From 2ba10cce1220b31ebba4e75d36f172050c07eb4b Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Wed, 11 Nov 2026 09:07:11 -0800 Subject: [PATCH] chore!: rename Fanout to Pitot Adopt Pitot and pitot.dev to avoid a conflicting third-party mark. Rename the module, command, public contracts, packaging and documentation together while preserving stored data, sessions and token formats. Keep legacy environment names for the first Pitot alpha with names-only deprecation warnings. --- .dockerignore | 2 +- .env.example | 282 +++++++++--------- .github/ISSUE_TEMPLATE/bug_report.yml | 4 +- .github/ISSUE_TEMPLATE/config.yml | 4 +- .github/ISSUE_TEMPLATE/feature_request.yml | 4 +- .github/pull_request_template.md | 2 +- .github/workflows/ci.yml | 8 +- .github/workflows/cla.yml | 2 +- .github/workflows/release.yml | 44 +-- .github/workflows/site.yml | 12 +- .gitignore | 4 +- .gitleaks.toml | 4 +- AGENTS.md | 16 +- CHANGELOG.md | 40 +++ CLA.md | 2 +- CODE_OF_CONDUCT.md | 2 +- CONTRIBUTING.md | 18 +- Dockerfile | 28 +- NOTICE | 2 +- README.md | 158 +++++----- SECURITY.md | 12 +- SUPPORT.md | 4 +- THIRD_PARTY_NOTICES | 4 +- TRADEMARK.md | 30 +- .../fragment_contract_docs_test.go | 0 cmd/{fanout-docgen => pitot-docgen}/groups.go | 2 +- cmd/{fanout-docgen => pitot-docgen}/main.go | 51 ++-- .../main_test.go | 10 +- .../mcptools.go | 12 +- cmd/{fanout-docgen => pitot-docgen}/roles.go | 18 +- cmd/{fanout-docgen => pitot-docgen}/routes.go | 18 +- .../routes_test.go | 4 +- cmd/{fanout => pitot}/main.go | 98 +++--- cmd/{fanout => pitot}/main_test.go | 80 ++--- cmd/{fanout => pitot}/setup_banner_test.go | 2 +- context7.json | 8 +- .../0001-environment-only-configuration.md | 8 +- .../0002-sqlite-goose-sqlc-control-state.md | 2 +- .../0003-pinned-duckdb-and-batch-format-4.md | 2 +- docs/adr/0005-calver-releases.md | 2 +- docs/authentication.md | 126 ++++---- docs/diagrams/architecture.json | 14 +- docs/diagrams/architecture.svg | 66 ++-- docs/diagrams/persistence.json | 12 +- docs/media/social-card.typ | 4 +- docs/operations.md | 154 +++++----- docs/proposals/0001-logged-in-ui-shell.md | 6 +- docs/proposals/0002-agent-dashboards.md | 22 +- docs/proposals/0003-agent-dashboards-m5.md | 10 +- docs/proposals/0004-fanql.md | 6 +- .../0005-dedicated-attribute-columns.md | 16 +- docs/release.md | 55 +++- docs/testing.md | 24 +- go.mod | 2 +- internal/agent/answer_only_test.go | 10 +- internal/agent/committed_panic_test.go | 10 +- internal/agent/dashboard_eval_golden_test.go | 22 +- internal/agent/fragment_content_test.go | 22 +- internal/agent/narration_test.go | 12 +- internal/agent/provider_contract_test.go | 6 +- internal/agent/provider_http.go | 2 +- internal/agent/provider_http_test.go | 2 +- internal/agent/run_context_test.go | 4 +- internal/agent/runtime.go | 18 +- internal/agent/runtime_log_test.go | 4 +- internal/agent/runtime_test.go | 16 +- internal/agent/service_input_test.go | 24 +- internal/agent/store_test.go | 16 +- internal/agent/tool_error_structure_test.go | 6 +- internal/agent/tools.go | 28 +- internal/agent/tools_integration_test.go | 30 +- internal/alert/email.go | 8 +- internal/alert/email_test.go | 2 +- internal/alert/engine.go | 4 +- internal/alert/engine_env_test.go | 2 +- internal/alert/engine_test.go | 2 +- internal/alert/store.go | 4 +- internal/alert/store_test.go | 2 +- internal/alert/types.go | 2 +- internal/annotations/service.go | 2 +- internal/annotations/service_test.go | 2 +- internal/api/account_ownership_test.go | 10 +- internal/api/alerts.go | 4 +- internal/api/alerts_email_test.go | 4 +- internal/api/alerts_test.go | 4 +- internal/api/annotations.go | 2 +- internal/api/annotations_test.go | 4 +- internal/api/auth.go | 10 +- internal/api/auth_middleware.go | 6 +- internal/api/auth_test.go | 20 +- internal/api/dashboard.go | 8 +- internal/api/dashboard_history_test.go | 6 +- internal/api/dashboard_test.go | 8 +- internal/api/errors.go | 2 +- internal/api/errors_test.go | 2 +- internal/api/fanql.go | 4 +- internal/api/fanql_corpus_test.go | 6 +- internal/api/fanql_test.go | 6 +- internal/api/health.go | 6 +- internal/api/health_test.go | 18 +- internal/api/intelligence.go | 2 +- internal/api/intelligence_test.go | 4 +- internal/api/mcp_conformance_test.go | 28 +- internal/api/mcp_policy.go | 2 +- internal/api/mcp_policy_test.go | 50 ++-- internal/api/oauth.go | 20 +- internal/api/oauth_test.go | 50 ++-- internal/api/oidc.go | 4 +- internal/api/oidc_discovery_test.go | 12 +- internal/api/oidc_test.go | 40 +-- internal/api/presentation_test.go | 2 +- internal/api/queries.go | 2 +- internal/api/queries_test.go | 14 +- internal/api/query_request_errors_test.go | 2 +- internal/api/schema_busy_test.go | 2 +- internal/api/scim.go | 4 +- internal/api/scim_test.go | 14 +- internal/api/session_middleware_test.go | 12 +- internal/api/settings.go | 4 +- internal/api/settings_test.go | 16 +- internal/api/shared_listener_test.go | 12 +- internal/api/traces.go | 4 +- internal/api/traces_test.go | 6 +- internal/api/users.go | 14 +- internal/api/users_test.go | 4 +- internal/auth/alert_mail.go | 4 +- internal/auth/alert_mail_test.go | 6 +- internal/auth/audit.go | 4 +- internal/auth/code.go | 12 +- internal/auth/code_test.go | 4 +- internal/auth/identity_store.go | 4 +- internal/auth/oauth_scope.go | 2 +- internal/auth/oauth_scope_test.go | 6 +- internal/auth/oauth_store.go | 4 +- internal/auth/oauth_store_test.go | 56 ++-- internal/auth/provisioning.go | 6 +- internal/auth/provisioning_test.go | 2 +- internal/auth/session.go | 3 +- internal/auth/session_test.go | 2 +- internal/auth/setup.go | 2 +- internal/auth/smtp.go | 26 +- internal/auth/smtp_test.go | 24 +- internal/auth/user_store.go | 6 +- internal/auth/user_store_test.go | 2 +- internal/brand/brand.go | 16 +- internal/brand/testdata/favicon.svg | 2 +- internal/cmd/dbmigrate/main.go | 4 +- internal/cmd/e2eseed/main.go | 2 +- internal/cmd/e2eseed/main_test.go | 16 +- internal/cmd/notices/main.go | 10 +- internal/cmd/notices/main_test.go | 2 +- internal/cmd/semconvgen/main.go | 2 +- internal/cmd/semconvgen/main_test.go | 2 +- internal/config/config.go | 251 ++++++++-------- internal/config/config_test.go | 221 ++++++++++---- internal/config/loader.go | 59 +++- internal/config/pinned_memory_test.go | 2 +- internal/config/provider_test.go | 20 +- internal/config/sizing.go | 14 +- internal/config/sizing_test.go | 12 +- internal/dashboard/changes.go | 2 +- internal/dashboard/changes_test.go | 2 +- internal/dashboard/concurrent_test.go | 6 +- internal/dashboard/defaults.go | 4 +- internal/dashboard/defaults_test.go | 14 +- internal/dashboard/edit.go | 2 +- internal/dashboard/edit_test.go | 2 +- internal/dashboard/identity.go | 10 +- internal/dashboard/layout.go | 2 +- internal/dashboard/layout_constraints_test.go | 2 +- internal/dashboard/layout_test.go | 2 +- internal/dashboard/origin_test.go | 2 +- internal/dashboard/resource_inventory_test.go | 18 +- internal/dashboard/service.go | 6 +- internal/dashboard/service_test.go | 4 +- internal/dashboard/write_constraints_test.go | 2 +- internal/db/dashboards_schema_test.go | 4 +- internal/duckdb/native.go | 4 +- internal/engine/analytical_backlog_test.go | 8 +- .../engine/annotation_maintenance_test.go | 10 +- internal/engine/annotations.go | 10 +- internal/engine/annotations_test.go | 10 +- internal/engine/backlog_pressure_test.go | 20 +- internal/engine/batch_cache.go | 14 +- .../engine/compaction_cache_transfer_test.go | 2 +- internal/engine/compaction_stall_test.go | 2 +- internal/engine/dashboard_rollup_test.go | 6 +- internal/engine/duck.go | 20 +- internal/engine/duck_memory.go | 2 +- internal/engine/duck_memory_test.go | 12 +- internal/engine/duck_test.go | 14 +- internal/engine/edge_arrival_test.go | 4 +- internal/engine/edge_backlog_test.go | 8 +- internal/engine/edge_parent_plan_test.go | 4 +- internal/engine/edge_tick_test.go | 8 +- internal/engine/file_snapshot.go | 8 +- internal/engine/file_snapshot_bench_test.go | 8 +- internal/engine/file_snapshot_test.go | 14 +- internal/engine/metric_names.go | 2 +- internal/engine/metric_names_test.go | 6 +- internal/engine/panel_sql_test.go | 6 +- internal/engine/peer_rollup_test.go | 4 +- internal/engine/progress.go | 10 +- internal/engine/progress_test.go | 2 +- internal/engine/querytest/tables.go | 2 +- internal/engine/read_order_test.go | 2 +- internal/engine/read_pressure_test.go | 6 +- internal/engine/read_setup_test.go | 2 +- internal/engine/receiver_rollup_bench_test.go | 8 +- internal/engine/receiver_rollup_test.go | 6 +- internal/engine/resource_inventory.go | 4 +- .../resource_inventory_evidence_test.go | 14 +- internal/engine/resource_inventory_test.go | 6 +- internal/engine/retirement_test.go | 6 +- internal/engine/rollup_keys_test.go | 6 +- internal/engine/rollup_scale_test.go | 8 +- internal/engine/rollup_sparse_memory_test.go | 4 +- internal/engine/rollup_test.go | 2 +- internal/engine/rollup_watermark_test.go | 8 +- internal/engine/rollup_yield_test.go | 4 +- internal/engine/row_group_pruning_test.go | 6 +- internal/engine/span_rollup_test.go | 4 +- internal/engine/sql_functions_test.go | 4 +- internal/engine/sql_keys.go | 6 +- internal/engine/sql_keys_test.go | 6 +- internal/engine/stall_instrumentation_test.go | 10 +- internal/engine/tables_test.go | 2 +- internal/engine/timestamp_plan_test.go | 2 +- internal/engine/variant_boundary_test.go | 8 +- internal/engine/variant_integration_test.go | 10 +- internal/engine/version_budget_test.go | 8 +- internal/engine/version_gate_test.go | 4 +- internal/engine/views.go | 2 +- internal/engine/views_schema_test.go | 2 +- internal/engine/watchdog_test.go | 4 +- internal/engine/writegate/write_gate.go | 2 +- internal/engine/writegate/write_gate_test.go | 8 +- internal/fanql/ast.go | 2 +- internal/fanql/bounds_test.go | 2 +- internal/fanql/complete.go | 4 +- internal/fanql/complete_test.go | 2 +- internal/fanql/corpus_test.go | 2 +- internal/fanql/diagnostic_copy_test.go | 2 +- internal/fanql/diagnostics_test.go | 2 +- internal/fanql/fanql.go | 4 +- internal/fanql/filter_exactness_test.go | 2 +- internal/fanql/format.go | 4 +- internal/fanql/format_copy_test.go | 2 +- internal/fanql/fuzz_test.go | 2 +- internal/fanql/hints_test.go | 2 +- internal/fanql/latency_test.go | 8 +- internal/fanql/lift.go | 6 +- internal/fanql/lift_test.go | 2 +- internal/fanql/literal_roundtrip_test.go | 2 +- internal/fanql/lower.go | 2 +- internal/fanql/lower_test.go | 2 +- internal/fanql/parser.go | 4 +- internal/fanql/parser_test.go | 2 +- internal/fanql/print.go | 4 +- internal/fanql/reference.go | 6 +- internal/fanql/reference_test.go | 4 +- internal/fanql/registry_growth_test.go | 2 +- internal/fanql/resolve.go | 8 +- internal/fanql/resolve_test.go | 2 +- internal/fanql/roundtrip_test.go | 4 +- internal/fanql/semantics_test.go | 14 +- internal/fanql/testhelpers_test.go | 8 +- internal/fanql/words.go | 2 +- internal/id/id.go | 2 +- internal/ingest/admission_bench_test.go | 6 +- internal/ingest/auth.go | 6 +- internal/ingest/auth_test.go | 8 +- internal/ingest/conversion_test.go | 6 +- internal/ingest/exponential_histogram_test.go | 4 +- internal/ingest/http.go | 2 +- internal/ingest/http_test.go | 10 +- internal/ingest/listener_test.go | 6 +- internal/ingest/metric_fidelity_test.go | 4 +- internal/ingest/nesting_test.go | 6 +- internal/ingest/server.go | 6 +- internal/ingest/server_test.go | 4 +- internal/ingest/shed_test.go | 4 +- internal/ingest/submitter_test.go | 4 +- internal/ingest/transport_bench_test.go | 12 +- internal/intelligence/annotations_test.go | 10 +- internal/intelligence/detector.go | 4 +- .../intelligence/detector_recovery_test.go | 10 +- internal/intelligence/effect_size_test.go | 2 +- internal/intelligence/parquet_test.go | 8 +- .../intelligence/pattern_recovery_test.go | 10 +- internal/intelligence/rollup_detector_test.go | 8 +- internal/mcp/apps.go | 4 +- internal/mcp/apps/panels.html | 8 +- internal/mcp/committed_panic_test.go | 4 +- internal/mcp/concurrent_receipts_test.go | 6 +- internal/mcp/dashboards.go | 6 +- internal/mcp/dashboards_tools_test.go | 6 +- internal/mcp/describe.go | 6 +- internal/mcp/describe_test.go | 4 +- internal/mcp/error_contract_test.go | 6 +- internal/mcp/fanql_resource.go | 4 +- internal/mcp/fanql_test.go | 12 +- internal/mcp/fragment_budget_test.go | 6 +- internal/mcp/fragment_contract_test.go | 4 +- internal/mcp/fragment_identity_test.go | 2 +- internal/mcp/fragments.go | 8 +- internal/mcp/fragments_test.go | 4 +- internal/mcp/history_test.go | 4 +- internal/mcp/http_cancellation_test.go | 10 +- internal/mcp/no_data_test.go | 6 +- internal/mcp/panel_examples_test.go | 10 +- internal/mcp/panels.go | 4 +- internal/mcp/panels_distribution_test.go | 2 +- internal/mcp/panels_test.go | 20 +- internal/mcp/pattern_context_guide_test.go | 2 +- internal/mcp/performance_operations_test.go | 10 +- internal/mcp/presentation_test.go | 6 +- internal/mcp/receipt_quality_test.go | 4 +- internal/mcp/receipts_test.go | 4 +- internal/mcp/server.go | 18 +- internal/mcp/server_test.go | 10 +- internal/mcp/service_input_test.go | 16 +- internal/mcp/tool_errors_test.go | 4 +- internal/metrics/duckdb_memory_test.go | 6 +- internal/metrics/metrics.go | 110 +++---- internal/metrics/metrics_test.go | 8 +- internal/metrics/panels.go | 4 +- .../observability/batch_reads_bench_test.go | 10 +- internal/observability/batch_reads_test.go | 8 +- internal/observability/contracts.go | 2 +- internal/observability/dependencies_test.go | 6 +- internal/observability/health_trend.go | 2 +- internal/observability/service.go | 4 +- internal/observability/service_test.go | 6 +- internal/observability/sql_adapter_test.go | 2 +- internal/observability/topology.go | 2 +- internal/observability/topology_test.go | 6 +- internal/observability/trace.go | 4 +- internal/observability/trace_test.go | 4 +- internal/query/admission_test.go | 6 +- internal/query/annotation_scope_test.go | 2 +- internal/query/backlog_pressure_test.go | 22 +- internal/query/catalog.go | 6 +- internal/query/check.go | 2 +- internal/query/check_test.go | 2 +- internal/query/compile.go | 2 +- internal/query/compile_expr_test.go | 2 +- internal/query/compile_test.go | 6 +- internal/query/confidence_ranking_test.go | 4 +- internal/query/deploy_split.go | 2 +- internal/query/diagnose.go | 2 +- internal/query/diagnose_admission_test.go | 2 +- internal/query/diagnose_regression_test.go | 4 +- internal/query/diagnose_types_test.go | 4 +- internal/query/distribution_test.go | 4 +- internal/query/drill_logs_test.go | 2 +- internal/query/exec.go | 10 +- internal/query/exec_logging_test.go | 2 +- internal/query/exec_test.go | 2 +- internal/query/execution_limits_test.go | 14 +- internal/query/exemplar_bounds_test.go | 4 +- internal/query/exemplar_index_test.go | 6 +- internal/query/exemplars.go | 4 +- internal/query/exemplars_test.go | 2 +- internal/query/filter.go | 2 +- internal/query/filter_test.go | 4 +- internal/query/frame.go | 6 +- internal/query/items_test.go | 2 +- internal/query/log_redaction_test.go | 4 +- internal/query/log_source.go | 2 +- internal/query/log_window_test.go | 2 +- internal/query/measure.go | 4 +- internal/query/metric_crosscheck_test.go | 6 +- internal/query/metric_exponential_test.go | 2 +- internal/query/metric_histogram_test.go | 4 +- internal/query/metric_intervals_test.go | 4 +- internal/query/metric_kinds_golden_test.go | 2 +- internal/query/metric_measure_bench_test.go | 10 +- internal/query/metric_measures_test.go | 2 +- internal/query/metric_schema_test.go | 2 +- internal/query/metric_series_test.go | 4 +- internal/query/metric_unit.go | 2 +- internal/query/metric_unit_test.go | 2 +- internal/query/metric_view_test.go | 2 +- internal/query/panel_bench_data_test.go | 12 +- internal/query/panel_bench_test.go | 12 +- internal/query/pattern_context_test.go | 4 +- internal/query/preview_patterns_test.go | 2 +- internal/query/ranking_expr_test.go | 2 +- internal/query/result_cache.go | 8 +- internal/query/result_cache_test.go | 6 +- internal/query/rollup_compile_test.go | 6 +- internal/query/rollup_panels.go | 2 +- internal/query/rollup_panels_test.go | 4 +- internal/query/rowpanels_test.go | 2 +- internal/query/schema.go | 6 +- internal/query/schema_discovery_test.go | 4 +- internal/query/schema_test.go | 4 +- internal/query/service_input.go | 2 +- internal/query/shape.go | 2 +- internal/query/spec.go | 4 +- internal/query/sqlpanel.go | 2 +- internal/query/sqlpanel_plan.go | 2 +- internal/query/table_semantics_test.go | 2 +- internal/query/table_trends.go | 2 +- internal/query/table_trends_test.go | 4 +- internal/query/testhelpers_test.go | 12 +- internal/query/trace_exclude_test.go | 2 +- internal/query/variables.go | 2 +- internal/server/clientca.go | 12 +- internal/server/clientca_test.go | 2 +- internal/server/http.go | 2 +- internal/settings/ingest.go | 10 +- internal/settings/ingest_test.go | 8 +- internal/settings/store.go | 4 +- internal/store/store.go | 2 +- internal/telemetry/coerce_test.go | 2 +- internal/telemetry/columns.go | 3 +- internal/telemetry/compaction_debt_test.go | 4 +- internal/telemetry/compaction_metrics_test.go | 2 +- internal/telemetry/merge_lists_test.go | 2 +- internal/telemetry/parquet.go | 2 +- internal/telemetry/parquet_bytes_test.go | 2 +- internal/telemetry/parquet_codec.go | 2 +- internal/telemetry/parquet_writer.go | 2 +- internal/telemetry/rows.go | 2 +- internal/telemetry/semconv_columns_test.go | 2 +- internal/telemetry/store/admission.go | 4 +- internal/telemetry/store/admission_test.go | 2 +- internal/telemetry/store/backpressure_test.go | 2 +- internal/telemetry/store/batch_bytes_test.go | 2 +- internal/telemetry/store/compaction.go | 4 +- .../telemetry/store/compaction_bytes_test.go | 2 +- .../telemetry/store/compaction_day_test.go | 2 +- .../store/compaction_preemption_test.go | 2 +- .../store/compaction_pressure_test.go | 2 +- .../store/compaction_starvation_test.go | 2 +- internal/telemetry/store/publication_test.go | 2 +- .../telemetry/store/read_pressure_test.go | 2 +- internal/telemetry/store/repair.go | 2 +- internal/telemetry/store/repair_test.go | 2 +- internal/telemetry/store/repository.go | 8 +- internal/telemetry/store/repository_test.go | 2 +- internal/telemetry/store/writer.go | 4 +- .../telemetry/store/writer_accounting_test.go | 2 +- internal/telemetry/store/writer_test.go | 4 +- internal/telemetry/verify.go | 4 +- internal/telemetry/verify_test.go | 2 +- ...ton-Btk7J2NS.js => CopyButton-BIdC6qm1.js} | 2 +- ...ut-B7uemOf3.js => NumberInput-CixyOph4.js} | 2 +- .../{Table-Bid0E8qM.js => Table-D4ZwUno3.js} | 2 +- ...tarea-BewZUT1f.js => Textarea-r3wuKNbO.js} | 2 +- ...{alerts-Czm6Z0m8.js => alerts-CYKuszTJ.js} | 2 +- internal/ui/dist/assets/auth-DWqIkMZS.js | 1 + internal/ui/dist/assets/auth-K3NK-QpB.js | 1 - .../{brand-CCQ0JT0F.js => brand-D6fP-cLS.js} | 2 +- internal/ui/dist/assets/chat-Bv0H8gs5.js | 2 - internal/ui/dist/assets/chat-DMtvX_Pa.js | 2 + .../ui/dist/assets/chat._threadId-CEunwapm.js | 1 - .../ui/dist/assets/chat._threadId-D5uvUdcn.js | 1 + .../ui/dist/assets/chat.index-CEunwapm.js | 1 - .../ui/dist/assets/chat.index-D5uvUdcn.js | 1 + ....js => dashboard-change-chips-BJ-GZE9U.js} | 2 +- ...js => dashboards._dashboardId-C_KLDd8s.js} | 2 +- ...dyk0DX.js => dashboards.index-N7UkPeK5.js} | 2 +- ...iscard-BmoNOAJh.js => discard-NZfxCIcK.js} | 2 +- ...xplore-SPpRMYjX.js => explore-D4KpDh3K.js} | 2 +- ...{format-fsvZ_y78.js => format-BZjbsxwM.js} | 2 +- .../{index-C5SsAUtw.js => index-C1Pd14SU.js} | 6 +- ...rbdH.js => lazyRouteComponent-DiWTNBZT.js} | 2 +- .../{lib-8mi5olAL.js => lib-BLIvzI-_.js} | 2 +- ...CbLSAtC3.js => live-data-meta-CUyw2snU.js} | 2 +- ...zWruJF.js => loading-skeleton-D1hXpfUI.js} | 2 +- .../{logs-BlzRGSJn.js => logs-DQVfH3k6.js} | 2 +- ...-D0JRq0Ru.js => mcp-app-frame-C1fa0h58.js} | 4 +- ...-xnHgERfr.js => new-dashboard-D58ui2mw.js} | 2 +- .../{page-DI98kZbw.js => page-1Rod7OFH.js} | 2 +- .../{page-DZ5HGDWI.js => page-BABqeqdg.js} | 6 +- ...r-DZGJDQzo.js => panel-editor-BVRFoShZ.js} | 2 +- ...og-EDUaI5f8.js => save-dialog-Chbkq2Xp.js} | 2 +- ...{search-Bj_SOIkw.js => search-CDra9nG2.js} | 2 +- ...{search-DBgztReF.js => search-D_K9J6yO.js} | 2 +- ...ge-Cs7GeQyA.js => search-page-uYBxylji.js} | 2 +- internal/ui/dist/assets/settings-BhplbQY-.js | 16 + internal/ui/dist/assets/settings-CXC__vby.js | 16 - internal/ui/dist/assets/settings-D9KXz_MJ.js | 1 - internal/ui/dist/assets/settings-_0QC4d6a.js | 1 + .../dist/assets/settings_.ingest-7LDcHtKJ.js | 1 + .../dist/assets/settings_.ingest-BmeDHL8A.js | 1 - .../{theme-B_iWg-Ot.js => theme-DXTVNXHm.js} | 2 +- ...oolbar-DV2TSB0G.js => toolbar-DV46cPGs.js} | 4 +- ...{traces-BoRV7xaS.js => traces-DQY6WBcG.js} | 2 +- ...on-rZS3GfBb.js => useMutation-B1CTivyp.js} | 2 +- internal/ui/dist/favicon.svg | 2 +- internal/ui/dist/index.html | 18 +- internal/ui/ui.go | 2 +- justfile | 30 +- scripts/dashboard-eval/README.md | 16 +- scripts/dashboard-eval/main.test.ts | 4 +- scripts/dashboard-eval/main.ts | 6 +- scripts/dashboard-eval/mock.ts | 2 +- scripts/dashboard-eval/regressions.test.ts | 4 +- scripts/dashboard-eval/testdata/server.json | 2 +- scripts/dashboard-eval/transport.test.ts | 2 +- scripts/dashboard-eval/transport.ts | 6 +- scripts/dead-code-gates.test.ts | 10 +- scripts/diagrams.mjs | 4 +- scripts/go-build-tags_test.sh | 2 +- scripts/go-deadcode.allowlist | 2 +- scripts/install.sh | 58 ++-- scripts/install.test.ts | 41 +++ scripts/release-notes.sh | 2 +- scripts/release_test.sh | 6 +- scripts/{run-fanout.mjs => run-pitot.mjs} | 4 +- .../{run-fanout.test.ts => run-pitot.test.ts} | 28 +- scripts/site-origin.test.ts | 4 +- scripts/site-tables.test.ts | 2 +- scripts/test-names.test.ts | 2 +- scripts/ui-boundaries.test.ts | 2 +- scripts/ui-compare.test.ts | 2 +- server.json | 18 +- site/astro.config.mjs | 24 +- site/package-lock.json | 4 +- site/package.json | 2 +- site/public/diagrams/architecture.svg | 66 ++-- site/public/favicon.svg | 2 +- site/public/logo.svg | 4 +- site/public/robots.txt | 2 +- site/public/social-card.png | Bin 80664 -> 82587 bytes site/scripts/benchmark-data.mjs | 14 +- site/scripts/benchmark-data.test.mjs | 6 +- site/scripts/check-canonical.mjs | 2 +- site/scripts/check-docs-urls.mjs | 4 +- site/scripts/encode-clips.mjs | 2 +- site/scripts/fixtures/landing-media.json | 16 +- site/scripts/landing-recordings.md | 10 +- site/scripts/upload-clips.mjs | 4 +- site/scripts/upload-clips.test.mjs | 6 +- site/src/components/Analytics.astro | 14 +- site/src/components/AnalyticsConsent.astro | 4 +- site/src/components/AnalyticsPreference.astro | 2 +- site/src/components/Head.astro | 2 +- site/src/components/SiteFooter.astro | 4 +- site/src/components/landing/CopyButton.astro | 2 +- site/src/components/landing/CtaBar.astro | 4 +- site/src/components/landing/McpCommand.astro | 4 +- .../src/components/landing/ProductVideo.astro | 2 +- .../components/landing/ThroughputReplay.astro | 2 +- site/src/content.config.ts | 4 +- .../docs/docs/concepts/architecture.mdx | 6 +- .../docs/docs/concepts/authentication.mdx | 76 ++--- .../content/docs/docs/concepts/comparison.mdx | 24 +- .../docs/docs/concepts/performance.mdx | 30 +- .../content/docs/docs/concepts/storage.mdx | 32 +- .../docs/docs/get-started/first-boot.mdx | 24 +- .../content/docs/docs/get-started/install.mdx | 54 ++-- .../docs/docs/get-started/overview.mdx | 16 +- .../docs/docs/get-started/send-telemetry.mdx | 62 ++-- site/src/content/docs/docs/guides/alerts.mdx | 22 +- .../docs/docs/guides/backup-and-restore.mdx | 8 +- site/src/content/docs/docs/guides/chat.mdx | 10 +- .../content/docs/docs/guides/dashboards.mdx | 18 +- site/src/content/docs/docs/guides/deploy.mdx | 94 +++--- site/src/content/docs/docs/guides/explore.mdx | 2 +- .../content/docs/docs/guides/hardening.mdx | 22 +- site/src/content/docs/docs/guides/mcp.mdx | 44 +-- .../content/docs/docs/guides/retention.mdx | 10 +- site/src/content/docs/docs/guides/tls.mdx | 62 ++-- .../docs/docs/guides/troubleshooting.mdx | 40 +-- site/src/content/docs/docs/guides/upgrade.mdx | 75 +++-- site/src/content/docs/docs/help.mdx | 12 +- site/src/content/docs/docs/index.mdx | 8 +- .../docs/docs/reference/alert-expressions.mdx | 2 +- site/src/content/docs/docs/reference/api.mdx | 20 +- .../docs/docs/reference/capabilities.mdx | 20 +- site/src/content/docs/docs/reference/cli.mdx | 38 +-- .../docs/docs/reference/configuration.mdx | 56 ++-- .../docs/docs/reference/configuration/ai.mdx | 35 +-- .../docs/reference/configuration/alerts.mdx | 25 +- .../docs/reference/configuration/auth.mdx | 85 +++--- .../docs/reference/configuration/ingest.mdx | 23 +- .../docs/docs/reference/configuration/mcp.mdx | 11 +- .../docs/reference/configuration/metrics.mdx | 17 +- .../docs/reference/configuration/server.mdx | 57 ++-- .../docs/reference/configuration/smtp.mdx | 27 +- .../docs/reference/configuration/storage.mdx | 37 +-- .../docs/docs/reference/data-layout.mdx | 16 +- .../content/docs/docs/reference/endpoints.mdx | 18 +- site/src/content/docs/docs/reference/fanql.md | 2 +- site/src/content/docs/docs/reference/mcp.mdx | 22 +- .../src/content/docs/docs/reference/roles.mdx | 12 +- site/src/content/docs/index.mdx | 20 +- site/src/content/docs/privacy.mdx | 12 +- site/src/data/benchmark.ts | 62 ++-- site/src/data/landing-media.json | 16 +- site/src/lib/site-assets.ts | 2 +- site/src/pages/llms-full.txt.ts | 4 +- site/src/pages/llms.txt.ts | 14 +- site/src/starlight-route-data.ts | 2 +- site/src/styles/code-theme.mjs | 4 +- site/src/styles/{fanout.css => pitot.css} | 8 +- ui/host/.storybook/main.ts | 2 +- ui/host/.storybook/preview.tsx | 4 +- ui/host/bun.lock | 2 +- ui/host/e2e/data/mcp.json | 92 +++--- ui/host/e2e/failure-report.ts | 2 +- ui/host/e2e/fixtures/app.ts | 8 +- ui/host/e2e/host/index.html | 4 +- ui/host/e2e/host/main.ts | 4 +- ui/host/e2e/host/record.ts | 12 +- ui/host/e2e/host/server.mjs | 4 +- .../e2e/specs/app/landing-captures.spec.ts | 10 +- .../e2e/specs/app/landing-recordings.spec.ts | 20 +- ui/host/e2e/specs/app/performance.spec.ts | 14 +- ui/host/e2e/specs/app/screenshots.spec.ts | 4 +- ui/host/e2e/specs/app/smoke.spec.ts | 4 +- ui/host/e2e/specs/app/system-overview.spec.ts | 2 +- ui/host/e2e/specs/mcp/panels.spec.ts | 4 +- ui/host/e2e/support/accessibility-support.ts | 4 +- ui/host/e2e/support/app-lifecycle.test.ts | 14 +- ui/host/e2e/support/app-lifecycle.ts | 2 +- ui/host/e2e/support/app-server.ts | 2 +- ui/host/e2e/support/app-teardown.ts | 2 +- ui/host/e2e/support/app.setup.ts | 4 +- ui/host/e2e/support/chat-harness.ts | 6 +- ui/host/e2e/support/editor-contrast.test.ts | 6 +- ui/host/e2e/support/global-setup.ts | 38 +-- ui/host/e2e/support/harness.test.ts | 2 +- .../support/panel-sql-editor-support.test.ts | 2 +- .../e2e/support/panel-sql-editor-support.ts | 6 +- .../e2e/support/performance-support.test.ts | 8 +- ui/host/e2e/support/performance-support.ts | 6 +- ui/host/index.html | 2 +- ui/host/package.json | 4 +- ui/host/panels.html | 2 +- ui/host/playwright.config.ts | 6 +- ui/host/public/favicon.svg | 2 +- ui/host/src/answer-only.test.tsx | 6 +- ui/host/src/app-context.ts | 18 +- ui/host/src/app.test.tsx | 26 +- ui/host/src/app.tsx | 6 +- ui/host/src/auth-session.test.ts | 4 +- ui/host/src/auth-session.ts | 4 +- ui/host/src/auth.stories.tsx | 4 +- ui/host/src/auth.test.tsx | 50 ++-- ui/host/src/auth.tsx | 18 +- ui/host/src/brand.tsx | 8 +- ui/host/src/catalog/fixtures.ts | 2 +- ui/host/src/catalog/interactions.ts | 6 +- ui/host/src/catalog/requests.ts | 4 +- ui/host/src/chat-cards.stories.tsx | 6 +- ui/host/src/chat.test.tsx | 46 +-- ui/host/src/chat.tsx | 10 +- ui/host/src/connect-telemetry.tsx | 26 +- .../src/dashboards/chart-measurements-dev.ts | 8 +- ui/host/src/dashboards/echart-canvas.test.tsx | 14 +- ui/host/src/dashboards/echart-canvas.tsx | 2 +- ui/host/src/dashboards/fragment-view.test.tsx | 2 +- ui/host/src/dashboards/fullscreen.test.tsx | 4 +- ui/host/src/dashboards/grid.test.tsx | 10 +- ui/host/src/dashboards/history.test.tsx | 4 +- ui/host/src/dashboards/page.test.tsx | 6 +- ui/host/src/dashboards/page.tsx | 4 +- ui/host/src/dashboards/panel-card.tsx | 4 +- ui/host/src/dashboards/panel-chrome.test.tsx | 4 +- .../src/dashboards/panel-rendering.test.tsx | 2 +- .../src/dashboards/row-formatting.test.tsx | 8 +- .../service-map-readable-scale.test.tsx | 4 +- ui/host/src/dashboards/service-map.test.tsx | 30 +- ui/host/src/dashboards/shortcut-preference.ts | 1 + .../dashboards/trace/span-details.stories.tsx | 4 +- .../src/dashboards/trace/waterfall.test.tsx | 6 +- .../src/dashboards/use-panel-results.test.tsx | 16 +- ui/host/src/dashboards/viz/row-panel.test.tsx | 6 +- ui/host/src/main.tsx | 4 +- ui/host/src/mcp-app-content.test.ts | 10 +- ui/host/src/mcp-app-content.ts | 8 +- ui/host/src/mcp-app-frame.test.tsx | 6 +- ui/host/src/mcp-app-frame.tsx | 8 +- ui/host/src/mcp-apps/panel-app.tsx | 6 +- ui/host/src/mcp-apps/use-panel-app.ts | 2 +- ui/host/src/router.test.ts | 4 +- ui/host/src/settings.test.tsx | 22 +- ui/host/src/settings.tsx | 24 +- ui/host/src/shell-navigation.test.tsx | 2 +- ui/host/src/shell.tsx | 4 +- ui/host/src/shortcuts-event.ts | 2 +- ui/host/src/sql-editor/sql-language.ts | 2 +- ui/host/src/sql-editor/theme.test.ts | 6 +- ui/host/src/theme-render.test.tsx | 4 +- ui/host/src/theme-tokens.test.ts | 4 +- ui/host/src/theme.test.ts | 6 +- ui/host/tests/build-graph.test.ts | 8 +- ui/host/vite.apps.config.ts | 2 +- ui/host/vite.config.ts | 2 +- ui/links.ts | 10 +- ui/package.json | 2 +- ui/panels/units.ts | 4 +- ui/theme.ts | 8 +- 699 files changed, 3914 insertions(+), 3575 deletions(-) create mode 100644 CHANGELOG.md rename cmd/{fanout-docgen => pitot-docgen}/fragment_contract_docs_test.go (100%) rename cmd/{fanout-docgen => pitot-docgen}/groups.go (97%) rename cmd/{fanout-docgen => pitot-docgen}/main.go (91%) rename cmd/{fanout-docgen => pitot-docgen}/main_test.go (95%) rename cmd/{fanout-docgen => pitot-docgen}/mcptools.go (94%) rename cmd/{fanout-docgen => pitot-docgen}/roles.go (87%) rename cmd/{fanout-docgen => pitot-docgen}/routes.go (94%) rename cmd/{fanout-docgen => pitot-docgen}/routes_test.go (99%) rename cmd/{fanout => pitot}/main.go (89%) rename cmd/{fanout => pitot}/main_test.go (92%) rename cmd/{fanout => pitot}/setup_banner_test.go (92%) rename internal/ui/dist/assets/{CopyButton-Btk7J2NS.js => CopyButton-BIdC6qm1.js} (92%) rename internal/ui/dist/assets/{NumberInput-B7uemOf3.js => NumberInput-CixyOph4.js} (99%) rename internal/ui/dist/assets/{Table-Bid0E8qM.js => Table-D4ZwUno3.js} (98%) rename internal/ui/dist/assets/{Textarea-BewZUT1f.js => Textarea-r3wuKNbO.js} (96%) rename internal/ui/dist/assets/{alerts-Czm6Z0m8.js => alerts-CYKuszTJ.js} (96%) create mode 100644 internal/ui/dist/assets/auth-DWqIkMZS.js delete mode 100644 internal/ui/dist/assets/auth-K3NK-QpB.js rename internal/ui/dist/assets/{brand-CCQ0JT0F.js => brand-D6fP-cLS.js} (98%) delete mode 100644 internal/ui/dist/assets/chat-Bv0H8gs5.js create mode 100644 internal/ui/dist/assets/chat-DMtvX_Pa.js delete mode 100644 internal/ui/dist/assets/chat._threadId-CEunwapm.js create mode 100644 internal/ui/dist/assets/chat._threadId-D5uvUdcn.js delete mode 100644 internal/ui/dist/assets/chat.index-CEunwapm.js create mode 100644 internal/ui/dist/assets/chat.index-D5uvUdcn.js rename internal/ui/dist/assets/{dashboard-change-chips-DMsA4yET.js => dashboard-change-chips-BJ-GZE9U.js} (84%) rename internal/ui/dist/assets/{dashboards._dashboardId-Bw6ECcx6.js => dashboards._dashboardId-C_KLDd8s.js} (63%) rename internal/ui/dist/assets/{dashboards.index-CRdyk0DX.js => dashboards.index-N7UkPeK5.js} (56%) rename internal/ui/dist/assets/{discard-BmoNOAJh.js => discard-NZfxCIcK.js} (92%) rename internal/ui/dist/assets/{explore-SPpRMYjX.js => explore-D4KpDh3K.js} (57%) rename internal/ui/dist/assets/{format-fsvZ_y78.js => format-BZjbsxwM.js} (98%) rename internal/ui/dist/assets/{index-C5SsAUtw.js => index-C1Pd14SU.js} (94%) rename internal/ui/dist/assets/{lazyRouteComponent-DfXsrbdH.js => lazyRouteComponent-DiWTNBZT.js} (98%) rename internal/ui/dist/assets/{lib-8mi5olAL.js => lib-BLIvzI-_.js} (99%) rename internal/ui/dist/assets/{live-data-meta-CbLSAtC3.js => live-data-meta-CUyw2snU.js} (99%) rename internal/ui/dist/assets/{loading-skeleton-DEzWruJF.js => loading-skeleton-D1hXpfUI.js} (98%) rename internal/ui/dist/assets/{logs-BlzRGSJn.js => logs-DQVfH3k6.js} (59%) rename internal/ui/dist/assets/{mcp-app-frame-D0JRq0Ru.js => mcp-app-frame-C1fa0h58.js} (97%) rename internal/ui/dist/assets/{new-dashboard-xnHgERfr.js => new-dashboard-D58ui2mw.js} (81%) rename internal/ui/dist/assets/{page-DI98kZbw.js => page-1Rod7OFH.js} (99%) rename internal/ui/dist/assets/{page-DZ5HGDWI.js => page-BABqeqdg.js} (98%) rename internal/ui/dist/assets/{panel-editor-DZGJDQzo.js => panel-editor-BVRFoShZ.js} (92%) rename internal/ui/dist/assets/{save-dialog-EDUaI5f8.js => save-dialog-Chbkq2Xp.js} (99%) rename internal/ui/dist/assets/{search-Bj_SOIkw.js => search-CDra9nG2.js} (95%) rename internal/ui/dist/assets/{search-DBgztReF.js => search-D_K9J6yO.js} (99%) rename internal/ui/dist/assets/{search-page-Cs7GeQyA.js => search-page-uYBxylji.js} (94%) create mode 100644 internal/ui/dist/assets/settings-BhplbQY-.js delete mode 100644 internal/ui/dist/assets/settings-CXC__vby.js delete mode 100644 internal/ui/dist/assets/settings-D9KXz_MJ.js create mode 100644 internal/ui/dist/assets/settings-_0QC4d6a.js create mode 100644 internal/ui/dist/assets/settings_.ingest-7LDcHtKJ.js delete mode 100644 internal/ui/dist/assets/settings_.ingest-BmeDHL8A.js rename internal/ui/dist/assets/{theme-B_iWg-Ot.js => theme-DXTVNXHm.js} (99%) rename internal/ui/dist/assets/{toolbar-DV2TSB0G.js => toolbar-DV46cPGs.js} (99%) rename internal/ui/dist/assets/{traces-BoRV7xaS.js => traces-DQY6WBcG.js} (67%) rename internal/ui/dist/assets/{useMutation-rZS3GfBb.js => useMutation-B1CTivyp.js} (97%) create mode 100644 scripts/install.test.ts rename scripts/{run-fanout.mjs => run-pitot.mjs} (95%) rename scripts/{run-fanout.test.ts => run-pitot.test.ts} (80%) rename site/src/styles/{fanout.css => pitot.css} (99%) diff --git a/.dockerignore b/.dockerignore index 27012c3b3..d59d1d7c6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -17,7 +17,7 @@ data/ /.cache/ telemetry.test bin/ -fanout +pitot ui/host/dist/ # Dev files diff --git a/.env.example b/.env.example index cdc6b4f36..30cf4029c 100644 --- a/.env.example +++ b/.env.example @@ -1,307 +1,307 @@ -# Generated by cmd/fanout-docgen from internal/config/config.go. +# Generated by cmd/pitot-docgen from internal/config/config.go. # Regenerate with just docs-generate; verify with just docs-generate-check. -# Fanout does not load dotenv files. Inject through your launcher or deployment. +# Pitot does not load dotenv files. Inject through your launcher or deployment. # Precedence: built-in defaults < nonempty environment values. # All settings require restart. Empty environment values mean no override. # Every entry is commented out so copying this template sets nothing, preserving image ENV. # Uncomment only settings you want to supply; use runtime secret injection for secrets. -# Local authentication requires FANOUT_AUTH_CODE_SECRET (32+ characters). -# Chat is disabled unless FANOUT_AI_PROVIDER selects anthropic or openai; its key is required. +# Local authentication requires PITOT_AUTH_CODE_SECRET (32+ characters). +# Chat is disabled unless PITOT_AI_PROVIDER selects anthropic or openai; its key is required. # ANTHROPIC_API_KEY; string; secret -# Required when FANOUT_AI_PROVIDER is anthropic. +# Required when PITOT_AI_PROVIDER is anthropic. # Default: (empty) # ANTHROPIC_API_KEY= # Alternatively set ANTHROPIC_API_KEY_FILE to a secret file path; do not set both. # ANTHROPIC_BASE_URL; string -# Defaults to https://api.anthropic.com. Fanout appends /v1/messages, preserving any gateway path prefix. Use an HTTP(S) base URL without embedded credentials, a query, or a fragment. +# Defaults to https://api.anthropic.com. Pitot appends /v1/messages, preserving any gateway path prefix. Use an HTTP(S) base URL without embedded credentials, a query, or a fragment. # Default: (empty) # ANTHROPIC_BASE_URL= -# FANOUT_ADDR; string +# OPENAI_API_KEY; string; secret +# Required when PITOT_AI_PROVIDER is openai. +# Default: (empty) +# OPENAI_API_KEY= +# Alternatively set OPENAI_API_KEY_FILE to a secret file path; do not set both. + +# OPENAI_BASE_URL; string +# Defaults to https://api.openai.com/v1. Pitot appends /responses, preserving the API version and any gateway path prefix. Use an HTTP(S) base URL without embedded credentials, a query, or a fragment. +# Default: (empty) +# OPENAI_BASE_URL= + +# PITOT_ADDR; string # Binds the browser, API, MCP, OTLP/gRPC and OTLP/HTTP listener. # Default: 127.0.0.1:7520 -# FANOUT_ADDR= +# PITOT_ADDR= -# FANOUT_AI_MODEL; string -# Overrides the provider's default: claude-sonnet-5-5 for Anthropic and gpt-6.1-sol for OpenAI. The OpenAI provider expects a reasoning model supporting reasoning.encrypted_content for stateless Responses replay. A 400 rejecting encrypted content is reported as a server-side configuration error; choose a compatible reasoning model with FANOUT_AI_MODEL. +# PITOT_AI_MODEL; string +# Overrides the provider's default: claude-sonnet-5-5 for Anthropic and gpt-6.1-sol for OpenAI. The OpenAI provider expects a reasoning model supporting reasoning.encrypted_content for stateless Responses replay. A 400 rejecting encrypted content is reported as a server-side configuration error; choose a compatible reasoning model with PITOT_AI_MODEL. # Default: (empty) -# FANOUT_AI_MODEL= +# PITOT_AI_MODEL= -# FANOUT_AI_PROVIDER; string +# PITOT_AI_PROVIDER; string # Enables chat by selecting exactly anthropic or openai. Empty disables chat. # Default: (empty) -# FANOUT_AI_PROVIDER= +# PITOT_AI_PROVIDER= -# FANOUT_ALERTS_EMAIL_DEFAULT_TO; string +# PITOT_ALERTS_EMAIL_DEFAULT_TO; string # A comma-separated list of addresses that receive alerts from rules with no webhook and no email recipients of their own; requires SMTP. # Default: (empty) -# FANOUT_ALERTS_EMAIL_DEFAULT_TO= +# PITOT_ALERTS_EMAIL_DEFAULT_TO= -# FANOUT_ALERTS_EMAIL_HOURLY_LIMIT; integer +# PITOT_ALERTS_EMAIL_HOURLY_LIMIT; integer # Caps the alert emails sent to one address in any rolling hour, across all rules. Notifications over the limit are suppressed, not delayed, and shown on the rule; 0 suppresses all alert email. # Default: 30 -# FANOUT_ALERTS_EMAIL_HOURLY_LIMIT= +# PITOT_ALERTS_EMAIL_HOURLY_LIMIT= -# FANOUT_ALERTS_ENABLED; boolean +# PITOT_ALERTS_ENABLED; boolean # Runs the alert evaluation engine. # Default: true -# FANOUT_ALERTS_ENABLED= +# PITOT_ALERTS_ENABLED= -# FANOUT_ALERTS_EVALUATION_INTERVAL; duration +# PITOT_ALERTS_EVALUATION_INTERVAL; duration # Schedules alert evaluation; use a Go duration of at least 1s. # Default: 30s -# FANOUT_ALERTS_EVALUATION_INTERVAL= +# PITOT_ALERTS_EVALUATION_INTERVAL= -# FANOUT_ALERTS_HISTORY_DAYS; integer +# PITOT_ALERTS_HISTORY_DAYS; integer # Sets alert history retention in days. # Default: 7 -# FANOUT_ALERTS_HISTORY_DAYS= +# PITOT_ALERTS_HISTORY_DAYS= -# FANOUT_AUTH_CODE_SECRET; string; secret +# PITOT_AUTH_CODE_SECRET; string; secret # Signs sign-in codes and login links; needs at least 32 characters in local mode and to issue or redeem OIDC break-glass links. # Default: (empty) -# FANOUT_AUTH_CODE_SECRET= -# Alternatively set FANOUT_AUTH_CODE_SECRET_FILE to a secret file path; do not set both. +# PITOT_AUTH_CODE_SECRET= +# Alternatively set PITOT_AUTH_CODE_SECRET_FILE to a secret file path; do not set both. -# FANOUT_AUTH_MODE; string +# PITOT_AUTH_MODE; string # Selects local sign-in or oidc; each mode validates its prerequisites. # Default: local -# FANOUT_AUTH_MODE= +# PITOT_AUTH_MODE= -# FANOUT_DATA_DIR; string +# PITOT_DATA_DIR; string # Stores telemetry, query state, and the control database. # Default: ./data -# FANOUT_DATA_DIR= +# PITOT_DATA_DIR= -# FANOUT_DEFAULT_NAMESPACE; string +# PITOT_DEFAULT_NAMESPACE; string # Supplies the namespace for telemetry without one. # Default: default -# FANOUT_DEFAULT_NAMESPACE= +# PITOT_DEFAULT_NAMESPACE= -# FANOUT_DUCKDB_MAX_CONNECTIONS; integer +# PITOT_DUCKDB_MAX_CONNECTIONS; integer # Caps the DuckDB read connection pool. Reads scan immutable Parquet concurrently; analytical and completed-batch writes use separate gates and connections. Zero selects available Go CPUs, bounded to 2–16. Startup logs and /readyz report the resolved pool size. # Default: 0 -# FANOUT_DUCKDB_MAX_CONNECTIONS= +# PITOT_DUCKDB_MAX_CONNECTIONS= -# FANOUT_DUCKDB_MEMORY; string +# PITOT_DUCKDB_MEMORY; string # Caps DuckDB's memory (e.g. "8GB"). Empty selects 60% of detected available memory, reserving headroom for Go. If detection fails, DuckDB uses its default with a process headroom adjustment. Startup logs and /readyz report the resolved budget and detection status. Set an explicit cap when memory limit detection is incomplete. # Default: (empty) -# FANOUT_DUCKDB_MEMORY= +# PITOT_DUCKDB_MEMORY= -# FANOUT_DUCKDB_THREADS; integer +# PITOT_DUCKDB_THREADS; integer # Caps DuckDB's global query worker pool. Zero selects one worker per CPU the process may run on (the affinity mask and cgroup quota, as GOMAXPROCS resolves them) rather than DuckDB's count of the machine's hardware threads. Set it to leave cores free for ingest on a query-heavy co-tenant host. # Default: 0 -# FANOUT_DUCKDB_THREADS= +# PITOT_DUCKDB_THREADS= -# FANOUT_HEALTHCHECK_CERT_FILE; string -# Selects the client certificate fanout healthcheck presents; requires FANOUT_HEALTHCHECK_KEY_FILE and FANOUT_TLS_CLIENT_CA_FILE. +# PITOT_HEALTHCHECK_CERT_FILE; string +# Selects the client certificate pitot healthcheck presents; requires PITOT_HEALTHCHECK_KEY_FILE and PITOT_TLS_CLIENT_CA_FILE. # Default: (empty) -# FANOUT_HEALTHCHECK_CERT_FILE= +# PITOT_HEALTHCHECK_CERT_FILE= -# FANOUT_HEALTHCHECK_KEY_FILE; string -# Selects the private key for FANOUT_HEALTHCHECK_CERT_FILE; requires FANOUT_HEALTHCHECK_CERT_FILE. +# PITOT_HEALTHCHECK_KEY_FILE; string +# Selects the private key for PITOT_HEALTHCHECK_CERT_FILE; requires PITOT_HEALTHCHECK_CERT_FILE. # Default: (empty) -# FANOUT_HEALTHCHECK_KEY_FILE= +# PITOT_HEALTHCHECK_KEY_FILE= -# FANOUT_INGEST_BATCH_SIZE; integer +# PITOT_INGEST_BATCH_SIZE; integer # Sets the group-commit row target; valid values are 1–50000. Individual requests remain atomic and can exceed this target. # Default: 50000 -# FANOUT_INGEST_BATCH_SIZE= +# PITOT_INGEST_BATCH_SIZE= -# FANOUT_INGEST_MAX_IN_FLIGHT_BYTES; integer +# PITOT_INGEST_MAX_IN_FLIGHT_BYTES; integer # Caps decoded telemetry held across concurrent requests until durable publication. Zero is unbounded. A single request is admitted when no other request holds budget, even if it exceeds the limit. # Default: 268435456 -# FANOUT_INGEST_MAX_IN_FLIGHT_BYTES= +# PITOT_INGEST_MAX_IN_FLIGHT_BYTES= -# FANOUT_INGEST_TOKEN; string; secret +# PITOT_INGEST_TOKEN; string; secret # Sets the first ingest token, named configuration, when none has ever existed, so an automated install accepts telemetry as soon as it starts. Use foi_ plus 43 base64url characters. Only its digest is stored. It is ignored once any token has existed, including a revoked one, so a restart cannot bring back a revoked token. # Default: (empty) -# FANOUT_INGEST_TOKEN= -# Alternatively set FANOUT_INGEST_TOKEN_FILE to a secret file path; do not set both. +# PITOT_INGEST_TOKEN= +# Alternatively set PITOT_INGEST_TOKEN_FILE to a secret file path; do not set both. -# FANOUT_MAINTENANCE_INTERVAL; duration +# PITOT_MAINTENANCE_INTERVAL; duration # Controls Parquet retention and compaction, and query-cache checkpointing. # Default: 1h -# FANOUT_MAINTENANCE_INTERVAL= +# PITOT_MAINTENANCE_INTERVAL= -# FANOUT_MCP_ENABLED; boolean +# PITOT_MCP_ENABLED; boolean # Serves the MCP endpoint at /mcp. # Default: true -# FANOUT_MCP_ENABLED= +# PITOT_MCP_ENABLED= -# FANOUT_METRICS_PUBLIC; boolean +# PITOT_METRICS_PUBLIC; boolean # Allows unauthenticated Prometheus scrapes. # Default: false -# FANOUT_METRICS_PUBLIC= +# PITOT_METRICS_PUBLIC= -# FANOUT_METRICS_TOKEN; string; secret +# PITOT_METRICS_TOKEN; string; secret # Authorizes Prometheus scrapes with a bearer token; optional when using an admin session. # Default: (empty) -# FANOUT_METRICS_TOKEN= -# Alternatively set FANOUT_METRICS_TOKEN_FILE to a secret file path; do not set both. +# PITOT_METRICS_TOKEN= +# Alternatively set PITOT_METRICS_TOKEN_FILE to a secret file path; do not set both. -# FANOUT_OIDC_ADMIN_GROUPS; string +# PITOT_OIDC_ADMIN_GROUPS; string # Lists identity-provider groups mapped to admin, separated by commas. # Default: (empty) -# FANOUT_OIDC_ADMIN_GROUPS= +# PITOT_OIDC_ADMIN_GROUPS= -# FANOUT_OIDC_ALLOWED_DOMAINS; string +# PITOT_OIDC_ALLOWED_DOMAINS; string # Lists allowed email domains, separated by commas; wildcard * requires verified email. # Default: (empty) -# FANOUT_OIDC_ALLOWED_DOMAINS= +# PITOT_OIDC_ALLOWED_DOMAINS= -# FANOUT_OIDC_ALLOWED_GROUPS; string +# PITOT_OIDC_ALLOWED_GROUPS; string # Lists allowed identity-provider groups, separated by commas. # Default: (empty) -# FANOUT_OIDC_ALLOWED_GROUPS= +# PITOT_OIDC_ALLOWED_GROUPS= -# FANOUT_OIDC_AUTO_PROVISION; boolean +# PITOT_OIDC_AUTO_PROVISION; boolean # Creates accounts on OIDC sign-in; requires an allowed group or domain. # Default: false -# FANOUT_OIDC_AUTO_PROVISION= +# PITOT_OIDC_AUTO_PROVISION= -# FANOUT_OIDC_CLIENT_ID; string -# Identifies Fanout's client registration; required in OIDC mode. +# PITOT_OIDC_CLIENT_ID; string +# Identifies Pitot's client registration; required in OIDC mode. # Default: (empty) -# FANOUT_OIDC_CLIENT_ID= +# PITOT_OIDC_CLIENT_ID= -# FANOUT_OIDC_CLIENT_SECRET; string; secret -# Authenticates Fanout's client registration; required in OIDC mode. +# PITOT_OIDC_CLIENT_SECRET; string; secret +# Authenticates Pitot's client registration; required in OIDC mode. # Default: (empty) -# FANOUT_OIDC_CLIENT_SECRET= -# Alternatively set FANOUT_OIDC_CLIENT_SECRET_FILE to a secret file path; do not set both. +# PITOT_OIDC_CLIENT_SECRET= +# Alternatively set PITOT_OIDC_CLIENT_SECRET_FILE to a secret file path; do not set both. -# FANOUT_OIDC_DEFAULT_ROLE; string +# PITOT_OIDC_DEFAULT_ROLE; string # Assigns viewer, operator, or admin to users without a group role mapping. # Default: viewer -# FANOUT_OIDC_DEFAULT_ROLE= +# PITOT_OIDC_DEFAULT_ROLE= -# FANOUT_OIDC_EMAIL_CLAIM; string +# PITOT_OIDC_EMAIL_CLAIM; string # Names the claim containing the user's email address. # Default: email -# FANOUT_OIDC_EMAIL_CLAIM= +# PITOT_OIDC_EMAIL_CLAIM= -# FANOUT_OIDC_EMAIL_VERIFICATION; string +# PITOT_OIDC_EMAIL_VERIFICATION; string # Selects required verified-email claims or issuer trust; issuer trust requires an allowlist. # Default: required -# FANOUT_OIDC_EMAIL_VERIFICATION= +# PITOT_OIDC_EMAIL_VERIFICATION= -# FANOUT_OIDC_ISSUER_URL; string -# Selects the identity provider issuer; required in OIDC mode. Fanout starts while it is unreachable and retries discovery; a mismatched issuer fails startup. +# PITOT_OIDC_ISSUER_URL; string +# Selects the identity provider issuer; required in OIDC mode. Pitot starts while it is unreachable and retries discovery; a mismatched issuer fails startup. # Default: (empty) -# FANOUT_OIDC_ISSUER_URL= +# PITOT_OIDC_ISSUER_URL= -# FANOUT_OIDC_OPERATOR_GROUPS; string +# PITOT_OIDC_OPERATOR_GROUPS; string # Lists identity-provider groups mapped to operator, separated by commas. # Default: (empty) -# FANOUT_OIDC_OPERATOR_GROUPS= +# PITOT_OIDC_OPERATOR_GROUPS= -# FANOUT_PPROF_ENABLED; boolean +# PITOT_PPROF_ENABLED; boolean # Exposes Go's net/http/pprof handlers at /debug/pprof/* for CPU/heap/mutex/goroutine profiling under load. Off by default; the routes require an admin browser session with operations:read. # Default: false -# FANOUT_PPROF_ENABLED= +# PITOT_PPROF_ENABLED= -# FANOUT_PUBLIC_URL; string +# PITOT_PUBLIC_URL; string # Sets the external browser origin, MCP token audience, and trusted MCP request origin. Required for OIDC; HTTPS is required with MCP. # Default: (empty) -# FANOUT_PUBLIC_URL= +# PITOT_PUBLIC_URL= -# FANOUT_QUERY_CACHE_TTL; duration +# PITOT_QUERY_CACHE_TTL; duration # The oldest a dashboard panel, exemplar or trace detail result served from memory may be, measured from the end of the time window it covers (for traces and exemplars, from when their run started). A result younger than half the TTL is served as is; one younger than the TTL is served while one background run refreshes it; an older one is rerun. A request with Cache-Control: no-cache, such as a dashboard's manual refresh, always reruns. Zero disables the cache; concurrent identical requests still share one execution. # Default: 10s -# FANOUT_QUERY_CACHE_TTL= +# PITOT_QUERY_CACHE_TTL= -# FANOUT_RETENTION_DAYS; integer +# PITOT_RETENTION_DAYS; integer # Sets telemetry retention in days; zero disables expiry. # Default: 30 -# FANOUT_RETENTION_DAYS= +# PITOT_RETENTION_DAYS= -# FANOUT_ROLLUP_INTERVAL; duration +# PITOT_ROLLUP_INTERVAL; duration # Schedules analytical rollups; use a Go duration of at least 1s. # Default: 1m -# FANOUT_ROLLUP_INTERVAL= +# PITOT_ROLLUP_INTERVAL= -# FANOUT_ROLLUP_SKIP_TO_LATEST; boolean +# PITOT_ROLLUP_SKIP_TO_LATEST; boolean # Set once at boot, this advances the service and edge rollup watermarks to the current max ingested timestamp. Existing history is not aggregated into those analytical rollups. Completed-batch trace caches still rebuild all retained history in bounded passes; uncached files remain immediately queryable. Useful for large pre-seeded datasets (benchmarks, restores); off in normal operation. # Default: false -# FANOUT_ROLLUP_SKIP_TO_LATEST= +# PITOT_ROLLUP_SKIP_TO_LATEST= -# FANOUT_SCIM_TOKEN; string; secret +# PITOT_SCIM_TOKEN; string; secret # Enables SCIM 2.0 user provisioning under /scim/v2 and turns off browser setup; requires OIDC mode and at least 32 characters. # Default: (empty) -# FANOUT_SCIM_TOKEN= -# Alternatively set FANOUT_SCIM_TOKEN_FILE to a secret file path; do not set both. +# PITOT_SCIM_TOKEN= +# Alternatively set PITOT_SCIM_TOKEN_FILE to a secret file path; do not set both. -# FANOUT_SELF_SIGNUP; boolean +# PITOT_SELF_SIGNUP; boolean # Allows verified email addresses to create viewer accounts; requires local auth and SMTP. # Default: false -# FANOUT_SELF_SIGNUP= +# PITOT_SELF_SIGNUP= -# FANOUT_SESSION_ABSOLUTE_TTL; duration -# Limits total session lifetime; it must be at least FANOUT_SESSION_IDLE_TTL. +# PITOT_SESSION_ABSOLUTE_TTL; duration +# Limits total session lifetime; it must be at least PITOT_SESSION_IDLE_TTL. # Default: 168h -# FANOUT_SESSION_ABSOLUTE_TTL= +# PITOT_SESSION_ABSOLUTE_TTL= -# FANOUT_SESSION_IDLE_TTL; duration +# PITOT_SESSION_IDLE_TTL; duration # Expires inactive sessions; use a Go duration of at least 5m. # Default: 12h -# FANOUT_SESSION_IDLE_TTL= +# PITOT_SESSION_IDLE_TTL= -# FANOUT_SMTP_FROM; string +# PITOT_SMTP_FROM; string # Sets the email sender address; required with SMTP. # Default: (empty) -# FANOUT_SMTP_FROM= +# PITOT_SMTP_FROM= -# FANOUT_SMTP_HOST; string +# PITOT_SMTP_HOST; string # Selects the mail server. Host, username, password, and from must all be set to enable SMTP. # Default: (empty) -# FANOUT_SMTP_HOST= +# PITOT_SMTP_HOST= -# FANOUT_SMTP_PASSWORD; string; secret +# PITOT_SMTP_PASSWORD; string; secret # Authenticates to the mail server; required with SMTP. # Default: (empty) -# FANOUT_SMTP_PASSWORD= -# Alternatively set FANOUT_SMTP_PASSWORD_FILE to a secret file path; do not set both. +# PITOT_SMTP_PASSWORD= +# Alternatively set PITOT_SMTP_PASSWORD_FILE to a secret file path; do not set both. -# FANOUT_SMTP_PORT; integer +# PITOT_SMTP_PORT; integer # Sets the mail server's positive TCP port. # Default: 587 -# FANOUT_SMTP_PORT= +# PITOT_SMTP_PORT= -# FANOUT_SMTP_USERNAME; string +# PITOT_SMTP_USERNAME; string # Authenticates to the mail server; required with SMTP. # Default: (empty) -# FANOUT_SMTP_USERNAME= +# PITOT_SMTP_USERNAME= -# FANOUT_TLS_CERT_FILE; string -# Selects the TLS certificate file; requires FANOUT_TLS_KEY_FILE. +# PITOT_TLS_CERT_FILE; string +# Selects the TLS certificate file; requires PITOT_TLS_KEY_FILE. # Default: (empty) -# FANOUT_TLS_CERT_FILE= +# PITOT_TLS_CERT_FILE= -# FANOUT_TLS_CLIENT_CA_FILE; string -# Selects a PEM CA bundle; when set, the listener requires client certificates signed by it. Requires FANOUT_TLS_CERT_FILE and FANOUT_TLS_KEY_FILE. +# PITOT_TLS_CLIENT_CA_FILE; string +# Selects a PEM CA bundle; when set, the listener requires client certificates signed by it. Requires PITOT_TLS_CERT_FILE and PITOT_TLS_KEY_FILE. # Default: (empty) -# FANOUT_TLS_CLIENT_CA_FILE= +# PITOT_TLS_CLIENT_CA_FILE= -# FANOUT_TLS_KEY_FILE; string -# Selects the TLS private key file; requires FANOUT_TLS_CERT_FILE. +# PITOT_TLS_KEY_FILE; string +# Selects the TLS private key file; requires PITOT_TLS_CERT_FILE. # Default: (empty) -# FANOUT_TLS_KEY_FILE= +# PITOT_TLS_KEY_FILE= -# FANOUT_TRUSTED_PROXY_CIDRS; string +# PITOT_TRUSTED_PROXY_CIDRS; string # Lists trusted proxy networks, separated by commas; empty trusts no forwarded client addresses. # Default: (empty) -# FANOUT_TRUSTED_PROXY_CIDRS= - -# OPENAI_API_KEY; string; secret -# Required when FANOUT_AI_PROVIDER is openai. -# Default: (empty) -# OPENAI_API_KEY= -# Alternatively set OPENAI_API_KEY_FILE to a secret file path; do not set both. - -# OPENAI_BASE_URL; string -# Defaults to https://api.openai.com/v1. Fanout appends /responses, preserving the API version and any gateway path prefix. Use an HTTP(S) base URL without embedded credentials, a query, or a fragment. -# Default: (empty) -# OPENAI_BASE_URL= +# PITOT_TRUSTED_PROXY_CIDRS= diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index ab8306c75..2d5f5ef9d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,5 +1,5 @@ name: Bug report -description: Report a reproducible problem in Fanout OSS +description: Report a reproducible problem in Pitot OSS title: "bug: " labels: [bug] body: @@ -9,7 +9,7 @@ body: - type: input id: version attributes: - label: Fanout version + label: Pitot version description: Release tag, image digest, or commit SHA. validations: required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index c34101684..9f38e66bf 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,8 +1,8 @@ blank_issues_enabled: false contact_links: - name: Setup and deployment questions - url: https://github.com/labstack/fanout/discussions + url: https://github.com/labstack/pitot/discussions about: Ask the community before filing a product defect. - name: Security vulnerability - url: https://github.com/labstack/fanout/security/advisories/new + url: https://github.com/labstack/pitot/security/advisories/new about: Report vulnerabilities privately; never put secrets in an issue. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 14bc7997c..161312b51 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,5 +1,5 @@ name: Feature request -description: Propose a broadly useful Fanout OSS improvement +description: Propose a broadly useful Pitot OSS improvement title: "feat: " labels: [enhancement] body: @@ -14,7 +14,7 @@ body: id: users attributes: label: Who benefits? - description: Explain why this is useful to typical self-hosted Fanout users. + description: Explain why this is useful to typical self-hosted Pitot users. validations: required: true - type: textarea diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index bd28edd9c..5bb211d94 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,6 +1,6 @@ ## What changed - + ## Verification diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1d7c4f12..a677a44c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -234,7 +234,7 @@ jobs: if: matrix.slug != 'catalog' run: just e2e ${{ matrix.args }} env: - FANOUT_E2E_SKIP_PERFORMANCE: ${{ matrix.skip_performance }} + PITOT_E2E_SKIP_PERFORMANCE: ${{ matrix.skip_performance }} - name: Upload browser evidence if: always() uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 @@ -292,14 +292,14 @@ jobs: context: . load: true push: false - tags: fanout:ci + tags: pitot:ci build-args: VERSION=sha-${{ github.event.pull_request.head.sha || github.sha }} cache-from: type=gha cache-to: type=gha,mode=max - name: Scan the runtime image uses: aquasecurity/trivy-action@a9c7b0f06e461e9d4b4d1711f154ee024b8d7ab8 # v0.36.0 with: - image-ref: fanout:ci + image-ref: pitot:ci version: v0.74.0 scanners: vuln,secret severity: HIGH,CRITICAL @@ -323,7 +323,7 @@ jobs: id: meta uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 with: - images: ghcr.io/labstack/fanout + images: ghcr.io/labstack/pitot tags: | type=ref,event=branch type=sha,prefix=sha- diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 27ed0cb27..202273c0a 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -30,7 +30,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - path-to-document: https://github.com/labstack/fanout/blob/main/CLA.md + path-to-document: https://github.com/labstack/pitot/blob/main/CLA.md path-to-signatures: signatures.json # Signatures live on their own branch. Storing them on main would put # a bot commit into the release history and trigger a CI run plus an diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12d5538a2..e87eb01b3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,8 +13,8 @@ permissions: contents: read env: - IMAGE: ghcr.io/labstack/fanout - DOCKERHUB_IMAGE: docker.io/labstack/fanout + IMAGE: ghcr.io/labstack/pitot + DOCKERHUB_IMAGE: docker.io/labstack/pitot MCP_PUBLISHER_VERSION: "1.8.1" MCP_PUBLISHER_LINUX_AMD64_SHA256: "a06c9096dcb9727c13555b6be26c7effa707b01f06a4c561ba7a3635443cf2cc" @@ -149,20 +149,20 @@ jobs: version="${GITHUB_REF_NAME}" bash scripts/with-duckdb.sh go test ./internal/engine -run 'TestPinnedEngine|TestSQLBoundary' -count=1 mkdir -p stage - bash scripts/with-duckdb.sh go build -trimpath -ldflags "-s -w -X main.version=${version}" -o stage/fanout ./cmd/fanout + bash scripts/with-duckdb.sh go build -trimpath -ldflags "-s -w -X main.version=${version}" -o stage/pitot ./cmd/pitot for doc in LICENSE NOTICE README.md THIRD_PARTY_NOTICES TRADEMARK.md; do if [ -f "${doc}" ]; then cp "${doc}" stage/; fi done - tar -czf "fanout_${version}_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz" -C stage . + tar -czf "pitot_${version}_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz" -C stage . - name: Smoke test the binary run: | set -euo pipefail - got="$(./stage/fanout -version)" + got="$(./stage/pitot -version)" [ "${got}" = "${GITHUB_REF_NAME}" ] || { echo "version = ${got}, want ${GITHUB_REF_NAME}"; exit 1; } - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: - name: fanout_${{ matrix.goos }}_${{ matrix.goarch }} - path: fanout_*.tar.gz + name: pitot_${{ matrix.goos }}_${{ matrix.goarch }} + path: pitot_*.tar.gz if-no-files-found: error # Each image layer is built natively and the two are joined into one manifest, @@ -326,7 +326,7 @@ jobs: - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: path: artifacts - pattern: fanout_* + pattern: pitot_* merge-multiple: true - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: @@ -336,8 +336,8 @@ jobs: run: | set -euo pipefail cd artifacts - ls -1 fanout_*.tar.gz - sha256sum fanout_*.tar.gz > SHA256SUMS + ls -1 pitot_*.tar.gz + sha256sum pitot_*.tar.gz > SHA256SUMS cat SHA256SUMS - name: Attest archives and checksum manifest uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2 @@ -356,7 +356,7 @@ jobs: --notes "$(cat notes/upgrade-notes.md)" \ --generate-notes \ --verify-tag \ - artifacts/fanout_*.tar.gz artifacts/SHA256SUMS + artifacts/pitot_*.tar.gz artifacts/SHA256SUMS verify-release: name: verify public release @@ -373,13 +373,13 @@ jobs: tmp="$(mktemp -d)" trap 'rm -rf "${tmp}"' EXIT cd "${tmp}" - base="https://github.com/labstack/fanout/releases/download/${VERSION}" + base="https://github.com/labstack/pitot/releases/download/${VERSION}" curl -fsSLO "${base}/SHA256SUMS" for target in linux_amd64 linux_arm64 darwin_amd64 darwin_arm64; do - curl -fsSLO "${base}/fanout_${VERSION}_${target}.tar.gz" + curl -fsSLO "${base}/pitot_${VERSION}_${target}.tar.gz" done sha256sum -c SHA256SUMS - for archive in fanout_*.tar.gz; do + for archive in pitot_*.tar.gz; do listing="${archive}.contents" tar -tzf "${archive}" > "${listing}" for document in LICENSE NOTICE README.md THIRD_PARTY_NOTICES TRADEMARK.md; do @@ -390,8 +390,8 @@ jobs: done done mkdir native - tar -xzf "fanout_${VERSION}_linux_amd64.tar.gz" -C native ./fanout - [ "$(native/fanout -version)" = "${VERSION}" ] + tar -xzf "pitot_${VERSION}_linux_amd64.tar.gz" -C native ./pitot + [ "$(native/pitot -version)" = "${VERSION}" ] - name: Verify the public installer env: VERSION: ${{ github.ref_name }} @@ -399,9 +399,9 @@ jobs: set -euo pipefail tmp="$(mktemp -d)" trap 'rm -rf "${tmp}"' EXIT - curl -fsSL "https://raw.githubusercontent.com/labstack/fanout/${VERSION}/scripts/install.sh" -o "${tmp}/install.sh" - FANOUT_VERSION="${VERSION}" FANOUT_PREFIX="${tmp}/bin" sh "${tmp}/install.sh" - [ "$("${tmp}/bin/fanout" -version)" = "${VERSION}" ] + curl -fsSL "https://raw.githubusercontent.com/labstack/pitot/${VERSION}/scripts/install.sh" -o "${tmp}/install.sh" + PITOT_VERSION="${VERSION}" PITOT_PREFIX="${tmp}/bin" sh "${tmp}/install.sh" + [ "$("${tmp}/bin/pitot" -version)" = "${VERSION}" ] - name: Verify GitHub build provenance env: GH_TOKEN: ${{ github.token }} @@ -411,11 +411,11 @@ jobs: tmp="$(mktemp -d)" trap 'rm -rf "${tmp}"' EXIT cd "${tmp}" - base="https://github.com/labstack/fanout/releases/download/${VERSION}" + base="https://github.com/labstack/pitot/releases/download/${VERSION}" for target in linux_amd64 linux_arm64 darwin_amd64 darwin_arm64; do - archive="fanout_${VERSION}_${target}.tar.gz" + archive="pitot_${VERSION}_${target}.tar.gz" curl -fsSLO "${base}/${archive}" - gh attestation verify "${archive}" --repo labstack/fanout + gh attestation verify "${archive}" --repo labstack/pitot done mcp-registry: diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index 8b2962504..762fb7fd3 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -21,7 +21,7 @@ on: # regenerated page is a documentation change whether or not anything under # site/ was touched by hand: settings come from internal/config, alert # variables from internal/alert, the roles matrix and route table from - # internal/api plus internal/agent and cmd/fanout, and the MCP tools from + # internal/api plus internal/agent and cmd/pitot, and the MCP tools from # internal/mcp. paths: - "site/**" @@ -30,8 +30,8 @@ on: - "internal/api/**" - "internal/agent/**" - "internal/mcp/**" - - "cmd/fanout/**" - - "cmd/fanout-docgen/**" + - "cmd/pitot/**" + - "cmd/pitot-docgen/**" - "internal/duckdb/**" - "scripts/with-duckdb.sh" - "scripts/go-build-tags.sh" @@ -82,7 +82,7 @@ jobs: - name: Refuse a reference that is behind the code env: CGO_ENABLED: "1" - run: bash scripts/with-duckdb.sh go run ./cmd/fanout-docgen --check + run: bash scripts/with-duckdb.sh go run ./cmd/pitot-docgen --check - name: Install dependencies working-directory: site @@ -95,7 +95,7 @@ jobs: - name: Build working-directory: site env: - SITE_URL: https://fanout.run + SITE_URL: https://pitot.dev # A GA4 measurement id is public in the delivered page, so this is a # repository variable rather than a secret. When absent, the site # build emits no analytics script or request. @@ -117,6 +117,6 @@ jobs: CLOUDFLARE_ACCOUNT_ID: e6379d37f788129207ab5f566abfb4ff run: | npx --yes wrangler@4.123.0 pages deploy dist \ - --project-name fanout \ + --project-name pitot \ --branch main \ --commit-hash "${GITHUB_SHA}" diff --git a/.gitignore b/.gitignore index 4b7a88056..070b172d0 100644 --- a/.gitignore +++ b/.gitignore @@ -62,6 +62,6 @@ cover.out # Ad-hoc output from `go build` without -o (named after the package). /bench -/fanout -/fanout-docgen +/pitot +/pitot-docgen .wrangler/ diff --git a/.gitleaks.toml b/.gitleaks.toml index 90dc9f7cc..617e792d3 100644 --- a/.gitleaks.toml +++ b/.gitleaks.toml @@ -33,7 +33,7 @@ regex = '''(/Users|/home)/[A-Za-z0-9_.-]+/''' keywords = ["/users/", "/home/"] [[rules]] -id = "fanout-bearer-secret" -description = "Fanout opaque bearer secret" +id = "pitot-bearer-secret" +description = "Pitot opaque bearer secret" regex = '''fo[iacr]_[A-Za-z0-9_-]{43}\b''' keywords = ["foi_", "foa_", "for_", "foc_"] diff --git a/AGENTS.md b/AGENTS.md index b82e4667a..2cafdb88a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,13 +4,17 @@ - Configuration is environment-only. `internal/config/config.go` is the authoritative schema: built-in defaults, then nonempty process environment. - Custom names use `FANOUT_` plus a clear name, adding the area only when it + Custom names use `PITOT_` plus a clear name, adding the area only when it clarifies; vendor credentials and endpoints keep `ANTHROPIC_API_KEY`, `ANTHROPIC_BASE_URL`, `OPENAI_API_KEY`, and `OPENAI_BASE_URL`. - Provider and model selection remain `FANOUT_AI_PROVIDER` and `FANOUT_AI_MODEL`. + Provider and model selection remain `PITOT_AI_PROVIDER` and `PITOT_AI_MODEL`. An empty provider disables chat; exactly `anthropic` or `openai` requires that provider's key. Ignore AI credentials and endpoints when chat is disabled; validate only the selected provider's endpoint. +- For the first Pitot alpha, `internal/config/loader.go` resolves legacy + `FANOUT_*` only when the equivalent primary name is unset. Preserve explicit + empty primaries and emit one names-only warning. See `CHANGELOG.md` for the + removal window and storage compatibility names. - Every `secret:"true"` field accepts `_FILE`. Both forms nonempty fail; secret files lose exactly one trailing LF or CRLF and must remain nonempty. Unselected AI providers' value and file forms are ignored. @@ -23,10 +27,10 @@ - The binary does not load dotenv. `just run` uses Node's native `parseEnv` for optional ignored `./.env`, then inherited environment values win. Personal development credentials may live there. Never shell-source dotenv. Only - Fanout's namespace rejects unknown names; tolerate platform service variables + Pitot's namespace rejects unknown names; tolerate platform service variables and ignore unrelated names in shared vendor namespaces. - Native listener default is `127.0.0.1:7520`. The image supplies - `FANOUT_ADDR=:7520` and `FANOUT_DATA_DIR=/var/lib/fanout/data`. + `PITOT_ADDR=:7520` and `PITOT_DATA_DIR=/var/lib/pitot/data`. - Repository-managed secret profiles adopt SOPS authority through a verified migration, with key recovery in 1Password. Existing vault/platform delivery remains authoritative until all consumers and recovery are verified. Follow @@ -127,7 +131,7 @@ ## Product versioning -Fanout uses CalVer with the format `YYYY.M.N[-alpha|-beta|-rc]`. +Pitot uses CalVer with the format `YYYY.M.N[-alpha|-beta|-rc]`. - `YYYY` is the full year and `M` is the unpadded month. - `N` is the release number within that month, starting at `0`. @@ -177,7 +181,7 @@ resources and protocol-defined contracts keep their own semantics. `/api/auth/code/verify`, and `POST /api/auth/logout`. Flow selection, passkeys, account linking, and sign-in link verification are distinct operations. OIDC sign-in uses `/api/auth/oidc/start` and `/api/auth/oidc/callback` without - a provider segment because Fanout supports exactly one configured provider. + a provider segment because Pitot supports exactly one configured provider. - Operational routes use `/healthz` for liveness, `/readyz` for readiness, and `/metrics` for Prometheus exposition. Preserve authorization requirements. - MCP tool names use verb-first snake_case and describe their behavior: diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..fd755a47b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,40 @@ +# Changelog + +## Unreleased — Pitot rename (2026-11-11) + +The product is now **Pitot** (pronounced **PEE-toh**), formerly Fanout, at +[pitot.dev](https://pitot.dev). The owner approved this rename on 2026-11-11 to avoid a +conflict with a third party's registered US trademark in cloud services. + +- The Go module is `github.com/labstack/pitot`; the binary is `pitot` and native + archives are `pitot___.tar.gz`, containing `./pitot`. +- Container images are `ghcr.io/labstack/pitot` and `docker.io/labstack/pitot`. + Update deployment manifests, service names, install URLs and MCP client entries. + The MCP Registry identity is `io.github.labstack/pitot`. +- Use `PITOT_*` settings. For the first Pitot alpha only, an unset primary + variable falls back to its `FANOUT_*` equivalent, including secret `_FILE` + forms and installer version/prefix overrides. A primary variable explicitly + set to empty blocks its legacy equivalent and uses the ordinary default. + Startup emits one deprecation warning listing used old names, never values. + Mixed value/file forms still fail when both are nonempty. Replace old names + before upgrading to the following alpha, when this bridge is due for removal. +- Keep the complete existing data directory. Native default `./data`, the + `control/fanout.sqlite` filename, all other storage filenames, telemetry format, + marker files, Parquet `fanout.spill.*` footer keys, stored + `_fanout_diagnostic_context` metadata and published migrations are unchanged; there is no data migration. + The new image defaults to `/var/lib/pitot/data`: mount the **existing** volume + there, or explicitly set `PITOT_DATA_DIR` to its existing mount location. + Do not accidentally create a fresh named volume when changing deployment names. +- Existing sessions keep their cookie names and keyboard preferences keep their + storage key. Saved chat activities resolve their old MCP App resource URI to + the new URI in memory, without rewriting history. Existing ingest and OAuth secrets + remain valid; token prefixes (`foi_`, `foa_`, `for_`, `foc_`) are unchanged for + both existing and new tokens because there is no central token-prefix registry. +- HTTP request headers and metrics use the Pitot name. Update custom clients + using the product request header to `Pitot-Request` (and dashboard deletion confirmation to + `Pitot-Confirm-Delete`), and update Prometheus + queries and alert rules from the old metric prefix to `pitot_`. + +Take a cold backup before upgrading, stop the old service, replace the binary or +image, and start the new service against the same data and secrets. Verify +`/readyz`, sign-in, ingest and a representative query before resuming traffic. diff --git a/CLA.md b/CLA.md index 573be135d..d6f81fe8e 100644 --- a/CLA.md +++ b/CLA.md @@ -1,7 +1,7 @@ # LabStack Contributor License Agreement Thank you for your interest in contributing to a project of LabStack LLC -("LabStack", "we", "us"), such as Driga, Fanout, or Onebox. +("LabStack", "we", "us"), such as Driga, Pitot, or Onebox. This Contributor License Agreement ("Agreement") documents the rights granted by contributors to LabStack. It applies to any Contribution you submit to any diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 7dda663af..671ab5e93 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -20,7 +20,7 @@ Maintainers may remove comments, close issues and pull requests, and block accounts that make the project worse to participate in. Report conduct privately through -[GitHub's reporting flow](https://github.com/labstack/fanout/security/advisories/new) +[GitHub's reporting flow](https://github.com/labstack/pitot/security/advisories/new) or contact the maintainers directly. Security vulnerabilities follow [SECURITY.md](SECURITY.md). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 99fa3edd9..42551e7ba 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# Contributing to Fanout +# Contributing to Pitot Thanks for your interest. Issues and pull requests are both welcome. @@ -35,7 +35,7 @@ Xcode Command Line Tools and `libc++`. Cross-compilation is unsupported. Use `just` recipes or prefix Go commands with the wrapper: ```sh -bash scripts/with-duckdb.sh go build ./cmd/fanout +bash scripts/with-duckdb.sh go build ./cmd/pitot bash scripts/with-duckdb.sh go test ./internal/ingest ``` @@ -91,20 +91,20 @@ SVG export. Archify is never installed through npm. Committed SVGs serve the README and docs site, so only diagram editors need the rendering environment. The evidence checkout defaults to this repository. If your `origin` points to a fork, use `DIAGRAMS_EVIDENCE_ROOT=/path/to/upstream-clone just diagrams`, where -the clone is labstack/fanout and contains the pinned revision. Archify normalizes +the clone is labstack/pitot and contains the pinned revision. Archify normalizes and verifies repository identity and the pinned revision during `finalize`. JSON inputs, SVG outputs, and the site copy still use your contributor checkout. **The social preview card is generated.** `just social-card` renders `docs/media/social-card.typ` into `site/public/social-card.png`. Set -`FANOUT_FONT_PATH` to a directory containing Inter; the recipe requires Typst +`PITOT_FONT_PATH` to a directory containing Inter; the recipe requires Typst 0.15.1 and fails if the font is missing. Commit the source and PNG together. The site build checks the committed image’s dimensions; CI does not rerender it. **Runtime configuration is strict.** `internal/config/config.go` owns the schema. New settings need an environment name, a documentation `group` tag, a purpose comment, a test, and matching documentation. Custom settings use -`FANOUT_` plus a clear name, adding the area only when it clarifies; vendor +`PITOT_` plus a clear name, adding the area only when it clarifies; vendor credentials and endpoints keep the vendor's documented names. Unknown owned names fail startup, while unrelated shared-vendor/tool variables are ignored. Secrets use `secret:"true"` and automatically accept an `_FILE` form; do not @@ -122,7 +122,7 @@ are immutable: add a migration rather than editing one already applied. The checksum ledger in `internal/db/migrations_test.go` makes the local and CI test gates reject edits, renames, and deletions. Extend it for new migrations; do not update checksums of published migrations. -Fanout embeds and applies them at startup; `just db-migrate-apply DB` applies +Pitot embeds and applies them at startup; `just db-migrate-apply DB` applies them manually with the same database guard used at startup. A version table without a positive applied version does not make an existing schema managed. DuckDB maintains its own query schema. @@ -130,7 +130,7 @@ DuckDB maintains its own query schema. ## Project layout ```text -cmd/fanout/ process composition and the single entry point +cmd/pitot/ process composition and the single entry point internal/ ingest, storage, query, agent, MCP, auth, alerts ui/host/ React browser host and shared MCP app renderer (build-time) docs/diagrams/ archify JSON sources and exported dual-theme SVGs @@ -167,7 +167,7 @@ as scanning the runtime container. ## Reporting bugs -Include the version (`fanout --version`), how Fanout is configured, and what +Include the version (`pitot --version`), how Pitot is configured, and what you expected instead of what happened. For anything security-related, follow [SECURITY.md](SECURITY.md) rather than opening an issue. @@ -182,5 +182,5 @@ agreement before contributing. ## License -Fanout is [Apache-2.0](LICENSE). Contributions are accepted under the same +Pitot is [Apache-2.0](LICENSE). Contributions are accepted under the same license, subject to the CLA above. diff --git a/Dockerfile b/Dockerfile index c2366dfac..1d3578bbb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # Bun is a build compiler only. Neither Bun nor Node is copied into the final -# image or launched by the Fanout process. +# image or launched by the Pitot process. FROM oven/bun:1.4.2@sha256:9114c058aeae42162ee16dd5084b95fe9473970bb6bcb5b232ab1630f0546895 AS ui-build WORKDIR /app COPY ui/host/package.json ui/host/bun.lock ./ui/host/ @@ -30,31 +30,31 @@ COPY --from=ui-build /app/internal/ui/dist/ ./internal/ui/dist/ RUN --mount=type=cache,target=/go/pkg/mod \ --mount=type=cache,target=/root/.cache/go-build \ CGO_ENABLED=1 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ - bash scripts/with-duckdb.sh go build -ldflags="-s -w -X main.version=${VERSION}" -o fanout ./cmd/fanout + bash scripts/with-duckdb.sh go build -ldflags="-s -w -X main.version=${VERSION}" -o pitot ./cmd/pitot # Distroless has no shell with which to create mutable paths. Prepare the data # directory here, then copy it with the runtime user's ownership below. -RUN mkdir -p /runtime/var/lib/fanout/data +RUN mkdir -p /runtime/var/lib/pitot/data -FROM cgr.dev/chainguard/glibc-dynamic:latest@sha256:3f1283dc2a6a48c25cd2e1c7730a871b19b721975240e108e0d6a73b555a3a20 AS fanout +FROM cgr.dev/chainguard/glibc-dynamic:latest@sha256:3f1283dc2a6a48c25cd2e1c7730a871b19b721975240e108e0d6a73b555a3a20 AS pitot ARG VERSION=dev -LABEL org.opencontainers.image.title="Fanout" \ +LABEL org.opencontainers.image.title="Pitot" \ org.opencontainers.image.description="Single-binary, agent-native OpenTelemetry investigation" \ - org.opencontainers.image.source="https://github.com/labstack/fanout" \ + org.opencontainers.image.source="https://github.com/labstack/pitot" \ org.opencontainers.image.licenses="Apache-2.0" \ org.opencontainers.image.version="${VERSION}" -COPY --from=build /app/fanout /usr/local/bin/fanout -COPY LICENSE NOTICE THIRD_PARTY_NOTICES TRADEMARK.md /usr/share/licenses/fanout/ -COPY --from=build --chown=nonroot:nonroot /runtime/var/lib/fanout /var/lib/fanout +COPY --from=build /app/pitot /usr/local/bin/pitot +COPY LICENSE NOTICE THIRD_PARTY_NOTICES TRADEMARK.md /usr/share/licenses/pitot/ +COPY --from=build --chown=nonroot:nonroot /runtime/var/lib/pitot /var/lib/pitot -# Runs unprivileged. A host directory bind-mounted at /var/lib/fanout/data must +# Runs unprivileged. A host directory bind-mounted at /var/lib/pitot/data must # be writable by UID/GID 65532, or the process cannot open its data directory. USER nonroot:nonroot -WORKDIR /var/lib/fanout +WORKDIR /var/lib/pitot -ENV FANOUT_ADDR=:7520 FANOUT_DATA_DIR=/var/lib/fanout/data +ENV PITOT_ADDR=:7520 PITOT_DATA_DIR=/var/lib/pitot/data EXPOSE 7520 @@ -62,6 +62,6 @@ EXPOSE 7520 # is generous relative to the check interval. # HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \ - CMD ["fanout", "healthcheck"] + CMD ["pitot", "healthcheck"] -ENTRYPOINT ["fanout"] +ENTRYPOINT ["pitot"] diff --git a/NOTICE b/NOTICE index 8bed859ec..02803710c 100644 --- a/NOTICE +++ b/NOTICE @@ -1,4 +1,4 @@ -Fanout +Pitot Copyright 2026 LabStack LLC This product includes software developed at LabStack LLC diff --git a/README.md b/README.md index a271bb9a3..7bba473df 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,28 @@ -# Fanout +# Pitot + +Pitot (pronounced **PEE-toh**), formerly Fanout. **Observability your agents can operate.** Send OpenTelemetry to one binary, then investigate with -Fanout's built-in agent or connect your own over MCP. +Pitot's built-in agent or connect your own over MCP. -[![CI](https://github.com/labstack/fanout/actions/workflows/ci.yml/badge.svg)](https://github.com/labstack/fanout/actions/workflows/ci.yml) +[![CI](https://github.com/labstack/pitot/actions/workflows/ci.yml/badge.svg)](https://github.com/labstack/pitot/actions/workflows/ci.yml) [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE) -[![Go Reference](https://pkg.go.dev/badge/github.com/labstack/fanout.svg)](https://pkg.go.dev/github.com/labstack/fanout) +[![Go Reference](https://pkg.go.dev/badge/github.com/labstack/pitot.svg)](https://pkg.go.dev/github.com/labstack/pitot) - + - A Fanout dashboard the built-in agent built from one request: store request rate, error rate, p95 latency and error logs, with request and error rates by service. + A Pitot dashboard the built-in agent built from one request: store request rate, error rate, p95 latency and error logs, with request and error rates by service. -Fanout keeps OpenTelemetry traces, logs, and metrics in one binary and one data directory, with no -external storage services to operate. Fanout is pre-release and changes without migration paths; the browser +*Preview capture from the pre-rename alpha.* + +Pitot keeps OpenTelemetry traces, logs, and metrics in one binary and one data directory, with no +external storage services to operate. Pitot is pre-release and changes without migration paths; the browser client, built-in agent, MCP tools, dashboards, and alerts are preview capabilities -([status](https://fanout.run/docs/reference/capabilities)). Start with the -[documentation](https://fanout.run) or run it below. +([status](https://pitot.dev/docs/reference/capabilities)). Start with the +[documentation](https://pitot.dev) or run it below. - OTLP ingest over gRPC and HTTP, with local Parquet storage and DuckDB analytics. - Explore and FanQL for querying telemetry without an AI provider. @@ -32,36 +36,36 @@ client, built-in agent, MCP tools, dashboards, and alerts are preview capabiliti ### Docker ```sh -docker run --name fanout --restart unless-stopped -p 7520:7520 \ - -v fanout-data:/var/lib/fanout/data \ - -e FANOUT_AUTH_CODE_SECRET=$(openssl rand -hex 32) \ - labstack/fanout:latest +docker run --name pitot --restart unless-stopped -p 7520:7520 \ + -v pitot-data:/var/lib/pitot/data \ + -e PITOT_AUTH_CODE_SECRET=$(openssl rand -hex 32) \ + labstack/pitot:latest ``` -Open the one-time setup URL printed by the container and create the first administrator. Fanout -displays the ingest token exactly once, unless `FANOUT_INGEST_TOKEN` already set it; save it with your collector secrets. For later sign-in +Open the one-time setup URL printed by the container and create the first administrator. Pitot +displays the ingest token exactly once, unless `PITOT_INGEST_TOKEN` already set it; save it with your collector secrets. For later sign-in without SMTP, mint a 15-minute, single-use link against the running container's control database: ```sh -docker exec fanout fanout login-link admin@example.com +docker exec pitot pitot login-link admin@example.com ``` The UI, API, MCP, and both OTLP transports share port `7520`. See -[installation](https://fanout.run/docs/get-started/install) for image defaults and bind-mount ownership, and -[first boot](https://fanout.run/docs/get-started/first-boot) for setup and SMTP login. +[installation](https://pitot.dev/docs/get-started/install) for image defaults and bind-mount ownership, and +[first boot](https://pitot.dev/docs/get-started/first-boot) for setup and SMTP login. ### Native binary Install a checksum-verified release for Linux or macOS, amd64 or arm64: ```sh -curl -fsSL https://raw.githubusercontent.com/labstack/fanout/main/scripts/install.sh | sh -export FANOUT_AUTH_CODE_SECRET=$(openssl rand -hex 32) -fanout +curl -fsSL https://raw.githubusercontent.com/labstack/pitot/main/scripts/install.sh | sh +export PITOT_AUTH_CODE_SECRET=$(openssl rand -hex 32) +pitot ``` -Set `FANOUT_VERSION` to a [release tag](https://github.com/labstack/fanout/releases), such as `v2026.11.0-alpha`, to pin a release, and `FANOUT_PREFIX` to choose the installation -directory. Native installs bind `127.0.0.1:7520`; set `FANOUT_ADDR=:7520` for remote access, then +Set `PITOT_VERSION` to a [release tag](https://github.com/labstack/pitot/releases), such as `v2026.11.0-alpha`, to pin a release, and `PITOT_PREFIX` to choose the installation +directory. Native installs bind `127.0.0.1:7520`; set `PITOT_ADDR=:7520` for remote access, then follow the same first-boot setup. ### Send telemetry @@ -78,60 +82,60 @@ For a Collector on the same private container network, the forwarding side is: ```yaml exporters: - otlp_http/fanout: - endpoint: http://fanout:7520 + otlp_http/pitot: + endpoint: http://pitot:7520 headers: Authorization: "Bearer ${env:INGEST_TOKEN}" service: pipelines: - traces: { receivers: [otlp], exporters: [otlp_http/fanout] } - metrics: { receivers: [otlp], exporters: [otlp_http/fanout] } - logs: { receivers: [otlp], exporters: [otlp_http/fanout] } + traces: { receivers: [otlp], exporters: [otlp_http/pitot] } + metrics: { receivers: [otlp], exporters: [otlp_http/pitot] } + logs: { receivers: [otlp], exporters: [otlp_http/pitot] } ``` -Use an existing `otlp` receiver, set `INGEST_TOKEN`, and replace `fanout` with the Collector's +Use an existing `otlp` receiver, set `INGEST_TOKEN`, and replace `pitot` with the Collector's reachable private hostname. OTLP/gRPC uses `localhost:7520` locally; see [send -telemetry](https://fanout.run/docs/get-started/send-telemetry) for TLS and HTTP/2 setup. +telemetry](https://pitot.dev/docs/get-started/send-telemetry) for TLS and HTTP/2 setup. ### Enable chat -Select `FANOUT_AI_PROVIDER=anthropic` and inject `ANTHROPIC_API_KEY`, or select -`FANOUT_AI_PROVIDER=openai` and inject `OPENAI_API_KEY`, then restart Fanout; the selected provider +Select `PITOT_AI_PROVIDER=anthropic` and inject `ANTHROPIC_API_KEY`, or select +`PITOT_AI_PROVIDER=openai` and inject `OPENAI_API_KEY`, then restart Pitot; the selected provider requires its key at startup. With no provider, chat is disabled and the other features still work. -See [AI settings](https://fanout.run/docs/reference/configuration/ai). +See [AI settings](https://pitot.dev/docs/reference/configuration/ai). ### Connect an MCP client -Set `FANOUT_PUBLIC_URL` to your stable, externally reachable HTTPS origin, then point a remote MCP +Set `PITOT_PUBLIC_URL` to your stable, externally reachable HTTPS origin, then point a remote MCP client at that origin's `/mcp` endpoint. The client discovers and registers through OAuth; you -authorize its scopes in the browser. Fanout serves MCP `2026-07-28` and, through the `initialize` +authorize its scopes in the browser. Pitot serves MCP `2026-07-28` and, through the `initialize` handshake, `2025-11-25` and `2025-06-18` over Streamable HTTP. See [connect over -MCP](https://fanout.run/docs/guides/mcp) for setup and permissions. +MCP](https://pitot.dev/docs/guides/mcp) for setup and permissions. ## How it compares -| If you use | Where Fanout differs | +| If you use | Where Pitot differs | | --- | --- | -| **Grafana with Loki, Tempo, and Mimir** | That stack keeps a service and a query language per signal, plus object storage underneath. Fanout keeps one process, one data directory, and one typed contract across all three signals, at the cost of the horizontal scale those components are built for. | -| **SigNoz** | Both are OTLP-native and self-hosted. SigNoz composes a collector, ClickHouse, and query services; Fanout compiles ingest, authoritative Parquet storage, indexed trace reads, DuckDB analytics, alerting, and the browser client into one binary. | -| **Jaeger** | Jaeger covers traces and expects a storage backend you run separately. Fanout ingests traces, logs, and metrics into the same store, with nothing else to deploy. | -| **Prometheus with Grafana** | Prometheus pulls metrics and is excellent at them. Fanout accepts pushed OTLP for all three signals and is built around investigating a specific incident rather than maintaining long-range metric series. | -| **Datadog**, **Honeycomb**, **Grafana Cloud** | Those are managed services: someone else runs the storage, the scaling, and the upgrades, and your telemetry leaves your network to get there. Fanout is a binary you run, on data that stays on your disk. | -| **An OpenTelemetry Collector piped into ClickHouse** | The same shape, assembled by hand: collector, database, dashboards, and the glue between them. Fanout is that assembly as one program, with an agent and an MCP server already wired to the same query contract. | +| **Grafana with Loki, Tempo, and Mimir** | That stack keeps a service and a query language per signal, plus object storage underneath. Pitot keeps one process, one data directory, and one typed contract across all three signals, at the cost of the horizontal scale those components are built for. | +| **SigNoz** | Both are OTLP-native and self-hosted. SigNoz composes a collector, ClickHouse, and query services; Pitot compiles ingest, authoritative Parquet storage, indexed trace reads, DuckDB analytics, alerting, and the browser client into one binary. | +| **Jaeger** | Jaeger covers traces and expects a storage backend you run separately. Pitot ingests traces, logs, and metrics into the same store, with nothing else to deploy. | +| **Prometheus with Grafana** | Prometheus pulls metrics and is excellent at them. Pitot accepts pushed OTLP for all three signals and is built around investigating a specific incident rather than maintaining long-range metric series. | +| **Datadog**, **Honeycomb**, **Grafana Cloud** | Those are managed services: someone else runs the storage, the scaling, and the upgrades, and your telemetry leaves your network to get there. Pitot is a binary you run, on data that stays on your disk. | +| **An OpenTelemetry Collector piped into ClickHouse** | The same shape, assembled by hand: collector, database, dashboards, and the glue between them. Pitot is that assembly as one program, with an agent and an MCP server already wired to the same query contract. | -Fanout is a single node. It has no clustering, no replication, and no object tier; a deployment that -outgrows one machine's disk and CPU has outgrown Fanout. +Pitot is a single node. It has no clustering, no replication, and no object tier; a deployment that +outgrows one machine's disk and CPU has outgrown Pitot. ## Architecture One process contains ingest, storage, query, alerts, the agent, MCP, and the React client. Browser and agent clients share a typed observability contract. -![Fanout runtime architecture: OTLP ingest and commit workers publish Parquet; the browser API, agent runtime, and MCP server share queries and dashboards, with DuckDB query state, SQLite control state, anomaly detection, and webhook alerts.](docs/diagrams/architecture.svg) +![Pitot runtime architecture: OTLP ingest and commit workers publish Parquet; the browser API, agent runtime, and MCP server share queries and dashboards, with DuckDB query state, SQLite control state, anomaly detection, and webhook alerts.](docs/diagrams/architecture.svg) Parquet holds telemetry, DuckDB query state is rebuildable, and SQLite holds transactional product -state. See [how storage works](https://fanout.run/docs/concepts/storage) for durable ingest, +state. See [how storage works](https://pitot.dev/docs/concepts/storage) for durable ingest, indexed reads, and compaction while reads continue. ![Telemetry durability and query flow: authenticated OTLP rows pass through group admission, parallel commit workers, and durable publication into immutable Parquet batches; indexed trace reads, DuckDB SQL, retention, and compaction use those batches, while service and edge rollups populate rebuildable query state.](docs/diagrams/persistence.svg) @@ -144,40 +148,40 @@ change requires a restart. | Environment variable | Default | Purpose | | --- | --- | --- | -| `FANOUT_ADDR` | `127.0.0.1:7520` | UI, API, MCP, and both OTLP transports | -| `FANOUT_DATA_DIR` | `./data` | Parquet, query state, and control SQLite | -| `FANOUT_AUTH_MODE` | `local` | Login link or SMTP, or `oidc` | -| `FANOUT_AUTH_CODE_SECRET` | — | Required in local mode and for OIDC break-glass links, 32+ characters | -| `FANOUT_AI_PROVIDER` | — | Empty disables chat; `anthropic` or `openai` enables it | +| `PITOT_ADDR` | `127.0.0.1:7520` | UI, API, MCP, and both OTLP transports | +| `PITOT_DATA_DIR` | `./data` | Parquet, query state, and control SQLite | +| `PITOT_AUTH_MODE` | `local` | Login link or SMTP, or `oidc` | +| `PITOT_AUTH_CODE_SECRET` | — | Required in local mode and for OIDC break-glass links, 32+ characters | +| `PITOT_AI_PROVIDER` | — | Empty disables chat; `anthropic` or `openai` enables it | | `ANTHROPIC_API_KEY` | — | Required for Anthropic chat | | `OPENAI_API_KEY` | — | Required for OpenAI chat | -| `FANOUT_RETENTION_DAYS` | `30` | Telemetry retention window | -| `FANOUT_MCP_ENABLED` | `true` | Serve the MCP endpoint at `/mcp` | +| `PITOT_RETENTION_DAYS` | `30` | Telemetry retention window | +| `PITOT_MCP_ENABLED` | `true` | Serve the MCP endpoint at `/mcp` | Every secret accepts `_FILE` instead of its value; see the [settings -reference](https://fanout.run/docs/reference/configuration) for validation and [runtime secret +reference](https://pitot.dev/docs/reference/configuration) for validation and [runtime secret delivery](docs/operations.md#runtime-secret-delivery) for deployment examples. ### Advanced DuckDB sizing -Fanout sizes DuckDB automatically; measured workloads can override memory, connections, and threads -as described in [DuckDB sizing](https://fanout.run/docs/reference/configuration#duckdb-sizing). +Pitot sizes DuckDB automatically; measured workloads can override memory, connections, and threads +as described in [DuckDB sizing](https://pitot.dev/docs/reference/configuration#duckdb-sizing). For TLS, health checks, backups, upgrades, retention, and recovery, see the [operator runbook](docs/operations.md). ## Performance -Fanout v2026.11.0-alpha accepted **507,311 mixed OpenTelemetry items/s** +Pitot v2026.11.0-alpha accepted **507,311 mixed OpenTelemetry items/s** over 306.8 seconds on a Hetzner Cloud ccx33 (8 dedicated vCPUs, 32 GB RAM), with telemetrygen on a separate ccx33. The ingest run on 6 November 2026 passed every -quality gate. See the [performance methodology](https://fanout.run/docs/concepts/performance). -[Fanout Bench](https://github.com/labstack/fanout-bench) reproduces the measurement on your hardware. +quality gate. See the [performance methodology](https://pitot.dev/docs/concepts/performance). +[Pitot Bench](https://github.com/labstack/pitot-bench) reproduces the measurement on your hardware. ## Build from source - **Go 1.27.3 and a C/C++ toolchain** on native Linux or macOS, amd64 or arm64. - Build with `just build` or `bash scripts/with-duckdb.sh go build ./cmd/fanout`; + Build with `just build` or `bash scripts/with-duckdb.sh go build ./cmd/pitot`; the wrapper supplies DuckDB's pinned headers, static libraries, and CGO flags. The first build needs network access to download the checksum-verified engine. - **[Bun](https://bun.sh)** — compiles the browser assets @@ -186,8 +190,8 @@ quality gate. See the [performance methodology](https://fanout.run/docs/concepts - A 32-character **authentication code secret** ```sh -git clone https://github.com/labstack/fanout.git -cd fanout +git clone https://github.com/labstack/pitot.git +cd pitot just install # browser dependencies and git hooks just build # browser assets, then the binary ``` @@ -195,13 +199,13 @@ just build # browser assets, then the binary Run it with the minimum configuration: ```sh -export FANOUT_AUTH_CODE_SECRET=$(openssl rand -hex 32) # must be 32+ characters +export PITOT_AUTH_CODE_SECRET=$(openssl rand -hex 32) # must be 32+ characters -./bin/fanout +./bin/pitot ``` Open and follow first-boot setup. SMTP and chat are optional; without SMTP, -run `./bin/fanout login-link admin@example.com` with the same configuration and data directory. +run `./bin/pitot login-link admin@example.com` with the same configuration and data directory. ## Development @@ -212,19 +216,19 @@ generated assets, hooks, and project layout. ## Releases Versions are CalVer — `vYYYY.M.N[-alpha|-beta|-rc]`, numbered from 0 within each month across all -maturity suffixes. Fanout is alpha (for example, `v2026.11.0-alpha`); GA has no suffix. +maturity suffixes. Pitot is alpha (for example, `v2026.11.0-alpha`); GA has no suffix. Container tags omit the leading `v`, and every release moves `latest`. Tagged releases publish -identical manifests to Docker Hub (`labstack/fanout`) and GHCR (`ghcr.io/labstack/fanout`); GHCR is +identical manifests to Docker Hub (`labstack/pitot`) and GHCR (`ghcr.io/labstack/pitot`); GHCR is canonical and also carries development images. | Image tag | Points at | | --- | --- | -| `labstack/fanout:latest` | the newest release, mirrored on Docker Hub | -| `labstack/fanout:2026.11.0-alpha` | that exact release, mirrored on Docker Hub | -| `ghcr.io/labstack/fanout:latest` | the newest release | -| `ghcr.io/labstack/fanout:2026.11.0-alpha` | that exact release | -| `ghcr.io/labstack/fanout:main` | the tip of `main` | -| `ghcr.io/labstack/fanout:sha-` | one specific commit | +| `labstack/pitot:latest` | the newest release, mirrored on Docker Hub | +| `labstack/pitot:2026.11.0-alpha` | that exact release, mirrored on Docker Hub | +| `ghcr.io/labstack/pitot:latest` | the newest release | +| `ghcr.io/labstack/pitot:2026.11.0-alpha` | that exact release | +| `ghcr.io/labstack/pitot:main` | the tip of `main` | +| `ghcr.io/labstack/pitot:sha-` | one specific commit | See [docs/release.md](docs/release.md) for platforms, checksums, provenance, and verification. @@ -236,7 +240,7 @@ and `just test-race` before opening a pull request. Report security issues throu ## Scope -This repository builds Fanout without another repository; LabStack's deployment configuration, +This repository builds Pitot without another repository; LabStack's deployment configuration, uptime monitoring, and public demo instance are not included. The documentation site in [`site/`](site) is included, with settings pages generated from the same `internal/config` type the loader binds and checked by `just check`. @@ -245,4 +249,4 @@ loader binds and checked by `just check`. [Apache-2.0](LICENSE) © LabStack LLC. See [NOTICE](NOTICE) and [THIRD_PARTY_NOTICES](THIRD_PARTY_NOTICES) for attribution, and -[TRADEMARK](TRADEMARK.md) for use of the Fanout name and logo. +[TRADEMARK](TRADEMARK.md) for use of the Pitot name and logo. diff --git a/SECURITY.md b/SECURITY.md index 93a4665e8..f057ebbc5 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -5,7 +5,7 @@ Please do not open a public issue for security vulnerabilities. Report them privately through -[GitHub Security Advisories](https://github.com/labstack/fanout/security/advisories/new), +[GitHub Security Advisories](https://github.com/labstack/pitot/security/advisories/new), or by email to **security@labstack.com**. Include what you need to make the issue reproducible: affected version or @@ -18,7 +18,7 @@ named. ## Scope -Fanout stores telemetry and the credentials needed to reach it, so findings in +Pitot stores telemetry and the credentials needed to reach it, so findings in these areas are especially relevant: - Authentication and session handling — local email codes, OIDC, MCP OAuth @@ -33,13 +33,13 @@ cross-owner dashboard access are authorization findings. ## Supported versions -Fanout uses CalVer and moves quickly. Fixes land on `main`, and only the latest +Pitot uses CalVer and moves quickly. Fixes land on `main`, and only the latest release is supported. There are no backports to earlier tags. -## Operating Fanout safely +## Operating Pitot safely -Fanout serves plaintext by default. Configure `FANOUT_TLS_CERT_FILE` and -`FANOUT_TLS_KEY_FILE`, or place it behind a reverse proxy that terminates TLS. +Pitot serves plaintext by default. Configure `PITOT_TLS_CERT_FILE` and +`PITOT_TLS_KEY_FILE`, or place it behind a reverse proxy that terminates TLS. Browser and API reads require an authenticated account, and every OTLP request requires the separately managed ingest token. Demo instances use the same credential paths as production instances. diff --git a/SUPPORT.md b/SUPPORT.md index aa026824d..f3e91357d 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -1,13 +1,13 @@ # Support -Fanout is community-supported open source software. +Pitot is community-supported open source software. - Use a bug report for reproducible product defects. - Use a feature request for broadly useful OSS improvements. - Use GitHub Discussions for setup questions and deployment advice. - Report vulnerabilities privately as described in [SECURITY.md](SECURITY.md). -Include the Fanout version or image digest, operating system or container +Include the Pitot version or image digest, operating system or container runtime, relevant configuration with secrets removed, and the smallest useful log excerpt. Public issues are not a safe place for ingest tokens, login links, session cookies, API keys, SMTP credentials, telemetry payloads, or production diff --git a/THIRD_PARTY_NOTICES b/THIRD_PARTY_NOTICES index 2a91ce485..da6d6e0cd 100644 --- a/THIRD_PARTY_NOTICES +++ b/THIRD_PARTY_NOTICES @@ -1,11 +1,11 @@ -FANOUT THIRD-PARTY NOTICES +PITOT THIRD-PARTY NOTICES This file is generated from the Go packages linked into the four supported release targets, the pinned native DuckDB engine, and the production dependency graphs of the two embedded browser applications. Development-only dependencies are excluded. Regenerate it with `just notices`; CI verifies it with `just notices-check`. -The following components are provided under their own terms. Fanout's Apache-2.0 +The following components are provided under their own terms. Pitot's Apache-2.0 license does not replace or alter those terms. COMPONENT INVENTORY diff --git a/TRADEMARK.md b/TRADEMARK.md index 91f4e3dae..f0778687c 100644 --- a/TRADEMARK.md +++ b/TRADEMARK.md @@ -1,39 +1,39 @@ -# Fanout trademark policy +# Pitot trademark policy -The Fanout source code is licensed under the Apache License, Version 2.0. That +The Pitot source code is licensed under the Apache License, Version 2.0. That license covers copyright and patents. It does **not** grant rights to the -Fanout name, logo, or related marks — Apache-2.0 section 6 says so explicitly. +Pitot name, logo, or related marks — Apache-2.0 section 6 says so explicitly. This document states what LabStack LLC permits and does not permit, so that everyone knows where the line is. ## What this covers -- The name "Fanout" and the mark "fanout". -- The Fanout logo and wordmark. -- The container image name `ghcr.io/labstack/fanout`. +- The name "Pitot" and the mark "pitot". +- The Pitot logo and wordmark. +- The container image name `ghcr.io/labstack/pitot`. ## You do not need permission to - Say truthfully that your project, product, or service works with, integrates - with, is built on, or is compatible with Fanout. -- Redistribute unmodified Fanout releases under the name Fanout. -- Write about Fanout — articles, talks, tutorials, comparisons, reviews, + with, is built on, or is compatible with Pitot. +- Redistribute unmodified Pitot releases under the name Pitot. +- Write about Pitot — articles, talks, tutorials, comparisons, reviews, including critical ones. - Use the name in a user group, meetup, conference talk title, or community channel that is clearly not operated by LabStack. - Fork the source and build on it, as Apache-2.0 permits, provided the result - is not distributed **under the Fanout name**. + is not distributed **under the Pitot name**. Nothing in this policy restricts any right Apache-2.0 grants you over the code. ## You need written permission to -- Distribute a **modified** version of Fanout under the name Fanout. -- Offer a hosted or managed service named Fanout, or named in a way that leads a +- Distribute a **modified** version of Pitot under the name Pitot. +- Offer a hosted or managed service named Pitot, or named in a way that leads a reasonable person to think LabStack operates it. -- Use Fanout, or a confusingly similar term, in your company name, product name, +- Use Pitot, or a confusingly similar term, in your company name, product name, domain name, app-store listing, or social account handle. -- Use the Fanout logo or wordmark as your own branding, or in a modified form. +- Use the Pitot logo or wordmark as your own branding, or in a modified form. - Sell merchandise bearing the marks. ## Never permitted @@ -41,7 +41,7 @@ Nothing in this policy restricts any right Apache-2.0 grants you over the code. - Implying sponsorship, endorsement, affiliation, or partnership with LabStack where none exists. - Using the marks in a way that suggests your modified build is the official - Fanout distribution. + Pitot distribution. - Registering the marks, or confusingly similar marks, as trademarks or domain names. diff --git a/cmd/fanout-docgen/fragment_contract_docs_test.go b/cmd/pitot-docgen/fragment_contract_docs_test.go similarity index 100% rename from cmd/fanout-docgen/fragment_contract_docs_test.go rename to cmd/pitot-docgen/fragment_contract_docs_test.go diff --git a/cmd/fanout-docgen/groups.go b/cmd/pitot-docgen/groups.go similarity index 97% rename from cmd/fanout-docgen/groups.go rename to cmd/pitot-docgen/groups.go index c615e7134..5b9f98433 100644 --- a/cmd/fanout-docgen/groups.go +++ b/cmd/pitot-docgen/groups.go @@ -50,7 +50,7 @@ func groupParams(file *ast.File, filename string) (map[string]string, error) { failure = fmt.Errorf( "%s: %s registers routes on an *echo.Group, whose paths are relative to a "+ "prefix declared at its call site in another package. Add %q to "+ - "groupPrefixes in cmd/fanout-docgen/groups.go with the prefix it is "+ + "groupPrefixes in cmd/pitot-docgen/groups.go with the prefix it is "+ "mounted at — without it those routes publish as requiring no credential", filename, name, name, ) diff --git a/cmd/fanout-docgen/main.go b/cmd/pitot-docgen/main.go similarity index 91% rename from cmd/fanout-docgen/main.go rename to cmd/pitot-docgen/main.go index 5ca60d46c..297da4a22 100644 --- a/cmd/fanout-docgen/main.go +++ b/cmd/pitot-docgen/main.go @@ -1,4 +1,4 @@ -// Command fanout-docgen writes the settings reference from Fanout's own +// Command pitot-docgen writes the settings reference from Pitot's own // configuration type. // // The contract comes from reflection over config.Config — the same struct the @@ -38,20 +38,20 @@ import ( "unicode" "unicode/utf8" - "github.com/labstack/fanout/internal/alert" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/fanql" + "github.com/labstack/pitot/internal/alert" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/fanql" ) func main() { var ( source = flag.String("source", "internal/config/config.go", "path to the file declaring config.Config") alerts = flag.String("alert-source", "internal/alert/types.go", "path to the file declaring alert.Env") - // Every directory that registers routes. cmd/fanout carries the + // Every directory that registers routes. cmd/pitot carries the // operational, protocol and SPA routes; internal/agent the investigator. // A directory listed here that registers nothing is an error, so this // list going stale is loud rather than a quietly shorter table. - routeDirs = flag.String("route-dirs", "internal/api,internal/agent,cmd/fanout", + routeDirs = flag.String("route-dirs", "internal/api,internal/agent,cmd/pitot", "comma-separated directories whose files register HTTP routes") outDir = flag.String("out", "site/src/content/docs/docs/reference", "reference root to write generated pages into") envExample = flag.String("env-example", ".env.example", "path to the generated environment template") @@ -60,7 +60,7 @@ func main() { flag.Parse() if err := run(*source, *alerts, *routeDirs, *outDir, *envExample, *check); err != nil { - fmt.Fprintf(os.Stderr, "fanout-docgen: %v\n", err) + fmt.Fprintf(os.Stderr, "pitot-docgen: %v\n", err) os.Exit(1) } } @@ -160,7 +160,7 @@ func run(source, alertSource, routeDirs, outDir, envExample string, check bool) strings.Join(stale, "\n "), ) } - fmt.Printf("fanout-docgen: %d page(s) match the types they document\n", len(pages)) + fmt.Printf("pitot-docgen: %d page(s) match the types they document\n", len(pages)) return nil } @@ -170,7 +170,7 @@ func run(source, alertSource, routeDirs, outDir, envExample string, check bool) } } fmt.Printf( - "fanout-docgen: wrote %d page(s) covering %d setting(s), %d alert variable(s), %d route(s) and %d MCP tool(s)\n", + "pitot-docgen: wrote %d page(s) covering %d setting(s), %d alert variable(s), %d route(s) and %d MCP tool(s)\n", len(pages), len(fields), len(alertEnvCount), len(routeCount), len(toolCount), ) return nil @@ -242,7 +242,7 @@ func renderAlertEnv(vars []field) []byte { b.WriteString("generated: true\n") b.WriteString("---\n\n") - b.WriteString("{/* Generated by cmd/fanout-docgen from internal/alert. Edit the generator, not this page. */}\n\n") + b.WriteString("{/* Generated by cmd/pitot-docgen from internal/alert. Edit the generator, not this page. */}\n\n") b.WriteString("An alert rule's `expression` is [CEL](https://cel.dev) evaluated\n") b.WriteString("against one service's rollup for the current window. It can read the following variables.\n\n") @@ -277,7 +277,7 @@ type field struct { GoName string Key string // alert expression variable Group string // documentation area, e.g. "storage" - Env string // e.g. "FANOUT_DUCKDB_MEMORY" + Env string // e.g. "PITOT_DUCKDB_MEMORY" Type string Default string Secret bool @@ -446,7 +446,7 @@ var groups = map[string]groupPage{ Description: "The shared HTTP and OTLP listener, the public URL, TLS, and proxy trust.", Summary: "Settings for the listener that serves the browser, API, chat, MCP and both OTLP transports.", ReadWhen: []string{ - "You are putting Fanout behind a reverse proxy.", + "You are putting Pitot behind a reverse proxy.", "Browser sessions are not getting Secure cookies.", }, }, @@ -474,7 +474,7 @@ var groups = map[string]groupPage{ Summary: "Settings for how people sign in and how long their sessions last.", ReadWhen: []string{ "You are moving an instance from local sign-in to an identity provider.", - "You need to map provider groups onto Fanout roles.", + "You need to map provider groups onto Pitot roles.", }, }, "smtp": { @@ -489,14 +489,14 @@ var groups = map[string]groupPage{ Summary: "Chat is disabled unless a provider is selected; its API key is then required.", ReadWhen: []string{ "The built-in agent is disabled and you want it on.", - "You are pointing Fanout at a self-hosted or proxied model endpoint.", + "You are pointing Pitot at a self-hosted or proxied model endpoint.", }, }, "mcp": { Title: "MCP settings", Description: "Whether the MCP server is served, and the public resource URI it binds tokens to.", Summary: "Settings for the MCP endpoint external agents connect to.", - ReadWhen: []string{"You are connecting an external agent to a Fanout instance."}, + ReadWhen: []string{"You are connecting an external agent to a Pitot instance."}, }, "alerts": { Title: "Alert settings", @@ -508,7 +508,7 @@ var groups = map[string]groupPage{ Title: "Metrics settings", Description: "The Prometheus endpoint's token and whether it is public.", Summary: "Settings for the Prometheus scrape endpoint at /metrics.", - ReadWhen: []string{"You are scraping Fanout's own metrics."}, + ReadWhen: []string{"You are scraping Pitot's own metrics."}, }, } @@ -524,7 +524,7 @@ func render(fields []field) (map[string][]byte, error) { if !ok { return nil, fmt.Errorf( "configuration group %q has no entry in the groups registry in "+ - "cmd/fanout-docgen/main.go; add a title and description for it "+ + "cmd/pitot-docgen/main.go; add a title and description for it "+ "rather than publishing a page named after a bare key", name, ) @@ -551,14 +551,15 @@ func renderPage(name string, page groupPage, fields []field) []byte { b.WriteString("generated: true\n") b.WriteString("---\n\n") - b.WriteString("{/* Generated by cmd/fanout-docgen from internal/config. Edit the generator, not this page. */}\n\n") + b.WriteString("{/* Generated by cmd/pitot-docgen from internal/config. Edit the generator, not this page. */}\n\n") b.WriteString("Every setting below is read once at startup and requires a restart to change.\n") b.WriteString("Built-in defaults are overridden by nonempty environment values.\n") - b.WriteString("Unknown `FANOUT_` names fail startup; platform-injected service names are tolerated.\n") + b.WriteString("For the first Pitot alpha, unset `PITOT_` variables accept `FANOUT_` equivalents with a names-only deprecation warning. Explicitly empty primary variables block fallback.\n") + b.WriteString("Unknown `PITOT_` names fail startup; platform-injected service names are tolerated.\n") b.WriteString("Vendor credentials and endpoints keep the vendor's documented names.\n\n") if name == "ai" { - b.WriteString("Fanout also recognizes `ANTHROPIC_API_KEY`, `ANTHROPIC_BASE_URL`,\n") + b.WriteString("Pitot also recognizes `ANTHROPIC_API_KEY`, `ANTHROPIC_BASE_URL`,\n") b.WriteString("`OPENAI_API_KEY`, and `OPENAI_BASE_URL`. Other vendor/tool variables are\n") b.WriteString("ignored; only the explicitly selected AI provider's key and endpoint are used.\n\n") } @@ -596,7 +597,7 @@ func renderPage(name string, page groupPage, fields []field) []byte { if hasSecret(fields) { b.WriteString("\n:::caution[Secrets]\n") - b.WriteString("Settings marked `secret` are redacted from Fanout's startup configuration\n") + b.WriteString("Settings marked `secret` are redacted from Pitot's startup configuration\n") b.WriteString("log. Supply either the value or its `_FILE` path, never both. File contents\n") b.WriteString("lose exactly one trailing newline (LF or CRLF); empty secrets fail startup.\n") b.WriteString(":::\n") @@ -609,15 +610,15 @@ func renderPage(name string, page groupPage, fields []field) []byte { // Entries are commented out; defaults and secret file forms stay in comments. func renderEnvironment(fields []field) []byte { var b strings.Builder - b.WriteString("# Generated by cmd/fanout-docgen from internal/config/config.go.\n") + b.WriteString("# Generated by cmd/pitot-docgen from internal/config/config.go.\n") b.WriteString("# Regenerate with just docs-generate; verify with just docs-generate-check.\n") - b.WriteString("# Fanout does not load dotenv files. Inject through your launcher or deployment.\n") + b.WriteString("# Pitot does not load dotenv files. Inject through your launcher or deployment.\n") b.WriteString("# Precedence: built-in defaults < nonempty environment values.\n") b.WriteString("# All settings require restart. Empty environment values mean no override.\n") b.WriteString("# Every entry is commented out so copying this template sets nothing, preserving image ENV.\n") b.WriteString("# Uncomment only settings you want to supply; use runtime secret injection for secrets.\n") - b.WriteString("# Local authentication requires FANOUT_AUTH_CODE_SECRET (32+ characters).\n") - b.WriteString("# Chat is disabled unless FANOUT_AI_PROVIDER selects anthropic or openai; its key is required.\n") + b.WriteString("# Local authentication requires PITOT_AUTH_CODE_SECRET (32+ characters).\n") + b.WriteString("# Chat is disabled unless PITOT_AI_PROVIDER selects anthropic or openai; its key is required.\n") for _, f := range fields { fmt.Fprintf(&b, "\n# %s; %s", f.Env, f.Type) if f.Secret { diff --git a/cmd/fanout-docgen/main_test.go b/cmd/pitot-docgen/main_test.go similarity index 95% rename from cmd/fanout-docgen/main_test.go rename to cmd/pitot-docgen/main_test.go index 75b99c7c4..15dd97e44 100644 --- a/cmd/fanout-docgen/main_test.go +++ b/cmd/pitot-docgen/main_test.go @@ -6,8 +6,8 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/fanql" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/fanql" ) const configSource = "../../internal/config/config.go" @@ -105,12 +105,12 @@ func TestEnvironmentTemplateMatchesSchema(t *testing.T) { } } // A copied template contributes no overrides to the image environment. - env = append(env, "FANOUT_ADDR=:7520", "FANOUT_DATA_DIR=/var/lib/fanout/data", "FANOUT_AUTH_CODE_SECRET="+strings.Repeat("x", 32)) + env = append(env, "PITOT_ADDR=:7520", "PITOT_DATA_DIR=/var/lib/pitot/data", "PITOT_AUTH_CODE_SECRET="+strings.Repeat("x", 32)) cfg, err := config.Load(config.LoadOptions{Environ: env}) if err != nil { t.Fatalf("template rejected by the runtime loader: %v", err) } - if cfg.Addr != ":7520" || cfg.DataDir != "/var/lib/fanout/data" { + if cfg.Addr != ":7520" || cfg.DataDir != "/var/lib/pitot/data" { t.Fatal("template must preserve image environment values") } } @@ -155,7 +155,7 @@ func TestRenderProducesOnePageWithFrontmatterPerGroup(t *testing.T) { for name, body := range pages { text := string(body) - if strings.Contains(text, "Fanout also recognizes") != (name == "configuration/ai.mdx") { + if strings.Contains(text, "Pitot also recognizes") != (name == "configuration/ai.mdx") { t.Errorf("%s: vendor-variable paragraph belongs only on the AI settings page", name) } if !strings.HasPrefix(text, "---\n") { diff --git a/cmd/fanout-docgen/mcptools.go b/cmd/pitot-docgen/mcptools.go similarity index 94% rename from cmd/fanout-docgen/mcptools.go rename to cmd/pitot-docgen/mcptools.go index ebade5ea2..d44dff847 100644 --- a/cmd/fanout-docgen/mcptools.go +++ b/cmd/pitot-docgen/mcptools.go @@ -6,8 +6,8 @@ import ( "sort" "strings" - "github.com/labstack/fanout/internal/mcp" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/mcp" + "github.com/labstack/pitot/internal/query" ) // toolCount is set by renderMCPTools so the summary line can report it. @@ -38,7 +38,7 @@ func renderMCPTools() ([]byte, error) { b.WriteString("---\n") b.WriteString("title: \"MCP tools\"\n") - b.WriteString("description: \"Every tool a Fanout instance exposes over MCP, with its inputs and whether it changes anything.\"\n") + b.WriteString("description: \"Every tool a Pitot instance exposes over MCP, with its inputs and whether it changes anything.\"\n") fmt.Fprintf(&b, "summary: \"%s served at /mcp, each with its inputs and mutation semantics.\"\n", count(len(tools), "tool"), @@ -50,12 +50,12 @@ func renderMCPTools() ([]byte, error) { b.WriteString("generated: true\n") b.WriteString("---\n\n") - b.WriteString("{/* Generated by cmd/fanout-docgen, which asks a running MCP server for its\n") + b.WriteString("{/* Generated by cmd/pitot-docgen, which asks a running MCP server for its\n") b.WriteString(" tool list rather than reading the registrations. Edit the generator, not\n") b.WriteString(" this page. */}\n\n") fmt.Fprintf(&b, - "A Fanout instance serves MCP at `/mcp`. %s are available to an Apps-enabled client. Ordinary clients receive the %d model-visible tools; the three app-only helpers require Apps negotiation and are never offered to the model.\n\n", + "A Pitot instance serves MCP at `/mcp`. %s are available to an Apps-enabled client. Ordinary clients receive the %d model-visible tools; the three app-only helpers require Apps negotiation and are never offered to the model.\n\n", count(len(tools), "tool"), modelVisible, ) @@ -109,7 +109,7 @@ func renderMCPTools() ([]byte, error) { "tool name %q is not usable as a heading anchor, so the summary table's "+ "link to its section would not resolve; either keep tool names to "+ "lowercase letters, digits and underscores, or slug the anchor in "+ - "cmd/fanout-docgen/mcptools.go", + "cmd/pitot-docgen/mcptools.go", tool.Name, ) } diff --git a/cmd/fanout-docgen/roles.go b/cmd/pitot-docgen/roles.go similarity index 87% rename from cmd/fanout-docgen/roles.go rename to cmd/pitot-docgen/roles.go index 8c00743a2..6f24e91b0 100644 --- a/cmd/fanout-docgen/roles.go +++ b/cmd/pitot-docgen/roles.go @@ -5,7 +5,7 @@ import ( "sort" "strings" - "github.com/labstack/fanout/internal/api" + "github.com/labstack/pitot/internal/api" ) // capabilityNotes is the authored half: what a capability lets someone do, in a @@ -53,7 +53,7 @@ func renderRoles() ([]byte, error) { sort.Strings(unlisted) return nil, fmt.Errorf( "the middleware defines role(s) %s that roleOrder does not place; "+ - "add them to roleOrder in cmd/fanout-docgen/roles.go", + "add them to roleOrder in cmd/pitot-docgen/roles.go", strings.Join(unlisted, ", "), ) } @@ -61,7 +61,7 @@ func renderRoles() ([]byte, error) { for _, capability := range caps { if capabilityNotes[capability] == "" { return nil, fmt.Errorf( - "capability %q has no entry in capabilityNotes in cmd/fanout-docgen/roles.go; "+ + "capability %q has no entry in capabilityNotes in cmd/pitot-docgen/roles.go; "+ "describe what it permits rather than publishing a bare name", capability, ) @@ -71,17 +71,17 @@ func renderRoles() ([]byte, error) { var b strings.Builder b.WriteString("---\n") b.WriteString("title: \"Roles\"\n") - b.WriteString("description: \"The three Fanout roles and the capabilities each one carries.\"\n") + b.WriteString("description: \"The three Pitot roles and the capabilities each one carries.\"\n") b.WriteString("summary: \"viewer, operator and admin, and what each is permitted to do.\"\n") b.WriteString("read_when:\n") b.WriteString(" - \"You are deciding which role to give someone.\"\n") - b.WriteString(" - \"You are mapping identity-provider groups onto Fanout roles.\"\n") + b.WriteString(" - \"You are mapping identity-provider groups onto Pitot roles.\"\n") b.WriteString(" - \"A request came back 403 and you want to know which capability it needed.\"\n") b.WriteString("status: preview\n") b.WriteString("generated: true\n") b.WriteString("---\n\n") - b.WriteString("{/* Generated by cmd/fanout-docgen from internal/api. Edit the generator, not this page. */}\n\n") + b.WriteString("{/* Generated by cmd/pitot-docgen from internal/api. Edit the generator, not this page. */}\n\n") b.WriteString("Each user has one fixed role: `viewer`, `operator` or `admin`.\n\n") @@ -113,9 +113,9 @@ func renderRoles() ([]byte, error) { } b.WriteString("\n## Who assigns roles\n\n") - b.WriteString("In `local` auth mode, roles are managed inside Fanout by an admin.\n\n") - b.WriteString("In `oidc` mode it depends on configuration. If `FANOUT_OIDC_ADMIN_GROUPS` or\n") - b.WriteString("`FANOUT_OIDC_OPERATOR_GROUPS` is set, the provider owns every linked user's\n") + b.WriteString("In `local` auth mode, roles are managed inside Pitot by an admin.\n\n") + b.WriteString("In `oidc` mode it depends on configuration. If `PITOT_OIDC_ADMIN_GROUPS` or\n") + b.WriteString("`PITOT_OIDC_OPERATOR_GROUPS` is set, the provider owns every linked user's\n") b.WriteString("role and reapplies it on each login; otherwise roles stay local.\n") b.WriteString("[Authentication modes](/docs/concepts/authentication) covers the details,\n") b.WriteString("including why the last active administrator is never demoted.\n\n") diff --git a/cmd/fanout-docgen/routes.go b/cmd/pitot-docgen/routes.go similarity index 94% rename from cmd/fanout-docgen/routes.go rename to cmd/pitot-docgen/routes.go index 95823bb71..ee5de462e 100644 --- a/cmd/fanout-docgen/routes.go +++ b/cmd/pitot-docgen/routes.go @@ -11,7 +11,7 @@ import ( "strconv" "strings" - "github.com/labstack/fanout/internal/api" + "github.com/labstack/pitot/internal/api" ) // routeCount is set by collectRoutes so the summary line can report it. @@ -30,7 +30,7 @@ var routeCount []api.RouteDoc // // It scans several directories because the surface is registered in several // places: the application handlers in internal/api, the agent runtime, and the -// operational, protocol and SPA routes wired up in cmd/fanout. Scanning only +// operational, protocol and SPA routes wired up in cmd/pitot. Scanning only // internal/api published a table that omitted /metrics, /debug/pprof/*, /mcp // and every /api/agent route, while the page invited an operator to audit what // an instance exposes (#188). @@ -220,7 +220,7 @@ func requirement(doc api.RouteDoc) string { case api.RoutePolicyProtocol: return "protocol handshake" case api.RoutePolicySCIM: - return "SCIM bearer token, when `FANOUT_SCIM_TOKEN` is set" + return "SCIM bearer token, when `PITOT_SCIM_TOKEN` is set" case api.RoutePolicyServiceCredential: return fmt.Sprintf("`%s`, or a service credential", doc.Capability) case api.RoutePolicyCapability: @@ -244,23 +244,23 @@ func renderRoutes(routes []api.RouteDoc) []byte { b.WriteString("generated: true\n") b.WriteString("---\n\n") - b.WriteString("{/* Generated by cmd/fanout-docgen from internal/api, internal/agent and cmd/fanout. Edit the generator, not this page. */}\n\n") + b.WriteString("{/* Generated by cmd/pitot-docgen from internal/api, internal/agent and cmd/pitot. Edit the generator, not this page. */}\n\n") - b.WriteString("Every route below is served on `FANOUT_ADDR` (`127.0.0.1:7520` by default;\n") + b.WriteString("Every route below is served on `PITOT_ADDR` (`127.0.0.1:7520` by default;\n") b.WriteString("the image sets `:7520`).\n") b.WriteString("OTLP shares this listener but uses its own handlers and ingest credential; see\n") b.WriteString("[send your first telemetry](/docs/get-started/send-telemetry).\n\n") b.WriteString("## Conditional routes\n\nThe table includes every route the binary can register. These routes depend on\nconfiguration:\n\n") - b.WriteString("- `/debug/pprof/*`: only when `FANOUT_PPROF_ENABLED` is true, which is\n") + b.WriteString("- `/debug/pprof/*`: only when `PITOT_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`, `/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(" `PITOT_MCP_ENABLED` is true, which **is** the default.\n") + b.WriteString("- `/api/agent/*`: only when `PITOT_AI_PROVIDER` selects `anthropic` or\n") b.WriteString(" `openai`, with that provider's required key. An empty provider disables chat.\n") b.WriteString("- `/api/auth/oidc/start` and `/api/auth/oidc/callback`: only in\n") - b.WriteString(" `FANOUT_AUTH_MODE=oidc`. They return 503 `unavailable` with `Retry-After`\n") + b.WriteString(" `PITOT_AUTH_MODE=oidc`. They return 503 `unavailable` with `Retry-After`\n") b.WriteString(" until provider discovery succeeds.\n\n") b.WriteString("Everything else is always registered. A path shown with `:name` or `*` is the\n") b.WriteString("pattern Echo matches on, not a literal URL.\n") diff --git a/cmd/fanout-docgen/routes_test.go b/cmd/pitot-docgen/routes_test.go similarity index 99% rename from cmd/fanout-docgen/routes_test.go rename to cmd/pitot-docgen/routes_test.go index 75860a3ae..14860f14e 100644 --- a/cmd/fanout-docgen/routes_test.go +++ b/cmd/pitot-docgen/routes_test.go @@ -6,13 +6,13 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/api" + "github.com/labstack/pitot/internal/api" ) // The directories the generator scans by default, from the same list main.go // ships. A test that scanned only internal/api would keep passing through // exactly the regression #188 was about. -var routeDirs = []string{"../../internal/api", "../../internal/agent", "../../cmd/fanout"} +var routeDirs = []string{"../../internal/api", "../../internal/agent", "../../cmd/pitot"} func TestHistoricalDashboardReadIsDocumentedAsOwnerCapability(t *testing.T) { routes, err := collectRoutes(routeDirs) diff --git a/cmd/fanout/main.go b/cmd/pitot/main.go similarity index 89% rename from cmd/fanout/main.go rename to cmd/pitot/main.go index f964fc47f..441b9b065 100644 --- a/cmd/fanout/main.go +++ b/cmd/pitot/main.go @@ -29,25 +29,25 @@ import ( "google.golang.org/grpc" _ "google.golang.org/grpc/encoding/gzip" // Register gzip decompressor - "github.com/labstack/fanout/internal/agent" - "github.com/labstack/fanout/internal/alert" - "github.com/labstack/fanout/internal/annotations" - "github.com/labstack/fanout/internal/api" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/ingest" - "github.com/labstack/fanout/internal/intelligence" - "github.com/labstack/fanout/internal/mcp" - appmetrics "github.com/labstack/fanout/internal/metrics" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/server" - "github.com/labstack/fanout/internal/settings" - "github.com/labstack/fanout/internal/store" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" - "github.com/labstack/fanout/internal/ui" + "github.com/labstack/pitot/internal/agent" + "github.com/labstack/pitot/internal/alert" + "github.com/labstack/pitot/internal/annotations" + "github.com/labstack/pitot/internal/api" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/ingest" + "github.com/labstack/pitot/internal/intelligence" + "github.com/labstack/pitot/internal/mcp" + appmetrics "github.com/labstack/pitot/internal/metrics" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/server" + "github.com/labstack/pitot/internal/settings" + "github.com/labstack/pitot/internal/store" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" + "github.com/labstack/pitot/internal/ui" ) // version is set at build time via -ldflags "-X main.version=...". @@ -75,16 +75,24 @@ func main() { fmt.Println(version) return } + var healthEnvironment map[string]string + if healthURL != "" || derivedProbe { + healthEnvironment = make(map[string]string) + for _, assignment := range config.ResolveEnvironment(os.Environ()) { + name, value, _ := strings.Cut(assignment, "=") + healthEnvironment[name] = value + } + } if derivedProbe { - healthURL, err = healthcheckURL(os.Getenv("FANOUT_ADDR"), os.Getenv("FANOUT_TLS_CERT_FILE")) + healthURL, err = healthcheckURL(healthEnvironment["PITOT_ADDR"], healthEnvironment["PITOT_TLS_CERT_FILE"]) if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(2) } } if healthURL != "" || derivedProbe { - if err := checkHealth(healthURL, derivedProbe, os.Getenv("FANOUT_TLS_CERT_FILE"), - os.Getenv("FANOUT_HEALTHCHECK_CERT_FILE"), os.Getenv("FANOUT_HEALTHCHECK_KEY_FILE")); err != nil { + if err := checkHealth(healthURL, derivedProbe, healthEnvironment["PITOT_TLS_CERT_FILE"], + healthEnvironment["PITOT_HEALTHCHECK_CERT_FILE"], healthEnvironment["PITOT_HEALTHCHECK_KEY_FILE"]); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } @@ -100,7 +108,7 @@ func main() { } if repair != nil { if err := runRepair(cfg.TelemetryDir(), *repair, os.Stdout); err != nil { - fmt.Fprintln(os.Stderr, "fanout repair:", err) + fmt.Fprintln(os.Stderr, "pitot repair:", err) os.Exit(1) } return @@ -286,7 +294,7 @@ func main() { e.GET("/debug/pprof/:name", echo.WrapHandler(http.HandlerFunc(pprof.Index)), operations) // heap, goroutine, allocs, mutex, block… } - // Fanout owns telemetry semantics; agents and web clients consume this one + // Pitot owns telemetry semantics; agents and web clients consume this one // typed query kernel through deterministic HTTP or standard MCP tools. // Route both HTTP and MCP reads through Duck's retrying adapter. Passing the // raw *sql.DB here bypassed the Telemetry maintenance-race protection. @@ -414,7 +422,7 @@ func main() { agent.NewRuntime(provider, toolRegistry, agent.NewStore(sqlite.DB)).Register(e.Group("/api/agent", api.RequireCapability(api.RunAgent))) slog.Info("AG-UI agent enabled", "path", "/api/agent/runs", "provider", cfg.AIProvider) } else { - slog.Info("AG-UI agent disabled", "reason", "FANOUT_AI_PROVIDER is not selected") + slog.Info("AG-UI agent disabled", "reason", "PITOT_AI_PROVIDER is not selected") } // The compiled browser client is an embedded asset, not a second runtime. @@ -450,8 +458,8 @@ func main() { failed = true slog.Error("fatal error, shutting down", "err", err) case err := <-q.Fatal(): - // DuckDB invalidated its database, or Fanout's own work on it stalled. - // Flush ingest and exit nonzero so the supervisor restarts Fanout, + // DuckDB invalidated its database, or Pitot's own work on it stalled. + // Flush ingest and exit nonzero so the supervisor restarts Pitot, // which rebuilds the query cache from Parquet. failed = true stalled = errors.Is(err, engine.ErrStalled) @@ -489,21 +497,21 @@ func parseCommandLine(args []string, output io.Writer) (showVersion bool, loginL return false, nil, "", true, nil, nil } - flags := flag.NewFlagSet("fanout", flag.ContinueOnError) + flags := flag.NewFlagSet("pitot", flag.ContinueOnError) flags.SetOutput(output) flags.Usage = func() { - fmt.Fprintln(output, "Usage of fanout:") - fmt.Fprintln(output, " fanout [flags]") - fmt.Fprintln(output, " fanout login-link [--break-glass]") - fmt.Fprintln(output, " fanout repair verify") - fmt.Fprintln(output, " fanout repair quarantine --batch ") - fmt.Fprintln(output, " fanout healthcheck [url]") - fmt.Fprintln(output, " fanout version") + fmt.Fprintln(output, "Usage of pitot:") + fmt.Fprintln(output, " pitot [flags]") + fmt.Fprintln(output, " pitot login-link [--break-glass]") + fmt.Fprintln(output, " pitot repair verify") + fmt.Fprintln(output, " pitot repair quarantine --batch ") + fmt.Fprintln(output, " pitot healthcheck [url]") + fmt.Fprintln(output, " pitot version") fmt.Fprintln(output, "Flags:") flags.PrintDefaults() } - flags.BoolVar(&showVersion, "version", false, "print the Fanout version") - flags.BoolVar(&showVersion, "v", false, "print the Fanout version") + flags.BoolVar(&showVersion, "version", false, "print the Pitot version") + flags.BoolVar(&showVersion, "v", false, "print the Pitot version") if err := flags.Parse(args); err != nil { return false, nil, "", false, nil, err } @@ -549,7 +557,7 @@ func parseRepairCommand(args []string, output io.Writer) (*repairCommand, error) if len(args) == 0 || args[0] != "quarantine" { return nil, errors.New("repair requires 'verify' or 'quarantine --batch '") } - flags := flag.NewFlagSet("fanout repair quarantine", flag.ContinueOnError) + flags := flag.NewFlagSet("pitot repair quarantine", flag.ContinueOnError) flags.SetOutput(output) batch := flags.String("batch", "", "unreadable authoritative batch ID to set aside") if err := flags.Parse(args[1:]); err != nil { @@ -597,7 +605,7 @@ func healthcheckURL(addr, certFile string) (string, error) { } host, port, err := net.SplitHostPort(addr) if err != nil { - return "", fmt.Errorf("FANOUT_ADDR must be a host:port address: %w", err) + return "", fmt.Errorf("PITOT_ADDR must be a host:port address: %w", err) } if host == "" { host = "127.0.0.1" @@ -628,7 +636,7 @@ func checkHealth(healthURL string, derivedProbe bool, certFile, clientCertFile, transport.Proxy = nil if probe.Scheme == "https" && (clientCertFile != "" || clientKeyFile != "") { if clientCertFile == "" || clientKeyFile == "" { - return fmt.Errorf("healthcheck: FANOUT_HEALTHCHECK_CERT_FILE and FANOUT_HEALTHCHECK_KEY_FILE must both be set") + return fmt.Errorf("healthcheck: PITOT_HEALTHCHECK_CERT_FILE and PITOT_HEALTHCHECK_KEY_FILE must both be set") } pair, err := tls.LoadX509KeyPair(clientCertFile, clientKeyFile) if err != nil { @@ -691,7 +699,7 @@ func createLoginLink(cfg config.Config, rawEmail string, breakGlass bool, output mode := strings.ToLower(strings.TrimSpace(cfg.AuthMode)) if breakGlass { if mode != "oidc" { - return fmt.Errorf("--break-glass is available only in oidc auth mode; use fanout login-link in local mode") + return fmt.Errorf("--break-glass is available only in oidc auth mode; use pitot login-link in local mode") } if err := cfg.ValidateLoginLinkSecret(); err != nil { return fmt.Errorf("break-glass login links need a configured secret: %w", err) @@ -745,7 +753,7 @@ func createLoginLink(cfg config.Config, rawEmail string, breakGlass bool, output query := loginURL.Query() query.Set("login_token", token) loginURL.RawQuery = query.Encode() - fmt.Fprintf(output, "fanout: %s for %s (valid 15 minutes, single use)\n %s\n", label, email, loginURL.String()) + fmt.Fprintf(output, "pitot: %s for %s (valid 15 minutes, single use)\n %s\n", label, email, loginURL.String()) return nil } @@ -761,9 +769,9 @@ func applyConfiguredIngestToken(ctx context.Context, store *settings.Store, toke return err } if applied { - slog.Info("ingest token set from FANOUT_INGEST_TOKEN") + slog.Info("ingest token set from PITOT_INGEST_TOKEN") } else { - slog.Info("FANOUT_INGEST_TOKEN ignored because an ingest token has already existed") + slog.Info("PITOT_INGEST_TOKEN ignored because an ingest token has already existed") } return nil } @@ -789,7 +797,7 @@ func setupBannerRequired(userCount int64, cfg config.Config) bool { func printSetupBanner(httpAddr, token string) { lines := []string{ "============================================================", - " FANOUT SETUP", + " PITOT SETUP", "", " Open: " + setupLoginURL(httpAddr) + "?setup_token=" + url.QueryEscape(token), " Valid: one-time use, expires in 1 hour", diff --git a/cmd/fanout/main_test.go b/cmd/pitot/main_test.go similarity index 92% rename from cmd/fanout/main_test.go rename to cmd/pitot/main_test.go index 17e58a514..274d61c0a 100644 --- a/cmd/fanout/main_test.go +++ b/cmd/pitot/main_test.go @@ -26,19 +26,19 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/server" - "github.com/labstack/fanout/internal/settings" - "github.com/labstack/fanout/internal/store" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/server" + "github.com/labstack/pitot/internal/settings" + "github.com/labstack/pitot/internal/store" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestParseCommandLine(t *testing.T) { - t.Setenv("FANOUT_ADDR", "invalid") - t.Setenv("FANOUT_TLS_CERT_FILE", "cert.pem") - t.Setenv("FANOUT_AUTH_CODE_SECRET_FILE", "/missing") + t.Setenv("PITOT_ADDR", "invalid") + t.Setenv("PITOT_TLS_CERT_FILE", "cert.pem") + t.Setenv("PITOT_AUTH_CODE_SECRET_FILE", "/missing") tests := []struct { name string args []string @@ -60,7 +60,7 @@ func TestParseCommandLine(t *testing.T) { {name: "login link unknown flag", args: []string{"login-link", "--force", "admin@example.com"}, wantErr: true}, {name: "login link two emails", args: []string{"login-link", "a@example.com", "b@example.com"}, wantErr: true}, {name: "default healthcheck", args: []string{"healthcheck"}, wantDerived: true}, - {name: "custom healthcheck", args: []string{"healthcheck", "http://fanout:8080/healthz"}, wantHealth: "http://fanout:8080/healthz"}, + {name: "custom healthcheck", args: []string{"healthcheck", "http://pitot:8080/healthz"}, wantHealth: "http://pitot:8080/healthz"}, {name: "repair verify", args: []string{"repair", "verify"}, wantRepair: &repairCommand{action: "verify"}}, {name: "repair quarantine", args: []string{"repair", "quarantine", "--batch", "broken"}, wantRepair: &repairCommand{action: "quarantine", batch: "broken"}}, {name: "repair quarantine missing batch", args: []string{"repair", "quarantine"}, wantErr: true}, @@ -104,7 +104,7 @@ func TestParseCommandLinePrintsOneErrorAndUsage(t *testing.T) { if got := strings.Count(output.String(), "unexpected arguments: serve"); got != 1 { t.Fatalf("error appeared %d times in %q", got, output.String()) } - if !strings.Contains(output.String(), "Usage of fanout") { + if !strings.Contains(output.String(), "Usage of pitot") { t.Fatalf("output does not include usage: %q", output.String()) } if !strings.Contains(output.String(), "login-link ") { @@ -181,7 +181,7 @@ func TestCreateLoginLink(t *testing.T) { AuthCodeSecret: "0123456789abcdef0123456789abcdef", DataDir: t.TempDir(), Addr: ":7520", - PublicURL: "https://fanout.example.com/base", + PublicURL: "https://pitot.example.com/base", } if err := os.MkdirAll(cfg.ControlDir(), 0o755); err != nil { t.Fatalf("MkdirAll: %v", err) @@ -207,7 +207,7 @@ func TestCreateLoginLink(t *testing.T) { if err != nil { t.Fatalf("parse URL: %v", err) } - if loginURL.Scheme != "https" || loginURL.Host != "fanout.example.com" || loginURL.Path != "/login" { + if loginURL.Scheme != "https" || loginURL.Host != "pitot.example.com" || loginURL.Path != "/login" { t.Fatalf("login URL = %s", loginURL) } @@ -236,7 +236,7 @@ func breakGlassTestConfig(t *testing.T, role auth.Role, status auth.UserStatus) AuthCodeSecret: "0123456789abcdef0123456789abcdef", DataDir: t.TempDir(), Addr: ":7520", - PublicURL: "https://fanout.example.com", + PublicURL: "https://pitot.example.com", } if err := os.MkdirAll(cfg.ControlDir(), 0o755); err != nil { t.Fatalf("MkdirAll: %v", err) @@ -320,7 +320,7 @@ func TestCreateBreakGlassLoginLinkForActiveAdministrator(t *testing.T) { // not depend on who owns accounts. func TestCreateBreakGlassLoginLinkWhenIdentityProviderOwnsAccounts(t *testing.T) { cfg := breakGlassTestConfig(t, auth.RoleAdmin, auth.UserStatusActive) - cfg.OIDCAdminGroups = "fanout-admins" + cfg.OIDCAdminGroups = "pitot-admins" cfg.SCIMToken = "scim-test-token-0123456789abcdef0123" var output bytes.Buffer if err := createLoginLink(cfg, "user@example.com", true, &output); err != nil { @@ -344,8 +344,8 @@ func TestCreateBreakGlassLoginLinkRefusals(t *testing.T) { {name: "viewer", role: auth.RoleViewer, status: auth.UserStatusActive, email: email, wantErr: "administrator"}, {name: "operator", role: auth.RoleOperator, status: auth.UserStatusActive, email: email, wantErr: "administrator"}, {name: "suspended administrator", role: auth.RoleAdmin, status: auth.UserStatusSuspended, email: email, wantErr: "suspended"}, - {name: "empty secret", role: auth.RoleAdmin, status: auth.UserStatusActive, email: email, mutate: func(c *config.Config) { c.AuthCodeSecret = "" }, wantErr: "FANOUT_AUTH_CODE_SECRET"}, - {name: "short secret", role: auth.RoleAdmin, status: auth.UserStatusActive, email: email, mutate: func(c *config.Config) { c.AuthCodeSecret = "short" }, wantErr: "FANOUT_AUTH_CODE_SECRET"}, + {name: "empty secret", role: auth.RoleAdmin, status: auth.UserStatusActive, email: email, mutate: func(c *config.Config) { c.AuthCodeSecret = "" }, wantErr: "PITOT_AUTH_CODE_SECRET"}, + {name: "short secret", role: auth.RoleAdmin, status: auth.UserStatusActive, email: email, mutate: func(c *config.Config) { c.AuthCodeSecret = "short" }, wantErr: "PITOT_AUTH_CODE_SECRET"}, {name: "local mode", role: auth.RoleAdmin, status: auth.UserStatusActive, email: email, mutate: func(c *config.Config) { c.AuthMode = "local" }, wantErr: "oidc"}, } { t.Run(tc.name, func(t *testing.T) { @@ -403,10 +403,10 @@ func TestHealthcheckURL(t *testing.T) { } func TestHealthcheckUsesEnvironmentWithoutValidatingSecrets(t *testing.T) { - t.Setenv("FANOUT_ADDR", "[::]:9090") - t.Setenv("FANOUT_TLS_CERT_FILE", "cert.pem") - t.Setenv("FANOUT_AUTH_CODE_SECRET_FILE", "/missing") - probe, err := healthcheckURL(os.Getenv("FANOUT_ADDR"), os.Getenv("FANOUT_TLS_CERT_FILE")) + t.Setenv("PITOT_ADDR", "[::]:9090") + t.Setenv("PITOT_TLS_CERT_FILE", "cert.pem") + t.Setenv("PITOT_AUTH_CODE_SECRET_FILE", "/missing") + probe, err := healthcheckURL(os.Getenv("PITOT_ADDR"), os.Getenv("PITOT_TLS_CERT_FILE")) if err != nil || probe != "https://127.0.0.1:9090/healthz" { t.Fatalf("probe = %s, %v", probe, err) } @@ -466,7 +466,7 @@ func newHealthcheckCertificate(t *testing.T, certificate *x509.Certificate) tls. return tls.Certificate{Certificate: [][]byte{der}, PrivateKey: key} } -// The derived probe presents FANOUT_HEALTHCHECK_CERT_FILE to a listener that +// The derived probe presents PITOT_HEALTHCHECK_CERT_FILE to a listener that // requires client certificates, and fails without it. func TestCheckHealthWithClientCertificate(t *testing.T) { caKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) @@ -491,7 +491,7 @@ func TestCheckHealthWithClientCertificate(t *testing.T) { t.Fatal(err) } clientDER, err := x509.CreateCertificate(rand.Reader, &x509.Certificate{ - SerialNumber: big.NewInt(11), Subject: pkix.Name{CommonName: "fanout healthcheck"}, + SerialNumber: big.NewInt(11), Subject: pkix.Name{CommonName: "pitot healthcheck"}, NotBefore: time.Now().Add(-time.Hour), NotAfter: time.Now().Add(time.Hour), KeyUsage: x509.KeyUsageDigitalSignature, ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}, }, ca, &clientKey.PublicKey, caKey) @@ -549,7 +549,7 @@ func TestCheckHealthWithClientCertificate(t *testing.T) { if err := checkHealth(probe, true, certFile, "", ""); err == nil { t.Fatal("healthcheck without a client certificate must fail") } - if err := checkHealth(probe, true, certFile, clientCertFile, ""); err == nil || !strings.Contains(err.Error(), "FANOUT_HEALTHCHECK_KEY_FILE") { + if err := checkHealth(probe, true, certFile, clientCertFile, ""); err == nil || !strings.Contains(err.Error(), "PITOT_HEALTHCHECK_KEY_FILE") { t.Fatalf("partial client pair must name both variables, got %v", err) } missing := filepath.Join(dir, "missing-key.pem") @@ -602,10 +602,10 @@ func TestCheckHealthTLSCertificate(t *testing.T) { wantErr bool }{ {name: "IP SAN", ips: []net.IP{net.ParseIP("192.0.2.10")}}, - {name: "DNS before IP SAN", dnsNames: []string{"fanout.example.com", "other.example.com"}, ips: []net.IP{net.ParseIP("192.0.2.10")}}, + {name: "DNS before IP SAN", dnsNames: []string{"pitot.example.com", "other.example.com"}, ips: []net.IP{net.ParseIP("192.0.2.10")}}, {name: "no SAN", wantErr: true}, - {name: "expired", dnsNames: []string{"fanout.example.com"}, expired: true, wantErr: true}, - {name: "client usage", dnsNames: []string{"fanout.example.com"}, clientOnly: true, wantErr: true}, + {name: "expired", dnsNames: []string{"pitot.example.com"}, expired: true, wantErr: true}, + {name: "client usage", dnsNames: []string{"pitot.example.com"}, clientOnly: true, wantErr: true}, } { t.Run(test.name, func(t *testing.T) { certificate := &x509.Certificate{ @@ -642,7 +642,7 @@ func TestCheckHealthTLSCertificate(t *testing.T) { func TestCheckHealthWithInterfaceTLS(t *testing.T) { certificate := &x509.Certificate{ - SerialNumber: big.NewInt(1), DNSNames: []string{"fanout.example.com"}, + SerialNumber: big.NewInt(1), DNSNames: []string{"pitot.example.com"}, NotBefore: time.Now().Add(-time.Hour), NotAfter: time.Now().Add(time.Hour), KeyUsage: x509.KeyUsageDigitalSignature, ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, } @@ -656,7 +656,7 @@ func TestCheckHealthWithInterfaceTLS(t *testing.T) { server.StartTLS() defer server.Close() certFile := writeHealthcheckCertificate(t, server.Certificate().Raw) - for _, addr := range []string{"192.0.2.10:7520", "[2001:db8::10]:7520", "[fe80::1%eth0]:7520", "fanout.example.com:7520", "wrong.example.com:7520"} { + for _, addr := range []string{"192.0.2.10:7520", "[2001:db8::10]:7520", "[fe80::1%eth0]:7520", "pitot.example.com:7520", "wrong.example.com:7520"} { t.Run(addr, func(t *testing.T) { original := http.DefaultTransport transport := original.(*http.Transport).Clone() @@ -674,9 +674,9 @@ func TestCheckHealthWithInterfaceTLS(t *testing.T) { http.DefaultTransport = original transport.CloseIdleConnections() }) - t.Setenv("FANOUT_ADDR", addr) - t.Setenv("FANOUT_TLS_CERT_FILE", certFile) - probe, err := healthcheckURL(os.Getenv("FANOUT_ADDR"), os.Getenv("FANOUT_TLS_CERT_FILE")) + t.Setenv("PITOT_ADDR", addr) + t.Setenv("PITOT_TLS_CERT_FILE", certFile) + probe, err := healthcheckURL(os.Getenv("PITOT_ADDR"), os.Getenv("PITOT_TLS_CERT_FILE")) if err != nil { t.Fatal(err) } @@ -704,7 +704,7 @@ func TestCheckHealthWithInterfaceTLS(t *testing.T) { func TestCheckHealthDerivedIgnoresEnvironmentProxy(t *testing.T) { // ProxyFromEnvironment caches settings on first use, so use a fresh process // to ensure earlier tests cannot hide the configured proxies. - if os.Getenv("FANOUT_TEST_PROXY_CHILD") != "1" { + if os.Getenv("PITOT_TEST_PROXY_CHILD") != "1" { listener, err := net.Listen("tcp", "127.0.0.1:0") if err != nil { t.Fatal(err) @@ -718,7 +718,7 @@ func TestCheckHealthDerivedIgnoresEnvironmentProxy(t *testing.T) { t.Setenv("NO_PROXY", "") t.Setenv("no_proxy", "") t.Setenv("REQUEST_METHOD", "") - t.Setenv("FANOUT_TEST_PROXY_CHILD", "1") + t.Setenv("PITOT_TEST_PROXY_CHILD", "1") command := exec.Command(os.Args[0], "-test.run=^TestCheckHealthDerivedIgnoresEnvironmentProxy$", "-test.v") if output, err := command.CombinedOutput(); err != nil { t.Fatalf("proxy regression subprocess: %v\n%s", err, output) @@ -727,7 +727,7 @@ func TestCheckHealthDerivedIgnoresEnvironmentProxy(t *testing.T) { } for _, tc := range []struct{ scheme, addr string }{ {"http", "192.0.2.10:7520"}, {"https", "192.0.2.10:7520"}, - {"http", "fanout.example.com:7520"}, {"https", "example.com:7520"}, + {"http", "pitot.example.com:7520"}, {"https", "example.com:7520"}, } { t.Run(tc.scheme+"/"+tc.addr, func(t *testing.T) { scheme, addr := tc.scheme, tc.addr @@ -766,9 +766,9 @@ func TestCheckHealthDerivedIgnoresEnvironmentProxy(t *testing.T) { http.DefaultTransport = original transport.CloseIdleConnections() }) - t.Setenv("FANOUT_ADDR", addr) - t.Setenv("FANOUT_TLS_CERT_FILE", certFile) - probe, err := healthcheckURL(os.Getenv("FANOUT_ADDR"), os.Getenv("FANOUT_TLS_CERT_FILE")) + t.Setenv("PITOT_ADDR", addr) + t.Setenv("PITOT_TLS_CERT_FILE", certFile) + probe, err := healthcheckURL(os.Getenv("PITOT_ADDR"), os.Getenv("PITOT_TLS_CERT_FILE")) if err != nil { t.Fatal(err) } @@ -820,7 +820,7 @@ func TestApplyConfiguredIngestTokenLogsWithoutToken(t *testing.T) { if strings.Contains(output, first) || strings.Contains(output, second) || strings.Contains(output, hash) { t.Fatalf("logs exposed token material: %s", output) } - if strings.Count(output, "FANOUT_INGEST_TOKEN") != 2 { + if strings.Count(output, "PITOT_INGEST_TOKEN") != 2 { t.Fatalf("logs must report both outcomes by setting name: %s", output) } } diff --git a/cmd/fanout/setup_banner_test.go b/cmd/pitot/setup_banner_test.go similarity index 92% rename from cmd/fanout/setup_banner_test.go rename to cmd/pitot/setup_banner_test.go index 1c02ab604..2b1a6d3c7 100644 --- a/cmd/fanout/setup_banner_test.go +++ b/cmd/pitot/setup_banner_test.go @@ -3,7 +3,7 @@ package main import ( "testing" - "github.com/labstack/fanout/internal/config" + "github.com/labstack/pitot/internal/config" ) func TestSetupBannerRequired(t *testing.T) { diff --git a/context7.json b/context7.json index 9c8e1ff9d..94d3b3b3b 100644 --- a/context7.json +++ b/context7.json @@ -1,6 +1,6 @@ { "$schema": "https://context7.com/schema/context7.json", - "projectTitle": "Fanout", + "projectTitle": "Pitot", "description": "Single-binary, agent-native OpenTelemetry investigation. Ingests OTLP, stores Parquet, queries with embedded DuckDB.", "branch": "main", "folders": ["site/src/content/docs", "docs", "README.md"], @@ -11,10 +11,10 @@ "docs/diagrams" ], "rules": [ - "Fanout is one Go process with no external dependencies to operate. There is no separate ingester, query service, metadata database, object store, or dashboard server to deploy.", + "Pitot is one Go process with no external dependencies to operate. There is no separate ingester, query service, metadata database, object store, or dashboard server to deploy.", "Telemetry arrives over OTLP/gRPC or OTLP/HTTP on port 7520. Point an OpenTelemetry SDK or Collector at it; do not invent a bespoke ingest protocol.", "Parquet is the authoritative telemetry store. DuckDB query state and rollups are rebuildable from it, and SQLite is reserved for transactional product state.", - "Fanout exposes an MCP server, and the browser client, the in-process agent and any external MCP host all reach the same typed observability contract rather than issuing raw SQL.", - "Configuration uses process environment over built-in defaults; see .env.example. Custom names use `FANOUT_`; AI keys and endpoints use documented vendor names. Secret variables also accept `_FILE` paths. The Go module path is `github.com/labstack/fanout`." + "Pitot exposes an MCP server, and the browser client, the in-process agent and any external MCP host all reach the same typed observability contract rather than issuing raw SQL.", + "Configuration uses process environment over built-in defaults; see .env.example. Custom names use `PITOT_`; AI keys and endpoints use documented vendor names. Secret variables also accept `_FILE` paths. The Go module path is `github.com/labstack/pitot`." ] } diff --git a/docs/adr/0001-environment-only-configuration.md b/docs/adr/0001-environment-only-configuration.md index 39f43462b..8208c6136 100644 --- a/docs/adr/0001-environment-only-configuration.md +++ b/docs/adr/0001-environment-only-configuration.md @@ -5,7 +5,7 @@ Date: 2026-10-30 ## Context -Fanout runs as one binary on laptops, containers and hosted platforms. It +Pitot runs as one binary on laptops, containers and hosted platforms. It needs one configuration source that works the same way in each, and a way to deliver secrets without writing them into configuration. @@ -13,9 +13,9 @@ deliver secrets without writing them into configuration. Configuration comes only from the process environment, over built-in defaults. `internal/config/config.go` is the authoritative schema. Custom names use the -`FANOUT_` prefix; vendor credentials and endpoints keep their vendor names +`PITOT_` prefix; vendor credentials and endpoints keep their vendor names (`ANTHROPIC_API_KEY`, `OPENAI_BASE_URL`, …). Every secret also accepts a -`_FILE` form. Unknown `FANOUT_` names fail startup. The binary does not +`_FILE` form. Unknown `PITOT_` names fail startup. The binary does not load dotenv files. ## Consequences @@ -23,4 +23,4 @@ load dotenv files. - One precedence rule and one place to read the schema. - `.env.example` and the site reference are generated from the schema. - Secrets can be mounted as files without appearing in the environment. -- A typo in a `FANOUT_` name fails fast instead of being ignored. +- A typo in a `PITOT_` name fails fast instead of being ignored. diff --git a/docs/adr/0002-sqlite-goose-sqlc-control-state.md b/docs/adr/0002-sqlite-goose-sqlc-control-state.md index 43939adfc..04615f7ac 100644 --- a/docs/adr/0002-sqlite-goose-sqlc-control-state.md +++ b/docs/adr/0002-sqlite-goose-sqlc-control-state.md @@ -5,7 +5,7 @@ Date: 2026-10-30 ## Context -Fanout needs a transactional store for users, sessions, dashboards, alerts and +Pitot needs a transactional store for users, sessions, dashboards, alerts and settings, without adding a database server to operate. ## Decision diff --git a/docs/adr/0003-pinned-duckdb-and-batch-format-4.md b/docs/adr/0003-pinned-duckdb-and-batch-format-4.md index ebe4d8413..e29f053c9 100644 --- a/docs/adr/0003-pinned-duckdb-and-batch-format-4.md +++ b/docs/adr/0003-pinned-duckdb-and-batch-format-4.md @@ -12,7 +12,7 @@ change query results. ## Decision -Fanout builds against one pinned DuckDB 2 engine (`internal/duckdb`, built with +Pitot builds against one pinned DuckDB 2 engine (`internal/duckdb`, built with `scripts/with-duckdb.sh`) with statically linked extensions and no dynamic extension downloads. Telemetry is stored only as batch format 4 Parquet with typed attribute maps. A schema change requires a new format version; there is diff --git a/docs/adr/0005-calver-releases.md b/docs/adr/0005-calver-releases.md index e5415b766..17207db08 100644 --- a/docs/adr/0005-calver-releases.md +++ b/docs/adr/0005-calver-releases.md @@ -5,7 +5,7 @@ Date: 2026-10-30 ## Context -Fanout ships frequently and its maturity is better described by date and stage +Pitot ships frequently and its maturity is better described by date and stage than by semantic version numbers. ## Decision diff --git a/docs/authentication.md b/docs/authentication.md index df4bc722d..da8222eb1 100644 --- a/docs/authentication.md +++ b/docs/authentication.md @@ -1,16 +1,16 @@ # Authentication and access operations -Operator reference for running Fanout's authentication safely. Settings are -environment variables; see the [settings reference](https://fanout.run/docs/reference/configuration). +Operator reference for running Pitot's authentication safely. Settings are +environment variables; see the [settings reference](https://pitot.dev/docs/reference/configuration). ## First run -At first boot, with zero users in the database, Fanout prints a setup banner to +At first boot, with zero users in the database, Pitot prints a setup banner to stderr containing a **setup URL**: ``` ============================================================ - FANOUT SETUP + PITOT SETUP Open: http://127.0.0.1:7520/login?setup_token= Valid: one-time use, expires in 1 hour @@ -42,11 +42,11 @@ Setup credential behavior: ### Before you complete setup -Local mode requires only a 32-character `FANOUT_AUTH_CODE_SECRET`. SMTP is +Local mode requires only a 32-character `PITOT_AUTH_CODE_SECRET`. SMTP is optional: when all SMTP settings are present, users can request email codes; without them, an operator with access to the control database can mint a login link. OIDC mode instead requires an HTTPS issuer, a client, and an HTTPS -`FANOUT_PUBLIC_URL`; set `FANOUT_AUTH_CODE_SECRET` as well to keep +`PITOT_PUBLIC_URL`; set `PITOT_AUTH_CODE_SECRET` as well to keep [break-glass recovery](#oidc-break-glass-recovery) available. After setup in local mode, send yourself a code if SMTP is configured and @@ -57,7 +57,7 @@ login link remains available when delivery fails. ### Local self-signup Local accounts are invitation-only by default. To let any verified email -address create an account, set `FANOUT_SELF_SIGNUP=true`. Fanout sends the +address create an account, set `PITOT_SELF_SIGNUP=true`. Pitot sends the email code and creates an active `viewer` only after that code is successfully verified. The role is fixed: self-signup can never create an operator or administrator. @@ -65,7 +65,7 @@ The setting requires complete SMTP configuration and local auth mode. Self-signup remains unavailable until the first administrator completes setup. Suspended accounts are not recreated or reactivated. Public installations -should enforce traffic and AI-budget limits at the deployment edge; Fanout also +should enforce traffic and AI-budget limits at the deployment edge; Pitot also retains its per-IP, per-address, expiry, and attempt limits described below. ### Recovery @@ -74,20 +74,20 @@ If you are locked out in local mode, run the command with the same configuration and data directory as the server: ```sh -fanout login-link admin@example.com +pitot login-link admin@example.com ``` For a running container: ```sh -docker exec fanout \ +docker exec pitot \ login-link admin@example.com ``` The command refuses missing or suspended users and a missing control database. It writes a hashed credential and a `login_link.issued` audit event, then prints one URL to stderr. The URL expires after 15 minutes, works once, and writes a -distinct `login_link.redeemed` audit event when used. Running it while Fanout is +distinct `login_link.redeemed` audit event when used. Running it while Pitot is online is supported by the control database's WAL and busy-timeout settings. Fix SMTP after regaining access if email-code login is expected. Ordinary @@ -99,13 +99,13 @@ When the identity provider is unavailable, an operator with access to the control database can issue a one-time link for an active administrator: ```sh -fanout login-link --break-glass admin@example.com +pitot login-link --break-glass admin@example.com ``` -`FANOUT_AUTH_CODE_SECRET` must be set to at least 32 characters, on both the +`PITOT_AUTH_CODE_SECRET` must be set to at least 32 characters, on both the command and the server, because it protects the stored credential. OIDC mode does not require the secret at startup, so an installation that wants this -recovery path must set it and restart Fanout before the outage. Without it the +recovery path must set it and restart Pitot before the outage. Without it the command fails with an error naming the variable and `/api/auth/link/verify` stays disabled. @@ -115,14 +115,14 @@ accepts only these links, refuses an ordinary login link without consuming it, and re-checks that the account is still an active administrator. Issuing writes a `login_link.break_glass_issued` audit event and redeeming writes a `login_link.break_glass_redeemed` audit event. If the redemption event cannot be -written, Fanout creates no session and the request fails; the link is spent, so +written, Pitot creates no session and the request fails; the link is spent, so issue a new one. `/api/auth/link/verify` is rate limited per client address. Behind a reverse -proxy, set `FANOUT_TRUSTED_PROXY_CIDRS`; otherwise every request shares the +proxy, set `PITOT_TRUSTED_PROXY_CIDRS`; otherwise every request shares the proxy's address and one limit, and other traffic can block recovery. -Fanout starts while the identity provider is unavailable, so break-glass access +Pitot starts while the identity provider is unavailable, so break-glass access also works after a restart during the outage. See [Provider availability](#provider-availability). @@ -159,11 +159,11 @@ User creation remains available when SMTP is not configured. The API returns `201` with `invite_delivery: "not_configured"` and `login_link_required: true`; mint the new active user a login link with the same command shown above and deliver it through a trusted channel. When SMTP is -configured, Fanout sends the invitation synchronously and reports relay +configured, Pitot sends the invitation synchronously and reports relay failure rather than claiming it was delivered. If the local account is suspended or its address is no longer usable, the -command refuses to mint a credential. Stop Fanout, copy the control database, +command refuses to mint a credential. Stop Pitot, copy the control database, and repair that account without deleting it or its owned data: ```sql @@ -174,7 +174,7 @@ UPDATE users WHERE id = ''; ``` -Restart Fanout, mint a login link for the repaired address, and sign in. Never +Restart Pitot, mint a login link for the repaired address, and sign in. Never recover by deleting the user: user deletion cascades to its sessions, OAuth grants, and dashboards. @@ -185,8 +185,8 @@ limits use the authenticated user and OAuth client. Behind a proxy, the client address arrives in `X-Forwarded-For`; trust it only from configured proxies. - **Default (no configuration):** forwarded headers are ignored and the direct - peer address is used. Safe when Fanout is exposed directly. -- **Behind a proxy:** set `FANOUT_TRUSTED_PROXY_CIDRS` to the proxy networks, + peer address is used. Safe when Pitot is exposed directly. +- **Behind a proxy:** set `PITOT_TRUSTED_PROXY_CIDRS` to the proxy networks, comma separated — for example `10.0.0.0/8,192.168.1.0/24`. Only these networks may present a forwarded address. Configuring this list also disables Echo's broad built-in trust of loopback, link-local, and RFC1918 ranges: your @@ -194,18 +194,18 @@ address arrives in `X-Forwarded-For`; trust it only from configured proxies. Set it to the address range of your proxy, never to `0.0.0.0/0`. -Related: `FANOUT_PUBLIC_URL` must be the externally reachable HTTPS URL so +Related: `PITOT_PUBLIC_URL` must be the externally reachable HTTPS URL so session cookies are issued with `Secure`. ## OIDC ### Provider availability -Fanout runs OIDC discovery once at startup, for at most 5 seconds. If the -provider is unreachable or answers with an error, Fanout starts anyway and +Pitot runs OIDC discovery once at startup, for at most 5 seconds. If the +provider is unreachable or answers with an error, Pitot starts anyway and serves ingest, MCP, and existing browser sessions. Discovery is retried in the background, starting after 1 second and doubling to at most 1 minute between -attempts, until it succeeds or Fanout shuts down. No restart is needed. +attempts, until it succeeds or Pitot shuts down. No restart is needed. Until then `/api/auth/oidc/start` and `/api/auth/oidc/callback` return 503 with `Retry-After`, and the `oidc` check in `/readyz` reports `degraded` while the @@ -213,8 +213,8 @@ endpoint still returns 200. The cause is in the logs. Invalid configuration still fails startup: a value rejected by configuration validation, or a provider that answers for an issuer other than -`FANOUT_OIDC_ISSUER_URL`. If a mismatch first appears on a background retry, -because the provider was down at startup, Fanout keeps running and retrying; +`PITOT_OIDC_ISSUER_URL`. If a mismatch first appears on a background retry, +because the provider was down at startup, Pitot keeps running and retrying; correct the issuer and restart. ### Public and community access @@ -225,20 +225,20 @@ audit attribution isolated without shared credentials or an anonymous authorization bypass: ```sh -export FANOUT_AUTH_MODE=oidc -export FANOUT_OIDC_EMAIL_VERIFICATION=required -export FANOUT_OIDC_AUTO_PROVISION=true -export FANOUT_OIDC_ALLOWED_DOMAINS="*" -export FANOUT_OIDC_DEFAULT_ROLE=viewer +export PITOT_AUTH_MODE=oidc +export PITOT_OIDC_EMAIL_VERIFICATION=required +export PITOT_OIDC_AUTO_PROVISION=true +export PITOT_OIDC_ALLOWED_DOMAINS="*" +export PITOT_OIDC_DEFAULT_ROLE=viewer ``` The wildcard is rejected with -`FANOUT_OIDC_EMAIL_VERIFICATION=issuer`. Use a specific domain or group allowlist +`PITOT_OIDC_EMAIL_VERIFICATION=issuer`. Use a specific domain or group allowlist for a private installation. A wildcard makes the installation available to every identity accepted by the configured provider, so rate-limit public traffic and budget AI usage at the deployment edge. -Fanout’s roles apply across the instance: +Pitot’s roles apply across the instance: - `viewer` reads telemetry, uses chat and MCP tools within viewer permissions, and manages its own dashboards. @@ -247,7 +247,7 @@ Fanout’s roles apply across the instance: ### Eligibility is enforced on every login -`FANOUT_OIDC_ALLOWED_GROUPS` and `FANOUT_OIDC_ALLOWED_DOMAINS` are evaluated on +`PITOT_OIDC_ALLOWED_GROUPS` and `PITOT_OIDC_ALLOWED_DOMAINS` are evaluated on **every** login, including logins by an identity that is already linked. Removing a user from an allowed group at the identity provider prevents their next login; it does not wait for a provisioning cycle. @@ -258,10 +258,10 @@ set; see [Who owns accounts](#who-owns-accounts). ### Role ownership -If `FANOUT_OIDC_ADMIN_GROUPS` or `FANOUT_OIDC_OPERATOR_GROUPS` is set, the +If `PITOT_OIDC_ADMIN_GROUPS` or `PITOT_OIDC_OPERATOR_GROUPS` is set, the identity provider owns each linked user's fixed role. On every login the mapped role is applied; users in no mapped group fall back to -`FANOUT_OIDC_DEFAULT_ROLE`. A role change increments the user's auth version, +`PITOT_OIDC_DEFAULT_ROLE`. A role change increments the user's auth version, revokes their existing browser sessions, and writes a `role.changed` audit event in one transaction. @@ -282,8 +282,8 @@ an administrator created. `GET /api/auth/status` reports the result as | `account_ownership` | Configuration | Browser user routes refuse | |---|---|---| | `local` | No role mapping, with or without a SCIM token | Nothing | -| `identity_provider_roles` | Role mapping and `FANOUT_OIDC_AUTO_PROVISION`, no SCIM token | Creating a user and changing a role | -| `identity_provider_roles_no_provisioning` | Role mapping, no `FANOUT_OIDC_AUTO_PROVISION`, no SCIM token | Creating a user and changing a role | +| `identity_provider_roles` | Role mapping and `PITOT_OIDC_AUTO_PROVISION`, no SCIM token | Creating a user and changing a role | +| `identity_provider_roles_no_provisioning` | Role mapping, no `PITOT_OIDC_AUTO_PROVISION`, no SCIM token | Creating a user and changing a role | | `identity_provider_directory` | Role mapping and a SCIM token | Creating and deleting a user; changing a role, status or email | A refused request returns `403` with the code `managed_by_identity_provider`, @@ -291,10 +291,10 @@ and it changes nothing. The check runs before the request body is validated, except on `PATCH /api/users/{id}`, which has to decode the body to see whether `email` is present. Malformed JSON there returns `400`. -To add users under a role mapping, set `FANOUT_OIDC_AUTO_PROVISION` with -`FANOUT_OIDC_ALLOWED_GROUPS` or `FANOUT_OIDC_ALLOWED_DOMAINS`, or configure a +To add users under a role mapping, set `PITOT_OIDC_AUTO_PROVISION` with +`PITOT_OIDC_ALLOWED_GROUPS` or `PITOT_OIDC_ALLOWED_DOMAINS`, or configure a SCIM token. With neither, `POST /api/users` is refused and a first login is -denied as not provisioned, so nobody new can get an account. Fanout still starts +denied as not provisioned, so nobody new can get an account. Pitot still starts in this configuration, logs a warning at startup, and Settings says so. Existing accounts keep working. @@ -307,7 +307,7 @@ working in every mode: - `POST /api/users/{id}/access/revoke`, which ends sessions and OAuth tokens without changing the account. - `POST /api/auth/setup` for the first administrator when no SCIM token is set. -- `fanout login-link --break-glass`. +- `pitot login-link --break-glass`. Without a SCIM token, an administrator can still suspend, reactivate, delete and change the email of a user from the browser routes. @@ -318,16 +318,16 @@ Past roughly 200 group memberships, Entra omits the `groups` claim from the token entirely and emits `_claim_names`/`_claim_sources` pointing at the Graph API instead. An omitted claim does not mean the user belongs to no groups. -When any group-based policy is configured and the token signals overage, Fanout +When any group-based policy is configured and the token signals overage, Pitot **denies the login** and names the group claim in the error. Fix it at the identity provider: configure the application registration to emit only **groups assigned to the application** rather than all group memberships. -Installations that use only `FANOUT_OIDC_ALLOWED_DOMAINS` are unaffected. +Installations that use only `PITOT_OIDC_ALLOWED_DOMAINS` are unaffected. ### Email verification -`FANOUT_OIDC_EMAIL_VERIFICATION` defaults to `required`: an identity is linked +`PITOT_OIDC_EMAIL_VERIFICATION` defaults to `required`: an identity is linked to a local account by matching email only when the provider asserts the email is verified. @@ -350,17 +350,17 @@ access, including browser sessions and OAuth tokens, through ## SCIM provisioning -Set `FANOUT_SCIM_TOKEN` (or `FANOUT_SCIM_TOKEN_FILE`) to let an identity provider +Set `PITOT_SCIM_TOKEN` (or `PITOT_SCIM_TOKEN_FILE`) to let an identity provider or automation create, update and deactivate accounts. The setting requires -`FANOUT_AUTH_MODE=oidc` and a value of at least 32 characters with no whitespace. +`PITOT_AUTH_MODE=oidc` and a value of at least 32 characters with no whitespace. Without it the routes do not exist and nothing below applies. -With a token configured, Fanout prints no setup banner, `/api/auth/setup` returns +With a token configured, Pitot prints no setup banner, `/api/auth/setup` returns `410`, and `/api/auth/status` reports `setup_required: false`. The first administrator comes from SCIM. Until one exists, signed-out API requests return `401` with `no accounts have been provisioned yet`. -Fanout implements a small subset of SCIM 2.0 (RFC 7644) under `/scim/v2`. +Pitot implements a small subset of SCIM 2.0 (RFC 7644) under `/scim/v2`. Requests send `Authorization: Bearer `, and bodies use `application/scim+json` or `application/json`. Responses use `application/scim+json`, and failures use the RFC 7644 error format. @@ -384,14 +384,14 @@ treated as an exact opaque string. `userName` is the email address. If `emails` is sent, its primary value must be the same address. The role is `admin`, `operator` or `viewer`. `active` defaults to `true`. -The account and the identity `(FANOUT_OIDC_ISSUER_URL, externalId)` are written +The account and the identity `(PITOT_OIDC_ISSUER_URL, externalId)` are written in one transaction with their audit events. The user's first OIDC login finds that identity, so no match by email takes place. A `POST` for an identity that already exists returns `200` with the current account and changes nothing, so a delayed retry cannot undo a later change. Send a `PATCH` to change an existing account. A new account returns `201`. An email -held by a different account returns `409` with `scimType` `uniqueness`; Fanout +held by a different account returns `409` with `scimType` `uniqueness`; Pitot never links an existing account by email. While there are no users, only an active administrator can be created, using the @@ -438,7 +438,7 @@ creation, then `user.suspended`, `user.reactivated`, `role.changed` or or status transition. Addresses and the token are never recorded. The token is compared in constant time and is never logged. Rotate it by -changing the setting and restarting Fanout. +changing the setting and restarting Pitot. ## Ingest tokens @@ -447,13 +447,13 @@ characters. An instance can hold up to 50 active tokens, each with its own name, so one Collector can be revoked without touching the rest. Names are 1 to 64 printable characters and unique among active tokens, ignoring ASCII case. -Fanout stores only each token's SHA-256 digest, plus its last four characters +Pitot stores only each token's SHA-256 digest, plus its last four characters as a hint. The value appears once, in the response that creates it, and that response is sent with `Cache-Control: no-store`. It is never written to logs, audit events, or any later response. Authenticating an export costs one digest and one lookup on an indexed column. -Fanout keeps no credential cache, so a revoked token is refused on the very next +Pitot keeps no credential cache, so a revoked token is refused on the very next request, with no delay or restart. Last-used times are coalesced in memory and written about once a minute and at shutdown, so a listing can lag real use by up to a minute. @@ -467,7 +467,7 @@ To rotate, create a replacement, move the Collector across, then revoke the old token. Revoking the last active token is allowed and stops ingest until another is created; the UI warns first. -First-admin setup issues a token named `default`, and `FANOUT_INGEST_TOKEN` seeds +First-admin setup issues a token named `default`, and `PITOT_INGEST_TOKEN` seeds one named `configuration`, but only when no token row has ever existed. A revoked row counts, so a restart that still carries the setting cannot bring back a token an administrator revoked. An instance upgraded from a single-token release keeps @@ -483,13 +483,13 @@ with the token id and name. | Credential | Purpose | Rotation | |---|---|---| -| Setup URL | Creates the first administrator | One-time, expires in 1 hour; not issued when `FANOUT_SCIM_TOKEN` is set | -| Login URL | Authenticates one existing active local user | One-time, expires in 15 minutes; mint with `fanout login-link` | -| Break-glass URL | Authenticates one active administrator in OIDC mode | One-time, expires in 15 minutes; mint with `fanout login-link --break-glass` | +| Setup URL | Creates the first administrator | One-time, expires in 1 hour; not issued when `PITOT_SCIM_TOKEN` is set | +| Login URL | Authenticates one existing active local user | One-time, expires in 15 minutes; mint with `pitot login-link` | +| Break-glass URL | Authenticates one active administrator in OIDC mode | One-time, expires in 15 minutes; mint with `pitot login-link --break-glass` | | Browser session | Interactive access | Idle and absolute TTL; revoked on role, email, or status change | -| Ingest tokens | OTLP ingest | Up to 50 named tokens at `/settings/ingest`; rotate by creating then revoking. `FANOUT_INGEST_TOKEN` seeds only the first token | -| Metrics token | `/metrics` scrape | `FANOUT_METRICS_TOKEN` | -| SCIM token | User provisioning at `/scim/v2` | `FANOUT_SCIM_TOKEN`; change the setting and restart | +| Ingest tokens | OTLP ingest | Up to 50 named tokens at `/settings/ingest`; rotate by creating then revoking. `PITOT_INGEST_TOKEN` seeds only the first token | +| Metrics token | `/metrics` scrape | `PITOT_METRICS_TOKEN` | +| SCIM token | User provisioning at `/scim/v2` | `PITOT_SCIM_TOKEN`; change the setting and restart | | 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. diff --git a/docs/diagrams/architecture.json b/docs/diagrams/architecture.json index cca9323d3..6857b924e 100644 --- a/docs/diagrams/architecture.json +++ b/docs/diagrams/architecture.json @@ -2,7 +2,7 @@ "schema_version": 1, "diagram_type": "architecture", "meta": { - "title": "Fanout runtime architecture", + "title": "Pitot runtime architecture", "output": "architecture.html", "quality_profile": "showcase", "locale": "en", @@ -279,17 +279,17 @@ ], "sources": [ { - "path": "internal/engine/duck.go", + "path": "internal/query/duck.go", "line": 240, "end_line": 244 }, { - "path": "internal/engine/duck.go", + "path": "internal/query/duck.go", "line": 505, "end_line": 522 }, { - "path": "internal/engine/duck.go", + "path": "internal/query/duck.go", "line": 627, "end_line": 653 } @@ -455,7 +455,7 @@ "boundaries": [ { "kind": "region", - "label": "fanout: one Go process, one listener :7520", + "label": "pitot: one Go process, one listener :7520", "wraps": [ "ingest", "api", @@ -470,7 +470,7 @@ }, { "kind": "region", - "label": "FANOUT_DATA_DIR", + "label": "PITOT_DATA_DIR", "wraps": [ "parquet", "qstate", @@ -619,7 +619,7 @@ "dot": "amber", "title": "Optional", "items": [ - "Chat only when FANOUT_AI_PROVIDER is set", + "Chat only when PITOT_AI_PROVIDER is set", "OIDC sign-in and SMTP email codes when configured", "/metrics for Prometheus" ] diff --git a/docs/diagrams/architecture.svg b/docs/diagrams/architecture.svg index 97858a29b..0732b97e8 100644 --- a/docs/diagrams/architecture.svg +++ b/docs/diagrams/architecture.svg @@ -726,7 +726,7 @@ svg[data-theme="light"] { --bg: #f4f5f7; --grid: #e9edf2; --canvas-dot: #e2e7ec; svg[data-theme="dark"] { --bg: #020617; --grid: #1e293b; --canvas-dot: rgba(148, 163, 184, 0.16); --text: #ffffff; --text-muted: #94a3b8; --text-dim: #475569; --text-faint: #7d8da1; --panel: rgba(15, 23, 42, 0.5); --panel-border: #1e293b; --lane-fill: rgba(15, 23, 42, 0.22); --lane-stroke: #334155; --arrow: #94a3b8; --arrow-emphasis: #34d399; --mask: #0f172a; --frontend-fill: rgba(8, 51, 68, 0.4); --frontend-stroke: #22d3ee; --backend-fill: rgba(6, 78, 59, 0.4); --backend-stroke: #34d399; --database-fill: rgba(76, 29, 149, 0.4); --database-stroke: #a78bfa; --cloud-fill: rgba(120, 53, 15, 0.3); --cloud-stroke: #fbbf24; --security-fill: rgba(136, 19, 55, 0.4); --security-stroke: #fb7185; --messagebus-fill: rgba(251, 146, 60, 0.3); --messagebus-stroke: #fb923c; --external-fill: rgba(30, 41, 59, 0.5); --external-stroke: #94a3b8; --toolbar-bg: rgba(15, 23, 42, 0.8); --toolbar-border: #334155; --toolbar-text: #e2e8f0; --toolbar-hover: rgba(15, 23, 42, 0.95); --toolbar-menu-bg: #0f172a; --flow-cycle: ; --flow-halo-peak: ; --flow-glow-peak: ; --flow-tail-peak: ; --flow-head-peak: ; --flow-wake-peak: ; --flow-ripple-peak: ; --flow-peak: ; } rect.c-bg-rect { fill: var(--bg); } - Fanout runtime architecture + Pitot runtime architecture An architecture diagram generated by Archify. @@ -772,9 +772,9 @@ rect.c-bg-rect { fill: var(--bg); } - + - + @@ -901,8 +901,8 @@ rect.c-bg-rect { fill: var(--bg); } remote agent or IDE - - OTLP ingest · gRPC + HTTP, token checked · fanout: one Go process, one listener :7520 + + OTLP ingest · gRPC + HTTP, token checked · pitot: one Go process, one listener :7520 - - HTTP API + auth · sessions, OIDC, email codes · fanout: one Go process, one listener :7520 + + HTTP API + auth · sessions, OIDC, email codes · pitot: one Go process, one listener :7520 - - Agent runtime · AG-UI stream, chat threads · fanout: one Go process, one listener :7520 + + Agent runtime · AG-UI stream, chat threads · pitot: one Go process, one listener :7520 - - MCP server · 20 typed tools · fanout: one Go process, one listener :7520 + + MCP server · 20 typed tools · pitot: one Go process, one listener :7520 - - Commit workers · up to 4, 10 ms group window · fanout: one Go process, one listener :7520 + + Commit workers · up to 4, 10 ms group window · pitot: one Go process, one listener :7520 - - Queries + dashboards · one contract for API and MCP · fanout: one Go process, one listener :7520 + + Queries + dashboards · one contract for API and MCP · pitot: one Go process, one listener :7520 - - Query kernel · DuckDB, rollups, compaction · fanout: one Go process, one listener :7520 + + Query kernel · DuckDB, rollups, compaction · pitot: one Go process, one listener :7520 - - Anomaly detector · health and z-scores · fanout: one Go process, one listener :7520 + + Anomaly detector · health and z-scores · pitot: one Go process, one listener :7520 - - Alert engine · CEL rules, every 30s · fanout: one Go process, one listener :7520 + + Alert engine · CEL rules, every 30s · pitot: one Go process, one listener :7520 - - Parquet batches · authoritative, trace.fidx · FANOUT_DATA_DIR + + Parquet batches · authoritative, trace.fidx · PITOT_DATA_DIR - - DuckDB query state · rebuildable cache · FANOUT_DATA_DIR + + DuckDB query state · rebuildable cache · PITOT_DATA_DIR - - Control SQLite · users, dashboards, rules, threads · FANOUT_DATA_DIR + + Control SQLite · users, dashboards, rules, threads · PITOT_DATA_DIR - - - fanout: one Go process, one listener :7520 + + + pitot: one Go process, one listener :7520 - - - FANOUT_DATA_DIR + + + PITOT_DATA_DIR diff --git a/docs/diagrams/persistence.json b/docs/diagrams/persistence.json index 252d24530..b812b1cb2 100644 --- a/docs/diagrams/persistence.json +++ b/docs/diagrams/persistence.json @@ -147,7 +147,7 @@ "row": 1, "sources": [ { - "path": "internal/engine/duck.go", + "path": "internal/query/duck.go", "line": 240, "end_line": 244 } @@ -162,12 +162,12 @@ "row": 2, "sources": [ { - "path": "internal/engine/duck.go", + "path": "internal/query/duck.go", "line": 627, "end_line": 653 }, { - "path": "internal/engine/duck.go", + "path": "internal/query/duck.go", "line": 692, "end_line": 693 }, @@ -187,17 +187,17 @@ "row": 1, "sources": [ { - "path": "internal/engine/duck.go", + "path": "internal/query/duck.go", "line": 505, "end_line": 522 }, { - "path": "internal/engine/duck.go", + "path": "internal/query/duck.go", "line": 1437, "end_line": 1437 }, { - "path": "internal/engine/duck.go", + "path": "internal/query/duck.go", "line": 1622, "end_line": 1622 } diff --git a/docs/media/social-card.typ b/docs/media/social-card.typ index 5fc2a1320..5c7b348fd 100644 --- a/docs/media/social-card.typ +++ b/docs/media/social-card.typ @@ -26,7 +26,7 @@ column-gutter: 16pt, align: horizon, image("../../ui/host/public/favicon.svg", width: 84pt), - text(size: 56pt, weight: 700, "Fanout"), + text(size: 56pt, weight: 700, "Pitot"), ) #v(30pt) @@ -51,5 +51,5 @@ #v(12pt) #grid(columns: (1fr, auto), text(size: 19pt, fill: rgb("#8a94a6"))[No collector fleet. No object store. One data directory.], - text(size: 19pt, fill: rgb("#8a94a6"))[github.com/labstack/fanout], + text(size: 19pt, fill: rgb("#8a94a6"))[github.com/labstack/pitot], ) diff --git a/docs/operations.md b/docs/operations.md index 08025ee1f..7d7560568 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -1,13 +1,13 @@ # Operator runbook -Fanout is one process and one persistent data directory. Operate those two +Pitot is one process and one persistent data directory. Operate those two things as a unit: preserve the directory, pin the binary or image version, and give ingest credentials only to trusted services and collectors. ## Runtime secret delivery Runtime configuration uses built-in defaults followed by nonempty process -environment values. Every setting requires a restart. Fanout reads no +environment values. Every setting requires a restart. Pitot reads no configuration document or dotenv file. Generated `.env.example` lists the settings as commented-out empty entries, with types, defaults, and secret file forms in comments. Copying the template sets nothing and preserves image ENV; @@ -16,9 +16,9 @@ loads optional ignored `./.env` with Node's native `parseEnv`; inherited values win, including empty values. Personal development credentials may live there. Personal environment files and operator profiles are excluded from Git and Docker. -Custom names use `FANOUT_` plus a clear name, adding the area only when it +Custom names use `PITOT_` plus a clear name, adding the area only when it clarifies. Vendor credentials and endpoints keep their documented names. -Unknown `FANOUT_` names fail startup, except platform service-discovery names; +Unknown `PITOT_` names fail startup, except platform service-discovery names; unrelated names in shared vendor namespaces are ignored. ### Environment and mounted secret files @@ -28,29 +28,29 @@ Every secret accepts either its value or its file path: | Value variable | File path variable | | --- | --- | -| `FANOUT_AUTH_CODE_SECRET` | `FANOUT_AUTH_CODE_SECRET_FILE` | -| `FANOUT_OIDC_CLIENT_SECRET` | `FANOUT_OIDC_CLIENT_SECRET_FILE` | -| `FANOUT_SMTP_PASSWORD` | `FANOUT_SMTP_PASSWORD_FILE` | -| `FANOUT_INGEST_TOKEN` | `FANOUT_INGEST_TOKEN_FILE` | -| `FANOUT_METRICS_TOKEN` | `FANOUT_METRICS_TOKEN_FILE` | -| `FANOUT_SCIM_TOKEN` | `FANOUT_SCIM_TOKEN_FILE` | +| `PITOT_AUTH_CODE_SECRET` | `PITOT_AUTH_CODE_SECRET_FILE` | +| `PITOT_OIDC_CLIENT_SECRET` | `PITOT_OIDC_CLIENT_SECRET_FILE` | +| `PITOT_SMTP_PASSWORD` | `PITOT_SMTP_PASSWORD_FILE` | +| `PITOT_INGEST_TOKEN` | `PITOT_INGEST_TOKEN_FILE` | +| `PITOT_METRICS_TOKEN` | `PITOT_METRICS_TOKEN_FILE` | +| `PITOT_SCIM_TOKEN` | `PITOT_SCIM_TOKEN_FILE` | | `ANTHROPIC_API_KEY` | `ANTHROPIC_API_KEY_FILE` | | `OPENAI_API_KEY` | `OPENAI_API_KEY_FILE` | -Both forms nonempty fail startup. Fanout strips exactly one trailing LF or CRLF +Both forms nonempty fail startup. Pitot strips exactly one trailing LF or CRLF from file contents, then rejects an empty result. Errors identify the variable -and path, never the contents. Fanout performs no file-mode check; the deployment +and path, never the contents. Pitot performs no file-mode check; the deployment controls mount access. Do not bake credentials into images or frontend bundles. Unselected AI providers' value and file forms are ignored. For Docker, mount a provisioned secret and inject its path: ```sh -docker run --name fanout --restart unless-stopped -p 7520:7520 \ - -v fanout-data:/var/lib/fanout/data \ +docker run --name pitot --restart unless-stopped -p 7520:7520 \ + -v pitot-data:/var/lib/pitot/data \ --mount type=bind,src="$AUTH_SECRET_PATH",dst=/run/secrets/auth_code,readonly \ - -e FANOUT_AUTH_CODE_SECRET_FILE=/run/secrets/auth_code \ - labstack/fanout:latest + -e PITOT_AUTH_CODE_SECRET_FILE=/run/secrets/auth_code \ + labstack/pitot:latest ``` The source secret must be readable by the image's UID 65532. In Compose, grant @@ -58,18 +58,18 @@ only the required secret to the service: ```yaml services: - fanout: - image: labstack/fanout:latest + pitot: + image: labstack/pitot:latest ports: ["7520:7520"] - volumes: ["fanout-data:/var/lib/fanout/data"] + volumes: ["pitot-data:/var/lib/pitot/data"] environment: - FANOUT_AUTH_CODE_SECRET_FILE: /run/secrets/auth_code + PITOT_AUTH_CODE_SECRET_FILE: /run/secrets/auth_code secrets: [auth_code] secrets: auth_code: file: ${AUTH_SECRET_PATH} volumes: - fanout-data: + pitot-data: ``` For Kubernetes, put ordinary settings in a ConfigMap and credentials in a @@ -78,16 +78,16 @@ injects both without putting credential values in the manifest: ```yaml containers: - - name: fanout - image: labstack/fanout:latest + - name: pitot + image: labstack/pitot:latest envFrom: - configMapRef: - name: fanout-settings + name: pitot-settings env: - - name: FANOUT_AUTH_CODE_SECRET + - name: PITOT_AUTH_CODE_SECRET valueFrom: secretKeyRef: - name: fanout-credentials + name: pitot-credentials key: auth_code_secret ``` @@ -97,7 +97,7 @@ paths. Use the existing persistent-volume and access policy for telemetry data. ### SOPS runtime injection Use one authoritative SOPS-encrypted profile per actual workload/credential -set, such as ignored `secrets/fanout.env`. Select a complete profile explicitly; +set, such as ignored `secrets/pitot.env`. Select a complete profile explicitly; never layer different credential sets or fall back on a missing profile. Platform-owned credentials remain platform-owned. This public repository ships no operator secrets, recipient policy, or decryption keys. @@ -107,9 +107,9 @@ With a provisioned SOPS key and existing encrypted profile, launch through without writing decrypted credentials to disk: ```sh -sops exec-env secrets/fanout.env './bin/fanout' +sops exec-env secrets/pitot.env './bin/pitot' # For local development with optional personal settings: -sops exec-env secrets/fanout.env 'just run' +sops exec-env secrets/pitot.env 'just run' ``` The profile supplies environment values to the child; ordinary settings may @@ -122,7 +122,7 @@ item. 1Password holds recovery rather than a second maintained copy of SOPS-owned application secrets. AI chat is disabled by default. Select exactly `anthropic` or `openai` with -`FANOUT_AI_PROVIDER`, then deliver its required `ANTHROPIC_API_KEY` or +`PITOT_AI_PROVIDER`, then deliver its required `ANTHROPIC_API_KEY` or `OPENAI_API_KEY`. A selected provider without its key fails startup. Inherited keys never enable chat. Only the selected endpoint is validated and used. Overrides are `ANTHROPIC_BASE_URL` and `OPENAI_BASE_URL`; the OpenAI base @@ -135,68 +135,68 @@ includes `/v1`, while Anthropic's excludes it. | `127.0.0.1:7520` (native), `:7520` (image) | Browser, API, MCP, health, metrics, OTLP/gRPC and OTLP/HTTP | Users, trusted services or a reverse proxy | Both native and container deployments use one listener. Native installs default -to loopback; set `FANOUT_ADDR=:7520` for remote access. The image supplies -`FANOUT_ADDR=:7520` and `FANOUT_DATA_DIR=/var/lib/fanout/data`. Every OTLP request +to loopback; set `PITOT_ADDR=:7520` for remote access. The image supplies +`PITOT_ADDR=:7520` and `PITOT_DATA_DIR=/var/lib/pitot/data`. Every OTLP request requires an active ingest token, created during first-admin setup, by an -administrator, or from `FANOUT_INGEST_TOKEN` on an empty install; browser sessions +administrator, or from `PITOT_INGEST_TOKEN` on an empty install; browser sessions and MCP tokens do not authorize ingest. Do not embed the ingest token in a browser or shipped mobile application. For OTLP/HTTP, set `http/protobuf`, use the base endpoint -`http://fanout:7520`, and supply `Authorization: Bearer `. Exporters +`http://pitot:7520`, and supply `Authorization: Bearer `. Exporters derive `/v1/traces`, `/v1/metrics`, and `/v1/logs` from the general endpoint. Signal-specific endpoint variables require the full path. OTLP/gRPC uses the same address and authorization value, over HTTP/2. ## Mobile boundary -Fanout remains a backend receiver, not a public mobile collector. The supported +Pitot remains a backend receiver, not a public mobile collector. The supported path is `mobile SDK -> customer-controlled public Collector or gateway -> -private Fanout`; the gateway owns public-client authentication, rate limits, -privacy policy, and abuse controls. Never compile Fanout's shared ingest token +private Pitot`; the gateway owns public-client authentication, rate limits, +privacy policy, and abuse controls. Never compile Pitot's shared ingest token into a shipped application. Propagate the standard `traceparent` and `tracestate` headers from mobile HTTP requests to backend services. When the customer's gateway exports client spans -to Fanout, that context correlates them with the backend trace without a Fanout -mobile SDK or a public Fanout listener. +to Pitot, that context correlates them with the backend trace without a Pitot +mobile SDK or a public Pitot listener. ## TLS and reverse proxies -Setting both `FANOUT_TLS_CERT_FILE` and `FANOUT_TLS_KEY_FILE` enables TLS 1.3 on -the shared listener. A proxy must forward HTTP/2 to Fanout for gRPC: use -h2c for a plaintext backend, or HTTP/2 over TLS when Fanout has a certificate. +Setting both `PITOT_TLS_CERT_FILE` and `PITOT_TLS_KEY_FILE` enables TLS 1.3 on +the shared listener. A proxy must forward HTTP/2 to Pitot for gRPC: use +h2c for a plaintext backend, or HTTP/2 over TLS when Pitot has a certificate. HTTP/1.1 forwarding supports OTLP/HTTP, but cannot carry gRPC. -`FANOUT_TLS_CLIENT_CA_FILE` additionally requires every client, including a +`PITOT_TLS_CLIENT_CA_FILE` additionally requires every client, including a TLS-terminating proxy such as Cloudflare with Authenticated Origin Pulls, to present a certificate from that CA bundle. The bundle is read at startup, so rotation needs a restart; keep the old and new CA in the bundle while clients move to certificates from the new one. -Set `FANOUT_PUBLIC_URL` to the externally reachable HTTPS browser origin. When -using forwarded client addresses, set `FANOUT_TRUSTED_PROXY_CIDRS` to only the +Set `PITOT_PUBLIC_URL` to the externally reachable HTTPS browser origin. When +using forwarded client addresses, set `PITOT_TRUSTED_PROXY_CIDRS` to only the proxy networks; never use `0.0.0.0/0`. The MCP resource URL is the same origin -with `/mcp` appended. Fanout accepts public MCP transport requests only when +with `/mcp` appended. Pitot accepts public MCP transport requests only when their HTTP `Host` matches that origin, so the reverse proxy must preserve the original host. MCP also validates `Origin` before authentication; see -[Connect an agent over MCP](https://fanout.run/docs/guides/mcp#protocol). +[Connect an agent over MCP](https://pitot.dev/docs/guides/mcp#protocol). ## Health and monitoring -`fanout healthcheck` derives `/healthz` from `FANOUT_ADDR` or its built-in +`pitot healthcheck` derives `/healthz` from `PITOT_ADDR` or its built-in default. Empty, `0.0.0.0`, and `::` bind hosts become `127.0.0.1`. -`FANOUT_TLS_CERT_FILE` selects HTTPS. Derived probes bypass environment proxies. +`PITOT_TLS_CERT_FILE` selects HTTPS. Derived probes bypass environment proxies. HTTPS IP-literal probes trust only the configured certificate and verify its first DNS or IP SAN, which may differ from the bind IP; hostname probes verify -normally. Derived HTTPS probes present `FANOUT_HEALTHCHECK_CERT_FILE` and -`FANOUT_HEALTHCHECK_KEY_FILE` when set, so they pass a listener with -`FANOUT_TLS_CLIENT_CA_FILE`. Healthcheck reads only these settings and does -not require valid secrets. An explicit `fanout healthcheck ` uses default +normally. Derived HTTPS probes present `PITOT_HEALTHCHECK_CERT_FILE` and +`PITOT_HEALTHCHECK_KEY_FILE` when set, so they pass a listener with +`PITOT_TLS_CLIENT_CA_FILE`. Healthcheck reads only these settings and does +not require valid secrets. An explicit `pitot healthcheck ` uses default proxy and certificate verification behaviour. -- `/healthz` is the liveness check. It fails only when Fanout's own work on +- `/healthz` is the liveness check. It fails only when Pitot's own work on the query engine stalls: a Parquet publication holds reads for 10 minutes, or an idle engine does not answer a ping while no read holds it. An overloaded engine stays alive, and so does one running a query past its @@ -205,31 +205,31 @@ proxy and certificate verification behaviour. engine reports `degraded` with 200; a stalled one reports 503. A query still running 25 seconds past its deadline reports `queries` as `degraded`, logs a warning with a hash of the query (never its text), and increments - `fanout_duckdb_statement_overruns_total`. In OIDC mode, the `oidc` check + `pitot_duckdb_statement_overruns_total`. In OIDC mode, the `oidc` check reports `degraded` with 200 while provider discovery is failing; only new OIDC sign-ins are affected, and discovery retries without a restart. - `/metrics` exposes Prometheus metrics. Keep it private or configure - `FANOUT_METRICS_TOKEN`; do not make it public merely to simplify scraping. + `PITOT_METRICS_TOKEN`; do not make it public merely to simplify scraping. Monitor admission and compaction together: -- `fanout_ingest_throttled_total{reason}` counts refused whole exports by `debt`, +- `pitot_ingest_throttled_total{reason}` counts refused whole exports by `debt`, `reads`, or `budget`. Exporters need retries enabled. -- `fanout_ingest_admission_rows_per_second` is the current row-rate cap; zero +- `pitot_ingest_admission_rows_per_second` is the current row-rate cap; zero means uncapped. -- `fanout_ingest_backpressure_seconds_total` measures time with an admission cap +- `pitot_ingest_backpressure_seconds_total` measures time with an admission cap active. Earlier releases measured blocked-writer time; do not compare them directly. -- `fanout_compaction_backlog_batches` is total generation-0 inventory, including +- `pitot_compaction_backlog_batches` is total generation-0 inventory, including batches excluded from reclaimable debt. -- `fanout_compaction_pass_seconds` measures pass duration, and - `fanout_compaction_retired_batches_total` counts input batches retired by +- `pitot_compaction_pass_seconds` measures pass duration, and + `pitot_compaction_retired_batches_total` counts input batches retired by successful publications. Compare its rate with backlog growth. -Run Fanout under a supervisor that restarts it on exit: Docker or Compose with +Run Pitot under a supervisor that restarts it on exit: Docker or Compose with `restart: unless-stopped` (`--restart unless-stopped`), systemd with `Restart=on-failure`, or Kubernetes. Docker's `HEALTHCHECK` only marks a -container unhealthy; it does not restart it. Fanout exits with status 1 when +container unhealthy; it does not restart it. Pitot exits with status 1 when the query engine fails beyond recovery, for example when it runs out of memory while writing its cache, or when a stall that fails `/healthz` lasts another 25 seconds. It first finishes writing received telemetry; the restart @@ -237,56 +237,56 @@ rebuilds the query cache from stored telemetry. Alert on repeated restarts, readiness failures, ingest authentication failures, telemetry drops, sustained query latency, and available disk space. Retention -is controlled by `FANOUT_RETENTION_DAYS`; maintenance removes expired data on +is controlled by `PITOT_RETENTION_DAYS`; maintenance removes expired data on its configured cycle rather than immediately when the setting changes. ## Control database migrations -Fanout uses SQLite with the modernc driver, sqlc query bindings, and embedded +Pitot uses SQLite with the modernc driver, sqlc query bindings, and embedded Goose SQL migrations. Pending migrations run forward at startup. PostgreSQL and pgx are not required. ## Backup The supported portable baseline is a **cold backup** of the complete -`FANOUT_DATA_DIR`. It contains atomic telemetry Parquet batches, query state, +`PITOT_DATA_DIR`. It contains atomic telemetry Parquet batches, query state, and the control SQLite database; copying only one subdirectory does not produce a recoverable installation. -1. Record the running Fanout version and configuration, excluding secrets from +1. Record the running Pitot version and configuration, excluding secrets from ordinary logs or tickets. -2. Stop Fanout cleanly and wait for the process to exit. Shutdown stops the shared +2. Stop Pitot cleanly and wait for the process to exit. Shutdown stops the shared listener and allows five seconds for active requests before closing remaining connections, then drains the telemetry commit workers. 3. Snapshot or copy the complete data directory with ownership and permissions preserved. -4. Restart Fanout and confirm `/readyz`. +4. Restart Pitot and confirm `/readyz`. 5. Periodically restore a backup into an isolated directory; an untested backup is not a recovery plan. -Do not use a normal recursive copy while Fanout is writing. A storage-level +Do not use a normal recursive copy while Pitot is writing. A storage-level snapshot is acceptable only when it provides a crash-consistent point-in-time view of the entire data directory. ## Restore -1. Stop the destination Fanout process. +1. Stop the destination Pitot process. 2. Move the existing data directory aside rather than mixing it with a backup. 3. Restore the complete directory and its original ownership and permissions. -4. Start the **same Fanout version that created the backup** and verify +4. Start the **same Pitot version that created the backup** and verify `/readyz`, sign-in, and a known telemetry query. 5. Upgrade separately after the restored installation is known healthy. Never recover an account by deleting its row from the control database; that -cascades to sessions, OAuth grants, and owned dashboards. Use `fanout login-link +cascades to sessions, OAuth grants, and owned dashboards. Use `pitot login-link ` as documented in [authentication.md](authentication.md). ## Upgrade and rollback 1. Read the release notes and pin the target image tag or binary version. 2. Take and verify a cold backup. -3. Stop Fanout, replace only the binary/image, and retain the data directory. -4. Start Fanout and check `/readyz`, authentication, both configured OTLP +3. Stop Pitot, replace only the binary/image, and retain the data directory. +4. Start Pitot and check `/readyz`, authentication, both configured OTLP transports, and representative queries. Database migrations run forward during startup. A binary rollback after @@ -300,7 +300,7 @@ SMTP is optional. Creating a local user without it succeeds and returns operator with access to the same configuration and data directory then runs: ```sh -fanout login-link user@example.com +pitot login-link user@example.com ``` The resulting link expires after 15 minutes, works once, and is recorded in the diff --git a/docs/proposals/0001-logged-in-ui-shell.md b/docs/proposals/0001-logged-in-ui-shell.md index 18f5d8852..508d59538 100644 --- a/docs/proposals/0001-logged-in-ui-shell.md +++ b/docs/proposals/0001-logged-in-ui-shell.md @@ -17,7 +17,7 @@ The user chose to rebuild the shell with a persistent rail and to give dashboard ``` ┌──────────────────────────────────────────────────────────────┐ -│ ▣ FANOUT ☾ (avatar ▾) │ header 52px +│ ▣ PITOT ☾ (avatar ▾) │ header 52px ├────────────┬─────────────────────────────────────────────────┤ │ + New chat │ │ │ CHATS │ │ @@ -34,7 +34,7 @@ The user chose to rebuild the shell with a persistent rail and to give dashboard - Mantine `AppShell` with `header` (52px) and `navbar` (256px). No `footer`. - Navbar breakpoint `md`: below it the rail is hidden and a hamburger `ActionIcon` in the header opens the same rail content in a `Drawer`. There is no separate icon-only rail state. - The rail is the only navigation surface. The header keeps the brand lockup, the colour-scheme toggle, and an avatar `Menu`. The Dashboard/Chat toggle button, the history icon, the plus icon, the "Live" indicator and the footer are removed. -- Avatar menu items: the signed-in email (disabled label), "Fanout on GitHub", "LabStack", divider, "Sign out". The copyright line goes away. +- Avatar menu items: the signed-in email (disabled label), "Pitot on GitHub", "LabStack", divider, "Sign out". The copyright line goes away. - Header at 390px shows: hamburger, brand, colour-scheme toggle, avatar. Nothing else, so nothing clips. ### Rail contents @@ -96,7 +96,7 @@ URLs are unchanged: `/chat`, `/chat/$threadId`, `/dashboards`, `/dashboards/$das ### Page header - Title (`Title order={1}`, 32px mono), description on the next line. -- One control row under it: window `Select` (same six values), namespace `TextInput`, "Add view" `Menu` button, "Ask Fanout" `Button variant="subtle"` (agent only). No surrounding `Paper`. +- One control row under it: window `Select` (same six values), namespace `TextInput`, "Add view" `Menu` button, "Ask Pitot" `Button variant="subtle"` (agent only). No surrounding `Paper`. - No "Refresh" button. Widget data refetches every 30s (`refetchInterval: 30_000`; failed queries keep the existing 15s retry). A dimmed "Updated 11:16" line sits at the right of the control row and uses the newest `dataUpdatedAt` across the widget queries. - No "Saved" pill. The save mutation is silent on success; on failure the existing "Dashboard changes not saved" alert with Retry remains. - Dashboard switching lives in the rail. The "Dashboards" dropdown above the title is removed. The dashboard list poll drops from 3s to 30s; the selected dashboard poll drops from 3s to 30s and still pauses during a pending or failed save. diff --git a/docs/proposals/0002-agent-dashboards.md b/docs/proposals/0002-agent-dashboards.md index 4896e3e20..06e44f9ac 100644 --- a/docs/proposals/0002-agent-dashboards.md +++ b/docs/proposals/0002-agent-dashboards.md @@ -6,13 +6,13 @@ Pull requests: #285, #286, #287, #295 (milestones 1 to 4) ## Goal -Fanout dashboards become the best way to look at a running system. An agent +Pitot dashboards become the best way to look at a running system. An agent builds a correct, professional, interactive dashboard from one sentence, on real telemetry, in under a minute. An SRE who knows Grafana should prefer the result to a board they would have built by hand, and should be able to keep refining it by talking to it. -Grafana is the reference for breadth and interaction quality. Fanout goes past +Grafana is the reference for breadth and interaction quality. Pitot goes past it in four places that follow from its architecture: 1. **Authoring by intent.** The agent writes a typed, validated spec, previews @@ -30,8 +30,8 @@ it in four places that follow from its architecture: ## Success criteria -The goal is met when every item below holds on a local Fanout loaded with -fanout-demo telemetry (the OpenTelemetry Demo: frontend, checkout, cart, +The goal is met when every item below holds on a local Pitot loaded with +pitot-demo telemetry (the OpenTelemetry Demo: frontend, checkout, cart, payment, shipping, email, recommendation, fraud-detection, accounting, flagd, kafka, load-generator). Each criterion names how it is measured. @@ -51,7 +51,7 @@ kafka, load-generator). Each criterion names how it is measured. | S12 | Correctness rules from #232 | items 1, 9, 12, 14, 17, 24, 30 resolved | regression tests named per item | | S13 | Parity with the capability preview | every in-scope preview capability shipped; the checkout-incident and payments-database boards rebuilt from their prompts | side-by-side screenshot review at milestone 4 | -The benchmark prompts, run against fanout-demo data: +The benchmark prompts, run against pitot-demo data: 1. Give me a health overview of the shop. 2. Why is checkout slow right now? @@ -92,9 +92,9 @@ duplicate fetches. ## Approaches considered -**A. Semantic panel spec, compiled by Fanout (chosen).** The agent states what +**A. Semantic panel spec, compiled by Pitot (chosen).** The agent states what each panel means: a signal, filters, measures, grouping, unit, thresholds and -interactions. Fanout compiles the query to DuckDB SQL and the visualization to +interactions. Pitot compiles the query to DuckDB SQL and the visualization to ECharts options. SQL remains available as an escape hatch for data, never for styling. @@ -449,19 +449,19 @@ panels when no service filter applies. `~ latency.thresholds`) and links to the new version. The rail shows the request each dashboard was built from. - **Accessibility.** Every chart has the Inspect data table, an `aria-label` - summary, keyboard-reachable menus, and status conveyed by Fanout's health + summary, keyboard-reachable menus, and status conveyed by Pitot's health shapes as well as color. Categorical colors use the first four series slots, which pass the CVD validator; panels with more series rely on the legend and direct labels. ## Data for development and tests -- **fanout-demo snapshot.** Copy `data/telemetry/batches/` from the demo host - into a scratch data directory and boot a local Fanout on it with a fresh +- **pitot-demo snapshot.** Copy `data/telemetry/batches/` from the demo host + into a scratch data directory and boot a local Pitot on it with a fresh control database. Never copy `data/control/` or secrets. Refresh the snapshot when the demo's services change. When the demo runs a release that writes an older batch format, replay the copied batches into the - local instance through OTLP with a throwaway converter instead; Fanout + local instance through OTLP with a throwaway converter instead; Pitot itself keeps no legacy reader. - **Fixtures.** Go tests use small deterministic Parquet fixtures written by test helpers, so CI never depends on the snapshot. diff --git a/docs/proposals/0003-agent-dashboards-m5.md b/docs/proposals/0003-agent-dashboards-m5.md index 42a3a3fae..c4294c573 100644 --- a/docs/proposals/0003-agent-dashboards-m5.md +++ b/docs/proposals/0003-agent-dashboards-m5.md @@ -11,14 +11,14 @@ and metric query speed) is deferred to a later milestone. ## Goal -Fanout shows what is happening in a whole system, not only in its traced +Pitot shows what is happening in a whole system, not only in its traced services, and its numbers are right at a realistic scale. A system is everything whose behaviour decides whether the software works: the services, what they depend on, where they run, how people reach them, and what changes. Everything arrives over OTLP through the OpenTelemetry Collector, using its standard receivers (`hostmetrics`, `docker_stats`, -`httpcheck`) and semantic conventions. Fanout adds no per-source integrations. +`httpcheck`) and semantic conventions. Pitot adds no per-source integrations. It recognises the standard names and presents them. The front page answers, in this order: @@ -256,8 +256,8 @@ The documentation gains a guide to watching a system: a Collector configuration with `hostmetrics`, `docker_stats`, `httpcheck` and OTLP forwarding, and what each section needs. It recommends running `httpcheck` from a second Collector on a machine outside the observed stack, and states -the limit plainly: if the machine running Fanout fails, nothing on the page -can report it, so Fanout itself still needs an outside monitor. +the limit plainly: if the machine running Pitot fails, nothing on the page +can report it, so Pitot itself still needs an outside monitor. ### The self-observation test @@ -290,7 +290,7 @@ repository. ## Out of scope Alert rules created from system-page sections, incidents and notifications, -reachability checks run by Fanout itself (a Collector with `httpcheck` on an +reachability checks run by Pitot itself (a Collector with `httpcheck` on an outside machine covers them), cost and usage tracking, vulnerability matching for runtime versions. Each is designed separately if the page shows it is needed. diff --git a/docs/proposals/0004-fanql.md b/docs/proposals/0004-fanql.md index f157183fc..b7b164382 100644 --- a/docs/proposals/0004-fanql.md +++ b/docs/proposals/0004-fanql.md @@ -6,7 +6,7 @@ Pull request: #410 (section 0, FanQL); sections 1 to 5 are not yet built ## Intent -Fanout must be fully usable when no AI provider is configured (`FANOUT_AI_PROVIDER` empty). Today creating a dashboard, adding a panel, exploring data, searching logs, finding traces and managing alerts all go through chat or MCP. A self-hosted user without a key, or a hosted fanout.run customer who has not entered one, gets read-only dashboards plus SQL edits on existing panels. Chat stays the fastest path when a key exists; it must not be the only path. +Pitot must be fully usable when no AI provider is configured (`PITOT_AI_PROVIDER` empty). Today creating a dashboard, adding a panel, exploring data, searching logs, finding traces and managing alerts all go through chat or MCP. A self-hosted user without a key, or a hosted pitot.dev customer who has not entered one, gets read-only dashboards plus SQL edits on existing panels. Chat stays the fastest path when a key exists; it must not be the only path. ## Goals @@ -548,7 +548,7 @@ One line per query. Prefix `-` excludes and includes rows missing the field; `!= | 11 | metrics counter rate | timeseries | counter increase per second, not points per second | | 12 | metrics gauge, resource attribute | table | `last(value)` is kind-aware; `resource.k` is `resource['k']` | -Comparison claims are descriptive only: over the four reference queries whose output contract is equivalent across FanQL, Fanout SQL, SPL, KQL and Grafana, the FanQL strings total 255 characters against 285 (SPL), 324 (Grafana, with two UI settings), 460 (KQL) and 670 (SQL). These are string sums for typing on a stated dataset, not claims about task completion, learning time or error rates. +Comparison claims are descriptive only: over the four reference queries whose output contract is equivalent across FanQL, Pitot SQL, SPL, KQL and Grafana, the FanQL strings total 255 characters against 285 (SPL), 324 (Grafana, with two UI settings), 460 (KQL) and 670 (SQL). These are string sums for typing on a stated dataset, not claims about task completion, learning time or error rates. #### 0.16 Scope: preview and later @@ -611,7 +611,7 @@ Rather than separate renderers, the rail gets **Logs** and **Traces** entries th 1. **No empty dashboards.** The spec keeps its 1–40 panel invariant (`internal/panel/validate.go`). "New dashboard" asks for a name, then opens the Explore editor in a drawer; the dashboard is created with that first panel. Removing the last panel stays refused. 2. **No template gallery yet.** Only `DefaultSpec()` exists and every owner already has it. Add a "Duplicate dashboard" action instead (new name required); templates become a later content task. -3. **AI keys stay env-only in Fanout.** Self-hosted: Settings explains `FANOUT_AI_PROVIDER` and the key variables, and how to connect an MCP client. Hosted fanout.run: the customer enters a key on the fanout.run account page, and the control plane renders it into the tenant's environment and redeploys (Onebox Cloud design). Fanout gains no secret storage. +3. **AI keys stay env-only in Pitot.** Self-hosted: Settings explains `PITOT_AI_PROVIDER` and the key variables, and how to connect an MCP client. Hosted pitot.dev: the customer enters a key on the pitot.dev account page, and the control plane renders it into the tenant's environment and redeploys (Onebox Cloud design). Pitot gains no secret storage. 4. **UI saves follow the MCP rule that panels must return data,** enforced in the UI: Add panel and Create dashboard are enabled only after a run returned rows without error. Editing an existing panel needs only a run without error, since a healthy panel such as errors by service can be empty right now; this keeps the old SQL editor's behaviour now that the panel editor replaces it. The HTTP API keeps its current behaviour. 5. **Variables.** The Add-panel drawer opened from a dashboard can reference that dashboard's variables (for example `$service`), and the FanQL editor and the builder's where-editor understand `$name` with the All rule of section 0.6. When saving from Explore into a dashboard that has a variable on the same field, the save dialog offers to replace the literal filter with the variable. diff --git a/docs/proposals/0005-dedicated-attribute-columns.md b/docs/proposals/0005-dedicated-attribute-columns.md index 0c93b0498..ae094a3b3 100644 --- a/docs/proposals/0005-dedicated-attribute-columns.md +++ b/docs/proposals/0005-dedicated-attribute-columns.md @@ -60,7 +60,7 @@ Recorded on 2026-11-01: target as M1 to M3: at most half of format 4's time. The rule comes from the published standard alone. No key is added or removed -because of what Fanout's own test or lab data contains. +because of what Pitot's own test or lab data contains. ## Motivation @@ -204,12 +204,12 @@ The `exception.*` keys sit on span events and remain the existing - `deployment.environment` → `deployment.environment.name` - `peer.service` → `service.peer.name`, which is Development -Fanout stores keys exactly as they are sent. Old spellings stay in the map +Pitot stores keys exactly as they are sent. Old spellings stay in the map and can still be queried, but slowly. Only keys in the list get a column. Producers that still send old names convert them upstream, either with the Collector's [schema processor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/schemaprocessor) -(alpha for traces) or with a transform processor recipe in the docs. Fanout +(alpha for traces) or with a transform processor recipe in the docs. Pitot itself carries no alias table. The ingest fallbacks for old spellings in `internal/ingest/server.go` are removed together with the columns they fill. A semconv upgrade reruns the script. A changed list is a schema change and @@ -246,7 +246,7 @@ The following format-4 columns are removed with no aliases: `http_method`, `service_version` and `deployment_env`. Six of them map to keys that now have dedicated columns. `rpc_method` does not, because `rpc.method` is Release Candidate at v1.44.0. Filters on `rpc.method` read the VARIANT map until a -later format adds the key. `peer_service` and `rpc_service` contain Fanout +later format adds the key. `peer_service` and `rpc_service` contain Pitot logic and stay as derived columns, which is open question 1. **Resolution.** FanQL already reads `http.route` as `attributes['http.route']` @@ -297,7 +297,7 @@ shredding `messaging.*`. counts each key's values without a conversion. **Existing format-4 data.** AGENTS.md and ADR 0004 forbid a legacy reader. -Fanout keeps refusing format-4 directories and preserves them, as it does +Pitot keeps refusing format-4 directories and preserves them, as it does today. The operator deletes them before starting format 5. There is a precedent: the data reset on 2026-10-11. @@ -346,7 +346,7 @@ arrays and the exponential layout as sent. Format 5 follows it. ### Metric points in format 5 -The physical `type` column holds Fanout's vocabulary, `gauge`, `counter`, +The physical `type` column holds Pitot's vocabulary, `gauge`, `counter`, `updown`, `histogram` and `summary` (`internal/query/vocabulary.go`), as a dictionary-encoded string. Each value names one OTLP point kind, except that `histogram` covers both histogram kinds; a non-null `exp_scale` marks the @@ -443,7 +443,7 @@ service and metric of its file. Peers order these tables as follows: All of them put either a coarse time bucket or the stream or series identity first, and time last. Format 5 adopts the ClickHouse exporter's keys, the -OTel-native peer, with Fanout's `namespace` placed before `service`: +OTel-native peer, with Pitot's `namespace` placed before `service`: - **Logs:** five-minute bucket of `log_time`, `namespace`, `service`, `log_time`. @@ -594,7 +594,7 @@ of the peer order, not a tuning target, and the evaluation reports it. - The ingest fallbacks for old spellings are removed, so producers that send old names lose fast paths until they convert upstream. - Exemplar, event and link attributes need a list of VARIANT values, a nesting the writer - and DuckDB's reader have not yet carried in Fanout. It must be proven + and DuckDB's reader have not yet carried in Pitot. It must be proven before the format ships. - List columns break the merge's rule of one physical value per row. The column copier must handle repetition levels, and a mistake there corrupts diff --git a/docs/release.md b/docs/release.md index f786464b6..9a79052b2 100644 --- a/docs/release.md +++ b/docs/release.md @@ -1,13 +1,13 @@ # Releases -Fanout publishes one release from a verified commit on `main`. A release contains: +Pitot publishes one release from a verified commit on `main`. A release contains: - native Linux and macOS archives for amd64 and arm64; -- canonical `ghcr.io/labstack/fanout:` and `latest` +- canonical `ghcr.io/labstack/pitot:` and `latest` multi-architecture images; -- byte-identical `labstack/fanout:` and `latest` Docker Hub mirrors; +- byte-identical `labstack/pitot:` and `latest` Docker Hub mirrors; - SHA-256 checksums and GitHub build-provenance attestations for every archive; -- an `io.github.labstack/fanout` entry in the official MCP Registry; +- an `io.github.labstack/pitot` entry in the official MCP Registry; - the Apache-2.0 license, project notice, trademark policy, and generated third-party notices in every archive and container image. @@ -15,10 +15,10 @@ Fanout publishes one release from a verified commit on `main`. A release contain Tags use unpadded CalVer: `vYYYY.M.N[-alpha|-beta|-rc]`. The suffix states product maturity; GA has no suffix. The first release in a month is `.0`, and every -release increments `N` regardless of suffix. Fanout is alpha. For example, +release increments `N` regardless of suffix. Pitot is alpha. For example, `v2026.10.1-alpha` follows `v2026.10.0-alpha`. Container tags omit the leading `v`, so `v2026.10.1-alpha` publishes -`ghcr.io/labstack/fanout:2026.10.1-alpha` and `labstack/fanout:2026.10.1-alpha`. +`ghcr.io/labstack/pitot:2026.10.1-alpha` and `labstack/pitot:2026.10.1-alpha`. Every release moves `latest`. GitHub Releases are not marked as prereleases: the tag carries maturity, and the installer's `/releases/latest` must resolve. Only release and `latest` tags are mirrored to Docker Hub; `main` and commit @@ -30,7 +30,7 @@ manifests and secret profiles outside this public repository. A tag without a suffix is a stable release; `-alpha`, `-beta` and `-rc` tags are prereleases. Because `latest` follows both, it is not a stable channel. The [upgrade policy](../site/src/content/docs/docs/guides/upgrade.mdx), published at -, sets the notice period for breaking +, sets the notice period for breaking changes, the route and API deprecation rules, and the same-version restore requirement. @@ -91,15 +91,15 @@ also be verified directly: ```sh sha256sum -c SHA256SUMS -gh attestation verify fanout_v2026.10.1-alpha_linux_amd64.tar.gz \ - --repo labstack/fanout +gh attestation verify pitot_v2026.10.1-alpha_linux_amd64.tar.gz \ + --repo labstack/pitot ``` For containers, pin or record the digest returned by the registry: ```sh -docker buildx imagetools inspect ghcr.io/labstack/fanout:2026.10.1-alpha -docker buildx imagetools inspect docker.io/labstack/fanout:2026.10.1-alpha +docker buildx imagetools inspect ghcr.io/labstack/pitot:2026.10.1-alpha +docker buildx imagetools inspect docker.io/labstack/pitot:2026.10.1-alpha ``` ## Supply-chain scope @@ -111,3 +111,36 @@ post-publication verification. The container is consumed by immutable digest. Standalone signatures and SBOMs are outside the release artifact inventory. GitHub build provenance identifies the source; `THIRD_PARTY_NOTICES` lists the shipped dependencies. + +## First Pitot release + +After merging the rename pull request: + +1. Rename the GitHub repository from `labstack/fanout` to `labstack/pitot` in + repository settings. Update remotes and the repository website to + `https://pitot.dev`; configure that domain for the site deployment. Configure + the `pitot` Cloudflare Pages project used by `site.yml` and migrate the media + hostname to `assets.pitot.dev` before enabling the renamed site workflow. + Refresh the six historical landing captures and hosted clips with the new + wordmark on a host that can launch Chrome; the committed captures still + document the pre-rename alpha. +2. Verify the renamed repository's Actions permissions, branch protection, + environments, OIDC trust and package access. Ensure `ghcr.io/labstack/pitot` + is public and Actions can write it. Create or configure the public Docker Hub + `labstack/pitot` image destination and retain the workflow's existing + credential delivery. Do not overwrite old releases or image tags. +3. Wait for the merged `main` CI run to pass, then run `just release` from a + clean, current `main`. This selects the next unused `vYYYY.M.N-alpha` tag; + do not reset the monthly sequence because the product changed names. +4. Wait for the tag-triggered `release.yml` workflow, including anonymous image + pulls, `pitot_` archives containing `./pitot`, checksums, attestations and + installer verification. It publishes version and `latest` images to both new + image destinations. Add the rename and one-alpha compatibility notice from + `CHANGELOG.md` to the release notes. +5. The final workflow job authenticates with GitHub OIDC and publishes the tagged + `server.json` as `io.github.labstack/pitot` in the MCP Registry. Verify that + entry and its version after the job passes; retire the old registry listing + separately according to registry policy. Do not publish from this branch. +6. In the following alpha, remove the legacy environment bridge and its installer + overrides after repeating the deprecation notice. Keep storage filenames and + token compatibility independently of that environment window. diff --git a/docs/testing.md b/docs/testing.md index 6523bb896..84d318615 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -7,7 +7,7 @@ before running MCP tests on a clean Ubuntu runner. Linux may request sudo for OS packages. From `ui/host`, run `bun run e2e --help` for the pinned Playwright CLI. The app matrix uses system Google Chrome. No AI provider key is needed. Run `just e2e` from the repository root to rebuild the embedded SPA, -MCP App and `bin/fanout`, then run every surface. `just check` remains browser-free. +MCP App and `bin/pitot`, then run every surface. `just check` remains browser-free. One config owns `ui/host/e2e/specs/`: `app/` contains the existing seeded-server specs, `mcp/` checks the built MCP App through the official AppBridge, and @@ -32,7 +32,7 @@ Run ownership regressions without a browser using `bun test e2e/support/app-lifecycle.test.ts` from `ui/host`; `bun run test -- e2e/support` runs all support tests with the configured Vitest environment. -MCP and visual projects have no setup dependency and never boot Fanout. +MCP and visual projects have no setup dependency and never boot Pitot. ```sh just e2e-browsers # locked Chromium and its OS dependencies @@ -61,12 +61,12 @@ artifact for review and acceptance; CI never silently accepts changed pixels. The existing `app/screenshots.spec.ts` stays in app: it captures opt-in review images and manifests, but has no screenshot assertions. Its -`FANOUT_E2E_SCREENSHOTS` gate is unchanged. +`PITOT_E2E_SCREENSHOTS` gate is unchanged. ## Recorded MCP host `e2e/host/server.mjs` builds current `panels.html` with `vite.apps.config.ts`, -setting `FANOUT_APPS_OUT` to a temporary directory, then builds the test host. +setting `PITOT_APPS_OUT` to a temporary directory, then builds the test host. It serves only those production files on `127.0.0.1` port zero with `Cache-Control: no-store`; Playwright captures `listening on ` into `E2E_PORT`. SIGTERM closes the listener and removes build output. It never @@ -110,8 +110,8 @@ fragment coverage below. Setup creates a disposable loopback server, first administrator and near-now deterministic OTLP protobuf traces and logs. Teardown stops the server and removes -its data and temporary credentials. `FANOUT_E2E_BINARY` can select another built -server; `FANOUT_E2E_SEED_BINARY` can select a prebuilt seed command. Both paths are +its data and temporary credentials. `PITOT_E2E_BINARY` can select another built +server; `PITOT_E2E_SEED_BINARY` can select a prebuilt seed command. Both paths are runtime values; otherwise the seed runs through `scripts/with-duckdb.sh`. Setup polls `/readyz` before creating the administrator within its 30-second start budget, then retries data readiness for 90 seconds, requiring span and log @@ -223,8 +223,8 @@ Check all six ordered categorical colours plus Other under colour-vision deficiency simulation. Browser accessibility scans cannot read canvas text, so supplement any scan with compiler/token assertions and screenshots. CI runs the performance spec (`just e2e e2e/specs/app/performance.spec.ts`) in its own job and -the rest with `FANOUT_E2E_SKIP_PERFORMANCE=1`. `just e2e` runs the axe-core AA scan of dashboards and chat panels in both -themes; `FANOUT_E2E_SCREENSHOTS=1 just e2e` also captures every panel type in +the rest with `PITOT_E2E_SKIP_PERFORMANCE=1`. `just e2e` runs the axe-core AA scan of dashboards and chat panels in both +themes; `PITOT_E2E_SCREENSHOTS=1 just e2e` also captures every panel type in both themes and states for review under `ui/host/test-results/`. Record the scanner or simulation method and version, findings and manual review results; an unrun or inconclusive check is not an accessibility pass. @@ -270,7 +270,7 @@ then regenerate and check: ```sh just docs-generate just docs-generate-check -just test ./cmd/fanout-docgen +just test ./cmd/pitot-docgen ``` With site dependencies installed, run `npm run build` from `site/` @@ -279,9 +279,9 @@ and benchmark guards. `just site-build` also installs site dependencies; use the installed build directly when dependency installation is outside the verification environment's scope. Neither command publishes the site. -Refresh the README's light and dark System overview captures with `just landing-captures` (real seeded server and local Chrome). To capture an existing instance, set `FANOUT_LANDING_BASE_URL` to its URL and `FANOUT_LANDING_SESSION_COOKIE` to a `name=value` session cookie before running the same command; no server starts and no data is seeded. +Refresh the README's light and dark System overview captures with `just landing-captures` (real seeded server and local Chrome). To capture an existing instance, set `PITOT_LANDING_BASE_URL` to its URL and `PITOT_LANDING_SESSION_COOKIE` to a `name=value` session cookie before running the same command; no server starts and no data is seeded. -To record chat and dashboard clips, set `FANOUT_LANDING_RECORDINGS=1` and the external-instance variables above, then run `bun run e2e e2e/specs/app/landing-recordings.spec.ts --project=app-1440-light --project=app-1440-dark` from `ui/host`. Follow [landing-recordings.md](../site/scripts/landing-recordings.md) to encode and upload them. +To record chat and dashboard clips, set `PITOT_LANDING_RECORDINGS=1` and the external-instance variables above, then run `bun run e2e e2e/specs/app/landing-recordings.spec.ts --project=app-1440-light --project=app-1440-dark` from `ui/host`. Follow [landing-recordings.md](../site/scripts/landing-recordings.md) to encode and upload them. ## Local product catalog @@ -351,6 +351,6 @@ that permits the browser's Mach port registration. The FanQL tests always enforce allocation ceilings and bounded parser/renderer work. Wall-clock acceptance is opt-in: run `just fanql-perf`, or set -`FANOUT_TEST_LATENCY=1` when running the FanQL tests through +`PITOT_TEST_LATENCY=1` when running the FanQL tests through `scripts/with-duckdb.sh`. Use an uninstrumented build for timing; race builds still check deterministic work bounds but skip wall-clock assertions. diff --git a/go.mod b/go.mod index ca0fc6df0..dd8eb3486 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/labstack/fanout +module github.com/labstack/pitot go 1.27.3 diff --git a/internal/agent/answer_only_test.go b/internal/agent/answer_only_test.go index 73dff003a..ba91fdb66 100644 --- a/internal/agent/answer_only_test.go +++ b/internal/agent/answer_only_test.go @@ -3,8 +3,8 @@ package agent import ( "context" "encoding/json" - "github.com/labstack/fanout/internal/dashboard" - fanoutmcp "github.com/labstack/fanout/internal/mcp" + "github.com/labstack/pitot/internal/dashboard" + pitotmcp "github.com/labstack/pitot/internal/mcp" "net/http" "net/http/httptest" "reflect" @@ -13,8 +13,8 @@ import ( agtypes "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/core/types" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/auth" - controlstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/auth" + controlstore "github.com/labstack/pitot/internal/store" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -177,7 +177,7 @@ func TestAnswerOnlyExecutorRequiresClassification(t *testing.T) { } } func TestAnswerOnlyRealToolClassificationGolden(t *testing.T) { - registry, err := NewToolRegistry(t.Context(), fanoutmcp.NewWithIntelligence(registryQueries{}, &dashboard.Service{}, nil, registryIntelligence{}, "test").MCP()) + registry, err := NewToolRegistry(t.Context(), pitotmcp.NewWithIntelligence(registryQueries{}, &dashboard.Service{}, nil, registryIntelligence{}, "test").MCP()) if err != nil { t.Fatal(err) } diff --git a/internal/agent/committed_panic_test.go b/internal/agent/committed_panic_test.go index 07e519c9b..b7ad22781 100644 --- a/internal/agent/committed_panic_test.go +++ b/internal/agent/committed_panic_test.go @@ -9,10 +9,10 @@ import ( "testing" agtypes "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/core/types" - "github.com/labstack/fanout/internal/dashboard" - fanoutmcp "github.com/labstack/fanout/internal/mcp" - "github.com/labstack/fanout/internal/query" - controlstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/dashboard" + pitotmcp "github.com/labstack/pitot/internal/mcp" + "github.com/labstack/pitot/internal/query" + controlstore "github.com/labstack/pitot/internal/store" ) func TestRuntimePanicDistinguishesCommittedSave(t *testing.T) { @@ -28,7 +28,7 @@ func TestRuntimePanicDistinguishesCommittedSave(t *testing.T) { t.Fatal(err) } service := dashboard.New(db.DB, query.NewExecutor(nil, 30)) - server := fanoutmcp.NewWithIntelligence(registryQueries{}, service, query.NewExecutor(nil, 30), nil, "test") + server := pitotmcp.NewWithIntelligence(registryQueries{}, service, query.NewExecutor(nil, 30), nil, "test") registry, err := NewToolRegistry(t.Context(), server.MCP()) if err != nil { t.Fatal(err) diff --git a/internal/agent/dashboard_eval_golden_test.go b/internal/agent/dashboard_eval_golden_test.go index 94ba720b6..df05b613f 100644 --- a/internal/agent/dashboard_eval_golden_test.go +++ b/internal/agent/dashboard_eval_golden_test.go @@ -12,15 +12,15 @@ import ( "time" agtypes "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/core/types" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/engine/querytest" - fanoutmcp "github.com/labstack/fanout/internal/mcp" - "github.com/labstack/fanout/internal/query" - controlstore "github.com/labstack/fanout/internal/store" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/engine/querytest" + pitotmcp "github.com/labstack/pitot/internal/mcp" + "github.com/labstack/pitot/internal/query" + controlstore "github.com/labstack/pitot/internal/store" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) // The Go service/executor/encoder own these fixtures. Only volatile IDs, @@ -55,7 +55,7 @@ func TestDashboardEvalGoldensCurrent(t *testing.T) { t.Fatal(err) } service := dashboard.New(db.DB, executor) - server := fanoutmcp.NewWithIntelligence(registryQueries{}, service, executor, nil, "test") + server := pitotmcp.NewWithIntelligence(registryQueries{}, service, executor, nil, "test") tools, err := NewToolRegistry(t.Context(), server.MCP()) if err != nil { t.Fatal(err) @@ -238,7 +238,7 @@ func TestDashboardEvalGoldensCurrent(t *testing.T) { } raw = append(raw, '\n') path := filepath.Join("..", "..", "scripts", "dashboard-eval", "testdata", "server.json") - if os.Getenv("FANOUT_EVAL_UPDATE_GOLDENS") == "1" { + if os.Getenv("PITOT_EVAL_UPDATE_GOLDENS") == "1" { if err = os.MkdirAll(filepath.Dir(path), 0755); err != nil { t.Fatal(err) } diff --git a/internal/agent/fragment_content_test.go b/internal/agent/fragment_content_test.go index 8827557a4..1164e3546 100644 --- a/internal/agent/fragment_content_test.go +++ b/internal/agent/fragment_content_test.go @@ -3,23 +3,23 @@ package agent import ( "context" "encoding/json" - fanoutmcp "github.com/labstack/fanout/internal/mcp" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/toolerror" + pitotmcp "github.com/labstack/pitot/internal/mcp" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/toolerror" "reflect" "strings" "testing" "unicode/utf8" agtypes "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/core/types" - controlstore "github.com/labstack/fanout/internal/store" + controlstore "github.com/labstack/pitot/internal/store" "github.com/modelcontextprotocol/go-sdk/mcp" ) func TestAppToolModelContentAndVisibility(t *testing.T) { server := mcp.NewServer(&mcp.Implementation{Name: "fixture", Version: "1"}, nil) fragment := map[string]any{"dashboard": map[string]any{"version": 1, "name": "Fixture", "panels": []any{map[string]any{"id": "text", "title": "Text", "viz": "text", "content": "hello"}}}, "results": []any{map[string]any{"id": "text", "status": "ok"}}} - mcp.AddTool(server, &mcp.Tool{Name: "query_telemetry", Meta: mcp.Meta{"ui": map[string]any{"resourceUri": "ui://fanout/panels.html", "visibility": []string{"model", "app"}}}}, func(context.Context, *mcp.CallToolRequest, struct{}) (*mcp.CallToolResult, map[string]any, error) { + mcp.AddTool(server, &mcp.Tool{Name: "query_telemetry", Meta: mcp.Meta{"ui": map[string]any{"resourceUri": "ui://pitot/panels.html", "visibility": []string{"model", "app"}}}}, func(context.Context, *mcp.CallToolRequest, struct{}) (*mcp.CallToolResult, map[string]any, error) { return &mcp.CallToolResult{Content: []mcp.Content{&mcp.TextContent{Text: "compact summary"}}}, fragment, nil }) mcp.AddTool(server, &mcp.Tool{Name: "query_panel_fragment", Meta: mcp.Meta{"ui": map[string]any{"visibility": []string{"app"}}}}, func(context.Context, *mcp.CallToolRequest, struct{}) (*mcp.CallToolResult, map[string]any, error) { @@ -66,7 +66,7 @@ func TestFragmentActivityPersistsExactContent(t *testing.T) { if err != nil { t.Fatal(err) } - server := fanoutmcp.NewWithIntelligence(registryQueries{}, nil, query.NewExecutor(nil, 30), nil, "test") + server := pitotmcp.NewWithIntelligence(registryQueries{}, nil, query.NewExecutor(nil, 30), nil, "test") tools, err := NewToolRegistry(t.Context(), server.MCP()) if err != nil { t.Fatal(err) @@ -123,7 +123,7 @@ func TestFragmentActivityPersistsExactContent(t *testing.T) { } func TestAppToolContentKeepsTextAndNonAppMarshalFailureIsError(t *testing.T) { - r := &ToolRegistry{apps: map[string]string{"app": "ui://fanout/panels.html"}} + r := &ToolRegistry{apps: map[string]string{"app": "ui://pitot/panels.html"}} result := &mcp.CallToolResult{Content: []mcp.Content{&mcp.TextContent{Text: "compact"}}, StructuredContent: map[string]any{"invalid": make(chan int)}} content, err := r.modelContent("app", result) if err != nil || content != "compact" { @@ -135,7 +135,7 @@ func TestAppToolContentKeepsTextAndNonAppMarshalFailureIsError(t *testing.T) { } func TestAppSummariesBoundedOnSuccessAndError(t *testing.T) { - registry := &ToolRegistry{apps: map[string]string{"app": "ui://fanout/panels.html"}} + registry := &ToolRegistry{apps: map[string]string{"app": "ui://pitot/panels.html"}} for _, failed := range []bool{false, true} { result := &mcp.CallToolResult{IsError: failed, StructuredContent: map[string]any{"frame": strings.Repeat("body", 100000)}, Content: []mcp.Content{&mcp.TextContent{Text: strings.Repeat("界", 20000)}}} got, err := registry.modelContent("app", result) @@ -153,7 +153,7 @@ func TestAppToolErrorHasNoActivity(t *testing.T) { t.Run(tc.name, func(t *testing.T) { messages := []agtypes.Message{{ID: "user", Role: agtypes.RoleUser, Content: "show"}} provider := &scriptedProvider{steps: [][]StreamEvent{{{Type: EventToolUse, ToolCall: &ToolCall{ID: "call", Name: tc.tool, Input: `{}`}}, {Type: EventStop, StopReason: "tool_calls"}}, {{Type: EventStop, StopReason: "end_turn"}}}} - runtime := NewRuntime(provider, &fakeTools{execution: ToolExecution{Content: tc.content, IsError: true, AppResourceURI: "ui://fanout/panels.html"}}, nil) + runtime := NewRuntime(provider, &fakeTools{execution: ToolExecution{Content: tc.content, IsError: true, AppResourceURI: "ui://pitot/panels.html"}}, nil) emitter, _ := newTestEmitter() if _, err := runtime.execute(t.Context(), "thread", "run", &messages, emitter); err != nil { t.Fatal(err) @@ -185,7 +185,7 @@ func TestDuplicateMapActivitiesStoppedAtSource(t *testing.T) { fragment := map[string]any{"view": map[string]any{"kind": "query", "key": "server-key"}, "dashboard": map[string]any{"version": 1, "name": "Map", "time": map[string]any{"from": "2026-10-07T18:45:00Z", "to": "2026-10-07T19:45:00Z"}, "panels": []any{map[string]any{"id": "services", "title": "Service dependencies", "viz": "service_map", "query": map[string]any{"from": "spans"}}}}, "results": []any{map[string]any{"id": "services", "status": "ok"}}} messages := []agtypes.Message{{ID: "user", Role: agtypes.RoleUser, Content: "map"}} provider := &scriptedProvider{steps: [][]StreamEvent{{{Type: EventToolUse, ToolCall: &ToolCall{ID: "custom", Name: "query_telemetry", Input: `{}`}}, {Type: EventToolUse, ToolCall: &ToolCall{ID: "preset", Name: "get_service_topology", Input: `{}`}}, {Type: EventStop, StopReason: "tool_calls"}}, {{Type: EventStop, StopReason: "end_turn"}}}} - runtime := NewRuntime(provider, &fakeTools{execution: ToolExecution{Content: "Map summary", Structured: fragment, AppResourceURI: "ui://fanout/panels.html"}}, nil) + runtime := NewRuntime(provider, &fakeTools{execution: ToolExecution{Content: "Map summary", Structured: fragment, AppResourceURI: "ui://pitot/panels.html"}}, nil) emitter, _ := newTestEmitter() if _, err := runtime.execute(t.Context(), "thread", "run", &messages, emitter); err != nil { t.Fatal(err) @@ -211,7 +211,7 @@ func (f *viewTools) Execute(_ context.Context, call ToolCall) (ToolExecution, er if call.Name == "renamed_preset" { kind = "preset" } - return ToolExecution{Content: kind, AppResourceURI: "ui://fanout/panels.html", Structured: fanoutmcp.PanelFragment{View: fanoutmcp.FragmentView{Kind: kind, Key: "authoritative-key"}}}, nil + return ToolExecution{Content: kind, AppResourceURI: "ui://pitot/panels.html", Structured: pitotmcp.PanelFragment{View: pitotmcp.FragmentView{Kind: kind, Key: "authoritative-key"}}}, nil } func TestRuntimeUsesServerIdentityAndPresetWinner(t *testing.T) { for _, order := range [][]string{{"query", "renamed_preset"}, {"renamed_preset", "query"}} { diff --git a/internal/agent/narration_test.go b/internal/agent/narration_test.go index 7a8c08804..e35abd905 100644 --- a/internal/agent/narration_test.go +++ b/internal/agent/narration_test.go @@ -10,7 +10,7 @@ import ( "time" agtypes "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/core/types" - controlstore "github.com/labstack/fanout/internal/store" + controlstore "github.com/labstack/pitot/internal/store" ) func TestRuntimeKeepsToolNarrationOutOfTranscript(t *testing.T) { @@ -296,12 +296,12 @@ func TestRuntimeErrorMessagesArePlain(t *testing.T) { err error want string }{ - {errProvider, "Fanout could not reach the model provider. Please try again."}, - {errStepLimit, "Fanout reached its step limit before finishing. Try a narrower question."}, - {fmt.Errorf("%w: unrelated wording", errTimeLimit), "Fanout reached its 5-minute time limit. Try a smaller request."}, - {fmt.Errorf("%w: misleading 5-minute text", errStepLimit), "Fanout reached its step limit before finishing. Try a narrower question."}, + {errProvider, "Pitot could not reach the model provider. Please try again."}, + {errStepLimit, "Pitot reached its step limit before finishing. Try a narrower question."}, + {fmt.Errorf("%w: unrelated wording", errTimeLimit), "Pitot reached its 5-minute time limit. Try a smaller request."}, + {fmt.Errorf("%w: misleading 5-minute text", errStepLimit), "Pitot reached its step limit before finishing. Try a narrower question."}, {context.Canceled, "Stopped"}, - {errors.New("private unknown error"), "Fanout could not complete this analysis. Please try again."}, + {errors.New("private unknown error"), "Pitot could not complete this analysis. Please try again."}, } { if got := clientErrorMessage(tc.err); got != tc.want { t.Fatalf("got=%q want=%q", got, tc.want) diff --git a/internal/agent/provider_contract_test.go b/internal/agent/provider_contract_test.go index 253069824..b804cf57e 100644 --- a/internal/agent/provider_contract_test.go +++ b/internal/agent/provider_contract_test.go @@ -15,7 +15,7 @@ import ( "testing" agtypes "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/core/types" - controlstore "github.com/labstack/fanout/internal/store" + controlstore "github.com/labstack/pitot/internal/store" ) func TestOpenAIOutputItemsReplayVerbatim(t *testing.T) { @@ -140,10 +140,10 @@ func TestOpenAIEncryptedContentConfigurationError(t *testing.T) { } err = p.Stream(context.Background(), StreamParams{}, func(StreamEvent) error { return nil }) var apiErr *APIError - if err == nil || !strings.Contains(err.Error(), "reasoning model") || !strings.Contains(err.Error(), "FANOUT_AI_MODEL") || !errors.As(err, &apiErr) || apiErr.StatusCode != 400 { + if err == nil || !strings.Contains(err.Error(), "reasoning model") || !strings.Contains(err.Error(), "PITOT_AI_MODEL") || !errors.As(err, &apiErr) || apiErr.StatusCode != 400 { t.Errorf("configuration error = %v", err) } - if got := clientErrorMessage(err); got != "Fanout could not reach the model provider. Please try again." { + if got := clientErrorMessage(err); got != "Pitot could not reach the model provider. Please try again." { t.Errorf("client error = %q", got) } } diff --git a/internal/agent/provider_http.go b/internal/agent/provider_http.go index d634db5e8..d9bde3b0d 100644 --- a/internal/agent/provider_http.go +++ b/internal/agent/provider_http.go @@ -104,7 +104,7 @@ func (p *openAIProvider) Stream(ctx context.Context, params StreamParams, cb fun if err != nil { var apiErr *APIError if errors.As(err, &apiErr) && apiErr.StatusCode == http.StatusBadRequest && strings.Contains(strings.ToLower(apiErr.Body), "encrypted") { - return fmt.Errorf("OpenAI configuration error: FANOUT_AI_MODEL must select a reasoning model supporting reasoning.encrypted_content (default gpt-6.1-sol): %w", err) + return fmt.Errorf("OpenAI configuration error: PITOT_AI_MODEL must select a reasoning model supporting reasoning.encrypted_content (default gpt-6.1-sol): %w", err) } return err } diff --git a/internal/agent/provider_http_test.go b/internal/agent/provider_http_test.go index 04feac584..c32ca4680 100644 --- a/internal/agent/provider_http_test.go +++ b/internal/agent/provider_http_test.go @@ -12,7 +12,7 @@ import ( "testing" agtypes "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/core/types" - "github.com/labstack/fanout/internal/config" + "github.com/labstack/pitot/internal/config" ) // lines joins SSE lines with \n. diff --git a/internal/agent/run_context_test.go b/internal/agent/run_context_test.go index 93aeb9962..50741dcdb 100644 --- a/internal/agent/run_context_test.go +++ b/internal/agent/run_context_test.go @@ -12,8 +12,8 @@ import ( agtypes "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/core/types" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/auth" - controlstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/auth" + controlstore "github.com/labstack/pitot/internal/store" ) func TestRunContextCapsMarshalledBytesWithoutSplittingRunes(t *testing.T) { diff --git a/internal/agent/runtime.go b/internal/agent/runtime.go index e3c07f3d3..742bb8d60 100644 --- a/internal/agent/runtime.go +++ b/internal/agent/runtime.go @@ -20,13 +20,13 @@ import ( "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/encoding/sse" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/api" - "github.com/labstack/fanout/internal/dashboard" - appid "github.com/labstack/fanout/internal/id" - "github.com/labstack/fanout/internal/toolerror" + "github.com/labstack/pitot/internal/api" + "github.com/labstack/pitot/internal/dashboard" + appid "github.com/labstack/pitot/internal/id" + "github.com/labstack/pitot/internal/toolerror" ) -const systemPrompt = `You are Fanout's observability assistant. When a view is attached to your reply it is the picture: never draw diagrams, trees, or charts in text, never use code fences to draw boxes, arrows, or trees, and never add a table or list that restates what an attached view already shows; your prose adds only what the view omits. Use get_overview first for broad health questions, get_insights for the latest precomputed anomalies and recurring log patterns, get_service_topology for direct dependency edges, get_service_dependencies for bounded upstream or downstream reachability from a service, get_service_performance for activity/latency/operations/comparisons, inspect_trace for trace or root-cause inspection, and search_logs for log questions. Treat structured outputs as authoritative. You build and change the user's dashboards. Build one whenever the user asks for an overview, asks why something is slow, failing or changing, asks to compare, break down or track telemetry, or asks for anything they would want to look at again; answer a single factual question with a view instead. To build one, read get_telemetry_schema, draft a complete spec of panels that answer the request, run preview_panels, fix every invalid panel, replace or drop every empty one, and only then call create_dashboard. Cover every part of the request: when a part has no data, state that finding in the answer and use the signals the service actually has. Title each panel with exactly what it measures. Prefer a few precise panels over many vague ones: headline stats first, then the time series that explain them, then a table of the worst offenders. After saving, reply in two or three sentences with what the dashboard shows and what stands out. Use filter values exactly as the schema lists them. To change a dashboard, get_dashboard first and use edit_dashboard so unrelated panels stay as they are; replace only when the user asks for a redesign. State the time window you used, distinguish missing data from healthy behavior, and never invent services, metrics, or causal claims. Do not present empty results. Dashboards contain only panels that return data; text panels are exempt. Keep answers concise because attached views provide interactive details. Never expose implementation details to the user: do not mention protocol names, tool names, schemas, query IDs, data-source names, storage engines, providers, rollups, aggregation tables, internal windows, or internal execution steps. Panel titles, descriptions and text panels must use product language, without implementation details. Refer to attached interactive content simply as a view.` + dashboardAnalysisGuidance +const systemPrompt = `You are Pitot's observability assistant. When a view is attached to your reply it is the picture: never draw diagrams, trees, or charts in text, never use code fences to draw boxes, arrows, or trees, and never add a table or list that restates what an attached view already shows; your prose adds only what the view omits. Use get_overview first for broad health questions, get_insights for the latest precomputed anomalies and recurring log patterns, get_service_topology for direct dependency edges, get_service_dependencies for bounded upstream or downstream reachability from a service, get_service_performance for activity/latency/operations/comparisons, inspect_trace for trace or root-cause inspection, and search_logs for log questions. Treat structured outputs as authoritative. You build and change the user's dashboards. Build one whenever the user asks for an overview, asks why something is slow, failing or changing, asks to compare, break down or track telemetry, or asks for anything they would want to look at again; answer a single factual question with a view instead. To build one, read get_telemetry_schema, draft a complete spec of panels that answer the request, run preview_panels, fix every invalid panel, replace or drop every empty one, and only then call create_dashboard. Cover every part of the request: when a part has no data, state that finding in the answer and use the signals the service actually has. Title each panel with exactly what it measures. Prefer a few precise panels over many vague ones: headline stats first, then the time series that explain them, then a table of the worst offenders. After saving, reply in two or three sentences with what the dashboard shows and what stands out. Use filter values exactly as the schema lists them. To change a dashboard, get_dashboard first and use edit_dashboard so unrelated panels stay as they are; replace only when the user asks for a redesign. State the time window you used, distinguish missing data from healthy behavior, and never invent services, metrics, or causal claims. Do not present empty results. Dashboards contain only panels that return data; text panels are exempt. Keep answers concise because attached views provide interactive details. Never expose implementation details to the user: do not mention protocol names, tool names, schemas, query IDs, data-source names, storage engines, providers, rollups, aggregation tables, internal windows, or internal execution steps. Panel titles, descriptions and text panels must use product language, without implementation details. Refer to attached interactive content simply as a view.` + dashboardAnalysisGuidance const dashboardAnalysisGuidance = ` For analysis dashboards, use only the types the question needs; do not fill a dashboard with all of them. Use heatmap for latency changes, histogram for distributions, scatter for relationships, state_timeline for threshold states, logs for events, log_patterns for repeated messages, traces for slow or erroring traces, service_map for dependencies, and health for service health. Use drill for span or log evidence; keep checked filters. Include annotations for change investigations; deploys and detector findings do not prove causes. Use a deploy split for scoped before/since comparisons; retain missing-deploy explanations. A definition, explanation, or single fact is an answer intent; do not create or replace a dashboard for it. Preserve every requested facet and explain absent telemetry without inventing it. Saved panels must keep working as new telemetry arrives: never filter on trace, span or request IDs or other values copied from one result; show recent evidence with a traces panel and drill to its logs. In replies, never name schema fields to the user. Explain in chat is answer intent: use the observed absolute panel window and resolved variables, explain errors and suggest corrections without creating, editing, replacing or restoring dashboards.` @@ -623,15 +623,15 @@ func clientErrorCode(err error) string { func clientErrorMessage(err error) string { switch clientErrorCode(err) { case "provider_unavailable": - return "Fanout could not reach the model provider. Please try again." + return "Pitot could not reach the model provider. Please try again." case "step_limit": - return "Fanout reached its step limit before finishing. Try a narrower question." + return "Pitot reached its step limit before finishing. Try a narrower question." case "time_limit": - return "Fanout reached its 5-minute time limit. Try a smaller request." + return "Pitot reached its 5-minute time limit. Try a smaller request." case "abort": return "Stopped" default: - return "Fanout could not complete this analysis. Please try again." + return "Pitot could not complete this analysis. Please try again." } } diff --git a/internal/agent/runtime_log_test.go b/internal/agent/runtime_log_test.go index 0b192c211..8ac16ff5d 100644 --- a/internal/agent/runtime_log_test.go +++ b/internal/agent/runtime_log_test.go @@ -3,8 +3,8 @@ package agent import ( "bytes" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/auth" - controlstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/auth" + controlstore "github.com/labstack/pitot/internal/store" "log/slog" "net/http/httptest" "strings" diff --git a/internal/agent/runtime_test.go b/internal/agent/runtime_test.go index f53fdd71a..079cbaad7 100644 --- a/internal/agent/runtime_test.go +++ b/internal/agent/runtime_test.go @@ -14,12 +14,12 @@ import ( agtypes "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/core/types" "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/encoding/sse" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/auth" - fanoutmcp "github.com/labstack/fanout/internal/mcp" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/auth" + pitotmcp "github.com/labstack/pitot/internal/mcp" + "github.com/labstack/pitot/internal/query" - "github.com/labstack/fanout/internal/dashboard" - controlstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/dashboard" + controlstore "github.com/labstack/pitot/internal/store" ) type textProvider struct{} @@ -185,7 +185,7 @@ func TestRuntimeProviderErrorSanitizedAndPersisted(t *testing.T) { } stream := output.String() assertEventOrder(t, stream, "RUN_STARTED", "RUN_ERROR") - if !strings.Contains(stream, "Fanout could not reach the model provider. Please try again.") { + if !strings.Contains(stream, "Pitot could not reach the model provider. Please try again.") { t.Errorf("RUN_ERROR missing generic message: %s", stream) } if strings.Contains(stream, "secret") { @@ -269,7 +269,7 @@ func TestRuntimeStepLimitExceeded(t *testing.T) { } stream := output.String() assertEventOrder(t, stream, "RUN_STARTED", "RUN_ERROR") - if !strings.Contains(stream, "Fanout reached its step limit before finishing. Try a narrower question.") { + if !strings.Contains(stream, "Pitot reached its step limit before finishing. Try a narrower question.") { t.Errorf("RUN_ERROR missing step limit message: %s", stream) } } @@ -370,7 +370,7 @@ func TestRuntimeRunInjectsAuthoritativeOriginIntoDashboardTool(t *testing.T) { t.Fatal(err) } service := dashboard.New(database.DB, originValidator{}) - registry, err := NewToolRegistry(t.Context(), fanoutmcp.NewWithIntelligence(registryQueries{}, service, nil, nil, "test").MCP()) + registry, err := NewToolRegistry(t.Context(), pitotmcp.NewWithIntelligence(registryQueries{}, service, nil, nil, "test").MCP()) if err != nil { t.Fatal(err) } diff --git a/internal/agent/service_input_test.go b/internal/agent/service_input_test.go index c1165ced6..39ea13bf4 100644 --- a/internal/agent/service_input_test.go +++ b/internal/agent/service_input_test.go @@ -8,16 +8,16 @@ import ( "time" "unicode/utf8" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/engine" - fanoutmcp "github.com/labstack/fanout/internal/mcp" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/query" - controlstore "github.com/labstack/fanout/internal/store" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" - "github.com/labstack/fanout/internal/toolerror" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/engine" + pitotmcp "github.com/labstack/pitot/internal/mcp" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/query" + controlstore "github.com/labstack/pitot/internal/store" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" + "github.com/labstack/pitot/internal/toolerror" ) func TestToolRegistryUnknownServiceBoundsOversizedAliases(t *testing.T) { @@ -47,7 +47,7 @@ func TestToolRegistryUnknownServiceBoundsOversizedAliases(t *testing.T) { t.Fatal(err) } executor := query.NewExecutor(duck, 7) - server := fanoutmcp.NewWithIntelligence(observability.New(duck, duck, 7), nil, executor, nil, "test") + server := pitotmcp.NewWithIntelligence(observability.New(duck, duck, 7), nil, executor, nil, "test") registry, err := NewToolRegistry(t.Context(), server.MCP()) if err != nil { t.Fatal(err) @@ -100,7 +100,7 @@ func TestToolRegistryNoDataAndDashboardPanelErrors(t *testing.T) { t.Fatal(err) } executor := query.NewExecutor(duck, 7) - server := fanoutmcp.NewWithIntelligence(observability.New(duck, duck, 7), dashboard.New(db.DB, executor), executor, nil, "test") + server := pitotmcp.NewWithIntelligence(observability.New(duck, duck, 7), dashboard.New(db.DB, executor), executor, nil, "test") registry, err := NewToolRegistry(t.Context(), server.MCP()) if err != nil { t.Fatal(err) diff --git a/internal/agent/store_test.go b/internal/agent/store_test.go index 4541bac12..c299fb1f2 100644 --- a/internal/agent/store_test.go +++ b/internal/agent/store_test.go @@ -16,11 +16,11 @@ import ( agtypes "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/core/types" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/api" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" + "github.com/labstack/pitot/internal/api" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" - controlstore "github.com/labstack/fanout/internal/store" + controlstore "github.com/labstack/pitot/internal/store" ) func TestStorePersistsOwnerScopedThread(t *testing.T) { @@ -56,8 +56,8 @@ func TestStoreReloadsSanitizedRunOutcome(t *testing.T) { err error want string }{ - {"provider", fmt.Errorf("%w: private provider body", errProvider), "Fanout could not reach the model provider. Please try again."}, - {"step limit", errStepLimit, "Fanout reached its step limit before finishing. Try a narrower question."}, + {"provider", fmt.Errorf("%w: private provider body", errProvider), "Pitot could not reach the model provider. Please try again."}, + {"step limit", errStepLimit, "Pitot reached its step limit before finishing. Try a narrower question."}, {"stopped", context.Canceled, "Stopped"}, {"stopped delivery", errors.Join(errAnswerDelivery, context.Canceled), "Stopped"}, } { @@ -553,7 +553,7 @@ func TestThreadRouteHidesOtherOwnersThread(t *testing.T) { mutation := func(method, path, body string) *httptest.ResponseRecorder { request := httptest.NewRequest(method, path, strings.NewReader(body)) request.Header.Set("Content-Type", "application/json") - request.Header.Set("Fanout-Request", "1") + request.Header.Set("Pitot-Request", "1") request.AddCookie(cookie) recorder := httptest.NewRecorder() e.ServeHTTP(recorder, request) @@ -601,7 +601,7 @@ func TestStoreStartRunKeepsStoredHistory(t *testing.T) { {ID: "user-1", Role: agtypes.RoleUser, Content: "health?"}, {ID: "assistant-1", Role: agtypes.RoleAssistant, Content: "here it is"}, {ID: "activity-1", Role: agtypes.RoleActivity, ActivityType: "mcp-app", Content: map[string]any{ - "resource_uri": "ui://fanout/panels.html", "tool_name": "query_telemetry", "tool_input": map[string]any{}, "is_error": false, + "resource_uri": "ui://pitot/panels.html", "tool_name": "query_telemetry", "tool_input": map[string]any{}, "is_error": false, "tool_result": map[string]any{"dashboard": map[string]any{"version": 1, "name": "Fixture", "panels": []any{map[string]any{"id": "text", "title": "Text", "viz": "text", "content": "Hello"}}}, "results": []any{map[string]any{"id": "text", "status": "ok"}}}, }}, } diff --git a/internal/agent/tool_error_structure_test.go b/internal/agent/tool_error_structure_test.go index 7d2c153c3..f3be8f6ff 100644 --- a/internal/agent/tool_error_structure_test.go +++ b/internal/agent/tool_error_structure_test.go @@ -9,8 +9,8 @@ import ( "time" agtypes "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/core/types" - fanoutmcp "github.com/labstack/fanout/internal/mcp" - controlstore "github.com/labstack/fanout/internal/store" + pitotmcp "github.com/labstack/pitot/internal/mcp" + controlstore "github.com/labstack/pitot/internal/store" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -52,7 +52,7 @@ func TestRuntimeToolErrorsAreStructuredLiveAndPersisted(t *testing.T) { } }} if path == "refused_app_only" || path == "mcp_panic" { - server := fanoutmcp.NewWithIntelligence(registryQueries{}, nil, nil, nil, "test") + server := pitotmcp.NewWithIntelligence(registryQueries{}, nil, nil, nil, "test") name = "query_panel_fragment" if path == "mcp_panic" { name = "panic_tool" diff --git a/internal/agent/tools.go b/internal/agent/tools.go index 0d37144b6..7f404c321 100644 --- a/internal/agent/tools.go +++ b/internal/agent/tools.go @@ -7,15 +7,15 @@ import ( "strings" "unicode/utf8" - "github.com/labstack/fanout/internal/dashboard" - fanoutmcp "github.com/labstack/fanout/internal/mcp" - "github.com/labstack/fanout/internal/toolerror" + "github.com/labstack/pitot/internal/dashboard" + pitotmcp "github.com/labstack/pitot/internal/mcp" + "github.com/labstack/pitot/internal/toolerror" "github.com/modelcontextprotocol/go-sdk/mcp" ) const ( - mcpUIExtension = fanoutmcp.UIExtension - mcpAppMIME = fanoutmcp.AppMIME + mcpUIExtension = pitotmcp.UIExtension + mcpAppMIME = pitotmcp.AppMIME ) type ToolExecution struct { @@ -40,12 +40,12 @@ func NewToolRegistry(ctx context.Context, server *mcp.Server) (*ToolRegistry, er if err != nil { return nil, fmt.Errorf("connect internal MCP server: %w", err) } - client := mcp.NewClient(&mcp.Implementation{Name: "fanout-agent", Version: "1"}, &mcp.ClientOptions{ + client := mcp.NewClient(&mcp.Implementation{Name: "pitot-agent", Version: "1"}, &mcp.ClientOptions{ Capabilities: &mcp.ClientCapabilities{Extensions: map[string]any{ mcpUIExtension: map[string]any{"mimeTypes": []string{mcpAppMIME}}, }}, }) - session, err := client.Connect(ctx, clientTransport, &mcp.ClientSessionOptions{ProtocolVersion: fanoutmcp.ProtocolVersion}) + session, err := client.Connect(ctx, clientTransport, &mcp.ClientSessionOptions{ProtocolVersion: pitotmcp.ProtocolVersion}) if err != nil { serverSession.Close() return nil, fmt.Errorf("connect internal MCP client: %w", err) @@ -58,12 +58,12 @@ func NewToolRegistry(ctx context.Context, server *mcp.Server) (*ToolRegistry, er } registry := &ToolRegistry{session: session, serverSession: serverSession, apps: map[string]string{}, mutations: map[string]bool{}, readOnly: map[string]bool{}} for _, tool := range listed.Tools { - if fanoutmcp.AppOnly(tool.Meta) { + if pitotmcp.AppOnly(tool.Meta) { continue } registry.definitions = append(registry.definitions, ToolDef{Name: tool.Name, Description: tool.Description, InputSchema: tool.InputSchema}) registry.readOnly[tool.Name] = reviewedReadOnly(tool.Name, tool.Annotations) - if fanoutmcp.RequiredToolScope(tool.Name) == dashboard.OAuthScope && tool.Annotations != nil && !tool.Annotations.ReadOnlyHint { + if pitotmcp.RequiredToolScope(tool.Name) == dashboard.OAuthScope && tool.Annotations != nil && !tool.Annotations.ReadOnlyHint { registry.mutations[tool.Name] = true } if resourceURI := appResourceURI(tool.Meta); resourceURI != "" { @@ -185,19 +185,19 @@ func appResourceURI(meta mcp.Meta) string { } // Consume the server's identity; never recompute it in the agent or host. -func fragmentView(value any) fanoutmcp.FragmentView { - if f, ok := value.(fanoutmcp.PanelFragment); ok { +func fragmentView(value any) pitotmcp.FragmentView { + if f, ok := value.(pitotmcp.PanelFragment); ok { return f.View } - if f, ok := value.(*fanoutmcp.PanelFragment); ok && f != nil { + if f, ok := value.(*pitotmcp.PanelFragment); ok && f != nil { return f.View } if f, ok := value.(map[string]any); ok { if v, ok := f["view"].(map[string]any); ok { kind, _ := v["kind"].(string) key, _ := v["key"].(string) - return fanoutmcp.FragmentView{Kind: kind, Key: key} + return pitotmcp.FragmentView{Kind: kind, Key: key} } } - return fanoutmcp.FragmentView{} + return pitotmcp.FragmentView{} } diff --git a/internal/agent/tools_integration_test.go b/internal/agent/tools_integration_test.go index 12b1b6ed2..c33920fc6 100644 --- a/internal/agent/tools_integration_test.go +++ b/internal/agent/tools_integration_test.go @@ -3,16 +3,16 @@ package agent import ( "context" "encoding/json" - "github.com/labstack/fanout/internal/dashboard" + "github.com/labstack/pitot/internal/dashboard" "github.com/modelcontextprotocol/go-sdk/mcp" "testing" agtypes "github.com/ag-ui-protocol/ag-ui/sdks/community/go/pkg/core/types" - "github.com/labstack/fanout/internal/intelligence" - fanoutmcp "github.com/labstack/fanout/internal/mcp" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/query" - controlstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/intelligence" + pitotmcp "github.com/labstack/pitot/internal/mcp" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/query" + controlstore "github.com/labstack/pitot/internal/store" ) type registryQueries struct{} @@ -32,7 +32,7 @@ func (registryQueries) Trace(context.Context, observability.Scope, string, strin } func TestToolRegistryNegotiatesMCPApps(t *testing.T) { - server := fanoutmcp.NewWithIntelligence(registryQueries{}, nil, nil, registryIntelligence{}, "test") + server := pitotmcp.NewWithIntelligence(registryQueries{}, nil, nil, registryIntelligence{}, "test") registry, err := NewToolRegistry(context.Background(), server.MCP()) if err != nil { t.Fatalf("NewToolRegistry: %v", err) @@ -44,12 +44,12 @@ func TestToolRegistryNegotiatesMCPApps(t *testing.T) { }) want := map[string]string{ - "query_telemetry": "ui://fanout/panels.html", - "get_overview": "ui://fanout/panels.html", - "get_service_topology": "ui://fanout/panels.html", - "get_service_performance": "ui://fanout/panels.html", - "inspect_trace": "ui://fanout/panels.html", - "search_logs": "ui://fanout/panels.html", + "query_telemetry": "ui://pitot/panels.html", + "get_overview": "ui://pitot/panels.html", + "get_service_topology": "ui://pitot/panels.html", + "get_service_performance": "ui://pitot/panels.html", + "inspect_trace": "ui://pitot/panels.html", + "search_logs": "ui://pitot/panels.html", } if len(registry.apps) != len(want) { t.Fatalf("registered MCP apps = %v, want %v", registry.apps, want) @@ -85,7 +85,7 @@ func TestToolRegistryInjectsAuthenticatedBuildOrigin(t *testing.T) { defer registry.Close() origin := dashboard.BuildOrigin{ThreadID: "server-thread", MessageID: "server-user", RequestExcerpt: "Actual request"} ctx := dashboard.WithBuildOrigin(dashboard.WithOwner(t.Context(), "owner"), origin) - _, err = registry.Execute(ctx, ToolCall{Name: "capture", Input: `{"_meta":{"io.fanout/build-origin":{"thread_id":"spoof"}}}`}) + _, err = registry.Execute(ctx, ToolCall{Name: "capture", Input: `{"_meta":{"io.pitot/build-origin":{"thread_id":"spoof"}}}`}) if err != nil { t.Fatal(err) } @@ -119,7 +119,7 @@ func TestRuntimeDashboardHistoryUsesAuthenticatedOwner(t *testing.T) { if err != nil { t.Fatal(err) } - server := fanoutmcp.NewWithIntelligence(registryQueries{}, service, executor, nil, "test") + server := pitotmcp.NewWithIntelligence(registryQueries{}, service, executor, nil, "test") // Restoring a spec the dashboard already has is rejected, so the save changes it. if _, err := service.Replace(t.Context(), "owner", created.ID, query.Dashboard{Name: "History", Panels: []query.Panel{{ID: "note", Title: "Note", Viz: "text", Content: "second"}}}, 1, dashboard.Author{Kind: "user", ID: "owner"}, "Saved again"); err != nil { t.Fatal(err) diff --git a/internal/alert/email.go b/internal/alert/email.go index 1e752b015..d42da1206 100644 --- a/internal/alert/email.go +++ b/internal/alert/email.go @@ -11,8 +11,8 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/db/generated" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/db/generated" ) // Rule email statuses, reported on Rule.EmailStatus. Delivery rows use sent, @@ -29,7 +29,7 @@ const ( ) // EmailUnavailableMessage explains why email cannot be chosen or delivered. -const EmailUnavailableMessage = "Email delivery is unavailable because SMTP is not configured. Set FANOUT_SMTP_HOST, FANOUT_SMTP_USERNAME, FANOUT_SMTP_PASSWORD and FANOUT_SMTP_FROM." +const EmailUnavailableMessage = "Email delivery is unavailable because SMTP is not configured. Set PITOT_SMTP_HOST, PITOT_SMTP_USERNAME, PITOT_SMTP_PASSWORD and PITOT_SMTP_FROM." const ( emailBatchSize = 50 @@ -423,7 +423,7 @@ func (e *Engine) deliverEmail(ctx context.Context, row generated.AlertEmailDeliv Time: content.Time, } if int(sent) == limit-1 { - mail.LimitNotice = fmt.Sprintf("This address has reached the limit of %d alert emails per hour. Further alerts are recorded on their rules in Fanout and not emailed until the count falls.", limit) + mail.LimitNotice = fmt.Sprintf("This address has reached the limit of %d alert emails per hour. Further alerts are recorded on their rules in Pitot and not emailed until the count falls.", limit) } sendCtx, cancel := context.WithTimeout(ctx, emailSendTimeout) err = e.email.Send(sendCtx, mail) diff --git a/internal/alert/email_test.go b/internal/alert/email_test.go index 23b90306c..4f2eb8225 100644 --- a/internal/alert/email_test.go +++ b/internal/alert/email_test.go @@ -16,7 +16,7 @@ import ( mail "github.com/wneessen/go-mail" - "github.com/labstack/fanout/internal/auth" + "github.com/labstack/pitot/internal/auth" ) // outbox records sends and fails them on demand. diff --git a/internal/alert/engine.go b/internal/alert/engine.go index ccf283134..548f4dfcb 100644 --- a/internal/alert/engine.go +++ b/internal/alert/engine.go @@ -11,8 +11,8 @@ import ( "sync" "time" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/intelligence" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/intelligence" ) const pruneHistDays = 7 diff --git a/internal/alert/engine_env_test.go b/internal/alert/engine_env_test.go index b5f5c5e65..acd87c616 100644 --- a/internal/alert/engine_env_test.go +++ b/internal/alert/engine_env_test.go @@ -8,7 +8,7 @@ import ( _ "github.com/duckdb/duckdb-go/v2" - "github.com/labstack/fanout/internal/engine" + "github.com/labstack/pitot/internal/engine" ) // buildEnvs feeds CEL rules from a SQL aggregate over service_rollup. DuckDB diff --git a/internal/alert/engine_test.go b/internal/alert/engine_test.go index 83f9e68b5..4932e23de 100644 --- a/internal/alert/engine_test.go +++ b/internal/alert/engine_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - appstore "github.com/labstack/fanout/internal/store" + appstore "github.com/labstack/pitot/internal/store" ) // newTestEngine creates an Engine and Store backed by an in-memory SQLite DB. diff --git a/internal/alert/store.go b/internal/alert/store.go index 64dfc4afd..6688ccc27 100644 --- a/internal/alert/store.go +++ b/internal/alert/store.go @@ -6,8 +6,8 @@ import ( "errors" "fmt" - "github.com/labstack/fanout/internal/db/generated" - appid "github.com/labstack/fanout/internal/id" + "github.com/labstack/pitot/internal/db/generated" + appid "github.com/labstack/pitot/internal/id" ) // ErrNotFound is returned when a requested record does not exist. diff --git a/internal/alert/store_test.go b/internal/alert/store_test.go index 267bb31cc..5d80830fb 100644 --- a/internal/alert/store_test.go +++ b/internal/alert/store_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - appstore "github.com/labstack/fanout/internal/store" + appstore "github.com/labstack/pitot/internal/store" ) func newTestStore(t *testing.T) *Store { diff --git a/internal/alert/types.go b/internal/alert/types.go index 2d7f8fde1..5b6973225 100644 --- a/internal/alert/types.go +++ b/internal/alert/types.go @@ -49,7 +49,7 @@ type Alert struct { // Env holds the metric values available to alert expressions. // // The `expr` tag is the name a rule author writes, and each field's doc comment -// is published as that variable's description by cmd/fanout-docgen. Adding a +// is published as that variable's description by cmd/pitot-docgen. Adding a // field here adds a row to the reference; describe it in a sentence a rule // author would find useful, not in terms of how it is computed. type Env struct { diff --git a/internal/annotations/service.go b/internal/annotations/service.go index 7efa679b6..f10e12c15 100644 --- a/internal/annotations/service.go +++ b/internal/annotations/service.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" ) var ErrRequest = errors.New("annotations need a positive range of at most 430 days and at most 100 services") diff --git a/internal/annotations/service_test.go b/internal/annotations/service_test.go index 418c767b4..074c4ec9f 100644 --- a/internal/annotations/service_test.go +++ b/internal/annotations/service_test.go @@ -3,7 +3,7 @@ package annotations import ( "context" "errors" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" "testing" "time" ) diff --git a/internal/api/account_ownership_test.go b/internal/api/account_ownership_test.go index cd9d8e99d..6243c95fd 100644 --- a/internal/api/account_ownership_test.go +++ b/internal/api/account_ownership_test.go @@ -7,13 +7,13 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" ) const ( - ownershipAdminGroup = "fanout-admins-group-name" - ownershipOperatorGroup = "fanout-operators-group-name" + ownershipAdminGroup = "pitot-admins-group-name" + ownershipOperatorGroup = "pitot-operators-group-name" ) func roleMappedConfig() config.Config { @@ -50,7 +50,7 @@ func createOwnershipUser(t *testing.T, s *scimServer, email string, role auth.Ro } func browserHeaders() map[string]string { - return map[string]string{"Content-Type": "application/json", "Fanout-Request": "1"} + return map[string]string{"Content-Type": "application/json", "Pitot-Request": "1"} } type browserUserOperation struct { diff --git a/internal/api/alerts.go b/internal/api/alerts.go index 5ddac32e2..995f3800a 100644 --- a/internal/api/alerts.go +++ b/internal/api/alerts.go @@ -8,8 +8,8 @@ import ( "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/alert" - "github.com/labstack/fanout/internal/auth" + "github.com/labstack/pitot/internal/alert" + "github.com/labstack/pitot/internal/auth" ) // RegisterAlertRoutes registers alert management REST endpoints. diff --git a/internal/api/alerts_email_test.go b/internal/api/alerts_email_test.go index 8077f8ce0..c9150f41e 100644 --- a/internal/api/alerts_email_test.go +++ b/internal/api/alerts_email_test.go @@ -10,8 +10,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/alert" - "github.com/labstack/fanout/internal/auth" + "github.com/labstack/pitot/internal/alert" + "github.com/labstack/pitot/internal/auth" ) type alertEmailServer struct { diff --git a/internal/api/alerts_test.go b/internal/api/alerts_test.go index 3dee1d6b1..9c61e0a04 100644 --- a/internal/api/alerts_test.go +++ b/internal/api/alerts_test.go @@ -12,8 +12,8 @@ import ( "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/alert" - "github.com/labstack/fanout/internal/auth" + "github.com/labstack/pitot/internal/alert" + "github.com/labstack/pitot/internal/auth" ) func TestAlertingReadRoutesRequireAuthenticationAndPreserveBodies(t *testing.T) { diff --git a/internal/api/annotations.go b/internal/api/annotations.go index c0637d0fa..9b5c26578 100644 --- a/internal/api/annotations.go +++ b/internal/api/annotations.go @@ -6,7 +6,7 @@ import ( "net/http" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/annotations" + "github.com/labstack/pitot/internal/annotations" ) type AnnotationReader interface { diff --git a/internal/api/annotations_test.go b/internal/api/annotations_test.go index 83c7b5d1e..fb645c12d 100644 --- a/internal/api/annotations_test.go +++ b/internal/api/annotations_test.go @@ -4,14 +4,14 @@ import ( "context" "errors" "fmt" - "github.com/labstack/fanout/internal/auth" + "github.com/labstack/pitot/internal/auth" "net/http" "net/http/httptest" "strings" "testing" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/annotations" + "github.com/labstack/pitot/internal/annotations" ) type annotationFake struct{} diff --git a/internal/api/auth.go b/internal/api/auth.go index d9438e370..34e527b9f 100644 --- a/internal/api/auth.go +++ b/internal/api/auth.go @@ -11,9 +11,9 @@ import ( "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/settings" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/settings" ) type setupCredential interface { @@ -108,11 +108,11 @@ func (h *AuthHandler) Setup(c *echo.Context) error { case auth.SetupStatusExpired: slog.Warn("auth: setup rejected", "reason", "expired") jitter() - return echo.NewHTTPError(http.StatusGone, "setup token expired; restart Fanout to generate a new one") + return echo.NewHTTPError(http.StatusGone, "setup token expired; restart Pitot to generate a new one") case auth.SetupStatusUnset: slog.Warn("auth: setup rejected", "reason", "unset") jitter() - return echo.NewHTTPError(http.StatusGone, "setup window is closed; restart Fanout to reopen it") + return echo.NewHTTPError(http.StatusGone, "setup window is closed; restart Pitot to reopen it") default: slog.Warn("auth: setup rejected", "reason", "wrong") jitter() diff --git a/internal/api/auth_middleware.go b/internal/api/auth_middleware.go index b3b3dc65b..c93f2069c 100644 --- a/internal/api/auth_middleware.go +++ b/internal/api/auth_middleware.go @@ -11,8 +11,8 @@ import ( "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" ) const ( @@ -402,7 +402,7 @@ func validBrowserMutation(r *http.Request) bool { if strings.EqualFold(strings.TrimSpace(r.Header.Get("Sec-Fetch-Site")), "cross-site") { return false } - if r.Header.Get("Fanout-Request") == "1" { + if r.Header.Get("Pitot-Request") == "1" { return true } for _, raw := range []string{r.Header.Get("Origin"), r.Header.Get("Referer")} { diff --git a/internal/api/auth_test.go b/internal/api/auth_test.go index 0872c4177..a82735bbd 100644 --- a/internal/api/auth_test.go +++ b/internal/api/auth_test.go @@ -13,10 +13,10 @@ import ( "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/settings" - appstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/settings" + appstore "github.com/labstack/pitot/internal/store" ) type testAuthServer struct { @@ -101,7 +101,7 @@ func sessionRequest(method, target string, body *strings.Reader, cookie *http.Co req.AddCookie(cookie) } if isUnsafeMethod(method) { - req.Header.Set("Fanout-Request", "1") + req.Header.Set("Pitot-Request", "1") } return req } @@ -443,12 +443,12 @@ func TestBrowserMutationValidation(t *testing.T) { want int }{ {name: "missing", want: http.StatusForbidden}, - {name: "custom header", head: map[string]string{"Fanout-Request": "1"}, want: http.StatusNoContent}, + {name: "custom header", head: map[string]string{"Pitot-Request": "1"}, want: http.StatusNoContent}, {name: "same origin", head: map[string]string{"Origin": "http://example.com"}, want: http.StatusNoContent}, {name: "referer", head: map[string]string{"Referer": "http://example.com/page"}, want: http.StatusNoContent}, {name: "malformed referer", head: map[string]string{"Referer": "://bad"}, want: http.StatusForbidden}, {name: "evil origin", head: map[string]string{"Origin": "https://evil.test"}, want: http.StatusForbidden}, - {name: "cross site overrides header", head: map[string]string{"Fanout-Request": "1", "Sec-Fetch-Site": "cross-site"}, want: http.StatusForbidden}, + {name: "cross site overrides header", head: map[string]string{"Pitot-Request": "1", "Sec-Fetch-Site": "cross-site"}, want: http.StatusForbidden}, } { t.Run(tc.name, func(t *testing.T) { req := httptest.NewRequest(http.MethodPost, "/api/alerting/rules", nil) @@ -483,7 +483,7 @@ func TestLogoutDeletesServerSession(t *testing.T) { } func TestStartDoesNotRevealAccountState(t *testing.T) { - smtp := auth.SMTPConfig{Host: "smtp.example.com", Port: 587, User: "user", Pass: "pass", From: "Fanout "} + smtp := auth.SMTPConfig{Host: "smtp.example.com", Port: 587, User: "user", Pass: "pass", From: "Pitot "} s := newTestAuthServerWith(t, config.Config{AuthMode: "local"}, smtp) suspended, _ := s.users.CreateWithAudit("suspended@example.com", "", "operator", auth.AuditEvent{EventType: "user.created", Outcome: "success"}) status := auth.UserStatusSuspended @@ -548,7 +548,7 @@ func TestLoginLinkAuthenticatesExactlyOnce(t *testing.T) { } func TestStartReturnsServiceUnavailableWhenEmailDeliveryFails(t *testing.T) { - smtp := auth.SMTPConfig{Host: "127.0.0.1", Port: 1, User: "user", Pass: "pass", From: "Fanout "} + smtp := auth.SMTPConfig{Host: "127.0.0.1", Port: 1, User: "user", Pass: "pass", From: "Pitot "} s := newTestAuthServerWith(t, config.Config{AuthMode: "local", SelfSignup: true}, smtp) if _, err := s.users.CreateWithAudit("admin@example.com", "", "admin", auth.AuditEvent{EventType: "user.created", Outcome: "success"}); err != nil { t.Fatalf("Create: %v", err) @@ -743,7 +743,7 @@ func TestSetupExpiryAndExistingAdminRetry(t *testing.T) { } func TestSetupReturnsPublicIngestEndpoint(t *testing.T) { - const endpoint = "https://fanout.example.com" + const endpoint = "https://pitot.example.com" s := newTestAuthServerWith(t, config.Config{AuthMode: "local", PublicURL: endpoint}, auth.SMTPConfig{}) req := httptest.NewRequest(http.MethodPost, "/api/auth/setup", strings.NewReader(`{"email":"admin@example.com","setup_token":"`+s.setupToken+`"}`)) req.Header.Set("Content-Type", "application/json") diff --git a/internal/api/dashboard.go b/internal/api/dashboard.go index 7ed1b825e..81e03f66f 100644 --- a/internal/api/dashboard.go +++ b/internal/api/dashboard.go @@ -7,8 +7,8 @@ import ( "strconv" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/query" ) type DashboardHandler struct{ dashboards *dashboard.Service } @@ -124,8 +124,8 @@ func (h *DashboardHandler) delete(c *echo.Context) error { if err != nil { return err } - if c.Request().Header.Get("Fanout-Confirm-Delete") != c.Param("id") { - return newAPIError(http.StatusPreconditionRequired, "confirmation_required", "Deleting a dashboard requires the Fanout-Confirm-Delete header set to its ID.") + if c.Request().Header.Get("Pitot-Confirm-Delete") != c.Param("id") { + return newAPIError(http.StatusPreconditionRequired, "confirmation_required", "Deleting a dashboard requires the Pitot-Confirm-Delete header set to its ID.") } if err := h.dashboards.Delete(c.Request().Context(), owner, c.Param("id")); err != nil { return dashboardError(c, err) diff --git a/internal/api/dashboard_history_test.go b/internal/api/dashboard_history_test.go index 1f4bbe5e2..14b43df1d 100644 --- a/internal/api/dashboard_history_test.go +++ b/internal/api/dashboard_history_test.go @@ -8,9 +8,9 @@ import ( "slices" "testing" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/query" ) func TestHistoricalDashboardHTTPReadRequiresOwnerAndReturnsSaveChanges(t *testing.T) { diff --git a/internal/api/dashboard_test.go b/internal/api/dashboard_test.go index 269338b23..c55b85db7 100644 --- a/internal/api/dashboard_test.go +++ b/internal/api/dashboard_test.go @@ -3,14 +3,14 @@ package api import ( "context" "encoding/json" - "github.com/labstack/fanout/internal/auth" + "github.com/labstack/pitot/internal/auth" "net/http" "net/http/httptest" "strings" "testing" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/query" ) type structuralValidator struct{} @@ -97,7 +97,7 @@ func TestDashboardLifecycleOverHTTP(t *testing.T) { if rec := call(http.MethodDelete, "/api/dashboards/"+created.ID, "", ownerCookie); rec.Code != http.StatusPreconditionRequired || !strings.Contains(rec.Body.String(), `"code":"confirmation_required"`) { t.Fatalf("unconfirmed delete = %d %s", rec.Code, rec.Body) } - if rec := call(http.MethodDelete, "/api/dashboards/"+created.ID, "", ownerCookie, "Fanout-Confirm-Delete", created.ID); rec.Code != http.StatusNoContent { + if rec := call(http.MethodDelete, "/api/dashboards/"+created.ID, "", ownerCookie, "Pitot-Confirm-Delete", created.ID); rec.Code != http.StatusNoContent { t.Fatalf("delete = %d", rec.Code) } } diff --git a/internal/api/errors.go b/internal/api/errors.go index 1398be9fe..cad1be093 100644 --- a/internal/api/errors.go +++ b/internal/api/errors.go @@ -6,7 +6,7 @@ import ( "net/http" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) type apiError struct { diff --git a/internal/api/errors_test.go b/internal/api/errors_test.go index cd4b5fa58..8b6dfea61 100644 --- a/internal/api/errors_test.go +++ b/internal/api/errors_test.go @@ -12,7 +12,7 @@ import ( "testing" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) func TestHTTPFailuresCarryStatusCodesAndSafeMessages(t *testing.T) { diff --git a/internal/api/fanql.go b/internal/api/fanql.go index 4f5911b6d..bf5a4d7b0 100644 --- a/internal/api/fanql.go +++ b/internal/api/fanql.go @@ -7,8 +7,8 @@ import ( "time" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/fanql" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/fanql" + "github.com/labstack/pitot/internal/query" ) type FanQLHandler struct { diff --git a/internal/api/fanql_corpus_test.go b/internal/api/fanql_corpus_test.go index 577866622..2a1bf39fd 100644 --- a/internal/api/fanql_corpus_test.go +++ b/internal/api/fanql_corpus_test.go @@ -11,9 +11,9 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/fanql" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/fanql" + "github.com/labstack/pitot/internal/query" ) type nonExecutingFanQLPanels struct { diff --git a/internal/api/fanql_test.go b/internal/api/fanql_test.go index fb97b82ca..7dabb73f3 100644 --- a/internal/api/fanql_test.go +++ b/internal/api/fanql_test.go @@ -10,9 +10,9 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/fanql" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/fanql" + "github.com/labstack/pitot/internal/query" ) type fakeFanQLParser struct { diff --git a/internal/api/health.go b/internal/api/health.go index d627cb6c4..f3babe109 100644 --- a/internal/api/health.go +++ b/internal/api/health.go @@ -13,8 +13,8 @@ import ( "time" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" ) // HealthHandler handles health check endpoints @@ -64,7 +64,7 @@ type HealthResponse struct { const livenessPingTimeout = time.Second // Liveness returns 200 while the process can serve (Kubernetes liveness -// probe). It fails only for a stall in Fanout's own work that a restart would +// probe). It fails only for a stall in Pitot's own work that a restart would // free: a Parquet publication holding reads out past its bound, or an idle // engine that cannot answer a ping. An overloaded engine, however saturated, // is alive, and so is one running a costly query past its deadline: a diff --git a/internal/api/health_test.go b/internal/api/health_test.go index 26e883891..41022ac25 100644 --- a/internal/api/health_test.go +++ b/internal/api/health_test.go @@ -12,8 +12,8 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" ) func TestLiveness(t *testing.T) { @@ -77,13 +77,13 @@ func TestReadiness_NilDuck(t *testing.T) { func TestReadinessReportsSizingResolvedByLoader(t *testing.T) { environ := []string{ - "FANOUT_AUTH_CODE_SECRET=0123456789abcdef0123456789abcdef", + "PITOT_AUTH_CODE_SECRET=0123456789abcdef0123456789abcdef", "ANTHROPIC_API_KEY=sk-test", - "FANOUT_SMTP_HOST=smtp.example.com", - "FANOUT_SMTP_USERNAME=user", - "FANOUT_SMTP_PASSWORD=pass", - "FANOUT_SMTP_FROM=noreply@example.com", - "FANOUT_DATA_DIR=" + t.TempDir(), + "PITOT_SMTP_HOST=smtp.example.com", + "PITOT_SMTP_USERNAME=user", + "PITOT_SMTP_PASSWORD=pass", + "PITOT_SMTP_FROM=noreply@example.com", + "PITOT_DATA_DIR=" + t.TempDir(), } cfg, err := config.Load(config.LoadOptions{Environ: environ}) if err != nil { @@ -254,7 +254,7 @@ func (p *fakePool) Overruns() int { return p.overruns } func (p *fakePool) Live(context.Context) error { return p.live } // Probes time out alike on an overloaded engine and a stalled one. Only a -// stall in Fanout's own work fails readiness and liveness, so the supervisor +// stall in Pitot's own work fails readiness and liveness, so the supervisor // restarts it; an overloaded engine, or one running a query past its // deadline, stays alive and reads as degraded. func TestOnlyAStalledEngineFailsReadinessAndLiveness(t *testing.T) { diff --git a/internal/api/intelligence.go b/internal/api/intelligence.go index f9b832cbd..987346b31 100644 --- a/internal/api/intelligence.go +++ b/internal/api/intelligence.go @@ -4,7 +4,7 @@ import ( "net/http" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/intelligence" + "github.com/labstack/pitot/internal/intelligence" ) // IntelligenceSnapshots is the read side of the detector used by HTTP and diff --git a/internal/api/intelligence_test.go b/internal/api/intelligence_test.go index 931c8aa99..e9598b214 100644 --- a/internal/api/intelligence_test.go +++ b/internal/api/intelligence_test.go @@ -9,8 +9,8 @@ import ( "time" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/intelligence" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/intelligence" ) type fakeIntelligenceSnapshots struct { diff --git a/internal/api/mcp_conformance_test.go b/internal/api/mcp_conformance_test.go index e9d315977..3bdb9f80e 100644 --- a/internal/api/mcp_conformance_test.go +++ b/internal/api/mcp_conformance_test.go @@ -15,10 +15,10 @@ import ( "time" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/dashboard" - appmcp "github.com/labstack/fanout/internal/mcp" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/dashboard" + appmcp "github.com/labstack/pitot/internal/mcp" "github.com/modelcontextprotocol/go-sdk/jsonrpc" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -40,7 +40,7 @@ type mcpHTTPFixture struct { func newMCPHTTPFixture(t *testing.T) *mcpHTTPFixture { t.Helper() - f := &mcpHTTPFixture{state: newTestAuthServerWith(t, config.Config{PublicURL: "https://fanout.example.com"}, auth.SMTPConfig{}), started: make(chan struct{}, 1), cancelled: make(chan error, 1), release: make(chan struct{})} + f := &mcpHTTPFixture{state: newTestAuthServerWith(t, config.Config{PublicURL: "https://pitot.example.com"}, auth.SMTPConfig{}), started: make(chan struct{}, 1), cancelled: make(chan error, 1), release: make(chan struct{})} store := auth.NewOAuthStore(f.state.db.DB) var err error f.auth, err = NewMCPAuthorization(store, f.state.users, testMCPResource) @@ -104,7 +104,7 @@ type mcpBearerTransport struct{ token string } func (t mcpBearerTransport) RoundTrip(r *http.Request) (*http.Response, error) { r = r.Clone(r.Context()) - r.Host = "fanout.example.com" + r.Host = "pitot.example.com" r.Header.Set("Authorization", "Bearer "+t.token) return http.DefaultTransport.RoundTrip(r) } @@ -132,7 +132,7 @@ func (f *mcpHTTPFixture) request(t *testing.T, token, method, body, version, rpc if err != nil { t.Fatal(err) } - r.Host = "fanout.example.com" + r.Host = "pitot.example.com" r.Header.Set("Authorization", "Bearer "+token) r.Header.Set("Content-Type", "application/json") r.Header.Set("Accept", "application/json, text/event-stream") @@ -175,7 +175,7 @@ func TestMCPModernSDKInteropWithOAuth(t *testing.T) { if err != nil || result.IsError || result.Content[0].(*mcp.TextContent).Text != "ok" { t.Fatalf("call=%+v err=%v", result, err) } - resource, err := session.ReadResource(t.Context(), &mcp.ReadResourceParams{URI: "ui://fanout/panels.html"}) + resource, err := session.ReadResource(t.Context(), &mcp.ReadResourceParams{URI: "ui://pitot/panels.html"}) if err != nil || len(resource.Contents) != 1 || resource.Contents[0].MIMEType != appmcp.AppMIME || resource.Contents[0].Text == "" { t.Fatalf("resource=%+v err=%v", resource, err) } @@ -200,11 +200,11 @@ func TestMCPTrustedAndAbsentOriginsProceedWithAuthentication(t *testing.T) { } cookie := f.state.login(t, user) for _, path := range []string{"/mcp", "/api/mcp"} { - for _, origin := range []string{"", "https://fanout.example.com"} { + for _, origin := range []string{"", "https://pitot.example.com"} { headers := map[string]string{ "Content-Type": "application/json", "Accept": "application/json, text/event-stream", "MCP-Protocol-Version": appmcp.ProtocolVersion, "Mcp-Method": "tools/call", "Mcp-Name": "conformance_probe", - "Authorization": "Bearer " + f.token, "Fanout-Request": "1", + "Authorization": "Bearer " + f.token, "Pitot-Request": "1", } if origin != "" { headers["Origin"] = origin @@ -382,7 +382,7 @@ func TestBrowserMCPRejectsInitializeWithModernHeader(t *testing.T) { cookie := f.state.login(t, user) body := fmt.Sprintf(`{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":%q,"capabilities":{},"clientInfo":{"name":"browser","version":"test"}}}`, appmcp.ProtocolVersion) rec := serve(t, f.state.e, "POST", "/api/mcp", body, map[string]string{ - "Content-Type": "application/json", "Accept": "application/json, text/event-stream", "Fanout-Request": "1", + "Content-Type": "application/json", "Accept": "application/json, text/event-stream", "Pitot-Request": "1", "MCP-Protocol-Version": appmcp.ProtocolVersion, "Mcp-Method": "initialize", }, cookie) if rec.Code != http.StatusBadRequest || rec.Header().Get("Mcp-Session-Id") != "" { @@ -487,7 +487,7 @@ func TestMCPDashboardScopeAcrossEras(t *testing.T) { } response := f.request(t, f.token, "POST", body, version, method, headerName, id) challenge := response.Header.Get("WWW-Authenticate") - if response.StatusCode != 403 || !strings.Contains(challenge, `error="insufficient_scope"`) || !strings.Contains(challenge, `scope="telemetry:read dashboard:manage"`) || !strings.Contains(challenge, `resource_metadata="https://fanout.example.com/.well-known/oauth-protected-resource/mcp"`) { + if response.StatusCode != 403 || !strings.Contains(challenge, `error="insufficient_scope"`) || !strings.Contains(challenge, `scope="telemetry:read dashboard:manage"`) || !strings.Contains(challenge, `resource_metadata="https://pitot.example.com/.well-known/oauth-protected-resource/mcp"`) { t.Fatalf("%s %s: status=%d challenge=%s", version, name, response.StatusCode, challenge) } if version != appmcp.ProtocolVersion { @@ -600,7 +600,7 @@ func TestMCPUnauthenticatedChallengeNamesReadScope(t *testing.T) { f := newMCPHTTPFixture(t) response := f.request(t, "", "POST", "", "", "", "") challenge := response.Header.Get("WWW-Authenticate") - if response.StatusCode != 401 || !strings.Contains(challenge, `scope="telemetry:read"`) || !strings.Contains(challenge, `resource_metadata="https://fanout.example.com/.well-known/oauth-protected-resource/mcp"`) { + if response.StatusCode != 401 || !strings.Contains(challenge, `scope="telemetry:read"`) || !strings.Contains(challenge, `resource_metadata="https://pitot.example.com/.well-known/oauth-protected-resource/mcp"`) { t.Fatalf("status=%d challenge=%s", response.StatusCode, challenge) } } @@ -677,7 +677,7 @@ func TestMCPToolRateLimitAndPrincipalIsolation(t *testing.T) { t.Fatal(err) } defer serverSession.Close() - client := mcp.NewClient(&mcp.Implementation{Name: "fanout-agent", Version: "test"}, nil) + client := mcp.NewClient(&mcp.Implementation{Name: "pitot-agent", Version: "test"}, nil) internal, err := client.Connect(t.Context(), clientTransport, &mcp.ClientSessionOptions{ProtocolVersion: appmcp.ProtocolVersion}) if err != nil { t.Fatal(err) diff --git a/internal/api/mcp_policy.go b/internal/api/mcp_policy.go index c30f59c76..1f678927b 100644 --- a/internal/api/mcp_policy.go +++ b/internal/api/mcp_policy.go @@ -11,7 +11,7 @@ import ( "sync" "time" - appmcp "github.com/labstack/fanout/internal/mcp" + appmcp "github.com/labstack/pitot/internal/mcp" mcpgoauth "github.com/modelcontextprotocol/go-sdk/auth" "github.com/modelcontextprotocol/go-sdk/jsonrpc" "golang.org/x/time/rate" diff --git a/internal/api/mcp_policy_test.go b/internal/api/mcp_policy_test.go index e5db234b7..023a0da71 100644 --- a/internal/api/mcp_policy_test.go +++ b/internal/api/mcp_policy_test.go @@ -8,12 +8,12 @@ import ( "time" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" ) func TestMCPOriginsPrecedeAuthenticationOnBothMounts(t *testing.T) { - s := newTestAuthServerWith(t, config.Config{PublicURL: "https://FANOUT.example.com:443/path/"}, auth.SMTPConfig{}) + s := newTestAuthServerWith(t, config.Config{PublicURL: "https://PITOT.example.com:443/path/"}, auth.SMTPConfig{}) h, err := NewMCPAuthorization(auth.NewOAuthStore(s.db.DB), s.users, testMCPResource) if err != nil { t.Fatal(err) @@ -22,11 +22,11 @@ func TestMCPOriginsPrecedeAuthenticationOnBothMounts(t *testing.T) { s.e.Any("/mcp", echo.WrapHandler(h.ProtectMCP(next))) s.e.Any("/api/mcp", h.ProtectBrowserMCP(s.sessions, next)) for _, path := range []string{"/mcp", "/api/mcp"} { - for _, origin := range []string{"absent", "https://fanout.example.com", "https://attacker.example", "null", "https://fanout.example.com/", "http://[broken"} { + for _, origin := range []string{"absent", "https://pitot.example.com", "https://attacker.example", "null", "https://pitot.example.com/", "http://[broken"} { for _, method := range []string{"POST", "GET", "DELETE"} { - headers := map[string]string{"Authorization": "Bearer invalid", "Fanout-Request": "1"} + headers := map[string]string{"Authorization": "Bearer invalid", "Pitot-Request": "1"} want := http.StatusForbidden - if origin == "absent" || origin == "https://fanout.example.com" { + if origin == "absent" || origin == "https://pitot.example.com" { want = http.StatusUnauthorized } if origin != "absent" { @@ -41,8 +41,8 @@ func TestMCPOriginsPrecedeAuthenticationOnBothMounts(t *testing.T) { } for _, path := range []string{"/mcp", "/api/mcp"} { r := httptest.NewRequest("POST", path, nil) - r.Host = "fanout.example.com" - r.Header["Origin"] = []string{"https://fanout.example.com", "https://fanout.example.com"} + r.Host = "pitot.example.com" + r.Header["Origin"] = []string{"https://pitot.example.com", "https://pitot.example.com"} rec := httptest.NewRecorder() s.e.ServeHTTP(rec, r) if rec.Code != http.StatusForbidden { @@ -68,23 +68,23 @@ func TestMCPOriginValidation(t *testing.T) { origins []string want bool }{ - {"absent", "https://fanout.example.com", "internal:7520", nil, true}, - {"https default port", "https://fanout.example.com:443", "internal:7520", []string{"https://fanout.example.com"}, true}, - {"http default port", "http://fanout.example.com:80", "internal:7520", []string{"http://fanout.example.com"}, true}, - {"uppercase configuration", "HTTPS://FANOUT.example.com:443", "internal:7520", []string{"https://fanout.example.com"}, true}, - {"trailing slash configuration", "https://fanout.example.com/", "internal:7520", []string{"https://fanout.example.com"}, true}, - {"path configuration", "https://fanout.example.com/path/", "internal:7520", []string{"https://fanout.example.com"}, true}, - {"non-default port", "https://fanout.example.com:8443/path", "internal:7520", []string{"https://fanout.example.com:8443"}, true}, - {"non-default port required", "https://fanout.example.com:8443", "internal:7520", []string{"https://fanout.example.com"}, false}, + {"absent", "https://pitot.example.com", "internal:7520", nil, true}, + {"https default port", "https://pitot.example.com:443", "internal:7520", []string{"https://pitot.example.com"}, true}, + {"http default port", "http://pitot.example.com:80", "internal:7520", []string{"http://pitot.example.com"}, true}, + {"uppercase configuration", "HTTPS://PITOT.example.com:443", "internal:7520", []string{"https://pitot.example.com"}, true}, + {"trailing slash configuration", "https://pitot.example.com/", "internal:7520", []string{"https://pitot.example.com"}, true}, + {"path configuration", "https://pitot.example.com/path/", "internal:7520", []string{"https://pitot.example.com"}, true}, + {"non-default port", "https://pitot.example.com:8443/path", "internal:7520", []string{"https://pitot.example.com:8443"}, true}, + {"non-default port required", "https://pitot.example.com:8443", "internal:7520", []string{"https://pitot.example.com"}, false}, {"IPv6 default port", "https://[::1]:443/path", "internal:7520", []string{"https://[::1]"}, true}, {"IPv6 non-default port", "https://[::1]:8443/path", "internal:7520", []string{"https://[::1]:8443"}, true}, - {"request must be serialized", "https://fanout.example.com", "internal:7520", []string{"https://FANOUT.example.com"}, false}, - {"explicit default request port", "https://fanout.example.com", "internal:7520", []string{"https://fanout.example.com:443"}, false}, - {"scheme mismatch", "https://fanout.example.com", "fanout.example.com", []string{"http://fanout.example.com"}, false}, - {"untrusted", "https://fanout.example.com", "attacker.example", []string{"https://attacker.example"}, false}, - {"empty", "https://fanout.example.com", "internal:7520", []string{""}, false}, - {"two values", "https://fanout.example.com", "internal:7520", []string{"https://fanout.example.com", "https://attacker.example"}, false}, - {"two identical values", "https://fanout.example.com", "internal:7520", []string{"https://fanout.example.com", "https://fanout.example.com"}, false}, + {"request must be serialized", "https://pitot.example.com", "internal:7520", []string{"https://PITOT.example.com"}, false}, + {"explicit default request port", "https://pitot.example.com", "internal:7520", []string{"https://pitot.example.com:443"}, false}, + {"scheme mismatch", "https://pitot.example.com", "pitot.example.com", []string{"http://pitot.example.com"}, false}, + {"untrusted", "https://pitot.example.com", "attacker.example", []string{"https://attacker.example"}, false}, + {"empty", "https://pitot.example.com", "internal:7520", []string{""}, false}, + {"two values", "https://pitot.example.com", "internal:7520", []string{"https://pitot.example.com", "https://attacker.example"}, false}, + {"two identical values", "https://pitot.example.com", "internal:7520", []string{"https://pitot.example.com", "https://pitot.example.com"}, false}, {"local absent", "", "localhost:7520", nil, true}, {"localhost", "", "localhost:7520", []string{"http://localhost:7520"}, true}, {"local HTTPS", "", "LOCALHOST:7520", []string{"HTTPS://localhost:7520"}, true}, @@ -106,8 +106,8 @@ func TestMCPOriginValidation(t *testing.T) { } }) } - for _, publicURL := range []string{"https://fanout.example.com", ""} { - for _, origin := range []string{"null", "", "http://[broken", "https://user@fanout.example.com", "https://fanout.example.com/", "https://fanout.example.com/path", "https://fanout.example.com?", "https://fanout.example.com#", "https://fanout.example.com:99999", "https://fanout.example.com https://attacker.example", "http://localhost:7520/"} { + for _, publicURL := range []string{"https://pitot.example.com", ""} { + for _, origin := range []string{"null", "", "http://[broken", "https://user@pitot.example.com", "https://pitot.example.com/", "https://pitot.example.com/path", "https://pitot.example.com?", "https://pitot.example.com#", "https://pitot.example.com:99999", "https://pitot.example.com https://attacker.example", "http://localhost:7520/"} { r := httptest.NewRequest("POST", "/mcp", nil) r.Host = "localhost:7520" r.Header.Set("Origin", origin) diff --git a/internal/api/oauth.go b/internal/api/oauth.go index 1a5fe3b9e..a0c239853 100644 --- a/internal/api/oauth.go +++ b/internal/api/oauth.go @@ -20,17 +20,17 @@ import ( "time" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/dashboard" + "github.com/labstack/pitot/internal/dashboard" - appauth "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/brand" - appmcp "github.com/labstack/fanout/internal/mcp" + appauth "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/brand" + appmcp "github.com/labstack/pitot/internal/mcp" mcpgoauth "github.com/modelcontextprotocol/go-sdk/auth" ) const mcpReadScope = appauth.MCPScopeTelemetryRead -const browserMCPSessionBearer = "fanout-browser-session" +const browserMCPSessionBearer = "pitot-browser-session" type browserMCPUserContextKey struct{} @@ -67,8 +67,8 @@ func NewMCPAuthorization(store *appauth.OAuthStore, users *appauth.UserStore, re // Registration is unauthenticated by design (RFC 7591 dynamic // registration). Bound how many clients one source can create before // the janitor collects the abandoned ones. The budget is per client - // IP, which collapses to one bucket when Fanout sits behind a proxy - // and FANOUT_TRUSTED_PROXY_CIDRS is unset, so it is set well above a + // IP, which collapses to one bucket when Pitot sits behind a proxy + // and PITOT_TRUSTED_PROXY_CIDRS is unset, so it is set well above a // plausible team rollout rather than at the tightest defensible value. registerLimiter: appauth.NewKeyedLimiter(60, 15*time.Minute), }, nil @@ -267,7 +267,7 @@ func (h *MCPAuthorization) ProtectedResourceMetadata(c *echo.Context) error { setDiscoveryHeaders(c) return c.JSON(http.StatusOK, map[string]any{ "resource": h.resource, - "resource_name": "Fanout Observability", + "resource_name": "Pitot Observability", "authorization_servers": []string{h.issuer}, "scopes_supported": mcpSupportedScopes, "bearer_methods_supported": []string{"header"}, @@ -754,7 +754,7 @@ func oauthJSONError(c *echo.Context, status int, code, description string) error var oauthConsentTemplate = template.Must(template.New("oauth-consent").Parse(` -Authorize access · Fanout
` + brand.MarkSVG + `Fanout

Secure connection

Allow {{.ClientName}} to access Fanout?

+
` + brand.MarkSVG + `Pitot

Secure connection

Allow {{.ClientName}} to access Pitot?

{{if .ReadOnly}}This application is requesting read-only access to your observability data through MCP. It cannot change settings, alerts, or dashboards.{{else}}This application is requesting the access listed below through MCP.{{end}}

{{.ClientName}}Unverified client — this name was chosen by whoever registered itReturns to {{.Redirect}}Scopes: {{.Scope}}
{{range .Grants}}
✓
{{.Title}}

{{.Detail}}

diff --git a/internal/api/oauth_test.go b/internal/api/oauth_test.go index 81801d4b4..39e911e71 100644 --- a/internal/api/oauth_test.go +++ b/internal/api/oauth_test.go @@ -16,14 +16,14 @@ import ( "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" - appmcp "github.com/labstack/fanout/internal/mcp" - appstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" + appmcp "github.com/labstack/pitot/internal/mcp" + appstore "github.com/labstack/pitot/internal/store" mcpgoauth "github.com/modelcontextprotocol/go-sdk/auth" ) -const testMCPResource = "https://fanout.example.com/mcp" +const testMCPResource = "https://pitot.example.com/mcp" const testReadMCPCall = `{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_overview","arguments":{}}}` @@ -40,7 +40,7 @@ func newOAuthTestServerWithConfig(t *testing.T, cfg config.Config) (*echo.Echo, func newOAuthTestServerAndDB(t *testing.T, cfg config.Config) (*echo.Echo, *auth.UserStore, *auth.BrowserSessions, *appstore.SQLite) { t.Helper() if cfg.PublicURL == "" { - cfg.PublicURL = "https://fanout.example.com" + cfg.PublicURL = "https://pitot.example.com" } sqlite, err := appstore.NewSQLite(":memory:") if err != nil { @@ -126,7 +126,7 @@ func TestMCPOAuthDiscoveryAndAuthorizationCodeFlow(t *testing.T) { metadata := serve(t, e, http.MethodGet, "/.well-known/oauth-protected-resource/mcp", "", nil) if metadata.Code != http.StatusOK || !strings.Contains(metadata.Body.String(), testMCPResource) || - !strings.Contains(metadata.Body.String(), `"resource_name":"Fanout Observability"`) || + !strings.Contains(metadata.Body.String(), `"resource_name":"Pitot Observability"`) || !strings.Contains(metadata.Body.String(), `"scopes_supported":["telemetry:read","dashboard:manage"]`) { t.Fatalf("protected resource metadata = %d %s", metadata.Code, metadata.Body.String()) } @@ -168,7 +168,7 @@ func TestMCPOAuthDiscoveryAndAuthorizationCodeFlow(t *testing.T) { } cookie := oauthCookieForUser(t, e, user) consent := serve(t, e, http.MethodGet, "/api/auth/oauth/authorize?"+params.Encode(), "", nil, cookie) - if consent.Code != http.StatusOK || !strings.Contains(consent.Body.String(), "Allow Codex to access Fanout?") { + if consent.Code != http.StatusOK || !strings.Contains(consent.Body.String(), "Allow Codex to access Pitot?") { t.Fatalf("consent = %d %s", consent.Code, consent.Body.String()) } csp := consent.Header().Get("Content-Security-Policy") @@ -185,7 +185,7 @@ func TestMCPOAuthDiscoveryAndAuthorizationCodeFlow(t *testing.T) { } for _, brandElement := range []string{ `class="brand-mark"`, - `class="brand-name">Fanout`, + `class="brand-name">Pitot`, } { if !strings.Contains(consent.Body.String(), brandElement) { t.Fatalf("consent page is missing branded element %q: %s", brandElement, consent.Body.String()) @@ -201,7 +201,7 @@ func TestMCPOAuthDiscoveryAndAuthorizationCodeFlow(t *testing.T) { if err != nil { t.Fatalf("parse callback: %v", err) } - if callback.Query().Get("state") != "state-123" || callback.Query().Get("code") == "" || callback.Query().Get("iss") != "https://fanout.example.com" { + if callback.Query().Get("state") != "state-123" || callback.Query().Get("code") == "" || callback.Query().Get("iss") != "https://pitot.example.com" { t.Fatalf("callback = %s", callback) } @@ -252,7 +252,7 @@ func TestMCPOAuthRejectsUnknownBearerAndAdvertisesDiscovery(t *testing.T) { if rec.Code != http.StatusUnauthorized { t.Fatalf("MCP accepted unknown bearer: %d", rec.Code) } - want := `resource_metadata="https://fanout.example.com/.well-known/oauth-protected-resource/mcp"` + want := `resource_metadata="https://pitot.example.com/.well-known/oauth-protected-resource/mcp"` if !strings.Contains(rec.Header().Get("WWW-Authenticate"), want) { t.Fatalf("WWW-Authenticate = %q, want %s", rec.Header().Get("WWW-Authenticate"), want) } @@ -265,7 +265,7 @@ func TestBrowserMCPUsesSessionWithoutWeakeningRemoteMCP(t *testing.T) { t.Fatalf("Create user: %v", err) } - anonymous := serve(t, e, http.MethodPost, "/api/mcp", "", map[string]string{"Fanout-Request": "1"}) + anonymous := serve(t, e, http.MethodPost, "/api/mcp", "", map[string]string{"Pitot-Request": "1"}) if anonymous.Code != http.StatusUnauthorized { t.Fatalf("anonymous browser MCP = %d, want 401", anonymous.Code) } @@ -281,7 +281,7 @@ func TestBrowserMCPUsesSessionWithoutWeakeningRemoteMCP(t *testing.T) { browser := serve(t, e, http.MethodPost, "/api/mcp", `{"jsonrpc":"2.0","id":1,"method":"tools/list"}`, map[string]string{ "Authorization": "Bearer attacker-controlled", - "Fanout-Request": "1", + "Pitot-Request": "1", "MCP-Protocol-Version": appmcp.ProtocolVersion, "Mcp-Method": "tools/list", }, cookie) @@ -299,7 +299,7 @@ func TestBrowserMCPUsesSessionWithoutWeakeningRemoteMCP(t *testing.T) { t.Fatalf("browser MCP context exposed account role %q", role) } - remoteWithSessionOnly := serve(t, e, http.MethodPost, "/mcp", "", map[string]string{"Fanout-Request": "1"}, cookie) + remoteWithSessionOnly := serve(t, e, http.MethodPost, "/mcp", "", map[string]string{"Pitot-Request": "1"}, cookie) if remoteWithSessionOnly.Code != http.StatusUnauthorized { t.Fatalf("remote MCP accepted browser session: %d", remoteWithSessionOnly.Code) } @@ -403,7 +403,7 @@ var formHeaders = map[string]string{"Content-Type": "application/x-www-form-urle func oauthCookieForUser(t *testing.T, e *echo.Echo, user auth.User) *http.Cookie { t.Helper() - rec := serve(t, e, http.MethodPost, "/api/auth/setup", "", map[string]string{"X-Test-User": user.ID, "Fanout-Request": "1"}) + rec := serve(t, e, http.MethodPost, "/api/auth/setup", "", map[string]string{"X-Test-User": user.ID, "Pitot-Request": "1"}) if rec.Code != http.StatusNoContent { t.Fatalf("test login = %d %s", rec.Code, rec.Body.String()) } @@ -504,7 +504,7 @@ func decodeTokens(t *testing.T, rec *httptest.ResponseRecorder) map[string]any { // --- HTTP-layer negative-path and scope tests --------------------------------- func TestMCPOAuthScopePolicyRejectsRetiredNames(t *testing.T) { - legacy := "fanout:dashboard fanout:read fanout:dashboard" + legacy := "pitot:dashboard pitot:read pitot:dashboard" if validMCPScopes(strings.Fields(legacy)) { t.Fatal("retired scope aliases were accepted") } @@ -587,7 +587,7 @@ func TestMCPOAuthRetiredRefreshGrantsPromptReauthorizationAndRevokeFamily(t *tes } // Reproduce a persisted grant from before the scope rename, without // accepting retired names in any issuance or authorization path. - if _, err := s.db.DB.Exec(`UPDATE oauth_tokens SET scope = 'fanout:read' WHERE user_id = ?`, user.ID); err != nil { + if _, err := s.db.DB.Exec(`UPDATE oauth_tokens SET scope = 'pitot:read' WHERE user_id = ?`, user.ID); err != nil { t.Fatal(err) } form := url.Values{ @@ -650,7 +650,7 @@ func TestMCPOAuthConsentDenyRedirectsAccessDenied(t *testing.T) { if callback.Query().Get("state") != "state-xyz" { t.Fatalf("deny callback dropped state: %s", callback) } - if callback.Query().Get("iss") != "https://fanout.example.com" { + if callback.Query().Get("iss") != "https://pitot.example.com" { t.Fatalf("deny callback issuer = %q", callback.Query().Get("iss")) } } @@ -770,7 +770,7 @@ func TestMCPOAuthOmittedScopeGrantsReadOnly(t *testing.T) { wwwAuthenticate := challenged.Header().Get("WWW-Authenticate") if !strings.Contains(wwwAuthenticate, `error="insufficient_scope"`) || !strings.Contains(wwwAuthenticate, `scope="telemetry:read dashboard:manage"`) || - !strings.Contains(wwwAuthenticate, `resource_metadata="https://fanout.example.com/.well-known/oauth-protected-resource/mcp"`) { + !strings.Contains(wwwAuthenticate, `resource_metadata="https://pitot.example.com/.well-known/oauth-protected-resource/mcp"`) { t.Fatalf("dashboard step-up challenge = %q", wwwAuthenticate) } } @@ -816,15 +816,15 @@ func TestMCPOAuthConsentShowsDashboardWriteGrant(t *testing.T) { func serve(t *testing.T, e *echo.Echo, method, target, body string, headers map[string]string, cookies ...*http.Cookie) *httptest.ResponseRecorder { t.Helper() req := httptest.NewRequest(method, target, strings.NewReader(body)) - req.Host = "fanout.example.com" + req.Host = "pitot.example.com" for name, value := range headers { req.Header.Set(name, value) } for _, cookie := range cookies { req.AddCookie(cookie) } - if len(cookies) > 0 && isUnsafeMethod(method) && req.Header.Get("Fanout-Request") == "" { - req.Header.Set("Fanout-Request", "1") + if len(cookies) > 0 && isUnsafeMethod(method) && req.Header.Get("Pitot-Request") == "" { + req.Header.Set("Pitot-Request", "1") } rec := httptest.NewRecorder() e.ServeHTTP(rec, req) @@ -894,7 +894,7 @@ func TestOAuthConnectionsRequireBrowserSession(t *testing.T) { 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") + req.Header.Set("Pitot-Request", "1") if credential != "anonymous" { req.Header.Set("Authorization", "Bearer "+pair.AccessToken) } @@ -957,7 +957,7 @@ func TestOAuthConnectionsAreOwnAccountOnlyForEveryRole(t *testing.T) { 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) + rec := serve(t, s.e, http.MethodPost, "/api/auth/oauth/connections/"+clientID+"/revoke", "", map[string]string{"Pitot-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()) } @@ -969,7 +969,7 @@ func TestOAuthConnectionsAreOwnAccountOnlyForEveryRole(t *testing.T) { 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) + revoked := serve(t, s.e, http.MethodPost, "/api/auth/oauth/connections/"+ownClient.ClientID+"/revoke", "", map[string]string{"Pitot-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()) } diff --git a/internal/api/oidc.go b/internal/api/oidc.go index b72c31462..214b933cf 100644 --- a/internal/api/oidc.go +++ b/internal/api/oidc.go @@ -21,8 +21,8 @@ import ( "github.com/labstack/echo/v5" "golang.org/x/oauth2" - appauth "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" + appauth "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" ) const oidcFlowTTL = 10 * time.Minute diff --git a/internal/api/oidc_discovery_test.go b/internal/api/oidc_discovery_test.go index bf95b4151..ce8035f2f 100644 --- a/internal/api/oidc_discovery_test.go +++ b/internal/api/oidc_discovery_test.go @@ -20,10 +20,10 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/labstack/echo/v5" - appauth "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - appstore "github.com/labstack/fanout/internal/store" + appauth "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + appstore "github.com/labstack/pitot/internal/store" ) var fastOIDCDiscovery = oidcDiscoveryTiming{attempt: 5 * time.Second, initial: 5 * time.Millisecond, max: 20 * time.Millisecond} @@ -86,8 +86,8 @@ func newOIDCDiscoveryFixture(t *testing.T, issuer string) *oidcDiscoveryFixture f := &oidcDiscoveryFixture{ echo: echo.New(), cfg: config.Config{ - AuthMode: "oidc", OIDCIssuerURL: issuer, OIDCClientID: "fanout-client", OIDCClientSecret: "client-secret", - PublicURL: "https://fanout.example.com", OIDCEmailVerification: "required", OIDCDefaultRole: "viewer", + AuthMode: "oidc", OIDCIssuerURL: issuer, OIDCClientID: "pitot-client", OIDCClientSecret: "client-secret", + PublicURL: "https://pitot.example.com", OIDCEmailVerification: "required", OIDCDefaultRole: "viewer", DataDir: os.TempDir(), }, users: appauth.NewUserStore(db.DB), diff --git a/internal/api/oidc_test.go b/internal/api/oidc_test.go index 90a2bf311..03497365f 100644 --- a/internal/api/oidc_test.go +++ b/internal/api/oidc_test.go @@ -17,18 +17,18 @@ import ( "github.com/golang-jwt/jwt/v5" "github.com/labstack/echo/v5" - appauth "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" - appstore "github.com/labstack/fanout/internal/store" + appauth "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" + appstore "github.com/labstack/pitot/internal/store" ) func TestOIDCProvisionPolicy(t *testing.T) { h := &OIDCHandler{cfg: config.Config{ - OIDCAllowedGroups: "fanout-users, sre", + OIDCAllowedGroups: "pitot-users, sre", OIDCAllowedDomains: "example.com", OIDCDefaultRole: "viewer", OIDCOperatorGroups: "operators", - OIDCAdminGroups: "fanout-admins", + OIDCAdminGroups: "pitot-admins", }} if !h.provisionAllowed("person@other.test", []string{"SRE"}) { t.Fatal("allowed group was rejected") @@ -39,7 +39,7 @@ func TestOIDCProvisionPolicy(t *testing.T) { if h.provisionAllowed("person@other.test", []string{"unrelated"}) { t.Fatal("unknown identity was provisioned") } - if role := h.provisionRole([]string{"fanout-admins"}); role != "admin" { + if role := h.provisionRole([]string{"pitot-admins"}); role != "admin" { t.Fatalf("admin group role = %q", role) } if role := h.provisionRole([]string{"operators"}); role != "operator" { @@ -164,7 +164,7 @@ func TestOIDCFlowValidatesPKCENonceAndCreatesSession(t *testing.T) { digest := sha256.Sum256([]byte(verifier)) pkceVerified = verifier != "" && base64.RawURLEncoding.EncodeToString(digest[:]) == expectedChallenge claims := jwt.MapClaims{ - "iss": issuer, "sub": "subject-1", "aud": "fanout-client", + "iss": issuer, "sub": "subject-1", "aud": "pitot-client", "exp": time.Now().Add(time.Minute).Unix(), "iat": time.Now().Add(-time.Second).Unix(), "nonce": issuedNonce, "email": "admin@example.com", "email_verified": true, } @@ -201,8 +201,8 @@ func TestOIDCFlowValidatesPKCENonceAndCreatesSession(t *testing.T) { e := echo.New() e.Use(echo.WrapMiddleware(sessions.Middleware)) cfg := config.Config{ - AuthMode: "oidc", OIDCIssuerURL: issuer, OIDCClientID: "fanout-client", OIDCClientSecret: "client-secret", - PublicURL: "https://fanout.example.com", OIDCEmailVerification: "required", OIDCDefaultRole: "viewer", + AuthMode: "oidc", OIDCIssuerURL: issuer, OIDCClientID: "pitot-client", OIDCClientSecret: "client-secret", + PublicURL: "https://pitot.example.com", OIDCEmailVerification: "required", OIDCDefaultRole: "viewer", } if _, err := RegisterOIDCRoutes(context.Background(), e, cfg, users, identities, sessions, appauth.NewAuditStore(db.DB)); err != nil { t.Fatalf("RegisterOIDCRoutes: %v", err) @@ -304,7 +304,7 @@ func runRejectedOIDCCallback(t *testing.T, mutate func(jwt.MapClaims), badKey, k }}}) case "/token": claims := jwt.MapClaims{ - "iss": issuer, "sub": "rejected-subject", "aud": "fanout-client", + "iss": issuer, "sub": "rejected-subject", "aud": "pitot-client", "exp": time.Now().Add(time.Minute).Unix(), "iat": time.Now().Add(-time.Second).Unix(), "nonce": issuedNonce, "email": "candidate@example.com", "email_verified": true, } @@ -350,8 +350,8 @@ func runRejectedOIDCCallback(t *testing.T, mutate func(jwt.MapClaims), badKey, k e := echo.New() e.Use(echo.WrapMiddleware(sessions.Middleware)) cfg := config.Config{ - AuthMode: "oidc", OIDCIssuerURL: issuer, OIDCClientID: "fanout-client", OIDCClientSecret: "client-secret", - PublicURL: "https://fanout.example.com", OIDCEmailVerification: "required", OIDCDefaultRole: "viewer", + AuthMode: "oidc", OIDCIssuerURL: issuer, OIDCClientID: "pitot-client", OIDCClientSecret: "client-secret", + PublicURL: "https://pitot.example.com", OIDCEmailVerification: "required", OIDCDefaultRole: "viewer", OIDCAutoProvision: false, } if _, err := RegisterOIDCRoutes(context.Background(), e, cfg, users, appauth.NewIdentityStore(db.DB), sessions, appauth.NewAuditStore(db.DB)); err != nil { @@ -498,10 +498,10 @@ func TestResolveUserDowngradesRoleWhenIdPAdminGroupRemoved(t *testing.T) { cfg := config.Config{ OIDCEmailVerification: "required", OIDCAllowedGroups: "trusted", - OIDCAdminGroups: "fanout-admins", + OIDCAdminGroups: "pitot-admins", OIDCDefaultRole: "viewer", } - handler, users, user := linkedOIDCFixture(t, cfg, "admin", []string{"trusted", "fanout-admins"}) + handler, users, user := linkedOIDCFixture(t, cfg, "admin", []string{"trusted", "pitot-admins"}) // A second admin keeps the last-active-admin invariant from blocking the downgrade. if _, err := users.CreateWithAudit("other-admin@example.com", "", "admin", appauth.AuditEvent{EventType: "user.created", Outcome: "success"}); err != nil { t.Fatal(err) @@ -532,10 +532,10 @@ func TestResolveUserDeniesGroupOverageWhenGroupPolicyConfigured(t *testing.T) { cfg := config.Config{ OIDCEmailVerification: "required", OIDCAllowedGroups: "trusted", - OIDCAdminGroups: "fanout-admins", + OIDCAdminGroups: "pitot-admins", OIDCDefaultRole: "viewer", } - handler, users, user := linkedOIDCFixture(t, cfg, "admin", []string{"trusted", "fanout-admins"}) + handler, users, user := linkedOIDCFixture(t, cfg, "admin", []string{"trusted", "pitot-admins"}) if _, err := users.CreateWithAudit("other-admin@example.com", "", "admin", appauth.AuditEvent{EventType: "user.created", Outcome: "success"}); err != nil { t.Fatal(err) } @@ -624,10 +624,10 @@ func TestResolveUserSkipsRoleReconciliationForSuspendedUser(t *testing.T) { cfg := config.Config{ OIDCEmailVerification: "required", OIDCAllowedGroups: "trusted", - OIDCAdminGroups: "fanout-admins", + OIDCAdminGroups: "pitot-admins", OIDCDefaultRole: "viewer", } - handler, users, user := linkedOIDCFixture(t, cfg, "admin", []string{"trusted", "fanout-admins"}) + handler, users, user := linkedOIDCFixture(t, cfg, "admin", []string{"trusted", "pitot-admins"}) if _, err := users.CreateWithAudit("other-admin@example.com", "", "admin", appauth.AuditEvent{EventType: "user.created", Outcome: "success"}); err != nil { t.Fatal(err) } @@ -694,7 +694,7 @@ func TestResolveUserReconcilesRoleOnTheLinkingLogin(t *testing.T) { cfg: config.Config{ OIDCEmailVerification: "required", OIDCAllowedDomains: "example.com", - OIDCAdminGroups: "fanout-admins", + OIDCAdminGroups: "pitot-admins", OIDCDefaultRole: "viewer", }, users: users, identities: identities, audit: appauth.NewAuditStore(db.DB), @@ -764,7 +764,7 @@ func TestReconciledRoleChangeIsAttributableToItsSource(t *testing.T) { cfg: config.Config{ OIDCEmailVerification: "required", OIDCAllowedGroups: "trusted", - OIDCAdminGroups: "fanout-admins", + OIDCAdminGroups: "pitot-admins", OIDCDefaultRole: "viewer", }, users: users, identities: identities, audit: appauth.NewAuditStore(db.DB), diff --git a/internal/api/presentation_test.go b/internal/api/presentation_test.go index 3fd61e0a6..39fc3d5ea 100644 --- a/internal/api/presentation_test.go +++ b/internal/api/presentation_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) func TestHTTPProblemMessagesAndHintsUseAuthorPresentation(t *testing.T) { diff --git a/internal/api/queries.go b/internal/api/queries.go index 9d7ef8bfc..b6d3ba5ce 100644 --- a/internal/api/queries.go +++ b/internal/api/queries.go @@ -10,7 +10,7 @@ import ( "time" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) type QueryEngine interface { diff --git a/internal/api/queries_test.go b/internal/api/queries_test.go index 38d9a3f2e..be9fa5d13 100644 --- a/internal/api/queries_test.go +++ b/internal/api/queries_test.go @@ -5,12 +5,12 @@ import ( "encoding/json" "errors" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "net/http" "net/http/httptest" "os" @@ -18,7 +18,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) type fakePanels struct { diff --git a/internal/api/query_request_errors_test.go b/internal/api/query_request_errors_test.go index f63faf49e..65ed2e2ed 100644 --- a/internal/api/query_request_errors_test.go +++ b/internal/api/query_request_errors_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) type failedExemplars struct { diff --git a/internal/api/schema_busy_test.go b/internal/api/schema_busy_test.go index c48f4b0da..72161b545 100644 --- a/internal/api/schema_busy_test.go +++ b/internal/api/schema_busy_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) type busySchema struct{ fakePanels } diff --git a/internal/api/scim.go b/internal/api/scim.go index d081ffc8f..a81e92384 100644 --- a/internal/api/scim.go +++ b/internal/api/scim.go @@ -16,8 +16,8 @@ import ( "github.com/labstack/echo/v5" - appauth "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" + appauth "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" ) const ( diff --git a/internal/api/scim_test.go b/internal/api/scim_test.go index 21ff562e8..95eff85c9 100644 --- a/internal/api/scim_test.go +++ b/internal/api/scim_test.go @@ -17,9 +17,9 @@ import ( "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" - appstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" + appstore "github.com/labstack/pitot/internal/store" ) const ( @@ -28,7 +28,7 @@ const ( ) func scimTestConfig() config.Config { - return config.Config{AuthMode: "oidc", OIDCIssuerURL: testSCIMIssuer, PublicURL: "https://fanout.example.com", SCIMToken: testSCIMToken} + return config.Config{AuthMode: "oidc", OIDCIssuerURL: testSCIMIssuer, PublicURL: "https://pitot.example.com", SCIMToken: testSCIMToken} } type scimServer struct { @@ -130,7 +130,7 @@ func TestSCIMCreateLinksIdentityAndRetrySucceeds(t *testing.T) { if created.ExternalID != "sub-opaque" || created.UserName != "owner@example.com" || !created.Active || created.Roles[0].Value != "admin" { t.Fatalf("created = %+v", created) } - wantLocation := "https://fanout.example.com/scim/v2/Users/" + created.ID + wantLocation := "https://pitot.example.com/scim/v2/Users/" + created.ID if rec.Header().Get("Location") != wantLocation || created.Meta.Location != wantLocation || created.Meta.ResourceType != "User" { t.Fatalf("location header %q meta %+v", rec.Header().Get("Location"), created.Meta) } @@ -731,7 +731,7 @@ func TestBrowserSuspensionRevokesMCPTokens(t *testing.T) { setStatus := func(status string) { t.Helper() - headers := map[string]string{"Content-Type": "application/json", "Fanout-Request": "1"} + headers := map[string]string{"Content-Type": "application/json", "Pitot-Request": "1"} rec := serve(t, s.e, http.MethodPatch, "/api/users/"+member.ID+"/status", `{"status":"`+status+`"}`, headers, ownerCookie) if rec.Code != http.StatusOK { t.Fatalf("set status %s = %d %s", status, rec.Code, rec.Body.String()) @@ -755,7 +755,7 @@ func TestReactivationRevokesCredentialsThatOutlivedSuspension(t *testing.T) { }{ {"browser route", func(t *testing.T, s *scimServer, member auth.User, ownerCookie *http.Cookie) { t.Helper() - headers := map[string]string{"Content-Type": "application/json", "Fanout-Request": "1"} + headers := map[string]string{"Content-Type": "application/json", "Pitot-Request": "1"} rec := serve(t, s.e, http.MethodPatch, "/api/users/"+member.ID+"/status", `{"status":"active"}`, headers, ownerCookie) if rec.Code != http.StatusOK { t.Fatalf("reactivate = %d %s", rec.Code, rec.Body.String()) diff --git a/internal/api/session_middleware_test.go b/internal/api/session_middleware_test.go index 57eb86453..6cad7fb3b 100644 --- a/internal/api/session_middleware_test.go +++ b/internal/api/session_middleware_test.go @@ -8,9 +8,9 @@ import ( "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" - appstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" + appstore "github.com/labstack/pitot/internal/store" ) func authenticatedSessionCookie(t *testing.T, sessions *auth.BrowserSessions, user auth.User) *http.Cookie { @@ -54,16 +54,16 @@ func TestSessionMiddlewareCSRFAndMetricsCredential(t *testing.T) { recorder := httptest.NewRecorder() e.ServeHTTP(recorder, withoutHeader) if recorder.Code != http.StatusForbidden { - t.Fatalf("session mutation without Fanout header = %d, want 403", recorder.Code) + t.Fatalf("session mutation without Pitot header = %d, want 403", recorder.Code) } withHeader := httptest.NewRequest(http.MethodPost, "/api/alerting/rules", nil) withHeader.AddCookie(cookie) - withHeader.Header.Set("Fanout-Request", "1") + withHeader.Header.Set("Pitot-Request", "1") recorder = httptest.NewRecorder() e.ServeHTTP(recorder, withHeader) if recorder.Code != http.StatusNoContent { - t.Fatalf("session mutation with Fanout header = %d, want 204", recorder.Code) + t.Fatalf("session mutation with Pitot header = %d, want 204", recorder.Code) } metrics := httptest.NewRequest(http.MethodGet, "/metrics", nil) diff --git a/internal/api/settings.go b/internal/api/settings.go index ac4895e37..f8a0b7133 100644 --- a/internal/api/settings.go +++ b/internal/api/settings.go @@ -10,8 +10,8 @@ import ( "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/settings" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/settings" ) type SettingsHandler struct { diff --git a/internal/api/settings_test.go b/internal/api/settings_test.go index ccb7e2a5f..bd3bf3550 100644 --- a/internal/api/settings_test.go +++ b/internal/api/settings_test.go @@ -9,9 +9,9 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/settings" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/settings" ) func newConfigServer(t *testing.T, cfg config.Config) (*testAuthServer, *settings.Store) { @@ -40,7 +40,7 @@ func createTokenRequest(t *testing.T, s *testAuthServer, cookie *http.Cookie, na } req := sessionRequest(http.MethodPost, "/api/settings/ingest/tokens", strings.NewReader(string(body)), cookie) req.Header.Set("Content-Type", "application/json") - req.Host = "fanout.example.com:7520" + req.Host = "pitot.example.com:7520" rec := httptest.NewRecorder() s.e.ServeHTTP(rec, req) return rec @@ -81,7 +81,7 @@ func TestGetIngest_EmptyBeforeSetup(t *testing.T) { admin, _ := s.users.CreateWithAudit("admin@example.com", "", "admin", auth.AuditEvent{EventType: "user.created", Outcome: "success"}) cookie := s.login(t, admin) req := sessionRequest(http.MethodGet, "/api/settings/ingest", nil, cookie) - req.Host = "fanout.example.com:7520" + req.Host = "pitot.example.com:7520" rec := httptest.NewRecorder() s.e.ServeHTTP(rec, req) if rec.Code != http.StatusOK { @@ -91,7 +91,7 @@ func TestGetIngest_EmptyBeforeSetup(t *testing.T) { if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil { t.Fatalf("Unmarshal: %v", err) } - if resp.TokenRequired || resp.SuggestedEndpoint != "http://fanout.example.com:7520" || resp.HeaderName != "Authorization" { + if resp.TokenRequired || resp.SuggestedEndpoint != "http://pitot.example.com:7520" || resp.HeaderName != "Authorization" { t.Fatalf("response = %+v", resp) } } @@ -250,9 +250,9 @@ func TestSuggestedIngestEndpoint(t *testing.T) { host string want string }{ - {"public origin", config.Config{Addr: ":7520", PublicURL: "https://fanout.example.com/"}, "internal:7520", "https://fanout.example.com"}, + {"public origin", config.Config{Addr: ":7520", PublicURL: "https://pitot.example.com/"}, "internal:7520", "https://pitot.example.com"}, {"request port", config.Config{Addr: ":7520"}, "localhost:8080", "http://localhost:8080"}, - {"direct TLS", config.Config{TLSCertFile: "cert", TLSKeyFile: "key"}, "fanout.example.com:8443", "https://fanout.example.com:8443"}, + {"direct TLS", config.Config{TLSCertFile: "cert", TLSKeyFile: "key"}, "pitot.example.com:8443", "https://pitot.example.com:8443"}, {"IPv6", config.Config{}, "[2001:db8::1]:7520", "http://[2001:db8::1]:7520"}, {"missing host", config.Config{Addr: ":8080"}, "", "http://localhost:8080"}, {"loopback bind", config.Config{Addr: "127.0.0.1:8080"}, "", "http://127.0.0.1:8080"}, diff --git a/internal/api/shared_listener_test.go b/internal/api/shared_listener_test.go index 9c2cdadc7..8701d11bf 100644 --- a/internal/api/shared_listener_test.go +++ b/internal/api/shared_listener_test.go @@ -2,16 +2,16 @@ package api import ( "context" - "github.com/labstack/fanout/internal/auth" + "github.com/labstack/pitot/internal/auth" "net/http/httptest" "strings" "testing" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/ingest" - httpserver "github.com/labstack/fanout/internal/server" - "github.com/labstack/fanout/internal/settings" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/ingest" + httpserver "github.com/labstack/pitot/internal/server" + "github.com/labstack/pitot/internal/settings" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "google.golang.org/grpc" ) diff --git a/internal/api/traces.go b/internal/api/traces.go index afc6324da..5b13ebce7 100644 --- a/internal/api/traces.go +++ b/internal/api/traces.go @@ -4,8 +4,8 @@ import ( "context" "errors" "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/query" "net/http" "strconv" "strings" diff --git a/internal/api/traces_test.go b/internal/api/traces_test.go index d1e2147a4..108d3db9c 100644 --- a/internal/api/traces_test.go +++ b/internal/api/traces_test.go @@ -3,9 +3,9 @@ package api import ( "context" "errors" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/query" "net/http" "net/http/httptest" "testing" diff --git a/internal/api/users.go b/internal/api/users.go index b0c86a973..a64b327b8 100644 --- a/internal/api/users.go +++ b/internal/api/users.go @@ -8,8 +8,8 @@ import ( "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" ) // UserHandler handles admin user management endpoints. @@ -112,7 +112,7 @@ func (h *UserHandler) ListUsers(c *echo.Context) error { // CreateUser adds a new user (admin only). func (h *UserHandler) CreateUser(c *echo.Context) error { if h.ownership != accountOwnershipLocal { - return ownedByIdentityProvider("Accounts cannot be created in Fanout when roles come from the identity provider.") + return ownedByIdentityProvider("Accounts cannot be created in Pitot when roles come from the identity provider.") } var req struct { Email string `json:"email"` @@ -180,7 +180,7 @@ func (h *UserHandler) UpdateUser(c *echo.Context) error { return err } if req.Email != nil && h.ownership == accountOwnershipDirectory { - return ownedByIdentityProvider("Email addresses are managed by the identity provider, not in Fanout.") + return ownedByIdentityProvider("Email addresses are managed by the identity provider, not in Pitot.") } if req.Email != nil { email, err := auth.NormalizeEmail(*req.Email) @@ -195,7 +195,7 @@ func (h *UserHandler) UpdateUser(c *echo.Context) error { // UpdateRole modifies a user's role (admin only). func (h *UserHandler) UpdateRole(c *echo.Context) error { if h.ownership != accountOwnershipLocal { - return ownedByIdentityProvider("Roles are assigned by the identity provider, not in Fanout.") + return ownedByIdentityProvider("Roles are assigned by the identity provider, not in Pitot.") } var req struct { Role string `json:"role"` @@ -213,7 +213,7 @@ func (h *UserHandler) UpdateRole(c *echo.Context) error { // UpdateStatus modifies a user's status (admin only). func (h *UserHandler) UpdateStatus(c *echo.Context) error { if h.ownership == accountOwnershipDirectory { - return ownedByIdentityProvider("Account status is managed by the identity provider, not in Fanout.") + return ownedByIdentityProvider("Account status is managed by the identity provider, not in Pitot.") } var req struct { Status string `json:"status"` @@ -254,7 +254,7 @@ func (h *UserHandler) updateUser(c *echo.Context, email, displayName *string, ro // DeleteUser removes a user (admin only). func (h *UserHandler) DeleteUser(c *echo.Context) error { if h.ownership == accountOwnershipDirectory { - return ownedByIdentityProvider("Accounts are deactivated by the identity provider, not deleted in Fanout.") + return ownedByIdentityProvider("Accounts are deactivated by the identity provider, not deleted in Pitot.") } id := c.Param("id") if err := h.users.DeleteWithAudit(id, userAuditEvent(c, "user.deleted")); err != nil { diff --git a/internal/api/users_test.go b/internal/api/users_test.go index db8f62361..2e8c2f2ae 100644 --- a/internal/api/users_test.go +++ b/internal/api/users_test.go @@ -9,8 +9,8 @@ import ( "github.com/labstack/echo/v5" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/config" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/config" ) func registerTestUserRoutes(s *testAuthServer) { diff --git a/internal/auth/alert_mail.go b/internal/auth/alert_mail.go index d37e540e6..07e337523 100644 --- a/internal/auth/alert_mail.go +++ b/internal/auth/alert_mail.go @@ -85,7 +85,7 @@ func SendAlert(ctx context.Context, cfg SMTPConfig, alert AlertMail) error { if err != nil { return fmt.Errorf("%w: %w", ErrInvalidMailAddress, err) } - message.SetMessageIDWithValue(alert.ID + "@alerts.fanout") + message.SetMessageIDWithValue(alert.ID + "@alerts.pitot") return deliver(ctx, cfg, message) } @@ -147,7 +147,7 @@ func renderAlertMail(alert AlertMail) (subject, text, html string, err error) { Time: alert.Time.UTC().Format(time.RFC1123), LimitNotice: singleLine(alert.LimitNotice, maxAlertDescriptionLength), } - subject = fmt.Sprintf("[Fanout] %s: %s on %s", data.Label, data.Rule, data.Service) + subject = fmt.Sprintf("[Pitot] %s: %s on %s", data.Label, data.Rule, data.Service) data.Preheader = subject var body strings.Builder diff --git a/internal/auth/alert_mail_test.go b/internal/auth/alert_mail_test.go index e5ea06940..a719a3be7 100644 --- a/internal/auth/alert_mail_test.go +++ b/internal/auth/alert_mail_test.go @@ -47,7 +47,7 @@ func startFakeSMTP(t *testing.T, rcptReply string) (*fakeSMTP, SMTPConfig) { go server.serve(conn) } }() - return server, SMTPConfig{Host: "127.0.0.1", Port: listener.Addr().(*net.TCPAddr).Port, User: "user", Pass: "pass", From: "Fanout "} + return server, SMTPConfig{Host: "127.0.0.1", Port: listener.Addr().(*net.TCPAddr).Port, User: "user", Pass: "pass", From: "Pitot "} } func (s *fakeSMTP) serve(conn net.Conn) { @@ -198,13 +198,13 @@ func TestSendAlertKeepsHostileValuesOutOfHeadersAndMarkup(t *testing.T) { if err != nil { t.Fatal(err) } - if !strings.HasPrefix(subject, "[Fanout] Firing: High errors X-Injected: yes on api Bcc:") { + if !strings.HasPrefix(subject, "[Pitot] Firing: High errors X-Injected: yes on api Bcc:") { t.Fatalf("subject = %q", subject) } if strings.ContainsAny(subject, "\r\n\u2028\u202e") { t.Fatalf("subject holds control characters: %q", subject) } - if got := message.Header.Get("Message-Id"); got != "<0190-delivery@alerts.fanout>" { + if got := message.Header.Get("Message-Id"); got != "<0190-delivery@alerts.pitot>" { t.Fatalf("message id = %q", got) } diff --git a/internal/auth/audit.go b/internal/auth/audit.go index 13571b512..8fe504f93 100644 --- a/internal/auth/audit.go +++ b/internal/auth/audit.go @@ -7,8 +7,8 @@ import ( "fmt" "time" - appid "github.com/labstack/fanout/internal/id" - appmetrics "github.com/labstack/fanout/internal/metrics" + appid "github.com/labstack/pitot/internal/id" + appmetrics "github.com/labstack/pitot/internal/metrics" ) type AuditEventType string diff --git a/internal/auth/code.go b/internal/auth/code.go index f34287bdd..a1a71ecd0 100644 --- a/internal/auth/code.go +++ b/internal/auth/code.go @@ -13,9 +13,9 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/db/generated" - appid "github.com/labstack/fanout/internal/id" - "github.com/labstack/fanout/internal/secret" + "github.com/labstack/pitot/internal/db/generated" + appid "github.com/labstack/pitot/internal/id" + "github.com/labstack/pitot/internal/secret" ) const ( @@ -24,16 +24,16 @@ const ( maxAttempts = 3 purposeEmailCode = "email_code" purposeLoginLink = "login_link" - // purposeBreakGlassLink marks a link minted by `fanout login-link + // purposeBreakGlassLink marks a link minted by `pitot login-link // --break-glass`. It is the only credential the OIDC-mode link route accepts, // and ordinary link verification never matches it. purposeBreakGlassLink = "break_glass_login_link" ) // ErrCodeSecretRequired reports a sign-in credential operation attempted -// without FANOUT_AUTH_CODE_SECRET. An empty HMAC key would make stored hashes +// without PITOT_AUTH_CODE_SECRET. An empty HMAC key would make stored hashes // computable from the credential alone. -var ErrCodeSecretRequired = errors.New("auth: FANOUT_AUTH_CODE_SECRET is required for sign-in credentials") +var ErrCodeSecretRequired = errors.New("auth: PITOT_AUTH_CODE_SECRET is required for sign-in credentials") // GenerateCode returns a random 6-digit code. func GenerateCode() (string, error) { diff --git a/internal/auth/code_test.go b/internal/auth/code_test.go index ee8e3ff41..c20282f41 100644 --- a/internal/auth/code_test.go +++ b/internal/auth/code_test.go @@ -8,9 +8,9 @@ import ( "testing" "time" - appstore "github.com/labstack/fanout/internal/store" + appstore "github.com/labstack/pitot/internal/store" - "github.com/labstack/fanout/internal/secret" + "github.com/labstack/pitot/internal/secret" ) func newTestCodeStore(t *testing.T) *CodeStore { diff --git a/internal/auth/identity_store.go b/internal/auth/identity_store.go index 8c22eff3f..7f22afd87 100644 --- a/internal/auth/identity_store.go +++ b/internal/auth/identity_store.go @@ -7,8 +7,8 @@ import ( "fmt" "time" - appid "github.com/labstack/fanout/internal/id" - appstore "github.com/labstack/fanout/internal/store" + appid "github.com/labstack/pitot/internal/id" + appstore "github.com/labstack/pitot/internal/store" ) type UserIdentity struct { diff --git a/internal/auth/oauth_scope.go b/internal/auth/oauth_scope.go index 318c3d5ee..6f5afafcc 100644 --- a/internal/auth/oauth_scope.go +++ b/internal/auth/oauth_scope.go @@ -3,7 +3,7 @@ package auth import "strings" const ( - // MCPScopeTelemetryRead grants read access to Fanout observability data. + // MCPScopeTelemetryRead grants read access to Pitot observability data. MCPScopeTelemetryRead = "telemetry:read" // MCPScopeDashboardManage grants access to manage the authenticated user's dashboards. MCPScopeDashboardManage = "dashboard:manage" diff --git a/internal/auth/oauth_scope_test.go b/internal/auth/oauth_scope_test.go index 100867d4f..0c29a6429 100644 --- a/internal/auth/oauth_scope_test.go +++ b/internal/auth/oauth_scope_test.go @@ -11,8 +11,8 @@ func TestCanonicalMCPOAuthScope(t *testing.T) { }{ {name: "read", raw: MCPScopeTelemetryRead, want: MCPScopeTelemetryRead, ok: true}, {name: "dashboard", raw: MCPScopeTelemetryRead + " " + MCPScopeDashboardManage, want: MCPScopeTelemetryRead + " " + MCPScopeDashboardManage, ok: true}, - {name: "legacy", raw: "fanout:dashboard" + " " + "fanout:read", ok: false}, - {name: "retired mixed grant rejected", raw: MCPScopeDashboardManage + " " + "fanout:read" + " " + MCPScopeDashboardManage, ok: false}, + {name: "legacy", raw: "pitot:dashboard" + " " + "pitot:read", ok: false}, + {name: "retired mixed grant rejected", raw: MCPScopeDashboardManage + " " + "pitot:read" + " " + MCPScopeDashboardManage, ok: false}, {name: "missing read", raw: MCPScopeDashboardManage, ok: false}, {name: "empty", raw: "", ok: false}, {name: "unknown", raw: MCPScopeTelemetryRead + " users:manage", ok: false}, @@ -40,7 +40,7 @@ func TestResolveMCPRefreshScope(t *testing.T) { {name: "omitted retains grant", granted: full, want: full, ok: true}, {name: "same grant", granted: full, requested: full, want: full, ok: true}, {name: "narrowed to read", granted: full, requested: MCPScopeTelemetryRead, want: MCPScopeTelemetryRead, ok: true}, - {name: "retired stored grant rejected", granted: "fanout:read" + " " + "fanout:dashboard", requested: "fanout:read", ok: false}, + {name: "retired stored grant rejected", granted: "pitot:read" + " " + "pitot:dashboard", requested: "pitot:read", ok: false}, {name: "cannot expand", granted: MCPScopeTelemetryRead, requested: full, ok: false}, {name: "unknown requested scope", granted: full, requested: "users:manage", ok: false}, {name: "invalid stored grant", granted: "users:manage", requested: MCPScopeTelemetryRead, ok: false}, diff --git a/internal/auth/oauth_store.go b/internal/auth/oauth_store.go index ec7f1c04f..42b015bdf 100644 --- a/internal/auth/oauth_store.go +++ b/internal/auth/oauth_store.go @@ -10,9 +10,9 @@ import ( "fmt" "time" - appid "github.com/labstack/fanout/internal/id" + appid "github.com/labstack/pitot/internal/id" - "github.com/labstack/fanout/internal/secret" + "github.com/labstack/pitot/internal/secret" ) const ( diff --git a/internal/auth/oauth_store_test.go b/internal/auth/oauth_store_test.go index 63de5c4d2..b0b1588e5 100644 --- a/internal/auth/oauth_store_test.go +++ b/internal/auth/oauth_store_test.go @@ -23,7 +23,7 @@ func TestOAuthStoreAuthorizationCodeIsSingleUse(t *testing.T) { raw, err := store.CreateAuthorizationCode(t.Context(), OAuthAuthorizationCode{ ClientID: client.ClientID, UserID: user.ID, RedirectURI: "http://localhost:4321/callback", Scope: MCPScopeTelemetryRead, - Resource: "https://fanout.example.com/mcp", CodeChallenge: "challenge", + Resource: "https://pitot.example.com/mcp", CodeChallenge: "challenge", }) if err != nil { t.Fatalf("CreateAuthorizationCode: %v", err) @@ -52,12 +52,12 @@ func TestOAuthStoreRejectsRetiredStoredGrants(t *testing.T) { if err != nil { t.Fatal(err) } - resource := "https://fanout.example.com/mcp" + resource := "https://pitot.example.com/mcp" pair, err := store.IssueTokenPair(t.Context(), client.ClientID, user.ID, MCPScopeTelemetryRead+" "+MCPScopeDashboardManage, resource) if err != nil { t.Fatal(err) } - legacy := "fanout:read fanout:dashboard" + legacy := "pitot:read pitot:dashboard" if _, err := sqlite.DB.Exec(`UPDATE oauth_tokens SET scope = ? WHERE family_id IN (SELECT family_id FROM oauth_tokens WHERE token_hash = ?)`, legacy, oauthHash(pair.AccessToken)); err != nil { t.Fatal(err) } @@ -88,7 +88,7 @@ func TestOAuthStoreRefreshRotationAndReuseRevokesFamily(t *testing.T) { if err != nil { t.Fatalf("RegisterClient: %v", err) } - resource := "https://fanout.example.com/mcp" + resource := "https://pitot.example.com/mcp" first, err := store.IssueTokenPair(t.Context(), client.ClientID, user.ID, MCPScopeTelemetryRead, resource) if err != nil { t.Fatalf("IssueTokenPair: %v", err) @@ -130,7 +130,7 @@ func TestOAuthStoreRefreshGraceAdmitsConcurrentSibling(t *testing.T) { if err != nil { t.Fatalf("RegisterClient: %v", err) } - resource := "https://fanout.example.com/mcp" + resource := "https://pitot.example.com/mcp" first, err := store.IssueTokenPair(t.Context(), client.ClientID, user.ID, MCPScopeTelemetryRead, resource) if err != nil { t.Fatalf("IssueTokenPair: %v", err) @@ -182,7 +182,7 @@ func TestOAuthStoreRefreshGraceRejectsFutureRotation(t *testing.T) { if err != nil { t.Fatalf("RegisterClient: %v", err) } - resource := "https://fanout.example.com/mcp" + resource := "https://pitot.example.com/mcp" first, err := store.IssueTokenPair(t.Context(), client.ClientID, user.ID, MCPScopeTelemetryRead, resource) if err != nil { t.Fatalf("IssueTokenPair: %v", err) @@ -217,7 +217,7 @@ func TestOAuthStoreRefreshGraceRevokesExpiredReplay(t *testing.T) { if err != nil { t.Fatalf("RegisterClient: %v", err) } - resource := "https://fanout.example.com/mcp" + resource := "https://pitot.example.com/mcp" first, err := store.IssueTokenPair(t.Context(), client.ClientID, user.ID, MCPScopeTelemetryRead, resource) if err != nil { t.Fatalf("IssueTokenPair: %v", err) @@ -253,7 +253,7 @@ func TestOAuthStoreRefreshGraceDoesNotReviveRevokedFamily(t *testing.T) { if err != nil { t.Fatalf("RegisterClient: %v", err) } - resource := "https://fanout.example.com/mcp" + resource := "https://pitot.example.com/mcp" first, err := store.IssueTokenPair(t.Context(), client.ClientID, user.ID, MCPScopeTelemetryRead, resource) if err != nil { t.Fatalf("IssueTokenPair: %v", err) @@ -281,7 +281,7 @@ func TestRevokeAllSessionsAlsoRevokesOAuthCredentials(t *testing.T) { if err != nil { t.Fatal(err) } - resource := "https://fanout.example.com/mcp" + resource := "https://pitot.example.com/mcp" pair, err := store.IssueTokenPair(t.Context(), client.ClientID, user.ID, MCPScopeTelemetryRead, resource) if err != nil { t.Fatal(err) @@ -319,7 +319,7 @@ func TestOAuthStoreRejectsWrongAudienceAndSuspendedRefresh(t *testing.T) { if err != nil { t.Fatalf("RegisterClient: %v", err) } - resource := "https://fanout.example.com/mcp" + resource := "https://pitot.example.com/mcp" pair, err := store.IssueTokenPair(t.Context(), client.ClientID, user.ID, MCPScopeTelemetryRead, resource) if err != nil { t.Fatalf("IssueTokenPair: %v", err) @@ -354,7 +354,7 @@ func TestOAuthStoreReuseDetectionRunsBeforeExpiryCheck(t *testing.T) { if err != nil { t.Fatalf("RegisterClient: %v", err) } - resource := "https://fanout.example.com/mcp" + resource := "https://pitot.example.com/mcp" first, err := store.IssueTokenPair(t.Context(), client.ClientID, user.ID, MCPScopeTelemetryRead, resource) if err != nil { t.Fatalf("IssueTokenPair: %v", err) @@ -390,7 +390,7 @@ func TestOAuthStoreRotateDBErrorDoesNotRevokeFamily(t *testing.T) { if err != nil { t.Fatalf("RegisterClient: %v", err) } - resource := "https://fanout.example.com/mcp" + resource := "https://pitot.example.com/mcp" pair, err := store.IssueTokenPair(t.Context(), client.ClientID, user.ID, MCPScopeTelemetryRead, resource) if err != nil { t.Fatalf("IssueTokenPair: %v", err) @@ -429,7 +429,7 @@ func TestOAuthStoreVerifyAccessTokenDBErrorIsNotInvalidToken(t *testing.T) { if err != nil { t.Fatalf("RegisterClient: %v", err) } - resource := "https://fanout.example.com/mcp" + resource := "https://pitot.example.com/mcp" pair, err := store.IssueTokenPair(t.Context(), client.ClientID, user.ID, MCPScopeTelemetryRead, resource) if err != nil { t.Fatalf("IssueTokenPair: %v", err) @@ -463,7 +463,7 @@ func TestOAuthStoreCleanupExpired(t *testing.T) { if err != nil { t.Fatalf("RegisterClient: %v", err) } - resource := "https://fanout.example.com/mcp" + resource := "https://pitot.example.com/mcp" if _, err := store.CreateAuthorizationCode(t.Context(), OAuthAuthorizationCode{ ClientID: client.ClientID, UserID: user.ID, RedirectURI: "http://localhost:5555/callback", Scope: MCPScopeTelemetryRead, Resource: resource, CodeChallenge: "challenge", @@ -529,7 +529,7 @@ func TestOAuthStoreCleanupKeepsLiveFamiliesAndActiveClients(t *testing.T) { if err != nil { t.Fatalf("RegisterClient: %v", err) } - resource := "https://fanout.example.com/mcp" + resource := "https://pitot.example.com/mcp" pair, err := store.IssueTokenPair(t.Context(), client.ClientID, user.ID, MCPScopeTelemetryRead, resource) if err != nil { t.Fatalf("IssueTokenPair: %v", err) @@ -576,7 +576,7 @@ func TestOAuthStoreExpiredCodeFails(t *testing.T) { client, _ := store.RegisterClient(t.Context(), "Client", "", []string{"http://localhost:1111/callback"}) raw, err := store.CreateAuthorizationCode(t.Context(), OAuthAuthorizationCode{ ClientID: client.ClientID, UserID: user.ID, RedirectURI: "http://localhost:1111/callback", - Scope: MCPScopeTelemetryRead, Resource: "https://fanout.example.com/mcp", CodeChallenge: "challenge", + Scope: MCPScopeTelemetryRead, Resource: "https://pitot.example.com/mcp", CodeChallenge: "challenge", }) if err != nil { t.Fatalf("CreateAuthorizationCode: %v", err) @@ -611,7 +611,7 @@ func TestOAuthConnectionsListLiveFamilies(t *testing.T) { } 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") + pair, err := store.IssueTokenPair(t.Context(), client.ClientID, owner.ID, MCPScopeTelemetryRead+" "+MCPScopeDashboardManage, "https://pitot.example.com/mcp") if err != nil { t.Fatal(err) } @@ -631,7 +631,7 @@ func TestOAuthConnectionsListLiveFamilies(t *testing.T) { 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 { + if _, err := store.RotateRefreshToken(t.Context(), client.ClientID, first.RefreshToken, "https://pitot.example.com/mcp", MCPScopeTelemetryRead); err != nil { t.Fatal(err) } expired := register("Expired") @@ -693,14 +693,14 @@ func TestOAuthConnectionRevocationIsScopedAndImmediate(t *testing.T) { } issue := func(clientID, userID string) OAuthTokenPair { t.Helper() - pair, err := store.IssueTokenPair(t.Context(), clientID, userID, MCPScopeTelemetryRead, "https://fanout.example.com/mcp") + pair, err := store.IssueTokenPair(t.Context(), clientID, userID, MCPScopeTelemetryRead, "https://pitot.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", "") + sibling, err := store.RotateRefreshToken(t.Context(), client.ClientID, pair.RefreshToken, "https://pitot.example.com/mcp", "") if err != nil { t.Fatal(err) } @@ -711,7 +711,7 @@ func TestOAuthConnectionRevocationIsScopedAndImmediate(t *testing.T) { 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", + Scope: MCPScopeTelemetryRead, Resource: "https://pitot.example.com/mcp", CodeChallenge: "challenge", }) if err != nil { t.Fatal(err) @@ -719,24 +719,24 @@ func TestOAuthConnectionRevocationIsScopedAndImmediate(t *testing.T) { 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 { + if _, err := store.VerifyAccessToken(t.Context(), pair.AccessToken, "https://pitot.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) { + if _, err := store.VerifyAccessToken(t.Context(), token, "https://pitot.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 { + if _, err := store.RotateRefreshToken(t.Context(), client.ClientID, token, "https://pitot.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 { + if _, err := store.VerifyAccessToken(t.Context(), token, "https://pitot.example.com/mcp"); err != nil { t.Fatalf("unrelated access = %v", err) } } @@ -777,7 +777,7 @@ func TestOAuthConnectionRevocationRollsBackWithAuditFailure(t *testing.T) { if err != nil { t.Fatal(err) } - pair, err := store.IssueTokenPair(t.Context(), client.ClientID, user.ID, MCPScopeTelemetryRead, "https://fanout.example.com/mcp") + pair, err := store.IssueTokenPair(t.Context(), client.ClientID, user.ID, MCPScopeTelemetryRead, "https://pitot.example.com/mcp") if err != nil { t.Fatal(err) } @@ -787,10 +787,10 @@ func TestOAuthConnectionRevocationRollsBackWithAuditFailure(t *testing.T) { 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 { + if _, err := store.VerifyAccessToken(t.Context(), pair.AccessToken, "https://pitot.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 { + if _, err := store.RotateRefreshToken(t.Context(), client.ClientID, pair.RefreshToken, "https://pitot.example.com/mcp", ""); err != nil { t.Fatalf("rolled-back refresh = %v", err) } } diff --git a/internal/auth/provisioning.go b/internal/auth/provisioning.go index 2c6a160d5..a160fc60a 100644 --- a/internal/auth/provisioning.go +++ b/internal/auth/provisioning.go @@ -6,9 +6,9 @@ import ( "fmt" "time" - "github.com/labstack/fanout/internal/db/generated" - appid "github.com/labstack/fanout/internal/id" - appstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/db/generated" + appid "github.com/labstack/pitot/internal/id" + appstore "github.com/labstack/pitot/internal/store" ) // ErrFirstUserMustBeAdmin refuses an account on an empty database that would diff --git a/internal/auth/provisioning_test.go b/internal/auth/provisioning_test.go index dfa112a5b..ec47b37c2 100644 --- a/internal/auth/provisioning_test.go +++ b/internal/auth/provisioning_test.go @@ -8,7 +8,7 @@ import ( "sync" "testing" - appstore "github.com/labstack/fanout/internal/store" + appstore "github.com/labstack/pitot/internal/store" ) const testIssuer = "https://issuer.example" diff --git a/internal/auth/session.go b/internal/auth/session.go index d82f375c0..41787479d 100644 --- a/internal/auth/session.go +++ b/internal/auth/session.go @@ -13,7 +13,7 @@ import ( "github.com/alexedwards/scs/v2" - appstore "github.com/labstack/fanout/internal/store" + appstore "github.com/labstack/pitot/internal/store" ) const ( @@ -264,6 +264,7 @@ func NewBrowserSessions(db *sql.DB, idleTTL, absoluteTTL time.Duration, secure b manager.Lifetime = absoluteTTL manager.IdleTimeout = 0 manager.HashTokenInStore = true + // Keep existing browser sessions valid through the product rename. manager.Cookie.Name = "fanout_session" if secure { manager.Cookie.Name = "__Host-fanout_session" diff --git a/internal/auth/session_test.go b/internal/auth/session_test.go index 7722b7b47..814680f96 100644 --- a/internal/auth/session_test.go +++ b/internal/auth/session_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - appstore "github.com/labstack/fanout/internal/store" + appstore "github.com/labstack/pitot/internal/store" ) func newSessionTestStore(t *testing.T) (*appstore.SQLite, *BrowserSessions) { diff --git a/internal/auth/setup.go b/internal/auth/setup.go index c22db2173..3a3dd4b00 100644 --- a/internal/auth/setup.go +++ b/internal/auth/setup.go @@ -5,7 +5,7 @@ import ( "sync" "time" - "github.com/labstack/fanout/internal/secret" + "github.com/labstack/pitot/internal/secret" ) const SetupTTL = time.Hour diff --git a/internal/auth/smtp.go b/internal/auth/smtp.go index 4702eb394..262538086 100644 --- a/internal/auth/smtp.go +++ b/internal/auth/smtp.go @@ -10,7 +10,7 @@ import ( mail "github.com/wneessen/go-mail" - "github.com/labstack/fanout/internal/brand" + "github.com/labstack/pitot/internal/brand" ) // SMTPConfig holds SMTP connection settings. @@ -25,19 +25,19 @@ type SMTPConfig struct { // SendInvite sends an invitation email to a new user. func SendInvite(cfg SMTPConfig, to string) error { message, err := renderMail(inviteMailTemplate, mailData{ - Preheader: "You've been invited to a Fanout workspace.", + Preheader: "You've been invited to a Pitot workspace.", }) if err != nil { return err } - return send(cfg, to, "You've been invited to Fanout", inviteMailText, message) + return send(cfg, to, "You've been invited to Pitot", inviteMailText, message) } // SendCode sends a verification code email via SMTP. func SendCode(cfg SMTPConfig, to, code string) error { - subject := fmt.Sprintf("Fanout login code: %s", code) + subject := fmt.Sprintf("Pitot login code: %s", code) message, err := renderMail(codeMailTemplate, mailData{ - Preheader: "Your Fanout verification code is " + code + ".", + Preheader: "Your Pitot verification code is " + code + ".", Code: code, }) if err != nil { @@ -48,10 +48,10 @@ func SendCode(cfg SMTPConfig, to, code string) error { const plainTextSafetyNotice = "If you did not expect this message, you can safely ignore it." -const inviteMailText = "You've been invited to Fanout.\n\nVisit your Fanout instance and sign in with this email address to start investigating your observability data.\n\n" + plainTextSafetyNotice +const inviteMailText = "You've been invited to Pitot.\n\nVisit your Pitot instance and sign in with this email address to start investigating your observability data.\n\n" + plainTextSafetyNotice func codeMailText(code string) string { - return fmt.Sprintf("Your Fanout verification code is %s.\n\nEnter this code to finish signing in. It expires in 5 minutes.\n\n%s", code, plainTextSafetyNotice) + return fmt.Sprintf("Your Pitot verification code is %s.\n\nEnter this code to finish signing in. It expires in 5 minutes.\n\n%s", code, plainTextSafetyNotice) } func send(cfg SMTPConfig, to, subject, bodyText, bodyHTML string) error { @@ -118,28 +118,28 @@ func renderMail(t *template.Template, data mailData) (string, error) { return body.String(), nil } -const mailShellStart = `Fanout +const mailShellStart = `Pitot
{{.Preheader}}
-
` + brand.EmailMarkHTML + `Fanout
+
` + brand.EmailMarkHTML + `Pitot
` const mailShellEnd = `

If you did not expect this message, you can safely ignore it.

-

Fanout observability

+

Pitot observability

` var codeMailTemplate = template.Must(template.New("code-email").Parse(mailShellStart + `

Secure sign in

Your verification code

-

Enter this code to finish signing in to Fanout. It expires in 5 minutes.

+

Enter this code to finish signing in to Pitot. It expires in 5 minutes.

{{.Code}}
` + mailShellEnd)) var inviteMailTemplate = template.Must(template.New("invite-email").Parse(mailShellStart + `

Workspace invitation

-

You've been invited to Fanout

-

Visit your Fanout instance and sign in with this email address to start investigating your observability data.

+

You've been invited to Pitot

+

Visit your Pitot instance and sign in with this email address to start investigating your observability data.

` + mailShellEnd)) diff --git a/internal/auth/smtp_test.go b/internal/auth/smtp_test.go index c30671026..bb1197cf2 100644 --- a/internal/auth/smtp_test.go +++ b/internal/auth/smtp_test.go @@ -5,10 +5,10 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/brand" + "github.com/labstack/pitot/internal/brand" ) -func TestCodeMailUsesFanoutBrandAndEscapesCode(t *testing.T) { +func TestCodeMailUsesPitotBrandAndEscapesCode(t *testing.T) { body, err := renderMail(codeMailTemplate, mailData{ Preheader: `Sign in `, Code: ``, @@ -18,7 +18,7 @@ func TestCodeMailUsesFanoutBrandAndEscapesCode(t *testing.T) { } for _, want := range []string{ - "Fanout", + "Pitot", "Secure sign in", "Your verification code", brand.EmailMarkHTML, @@ -36,11 +36,11 @@ func TestCodeMailUsesFanoutBrandAndEscapesCode(t *testing.T) { func TestMailMessageContainsPlainTextAndHTMLAlternatives(t *testing.T) { message, err := newMailMessage( - "Fanout ", + "Pitot ", "operator@example.com", - "Fanout login code: 123456", - "Your Fanout verification code is 123456.", - "Your Fanout verification code is 123456.", + "Pitot login code: 123456", + "Your Pitot verification code is 123456.", + "Your Pitot verification code is 123456.", ) if err != nil { t.Fatalf("newMailMessage: %v", err) @@ -74,20 +74,20 @@ func TestPlainTextMailBodiesIncludeSafetyNotice(t *testing.T) { } } -func TestInviteMailUsesFanoutBrand(t *testing.T) { +func TestInviteMailUsesPitotBrand(t *testing.T) { body, err := renderMail(inviteMailTemplate, mailData{ - Preheader: "You've been invited to a Fanout workspace.", + Preheader: "You've been invited to a Pitot workspace.", }) if err != nil { t.Fatalf("renderMail: %v", err) } for _, want := range []string{ - "Fanout", + "Pitot", "Workspace invitation", - "You've been invited to Fanout", + "You've been invited to Pitot", "start investigating your observability data", - "Fanout observability", + "Pitot observability", } { if !strings.Contains(body, want) { t.Fatalf("invite email missing %q:\n%s", want, body) diff --git a/internal/auth/user_store.go b/internal/auth/user_store.go index 53e9bf59a..4e36d2635 100644 --- a/internal/auth/user_store.go +++ b/internal/auth/user_store.go @@ -7,9 +7,9 @@ import ( "fmt" "time" - "github.com/labstack/fanout/internal/db/generated" - appid "github.com/labstack/fanout/internal/id" - appstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/db/generated" + appid "github.com/labstack/pitot/internal/id" + appstore "github.com/labstack/pitot/internal/store" ) // ErrUserNotFound is returned when a requested user does not exist. diff --git a/internal/auth/user_store_test.go b/internal/auth/user_store_test.go index e3ea460f8..7250086af 100644 --- a/internal/auth/user_store_test.go +++ b/internal/auth/user_store_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - appstore "github.com/labstack/fanout/internal/store" + appstore "github.com/labstack/pitot/internal/store" ) func newTestSQLite(t *testing.T) *appstore.SQLite { diff --git a/internal/brand/brand.go b/internal/brand/brand.go index 1cc02dd8f..b70abc2df 100644 --- a/internal/brand/brand.go +++ b/internal/brand/brand.go @@ -1,20 +1,20 @@ -// Package brand contains static Fanout brand assets shared by user-facing +// Package brand contains static Pitot brand assets shared by user-facing // surfaces that cannot render the React brand components. package brand -// MarkSVG is the server-rendered Fanout mark. Keep its ribbon paths and +// MarkSVG is the server-rendered Pitot mark. Keep its ribbon paths and // gradients in sync with ui/host/public/favicon.svg, the canonical asset. // testdata/favicon.svg vendors a copy so the test in this package can assert // they have not drifted apart. const MarkSVG = `` // EmailMarkHTML approximates the flowing-F ribbons with email-safe table diff --git a/internal/brand/testdata/favicon.svg b/internal/brand/testdata/favicon.svg index 2e14dc052..39ea61de8 100644 --- a/internal/brand/testdata/favicon.svg +++ b/internal/brand/testdata/favicon.svg @@ -1,7 +1,7 @@ - Fanout Flowing F icon + Pitot Flowing F icon Three rounded flowing ribbons forming an abstract letter F. diff --git a/internal/cmd/dbmigrate/main.go b/internal/cmd/dbmigrate/main.go index d4a447133..c85de2441 100644 --- a/internal/cmd/dbmigrate/main.go +++ b/internal/cmd/dbmigrate/main.go @@ -1,5 +1,5 @@ // dbmigrate applies the same embedded control migrations and database guard as -// Fanout startup, without starting the server or loading runtime configuration. +// Pitot startup, without starting the server or loading runtime configuration. package main import ( @@ -8,7 +8,7 @@ import ( "os" "path/filepath" - "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/store" ) func main() { diff --git a/internal/cmd/e2eseed/main.go b/internal/cmd/e2eseed/main.go index 6a9fba868..ecdaad835 100644 --- a/internal/cmd/e2eseed/main.go +++ b/internal/cmd/e2eseed/main.go @@ -28,7 +28,7 @@ import ( ) func main() { - endpoint := flag.String("endpoint", "", "Disposable Fanout base URL") + endpoint := flag.String("endpoint", "", "Disposable Pitot base URL") tokenFile := flag.String("token-file", "", "Temporary ingest credential file") flag.Parse() if err := run(*endpoint, *tokenFile); err != nil { diff --git a/internal/cmd/e2eseed/main_test.go b/internal/cmd/e2eseed/main_test.go index e4050429a..d42737c37 100644 --- a/internal/cmd/e2eseed/main_test.go +++ b/internal/cmd/e2eseed/main_test.go @@ -14,14 +14,14 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/engine/querytest" - "github.com/labstack/fanout/internal/ingest" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/query" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/engine/querytest" + "github.com/labstack/pitot/internal/ingest" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/query" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" collectorlogs "go.opentelemetry.io/proto/otlp/collector/logs/v1" collectormetrics "go.opentelemetry.io/proto/otlp/collector/metrics/v1" collectortrace "go.opentelemetry.io/proto/otlp/collector/trace/v1" diff --git a/internal/cmd/notices/main.go b/internal/cmd/notices/main.go index 18704a7d6..4b4ba4242 100644 --- a/internal/cmd/notices/main.go +++ b/internal/cmd/notices/main.go @@ -1,4 +1,4 @@ -// Command notices generates the third-party notices shipped with Fanout. +// Command notices generates the third-party notices shipped with Pitot. package main import ( @@ -17,7 +17,7 @@ import ( "sort" "strings" - engine "github.com/labstack/fanout/internal/duckdb" + engine "github.com/labstack/pitot/internal/duckdb" ) type component struct { @@ -141,7 +141,7 @@ func collect(root string) ([]component, error) { func collectGo(root string, all map[string]component) error { targets := [][2]string{{"linux", "amd64"}, {"linux", "arm64"}, {"darwin", "amd64"}, {"darwin", "arm64"}} for _, target := range targets { - cmd := exec.Command("go", "list", "-deps", "-json", "./cmd/fanout") + cmd := exec.Command("go", "list", "-deps", "-json", "./cmd/pitot") cmd.Dir = root cmd.Env = append(os.Environ(), "CGO_ENABLED=1", "GOOS="+target[0], "GOARCH="+target[1]) stdout, err := cmd.StdoutPipe() @@ -412,12 +412,12 @@ func sortedKeys[V any](values map[string]V) []string { func render(components []component) []byte { var out strings.Builder - out.WriteString("FANOUT THIRD-PARTY NOTICES\n\n") + out.WriteString("PITOT THIRD-PARTY NOTICES\n\n") out.WriteString("This file is generated from the Go packages linked into the four supported\n") out.WriteString("release targets, the pinned native DuckDB engine, and the production dependency graphs of the two embedded\n") out.WriteString("browser applications. Development-only dependencies are excluded. Regenerate it\n") out.WriteString("with `just notices`; CI verifies it with `just notices-check`.\n\n") - out.WriteString("The following components are provided under their own terms. Fanout's Apache-2.0\n") + out.WriteString("The following components are provided under their own terms. Pitot's Apache-2.0\n") out.WriteString("license does not replace or alter those terms.\n\n") out.WriteString("COMPONENT INVENTORY\n") out.WriteString("===================\n\n") diff --git a/internal/cmd/notices/main_test.go b/internal/cmd/notices/main_test.go index 4ed84bddb..107fdf393 100644 --- a/internal/cmd/notices/main_test.go +++ b/internal/cmd/notices/main_test.go @@ -66,7 +66,7 @@ func writeTestFile(t *testing.T, path, contents string) { func TestCollectGoExcludesToolOnlyModules(t *testing.T) { root := t.TempDir() writeTestFile(t, filepath.Join(root, "go.mod"), "module fixture\ngo 1.27.1\nrequire example.com/tools v0.0.0\nreplace example.com/tools => ./tools\ntool example.com/tools/cmd/check\n") - writeTestFile(t, filepath.Join(root, "cmd/fanout/main.go"), "package main\nfunc main() {}\n") + writeTestFile(t, filepath.Join(root, "cmd/pitot/main.go"), "package main\nfunc main() {}\n") writeTestFile(t, filepath.Join(root, "tools/go.mod"), "module example.com/tools\ngo 1.27.1\n") writeTestFile(t, filepath.Join(root, "tools/cmd/check/main.go"), "package main\nfunc main() {}\n") all := map[string]component{} diff --git a/internal/cmd/semconvgen/main.go b/internal/cmd/semconvgen/main.go index d46306950..96882331e 100644 --- a/internal/cmd/semconvgen/main.go +++ b/internal/cmd/semconvgen/main.go @@ -16,7 +16,7 @@ import ( "slices" "strings" - "github.com/labstack/fanout/internal/telemetry/semconv" + "github.com/labstack/pitot/internal/telemetry/semconv" ) // Rule A: the Stable duration metrics whose non-Opt-In attributes are span keys. diff --git a/internal/cmd/semconvgen/main_test.go b/internal/cmd/semconvgen/main_test.go index 1e621efe3..5fa9b7b1a 100644 --- a/internal/cmd/semconvgen/main_test.go +++ b/internal/cmd/semconvgen/main_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/telemetry/semconv" + "github.com/labstack/pitot/internal/telemetry/semconv" ) // A miniature resolved registry with one case per rule clause. diff --git a/internal/config/config.go b/internal/config/config.go index 19ed84a10..f5e96b53e 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -10,8 +10,8 @@ import ( "time" "unicode" - appauth "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/secret" + appauth "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/secret" ) const maxIngestBatchSize = 50_000 @@ -47,49 +47,49 @@ func providerForEnvironment(name string) string { return "" } -// Config is Fanout's canonical configuration schema. Custom environment names -// use FANOUT_; provider credentials and endpoints use their vendor's names. +// Config is Pitot's canonical configuration schema. Custom environment names +// use PITOT_; provider credentials and endpoints use their vendor's names. // Elapsed-time settings use time.Duration with unit-bearing values. type Config struct { // Addr binds the browser, API, MCP, OTLP/gRPC and OTLP/HTTP listener. - Addr string `group:"server" env:"FANOUT_ADDR" default:"127.0.0.1:7520"` + Addr string `group:"server" env:"PITOT_ADDR" default:"127.0.0.1:7520"` // DataDir stores telemetry, query state, and the control database. - DataDir string `group:"storage" env:"FANOUT_DATA_DIR" default:"./data"` + DataDir string `group:"storage" env:"PITOT_DATA_DIR" default:"./data"` // IngestBatchSize sets the group-commit row target; valid values are 1–50000. // Individual requests remain atomic and can exceed this target. - IngestBatchSize int `group:"ingest" env:"FANOUT_INGEST_BATCH_SIZE" default:"50000"` + IngestBatchSize int `group:"ingest" env:"PITOT_INGEST_BATCH_SIZE" default:"50000"` // IngestMaxInFlightBytes caps decoded telemetry held across concurrent requests // until durable publication. Zero is unbounded. A single request is admitted // when no other request holds budget, even if it exceeds the limit. - IngestMaxInFlightBytes int `group:"ingest" env:"FANOUT_INGEST_MAX_IN_FLIGHT_BYTES" default:"268435456"` + IngestMaxInFlightBytes int `group:"ingest" env:"PITOT_INGEST_MAX_IN_FLIGHT_BYTES" default:"268435456"` // IngestToken sets the first ingest token, named configuration, when none has // ever existed, so an automated install accepts telemetry as soon as it starts. // Use foi_ plus 43 base64url characters. Only its digest is stored. It is // ignored once any token has existed, including a revoked one, so a restart // cannot bring back a revoked token. - IngestToken string `group:"ingest" env:"FANOUT_INGEST_TOKEN" secret:"true"` + IngestToken string `group:"ingest" env:"PITOT_INGEST_TOKEN" secret:"true"` // RollupInterval schedules analytical rollups; use a Go duration of at least 1s. - RollupInterval time.Duration `group:"storage" env:"FANOUT_ROLLUP_INTERVAL" default:"1m"` + RollupInterval time.Duration `group:"storage" env:"PITOT_ROLLUP_INTERVAL" default:"1m"` // MCPEnabled serves the MCP endpoint at /mcp. - MCPEnabled bool `group:"mcp" env:"FANOUT_MCP_ENABLED" default:"true"` + MCPEnabled bool `group:"mcp" env:"PITOT_MCP_ENABLED" default:"true"` // RetentionDays sets telemetry retention in days; zero disables expiry. - RetentionDays int `group:"storage" env:"FANOUT_RETENTION_DAYS" default:"30"` + RetentionDays int `group:"storage" env:"PITOT_RETENTION_DAYS" default:"30"` // MaintenanceInterval controls Parquet retention and compaction, and // query-cache checkpointing. - MaintenanceInterval time.Duration `group:"storage" env:"FANOUT_MAINTENANCE_INTERVAL" default:"1h"` + MaintenanceInterval time.Duration `group:"storage" env:"PITOT_MAINTENANCE_INTERVAL" default:"1h"` // Set once at boot, this advances the service and edge rollup // watermarks to the current max ingested timestamp. Existing history is not // aggregated into those analytical rollups. Completed-batch trace caches // still rebuild all retained history in bounded passes; // uncached files remain immediately queryable. Useful for large pre-seeded // datasets (benchmarks, restores); off in normal operation. - RollupSkipToLatest bool `group:"storage" env:"FANOUT_ROLLUP_SKIP_TO_LATEST" default:"false"` + RollupSkipToLatest bool `group:"storage" env:"PITOT_ROLLUP_SKIP_TO_LATEST" default:"false"` // DefaultNamespace supplies the namespace for telemetry without one. - DefaultNamespace string `group:"ingest" env:"FANOUT_DEFAULT_NAMESPACE" default:"default"` + DefaultNamespace string `group:"ingest" env:"PITOT_DEFAULT_NAMESPACE" default:"default"` // PprofEnabled exposes Go's net/http/pprof handlers at /debug/pprof/* for // CPU/heap/mutex/goroutine profiling under load. Off by default; the routes // require an admin browser session with operations:read. - PprofEnabled bool `group:"server" env:"FANOUT_PPROF_ENABLED" default:"false"` + PprofEnabled bool `group:"server" env:"PITOT_PPROF_ENABLED" default:"false"` // QueryCacheTTL is the oldest a dashboard panel, exemplar or trace // detail result served from memory may be, measured from the end of the // time window it covers (for traces and exemplars, from when their run @@ -98,19 +98,19 @@ type Config struct { // an older one is rerun. A request with Cache-Control: no-cache, such as // a dashboard's manual refresh, always reruns. Zero disables the cache; // concurrent identical requests still share one execution. - QueryCacheTTL time.Duration `group:"server" env:"FANOUT_QUERY_CACHE_TTL" default:"10s"` + QueryCacheTTL time.Duration `group:"server" env:"PITOT_QUERY_CACHE_TTL" default:"10s"` // The DuckDB knobs below self-size where possible and otherwise default to // values validated on the reference deployment target, a small shared VM // (Hetzner CPX32: 4 vCPU, 8 GB RAM, 160 GB disk). There the self-sizing // resolves to a ~4.8 GB memory cap and 4 query threads (deterministic from - // 8 GB / 4 vCPU). Measure the target host with the external fanout-bench + // 8 GB / 4 vCPU). Measure the target host with an external benchmark // harness before setting // production limits; throughput and memory use vary with CPU, disk, and the // telemetry mix. // // Kept free-floating, separated from the field below by a blank line, so it // stays context for the group rather than becoming DuckDBMemory's own doc - // comment: cmd/fanout-docgen publishes each field's comment as that + // comment: cmd/pitot-docgen publishes each field's comment as that // setting's note, and this paragraph describes three of them. // DuckDBMemory caps DuckDB's memory (e.g. "8GB"). Empty selects 60% of detected @@ -118,111 +118,111 @@ type Config struct { // its default with a process headroom adjustment. Startup logs and /readyz // report the resolved budget and detection status. Set an explicit cap when // memory limit detection is incomplete. - DuckDBMemory string `group:"storage" env:"FANOUT_DUCKDB_MEMORY"` + DuckDBMemory string `group:"storage" env:"PITOT_DUCKDB_MEMORY"` // DuckDBThreads caps DuckDB's global query worker pool. Zero selects one // worker per CPU the process may run on (the affinity mask and cgroup // quota, as GOMAXPROCS resolves them) rather than DuckDB's count of the // machine's hardware threads. Set it to leave cores free for ingest on a // query-heavy co-tenant host. - DuckDBThreads int `group:"storage" env:"FANOUT_DUCKDB_THREADS" default:"0"` + DuckDBThreads int `group:"storage" env:"PITOT_DUCKDB_THREADS" default:"0"` // DuckDBMaxConns caps the DuckDB read connection pool. Reads scan immutable // Parquet concurrently; analytical and completed-batch writes use separate // gates and connections. Zero selects available Go CPUs, bounded to 2–16. // Startup logs and /readyz report the resolved pool size. - DuckDBMaxConns int `group:"storage" env:"FANOUT_DUCKDB_MAX_CONNECTIONS" default:"0"` + DuckDBMaxConns int `group:"storage" env:"PITOT_DUCKDB_MAX_CONNECTIONS" default:"0"` // AlertEnabled runs the alert evaluation engine. - AlertEnabled bool `group:"alerts" env:"FANOUT_ALERTS_ENABLED" default:"true"` + AlertEnabled bool `group:"alerts" env:"PITOT_ALERTS_ENABLED" default:"true"` // AlertEvaluationInterval schedules alert evaluation; use a Go duration of at least 1s. - AlertEvaluationInterval time.Duration `group:"alerts" env:"FANOUT_ALERTS_EVALUATION_INTERVAL" default:"30s"` + AlertEvaluationInterval time.Duration `group:"alerts" env:"PITOT_ALERTS_EVALUATION_INTERVAL" default:"30s"` // AlertHistoryDays sets alert history retention in days. - AlertHistoryDays int `group:"alerts" env:"FANOUT_ALERTS_HISTORY_DAYS" default:"7"` + AlertHistoryDays int `group:"alerts" env:"PITOT_ALERTS_HISTORY_DAYS" default:"7"` // AlertEmailDefaultTo is a comma-separated list of addresses that receive alerts from rules with no webhook and no email recipients of their own; requires SMTP. - AlertEmailDefaultTo string `group:"alerts" env:"FANOUT_ALERTS_EMAIL_DEFAULT_TO"` + AlertEmailDefaultTo string `group:"alerts" env:"PITOT_ALERTS_EMAIL_DEFAULT_TO"` // AlertEmailHourlyLimit caps the alert emails sent to one address in any rolling hour, across all rules. Notifications over the limit are suppressed, not delayed, and shown on the rule; 0 suppresses all alert email. - AlertEmailHourlyLimit int `group:"alerts" env:"FANOUT_ALERTS_EMAIL_HOURLY_LIMIT" default:"30"` + AlertEmailHourlyLimit int `group:"alerts" env:"PITOT_ALERTS_EMAIL_HOURLY_LIMIT" default:"30"` // AIProvider enables chat by selecting exactly anthropic or openai. Empty disables chat. - AIProvider string `group:"ai" env:"FANOUT_AI_PROVIDER" default:""` + AIProvider string `group:"ai" env:"PITOT_AI_PROVIDER" default:""` // AIModel overrides the provider's default: claude-sonnet-5-5 for Anthropic // and gpt-6.1-sol for OpenAI. The OpenAI provider expects a reasoning model // supporting reasoning.encrypted_content for stateless Responses replay. // A 400 rejecting encrypted content is reported as a server-side configuration - // error; choose a compatible reasoning model with FANOUT_AI_MODEL. - AIModel string `group:"ai" env:"FANOUT_AI_MODEL"` - // AnthropicAPIKey is required when FANOUT_AI_PROVIDER is anthropic. + // error; choose a compatible reasoning model with PITOT_AI_MODEL. + AIModel string `group:"ai" env:"PITOT_AI_MODEL"` + // AnthropicAPIKey is required when PITOT_AI_PROVIDER is anthropic. AnthropicAPIKey string `group:"ai" env:"ANTHROPIC_API_KEY" secret:"true"` - // AnthropicBaseURL defaults to https://api.anthropic.com. Fanout appends + // AnthropicBaseURL defaults to https://api.anthropic.com. Pitot appends // /v1/messages, preserving any gateway path prefix. Use an HTTP(S) base URL // without embedded credentials, a query, or a fragment. AnthropicBaseURL string `group:"ai" env:"ANTHROPIC_BASE_URL"` - // OpenAIAPIKey is required when FANOUT_AI_PROVIDER is openai. + // OpenAIAPIKey is required when PITOT_AI_PROVIDER is openai. OpenAIAPIKey string `group:"ai" env:"OPENAI_API_KEY" secret:"true"` - // OpenAIBaseURL defaults to https://api.openai.com/v1. Fanout appends + // OpenAIBaseURL defaults to https://api.openai.com/v1. Pitot appends // /responses, preserving the API version and any gateway path prefix. // Use an HTTP(S) base URL without embedded credentials, a query, or a fragment. OpenAIBaseURL string `group:"ai" env:"OPENAI_BASE_URL"` // SMTPHost selects the mail server. Host, username, password, and from must all be set to enable SMTP. - SMTPHost string `group:"smtp" env:"FANOUT_SMTP_HOST"` + SMTPHost string `group:"smtp" env:"PITOT_SMTP_HOST"` // SMTPPort sets the mail server's positive TCP port. - SMTPPort int `group:"smtp" env:"FANOUT_SMTP_PORT" default:"587"` + SMTPPort int `group:"smtp" env:"PITOT_SMTP_PORT" default:"587"` // SMTPUser authenticates to the mail server; required with SMTP. - SMTPUser string `group:"smtp" env:"FANOUT_SMTP_USERNAME"` + SMTPUser string `group:"smtp" env:"PITOT_SMTP_USERNAME"` // SMTPPass authenticates to the mail server; required with SMTP. - SMTPPass string `group:"smtp" env:"FANOUT_SMTP_PASSWORD" secret:"true"` + SMTPPass string `group:"smtp" env:"PITOT_SMTP_PASSWORD" secret:"true"` // SMTPFrom sets the email sender address; required with SMTP. - SMTPFrom string `group:"smtp" env:"FANOUT_SMTP_FROM"` + SMTPFrom string `group:"smtp" env:"PITOT_SMTP_FROM"` // AuthMode selects local sign-in or oidc; each mode validates its prerequisites. - AuthMode string `group:"auth" env:"FANOUT_AUTH_MODE" default:"local"` + AuthMode string `group:"auth" env:"PITOT_AUTH_MODE" default:"local"` // PublicURL sets the external browser origin, MCP token audience, and trusted MCP // request origin. Required for OIDC; HTTPS is required with MCP. - PublicURL string `group:"server" env:"FANOUT_PUBLIC_URL"` + PublicURL string `group:"server" env:"PITOT_PUBLIC_URL"` // AuthCodeSecret signs sign-in codes and login links; needs at least 32 characters in local mode and to issue or redeem OIDC break-glass links. - AuthCodeSecret string `group:"auth" env:"FANOUT_AUTH_CODE_SECRET" secret:"true"` + AuthCodeSecret string `group:"auth" env:"PITOT_AUTH_CODE_SECRET" secret:"true"` // SelfSignup allows verified email addresses to create viewer accounts; requires local auth and SMTP. - SelfSignup bool `group:"auth" env:"FANOUT_SELF_SIGNUP" default:"false"` + SelfSignup bool `group:"auth" env:"PITOT_SELF_SIGNUP" default:"false"` // SessionIdleTTL expires inactive sessions; use a Go duration of at least 5m. - SessionIdleTTL time.Duration `group:"auth" env:"FANOUT_SESSION_IDLE_TTL" default:"12h"` - // SessionAbsoluteTTL limits total session lifetime; it must be at least FANOUT_SESSION_IDLE_TTL. - SessionAbsoluteTTL time.Duration `group:"auth" env:"FANOUT_SESSION_ABSOLUTE_TTL" default:"168h"` + SessionIdleTTL time.Duration `group:"auth" env:"PITOT_SESSION_IDLE_TTL" default:"12h"` + // SessionAbsoluteTTL limits total session lifetime; it must be at least PITOT_SESSION_IDLE_TTL. + SessionAbsoluteTTL time.Duration `group:"auth" env:"PITOT_SESSION_ABSOLUTE_TTL" default:"168h"` // SCIMToken enables SCIM 2.0 user provisioning under /scim/v2 and turns off browser setup; requires OIDC mode and at least 32 characters. - SCIMToken string `group:"auth" env:"FANOUT_SCIM_TOKEN" secret:"true"` - // OIDCIssuerURL selects the identity provider issuer; required in OIDC mode. Fanout starts while it is unreachable and retries discovery; a mismatched issuer fails startup. - OIDCIssuerURL string `group:"auth" env:"FANOUT_OIDC_ISSUER_URL"` - // OIDCClientID identifies Fanout's client registration; required in OIDC mode. - OIDCClientID string `group:"auth" env:"FANOUT_OIDC_CLIENT_ID"` - // OIDCClientSecret authenticates Fanout's client registration; required in OIDC mode. - OIDCClientSecret string `group:"auth" env:"FANOUT_OIDC_CLIENT_SECRET" secret:"true"` + SCIMToken string `group:"auth" env:"PITOT_SCIM_TOKEN" secret:"true"` + // OIDCIssuerURL selects the identity provider issuer; required in OIDC mode. Pitot starts while it is unreachable and retries discovery; a mismatched issuer fails startup. + OIDCIssuerURL string `group:"auth" env:"PITOT_OIDC_ISSUER_URL"` + // OIDCClientID identifies Pitot's client registration; required in OIDC mode. + OIDCClientID string `group:"auth" env:"PITOT_OIDC_CLIENT_ID"` + // OIDCClientSecret authenticates Pitot's client registration; required in OIDC mode. + OIDCClientSecret string `group:"auth" env:"PITOT_OIDC_CLIENT_SECRET" secret:"true"` // OIDCEmailClaim names the claim containing the user's email address. - OIDCEmailClaim string `group:"auth" env:"FANOUT_OIDC_EMAIL_CLAIM" default:"email"` + OIDCEmailClaim string `group:"auth" env:"PITOT_OIDC_EMAIL_CLAIM" default:"email"` // OIDCEmailVerification selects required verified-email claims or issuer trust; issuer trust requires an allowlist. - OIDCEmailVerification string `group:"auth" env:"FANOUT_OIDC_EMAIL_VERIFICATION" default:"required"` + OIDCEmailVerification string `group:"auth" env:"PITOT_OIDC_EMAIL_VERIFICATION" default:"required"` // OIDCAutoProvision creates accounts on OIDC sign-in; requires an allowed group or domain. - OIDCAutoProvision bool `group:"auth" env:"FANOUT_OIDC_AUTO_PROVISION" default:"false"` + OIDCAutoProvision bool `group:"auth" env:"PITOT_OIDC_AUTO_PROVISION" default:"false"` // OIDCAllowedGroups lists allowed identity-provider groups, separated by commas. - OIDCAllowedGroups string `group:"auth" env:"FANOUT_OIDC_ALLOWED_GROUPS"` + OIDCAllowedGroups string `group:"auth" env:"PITOT_OIDC_ALLOWED_GROUPS"` // OIDCAllowedDomains lists allowed email domains, separated by commas; wildcard * requires verified email. - OIDCAllowedDomains string `group:"auth" env:"FANOUT_OIDC_ALLOWED_DOMAINS"` + OIDCAllowedDomains string `group:"auth" env:"PITOT_OIDC_ALLOWED_DOMAINS"` // OIDCDefaultRole assigns viewer, operator, or admin to users without a group role mapping. - OIDCDefaultRole string `group:"auth" env:"FANOUT_OIDC_DEFAULT_ROLE" default:"viewer"` + OIDCDefaultRole string `group:"auth" env:"PITOT_OIDC_DEFAULT_ROLE" default:"viewer"` // OIDCOperatorGroups lists identity-provider groups mapped to operator, separated by commas. - OIDCOperatorGroups string `group:"auth" env:"FANOUT_OIDC_OPERATOR_GROUPS"` + OIDCOperatorGroups string `group:"auth" env:"PITOT_OIDC_OPERATOR_GROUPS"` // OIDCAdminGroups lists identity-provider groups mapped to admin, separated by commas. - OIDCAdminGroups string `group:"auth" env:"FANOUT_OIDC_ADMIN_GROUPS"` + OIDCAdminGroups string `group:"auth" env:"PITOT_OIDC_ADMIN_GROUPS"` // MetricsToken authorizes Prometheus scrapes with a bearer token; optional when using an admin session. - MetricsToken string `group:"metrics" env:"FANOUT_METRICS_TOKEN" secret:"true"` + MetricsToken string `group:"metrics" env:"PITOT_METRICS_TOKEN" secret:"true"` // MetricsPublic allows unauthenticated Prometheus scrapes. - MetricsPublic bool `group:"metrics" env:"FANOUT_METRICS_PUBLIC" default:"false"` + MetricsPublic bool `group:"metrics" env:"PITOT_METRICS_PUBLIC" default:"false"` // TrustedProxyCIDRs lists trusted proxy networks, separated by commas; empty trusts no forwarded client addresses. - TrustedProxyCIDRs string `group:"server" env:"FANOUT_TRUSTED_PROXY_CIDRS"` - // TLSCertFile selects the TLS certificate file; requires FANOUT_TLS_KEY_FILE. - TLSCertFile string `group:"server" env:"FANOUT_TLS_CERT_FILE"` - // TLSKeyFile selects the TLS private key file; requires FANOUT_TLS_CERT_FILE. - TLSKeyFile string `group:"server" env:"FANOUT_TLS_KEY_FILE"` - // TLSClientCAFile selects a PEM CA bundle; when set, the listener requires client certificates signed by it. Requires FANOUT_TLS_CERT_FILE and FANOUT_TLS_KEY_FILE. - TLSClientCAFile string `group:"server" env:"FANOUT_TLS_CLIENT_CA_FILE"` - // HealthcheckCertFile selects the client certificate fanout healthcheck presents; requires FANOUT_HEALTHCHECK_KEY_FILE and FANOUT_TLS_CLIENT_CA_FILE. - HealthcheckCertFile string `group:"server" env:"FANOUT_HEALTHCHECK_CERT_FILE"` - // HealthcheckKeyFile selects the private key for FANOUT_HEALTHCHECK_CERT_FILE; requires FANOUT_HEALTHCHECK_CERT_FILE. - HealthcheckKeyFile string `group:"server" env:"FANOUT_HEALTHCHECK_KEY_FILE"` + TrustedProxyCIDRs string `group:"server" env:"PITOT_TRUSTED_PROXY_CIDRS"` + // TLSCertFile selects the TLS certificate file; requires PITOT_TLS_KEY_FILE. + TLSCertFile string `group:"server" env:"PITOT_TLS_CERT_FILE"` + // TLSKeyFile selects the TLS private key file; requires PITOT_TLS_CERT_FILE. + TLSKeyFile string `group:"server" env:"PITOT_TLS_KEY_FILE"` + // TLSClientCAFile selects a PEM CA bundle; when set, the listener requires client certificates signed by it. Requires PITOT_TLS_CERT_FILE and PITOT_TLS_KEY_FILE. + TLSClientCAFile string `group:"server" env:"PITOT_TLS_CLIENT_CA_FILE"` + // HealthcheckCertFile selects the client certificate pitot healthcheck presents; requires PITOT_HEALTHCHECK_KEY_FILE and PITOT_TLS_CLIENT_CA_FILE. + HealthcheckCertFile string `group:"server" env:"PITOT_HEALTHCHECK_CERT_FILE"` + // HealthcheckKeyFile selects the private key for PITOT_HEALTHCHECK_CERT_FILE; requires PITOT_HEALTHCHECK_CERT_FILE. + HealthcheckKeyFile string `group:"server" env:"PITOT_HEALTHCHECK_KEY_FILE"` resolvedSizing sizingSource } @@ -231,16 +231,16 @@ type Config struct { func (c Config) LogStartup() { c.logResolvedSizing(c.resolvedSizing) if !c.SecureCookies() { - slog.Warn("browser session cookies are not Secure; configure FANOUT_PUBLIC_URL or local TLS before exposing Fanout") + slog.Warn("browser session cookies are not Secure; configure PITOT_PUBLIC_URL or local TLS before exposing Pitot") } if strings.TrimSpace(c.PublicURL) != "" && !c.TLSEnabled() && strings.TrimSpace(c.TrustedProxyCIDRs) == "" { - slog.Warn("reverse-proxy client IPs are not trusted; configure FANOUT_TRUSTED_PROXY_CIDRS so audit and rate limits use end-client addresses") + slog.Warn("reverse-proxy client IPs are not trusted; configure PITOT_TRUSTED_PROXY_CIDRS so audit and rate limits use end-client addresses") } if c.MetricsPublic { slog.Warn("Prometheus metrics are publicly accessible", "path", "/metrics") } if strings.ToLower(strings.TrimSpace(c.AuthMode)) == "oidc" && c.AuthCodeSecret != "" && c.ValidateLoginLinkSecret() != nil { - slog.Warn("FANOUT_AUTH_CODE_SECRET is shorter than 32 characters; OIDC break-glass login links will be unavailable") + slog.Warn("PITOT_AUTH_CODE_SECRET is shorter than 32 characters; OIDC break-glass login links will be unavailable") } if c.SelfSignup { slog.Info("self-signup is enabled", "role", appauth.RoleViewer) @@ -248,7 +248,7 @@ func (c Config) LogStartup() { // A warning and not a validation error: an installation with this // combination must still start after upgrading. if strings.ToLower(strings.TrimSpace(c.AuthMode)) == "oidc" && c.OIDCRoleMappingConfigured() && !c.OIDCAutoProvision && c.SCIMToken == "" { - slog.Warn("OIDC role mapping refuses browser user creation and FANOUT_OIDC_AUTO_PROVISION is off, so no new user can get an account; set FANOUT_OIDC_AUTO_PROVISION with an allowed group or domain, or FANOUT_SCIM_TOKEN") + slog.Warn("OIDC role mapping refuses browser user creation and PITOT_OIDC_AUTO_PROVISION is off, so no new user can get an account; set PITOT_OIDC_AUTO_PROVISION with an allowed group or domain, or PITOT_SCIM_TOKEN") } } @@ -287,18 +287,19 @@ func (c Config) ControlDir() string { } func (c Config) ControlSQLitePath() string { + // Stable on-disk name: opening a new file would hide existing control state. return filepath.Join(c.ControlDir(), "fanout.sqlite") } // TLSEnabled reports whether a cert/key pair is configured. When true, HTTP -// serves HTTPS and OTLP gRPC over TLS on FANOUT_ADDR. +// serves HTTPS and OTLP gRPC over TLS on PITOT_ADDR. func (c Config) TLSEnabled() bool { return strings.TrimSpace(c.TLSCertFile) != "" && strings.TrimSpace(c.TLSKeyFile) != "" } // ClientCertificatesRequired reports whether the TLS listener requires and -// verifies client certificates against FANOUT_TLS_CLIENT_CA_FILE. +// verifies client certificates against PITOT_TLS_CLIENT_CA_FILE. func (c Config) ClientCertificatesRequired() bool { return c.TLSEnabled() && strings.TrimSpace(c.TLSClientCAFile) != "" } @@ -306,64 +307,64 @@ func (c Config) ClientCertificatesRequired() bool { // Validate checks that config values are sane. func (c Config) Validate() error { if strings.TrimSpace(c.Addr) == "" { - return fmt.Errorf("FANOUT_ADDR must not be empty") + return fmt.Errorf("PITOT_ADDR must not be empty") } if strings.TrimSpace(c.DataDir) == "" { - return fmt.Errorf("FANOUT_DATA_DIR must not be empty") + return fmt.Errorf("PITOT_DATA_DIR must not be empty") } if c.IngestBatchSize <= 0 || c.IngestBatchSize > maxIngestBatchSize { - return fmt.Errorf("FANOUT_INGEST_BATCH_SIZE must be between 1 and %d, got %d", maxIngestBatchSize, c.IngestBatchSize) + return fmt.Errorf("PITOT_INGEST_BATCH_SIZE must be between 1 and %d, got %d", maxIngestBatchSize, c.IngestBatchSize) } if c.IngestToken != "" && !secret.ValidSecret(c.IngestToken, "foi_") { - return fmt.Errorf("FANOUT_INGEST_TOKEN must be foi_ followed by 43 base64url characters") + return fmt.Errorf("PITOT_INGEST_TOKEN must be foi_ followed by 43 base64url characters") } if c.RollupInterval < time.Second { - return fmt.Errorf("FANOUT_ROLLUP_INTERVAL must be at least 1s, got %s", c.RollupInterval) + return fmt.Errorf("PITOT_ROLLUP_INTERVAL must be at least 1s, got %s", c.RollupInterval) } if c.RetentionDays < 0 { - return fmt.Errorf("FANOUT_RETENTION_DAYS must be >= 0, got %d", c.RetentionDays) + return fmt.Errorf("PITOT_RETENTION_DAYS must be >= 0, got %d", c.RetentionDays) } if c.MaintenanceInterval < time.Second { - return fmt.Errorf("FANOUT_MAINTENANCE_INTERVAL must be at least 1s, got %s", c.MaintenanceInterval) + return fmt.Errorf("PITOT_MAINTENANCE_INTERVAL must be at least 1s, got %s", c.MaintenanceInterval) } if c.QueryCacheTTL < 0 { - return fmt.Errorf("FANOUT_QUERY_CACHE_TTL must be >= 0, got %s", c.QueryCacheTTL) + return fmt.Errorf("PITOT_QUERY_CACHE_TTL must be >= 0, got %s", c.QueryCacheTTL) } if c.DuckDBThreads < 0 { - return fmt.Errorf("FANOUT_DUCKDB_THREADS must be >= 0, got %d", c.DuckDBThreads) + return fmt.Errorf("PITOT_DUCKDB_THREADS must be >= 0, got %d", c.DuckDBThreads) } if c.DuckDBMaxConns <= 0 { - return fmt.Errorf("FANOUT_DUCKDB_MAX_CONNECTIONS must resolve to > 0, got %d", c.DuckDBMaxConns) + return fmt.Errorf("PITOT_DUCKDB_MAX_CONNECTIONS must resolve to > 0, got %d", c.DuckDBMaxConns) } if c.AlertEvaluationInterval < time.Second { - return fmt.Errorf("FANOUT_ALERTS_EVALUATION_INTERVAL must be at least 1s, got %s", c.AlertEvaluationInterval) + return fmt.Errorf("PITOT_ALERTS_EVALUATION_INTERVAL must be at least 1s, got %s", c.AlertEvaluationInterval) } if c.AlertHistoryDays < 0 { - return fmt.Errorf("FANOUT_ALERTS_HISTORY_DAYS must be >= 0, got %d", c.AlertHistoryDays) + return fmt.Errorf("PITOT_ALERTS_HISTORY_DAYS must be >= 0, got %d", c.AlertHistoryDays) } if c.AlertEmailHourlyLimit < 0 { - return fmt.Errorf("FANOUT_ALERTS_EMAIL_HOURLY_LIMIT must be >= 0, got %d", c.AlertEmailHourlyLimit) + return fmt.Errorf("PITOT_ALERTS_EMAIL_HOURLY_LIMIT must be >= 0, got %d", c.AlertEmailHourlyLimit) } if c.MCPEnabled { u, err := url.Parse(c.MCPResourceURL()) if err != nil || u.Scheme != "https" || u.Host == "" || u.User != nil || u.Path != "/mcp" || u.RawQuery != "" || u.Fragment != "" { - return fmt.Errorf("FANOUT_PUBLIC_URL must be an HTTPS origin when MCP is enabled") + return fmt.Errorf("PITOT_PUBLIC_URL must be an HTTPS origin when MCP is enabled") } } authMode := strings.ToLower(strings.TrimSpace(c.AuthMode)) if authMode == "" { - return fmt.Errorf("FANOUT_AUTH_MODE must not be empty") + return fmt.Errorf("PITOT_AUTH_MODE must not be empty") } if authMode != "local" && authMode != "oidc" { - return fmt.Errorf("FANOUT_AUTH_MODE must be local or oidc") + return fmt.Errorf("PITOT_AUTH_MODE must be local or oidc") } idleTTL := c.SessionIdleTTL absoluteTTL := c.SessionAbsoluteTTL if idleTTL < 5*time.Minute { - return fmt.Errorf("FANOUT_SESSION_IDLE_TTL must be at least 5m") + return fmt.Errorf("PITOT_SESSION_IDLE_TTL must be at least 5m") } if absoluteTTL <= 0 || idleTTL > absoluteTTL { - return fmt.Errorf("FANOUT_SESSION_ABSOLUTE_TTL must be positive and at least FANOUT_SESSION_IDLE_TTL") + return fmt.Errorf("PITOT_SESSION_ABSOLUTE_TTL must be positive and at least PITOT_SESSION_IDLE_TTL") } if authMode == "local" { if err := c.ValidateLoginLinkSecret(); err != nil { @@ -372,75 +373,75 @@ func (c Config) Validate() error { } if anySet(c.SMTPHost, c.SMTPUser, c.SMTPPass, c.SMTPFrom) { if !c.SMTPConfigured() { - return fmt.Errorf("FANOUT_SMTP_HOST, FANOUT_SMTP_USERNAME, FANOUT_SMTP_PASSWORD, and FANOUT_SMTP_FROM must all be set when SMTP is configured") + return fmt.Errorf("PITOT_SMTP_HOST, PITOT_SMTP_USERNAME, PITOT_SMTP_PASSWORD, and PITOT_SMTP_FROM must all be set when SMTP is configured") } if c.SMTPPort <= 0 { - return fmt.Errorf("FANOUT_SMTP_PORT must be > 0") + return fmt.Errorf("PITOT_SMTP_PORT must be > 0") } } if anySet(c.AlertEmailDefaultTo) { if !c.SMTPConfigured() { - return fmt.Errorf("FANOUT_ALERTS_EMAIL_DEFAULT_TO requires SMTP") + return fmt.Errorf("PITOT_ALERTS_EMAIL_DEFAULT_TO requires SMTP") } if _, err := c.AlertEmailDefaults(); err != nil { - return fmt.Errorf("FANOUT_ALERTS_EMAIL_DEFAULT_TO: %w", err) + return fmt.Errorf("PITOT_ALERTS_EMAIL_DEFAULT_TO: %w", err) } } if c.SelfSignup { if authMode != "local" { - return fmt.Errorf("FANOUT_SELF_SIGNUP requires FANOUT_AUTH_MODE=local") + return fmt.Errorf("PITOT_SELF_SIGNUP requires PITOT_AUTH_MODE=local") } if !c.SMTPConfigured() { - return fmt.Errorf("FANOUT_SELF_SIGNUP requires SMTP") + return fmt.Errorf("PITOT_SELF_SIGNUP requires SMTP") } } if c.SCIMToken != "" { // SCIM links each account to (issuer, subject), which needs an issuer. if authMode != "oidc" { - return fmt.Errorf("FANOUT_SCIM_TOKEN requires FANOUT_AUTH_MODE=oidc") + return fmt.Errorf("PITOT_SCIM_TOKEN requires PITOT_AUTH_MODE=oidc") } if len(c.SCIMToken) < 32 || strings.ContainsAny(c.SCIMToken, " \t\r\n") { - return fmt.Errorf("FANOUT_SCIM_TOKEN must be at least 32 characters with no whitespace") + return fmt.Errorf("PITOT_SCIM_TOKEN must be at least 32 characters with no whitespace") } } if authMode == "oidc" { issuer, err := url.Parse(strings.TrimSpace(c.OIDCIssuerURL)) if err != nil || issuer.Scheme != "https" || issuer.Host == "" { - return fmt.Errorf("FANOUT_OIDC_ISSUER_URL must be an HTTPS URL") + return fmt.Errorf("PITOT_OIDC_ISSUER_URL must be an HTTPS URL") } if strings.TrimSpace(c.OIDCClientID) == "" || strings.TrimSpace(c.OIDCClientSecret) == "" { - return fmt.Errorf("FANOUT_OIDC_CLIENT_ID and FANOUT_OIDC_CLIENT_SECRET are required in oidc mode") + return fmt.Errorf("PITOT_OIDC_CLIENT_ID and PITOT_OIDC_CLIENT_SECRET are required in oidc mode") } publicURL, err := url.Parse(strings.TrimSpace(c.PublicURL)) if err != nil || publicURL.Scheme != "https" || publicURL.Host == "" { - return fmt.Errorf("FANOUT_PUBLIC_URL must be an HTTPS URL in oidc mode") + return fmt.Errorf("PITOT_PUBLIC_URL must be an HTTPS URL in oidc mode") } if c.OIDCEmailVerification != "required" && c.OIDCEmailVerification != "issuer" { - return fmt.Errorf("FANOUT_OIDC_EMAIL_VERIFICATION must be required or issuer") + return fmt.Errorf("PITOT_OIDC_EMAIL_VERIFICATION must be required or issuer") } if c.OIDCEmailVerification != "required" && csvContains(c.OIDCAllowedDomains, "*") { - return fmt.Errorf("FANOUT_OIDC_ALLOWED_DOMAINS wildcard requires FANOUT_OIDC_EMAIL_VERIFICATION=required") + return fmt.Errorf("PITOT_OIDC_ALLOWED_DOMAINS wildcard requires PITOT_OIDC_EMAIL_VERIFICATION=required") } if strings.TrimSpace(c.OIDCEmailClaim) == "" { - return fmt.Errorf("FANOUT_OIDC_EMAIL_CLAIM must not be empty") + return fmt.Errorf("PITOT_OIDC_EMAIL_CLAIM must not be empty") } if c.OIDCEmailVerification == "issuer" && strings.TrimSpace(c.OIDCAllowedGroups) == "" && strings.TrimSpace(c.OIDCAllowedDomains) == "" { - return fmt.Errorf("OIDC issuer email verification requires FANOUT_OIDC_ALLOWED_GROUPS or FANOUT_OIDC_ALLOWED_DOMAINS") + return fmt.Errorf("OIDC issuer email verification requires PITOT_OIDC_ALLOWED_GROUPS or PITOT_OIDC_ALLOWED_DOMAINS") } if !appauth.ValidRole(c.OIDCDefaultRole) { - return fmt.Errorf("FANOUT_OIDC_DEFAULT_ROLE must be viewer, operator, or admin") + return fmt.Errorf("PITOT_OIDC_DEFAULT_ROLE must be viewer, operator, or admin") } if c.OIDCAutoProvision && strings.TrimSpace(c.OIDCAllowedGroups) == "" && strings.TrimSpace(c.OIDCAllowedDomains) == "" { - return fmt.Errorf("OIDC auto-provisioning requires FANOUT_OIDC_ALLOWED_GROUPS or FANOUT_OIDC_ALLOWED_DOMAINS") + return fmt.Errorf("OIDC auto-provisioning requires PITOT_OIDC_ALLOWED_GROUPS or PITOT_OIDC_ALLOWED_DOMAINS") } } provider, supported := providers[c.AIProvider] if c.AIProvider != "" && !supported { - return fmt.Errorf("FANOUT_AI_PROVIDER must be anthropic or openai") + return fmt.Errorf("PITOT_AI_PROVIDER must be anthropic or openai") } if c.AgentConfigured() { if strings.TrimSpace(c.AIAPIKey()) == "" { - return fmt.Errorf("%s is required when FANOUT_AI_PROVIDER is %s", provider.keyEnv, c.AIProvider) + return fmt.Errorf("%s is required when PITOT_AI_PROVIDER is %s", provider.keyEnv, c.AIProvider) } baseURL := c.AIBaseURL() u, err := url.Parse(baseURL) @@ -454,33 +455,33 @@ func (c Config) Validate() error { continue } if _, _, err := net.ParseCIDR(value); err != nil { - return fmt.Errorf("FANOUT_TRUSTED_PROXY_CIDRS contains invalid CIDR %q", value) + return fmt.Errorf("PITOT_TRUSTED_PROXY_CIDRS contains invalid CIDR %q", value) } } if anySet(c.TLSCertFile, c.TLSKeyFile) && !c.TLSEnabled() { - return fmt.Errorf("FANOUT_TLS_CERT_FILE and FANOUT_TLS_KEY_FILE must both be set") + return fmt.Errorf("PITOT_TLS_CERT_FILE and PITOT_TLS_KEY_FILE must both be set") } if anySet(c.TLSClientCAFile) && !c.TLSEnabled() { - return fmt.Errorf("FANOUT_TLS_CLIENT_CA_FILE requires FANOUT_TLS_CERT_FILE and FANOUT_TLS_KEY_FILE") + return fmt.Errorf("PITOT_TLS_CLIENT_CA_FILE requires PITOT_TLS_CERT_FILE and PITOT_TLS_KEY_FILE") } if anySet(c.HealthcheckCertFile, c.HealthcheckKeyFile) { if !anySet(c.HealthcheckCertFile) || !anySet(c.HealthcheckKeyFile) { - return fmt.Errorf("FANOUT_HEALTHCHECK_CERT_FILE and FANOUT_HEALTHCHECK_KEY_FILE must both be set") + return fmt.Errorf("PITOT_HEALTHCHECK_CERT_FILE and PITOT_HEALTHCHECK_KEY_FILE must both be set") } if !anySet(c.TLSClientCAFile) { - return fmt.Errorf("FANOUT_HEALTHCHECK_CERT_FILE and FANOUT_HEALTHCHECK_KEY_FILE require FANOUT_TLS_CLIENT_CA_FILE") + return fmt.Errorf("PITOT_HEALTHCHECK_CERT_FILE and PITOT_HEALTHCHECK_KEY_FILE require PITOT_TLS_CLIENT_CA_FILE") } } return nil } -// ValidateLoginLinkSecret reports whether FANOUT_AUTH_CODE_SECRET can protect +// ValidateLoginLinkSecret reports whether PITOT_AUTH_CODE_SECRET can protect // login links. Local mode requires this at startup. OIDC mode checks it only // when a break-glass link is issued or redeemed, so OIDC installs that never // set the secret keep starting. func (c Config) ValidateLoginLinkSecret() error { if len(strings.TrimSpace(c.AuthCodeSecret)) < 32 { - return fmt.Errorf("FANOUT_AUTH_CODE_SECRET must be at least 32 characters") + return fmt.Errorf("PITOT_AUTH_CODE_SECRET must be at least 32 characters") } return nil } @@ -494,7 +495,7 @@ func (c Config) SecureCookies() bool { } // MCPResourceURL returns the canonical OAuth resource URI for the MCP route. -// MCP is served by the main HTTP server, so it always shares FANOUT_PUBLIC_URL. +// MCP is served by the main HTTP server, so it always shares PITOT_PUBLIC_URL. // The localhost value preserves zero-configuration development when no public // origin is configured. func (c Config) MCPResourceURL() string { diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 8f284338e..985d82d02 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -15,12 +15,12 @@ import ( func validEnvironment() []string { return []string{ - "FANOUT_AUTH_CODE_SECRET=0123456789abcdef0123456789abcdef", + "PITOT_AUTH_CODE_SECRET=0123456789abcdef0123456789abcdef", "ANTHROPIC_API_KEY=sk-test", - "FANOUT_SMTP_HOST=smtp.example.com", - "FANOUT_SMTP_USERNAME=user", - "FANOUT_SMTP_PASSWORD=pass", - "FANOUT_SMTP_FROM=Fanout ", + "PITOT_SMTP_HOST=smtp.example.com", + "PITOT_SMTP_USERNAME=user", + "PITOT_SMTP_PASSWORD=pass", + "PITOT_SMTP_FROM=Pitot ", } } @@ -39,9 +39,9 @@ func TestLoadReturnsDefaults(t *testing.T) { func TestLoadTypedEnvironmentValues(t *testing.T) { cfg, err := Load(LoadOptions{Environ: append(validEnvironment(), - "FANOUT_ADDR=:9000", "FANOUT_MCP_ENABLED=false", "FANOUT_METRICS_PUBLIC=true", - "FANOUT_SESSION_IDLE_TTL=10h", "FANOUT_SELF_SIGNUP=true", "FANOUT_RETENTION_DAYS=0", - "FANOUT_ROLLUP_INTERVAL=5m", "FANOUT_MAINTENANCE_INTERVAL=2h", "FANOUT_ALERTS_EVALUATION_INTERVAL=45s", + "PITOT_ADDR=:9000", "PITOT_MCP_ENABLED=false", "PITOT_METRICS_PUBLIC=true", + "PITOT_SESSION_IDLE_TTL=10h", "PITOT_SELF_SIGNUP=true", "PITOT_RETENTION_DAYS=0", + "PITOT_ROLLUP_INTERVAL=5m", "PITOT_MAINTENANCE_INTERVAL=2h", "PITOT_ALERTS_EVALUATION_INTERVAL=45s", )}) if err != nil { t.Fatal(err) @@ -52,7 +52,7 @@ func TestLoadTypedEnvironmentValues(t *testing.T) { } func TestLoadTreatsEmptyEnvironmentValuesAsAbsent(t *testing.T) { - cfg, err := Load(LoadOptions{Environ: append(validEnvironment(), "FANOUT_ADDR=", "FANOUT_MCP_ENABLED=", "FANOUT_RETENTION_DAYS=", "FANOUT_AUTH_CODE_SECRET_FILE=")}) + cfg, err := Load(LoadOptions{Environ: append(validEnvironment(), "PITOT_ADDR=", "PITOT_MCP_ENABLED=", "PITOT_RETENTION_DAYS=", "PITOT_AUTH_CODE_SECRET_FILE=")}) if err != nil { t.Fatal(err) } @@ -77,7 +77,7 @@ func TestConfigurationSchemaUsesUnitBearingDurations(t *testing.T) { } func TestLoadRejectsUnknownAndMalformedEnvironment(t *testing.T) { - for _, entry := range []string{"FANOUT_HTPP_ADDR=:1111", "FANOUT_SERVICE_PORTAL=7520", "FANOUT_ADDR", "FANOUT_ADDR_FILE=/unused", "FANOUT_UNKNOWN_SETTING=synthetic-private-value"} { + for _, entry := range []string{"PITOT_HTPP_ADDR=:1111", "PITOT_SERVICE_PORTAL=7520", "PITOT_ADDR", "PITOT_ADDR_FILE=/unused", "PITOT_UNKNOWN_SETTING=synthetic-private-value"} { _, err := Load(LoadOptions{Environ: append(validEnvironment(), entry)}) name, _, _ := strings.Cut(entry, "=") if err == nil || !strings.Contains(err.Error(), name) || strings.Contains(err.Error(), "synthetic-private-value") { @@ -87,7 +87,7 @@ func TestLoadRejectsUnknownAndMalformedEnvironment(t *testing.T) { } func TestLoadRejectsDuplicateEnvironmentNames(t *testing.T) { - for _, entry := range []string{"FANOUT_ADDR=", "ANTHROPIC_API_KEY=test", "FANOUT_METRICS_TOKEN_FILE="} { + for _, entry := range []string{"PITOT_ADDR=", "ANTHROPIC_API_KEY=test", "PITOT_METRICS_TOKEN_FILE="} { name, _, _ := strings.Cut(entry, "=") _, err := Load(LoadOptions{Environ: []string{entry, entry}}) if err == nil || !strings.Contains(err.Error(), "duplicate") || !strings.Contains(err.Error(), name) { @@ -97,7 +97,7 @@ func TestLoadRejectsDuplicateEnvironmentNames(t *testing.T) { } func TestLoadIgnoresPlatformAndUnrelatedEnvironment(t *testing.T) { - env := append(validEnvironment(), "FANOUT_SERVICE_HOST=10.0.0.1", "FANOUT_SERVICE_PORT=7520", "FANOUT_SERVICE_PORT_HTTP=7520", "FANOUT_PORT=tcp://10.0.0.1:7520", "FANOUT_PORT_7520_TCP_ADDR=10.0.0.1", "OTHER_APP_SETTING=value", "OPENAI_MODEL=other-model") + env := append(validEnvironment(), "PITOT_SERVICE_HOST=10.0.0.1", "PITOT_SERVICE_PORT=7520", "PITOT_SERVICE_PORT_HTTP=7520", "PITOT_PORT=tcp://10.0.0.1:7520", "PITOT_PORT_7520_TCP_ADDR=10.0.0.1", "OTHER_APP_SETTING=value", "OPENAI_MODEL=other-model") if _, err := Load(LoadOptions{Environ: env}); err != nil { t.Fatal(err) } @@ -105,9 +105,9 @@ func TestLoadIgnoresPlatformAndUnrelatedEnvironment(t *testing.T) { func TestLoadRejectsInvalidTypedValuesWithoutLeakingValues(t *testing.T) { for _, entry := range []string{ - "FANOUT_ROLLUP_INTERVAL=private-value", "FANOUT_SMTP_PORT=25.9", "FANOUT_MCP_ENABLED=off", "FANOUT_RETENTION_DAYS=999999999999999999999999999", - "FANOUT_INGEST_BATCH_SIZE=0", "FANOUT_DUCKDB_MAX_CONNECTIONS=-3", "FANOUT_DUCKDB_THREADS=-4", - "FANOUT_ROLLUP_INTERVAL=999ms", "FANOUT_MAINTENANCE_INTERVAL=-5s", "FANOUT_ALERTS_EVALUATION_INTERVAL=0s", + "PITOT_ROLLUP_INTERVAL=private-value", "PITOT_SMTP_PORT=25.9", "PITOT_MCP_ENABLED=off", "PITOT_RETENTION_DAYS=999999999999999999999999999", + "PITOT_INGEST_BATCH_SIZE=0", "PITOT_DUCKDB_MAX_CONNECTIONS=-3", "PITOT_DUCKDB_THREADS=-4", + "PITOT_ROLLUP_INTERVAL=999ms", "PITOT_MAINTENANCE_INTERVAL=-5s", "PITOT_ALERTS_EVALUATION_INTERVAL=0s", } { env := validEnvironment() name, _, _ := strings.Cut(entry, "=") @@ -126,7 +126,7 @@ func TestLoadRejectsInvalidTypedValuesWithoutLeakingValues(t *testing.T) { func TestLoadIgnoresDotenvInputs(t *testing.T) { dir := t.TempDir() - if err := os.WriteFile(filepath.Join(dir, ".env"), []byte("FANOUT_ADDR=:9999\n"), 0o600); err != nil { + if err := os.WriteFile(filepath.Join(dir, ".env"), []byte("PITOT_ADDR=:9999\n"), 0o600); err != nil { t.Fatal(err) } t.Chdir(dir) @@ -140,7 +140,7 @@ func TestLoadIgnoresDotenvInputs(t *testing.T) { } func TestLoadSecretFiles(t *testing.T) { - names := []string{"FANOUT_AUTH_CODE_SECRET", "FANOUT_OIDC_CLIENT_SECRET", "FANOUT_SMTP_PASSWORD", "FANOUT_METRICS_TOKEN", "ANTHROPIC_API_KEY", "OPENAI_API_KEY"} + names := []string{"PITOT_AUTH_CODE_SECRET", "PITOT_OIDC_CLIENT_SECRET", "PITOT_SMTP_PASSWORD", "PITOT_METRICS_TOKEN", "ANTHROPIC_API_KEY", "OPENAI_API_KEY"} specs, err := configFieldSpecs() if err != nil { t.Fatal(err) @@ -169,7 +169,7 @@ func TestLoadSecretFiles(t *testing.T) { } env = append(env, name+"=", name+"_FILE="+path) if provider := providerForEnvironment(name); provider != "" { - env = append(env, "FANOUT_AI_PROVIDER="+provider) + env = append(env, "PITOT_AI_PROVIDER="+provider) } cfg, err := Load(LoadOptions{Environ: env}) if err != nil { @@ -187,7 +187,7 @@ func TestLoadSecretFiles(t *testing.T) { } func TestLoadRejectsConflictingOrInvalidSecretFiles(t *testing.T) { - const name = "FANOUT_METRICS_TOKEN" + const name = "PITOT_METRICS_TOKEN" const secret = "synthetic-private-value" path := filepath.Join(t.TempDir(), "secret") for _, content := range []string{"", "\n", "\r\n", secret} { @@ -213,7 +213,7 @@ func TestLoadRejectsConflictingOrInvalidSecretFiles(t *testing.T) { func TestMCPResourceURL(t *testing.T) { for _, tc := range []struct{ publicURL, want string }{ - {"", "https://localhost:7520/mcp"}, {"https://fanout.example.com", "https://fanout.example.com/mcp"}, {" https://fanout.example.com/ ", "https://fanout.example.com/mcp"}, + {"", "https://localhost:7520/mcp"}, {"https://pitot.example.com", "https://pitot.example.com/mcp"}, {" https://pitot.example.com/ ", "https://pitot.example.com/mcp"}, } { if got := (Config{PublicURL: tc.publicURL}).MCPResourceURL(); got != tc.want { t.Fatalf("MCPResourceURL = %s, want %s", got, tc.want) @@ -238,7 +238,7 @@ func TestValidate(t *testing.T) { SMTPPort: 587, SMTPUser: "user", SMTPPass: "pass", - SMTPFrom: "Fanout ", + SMTPFrom: "Pitot ", AuthMode: "local", AuthCodeSecret: "0123456789abcdef0123456789abcdef", SessionIdleTTL: 12 * time.Hour, @@ -283,7 +283,7 @@ func TestValidate(t *testing.T) { c.OIDCIssuerURL = "https://id.example.com" c.OIDCClientID = "client" c.OIDCClientSecret = "secret" - c.PublicURL = "https://fanout.example.com" + c.PublicURL = "https://pitot.example.com" }}, {"session idle zero", func(c *Config) { c.SessionIdleTTL = 0 }}, {"session idle too short", func(c *Config) { c.SessionIdleTTL = time.Minute }}, @@ -345,12 +345,12 @@ func TestValidate(t *testing.T) { c.AuthCodeSecret = "" c.SMTPHost, c.SMTPUser, c.SMTPPass, c.SMTPFrom = "", "", "", "" c.OIDCIssuerURL = "https://id.example.com" - c.OIDCClientID = "fanout" + c.OIDCClientID = "pitot" c.OIDCClientSecret = "secret" c.OIDCEmailClaim = "email" c.OIDCEmailVerification = "required" c.OIDCDefaultRole = "viewer" - c.PublicURL = "https://fanout.example.com" + c.PublicURL = "https://pitot.example.com" if err := c.Validate(); err != nil { t.Fatalf("OIDC config should pass: %v", err) } @@ -360,19 +360,19 @@ func TestValidate(t *testing.T) { c := valid c.AuthMode = "oidc" c.OIDCIssuerURL = "https://id.example.com" - c.OIDCClientID = "fanout" + c.OIDCClientID = "pitot" c.OIDCClientSecret = "secret" c.OIDCEmailClaim = "email" c.OIDCEmailVerification = "required" c.OIDCDefaultRole = "viewer" - c.PublicURL = "https://fanout.example.com" + c.PublicURL = "https://pitot.example.com" for _, secret := range []string{"", "short"} { c.AuthCodeSecret = secret if err := c.Validate(); err != nil { t.Fatalf("secret %q should not fail OIDC startup: %v", secret, err) } err := c.ValidateLoginLinkSecret() - if err == nil || !strings.Contains(err.Error(), "FANOUT_AUTH_CODE_SECRET") { + if err == nil || !strings.Contains(err.Error(), "PITOT_AUTH_CODE_SECRET") { t.Fatalf("secret %q: ValidateLoginLinkSecret = %v, want an error naming the variable", secret, err) } } @@ -387,14 +387,14 @@ func TestValidate(t *testing.T) { c.AuthMode = "oidc" c.AuthCodeSecret = "" c.OIDCIssuerURL = "https://id.example.com" - c.OIDCClientID = "fanout" + c.OIDCClientID = "pitot" c.OIDCClientSecret = "secret" c.OIDCEmailClaim = "email" c.OIDCEmailVerification = "required" c.OIDCAutoProvision = true c.OIDCAllowedDomains = "*" c.OIDCDefaultRole = "viewer" - c.PublicURL = "https://fanout.example.com" + c.PublicURL = "https://pitot.example.com" if err := c.Validate(); err != nil { t.Fatalf("verified email wildcard should pass: %v", err) } @@ -408,23 +408,23 @@ func TestValidate(t *testing.T) { t.Run("MCP derives its HTTPS resource from the public origin", func(t *testing.T) { c := valid c.MCPEnabled = true - c.PublicURL = "https://fanout.example.com" + c.PublicURL = "https://pitot.example.com" if err := c.Validate(); err != nil { t.Fatalf("HTTPS public origin should pass: %v", err) } - if got := c.MCPResourceURL(); got != "https://fanout.example.com/mcp" { + if got := c.MCPResourceURL(); got != "https://pitot.example.com/mcp" { t.Fatalf("MCPResourceURL() = %q", got) } for _, invalid := range []string{ - "http://fanout.example.com", - "https://user@fanout.example.com", - "https://fanout.example.com/base", - "https://fanout.example.com?tenant=one", + "http://pitot.example.com", + "https://user@pitot.example.com", + "https://pitot.example.com/base", + "https://pitot.example.com?tenant=one", } { c.PublicURL = invalid if err := c.Validate(); err == nil { - t.Errorf("FANOUT_PUBLIC_URL %q should be rejected with MCP enabled", invalid) + t.Errorf("PITOT_PUBLIC_URL %q should be rejected with MCP enabled", invalid) } } }) @@ -440,7 +440,7 @@ func TestValidate(t *testing.T) { t.Error("TLSEnabled = false, want true") } if c.ClientCertificatesRequired() { - t.Error("ClientCertificatesRequired = true without FANOUT_TLS_CLIENT_CA_FILE") + t.Error("ClientCertificatesRequired = true without PITOT_TLS_CLIENT_CA_FILE") } }) @@ -469,16 +469,16 @@ func TestFieldSpecsRejectInvalidSchemas(t *testing.T) { { name: "secret file name collision", typ: reflect.TypeOf(struct { - A string `env:"FANOUT_SECRET" secret:"true"` - B string `env:"FANOUT_SECRET_FILE"` + A string `env:"PITOT_SECRET" secret:"true"` + B string `env:"PITOT_SECRET_FILE"` }{}), want: "share environment variable", }, { name: "duplicate environment", typ: reflect.TypeOf(struct { - A string `env:"FANOUT_SAME"` - B string `env:"FANOUT_SAME"` + A string `env:"PITOT_SAME"` + B string `env:"PITOT_SAME"` }{}), want: "share environment variable", }, @@ -514,8 +514,8 @@ func TestSecureCookies(t *testing.T) { want bool }{ {name: "plain HTTP", cfg: Config{}, want: false}, - {name: "external HTTPS", cfg: Config{PublicURL: "https://fanout.example.com"}, want: true}, - {name: "external HTTP", cfg: Config{PublicURL: "http://fanout.example.com"}, want: false}, + {name: "external HTTPS", cfg: Config{PublicURL: "https://pitot.example.com"}, want: true}, + {name: "external HTTP", cfg: Config{PublicURL: "http://pitot.example.com"}, want: false}, {name: "local TLS", cfg: Config{TLSCertFile: "server.pem", TLSKeyFile: "server-key.pem"}, want: true}, } for _, tc := range cases { @@ -528,7 +528,7 @@ func TestSecureCookies(t *testing.T) { } func TestLogStartupWarnsWhenNoPathCanAddUsers(t *testing.T) { - const group = "fanout-admins-group-name" + const group = "pitot-admins-group-name" const token = "scim-token-value-0123456789abcdef0123" for _, tc := range []struct { name string @@ -552,7 +552,7 @@ func TestLogStartupWarnsWhenNoPathCanAddUsers(t *testing.T) { tc.cfg.LogStartup() output := logs.String() - if got := strings.Contains(output, "FANOUT_OIDC_AUTO_PROVISION"); got != tc.want { + if got := strings.Contains(output, "PITOT_OIDC_AUTO_PROVISION"); got != tc.want { t.Fatalf("warning present = %v, want %v; logs: %s", got, tc.want, output) } if strings.Contains(output, group) || strings.Contains(output, token) { @@ -565,12 +565,12 @@ func TestLogStartupWarnsWhenNoPathCanAddUsers(t *testing.T) { // The combination is a warning so that existing installations still start. func TestLoadAcceptsRoleMappingWithoutProvisioning(t *testing.T) { env := append(validEnvironment(), - "FANOUT_AUTH_MODE=oidc", - "FANOUT_OIDC_ISSUER_URL=https://issuer.example.com", - "FANOUT_OIDC_CLIENT_ID=client", - "FANOUT_OIDC_CLIENT_SECRET=secret", - "FANOUT_PUBLIC_URL=https://fanout.example.com", - "FANOUT_OIDC_ADMIN_GROUPS=fanout-admins", + "PITOT_AUTH_MODE=oidc", + "PITOT_OIDC_ISSUER_URL=https://issuer.example.com", + "PITOT_OIDC_CLIENT_ID=client", + "PITOT_OIDC_CLIENT_SECRET=secret", + "PITOT_PUBLIC_URL=https://pitot.example.com", + "PITOT_OIDC_ADMIN_GROUPS=pitot-admins", ) cfg, err := Load(LoadOptions{Environ: env}) if err != nil { @@ -604,7 +604,7 @@ func TestLogStartupWarnsAboutUnusableBreakGlassSecret(t *testing.T) { Config{AuthMode: tc.mode, AuthCodeSecret: tc.secret}.LogStartup() output := logs.String() - got := strings.Contains(output, "FANOUT_AUTH_CODE_SECRET") && strings.Contains(output, "break-glass") + got := strings.Contains(output, "PITOT_AUTH_CODE_SECRET") && strings.Contains(output, "break-glass") if got != tc.want { t.Fatalf("warning present = %v, want %v; logs: %s", got, tc.want, output) } @@ -616,7 +616,7 @@ func TestLogStartupWarnsAboutUnusableBreakGlassSecret(t *testing.T) { } func TestLoadIngestToken(t *testing.T) { - const name = "FANOUT_INGEST_TOKEN" + const name = "PITOT_INGEST_TOKEN" valid := "foi_" + strings.Repeat("A", 43) t.Run("absent by default", func(t *testing.T) { @@ -693,7 +693,7 @@ func TestLoadIngestToken(t *testing.T) { } func TestAlertEmailSettings(t *testing.T) { - cfg, err := Load(LoadOptions{Environ: append(validEnvironment(), "FANOUT_ALERTS_EMAIL_DEFAULT_TO=Oncall@example.com, b@example.com")}) + cfg, err := Load(LoadOptions{Environ: append(validEnvironment(), "PITOT_ALERTS_EMAIL_DEFAULT_TO=Oncall@example.com, b@example.com")}) if err != nil { t.Fatal(err) } @@ -710,9 +710,9 @@ func TestAlertEmailSettings(t *testing.T) { env []string want string }{ - {"invalid address", append(validEnvironment(), "FANOUT_ALERTS_EMAIL_DEFAULT_TO=nope"), "FANOUT_ALERTS_EMAIL_DEFAULT_TO"}, - {"negative limit", append(validEnvironment(), "FANOUT_ALERTS_EMAIL_HOURLY_LIMIT=-1"), "FANOUT_ALERTS_EMAIL_HOURLY_LIMIT"}, - {"no SMTP", []string{"FANOUT_AUTH_CODE_SECRET=0123456789abcdef0123456789abcdef", "ANTHROPIC_API_KEY=sk-test", "FANOUT_ALERTS_EMAIL_DEFAULT_TO=a@example.com"}, "requires SMTP"}, + {"invalid address", append(validEnvironment(), "PITOT_ALERTS_EMAIL_DEFAULT_TO=nope"), "PITOT_ALERTS_EMAIL_DEFAULT_TO"}, + {"negative limit", append(validEnvironment(), "PITOT_ALERTS_EMAIL_HOURLY_LIMIT=-1"), "PITOT_ALERTS_EMAIL_HOURLY_LIMIT"}, + {"no SMTP", []string{"PITOT_AUTH_CODE_SECRET=0123456789abcdef0123456789abcdef", "ANTHROPIC_API_KEY=sk-test", "PITOT_ALERTS_EMAIL_DEFAULT_TO=a@example.com"}, "requires SMTP"}, } { t.Run(tc.name, func(t *testing.T) { if _, err := Load(LoadOptions{Environ: tc.env}); err == nil || !strings.Contains(err.Error(), tc.want) { @@ -723,14 +723,14 @@ func TestAlertEmailSettings(t *testing.T) { } func TestLoadSCIMToken(t *testing.T) { - const name = "FANOUT_SCIM_TOKEN" + const name = "PITOT_SCIM_TOKEN" valid := strings.Repeat("s", 32) oidc := append(validEnvironment(), - "FANOUT_AUTH_MODE=oidc", - "FANOUT_OIDC_ISSUER_URL=https://issuer.example.com", - "FANOUT_OIDC_CLIENT_ID=client", - "FANOUT_OIDC_CLIENT_SECRET=secret", - "FANOUT_PUBLIC_URL=https://fanout.example.com", + "PITOT_AUTH_MODE=oidc", + "PITOT_OIDC_ISSUER_URL=https://issuer.example.com", + "PITOT_OIDC_CLIENT_ID=client", + "PITOT_OIDC_CLIENT_SECRET=secret", + "PITOT_PUBLIC_URL=https://pitot.example.com", ) t.Run("absent by default", func(t *testing.T) { @@ -769,7 +769,7 @@ func TestLoadSCIMToken(t *testing.T) { t.Run("requires OIDC mode", func(t *testing.T) { _, err := Load(LoadOptions{Environ: append(validEnvironment(), name+"="+valid)}) - if err == nil || !strings.Contains(err.Error(), "FANOUT_AUTH_MODE=oidc") { + if err == nil || !strings.Contains(err.Error(), "PITOT_AUTH_MODE=oidc") { t.Fatalf("Load = %v", err) } }) @@ -783,3 +783,96 @@ func TestLoadSCIMToken(t *testing.T) { }) } } + +func TestLegacyEnvironmentCompatibility(t *testing.T) { + for _, test := range []struct { + name string + env []string + want string + warnings int + }{ + {"fallback", []string{"FANOUT_ADDR=:9001", "FANOUT_RETENTION_DAYS=9"}, ":9001", 1}, + {"primary wins", []string{"FANOUT_ADDR=:9001", "PITOT_ADDR=:9002"}, ":9002", 0}, + {"empty primary blocks fallback", []string{"FANOUT_ADDR=:9001", "PITOT_ADDR="}, DefaultAddr, 0}, + {"empty legacy uses default", []string{"FANOUT_ADDR="}, DefaultAddr, 0}, + } { + t.Run(test.name, func(t *testing.T) { + var logs bytes.Buffer + previous := slog.Default() + slog.SetDefault(slog.New(slog.NewTextHandler(&logs, nil))) + t.Cleanup(func() { slog.SetDefault(previous) }) + cfg, err := Load(LoadOptions{Environ: append(validEnvironment(), test.env...)}) + if err != nil { + t.Fatal(err) + } + if cfg.Addr != test.want { + t.Fatalf("address = %q, want %q", cfg.Addr, test.want) + } + if strings.Count(logs.String(), "deprecated environment variables") != test.warnings { + t.Fatalf("unexpected warning count: %s", logs.String()) + } + if test.warnings > 0 && !strings.Contains(logs.String(), "FANOUT_ADDR, FANOUT_RETENTION_DAYS") { + t.Fatal("warning must list every used name") + } + if strings.Contains(logs.String(), ":9001") { + t.Fatal("warning leaked a value") + } + }) + } +} + +func TestLegacySecretFileCompatibility(t *testing.T) { + path := filepath.Join(t.TempDir(), "auth-secret") + value := strings.Repeat("z", 32) + if err := os.WriteFile(path, []byte(value+"\n"), 0600); err != nil { + t.Fatal(err) + } + var logs bytes.Buffer + previous := slog.Default() + slog.SetDefault(slog.New(slog.NewTextHandler(&logs, nil))) + t.Cleanup(func() { slog.SetDefault(previous) }) + cfg, err := Load(LoadOptions{Environ: []string{"FANOUT_AUTH_CODE_SECRET_FILE=" + path}}) + if err != nil { + t.Fatal(err) + } + if cfg.AuthCodeSecret != value { + t.Fatal("legacy secret file was not loaded") + } + if !strings.Contains(logs.String(), "FANOUT_AUTH_CODE_SECRET_FILE") || strings.Contains(logs.String(), path) || strings.Contains(logs.String(), value) { + t.Fatal("warning must contain only the variable name") + } + _, err = Load(LoadOptions{Environ: []string{"FANOUT_AUTH_CODE_SECRET_FILE=" + path, "PITOT_AUTH_CODE_SECRET=" + value}}) + if err == nil { + t.Fatal("mixed value and file forms must still conflict") + } +} + +func TestLegacySchemaAliasesCoverEveryOwnedSetting(t *testing.T) { + specs, err := configFieldSpecs() + if err != nil { + t.Fatal(err) + } + for _, spec := range specs { + if !strings.HasPrefix(spec.env, "PITOT_") { + continue + } + names := []string{spec.env} + if spec.secret { + names = append(names, spec.env+"_FILE") + } + for _, name := range names { + legacy := strings.Replace(name, "PITOT_", "FANOUT_", 1) + got := ResolveEnvironment([]string{legacy + "="}) + if !reflect.DeepEqual(got, []string{name + "="}) { + t.Fatalf("alias missing for %s", name) + } + } + } +} + +func TestControlDatabaseKeepsLegacyFilename(t *testing.T) { + cfg := Config{DataDir: t.TempDir()} + if filepath.Base(cfg.ControlSQLitePath()) != "fanout.sqlite" { + t.Fatal("rename must preserve the existing control database") + } +} diff --git a/internal/config/loader.go b/internal/config/loader.go index 1398f19ab..b7e35795c 100644 --- a/internal/config/loader.go +++ b/internal/config/loader.go @@ -2,6 +2,7 @@ package config import ( "fmt" + "log/slog" "os" "reflect" "sort" @@ -48,14 +49,14 @@ func Load(options LoadOptions) (Config, error) { if environ == nil { environ = os.Environ() } - values, err := environmentValues(environ, known) + values, err := environmentValues(ResolveEnvironment(environ), known) if err != nil { return Config{}, err } for _, spec := range specs { // Shared vendor settings, including secret mounts, belong only to the - // explicitly selected provider. Fanout-owned secrets always resolve. - if provider := providerForEnvironment(spec.env); provider != "" && provider != values["FANOUT_AI_PROVIDER"] { + // explicitly selected provider. Pitot-owned secrets always resolve. + if provider := providerForEnvironment(spec.env); provider != "" && provider != values["PITOT_AI_PROVIDER"] { continue } text := values[spec.env] @@ -97,6 +98,42 @@ func Load(options LoadOptions) (Config, error) { return cfg, nil } +// ResolveEnvironment provides the one-alpha-release legacy environment bridge. +// Presence, including an empty value, takes precedence over the old spelling. +// It reports only names, never values or secret file paths. +func ResolveEnvironment(environ []string) []string { + present := make(map[string]bool, len(environ)) + for _, assignment := range environ { + name, _, _ := strings.Cut(assignment, "=") + present[name] = true + } + resolved := make([]string, 0, len(environ)) + var used []string + for _, assignment := range environ { + name, value, found := strings.Cut(assignment, "=") + if strings.HasPrefix(name, "FANOUT_") { + primary := "PITOT_" + strings.TrimPrefix(name, "FANOUT_") + if present[primary] { + continue + } + if value != "" && !isPlatformInjectedEnvironment(primary) { + used = append(used, name) + } + name = primary + } + if found { + resolved = append(resolved, name+"="+value) + } else { + resolved = append(resolved, name) + } + } + if len(used) > 0 { + sort.Strings(used) + slog.Warn("deprecated environment variables; use PITOT_ equivalents before the next alpha release", "names", strings.Join(used, ", ")) + } + return resolved +} + func configFieldSpecs() ([]fieldSpec, error) { return fieldSpecs(reflect.TypeOf(Config{})) } @@ -116,7 +153,7 @@ func fieldSpecs(typ reflect.Type) ([]fieldSpec, error) { if name == "" { return nil, fmt.Errorf("configuration field %s must declare an env tag", field.Name) } - if !strings.HasPrefix(name, "FANOUT_") && providerForEnvironment(name) == "" { + if !strings.HasPrefix(name, "PITOT_") && providerForEnvironment(name) == "" { return nil, fmt.Errorf("environment variable %s is outside the supported configuration contract", name) } secret := field.Tag.Get("secret") == "true" @@ -157,7 +194,7 @@ func environmentValues(environ []string, known map[string]bool) (map[string]stri for _, assignment := range environ { name, value, found := strings.Cut(assignment, "=") isKnown := known[name] - if !isKnown && (!strings.HasPrefix(name, "FANOUT_") || isPlatformInjectedEnvironment(name)) { + if !isKnown && (!strings.HasPrefix(name, "PITOT_") || isPlatformInjectedEnvironment(name)) { continue } if !found { @@ -174,17 +211,17 @@ func environmentValues(environ []string, known map[string]bool) (map[string]stri } if len(unknown) > 0 { sort.Strings(unknown) - return nil, fmt.Errorf("unknown Fanout environment variables: %s", strings.Join(unknown, ", ")) + return nil, fmt.Errorf("unknown Pitot environment variables: %s", strings.Join(unknown, ", ")) } return values, nil } func isPlatformInjectedEnvironment(name string) bool { - return name == "FANOUT_SERVICE_HOST" || - name == "FANOUT_SERVICE_PORT" || - strings.HasPrefix(name, "FANOUT_SERVICE_PORT_") || - name == "FANOUT_PORT" || - strings.HasPrefix(name, "FANOUT_PORT_") + return name == "PITOT_SERVICE_HOST" || + name == "PITOT_SERVICE_PORT" || + strings.HasPrefix(name, "PITOT_SERVICE_PORT_") || + name == "PITOT_PORT" || + strings.HasPrefix(name, "PITOT_PORT_") } func parseTextValue(value string, typ reflect.Type) (any, error) { diff --git a/internal/config/pinned_memory_test.go b/internal/config/pinned_memory_test.go index 29826aa48..6fb2d73ba 100644 --- a/internal/config/pinned_memory_test.go +++ b/internal/config/pinned_memory_test.go @@ -2,7 +2,7 @@ package config import "testing" -// Pinning FANOUT_DUCKDB_MEMORY skips detection entirely, so nothing compares +// Pinning PITOT_DUCKDB_MEMORY skips detection entirely, so nothing compares // the value to the machine. Both production deployments pinned 4GB on 8 GiB // hosts and were OOM-killed repeatedly: DuckDB's budget is not the process's // budget, and the Go runtime, the ingest appender and compaction's merges all diff --git a/internal/config/provider_test.go b/internal/config/provider_test.go index 5096a3307..2325b3778 100644 --- a/internal/config/provider_test.go +++ b/internal/config/provider_test.go @@ -31,7 +31,7 @@ func TestLoadIgnoresInactiveProviderSecretFiles(t *testing.T) { } { for _, bothSet := range []bool{false, true} { t.Run(fmt.Sprintf("%s/%s/%s/both_set=%t", provider, vendor, file.name, bothSet), func(t *testing.T) { - env := []string{"FANOUT_AUTH_CODE_SECRET=" + strings.Repeat("x", 32), "FANOUT_AI_PROVIDER=" + provider} + env := []string{"PITOT_AUTH_CODE_SECRET=" + strings.Repeat("x", 32), "PITOT_AI_PROVIDER=" + provider} if provider != "" { env = append(env, strings.ToUpper(provider)+"_API_KEY=selected-key") } @@ -62,7 +62,7 @@ func TestLoadRejectsSelectedProviderSecretFileErrors(t *testing.T) { name := strings.ToUpper(provider) + "_API_KEY" path := filepath.Join(t.TempDir(), "missing") env := []string{ - "FANOUT_AUTH_CODE_SECRET=" + strings.Repeat("x", 32), "FANOUT_AI_PROVIDER=" + provider, + "PITOT_AUTH_CODE_SECRET=" + strings.Repeat("x", 32), "PITOT_AI_PROVIDER=" + provider, name + "_FILE=" + path, } if bothSet { @@ -92,7 +92,7 @@ func TestLoadSelectsProviderCredentials(t *testing.T) { {"openai default endpoint", "openai", "openai-test", DefaultOpenAIBaseURL, []string{"OPENAI_API_KEY=openai-test", "ANTHROPIC_BASE_URL=not-used"}}, } { t.Run(tc.name, func(t *testing.T) { - env := []string{"FANOUT_AUTH_CODE_SECRET=" + strings.Repeat("x", 32), "FANOUT_AI_PROVIDER=" + tc.provider} + env := []string{"PITOT_AUTH_CODE_SECRET=" + strings.Repeat("x", 32), "PITOT_AI_PROVIDER=" + tc.provider} cfg, err := Load(LoadOptions{Environ: append(env, tc.credentials...)}) if err != nil { t.Fatal(err) @@ -106,9 +106,9 @@ func TestLoadSelectsProviderCredentials(t *testing.T) { func TestLoadIgnoresOtherVendorEnvironment(t *testing.T) { cfg, err := Load(LoadOptions{Environ: []string{ - "FANOUT_AUTH_CODE_SECRET=" + strings.Repeat("x", 32), - "FANOUT_AI_PROVIDER=openai", "OPENAI_API_KEY=openai-env", - "OPENAI_BASE_URL=https://gateway.example/api/v1/", "FANOUT_AI_MODEL=configured-model", + "PITOT_AUTH_CODE_SECRET=" + strings.Repeat("x", 32), + "PITOT_AI_PROVIDER=openai", "OPENAI_API_KEY=openai-env", + "OPENAI_BASE_URL=https://gateway.example/api/v1/", "PITOT_AI_MODEL=configured-model", "ANTHROPIC_API_KEY=", "ANTHROPIC_BASE_URL=", "OPENAI_MODEL=unrelated-tool", "ANTHROPIC_MODEL=unrelated-tool", "OPENAI_PROJECT_ID=another-consumer", "ANTHROPIC_AUTH_TOKEN=another-consumer", @@ -125,7 +125,7 @@ func TestLoadRejectsInvalidProviderURLWithoutLeakingValues(t *testing.T) { for _, provider := range []string{"anthropic", "openai"} { name := strings.ToUpper(provider) + "_BASE_URL" for _, value := range []string{"file:///private", "https://user:private-value@example.com", "https://example.com?key=private-value", "https://example.com#private-value", "https://example.com?", "https://example.com#", "https://", "https://example.com/%zz"} { - _, err := Load(LoadOptions{Environ: []string{"FANOUT_AUTH_CODE_SECRET=" + strings.Repeat("x", 32), "FANOUT_AI_PROVIDER=" + provider, strings.ToUpper(provider) + "_API_KEY=test-key", name + "=" + value}}) + _, err := Load(LoadOptions{Environ: []string{"PITOT_AUTH_CODE_SECRET=" + strings.Repeat("x", 32), "PITOT_AI_PROVIDER=" + provider, strings.ToUpper(provider) + "_API_KEY=test-key", name + "=" + value}}) if err == nil || !strings.Contains(err.Error(), name) || strings.Contains(err.Error(), value) || strings.Contains(err.Error(), "private-value") { t.Fatalf("expected redacted validation error naming %s", name) } @@ -135,8 +135,8 @@ func TestLoadRejectsInvalidProviderURLWithoutLeakingValues(t *testing.T) { func TestLoadRejectsUnsupportedProviderWithoutAKey(t *testing.T) { for _, provider := range []string{"unsupported", "OpenAI", " OpenAI ", " openai ", "Anthropic"} { - _, err := Load(LoadOptions{Environ: []string{"FANOUT_AUTH_CODE_SECRET=" + strings.Repeat("x", 32), "FANOUT_AI_PROVIDER=" + provider}}) - if err == nil || !strings.Contains(err.Error(), "FANOUT_AI_PROVIDER") { + _, err := Load(LoadOptions{Environ: []string{"PITOT_AUTH_CODE_SECRET=" + strings.Repeat("x", 32), "PITOT_AI_PROVIDER=" + provider}}) + if err == nil || !strings.Contains(err.Error(), "PITOT_AI_PROVIDER") { t.Fatal("unsupported provider must fail at startup, even without a key") } } @@ -151,7 +151,7 @@ func TestLoadRequiresSelectedProviderKey(t *testing.T) { for _, value := range []string{"", " "} { name := strings.ToUpper(provider) + "_API_KEY" _, err := Load(LoadOptions{Environ: []string{ - "FANOUT_AUTH_CODE_SECRET=" + strings.Repeat("x", 32), "FANOUT_AI_PROVIDER=" + provider, + "PITOT_AUTH_CODE_SECRET=" + strings.Repeat("x", 32), "PITOT_AI_PROVIDER=" + provider, name + "=" + value, otherKey + "=other-provider-key", }}) if err == nil || !strings.Contains(err.Error(), name) { diff --git a/internal/config/sizing.go b/internal/config/sizing.go index 30def46ac..d42a541f7 100644 --- a/internal/config/sizing.go +++ b/internal/config/sizing.go @@ -186,13 +186,13 @@ func (c Config) logResolvedSizing(src sizingSource) { "query_cache_max_bytes", QueryCacheMaxBytes, ) if src.MemoryAuto && src.MemoryDetectionIncomplete { - slog.Warn("memory limit detection was incomplete; automatic DuckDB sizing may exceed a container limit — configure FANOUT_DUCKDB_MEMORY explicitly", + slog.Warn("memory limit detection was incomplete; automatic DuckDB sizing may exceed a container limit — configure PITOT_DUCKDB_MEMORY explicitly", "memory_source", src.MemorySource, "detected_memory_bytes", src.DetectedRAM, ) } if src.MemoryAuto && c.DuckDBMemory == "" { - slog.Warn("could not detect available memory; DuckDB will size itself to 80% of RAM, which can exceed the machine once the Go runtime is added — configure FANOUT_DUCKDB_MEMORY explicitly") + slog.Warn("could not detect available memory; DuckDB will size itself to 80% of RAM, which can exceed the machine once the Go runtime is added — configure PITOT_DUCKDB_MEMORY explicitly") } // A pinned budget skipped detection, so this is the only place it is ever // compared to the machine it will run on. @@ -226,7 +226,7 @@ func resolveDuckDBMemory(available uint64) string { // pinnedMemoryConcern reports why an operator-pinned DuckDB budget looks wrong // for this machine, or "" when it looks fine or cannot be judged. // -// Pinning FANOUT_DUCKDB_MEMORY skips detection entirely (resolveSizing only +// Pinning PITOT_DUCKDB_MEMORY skips detection entirely (resolveSizing only // fills a value that is empty), so without this nothing ever compares the // figure to the machine it will run on. DuckDB's budget is not the process's // budget: the Go heap, the ingest appender and compaction's merges all sit on @@ -244,14 +244,14 @@ func pinnedMemoryConcern(pinned string, detectedRAM uint64) string { } budget, ok := parseByteSize(pinned) if !ok { - return fmt.Sprintf("FANOUT_DUCKDB_MEMORY %q could not be parsed as a size; DuckDB may reject it or fall back to its own default", pinned) + return fmt.Sprintf("PITOT_DUCKDB_MEMORY %q could not be parsed as a size; DuckDB may reject it or fall back to its own default", pinned) } if budget >= detectedRAM { - return fmt.Sprintf("FANOUT_DUCKDB_MEMORY %q is at or above the %d bytes detected for this machine; the Go runtime and compaction allocate on top of it", pinned, detectedRAM) + return fmt.Sprintf("PITOT_DUCKDB_MEMORY %q is at or above the %d bytes detected for this machine; the Go runtime and compaction allocate on top of it", pinned, detectedRAM) } share := detectedRAM / 100 * duckDBMemoryPercent if budget > share { - return fmt.Sprintf("FANOUT_DUCKDB_MEMORY %q takes more than the %d%% of %d bytes automatic sizing would leave DuckDB; the remainder has to cover the Go heap, the ingest appender and compaction merges", pinned, duckDBMemoryPercent, detectedRAM) + return fmt.Sprintf("PITOT_DUCKDB_MEMORY %q takes more than the %d%% of %d bytes automatic sizing would leave DuckDB; the remainder has to cover the Go heap, the ingest appender and compaction merges", pinned, duckDBMemoryPercent, detectedRAM) } return "" } @@ -385,7 +385,7 @@ type cgroupMount struct { // detectCgroupMemoryLimitDetailed finds the process's actual memory cgroup from procfs // and walks toward the controller mount, taking the tightest finite limit. A -// service such as systemd's fanout.service normally lives below the mount root; +// service such as systemd's pitot.service normally lives below the mount root; // reading only /sys/fs/cgroup/memory.max would inspect the host, not the service. func detectCgroupMemoryLimitDetailed(cgroupPath, mountInfoPath string) (uint64, bool, error) { if _, err := os.ReadFile(cgroupPath); err != nil { diff --git a/internal/config/sizing_test.go b/internal/config/sizing_test.go index b201e773c..53203c1f3 100644 --- a/internal/config/sizing_test.go +++ b/internal/config/sizing_test.go @@ -129,7 +129,7 @@ func TestDetailedCgroupDetectionReportsUnreadableMetadata(t *testing.T) { func TestDetectCgroupV2MemoryLimitUsesTheProcessCgroup(t *testing.T) { mountPoint := t.TempDir() - processDir := filepath.Join(mountPoint, "system.slice", "fanout.service") + processDir := filepath.Join(mountPoint, "system.slice", "pitot.service") if err := os.MkdirAll(processDir, 0o755); err != nil { t.Fatal(err) } @@ -138,7 +138,7 @@ func TestDetectCgroupV2MemoryLimitUsesTheProcessCgroup(t *testing.T) { procDir := t.TempDir() cgroupPath := filepath.Join(procDir, "cgroup") mountInfoPath := filepath.Join(procDir, "mountinfo") - writeTestFile(t, cgroupPath, "0::/system.slice/fanout.service\n") + writeTestFile(t, cgroupPath, "0::/system.slice/pitot.service\n") writeTestFile(t, mountInfoPath, fmt.Sprintf( "36 25 0:32 / %s rw,nosuid,nodev,noexec,relatime - cgroup2 cgroup rw\n", mountPoint, @@ -151,7 +151,7 @@ func TestDetectCgroupV2MemoryLimitUsesTheProcessCgroup(t *testing.T) { func TestDetectCgroupMemoryLimitUsesTheTightestAncestor(t *testing.T) { mountPoint := t.TempDir() - processDir := filepath.Join(mountPoint, "tenant", "fanout") + processDir := filepath.Join(mountPoint, "tenant", "pitot") if err := os.MkdirAll(processDir, 0o755); err != nil { t.Fatal(err) } @@ -162,7 +162,7 @@ func TestDetectCgroupMemoryLimitUsesTheTightestAncestor(t *testing.T) { procDir := t.TempDir() cgroupPath := filepath.Join(procDir, "cgroup") mountInfoPath := filepath.Join(procDir, "mountinfo") - writeTestFile(t, cgroupPath, "0::/tenant/fanout\n") + writeTestFile(t, cgroupPath, "0::/tenant/pitot\n") writeTestFile(t, mountInfoPath, fmt.Sprintf( "36 25 0:32 / %s rw - cgroup2 cgroup rw\n", mountPoint, @@ -175,7 +175,7 @@ func TestDetectCgroupMemoryLimitUsesTheTightestAncestor(t *testing.T) { func TestDetectCgroupV1MemoryLimitHonorsTheMountRoot(t *testing.T) { mountPoint := t.TempDir() - processDir := filepath.Join(mountPoint, "fanout") + processDir := filepath.Join(mountPoint, "pitot") if err := os.MkdirAll(processDir, 0o755); err != nil { t.Fatal(err) } @@ -184,7 +184,7 @@ func TestDetectCgroupV1MemoryLimitHonorsTheMountRoot(t *testing.T) { procDir := t.TempDir() cgroupPath := filepath.Join(procDir, "cgroup") mountInfoPath := filepath.Join(procDir, "mountinfo") - writeTestFile(t, cgroupPath, "5:cpu,memory:/docker/abc/fanout\n") + writeTestFile(t, cgroupPath, "5:cpu,memory:/docker/abc/pitot\n") writeTestFile(t, mountInfoPath, fmt.Sprintf( "29 24 0:26 /docker/abc %s rw - cgroup cgroup rw,memory\n", mountPoint, diff --git a/internal/dashboard/changes.go b/internal/dashboard/changes.go index 1af49cde6..9f8910cff 100644 --- a/internal/dashboard/changes.go +++ b/internal/dashboard/changes.go @@ -5,7 +5,7 @@ import ( "encoding/json" "sort" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) type PanelChange struct { diff --git a/internal/dashboard/changes_test.go b/internal/dashboard/changes_test.go index f2a5448e2..1dce6e8b4 100644 --- a/internal/dashboard/changes_test.go +++ b/internal/dashboard/changes_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) func TestChangesReportOnlyPanelsOutsideTheLongestCommonOrder(t *testing.T) { diff --git a/internal/dashboard/concurrent_test.go b/internal/dashboard/concurrent_test.go index 0d505956c..1347d9eef 100644 --- a/internal/dashboard/concurrent_test.go +++ b/internal/dashboard/concurrent_test.go @@ -13,9 +13,9 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/db/generated" - "github.com/labstack/fanout/internal/query" - appstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/db/generated" + "github.com/labstack/pitot/internal/query" + appstore "github.com/labstack/pitot/internal/store" "modernc.org/sqlite" ) diff --git a/internal/dashboard/defaults.go b/internal/dashboard/defaults.go index 1b29f0c31..9834bbbbd 100644 --- a/internal/dashboard/defaults.go +++ b/internal/dashboard/defaults.go @@ -1,6 +1,6 @@ package dashboard -import "github.com/labstack/fanout/internal/query" +import "github.com/labstack/pitot/internal/query" // DefaultSpec is every owner's first dashboard: the shape of the whole system, // filterable to one service. @@ -37,7 +37,7 @@ func DefaultSpec() query.Dashboard { } func receiverDescription(receiver, description string) string { - return description + " Supplied by the Collector `" + receiver + "` receiver. [Collector setup](https://fanout.run/docs/get-started/send-telemetry#watch-hosts-containers-and-endpoints)." + return description + " Supplied by the Collector `" + receiver + "` receiver. [Collector setup](https://pitot.dev/docs/get-started/send-telemetry#watch-hosts-containers-and-endpoints)." } func capacityPanel(id, title, receiver, description, sql string) query.Panel { diff --git a/internal/dashboard/defaults_test.go b/internal/dashboard/defaults_test.go index beb46163a..4d21746ca 100644 --- a/internal/dashboard/defaults_test.go +++ b/internal/dashboard/defaults_test.go @@ -8,12 +8,12 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestDefaultSpecPassesTheFullCheck(t *testing.T) { @@ -80,7 +80,7 @@ func TestDefaultSpecKeepsExistingPanelsBeforeSystemSections(t *testing.T) { var ids []string for i, p := range spec.Panels { ids = append(ids, p.ID) - if i >= 8 && (!strings.Contains(p.Description, "Collector `") || !strings.Contains(p.Description, "https://fanout.run/docs/get-started/send-telemetry#watch-hosts-containers-and-endpoints")) { + if i >= 8 && (!strings.Contains(p.Description, "Collector `") || !strings.Contains(p.Description, "https://pitot.dev/docs/get-started/send-telemetry#watch-hosts-containers-and-endpoints")) { t.Fatalf("receiver guidance missing: %+v", p) } } diff --git a/internal/dashboard/edit.go b/internal/dashboard/edit.go index ac433dccc..37696cd60 100644 --- a/internal/dashboard/edit.go +++ b/internal/dashboard/edit.go @@ -8,7 +8,7 @@ import ( "slices" "strings" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) // Operation is one typed edit. Panels are addressed by their stable id, never diff --git a/internal/dashboard/edit_test.go b/internal/dashboard/edit_test.go index c0daffa8d..285b43f5c 100644 --- a/internal/dashboard/edit_test.go +++ b/internal/dashboard/edit_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) func editBase() query.Dashboard { diff --git a/internal/dashboard/identity.go b/internal/dashboard/identity.go index 279bb3a20..35f9e9a8b 100644 --- a/internal/dashboard/identity.go +++ b/internal/dashboard/identity.go @@ -3,19 +3,19 @@ package dashboard import ( "context" - "github.com/labstack/fanout/internal/auth" + "github.com/labstack/pitot/internal/auth" ) // OwnerMetaKey carries the dashboard owner's user ID in MCP request _meta. // -// Trust model (three-file invariant): io.fanout/owner-id and -// io.fanout/build-origin are client-suppliable metadata. Dashboard tools trust +// Trust model (three-file invariant): io.pitot/owner-id and +// io.pitot/build-origin are client-suppliable metadata. Dashboard tools trust // these values ONLY on the in-process path with authenticated owner injection // from internal/agent/tools.go. ProtectMCP and ProtectBrowserMCP // (internal/api/oauth.go) guarantee OAuth TokenInfo on both HTTP mounts; remote TokenInfo takes precedence, // and remote metadata cannot fabricate ownership or conversation provenance. -const OwnerMetaKey = "io.fanout/owner-id" -const BuildOriginMetaKey = "io.fanout/build-origin" +const OwnerMetaKey = "io.pitot/owner-id" +const BuildOriginMetaKey = "io.pitot/build-origin" const OAuthScope = auth.MCPScopeDashboardManage type ownerContextKey struct{} diff --git a/internal/dashboard/layout.go b/internal/dashboard/layout.go index 925512a70..f7bef914b 100644 --- a/internal/dashboard/layout.go +++ b/internal/dashboard/layout.go @@ -4,7 +4,7 @@ import ( "cmp" "slices" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) // RowHeight is the grid row height in pixels; ui/host/src/dashboards/grid.tsx diff --git a/internal/dashboard/layout_constraints_test.go b/internal/dashboard/layout_constraints_test.go index 259c86a98..b3f8a8f10 100644 --- a/internal/dashboard/layout_constraints_test.go +++ b/internal/dashboard/layout_constraints_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) func TestAddPreservesSavedLayout(t *testing.T) { diff --git a/internal/dashboard/layout_test.go b/internal/dashboard/layout_test.go index 201461b42..4cbe4f51a 100644 --- a/internal/dashboard/layout_test.go +++ b/internal/dashboard/layout_test.go @@ -5,7 +5,7 @@ import ( "slices" "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) func TestPackedRowBandsSnapOnlyFreeNewPanels(t *testing.T) { diff --git a/internal/dashboard/origin_test.go b/internal/dashboard/origin_test.go index 5e2957527..622d40ac4 100644 --- a/internal/dashboard/origin_test.go +++ b/internal/dashboard/origin_test.go @@ -1,7 +1,7 @@ package dashboard import ( - appstore "github.com/labstack/fanout/internal/store" + appstore "github.com/labstack/pitot/internal/store" "path/filepath" "strings" "testing" diff --git a/internal/dashboard/resource_inventory_test.go b/internal/dashboard/resource_inventory_test.go index e6da275e0..9a3be5436 100644 --- a/internal/dashboard/resource_inventory_test.go +++ b/internal/dashboard/resource_inventory_test.go @@ -12,11 +12,11 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func assertResourceFrame(t *testing.T, name string, frame *query.Frame) { @@ -179,13 +179,13 @@ func TestDefaultResourceInventoryKeepsVantageNamespacesSeparate(t *testing.T) { // Opt-in evidence uses an extracted immutable snapshot and writes only to the // supplied evidence directory and its separate disposable query cache. func TestResourceInventoryFrozenSnapshotFrames(t *testing.T) { - root := os.Getenv("FANOUT_TEST_INVENTORY_SNAPSHOT") + root := os.Getenv("PITOT_TEST_INVENTORY_SNAPSHOT") if root == "" { - t.Skip("set FANOUT_TEST_INVENTORY_SNAPSHOT to an extracted telemetry repository") + t.Skip("set PITOT_TEST_INVENTORY_SNAPSHOT to an extracted telemetry repository") } - evidence := os.Getenv("FANOUT_TEST_INVENTORY_EVIDENCE") + evidence := os.Getenv("PITOT_TEST_INVENTORY_EVIDENCE") if evidence == "" { - t.Fatal("FANOUT_TEST_INVENTORY_EVIDENCE is required") + t.Fatal("PITOT_TEST_INVENTORY_EVIDENCE is required") } if err := os.MkdirAll(evidence, 0755); err != nil { t.Fatal(err) diff --git a/internal/dashboard/service.go b/internal/dashboard/service.go index 7f065cb4e..3779aacff 100644 --- a/internal/dashboard/service.go +++ b/internal/dashboard/service.go @@ -9,9 +9,9 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/db/generated" - appid "github.com/labstack/fanout/internal/id" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/db/generated" + appid "github.com/labstack/pitot/internal/id" + "github.com/labstack/pitot/internal/query" ) var ( diff --git a/internal/dashboard/service_test.go b/internal/dashboard/service_test.go index cf1cbead1..8a65e5e36 100644 --- a/internal/dashboard/service_test.go +++ b/internal/dashboard/service_test.go @@ -9,8 +9,8 @@ import ( "sync/atomic" "testing" - "github.com/labstack/fanout/internal/query" - appstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/query" + appstore "github.com/labstack/pitot/internal/store" ) // structural validates without DuckDB; filter checks are covered in diff --git a/internal/dashboard/write_constraints_test.go b/internal/dashboard/write_constraints_test.go index f04a50fb2..aa5255fcb 100644 --- a/internal/dashboard/write_constraints_test.go +++ b/internal/dashboard/write_constraints_test.go @@ -4,7 +4,7 @@ import ( "context" "errors" "fmt" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" "strings" "sync" "testing" diff --git a/internal/db/dashboards_schema_test.go b/internal/db/dashboards_schema_test.go index c7a8b61ee..93bfbad77 100644 --- a/internal/db/dashboards_schema_test.go +++ b/internal/db/dashboards_schema_test.go @@ -3,8 +3,8 @@ package db_test import ( "testing" - "github.com/labstack/fanout/internal/db/generated" - appstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/db/generated" + appstore "github.com/labstack/pitot/internal/store" ) func TestDashboardVersionsCascadeAndOptimisticUpdate(t *testing.T) { diff --git a/internal/duckdb/native.go b/internal/duckdb/native.go index f58fc5c41..b35e0dcbb 100644 --- a/internal/duckdb/native.go +++ b/internal/duckdb/native.go @@ -1,4 +1,4 @@ -// Package duckdb registers the extensions compiled into Fanout's pinned +// Package duckdb registers the extensions compiled into Pitot's pinned // DuckDB engine. Building requires scripts/with-duckdb.sh; there is one engine. package duckdb @@ -23,7 +23,7 @@ const SourceCommit = "d54cbbe3df" func init() { if C.GoString(C.duckdb_library_version()) != Version { - panic("Fanout requires DuckDB " + Version + "; build with scripts/with-duckdb.sh") + panic("Pitot requires DuckDB " + Version + "; build with scripts/with-duckdb.sh") } if C.register_extensions() != 0 { panic("DuckDB static extension registration failed") diff --git a/internal/engine/analytical_backlog_test.go b/internal/engine/analytical_backlog_test.go index 0ce61bd42..b356297aa 100644 --- a/internal/engine/analytical_backlog_test.go +++ b/internal/engine/analytical_backlog_test.go @@ -7,10 +7,10 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/annotations" - "github.com/labstack/fanout/internal/engine/writegate" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/annotations" + "github.com/labstack/pitot/internal/engine/writegate" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) // Equal-ingest immutable batches cover six edge sub-windows. Channel barriers diff --git a/internal/engine/annotation_maintenance_test.go b/internal/engine/annotation_maintenance_test.go index e3abf7450..0c5a42bf0 100644 --- a/internal/engine/annotation_maintenance_test.go +++ b/internal/engine/annotation_maintenance_test.go @@ -14,11 +14,11 @@ import ( "time" "github.com/DATA-DOG/go-sqlmock" - "github.com/labstack/fanout/internal/annotations" - "github.com/labstack/fanout/internal/engine/writegate" - "github.com/labstack/fanout/internal/metrics" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/annotations" + "github.com/labstack/pitot/internal/engine/writegate" + "github.com/labstack/pitot/internal/metrics" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "github.com/prometheus/client_golang/prometheus/testutil" ) diff --git a/internal/engine/annotations.go b/internal/engine/annotations.go index a76d69279..85f672ee2 100644 --- a/internal/engine/annotations.go +++ b/internal/engine/annotations.go @@ -10,11 +10,11 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/annotations" - "github.com/labstack/fanout/internal/engine/writegate" - "github.com/labstack/fanout/internal/metrics" - "github.com/labstack/fanout/internal/telemetry" - "github.com/labstack/fanout/internal/telemetry/semconv" + "github.com/labstack/pitot/internal/annotations" + "github.com/labstack/pitot/internal/engine/writegate" + "github.com/labstack/pitot/internal/metrics" + "github.com/labstack/pitot/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry/semconv" ) const createVersionRollupTable = `CREATE TABLE IF NOT EXISTS version_rollup ( diff --git a/internal/engine/annotations_test.go b/internal/engine/annotations_test.go index 9de10ed93..1c5b7a3f1 100644 --- a/internal/engine/annotations_test.go +++ b/internal/engine/annotations_test.go @@ -8,11 +8,11 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/annotations" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/annotations" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestAnnotationWidenedRangeAccepted(t *testing.T) { diff --git a/internal/engine/backlog_pressure_test.go b/internal/engine/backlog_pressure_test.go index eb97a5ee3..aae7b5a54 100644 --- a/internal/engine/backlog_pressure_test.go +++ b/internal/engine/backlog_pressure_test.go @@ -20,21 +20,21 @@ import ( "time" duckdb "github.com/duckdb/duckdb-go/v2" - "github.com/labstack/fanout/internal/annotations" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine/writegate" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/annotations" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine/writegate" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "github.com/prometheus/client_golang/prometheus" ) // The deadline includes seeding. All disposable files stay in the private workspace. func pressureBatches(t *testing.T) int { t.Helper() - if raw := os.Getenv("FANOUT_BACKLOG_BATCHES"); raw != "" { + if raw := os.Getenv("PITOT_BACKLOG_BATCHES"); raw != "" { n, err := strconv.Atoi(raw) if err != nil || n < 1 { - t.Fatalf("invalid FANOUT_BACKLOG_BATCHES %q", raw) + t.Fatalf("invalid PITOT_BACKLOG_BATCHES %q", raw) } return n } @@ -42,10 +42,10 @@ func pressureBatches(t *testing.T) int { } func pressureDuration(t *testing.T) time.Duration { t.Helper() - if raw := os.Getenv("FANOUT_BACKLOG_DURATION"); raw != "" { + if raw := os.Getenv("PITOT_BACKLOG_DURATION"); raw != "" { d, err := time.ParseDuration(raw) if err != nil || d <= 0 { - t.Fatalf("invalid FANOUT_BACKLOG_DURATION %q", raw) + t.Fatalf("invalid PITOT_BACKLOG_DURATION %q", raw) } return d } @@ -200,7 +200,7 @@ func pressureDiagnostics(ctx context.Context, t *testing.T, d *Duck, repo *telem return } for _, f := range families { - if f.GetName() == "fanout_write_gate_wait_seconds" || f.GetName() == "fanout_write_gate_hold_seconds" { + if f.GetName() == "pitot_write_gate_wait_seconds" || f.GetName() == "pitot_write_gate_hold_seconds" { for _, m := range f.Metric { t.Logf("gate phase=%s metric=%s labels=%v count=%d seconds_sum=%.6f", phase, f.GetName(), m.Label, m.GetHistogram().GetSampleCount(), m.GetHistogram().GetSampleSum()) } diff --git a/internal/engine/batch_cache.go b/internal/engine/batch_cache.go index 3889722ea..62bcc2270 100644 --- a/internal/engine/batch_cache.go +++ b/internal/engine/batch_cache.go @@ -9,11 +9,11 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/engine/writegate" - "github.com/labstack/fanout/internal/metrics" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/readpressure" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/engine/writegate" + "github.com/labstack/pitot/internal/metrics" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/readpressure" + "github.com/labstack/pitot/internal/telemetry" ) // readCacheVersion covers the schema and semantics of DuckDB's read caches: @@ -322,8 +322,8 @@ func (d *Duck) cacheBatches(ctx context.Context, batches []telemetry.BatchMetada } // One Parquet scan binds the pass's files. The virtual filename column // identifies each contribution without a separate UNION branch per file. - physical := strings.Replace(d.physicalSource(signal, selected), "SELECT ", "SELECT filename AS __fanout_filename,", 1) - return strings.Replace(cleanSource(signal, physical), "SELECT\n", "SELECT "+d.batchIDColumn(signal, "__fanout_filename")+" AS batch_id,\n", 1) + physical := strings.Replace(d.physicalSource(signal, selected), "SELECT ", "SELECT filename AS __pitot_filename,", 1) + return strings.Replace(cleanSource(signal, physical), "SELECT\n", "SELECT "+d.batchIDColumn(signal, "__pitot_filename")+" AS batch_id,\n", 1) } for _, s := range telemetry.Signals { if rows := source(s.Name); rows != "" { diff --git a/internal/engine/compaction_cache_transfer_test.go b/internal/engine/compaction_cache_transfer_test.go index 758c85806..cd4b2e882 100644 --- a/internal/engine/compaction_cache_transfer_test.go +++ b/internal/engine/compaction_cache_transfer_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/engine/writegate" + "github.com/labstack/pitot/internal/engine/writegate" ) // A busy background lease must defer reuse of complete input contributions, diff --git a/internal/engine/compaction_stall_test.go b/internal/engine/compaction_stall_test.go index be20dd83a..e38e98af5 100644 --- a/internal/engine/compaction_stall_test.go +++ b/internal/engine/compaction_stall_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/engine/writegate" + "github.com/labstack/pitot/internal/engine/writegate" ) // Both rollups and read-cache passes hold a pin while using background SQL. diff --git a/internal/engine/dashboard_rollup_test.go b/internal/engine/dashboard_rollup_test.go index 65e7ccc5f..6d707c082 100644 --- a/internal/engine/dashboard_rollup_test.go +++ b/internal/engine/dashboard_rollup_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestDashboardRollupsBoundRoutesAndRepairLateData(t *testing.T) { diff --git a/internal/engine/duck.go b/internal/engine/duck.go index d37a5312f..ad95d3304 100644 --- a/internal/engine/duck.go +++ b/internal/engine/duck.go @@ -17,14 +17,14 @@ import ( "github.com/duckdb/duckdb-go/v2" - "github.com/labstack/fanout/internal/config" - engine "github.com/labstack/fanout/internal/duckdb" - "github.com/labstack/fanout/internal/engine/writegate" - "github.com/labstack/fanout/internal/metrics" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/readpressure" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + engine "github.com/labstack/pitot/internal/duckdb" + "github.com/labstack/pitot/internal/engine/writegate" + "github.com/labstack/pitot/internal/metrics" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/readpressure" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) type Duck struct { @@ -164,7 +164,7 @@ func duckDBPoolSize(cfg config.Config) int { // of a constant that's wrong everywhere but the box it was tuned for. func duckDSN(dbPath, mem string, threads int) (string, error) { if strings.ContainsAny(mem, "&?'\"\\; ") { - return "", fmt.Errorf("invalid FANOUT_DUCKDB_MEMORY value: %q", mem) + return "", fmt.Errorf("invalid PITOT_DUCKDB_MEMORY value: %q", mem) } params := make([]string, 0, 2) if threads > 0 { @@ -278,7 +278,7 @@ func NewDuck(ctx context.Context, cfg config.Config, repository *telemetrystore. // Reads are the pool that can starve, so it is the one worth watching. d.releasePoolGauges = metrics.SetDuckDBPoolSource(db.Stats) if cfg.DuckDBMemory == "" { - // Only when the operator hasn't pinned FANOUT_DUCKDB_MEMORY: keep DuckDB's + // Only when the operator hasn't pinned PITOT_DUCKDB_MEMORY: keep DuckDB's // cgroup-aware auto limit on big boxes but leave absolute RAM headroom on // small ones, so the kernel doesn't OOM-kill the whole process. if err := applyMemoryHeadroom(ctx, db); err != nil { diff --git a/internal/engine/duck_memory.go b/internal/engine/duck_memory.go index 3baab89be..3385a2d26 100644 --- a/internal/engine/duck_memory.go +++ b/internal/engine/duck_memory.go @@ -5,7 +5,7 @@ import ( "log/slog" "time" - "github.com/labstack/fanout/internal/metrics" + "github.com/labstack/pitot/internal/metrics" ) const duckDBMemorySampleInterval = 5 * time.Second diff --git a/internal/engine/duck_memory_test.go b/internal/engine/duck_memory_test.go index 19990e8de..c61acaadc 100644 --- a/internal/engine/duck_memory_test.go +++ b/internal/engine/duck_memory_test.go @@ -15,8 +15,8 @@ import ( "time" "github.com/DATA-DOG/go-sqlmock" - "github.com/labstack/fanout/internal/config" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" ) @@ -171,9 +171,9 @@ func memoryMetrics(t *testing.T) (memory, timestamp float64) { } for _, family := range families { switch family.GetName() { - case "fanout_duckdb_memory_bytes": + case "pitot_duckdb_memory_bytes": memory = family.Metric[0].GetGauge().GetValue() - case "fanout_duckdb_memory_last_success_timestamp_seconds": + case "pitot_duckdb_memory_last_success_timestamp_seconds": timestamp = family.Metric[0].GetGauge().GetValue() } } @@ -244,10 +244,10 @@ func TestMetricsScrapeDropsStaleMemoryWhileSamplerBlocks(t *testing.T) { t.Fatalf("/metrics status=%d: %s", recorder.Code, recorder.Body.String()) } body := recorder.Body.String() - if strings.Contains(body, "fanout_duckdb_memory_bytes") { + if strings.Contains(body, "pitot_duckdb_memory_bytes") { t.Fatal("blocked sampler still exports stale memory series") } - const prefix = "fanout_duckdb_memory_last_success_timestamp_seconds " + const prefix = "pitot_duckdb_memory_last_success_timestamp_seconds " for _, line := range strings.Split(body, "\n") { if strings.HasPrefix(line, prefix) { value := strings.TrimPrefix(line, prefix) diff --git a/internal/engine/duck_test.go b/internal/engine/duck_test.go index 1bb5d9443..2ed3bc874 100644 --- a/internal/engine/duck_test.go +++ b/internal/engine/duck_test.go @@ -11,11 +11,11 @@ import ( "time" "github.com/DATA-DOG/go-sqlmock" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine/writegate" - "github.com/labstack/fanout/internal/metrics" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine/writegate" + "github.com/labstack/pitot/internal/metrics" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "github.com/prometheus/client_golang/prometheus/testutil" ) @@ -546,11 +546,11 @@ func TestParseDuckBytes(t *testing.T) { } // A rollup that fails after reading the source tip must still publish lag. -// Otherwise fanout_rollup_lag_seconds freezes at its last healthy value during +// Otherwise pitot_rollup_lag_seconds freezes at its last healthy value during // exactly the outage it exists to expose, and a lag alert never fires. // The publish-lag-on-error defer is copy-pasted into all three rollup // components, so it is covered for all three. A wrong component constant or a -// missed sourceMax assignment in one copy freezes fanout_rollup_lag_seconds at +// missed sourceMax assignment in one copy freezes pitot_rollup_lag_seconds at // its last healthy value during exactly the outage the gauge exists to expose, // and the lag alert never fires. func TestFailedRollupStillPublishesLag(t *testing.T) { diff --git a/internal/engine/edge_arrival_test.go b/internal/engine/edge_arrival_test.go index ab7df308e..6107e77c6 100644 --- a/internal/engine/edge_arrival_test.go +++ b/internal/engine/edge_arrival_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestEdgeRollupRepairsRelatedArrivals(t *testing.T) { diff --git a/internal/engine/edge_backlog_test.go b/internal/engine/edge_backlog_test.go index 49a824a89..fc7341b3d 100644 --- a/internal/engine/edge_backlog_test.go +++ b/internal/engine/edge_backlog_test.go @@ -6,10 +6,10 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/metrics" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/metrics" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "github.com/prometheus/client_golang/prometheus/testutil" ) diff --git a/internal/engine/edge_parent_plan_test.go b/internal/engine/edge_parent_plan_test.go index e8f6e844c..4e4c098de 100644 --- a/internal/engine/edge_parent_plan_test.go +++ b/internal/engine/edge_parent_plan_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" - store "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/telemetry" + store "github.com/labstack/pitot/internal/telemetry/store" ) // A schema-first catalog estimates zero raw rows while materialized children diff --git a/internal/engine/edge_tick_test.go b/internal/engine/edge_tick_test.go index 0b7d9f654..6a68d9729 100644 --- a/internal/engine/edge_tick_test.go +++ b/internal/engine/edge_tick_test.go @@ -6,10 +6,10 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/annotations" - "github.com/labstack/fanout/internal/metrics" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/annotations" + "github.com/labstack/pitot/internal/metrics" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "github.com/prometheus/client_golang/prometheus/testutil" ) diff --git a/internal/engine/file_snapshot.go b/internal/engine/file_snapshot.go index 6000f07e6..97cd6c13e 100644 --- a/internal/engine/file_snapshot.go +++ b/internal/engine/file_snapshot.go @@ -11,8 +11,8 @@ import ( "time" "unicode/utf8" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" ) type snapshotSQL interface { @@ -247,7 +247,7 @@ func compileRelations(ctx context.Context, db snapshotSQL, query string, sources } ctes(root) for name := range shadowed { - if strings.HasPrefix(name, "__fanout_snapshot_") { + if strings.HasPrefix(name, "__pitot_snapshot_") { return "", fmt.Errorf("reserved snapshot CTE name %s", name) } } @@ -369,7 +369,7 @@ func (d *Duck) compileSnapshot(ctx context.Context, db snapshotSQL, query string names = append(names, "telemetry."+s.Name, s.Name) } for _, name := range names { - alias := "__fanout_snapshot_" + strings.ReplaceAll(name, ".", "_") + alias := "__pitot_snapshot_" + strings.ReplaceAll(name, ".", "_") aliases[name] = "SELECT * FROM " + alias } used := map[string]string{} diff --git a/internal/engine/file_snapshot_bench_test.go b/internal/engine/file_snapshot_bench_test.go index 45effecb3..453fd77e9 100644 --- a/internal/engine/file_snapshot_bench_test.go +++ b/internal/engine/file_snapshot_bench_test.go @@ -10,10 +10,10 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) // Opt-in file-binder experiment. Run alone with the pinned native wrapper and diff --git a/internal/engine/file_snapshot_test.go b/internal/engine/file_snapshot_test.go index 6cfe77d43..8bc8aa458 100644 --- a/internal/engine/file_snapshot_test.go +++ b/internal/engine/file_snapshot_test.go @@ -9,11 +9,11 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine/writegate" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine/writegate" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func newBatchCacheTest(t *testing.T) (*Duck, *telemetrystore.Repository) { @@ -86,7 +86,7 @@ func TestSnapshotUsesActualEventBoundsAndPreservesParameters(t *testing.T) { for _, statement := range []string{ `SELECT count(telemetry.logs.namespace) FROM telemetry.logs`, `WITH x AS (SELECT count(*) AS n FROM logs) SELECT n FROM x`, - `SELECT count(*) FROM logs WHERE '__fanout_snapshot_metrics'<>''`, + `SELECT count(*) FROM logs WHERE '__pitot_snapshot_metrics'<>''`, } { if err := d.QueryRowScan(ctx, []any{&value}, statement); err != nil || value != 1 { t.Fatalf("snapshot SQL %s: %d %v", statement, value, err) @@ -682,7 +682,7 @@ func TestReadCacheBudgetsAllSignalsAndReportsInventoryWork(t *testing.T) { if err != nil || len(markers) != 1 || !markers["log-only"] || written != 2 { t.Fatalf("all-signal budget/work: %v written=%d err=%v", markers, written, err) } - if got := metricFamily(t, "fanout_read_cache_pending_batches").Metric[0].GetGauge().GetValue(); got != 3 { + if got := metricFamily(t, "pitot_read_cache_pending_batches").Metric[0].GetGauge().GetValue(); got != 3 { t.Fatalf("pending all-signal gauge=%v want 3", got) } written, err = d.RefreshReadCaches(t.Context()) diff --git a/internal/engine/metric_names.go b/internal/engine/metric_names.go index 8df617af1..1a9a55a85 100644 --- a/internal/engine/metric_names.go +++ b/internal/engine/metric_names.go @@ -3,7 +3,7 @@ package engine import ( "context" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) // Recognize a single direct metrics scan with a literal name predicate. No diff --git a/internal/engine/metric_names_test.go b/internal/engine/metric_names_test.go index b1fbdaa6f..512ef21d9 100644 --- a/internal/engine/metric_names_test.go +++ b/internal/engine/metric_names_test.go @@ -1,9 +1,9 @@ package engine import ( - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "testing" "time" ) diff --git a/internal/engine/panel_sql_test.go b/internal/engine/panel_sql_test.go index 90eeebc45..847f29f51 100644 --- a/internal/engine/panel_sql_test.go +++ b/internal/engine/panel_sql_test.go @@ -7,9 +7,9 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestTelemetrySQLRejectsCatalogMacrosAndSideEffects(t *testing.T) { diff --git a/internal/engine/peer_rollup_test.go b/internal/engine/peer_rollup_test.go index edd97f59a..1c0cf8899 100644 --- a/internal/engine/peer_rollup_test.go +++ b/internal/engine/peer_rollup_test.go @@ -1,8 +1,8 @@ package engine import ( - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "testing" "time" ) diff --git a/internal/engine/progress.go b/internal/engine/progress.go index 87e84d05a..6c9b6e789 100644 --- a/internal/engine/progress.go +++ b/internal/engine/progress.go @@ -11,10 +11,10 @@ import ( "sync" "time" - "github.com/labstack/fanout/internal/metrics" + "github.com/labstack/pitot/internal/metrics" ) -// ErrStalled reports a stall in work Fanout owns: a Parquet publication +// ErrStalled reports a stall in work Pitot owns: a Parquet publication // running far past its budget, or an idle engine that does not answer a ping. // Only a restart frees it. var ErrStalled = errors.New("query engine stalled") @@ -26,7 +26,7 @@ var ErrStalled = errors.New("query engine stalled") // connection, not the engine, so it never fails liveness. const overrunGrace = longestRead -// longestRead bounds the deadline of every read Fanout issues; panel batches +// longestRead bounds the deadline of every read Pitot issues; panel batches // take 20 s and the detector's statements 15 s. const longestRead = 25 * time.Second @@ -200,7 +200,7 @@ func (d *Duck) Ping(ctx context.Context) error { return nil } -// stallExit is how long a stall must last before Fanout exits for a restart: +// stallExit is how long a stall must last before Pitot exits for a restart: // another overrunGrace, so supervisors that restart only on exit recover too. const stallExit = overrunGrace @@ -230,7 +230,7 @@ func (w *stallWatch) observe(now time.Time, stall string) bool { } // Watch reports read overruns, and delivers ErrStalled on Fatal once a stall -// in Fanout's own work has lasted stallExit, so the process exits and its +// in Pitot's own work has lasted stallExit, so the process exits and its // supervisor restarts it. Overload and costly queries are no stall. It stops // with ctx, so shutdown cannot fire it. func (d *Duck) Watch(ctx context.Context) { diff --git a/internal/engine/progress_test.go b/internal/engine/progress_test.go index d5d8ddeca..cafaa9d16 100644 --- a/internal/engine/progress_test.go +++ b/internal/engine/progress_test.go @@ -10,7 +10,7 @@ import ( "time" "github.com/DATA-DOG/go-sqlmock" - "github.com/labstack/fanout/internal/metrics" + "github.com/labstack/pitot/internal/metrics" "github.com/prometheus/client_golang/prometheus/testutil" ) diff --git a/internal/engine/querytest/tables.go b/internal/engine/querytest/tables.go index 98dfc7a57..273d9503f 100644 --- a/internal/engine/querytest/tables.go +++ b/internal/engine/querytest/tables.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) // types are the engine types the raw relation reads from each physical type. diff --git a/internal/engine/read_order_test.go b/internal/engine/read_order_test.go index 41150ca17..e1044ba19 100644 --- a/internal/engine/read_order_test.go +++ b/internal/engine/read_order_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) // A reader queued for a pool connection does not yet read Parquet, so it must diff --git a/internal/engine/read_pressure_test.go b/internal/engine/read_pressure_test.go index 671afd850..b73cff443 100644 --- a/internal/engine/read_pressure_test.go +++ b/internal/engine/read_pressure_test.go @@ -3,9 +3,9 @@ package engine import ( "context" "errors" - "github.com/labstack/fanout/internal/readpressure" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/readpressure" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "testing" "time" ) diff --git a/internal/engine/read_setup_test.go b/internal/engine/read_setup_test.go index e385908c1..ef77049f9 100644 --- a/internal/engine/read_setup_test.go +++ b/internal/engine/read_setup_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" ) // Panic at the first setup operation after readConn has acquired its pin. diff --git a/internal/engine/receiver_rollup_bench_test.go b/internal/engine/receiver_rollup_bench_test.go index d451d0b64..99f95dfec 100644 --- a/internal/engine/receiver_rollup_bench_test.go +++ b/internal/engine/receiver_rollup_bench_test.go @@ -6,10 +6,10 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - _ "github.com/labstack/fanout/internal/duckdb" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + _ "github.com/labstack/pitot/internal/duckdb" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) // Keep the number of resources fixed while increasing points per resource. diff --git a/internal/engine/receiver_rollup_test.go b/internal/engine/receiver_rollup_test.go index 0e740dbb0..a852d9403 100644 --- a/internal/engine/receiver_rollup_test.go +++ b/internal/engine/receiver_rollup_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestReceiverSummariesRepairRetriesLateDataAndRetirement(t *testing.T) { diff --git a/internal/engine/resource_inventory.go b/internal/engine/resource_inventory.go index f90d55917..283cbf0c0 100644 --- a/internal/engine/resource_inventory.go +++ b/internal/engine/resource_inventory.go @@ -4,8 +4,8 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" ) // Every signal partitions the captured files independently. Whole cached files diff --git a/internal/engine/resource_inventory_evidence_test.go b/internal/engine/resource_inventory_evidence_test.go index fd0bfd51a..042216061 100644 --- a/internal/engine/resource_inventory_evidence_test.go +++ b/internal/engine/resource_inventory_evidence_test.go @@ -9,19 +9,19 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/queryrows" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/queryrows" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestResourceInventoryFrozenSnapshotPlans(t *testing.T) { - root := os.Getenv("FANOUT_TEST_INVENTORY_SNAPSHOT") + root := os.Getenv("PITOT_TEST_INVENTORY_SNAPSHOT") if root == "" { - t.Skip("set FANOUT_TEST_INVENTORY_SNAPSHOT to an extracted telemetry repository") + t.Skip("set PITOT_TEST_INVENTORY_SNAPSHOT to an extracted telemetry repository") } - evidence := os.Getenv("FANOUT_TEST_INVENTORY_EVIDENCE") + evidence := os.Getenv("PITOT_TEST_INVENTORY_EVIDENCE") if evidence == "" { - t.Fatal("FANOUT_TEST_INVENTORY_EVIDENCE is required") + t.Fatal("PITOT_TEST_INVENTORY_EVIDENCE is required") } data, err := os.ReadFile(filepath.Join(evidence, "panel-sql.json")) if err != nil { diff --git a/internal/engine/resource_inventory_test.go b/internal/engine/resource_inventory_test.go index d8cea5e2a..409c1da23 100644 --- a/internal/engine/resource_inventory_test.go +++ b/internal/engine/resource_inventory_test.go @@ -11,9 +11,9 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "github.com/parquet-go/parquet-go" ) diff --git a/internal/engine/retirement_test.go b/internal/engine/retirement_test.go index 9e2e753d2..1f18a0d5a 100644 --- a/internal/engine/retirement_test.go +++ b/internal/engine/retirement_test.go @@ -9,9 +9,9 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func commitCurrentBatches(t *testing.T, repo *telemetrystore.Repository, prefix string, n int, at time.Time) { diff --git a/internal/engine/rollup_keys_test.go b/internal/engine/rollup_keys_test.go index 63773b997..def534907 100644 --- a/internal/engine/rollup_keys_test.go +++ b/internal/engine/rollup_keys_test.go @@ -11,9 +11,9 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) // A NUL byte in a namespace must neither fail a rollup pass nor stop the diff --git a/internal/engine/rollup_scale_test.go b/internal/engine/rollup_scale_test.go index d072c4363..e76a7f278 100644 --- a/internal/engine/rollup_scale_test.go +++ b/internal/engine/rollup_scale_test.go @@ -64,16 +64,16 @@ func (p *scaleCapture) ExecContext(ctx context.Context, q string, args ...any) ( // Opt-in measurements run each case in a fresh process for peak RSS accounting. // Build with scripts/with-duckdb.sh go test -c, then invoke the test binary with -// FANOUT_SCALE_KEYS=1000|10000|60000 and FANOUT_SCALE_KIND=service|edge. +// PITOT_SCALE_KEYS=1000|10000|60000 and PITOT_SCALE_KIND=service|edge. // Prepare is unbound preparation; bound_explain includes binding, optimization // and JSON plan serialization. Pass excludes those extra instrumentation calls. // Peak RSS includes fixture setup and instrumentation; timings exclude setup. func TestRollupKeyScaleMeasurement(t *testing.T) { - n, _ := strconv.Atoi(os.Getenv("FANOUT_SCALE_KEYS")) + n, _ := strconv.Atoi(os.Getenv("PITOT_SCALE_KEYS")) if n == 0 { - t.Skip("set FANOUT_SCALE_KEYS") + t.Skip("set PITOT_SCALE_KEYS") } - kind := os.Getenv("FANOUT_SCALE_KIND") + kind := os.Getenv("PITOT_SCALE_KIND") measureRollupKeyScale(t, n, kind, false) } diff --git a/internal/engine/rollup_sparse_memory_test.go b/internal/engine/rollup_sparse_memory_test.go index 87b093648..6d89ec1d4 100644 --- a/internal/engine/rollup_sparse_memory_test.go +++ b/internal/engine/rollup_sparse_memory_test.go @@ -16,11 +16,11 @@ import ( // not hide the native t-digest heap, which memory_limit does not govern. func rollupMemoryProcess(t *testing.T) bool { t.Helper() - if os.Getenv("FANOUT_ROLLUP_MEMORY_CHILD") == t.Name() { + if os.Getenv("PITOT_ROLLUP_MEMORY_CHILD") == t.Name() { return true } cmd := exec.Command(os.Args[0], "-test.run=^"+t.Name()+"$", "-test.v", "-test.timeout=90s") - cmd.Env = append(os.Environ(), "FANOUT_ROLLUP_MEMORY_CHILD="+t.Name()) + cmd.Env = append(os.Environ(), "PITOT_ROLLUP_MEMORY_CHILD="+t.Name()) out, err := cmd.CombinedOutput() t.Logf("%s", out) if cmd.ProcessState != nil { diff --git a/internal/engine/rollup_test.go b/internal/engine/rollup_test.go index 6a36e01e1..22cce6663 100644 --- a/internal/engine/rollup_test.go +++ b/internal/engine/rollup_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" + "github.com/labstack/pitot/internal/config" ) func TestRollupOnceRebuildsAffectedServiceBuckets(t *testing.T) { diff --git a/internal/engine/rollup_watermark_test.go b/internal/engine/rollup_watermark_test.go index 59b8d216e..d9538afa4 100644 --- a/internal/engine/rollup_watermark_test.go +++ b/internal/engine/rollup_watermark_test.go @@ -6,10 +6,10 @@ import ( "time" "github.com/DATA-DOG/go-sqlmock" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/metrics" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/metrics" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "github.com/prometheus/client_golang/prometheus/testutil" ) diff --git a/internal/engine/rollup_yield_test.go b/internal/engine/rollup_yield_test.go index 8d76b835c..d3cf6a260 100644 --- a/internal/engine/rollup_yield_test.go +++ b/internal/engine/rollup_yield_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/telemetry" ) // seedEdgeSpread writes SERVER/CLIENT pairs that share one ingested instant but diff --git a/internal/engine/row_group_pruning_test.go b/internal/engine/row_group_pruning_test.go index 8aae96f03..641799f35 100644 --- a/internal/engine/row_group_pruning_test.go +++ b/internal/engine/row_group_pruning_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) // Log and metric files sort by time bucket or series identity (proposal 0005), diff --git a/internal/engine/span_rollup_test.go b/internal/engine/span_rollup_test.go index f0c8dcad4..df74db49e 100644 --- a/internal/engine/span_rollup_test.go +++ b/internal/engine/span_rollup_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestSpanRollupReaggregatesAndRetires(t *testing.T) { diff --git a/internal/engine/sql_functions_test.go b/internal/engine/sql_functions_test.go index df4d76f17..1065ad551 100644 --- a/internal/engine/sql_functions_test.go +++ b/internal/engine/sql_functions_test.go @@ -41,7 +41,7 @@ WHERE function_type = 'macro' AND regexp_matches(lower(macro_definition), '\bsel // An engine upgrade that adds, removes or retypes a built-in fails here until // its functions are reviewed against blockedSQLFunctions and the table-function -// allowlist. Regenerate with FANOUT_UPDATE_SQL_FUNCTIONS=1 after that review. +// allowlist. Regenerate with PITOT_UPDATE_SQL_FUNCTIONS=1 after that review. func TestBuiltinFunctionsMatchTheReviewedSnapshot(t *testing.T) { db := openTestDuck(t) var version string @@ -64,7 +64,7 @@ func TestBuiltinFunctionsMatchTheReviewedSnapshot(t *testing.T) { if err := rows.Err(); err != nil { t.Fatal(err) } - if os.Getenv("FANOUT_UPDATE_SQL_FUNCTIONS") == "1" { + if os.Getenv("PITOT_UPDATE_SQL_FUNCTIONS") == "1" { if err := os.MkdirAll(filepath.Dir(builtinFunctionsSnapshot), 0o755); err != nil { t.Fatal(err) } diff --git a/internal/engine/sql_keys.go b/internal/engine/sql_keys.go index c3b3e25ac..db75d48e8 100644 --- a/internal/engine/sql_keys.go +++ b/internal/engine/sql_keys.go @@ -11,8 +11,8 @@ import ( "slices" "strings" - "github.com/labstack/fanout/internal/telemetry" - "github.com/labstack/fanout/internal/telemetry/semconv" + "github.com/labstack/pitot/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry/semconv" ) // Batch format 5 copies the standard keys into typed dedicated columns @@ -471,7 +471,7 @@ func (r *keyRewriter) expressionStar(star map[string]any, scope *keyScope) { // the inner star. func patternFilter(star, pattern map[string]any) map[string]any { param := func() map[string]any { - return map[string]any{"class": "COLUMN_REF", "type": "COLUMN_REF", "alias": "", "column_names": []any{"__fanout_column"}} + return map[string]any{"class": "COLUMN_REF", "type": "COLUMN_REF", "alias": "", "column_names": []any{"__pitot_column"}} } function := func(name string, args ...map[string]any) map[string]any { arguments := make([]any, len(args)) diff --git a/internal/engine/sql_keys_test.go b/internal/engine/sql_keys_test.go index e5b6db962..eb39d1807 100644 --- a/internal/engine/sql_keys_test.go +++ b/internal/engine/sql_keys_test.go @@ -7,9 +7,9 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) var quotedNames = regexp.MustCompile(`"(?:[^"]|"")*"`) diff --git a/internal/engine/stall_instrumentation_test.go b/internal/engine/stall_instrumentation_test.go index c83530aad..8a9fb96e3 100644 --- a/internal/engine/stall_instrumentation_test.go +++ b/internal/engine/stall_instrumentation_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" ) @@ -76,7 +76,7 @@ func TestWritesDoNotDrawFromTheReadPool(t *testing.T) { } // The read pool is the one worth watching, so it is the one the gauges read. - if got := int(metricFamily(t, "fanout_duckdb_pool_max_open").Metric[0].GetGauge().GetValue()); got != 4 { + if got := int(metricFamily(t, "pitot_duckdb_pool_max_open").Metric[0].GetGauge().GetValue()); got != 4 { t.Fatalf("pool gauges read a pool with MaxOpenConnections = %d, want the read pool's 4", got) } } @@ -156,7 +156,7 @@ func TestClosingADisplacedDuckLeavesTheGaugeSourceAlone(t *testing.T) { if err := first.Close(); err != nil { t.Fatalf("close first: %v", err) } - if got := int(metricFamily(t, "fanout_duckdb_pool_max_open").Metric[0].GetGauge().GetValue()); got != 3 { + if got := int(metricFamily(t, "pitot_duckdb_pool_max_open").Metric[0].GetGauge().GetValue()); got != 3 { t.Fatalf("pool gauges read MaxOpenConnections = %d after a displaced Duck closed, want the live pool's 3", got) } } @@ -217,7 +217,7 @@ func TestStatementTimerExcludesTheWaitForAConnection(t *testing.T) { // statementSeconds reports the histogram's running total. func statementSeconds(t *testing.T) float64 { t.Helper() - return metricFamily(t, "fanout_duckdb_statement_seconds").Metric[0].GetHistogram().GetSampleSum() + return metricFamily(t, "pitot_duckdb_statement_seconds").Metric[0].GetHistogram().GetSampleSum() } // Close is reached from error paths and from test cleanup, where a Duck may diff --git a/internal/engine/tables_test.go b/internal/engine/tables_test.go index d01ce22df..f2b42921a 100644 --- a/internal/engine/tables_test.go +++ b/internal/engine/tables_test.go @@ -2,7 +2,7 @@ package engine import ( "database/sql" - "github.com/labstack/fanout/internal/engine/querytest" + "github.com/labstack/pitot/internal/engine/querytest" ) func CreateTables(db *sql.DB) error { return querytest.CreateTables(db, CreateCacheTables) } diff --git a/internal/engine/timestamp_plan_test.go b/internal/engine/timestamp_plan_test.go index 95279ac71..b7d7b9d7e 100644 --- a/internal/engine/timestamp_plan_test.go +++ b/internal/engine/timestamp_plan_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) func TestNativeTimestampPredicatesPruneParquetAndPreserveNanoseconds(t *testing.T) { diff --git a/internal/engine/variant_boundary_test.go b/internal/engine/variant_boundary_test.go index 6690754be..d0150835c 100644 --- a/internal/engine/variant_boundary_test.go +++ b/internal/engine/variant_boundary_test.go @@ -8,10 +8,10 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestSQLBoundaryPreservesResidualTypesUnderShreddedKeys(t *testing.T) { diff --git a/internal/engine/variant_integration_test.go b/internal/engine/variant_integration_test.go index 7c453c61e..7ff8b77e9 100644 --- a/internal/engine/variant_integration_test.go +++ b/internal/engine/variant_integration_test.go @@ -9,11 +9,11 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - engine "github.com/labstack/fanout/internal/duckdb" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + engine "github.com/labstack/pitot/internal/duckdb" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestPinnedEngineReadsShreddedTelemetry(t *testing.T) { diff --git a/internal/engine/version_budget_test.go b/internal/engine/version_budget_test.go index b2b1b57ba..9b93c54b7 100644 --- a/internal/engine/version_budget_test.go +++ b/internal/engine/version_budget_test.go @@ -6,10 +6,10 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/annotations" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/annotations" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestVersionPendingBudgetsAndSingleRetries(t *testing.T) { diff --git a/internal/engine/version_gate_test.go b/internal/engine/version_gate_test.go index be0f71da6..b151449ff 100644 --- a/internal/engine/version_gate_test.go +++ b/internal/engine/version_gate_test.go @@ -4,8 +4,8 @@ import ( "bytes" "context" "errors" - "github.com/labstack/fanout/internal/engine/writegate" - "github.com/labstack/fanout/internal/metrics" + "github.com/labstack/pitot/internal/engine/writegate" + "github.com/labstack/pitot/internal/metrics" "github.com/prometheus/client_golang/prometheus/testutil" "log/slog" "runtime" diff --git a/internal/engine/views.go b/internal/engine/views.go index 077bcb16a..937e79a85 100644 --- a/internal/engine/views.go +++ b/internal/engine/views.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) const createServiceRollupTable = ` diff --git a/internal/engine/views_schema_test.go b/internal/engine/views_schema_test.go index 5f9fe6c2f..13755fd3d 100644 --- a/internal/engine/views_schema_test.go +++ b/internal/engine/views_schema_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) func TestParquetMessagingViewProjectsShreddedKeysIntoScan(t *testing.T) { diff --git a/internal/engine/watchdog_test.go b/internal/engine/watchdog_test.go index 932224344..92b5a72f8 100644 --- a/internal/engine/watchdog_test.go +++ b/internal/engine/watchdog_test.go @@ -73,7 +73,7 @@ func TestWatchExitsOnAStalledPublication(t *testing.T) { } } -// A costly query running far past its deadline is the user's, not Fanout's: +// A costly query running far past its deadline is the user's, not Pitot's: // the watchdog reports it but never exits. func TestWatchNeverExitsOnAQueryOverrun(t *testing.T) { d, _ := mockDuck(t) @@ -102,7 +102,7 @@ func TestWatchIgnoresReadsWithinTheirDeadlines(t *testing.T) { } // An idle engine that cannot answer a ping while nothing holds the pool is -// Fanout's stall. +// Pitot's stall. func TestWatchExitsWhenAnIdleEngineCannotAnswer(t *testing.T) { d, _ := mockDuck(t) d.progress.Store(time.Now().Add(-idleLimit - time.Second).UnixNano()) diff --git a/internal/engine/writegate/write_gate.go b/internal/engine/writegate/write_gate.go index da43fe828..1991fde13 100644 --- a/internal/engine/writegate/write_gate.go +++ b/internal/engine/writegate/write_gate.go @@ -7,7 +7,7 @@ import ( "sync" "time" - "github.com/labstack/fanout/internal/metrics" + "github.com/labstack/pitot/internal/metrics" ) // Operation is a bounded metric label for a rollup-cache write. diff --git a/internal/engine/writegate/write_gate_test.go b/internal/engine/writegate/write_gate_test.go index 46020aa78..bc8d0f7ce 100644 --- a/internal/engine/writegate/write_gate_test.go +++ b/internal/engine/writegate/write_gate_test.go @@ -126,16 +126,16 @@ func TestGateObservesOutsideTheCriticalSection(t *testing.T) { // whether ingest is stalling behind rollups, which is the question this // instrumentation exists to answer. func TestGateRecordsBothWaitAndHoldHistograms(t *testing.T) { - beforeWait := histogramCount(t, "fanout_write_gate_wait_seconds", Maintenance) - beforeHold := histogramCount(t, "fanout_write_gate_hold_seconds", Maintenance) + beforeWait := histogramCount(t, "pitot_write_gate_wait_seconds", Maintenance) + beforeHold := histogramCount(t, "pitot_write_gate_hold_seconds", Maintenance) var gate Gate gate.Lock(Maintenance)() - if after := histogramCount(t, "fanout_write_gate_wait_seconds", Maintenance); after != beforeWait+1 { + if after := histogramCount(t, "pitot_write_gate_wait_seconds", Maintenance); after != beforeWait+1 { t.Errorf("wait sample count = %d, want %d", after, beforeWait+1) } - if after := histogramCount(t, "fanout_write_gate_hold_seconds", Maintenance); after != beforeHold+1 { + if after := histogramCount(t, "pitot_write_gate_hold_seconds", Maintenance); after != beforeHold+1 { t.Errorf("hold sample count = %d, want %d", after, beforeHold+1) } } diff --git a/internal/fanql/ast.go b/internal/fanql/ast.go index 505442612..bf7d98160 100644 --- a/internal/fanql/ast.go +++ b/internal/fanql/ast.go @@ -1,6 +1,6 @@ package fanql -import "github.com/labstack/fanout/internal/query" +import "github.com/labstack/pitot/internal/query" type queryTree struct { Source string diff --git a/internal/fanql/bounds_test.go b/internal/fanql/bounds_test.go index 7929e8228..336cf4018 100644 --- a/internal/fanql/bounds_test.go +++ b/internal/fanql/bounds_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) func TestEachInteractiveBoundIndependently(t *testing.T) { diff --git a/internal/fanql/complete.go b/internal/fanql/complete.go index 8f9174143..dcebf03e3 100644 --- a/internal/fanql/complete.go +++ b/internal/fanql/complete.go @@ -11,8 +11,8 @@ import ( "time" "unicode/utf8" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/telemetry" ) type expect struct { diff --git a/internal/fanql/complete_test.go b/internal/fanql/complete_test.go index 77a781fe3..de64a674f 100644 --- a/internal/fanql/complete_test.go +++ b/internal/fanql/complete_test.go @@ -12,7 +12,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) // fakeSchemas fetches with fetch and, like the executor, answers cached diff --git a/internal/fanql/corpus_test.go b/internal/fanql/corpus_test.go index 692cae3dc..c69c00dff 100644 --- a/internal/fanql/corpus_test.go +++ b/internal/fanql/corpus_test.go @@ -7,7 +7,7 @@ import ( "reflect" "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) // Each JSON block is an independently pinned input/output fixture. There is no diff --git a/internal/fanql/diagnostic_copy_test.go b/internal/fanql/diagnostic_copy_test.go index b31d4056f..b2727992f 100644 --- a/internal/fanql/diagnostic_copy_test.go +++ b/internal/fanql/diagnostic_copy_test.go @@ -1,7 +1,7 @@ package fanql import ( - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" "regexp" "strings" "testing" diff --git a/internal/fanql/diagnostics_test.go b/internal/fanql/diagnostics_test.go index 799f9193f..7a13f79ef 100644 --- a/internal/fanql/diagnostics_test.go +++ b/internal/fanql/diagnostics_test.go @@ -4,7 +4,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) func TestCompileRejectsReservedVariablesInEveryPosition(t *testing.T) { diff --git a/internal/fanql/fanql.go b/internal/fanql/fanql.go index 7ab4e9597..1c254009b 100644 --- a/internal/fanql/fanql.go +++ b/internal/fanql/fanql.go @@ -1,10 +1,10 @@ -// Package fanql parses the text form of Fanout's structured telemetry queries. +// Package fanql parses the text form of Pitot's structured telemetry queries. package fanql import ( "sort" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) type Options struct { diff --git a/internal/fanql/filter_exactness_test.go b/internal/fanql/filter_exactness_test.go index b34df7fc1..5af7b9329 100644 --- a/internal/fanql/filter_exactness_test.go +++ b/internal/fanql/filter_exactness_test.go @@ -5,7 +5,7 @@ import ( "strconv" "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) func TestRawFragmentsPreservePrecedence(t *testing.T) { diff --git a/internal/fanql/format.go b/internal/fanql/format.go index e1bce83c8..b3ccb5b38 100644 --- a/internal/fanql/format.go +++ b/internal/fanql/format.go @@ -3,8 +3,8 @@ package fanql import ( "context" "fmt" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/sqlscan" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/sqlscan" "strconv" "strings" "unicode/utf8" diff --git a/internal/fanql/format_copy_test.go b/internal/fanql/format_copy_test.go index 8ca7d3513..e379e0855 100644 --- a/internal/fanql/format_copy_test.go +++ b/internal/fanql/format_copy_test.go @@ -3,7 +3,7 @@ package fanql import ( "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) func TestFormatGaugeExplainsNoGrouping(t *testing.T) { diff --git a/internal/fanql/fuzz_test.go b/internal/fanql/fuzz_test.go index 40d9cc969..4a3033658 100644 --- a/internal/fanql/fuzz_test.go +++ b/internal/fanql/fuzz_test.go @@ -9,7 +9,7 @@ import ( "testing" "unicode/utf8" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) func FuzzCompileFormatCompile(f *testing.F) { diff --git a/internal/fanql/hints_test.go b/internal/fanql/hints_test.go index c83f6488c..49fea9e22 100644 --- a/internal/fanql/hints_test.go +++ b/internal/fanql/hints_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) // Foreign forms get one problem with a fix-it that makes the query valid. diff --git a/internal/fanql/latency_test.go b/internal/fanql/latency_test.go index 02fd0b397..0c977e19c 100644 --- a/internal/fanql/latency_test.go +++ b/internal/fanql/latency_test.go @@ -11,7 +11,7 @@ import ( "time" "unicode/utf8" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) type budgetParser struct { @@ -108,7 +108,7 @@ func TestLatencyBudgets(t *testing.T) { } t.Run("smoke", func(t *testing.T) { if !latencyAcceptanceEnabled() { - t.Skip("set FANOUT_TEST_LATENCY=1 or run just fanql-perf to assert wall-clock budgets") + t.Skip("set PITOT_TEST_LATENCY=1 or run just fanql-perf to assert wall-clock budgets") } if raceInstrumentation { t.Skip("wall-clock smoke budgets exclude race instrumentation; deterministic work bounds still run") @@ -233,11 +233,11 @@ func BenchmarkParseRank(b *testing.B) { func TestLatencyAcceptanceRequiresOptIn(t *testing.T) { for _, value := range []string{"", "0", "true", "1"} { - t.Setenv("FANOUT_TEST_LATENCY", value) + t.Setenv("PITOT_TEST_LATENCY", value) if got := latencyAcceptanceEnabled(); got != (value == "1") { t.Errorf("opt-in %q: got %v", value, got) } } } -func latencyAcceptanceEnabled() bool { return os.Getenv("FANOUT_TEST_LATENCY") == "1" } +func latencyAcceptanceEnabled() bool { return os.Getenv("PITOT_TEST_LATENCY") == "1" } diff --git a/internal/fanql/lift.go b/internal/fanql/lift.go index c045eabbf..b4d73021a 100644 --- a/internal/fanql/lift.go +++ b/internal/fanql/lift.go @@ -9,9 +9,9 @@ import ( "strconv" "strings" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/sqlscan" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/sqlscan" + "github.com/labstack/pitot/internal/telemetry" ) // formatInputError denotes a stored query that cannot be expressed without diff --git a/internal/fanql/lift_test.go b/internal/fanql/lift_test.go index 498cccc08..6a48cf2ce 100644 --- a/internal/fanql/lift_test.go +++ b/internal/fanql/lift_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) type countingParser struct { diff --git a/internal/fanql/literal_roundtrip_test.go b/internal/fanql/literal_roundtrip_test.go index d822bf578..24689547b 100644 --- a/internal/fanql/literal_roundtrip_test.go +++ b/internal/fanql/literal_roundtrip_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) func TestCompileNestedMeasureNegation(t *testing.T) { diff --git a/internal/fanql/lower.go b/internal/fanql/lower.go index 18a2b032e..bc5f1d15d 100644 --- a/internal/fanql/lower.go +++ b/internal/fanql/lower.go @@ -6,7 +6,7 @@ import ( "strconv" "strings" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) // lower is pure: it emits one SQL string per entry and keeps all stored order. diff --git a/internal/fanql/lower_test.go b/internal/fanql/lower_test.go index d153fd4d9..658f25964 100644 --- a/internal/fanql/lower_test.go +++ b/internal/fanql/lower_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) var lowerFixtures = []struct{ text, sql string }{ diff --git a/internal/fanql/parser.go b/internal/fanql/parser.go index c1ccd55a1..7d35166fb 100644 --- a/internal/fanql/parser.go +++ b/internal/fanql/parser.go @@ -9,8 +9,8 @@ import ( "strings" "unicode" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/suggest" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/suggest" ) const ( diff --git a/internal/fanql/parser_test.go b/internal/fanql/parser_test.go index 350583210..9259bd280 100644 --- a/internal/fanql/parser_test.go +++ b/internal/fanql/parser_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) func mustParse(t *testing.T, text string) *queryTree { diff --git a/internal/fanql/print.go b/internal/fanql/print.go index 0fc6e02d7..97491ced0 100644 --- a/internal/fanql/print.go +++ b/internal/fanql/print.go @@ -5,8 +5,8 @@ import ( "strings" "unicode" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/telemetry" ) // Print prints the canonical spelling of a resolved tree. This spelling is diff --git a/internal/fanql/reference.go b/internal/fanql/reference.go index 7ed6e07e7..ca5fc290c 100644 --- a/internal/fanql/reference.go +++ b/internal/fanql/reference.go @@ -5,8 +5,8 @@ import ( "slices" "strings" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/telemetry" ) // Reference is the shared API, MCP resource and generated-site reference. @@ -108,7 +108,7 @@ func Reference() string { b.WriteString(example) b.WriteByte('\n') } - b.WriteString("```\n\n## Transport\n\nMachine text inputs carry visualization, time, comparison, declarations, resolved values, namespace and options as needed. The structured query is required when editable is false. Panels keep storing queries, never text.\n\nCompletion accepts a relative `window` duration or absolute `from` and `to` timestamps. Absolute windows and durations over 24h use recent 24h schema, disclosed by `schema.recent` and `schema.notice`. With no selected window, the same recent fallback applies.\n\nHTTP exposes `/api/fanql/parse`, `/api/fanql/format`, `/api/fanql/complete` and `/api/fanql/reference`, requiring telemetry:read. MCP query_telemetry accepts optional text beside panel; agents should prefer panel.query, or panel.sql for complex work. This reference is also `fanout://fanql/reference`.\n") + b.WriteString("```\n\n## Transport\n\nMachine text inputs carry visualization, time, comparison, declarations, resolved values, namespace and options as needed. The structured query is required when editable is false. Panels keep storing queries, never text.\n\nCompletion accepts a relative `window` duration or absolute `from` and `to` timestamps. Absolute windows and durations over 24h use recent 24h schema, disclosed by `schema.recent` and `schema.notice`. With no selected window, the same recent fallback applies.\n\nHTTP exposes `/api/fanql/parse`, `/api/fanql/format`, `/api/fanql/complete` and `/api/fanql/reference`, requiring telemetry:read. MCP query_telemetry accepts optional text beside panel; agents should prefer panel.query, or panel.sql for complex work. This reference is also `pitot://fanql/reference`.\n") return b.String() } diff --git a/internal/fanql/reference_test.go b/internal/fanql/reference_test.go index aee3bb0db..025dddf59 100644 --- a/internal/fanql/reference_test.go +++ b/internal/fanql/reference_test.go @@ -4,8 +4,8 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/telemetry" ) func TestReferenceCoversEveryRegistryEntry(t *testing.T) { diff --git a/internal/fanql/registry_growth_test.go b/internal/fanql/registry_growth_test.go index f144db508..1166e0327 100644 --- a/internal/fanql/registry_growth_test.go +++ b/internal/fanql/registry_growth_test.go @@ -6,7 +6,7 @@ import ( "slices" "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) type registryMeaning struct { diff --git a/internal/fanql/resolve.go b/internal/fanql/resolve.go index 0ff5fdad0..d4af23dc6 100644 --- a/internal/fanql/resolve.go +++ b/internal/fanql/resolve.go @@ -11,10 +11,10 @@ import ( "time" "unicode/utf8" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/sqlscan" - "github.com/labstack/fanout/internal/suggest" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/sqlscan" + "github.com/labstack/pitot/internal/suggest" + "github.com/labstack/pitot/internal/telemetry" ) type Notice struct { diff --git a/internal/fanql/resolve_test.go b/internal/fanql/resolve_test.go index f9743090d..802abce59 100644 --- a/internal/fanql/resolve_test.go +++ b/internal/fanql/resolve_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" ) func resolvedText(t *testing.T, text string, opts Options) (*resolved, query.Problems) { diff --git a/internal/fanql/roundtrip_test.go b/internal/fanql/roundtrip_test.go index c9e6a504d..9e75db90c 100644 --- a/internal/fanql/roundtrip_test.go +++ b/internal/fanql/roundtrip_test.go @@ -14,8 +14,8 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/query" ) type storedQueryFixture struct { diff --git a/internal/fanql/semantics_test.go b/internal/fanql/semantics_test.go index 258ea548a..e9cbfa1f1 100644 --- a/internal/fanql/semantics_test.go +++ b/internal/fanql/semantics_test.go @@ -10,13 +10,13 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/engine/querytest" - "github.com/labstack/fanout/internal/ingest" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/engine/querytest" + "github.com/labstack/pitot/internal/ingest" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" collectorlogs "go.opentelemetry.io/proto/otlp/collector/logs/v1" commonpb "go.opentelemetry.io/proto/otlp/common/v1" logspb "go.opentelemetry.io/proto/otlp/logs/v1" diff --git a/internal/fanql/testhelpers_test.go b/internal/fanql/testhelpers_test.go index ea5708aa4..c0a66b918 100644 --- a/internal/fanql/testhelpers_test.go +++ b/internal/fanql/testhelpers_test.go @@ -4,10 +4,10 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/query" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/query" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func newTestEngine(t testing.TB) (*engine.Duck, *telemetrystore.Repository) { diff --git a/internal/fanql/words.go b/internal/fanql/words.go index 07226943f..9c2b585fa 100644 --- a/internal/fanql/words.go +++ b/internal/fanql/words.go @@ -2,7 +2,7 @@ package fanql import ( "fmt" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" "strings" ) diff --git a/internal/id/id.go b/internal/id/id.go index ccb31c9c9..72a13cd33 100644 --- a/internal/id/id.go +++ b/internal/id/id.go @@ -1,4 +1,4 @@ -// Package id centralizes identifiers generated and owned by Fanout. +// Package id centralizes identifiers generated and owned by Pitot. package id import "github.com/google/uuid" diff --git a/internal/ingest/admission_bench_test.go b/internal/ingest/admission_bench_test.go index f263bff7a..6c5f19f70 100644 --- a/internal/ingest/admission_bench_test.go +++ b/internal/ingest/admission_bench_test.go @@ -6,9 +6,9 @@ import ( "syscall" "testing" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" collectortrace "go.opentelemetry.io/proto/otlp/collector/trace/v1" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/internal/ingest/auth.go b/internal/ingest/auth.go index aed7f97cc..d85995a69 100644 --- a/internal/ingest/auth.go +++ b/internal/ingest/auth.go @@ -12,8 +12,8 @@ import ( "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" - "github.com/labstack/fanout/internal/secret" - "github.com/labstack/fanout/internal/settings" + "github.com/labstack/pitot/internal/secret" + "github.com/labstack/pitot/internal/settings" ) // GRPCServerOptions authenticates exports. The shared HTTP server owns TLS. @@ -66,7 +66,7 @@ func (a *ingestAuthorizer) authorizeToken(ctx context.Context, token string) err return errInvalidIngestToken } if a.settingsStore == nil { - // Defensive: production always wires a store (cmd/fanout/main.go). Reaching + // Defensive: production always wires a store (cmd/pitot/main.go). Reaching // this path means a mis-wired init; fail closed and log so it surfaces. slog.Error("ingest: settings store not wired; rejecting request") return errIngestAuthUnavailable diff --git a/internal/ingest/auth_test.go b/internal/ingest/auth_test.go index 8808cc673..cb3443724 100644 --- a/internal/ingest/auth_test.go +++ b/internal/ingest/auth_test.go @@ -10,8 +10,8 @@ import ( "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" - "github.com/labstack/fanout/internal/settings" - appstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/settings" + appstore "github.com/labstack/pitot/internal/store" ) func TestGRPCServerOptions(t *testing.T) { @@ -87,7 +87,7 @@ func TestAuthorize_AcceptsCaseInsensitiveBearerScheme(t *testing.T) { } } -func TestAuthorize_RejectsLegacyFanoutHeader(t *testing.T) { +func TestAuthorize_RejectsLegacyPitotHeader(t *testing.T) { store := newRuntimeStore(t) token, _, err := settings.GenerateIngestToken() if err != nil { @@ -98,7 +98,7 @@ func TestAuthorize_RejectsLegacyFanoutHeader(t *testing.T) { } authorizer := newIngestAuthorizer(store) - ctx := metadata.NewIncomingContext(context.Background(), metadata.Pairs("x-fanout-ingest-token", token)) + ctx := metadata.NewIncomingContext(context.Background(), metadata.Pairs("x-pitot-ingest-token", token)) err = authorizer.authorize(ctx) if status.Code(err) != codes.Unauthenticated { diff --git a/internal/ingest/conversion_test.go b/internal/ingest/conversion_test.go index e53e226e5..b4cd0f126 100644 --- a/internal/ingest/conversion_test.go +++ b/internal/ingest/conversion_test.go @@ -8,8 +8,8 @@ import ( "reflect" "testing" - "github.com/labstack/fanout/internal/config" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" collectorlogs "go.opentelemetry.io/proto/otlp/collector/logs/v1" collectormetrics "go.opentelemetry.io/proto/otlp/collector/metrics/v1" collectortrace "go.opentelemetry.io/proto/otlp/collector/trace/v1" @@ -141,7 +141,7 @@ func TestExportConversionRowsMatchBaseline(t *testing.T) { } } -// Fanout stores keys exactly as sent: current and deprecated spellings both +// Pitot stores keys exactly as sent: current and deprecated spellings both // stay in the maps, and neither fills a column for the other. func TestTraceKeepsAttributeSpellingsAsSent(t *testing.T) { text := func(k, v string) *common.KeyValue { diff --git a/internal/ingest/exponential_histogram_test.go b/internal/ingest/exponential_histogram_test.go index e3cd75620..fde829328 100644 --- a/internal/ingest/exponential_histogram_test.go +++ b/internal/ingest/exponential_histogram_test.go @@ -7,8 +7,8 @@ import ( collectormetrics "go.opentelemetry.io/proto/otlp/collector/metrics/v1" metricspb "go.opentelemetry.io/proto/otlp/metrics/v1" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/telemetry" ) // Exponential histograms are stored as sent: scale, zero bucket, offsets and diff --git a/internal/ingest/http.go b/internal/ingest/http.go index 7ab6f1b06..1586f4434 100644 --- a/internal/ingest/http.go +++ b/internal/ingest/http.go @@ -21,7 +21,7 @@ import ( "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" - "github.com/labstack/fanout/internal/settings" + "github.com/labstack/pitot/internal/settings" ) const ( diff --git a/internal/ingest/http_test.go b/internal/ingest/http_test.go index b319eb450..ae9651733 100644 --- a/internal/ingest/http_test.go +++ b/internal/ingest/http_test.go @@ -25,9 +25,9 @@ import ( tracepb "go.opentelemetry.io/proto/otlp/trace/v1" "google.golang.org/protobuf/proto" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/settings" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/settings" + "github.com/labstack/pitot/internal/telemetry" ) type httpIngestFixture struct { @@ -133,7 +133,7 @@ func TestHTTPIngestAuthentication(t *testing.T) { f := newHTTPIngestFixture(t, true) assertOTLPHTTPStatus(t, f.handler, http.MethodPost, "/v1/traces", testTraceRequest(), "foi_"+strings.Repeat("A", 43), http.StatusUnauthorized) }) - t.Run("legacy Fanout header", func(t *testing.T) { + t.Run("legacy Pitot header", func(t *testing.T) { f := newHTTPIngestFixture(t, true) payload, err := proto.Marshal(testTraceRequest()) if err != nil { @@ -141,7 +141,7 @@ func TestHTTPIngestAuthentication(t *testing.T) { } req := httptest.NewRequest(http.MethodPost, "/v1/traces", bytes.NewReader(payload)) req.Header.Set("Content-Type", otlpProtobufContentType) - req.Header.Set("x-fanout-ingest-token", f.token) + req.Header.Set("x-pitot-ingest-token", f.token) rec := httptest.NewRecorder() f.handler.ServeHTTP(rec, req) if rec.Code != http.StatusUnauthorized { diff --git a/internal/ingest/listener_test.go b/internal/ingest/listener_test.go index 96bc1b8bd..a0f45677f 100644 --- a/internal/ingest/listener_test.go +++ b/internal/ingest/listener_test.go @@ -18,9 +18,9 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - httpserver "github.com/labstack/fanout/internal/server" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + httpserver "github.com/labstack/pitot/internal/server" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" collectorlogs "go.opentelemetry.io/proto/otlp/collector/logs/v1" collectormetrics "go.opentelemetry.io/proto/otlp/collector/metrics/v1" collectortrace "go.opentelemetry.io/proto/otlp/collector/trace/v1" diff --git a/internal/ingest/metric_fidelity_test.go b/internal/ingest/metric_fidelity_test.go index d3371fa9b..722144ce3 100644 --- a/internal/ingest/metric_fidelity_test.go +++ b/internal/ingest/metric_fidelity_test.go @@ -8,8 +8,8 @@ import ( "github.com/parquet-go/parquet-go" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/telemetry" collectormetrics "go.opentelemetry.io/proto/otlp/collector/metrics/v1" metricspb "go.opentelemetry.io/proto/otlp/metrics/v1" "google.golang.org/grpc/codes" diff --git a/internal/ingest/nesting_test.go b/internal/ingest/nesting_test.go index 08f4250f3..17224d8ff 100644 --- a/internal/ingest/nesting_test.go +++ b/internal/ingest/nesting_test.go @@ -10,9 +10,9 @@ import ( "reflect" "testing" - "github.com/labstack/fanout/internal/config" - _ "github.com/labstack/fanout/internal/duckdb" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + _ "github.com/labstack/pitot/internal/duckdb" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" collectorlogs "go.opentelemetry.io/proto/otlp/collector/logs/v1" collectormetrics "go.opentelemetry.io/proto/otlp/collector/metrics/v1" collectortrace "go.opentelemetry.io/proto/otlp/collector/trace/v1" diff --git a/internal/ingest/server.go b/internal/ingest/server.go index c16555a19..41d315a91 100644 --- a/internal/ingest/server.go +++ b/internal/ingest/server.go @@ -21,9 +21,9 @@ import ( tracepb "go.opentelemetry.io/proto/otlp/trace/v1" "google.golang.org/grpc" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/internal/ingest/server_test.go b/internal/ingest/server_test.go index c5b84c9fc..5a280345f 100644 --- a/internal/ingest/server_test.go +++ b/internal/ingest/server_test.go @@ -15,8 +15,8 @@ import ( resourcepb "go.opentelemetry.io/proto/otlp/resource/v1" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/telemetry" ) func TestBodyString(t *testing.T) { diff --git a/internal/ingest/shed_test.go b/internal/ingest/shed_test.go index 53a403095..c4f73be14 100644 --- a/internal/ingest/shed_test.go +++ b/internal/ingest/shed_test.go @@ -9,8 +9,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/internal/ingest/submitter_test.go b/internal/ingest/submitter_test.go index 2e1de060e..32e2027c7 100644 --- a/internal/ingest/submitter_test.go +++ b/internal/ingest/submitter_test.go @@ -3,8 +3,8 @@ package ingest import ( "context" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) type channelSubmitter struct { diff --git a/internal/ingest/transport_bench_test.go b/internal/ingest/transport_bench_test.go index eb0717597..e1fab38eb 100644 --- a/internal/ingest/transport_bench_test.go +++ b/internal/ingest/transport_bench_test.go @@ -19,10 +19,10 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - httpserver "github.com/labstack/fanout/internal/server" - "github.com/labstack/fanout/internal/settings" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + httpserver "github.com/labstack/pitot/internal/server" + "github.com/labstack/pitot/internal/settings" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" collectorlogs "go.opentelemetry.io/proto/otlp/collector/logs/v1" collectormetrics "go.opentelemetry.io/proto/otlp/collector/metrics/v1" collectortrace "go.opentelemetry.io/proto/otlp/collector/trace/v1" @@ -35,7 +35,7 @@ import ( // conversion; durable also waits for the production writer's Parquet commit. // Client and server share this process: CPU/allocations include both sides. // Run: go test -tags transportbench ./internal/ingest -run '^TestTransportComparison$' -v -count=1 -timeout=10m -// FANOUT_BENCH_PROFILE_DIR writes a CPU profile of each measurement interval +// PITOT_BENCH_PROFILE_DIR writes a CPU profile of each measurement interval // and a post-load heap profile under a separate directory for every subtest. func TestTransportComparison(t *testing.T) { t.Logf("environment go=%s os=%s arch=%s CPUs=%d GOMAXPROCS=%d", runtime.Version(), runtime.GOOS, runtime.GOARCH, runtime.NumCPU(), runtime.GOMAXPROCS(0)) @@ -173,7 +173,7 @@ func runTransportComparison(t *testing.T, mode string, durable bool, concurrency runtime.GC() var before, after runtime.MemStats runtime.ReadMemStats(&before) - profileDir := os.Getenv("FANOUT_BENCH_PROFILE_DIR") + profileDir := os.Getenv("PITOT_BENCH_PROFILE_DIR") var cpuFile *os.File if profileDir != "" { profileDir = filepath.Join(profileDir, t.Name()) diff --git a/internal/intelligence/annotations_test.go b/internal/intelligence/annotations_test.go index 9bb3f948d..107819e21 100644 --- a/internal/intelligence/annotations_test.go +++ b/internal/intelligence/annotations_test.go @@ -2,11 +2,11 @@ package intelligence import ( "context" - "github.com/labstack/fanout/internal/annotations" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/engine/writegate" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/annotations" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/engine/writegate" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "testing" "time" ) diff --git a/internal/intelligence/detector.go b/internal/intelligence/detector.go index 0665acb57..95c0e636f 100644 --- a/internal/intelligence/detector.go +++ b/internal/intelligence/detector.go @@ -12,8 +12,8 @@ import ( "sync" "time" - "github.com/labstack/fanout/internal/annotations" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/annotations" + "github.com/labstack/pitot/internal/queryrows" ) // Engine is the read and annotation surface the detector uses; *engine.Duck diff --git a/internal/intelligence/detector_recovery_test.go b/internal/intelligence/detector_recovery_test.go index b3c9aecfb..cb8ad7fa8 100644 --- a/internal/intelligence/detector_recovery_test.go +++ b/internal/intelligence/detector_recovery_test.go @@ -7,11 +7,11 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/annotations" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/engine/writegate" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/annotations" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/engine/writegate" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func seedDetectorRecoveryRollup(t *testing.T, db *sql.DB, end time.Time) { diff --git a/internal/intelligence/effect_size_test.go b/internal/intelligence/effect_size_test.go index 3fa65689a..ed20994cd 100644 --- a/internal/intelligence/effect_size_test.go +++ b/internal/intelligence/effect_size_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/engine" + "github.com/labstack/pitot/internal/engine" ) func TestLatencyAnomaliesRequireStatisticalAndPracticalSignificance(t *testing.T) { diff --git a/internal/intelligence/parquet_test.go b/internal/intelligence/parquet_test.go index 2be4f67b7..653cfae49 100644 --- a/internal/intelligence/parquet_test.go +++ b/internal/intelligence/parquet_test.go @@ -6,10 +6,10 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) // Exercise the production Parquet timestamp type, not a mutable TIMESTAMP table. diff --git a/internal/intelligence/pattern_recovery_test.go b/internal/intelligence/pattern_recovery_test.go index 107cb68f2..159f1344a 100644 --- a/internal/intelligence/pattern_recovery_test.go +++ b/internal/intelligence/pattern_recovery_test.go @@ -7,11 +7,11 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) // detectorEngine is a real engine whose detector reads can fail on demand: a diff --git a/internal/intelligence/rollup_detector_test.go b/internal/intelligence/rollup_detector_test.go index 60cfa12f7..fd21d8105 100644 --- a/internal/intelligence/rollup_detector_test.go +++ b/internal/intelligence/rollup_detector_test.go @@ -6,10 +6,10 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/annotations" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/annotations" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestServiceDetectorsWeightMinutesBySpanCount(t *testing.T) { diff --git a/internal/mcp/apps.go b/internal/mcp/apps.go index bd5fd7a81..f8cdee592 100644 --- a/internal/mcp/apps.go +++ b/internal/mcp/apps.go @@ -9,7 +9,7 @@ import ( const ( mcpAppMIME = "text/html;profile=mcp-app" - panelsAppURI = "ui://fanout/panels.html" + panelsAppURI = "ui://pitot/panels.html" ) //go:embed apps/*.html @@ -27,7 +27,7 @@ func (s *Server) addAppResource(name, uri, path string) { Title: name, URI: uri, MIMEType: mcpAppMIME, - Description: "Interactive Fanout observability view delivered as an MCP App.", + Description: "Interactive Pitot observability view delivered as an MCP App.", }, func(_ context.Context, _ *mcp.ReadResourceRequest) (*mcp.ReadResourceResult, error) { html, err := appFiles.ReadFile(path) if err != nil { diff --git a/internal/mcp/apps/panels.html b/internal/mcp/apps/panels.html index 7c8ac8f6e..e2a68a5ae 100644 --- a/internal/mcp/apps/panels.html +++ b/internal/mcp/apps/panels.html @@ -1,5 +1,5 @@ -Fanout panels +container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:Y().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:Y().optional().describe(`User's timezone in IANA format.`),userAgent:Y().optional().describe(`Host application identifier.`),platform:_6([$(`web`),$(`desktop`),$(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:Q({touch:c6().optional().describe(`Whether the device supports touch input.`),hover:c6().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:Q({top:X().describe(`Top safe area inset in pixels.`),right:X().describe(`Right safe area inset in pixels.`),bottom:X().describe(`Bottom safe area inset in pixels.`),left:X().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough(),rLe=Q({method:$(`ui/notifications/host-context-changed`),params:Z9.describe(`Partial context update containing only changed fields.`)});Q({method:$(`ui/update-model-context`),params:Q({content:Z(v5).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:x6(Y(),f6().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),Q({method:$(`ui/initialize`),params:Q({appInfo:f8.describe(`App identification (name and version).`),appCapabilities:$Ie.describe(`Features and capabilities this app provides.`),protocolVersion:Y().describe(`Protocol version this app supports.`)})});var iLe=Q({protocolVersion:Y().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:f8.describe(`Host application identification and version.`),hostCapabilities:QIe.describe(`Features and capabilities provided by the host.`),hostContext:Z9.describe(`Rich context about the host environment.`)}).passthrough(),aLe={target:`draft-2020-12`};async function Q9(e,t){let n=e[`~standard`];if(n.jsonSchema)return n.jsonSchema[t](aLe);throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function $9(e,t,n=``){let r=await e[`~standard`].validate(t);if(r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e).join(`.`);return t?`${t}: ${e.message}`:e.message}).join(`; `);throw Error(n+e)}return r.value}function oLe(e,t){let n={...e,...t};return t.experimental!==void 0&&(n.experimental={...e.experimental,...t.experimental}),t.tools!==void 0&&(n.tools={...e.tools,...t.tools}),n}var sLe=class e extends xIe{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new IIe;_methods=new LIe;setRequestHandler=(...e)=>{let[t,...n]=G9(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=G9(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};removeRequestHandler=e=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=e=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:GIe,toolinputpartial:KIe,toolresult:nLe,toolcancelled:qIe,hostcontextchanged:rLe};static ONE_SHOT_EVENTS=new Set([`toolinput`,`toolinputpartial`,`toolresult`,`toolcancelled`]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(n);console.warn(n)}setEventHandler(e,t){t&&this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},t=>{let n=t;e===`hostcontextchanged`&&(this._hostContext={...this._hostContext,...n}),this._events.dispatch(e,n)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,n){t&&n&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},n={autoResize:!0}){super(n),this._appInfo=e,this._appCapabilities=t,this.options=n,this._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),!n.allowUnsafeEval&&x2({jitless:!0}),this.replaceRequestHandler(`ping`,e=>(console.log(`Received ping:`,e.params),{})),this.setEventHandler(`hostcontextchanged`,void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after transport is established`);this._appCapabilities=oLe(this._appCapabilities,e)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,i=()=>{r._initializedSent&&r._appCapabilities.tools?.listChanged&&r.sendToolListChanged()},a=t.inputSchema!==void 0,o={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(e){Object.assign(this,e),i()},remove(){r._registeredTools[e]===o&&(delete r._registeredTools[e],i())},handler:async(t,r)=>{if(!o.enabled)throw Error(`Tool ${e} is disabled`);let i;if(a){let a=o.inputSchema;i=await n(a?await $9(a,t??{},`Invalid input for tool ${e}: `):t??{},r)}else i=await n(r);return o.outputSchema&&!i.isError&&(i.structuredContent=await $9(o.outputSchema,i.structuredContent,`Invalid output for tool ${e}: `)),i}};return this._registeredTools[e]=o,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),o}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let n=this._registeredTools[e.name];if(!n)throw Error(`Tool ${e.name} not found`);return n.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([e,t])=>t.enabled).map(async([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?await Q9(t.inputSchema,`input`):{type:`object`,properties:{}}};return t.outputSchema&&(n.outputSchema=await Q9(t.outputSchema,`output`)),t.annotations&&(n.annotations=t.annotations),t._meta&&(n._meta=t._meta),n}))}))}async sendToolListChanged(e={}){this._assertInitialized(`sendToolListChanged`),await this.notification({method:`notifications/tools/list_changed`,params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler(`toolinput`)}set ontoolinput(e){this.setEventHandler(`toolinput`,e)}get ontoolinputpartial(){return this.getEventHandler(`toolinputpartial`)}set ontoolinputpartial(e){this.setEventHandler(`toolinputpartial`,e)}get ontoolresult(){return this.getEventHandler(`toolresult`)}set ontoolresult(e){this.setEventHandler(`toolresult`,e)}get ontoolcancelled(){return this.getEventHandler(`toolcancelled`)}set ontoolcancelled(e){this.setEventHandler(`toolcancelled`,e)}get onhostcontextchanged(){return this.getEventHandler(`hostcontextchanged`)}set onhostcontextchanged(e){this.setEventHandler(`hostcontextchanged`,e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced(`onteardown`,this._onteardown,e),this._onteardown=e,this.replaceRequestHandler(`ui/resource-teardown`,{params:XIe.shape.params,result:ZIe},(e,t)=>{if(!this._onteardown)throw Error(`No onteardown handler set`);return this._onteardown(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(`tools/call`,(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced(`onlisttools`,this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler(`tools/list`,(e,t)=>{if(!this._onlisttools)throw Error(`No onlisttools handler set`);return this._onlisttools(e.params,t)})}assertCapabilityForMethod(e){if(e===`sampling/createMessage`&&!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case`tools/call`:case`tools/list`:if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized(`callServerTool`),typeof e==`string`)throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:`tools/call`,params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized(`readServerResource`),await this.request({method:`resources/read`,params:e},t)}async listServerResources(e,t){return this._assertInitialized(`listServerResources`),await this.request({method:`resources/list`,params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized(`createSamplingMessage`),await this.request({method:`sampling/createMessage`,params:e},t)}sendMessage(e,t){return this._assertInitialized(`sendMessage`),this.request({method:`ui/message`,params:e},WIe,t)}sendLog(e){return this.notification({method:`notifications/message`,params:e})}updateModelContext(e,t){return this._assertInitialized(`updateModelContext`),this.request({method:`ui/update-model-context`,params:e},o8,t)}openLink(e,t){return this._assertInitialized(`openLink`),this.request({method:`ui/open-link`,params:e},HIe,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized(`downloadFile`),this.request({method:`ui/download-file`,params:e},UIe,t)}requestTeardown(e={}){return this.notification({method:`ui/notifications/request-teardown`,params:e})}requestDisplayMode(e,t){return this._assertInitialized(`requestDisplayMode`),this.request({method:`ui/request-display-mode`,params:e},eLe,t)}sendSizeChanged(e){return this.notification({method:`ui/notifications/size-changed`,params:e})}setupSizeChangedNotifications(){let e=!1,t=0,n=0,r=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let r=document.documentElement,i=r.style.height;r.style.height=`max-content`;let a=Math.ceil(r.getBoundingClientRect().height);r.style.height=i;let o=Math.ceil(window.innerWidth);(o!==t||a!==n)&&(t=o,n=a,this.sendSizeChanged({width:o,height:a}))}))};r();let i=new ResizeObserver(r);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(e=new K9(window.parent,window.parent),t){if(this.transport)throw Error(`App is already connected. Call close() before connecting again.`);this._initializedSent=!1;try{await super.connect(e);let n=await this.request({method:`ui/initialize`,params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:zIe}},iLe,t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:`ui/notifications/initialized`}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(e){throw this.close(),e}}};function cLe({appInfo:e,capabilities:t,onAppCreated:n,autoResize:r=!0,strict:i}){let[a,o]=(0,A.useState)(null),[s,c]=(0,A.useState)(!1),[l,u]=(0,A.useState)(null);return(0,A.useEffect)(()=>{let a=!0,s;async function l(){try{let l=new K9(window.parent,window.parent);if(s=new sLe(e,t,{autoResize:r,strict:i}),n?.(s),await s.connect(l),!a){s.close();return}o(s),c(!0),u(null)}catch(e){a&&(o(null),c(!1),u(e instanceof Error?e:Error(`Failed to connect`)))}}return l(),()=>{a=!1,s?.close()}},[]),{app:a,isConnected:s,error:l}}function lLe(){let[e,t]=(0,A.useState)(null),[n,r]=(0,A.useState)(),[i,a]=(0,A.useState)(null);function o(e){try{if(e.isError){let n=e.content?.find(e=>e.type===`text`),r=e.structuredContent??(n?.type===`text`?JSON.parse(n.text):void 0);if(r?.error&&typeof r.error==`object`&&`code`in r.error&&r.error.code===`no_data`&&`message`in r.error&&typeof r.error.message==`string`){t(null),a(r.error.message);return}throw Error(`Tool error`)}let n=dv(e.structuredContent);t(n),a(null)}catch{a(`This view could not be loaded. Please try again.`)}}let s=cLe({autoResize:!1,appInfo:{name:`Pitot panels`,version:`1.0.0`},capabilities:{},onAppCreated:e=>{e.ontoolresult=o,e.ontoolcancelled=()=>a(`View cancelled.`),e.onhostcontextchanged=e=>r(t=>({...t,...e})),e.onerror=()=>a(`This view could not be refreshed. Please try again.`)}});return(0,A.useEffect)(()=>{s.app&&r(s.app.getHostContext())},[s.app]),{...s,fragment:e,host:n,toolError:i}}function uLe(e,t){let n,r=()=>{let r=e.getBoundingClientRect().height;n!==void 0&&Math.abs(r-n)<2||(n=r,t({height:Math.round(r)}))},i=new ResizeObserver(r);return i.observe(e),r(),()=>i.disconnect()}var dLe=new Kee({defaultOptions:{queries:{retry:!1}}});function fLe(){let{app:e,fragment:t,host:n,error:r,toolError:i}=lLe(),a=(0,A.useRef)(null);(0,A.useEffect)(()=>{if(e&&a.current)return uLe(a.current,t=>e.sendSizeChanged(t))},[e]);let o=(0,A.useMemo)(()=>e?qOe(e):void 0,[e]),s=Ce(`(prefers-color-scheme: dark)`,void 0,{getInitialValueInEffect:!1}),c=n?.theme?n.theme===`dark`:s,l=i??(r?`This view could not be loaded. Please try again.`:null);return(0,R.jsx)(Pn,{theme:ite,cssVariablesResolver:ate,forceColorScheme:c?`dark`:`light`,children:(0,R.jsx)(Dee,{client:dLe,children:(0,R.jsx)(`div`,{ref:a,role:`main`,"aria-label":`Pitot analysis view`,"data-app-content":!0,children:t&&o&&n?(0,R.jsxs)(R.Fragment,{children:[l&&(0,R.jsx)(B,{m:`md`,children:(0,R.jsx)(Jg,{state:`error`,error:{message:l}})}),(0,R.jsx)(KOe,{fragment:t,dark:c,onQuery:o.query,drillClient:o.drill,resolveVariables:o.resolveVariables,hostDisplayMode:n.displayMode??`inline`,onDisplayMode:n.availableDisplayModes?.includes(`fullscreen`)?async t=>(await e.requestDisplayMode({mode:t})).mode===t:void 0})]}):l?(0,R.jsx)(B,{m:`md`,children:(0,R.jsx)(Jg,{state:`error`,error:{message:l}})}):(0,R.jsx)(Jg,{state:`loading`,loadingLabel:`Loading panel view`})})})})}(0,Og.createRoot)(document.getElementById(`root`)).render((0,R.jsx)(A.StrictMode,{children:(0,R.jsx)(fLe,{})}));
diff --git a/internal/mcp/committed_panic_test.go b/internal/mcp/committed_panic_test.go index 1775d5c23..719396c43 100644 --- a/internal/mcp/committed_panic_test.go +++ b/internal/mcp/committed_panic_test.go @@ -9,8 +9,8 @@ import ( "sync/atomic" "testing" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/query" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/internal/mcp/concurrent_receipts_test.go b/internal/mcp/concurrent_receipts_test.go index 916f0ad5f..ec9f8904f 100644 --- a/internal/mcp/concurrent_receipts_test.go +++ b/internal/mcp/concurrent_receipts_test.go @@ -8,9 +8,9 @@ import ( "sync" "testing" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/query" - controlstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/query" + controlstore "github.com/labstack/pitot/internal/store" ) func newConcurrentFileServer(t *testing.T) *Server { diff --git a/internal/mcp/dashboards.go b/internal/mcp/dashboards.go index 21d0c78dd..a5bb9c3ea 100644 --- a/internal/mcp/dashboards.go +++ b/internal/mcp/dashboards.go @@ -9,9 +9,9 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/toolerror" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/toolerror" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/internal/mcp/dashboards_tools_test.go b/internal/mcp/dashboards_tools_test.go index a92f39ac0..81eafe317 100644 --- a/internal/mcp/dashboards_tools_test.go +++ b/internal/mcp/dashboards_tools_test.go @@ -7,9 +7,9 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/query" - controlstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/query" + controlstore "github.com/labstack/pitot/internal/store" mcpgoauth "github.com/modelcontextprotocol/go-sdk/auth" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/internal/mcp/describe.go b/internal/mcp/describe.go index c644115c0..0e414e1fe 100644 --- a/internal/mcp/describe.go +++ b/internal/mcp/describe.go @@ -9,8 +9,8 @@ import ( "github.com/modelcontextprotocol/go-sdk/mcp" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/intelligence" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/intelligence" ) // This file exists so the MCP reference can be generated from the server itself @@ -95,7 +95,7 @@ func DescribeTools(ctx context.Context) ([]ToolDoc, error) { connected <- connection{session: session, err: err} }() - client := mcp.NewClient(&mcp.Implementation{Name: "fanout-docgen", Version: "docgen"}, &mcp.ClientOptions{ + client := mcp.NewClient(&mcp.Implementation{Name: "pitot-docgen", Version: "docgen"}, &mcp.ClientOptions{ Capabilities: &mcp.ClientCapabilities{Extensions: map[string]any{mcpUIExtension: map[string]any{"mimeTypes": []string{mcpAppMIME}}}}, }) session, err := client.Connect(ctx, clientTransport, nil) diff --git a/internal/mcp/describe_test.go b/internal/mcp/describe_test.go index c364c9610..59a271123 100644 --- a/internal/mcp/describe_test.go +++ b/internal/mcp/describe_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/dashboard" + "github.com/labstack/pitot/internal/dashboard" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -148,7 +148,7 @@ func TestDescribeToolsReportsCompleteMetadata(t *testing.T) { t.Errorf("%+v: incomplete metadata", doc) } if doc.OpenWorld { - t.Errorf("%s reports open-world; every Fanout tool is closed-world", doc.Name) + t.Errorf("%s reports open-world; every Pitot tool is closed-world", doc.Name) } for _, input := range doc.Inputs { if input.Type == "" { diff --git a/internal/mcp/error_contract_test.go b/internal/mcp/error_contract_test.go index 6c8687f8b..19f3d5466 100644 --- a/internal/mcp/error_contract_test.go +++ b/internal/mcp/error_contract_test.go @@ -7,9 +7,9 @@ import ( "reflect" "testing" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/toolerror" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/toolerror" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/internal/mcp/fanql_resource.go b/internal/mcp/fanql_resource.go index d43299bdc..89f0c92ef 100644 --- a/internal/mcp/fanql_resource.go +++ b/internal/mcp/fanql_resource.go @@ -3,11 +3,11 @@ package mcp import ( "context" - "github.com/labstack/fanout/internal/fanql" + "github.com/labstack/pitot/internal/fanql" "github.com/modelcontextprotocol/go-sdk/mcp" ) -const fanqlReferenceURI = "fanout://fanql/reference" +const fanqlReferenceURI = "pitot://fanql/reference" func (s *Server) registerFanQLResource() { s.mcp.AddResource(&mcp.Resource{ diff --git a/internal/mcp/fanql_test.go b/internal/mcp/fanql_test.go index 288accc3d..f959d8b77 100644 --- a/internal/mcp/fanql_test.go +++ b/internal/mcp/fanql_test.go @@ -8,9 +8,9 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/fanql" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/toolerror" + "github.com/labstack/pitot/internal/fanql" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/toolerror" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -91,7 +91,7 @@ func TestFanQLReferenceResource(t *testing.T) { } found := false for _, r := range listed.Resources { - if r.URI == "fanout://fanql/reference" { + if r.URI == "pitot://fanql/reference" { found = true if r.Name != "FanQL reference" || r.MIMEType != "text/markdown" { t.Fatal(r) @@ -101,7 +101,7 @@ func TestFanQLReferenceResource(t *testing.T) { if !found { t.Fatal("FanQL reference missing from resources/list") } - r, err := client.ReadResource(t.Context(), &mcp.ReadResourceParams{URI: "fanout://fanql/reference"}) + r, err := client.ReadResource(t.Context(), &mcp.ReadResourceParams{URI: "pitot://fanql/reference"}) if err != nil { t.Fatal(err) } @@ -121,7 +121,7 @@ func TestQueryTelemetryDescriptionPrefersStructuredInput(t *testing.T) { continue } d := tool.Description - if !strings.Contains(d, "panel.query") || strings.Index(d, "text") < strings.Index(d, "panel.query") || !strings.Contains(d, "fanout://fanql/reference") { + if !strings.Contains(d, "panel.query") || strings.Index(d, "text") < strings.Index(d, "panel.query") || !strings.Contains(d, "pitot://fanql/reference") { t.Fatal(d) } if tool.Annotations == nil || !tool.Annotations.ReadOnlyHint { diff --git a/internal/mcp/fragment_budget_test.go b/internal/mcp/fragment_budget_test.go index b54991698..62e0e9dcc 100644 --- a/internal/mcp/fragment_budget_test.go +++ b/internal/mcp/fragment_budget_test.go @@ -9,8 +9,8 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/query" sdk "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -111,7 +111,7 @@ func TestNullArgumentsRawJSONRPC(t *testing.T) { h := s.HTTPHandler() for _, name := range []string{"get_telemetry_schema", "list_dashboards", "get_overview"} { t.Run(name, func(t *testing.T) { - request := httptest.NewRequest("POST", "/api/mcp", strings.NewReader(fmt.Sprintf(`{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":%q,"_meta":{"io.fanout/owner-id":"owner","io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}},"arguments":null}}`, name))) + request := httptest.NewRequest("POST", "/api/mcp", strings.NewReader(fmt.Sprintf(`{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":%q,"_meta":{"io.pitot/owner-id":"owner","io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}},"arguments":null}}`, name))) request.Header.Set("Content-Type", "application/json") request.Header.Set("Accept", "application/json, text/event-stream") request.Header.Set("MCP-Protocol-Version", ProtocolVersion) diff --git a/internal/mcp/fragment_contract_test.go b/internal/mcp/fragment_contract_test.go index 252174f1b..36677d84e 100644 --- a/internal/mcp/fragment_contract_test.go +++ b/internal/mcp/fragment_contract_test.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "github.com/labstack/fanout/internal/observability" + "github.com/labstack/pitot/internal/observability" "math" "net/http" "net/http/httptest" @@ -15,7 +15,7 @@ import ( "time" "unicode/utf8" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" sdk "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/internal/mcp/fragment_identity_test.go b/internal/mcp/fragment_identity_test.go index 75e572a31..48179a911 100644 --- a/internal/mcp/fragment_identity_test.go +++ b/internal/mcp/fragment_identity_test.go @@ -1,7 +1,7 @@ package mcp import ( - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" "testing" ) diff --git a/internal/mcp/fragments.go b/internal/mcp/fragments.go index 57ec601b5..62f2b6f31 100644 --- a/internal/mcp/fragments.go +++ b/internal/mcp/fragments.go @@ -14,15 +14,15 @@ import ( "unicode/utf8" "github.com/google/jsonschema-go/jsonschema" - "github.com/labstack/fanout/internal/fanql" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/fanql" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/query" "github.com/modelcontextprotocol/go-sdk/mcp" ) type QueryTelemetryInput struct { Panel query.Panel `json:"panel" jsonschema:"One v1 panel to display in the answer"` - Text string `json:"text,omitempty" jsonschema:"FanQL text that becomes panel.query; prefer panel.query (structured) or panel.sql; see fanout://fanql/reference"` + Text string `json:"text,omitempty" jsonschema:"FanQL text that becomes panel.query; prefer panel.query (structured) or panel.sql; see pitot://fanql/reference"` Variables []query.Variable `json:"variables,omitempty" jsonschema:"Optional v1 variable definitions used by this panel"` Time *query.Time `json:"time,omitempty" jsonschema:"Optional dashboard time override: exact from/to or a relative range"` Vars map[string]query.Value `json:"vars,omitempty" jsonschema:"Resolved variable values: strings or lists; preserves $__all and empty lists"` diff --git a/internal/mcp/fragments_test.go b/internal/mcp/fragments_test.go index 7eaa16c0f..6cd5ad2b0 100644 --- a/internal/mcp/fragments_test.go +++ b/internal/mcp/fragments_test.go @@ -3,8 +3,8 @@ package mcp import ( "encoding/json" "fmt" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/query" "github.com/modelcontextprotocol/go-sdk/mcp" "reflect" "strings" diff --git a/internal/mcp/history_test.go b/internal/mcp/history_test.go index cad2a90ec..31baf19b9 100644 --- a/internal/mcp/history_test.go +++ b/internal/mcp/history_test.go @@ -10,8 +10,8 @@ import ( "sync/atomic" "testing" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/query" mcpgoauth "github.com/modelcontextprotocol/go-sdk/auth" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/internal/mcp/http_cancellation_test.go b/internal/mcp/http_cancellation_test.go index 2239ca37e..f50bb3028 100644 --- a/internal/mcp/http_cancellation_test.go +++ b/internal/mcp/http_cancellation_test.go @@ -11,11 +11,11 @@ import ( "time" duckdb "github.com/duckdb/duckdb-go/v2" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/queryrows" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/queryrows" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/internal/mcp/no_data_test.go b/internal/mcp/no_data_test.go index 4485b89a6..33da4f7f9 100644 --- a/internal/mcp/no_data_test.go +++ b/internal/mcp/no_data_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/toolerror" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/toolerror" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/internal/mcp/panel_examples_test.go b/internal/mcp/panel_examples_test.go index 0333efdda..0cdbe0beb 100644 --- a/internal/mcp/panel_examples_test.go +++ b/internal/mcp/panel_examples_test.go @@ -9,11 +9,11 @@ import ( "time" "unicode/utf8" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestSQLTimestampRuleAppearsOnceInAgentGuidance(t *testing.T) { diff --git a/internal/mcp/panels.go b/internal/mcp/panels.go index 67ba1a903..296e4f1fa 100644 --- a/internal/mcp/panels.go +++ b/internal/mcp/panels.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -48,7 +48,7 @@ const baseSpecGuide = `A dashboard is {name, description, time:{range}, variable func (s *Server) registerPanelTools() { readOnly := &mcp.ToolAnnotations{ReadOnlyHint: true, OpenWorldHint: boolPtr(false)} - fragmentTool(s, &mcp.Tool{Name: "query_telemetry", Title: "Telemetry panel", Description: "Display one v1 panel in chat as an executable dashboard fragment. Use get_telemetry_schema to discover fields; see create_dashboard for the spec guide. The authored spec plus vars must fit 128 KiB (131072 serialized JSON bytes); larger inputs are rejected with their actual size. Agents: write panel.query (structured JSON) first, or panel.sql for complex work; text accepts FanQL: source [where] filters | measures by fields every bucket sort key limit n. Examples: spans where status:error | count() by service; logs where severity>=warn | count() by service every 1m. See fanout://fanql/reference for fields, operators and variables.", Annotations: readOnly, Meta: appToolMeta(panelsAppURI)}, s.queryTelemetry) + fragmentTool(s, &mcp.Tool{Name: "query_telemetry", Title: "Telemetry panel", Description: "Display one v1 panel in chat as an executable dashboard fragment. Use get_telemetry_schema to discover fields; see create_dashboard for the spec guide. The authored spec plus vars must fit 128 KiB (131072 serialized JSON bytes); larger inputs are rejected with their actual size. Agents: write panel.query (structured JSON) first, or panel.sql for complex work; text accepts FanQL: source [where] filters | measures by fields every bucket sort key limit n. Examples: spans where status:error | count() by service; logs where severity>=warn | count() by service every 1m. See pitot://fanql/reference for fields, operators and variables.", Annotations: readOnly, Meta: appToolMeta(panelsAppURI)}, s.queryTelemetry) fragmentTool(s, &mcp.Tool{Name: "query_panel_fragment", Title: "Refresh telemetry panels", Description: "Run every panel in a dashboard fragment; panel subsets are forbidden.", Annotations: readOnly, Meta: appHelperMeta()}, func(ctx context.Context, req *mcp.CallToolRequest, input fragmentInput) (*mcp.CallToolResult, PanelFragment, error) { return s.queryPanelFragment(ctx, req, query.RunRequest{Dashboard: input.Dashboard, Time: input.Time, Vars: input.Vars, Widths: input.Widths, Compare: input.Compare}) }) diff --git a/internal/mcp/panels_distribution_test.go b/internal/mcp/panels_distribution_test.go index fbae4f0d1..dddf9e61b 100644 --- a/internal/mcp/panels_distribution_test.go +++ b/internal/mcp/panels_distribution_test.go @@ -4,7 +4,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/dashboard" + "github.com/labstack/pitot/internal/dashboard" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/internal/mcp/panels_test.go b/internal/mcp/panels_test.go index 092cdf833..afc499e12 100644 --- a/internal/mcp/panels_test.go +++ b/internal/mcp/panels_test.go @@ -8,16 +8,16 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/engine/querytest" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/query" - appstore "github.com/labstack/fanout/internal/store" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" - "github.com/labstack/fanout/internal/toolerror" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/engine/querytest" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/query" + appstore "github.com/labstack/pitot/internal/store" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" + "github.com/labstack/pitot/internal/toolerror" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/internal/mcp/pattern_context_guide_test.go b/internal/mcp/pattern_context_guide_test.go index ae9a4fd84..e6340c75f 100644 --- a/internal/mcp/pattern_context_guide_test.go +++ b/internal/mcp/pattern_context_guide_test.go @@ -1,7 +1,7 @@ package mcp import ( - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/query" "reflect" "strings" "testing" diff --git a/internal/mcp/performance_operations_test.go b/internal/mcp/performance_operations_test.go index 5d4d4c164..ce8ad6222 100644 --- a/internal/mcp/performance_operations_test.go +++ b/internal/mcp/performance_operations_test.go @@ -6,11 +6,11 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestPerformanceSlowOperationsAcrossProtocols(t *testing.T) { diff --git a/internal/mcp/presentation_test.go b/internal/mcp/presentation_test.go index deb8645a5..c5bba5f38 100644 --- a/internal/mcp/presentation_test.go +++ b/internal/mcp/presentation_test.go @@ -10,9 +10,9 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/toolerror" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/toolerror" mcpsdk "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/internal/mcp/receipt_quality_test.go b/internal/mcp/receipt_quality_test.go index b6435b622..622c416b8 100644 --- a/internal/mcp/receipt_quality_test.go +++ b/internal/mcp/receipt_quality_test.go @@ -10,8 +10,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/query" ) func parallelTimingExecutor() receiptExecutor { diff --git a/internal/mcp/receipts_test.go b/internal/mcp/receipts_test.go index 7f5c5dfea..bc0ff6be5 100644 --- a/internal/mcp/receipts_test.go +++ b/internal/mcp/receipts_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/query" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/internal/mcp/server.go b/internal/mcp/server.go index 5ecc9c31e..119d8df61 100644 --- a/internal/mcp/server.go +++ b/internal/mcp/server.go @@ -14,11 +14,11 @@ import ( "time" "unicode/utf8" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/intelligence" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/toolerror" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/intelligence" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/toolerror" "github.com/modelcontextprotocol/go-sdk/jsonrpc" "github.com/modelcontextprotocol/go-sdk/mcp" ) @@ -118,14 +118,14 @@ func NewWithIntelligence(queries Observability, dashboards *dashboard.Service, p func newServer(queries Observability, dashboards *dashboard.Service, panels *query.Executor, snapshots IntelligenceSnapshots, version string) *Server { s := &Server{ mcp: mcp.NewServer(&mcp.Implementation{ - Name: "fanout", - Title: "Fanout Observability", + Name: "pitot", + Title: "Pitot Observability", Version: version, }, &mcp.ServerOptions{SupportedProtocolVersions: supportedProtocolVersions, Instructions: serverInstructions, Capabilities: &mcp.ServerCapabilities{ Extensions: map[string]any{ mcpUIExtension: map[string]any{"mimeTypes": []string{mcpAppMIME}}, }, - // Fanout's tool and resource sets are fixed for the process lifetime. + // Pitot's tool and resource sets are fixed for the process lifetime. Tools: &mcp.ToolCapabilities{}, Resources: &mcp.ResourceCapabilities{}, }}), @@ -328,7 +328,7 @@ func (s *Server) HTTPHandler() http.Handler { // The MCP OAuth bearer middleware runs before this handler. Disable the SDK's // localhost Host heuristic because a legitimate local reverse proxy connects // over loopback while preserving the public Host (for example, - // fanout.example.com); the heuristic otherwise rejects every browser MCP App. + // pitot.example.com); the heuristic otherwise rejects every browser MCP App. modern := mcp.NewStreamableHTTPHandler( func(*http.Request) *mcp.Server { return s.mcp }, &mcp.StreamableHTTPOptions{ diff --git a/internal/mcp/server_test.go b/internal/mcp/server_test.go index 77f1a2458..c78b9be4a 100644 --- a/internal/mcp/server_test.go +++ b/internal/mcp/server_test.go @@ -8,11 +8,11 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/dashboard" - "github.com/labstack/fanout/internal/intelligence" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/query" - controlstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/dashboard" + "github.com/labstack/pitot/internal/intelligence" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/query" + controlstore "github.com/labstack/pitot/internal/store" mcpgoauth "github.com/modelcontextprotocol/go-sdk/auth" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/internal/mcp/service_input_test.go b/internal/mcp/service_input_test.go index 1a1764754..c8d91898e 100644 --- a/internal/mcp/service_input_test.go +++ b/internal/mcp/service_input_test.go @@ -10,14 +10,14 @@ import ( "time" "unicode/utf8" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/engine/querytest" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/query" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" - "github.com/labstack/fanout/internal/toolerror" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/engine/querytest" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/query" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" + "github.com/labstack/pitot/internal/toolerror" "github.com/modelcontextprotocol/go-sdk/mcp" ) diff --git a/internal/mcp/tool_errors_test.go b/internal/mcp/tool_errors_test.go index d3581d7d7..ca707305e 100644 --- a/internal/mcp/tool_errors_test.go +++ b/internal/mcp/tool_errors_test.go @@ -4,8 +4,8 @@ import ( "context" "errors" "fmt" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/query" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/query" "strings" "testing" "time" diff --git a/internal/metrics/duckdb_memory_test.go b/internal/metrics/duckdb_memory_test.go index e01b0b4bb..9c4f22966 100644 --- a/internal/metrics/duckdb_memory_test.go +++ b/internal/metrics/duckdb_memory_test.go @@ -17,7 +17,7 @@ func gatherDuckDBMemory(t *testing.T) map[string]float64 { } out := map[string]float64{} for _, family := range families { - if family.GetName() != "fanout_duckdb_memory_bytes" { + if family.GetName() != "pitot_duckdb_memory_bytes" { continue } for _, metric := range family.GetMetric() { @@ -94,7 +94,7 @@ func TestDuckDBMemoryIsSafeUnderConcurrentScrapes(t *testing.T) { return } for _, family := range families { - if family.GetName() != "fanout_duckdb_memory_bytes" { + if family.GetName() != "pitot_duckdb_memory_bytes" { continue } if n := len(family.GetMetric()); n != 3 { @@ -126,7 +126,7 @@ func gatherMemoryTimestamp(t *testing.T) float64 { t.Fatal(err) } for _, family := range families { - if family.GetName() == "fanout_duckdb_memory_last_success_timestamp_seconds" { + if family.GetName() == "pitot_duckdb_memory_last_success_timestamp_seconds" { return family.Metric[0].GetGauge().GetValue() } } diff --git a/internal/metrics/metrics.go b/internal/metrics/metrics.go index 2a70ea61b..4532671eb 100644 --- a/internal/metrics/metrics.go +++ b/internal/metrics/metrics.go @@ -47,52 +47,52 @@ const ( ) var ( - ReadCachePendingBatches = promauto.NewGauge(prometheus.GaugeOpts{Name: "fanout_read_cache_pending_batches", Help: "Nonempty active immutable batches across spans, logs and metrics not covered at the start of the last read-cache pass"}) + ReadCachePendingBatches = promauto.NewGauge(prometheus.GaugeOpts{Name: "pitot_read_cache_pending_batches", Help: "Nonempty active immutable batches across spans, logs and metrics not covered at the start of the last read-cache pass"}) // QueryCacheRequests counts panel, exemplar and trace-detail lookups in the // query result cache: hit (fresh), stale (served while one refresh runs), // miss (ran the queries) and coalesced (joined an identical run in flight). QueryCacheRequests = promauto.NewCounterVec(prometheus.CounterOpts{ - Name: "fanout_query_cache_requests_total", + Name: "pitot_query_cache_requests_total", Help: "Query result cache lookups by result: hit, stale, miss or coalesced", }, []string{"result"}) QueryCacheBytes = promauto.NewGauge(prometheus.GaugeOpts{ - Name: "fanout_query_cache_bytes", + Name: "pitot_query_cache_bytes", Help: "Estimated bytes of results held in the query result cache", }) IngestBackpressureSeconds = promauto.NewCounter(prometheus.CounterOpts{ - Name: "fanout_ingest_backpressure_seconds_total", Help: "Total seconds an ingest admission rate cap was active", + Name: "pitot_ingest_backpressure_seconds_total", Help: "Total seconds an ingest admission rate cap was active", }) CompactionPassSeconds = promauto.NewHistogram(prometheus.HistogramOpts{ - Name: "fanout_compaction_pass_seconds", Help: "Duration of a compaction pass including publication", Buckets: []float64{0.1, 0.5, 1, 2, 5, 10, 30, 60, 120, 300}, + Name: "pitot_compaction_pass_seconds", Help: "Duration of a compaction pass including publication", Buckets: []float64{0.1, 0.5, 1, 2, 5, 10, 30, 60, 120, 300}, }) CompactionRetiredBatches = promauto.NewCounter(prometheus.CounterOpts{ - Name: "fanout_compaction_retired_batches_total", Help: "Input batches retired from the live catalog by compaction publications", + Name: "pitot_compaction_retired_batches_total", Help: "Input batches retired from the live catalog by compaction publications", }) IngestThrottled = promauto.NewCounterVec(prometheus.CounterOpts{ - Name: "fanout_ingest_throttled_total", Help: "Whole exports refused by admission reason: debt, reads or budget", + Name: "pitot_ingest_throttled_total", Help: "Whole exports refused by admission reason: debt, reads or budget", }, []string{"reason"}) IngestAdmissionRate = promauto.NewGauge(prometheus.GaugeOpts{ - Name: "fanout_ingest_admission_rows_per_second", Help: "Current ingest admission rows per second; zero means uncapped", + Name: "pitot_ingest_admission_rows_per_second", Help: "Current ingest admission rows per second; zero means uncapped", }) // Ingest metrics IngestTotal = promauto.NewCounterVec(prometheus.CounterOpts{ - Name: "fanout_ingest_rows_total", + Name: "pitot_ingest_rows_total", Help: "Total rows ingested", }, []string{"signal"}) IngestQueueDepth = promauto.NewGaugeVec(prometheus.GaugeOpts{ - Name: "fanout_ingest_queue_depth", + Name: "pitot_ingest_queue_depth", Help: "Current ingest submission queue depth", }, []string{"signal"}) FlushTotal = promauto.NewCounterVec(prometheus.CounterOpts{ - Name: "fanout_flush_total", + Name: "pitot_flush_total", Help: "Total flush operations", }, []string{"signal"}) @@ -102,7 +102,7 @@ var ( // rising one means senders are being asked to retry, which is worth // seeing before it becomes a support question. IngestShedTotal = promauto.NewCounter(prometheus.CounterOpts{ - Name: "fanout_ingest_shed_total", + Name: "pitot_ingest_shed_total", Help: "Telemetry requests refused because ingest was over its in-flight byte budget", }) @@ -111,137 +111,137 @@ var ( // cancelled, or the server cut the request off while shutting down. The // sender resends, so storing the abandoned copy too would duplicate rows. IngestAbandonedTotal = promauto.NewCounter(prometheus.CounterOpts{ - Name: "fanout_ingest_abandoned_total", + Name: "pitot_ingest_abandoned_total", Help: "Telemetry requests dropped before commit because the request ended (sender timeout or cancel, or server shutdown)", }) FlushDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "fanout_flush_duration_seconds", + Name: "pitot_flush_duration_seconds", Help: "Flush duration in seconds", Buckets: prometheus.DefBuckets, }, []string{"signal"}) FlushErrors = promauto.NewCounterVec(prometheus.CounterOpts{ - Name: "fanout_flush_errors_total", + Name: "pitot_flush_errors_total", Help: "Total flush write errors", }, []string{"signal"}) RowsDropped = promauto.NewCounterVec(prometheus.CounterOpts{ - Name: "fanout_rows_dropped_total", + Name: "pitot_rows_dropped_total", Help: "Total rows left uncommitted after a permanent flush failure", }, []string{"signal"}) WriteGateWait = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "fanout_write_gate_wait_seconds", + Name: "pitot_write_gate_wait_seconds", Help: "Time spent waiting to enter the Telemetry catalog write critical section", Buckets: []float64{.0001, .0005, .001, .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 30, 60}, }, []string{"operation"}) WriteGateHold = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "fanout_write_gate_hold_seconds", + Name: "pitot_write_gate_hold_seconds", Help: "Time spent inside the Telemetry catalog write critical section", Buckets: []float64{.0001, .0005, .001, .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 30, 60}, }, []string{"operation"}) // Rollup metrics RollupTotal = promauto.NewCounter(prometheus.CounterOpts{ - Name: "fanout_rollup_total", + Name: "pitot_rollup_total", Help: "Total rollup operations", }) RollupDuration = promauto.NewHistogram(prometheus.HistogramOpts{ - Name: "fanout_rollup_duration_seconds", + Name: "pitot_rollup_duration_seconds", Help: "Rollup duration in seconds", Buckets: []float64{.1, .5, 1, 2, 5, 10, 30, 60}, }) RollupRows = promauto.NewCounter(prometheus.CounterOpts{ - Name: "fanout_rollup_rows_total", + Name: "pitot_rollup_rows_total", Help: "Total rows processed by rollups", }) RollupLastSuccess = promauto.NewGauge(prometheus.GaugeOpts{ - Name: "fanout_rollup_last_success_timestamp", + Name: "pitot_rollup_last_success_timestamp", Help: "Timestamp of last successful rollup", }) RollupComponentTotal = promauto.NewCounterVec(prometheus.CounterOpts{ - Name: "fanout_rollup_component_total", + Name: "pitot_rollup_component_total", Help: "Rollup component executions by bounded outcome", }, []string{"rollup", "result"}) // Duration is measured end to end and therefore includes time spent waiting // for the catalog write gate. That is deliberate: it is the latency an - // operator cares about, and fanout_write_gate_wait_seconds already isolates + // operator cares about, and pitot_write_gate_wait_seconds already isolates // the waiting half. Timing only the held section would duplicate - // fanout_write_gate_hold_seconds. + // pitot_write_gate_hold_seconds. RollupComponentDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "fanout_rollup_component_duration_seconds", + Name: "pitot_rollup_component_duration_seconds", Help: "Rollup component duration in seconds, including write-gate wait", Buckets: []float64{.001, .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 30, 60}, }, []string{"rollup"}) RollupComponentRows = promauto.NewCounterVec(prometheus.CounterOpts{ - Name: "fanout_rollup_component_rows_total", + Name: "pitot_rollup_component_rows_total", Help: "Rows materialized by each rollup component", }, []string{"rollup"}) RollupEnabled = promauto.NewGaugeVec(prometheus.GaugeOpts{ - Name: "fanout_rollup_enabled", + Name: "pitot_rollup_enabled", Help: "Whether the rollup component is enabled", }, []string{"rollup"}) RollupWatermark = promauto.NewGaugeVec(prometheus.GaugeOpts{ - Name: "fanout_rollup_watermark_timestamp_seconds", + Name: "pitot_rollup_watermark_timestamp_seconds", Help: "Latest completed rollup watermark as a Unix timestamp", }, []string{"rollup"}) RollupSourceMax = promauto.NewGaugeVec(prometheus.GaugeOpts{ - Name: "fanout_rollup_source_timestamp_seconds", + Name: "pitot_rollup_source_timestamp_seconds", Help: "Latest source ingest timestamp visible to the rollup", }, []string{"rollup"}) RollupLag = promauto.NewGaugeVec(prometheus.GaugeOpts{ - Name: "fanout_rollup_lag_seconds", + Name: "pitot_rollup_lag_seconds", Help: "Source ingest time not yet covered by the completed rollup watermark", }, []string{"rollup"}) RollupBacklogChunks = promauto.NewGaugeVec(prometheus.GaugeOpts{ - Name: "fanout_rollup_backlog_chunks", + Name: "pitot_rollup_backlog_chunks", Help: "Estimated bounded catch-up chunks remaining for the rollup", }, []string{"rollup"}) TelemetryOperationTotal = promauto.NewCounterVec(prometheus.CounterOpts{ - Name: "fanout_telemetry_operation_total", + Name: "pitot_telemetry_operation_total", Help: "Telemetry compaction and maintenance calls by bounded outcome", }, []string{"operation", "result"}) TelemetryOperationDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "fanout_telemetry_operation_duration_seconds", + Name: "pitot_telemetry_operation_duration_seconds", Help: "Executed telemetry compaction and maintenance duration in seconds", Buckets: []float64{.001, .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 30, 60, 120, 300}, }, []string{"operation"}) // Storage metrics ParquetSize = promauto.NewGaugeVec(prometheus.GaugeOpts{ - Name: "fanout_parquet_size_bytes", + Name: "pitot_parquet_size_bytes", Help: "Total size of telemetry Parquet files in bytes", }, []string{"signal"}) ParquetFiles = promauto.NewGaugeVec(prometheus.GaugeOpts{ - Name: "fanout_parquet_files", + Name: "pitot_parquet_files", Help: "Number of telemetry Parquet files per signal", }, []string{"signal"}) // A swap is a rename and an fsync, so the ladder starts in microseconds. ParquetPublishHold = promauto.NewHistogram(prometheus.HistogramOpts{ - Name: "fanout_parquet_publish_hold_seconds", + Name: "pitot_parquet_publish_hold_seconds", Help: "Time one Parquet publication took to swap a new file set into the catalog; readers never wait for it", Buckets: []float64{.000001, .000005, .00002, .0001, .0005, .001, .005, .025, .1, .5, 1, 2.5, 5, 10, 30, 60}, }) ParquetRetiringBatches = promauto.NewGauge(prometheus.GaugeOpts{ - Name: "fanout_parquet_retiring_batches", + Name: "pitot_parquet_retiring_batches", Help: "Batches compaction or retention replaced whose files wait for earlier readers to finish", }) @@ -251,7 +251,7 @@ var ( // The connection is acquired before this timer starts, so the two do not // overlap. DuckDBStatement = promauto.NewHistogram(prometheus.HistogramOpts{ - Name: "fanout_duckdb_statement_seconds", + Name: "pitot_duckdb_statement_seconds", Help: "Time a read statement spent executing in DuckDB, excluding any wait to start it", Buckets: []float64{.0005, .001, .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 30}, }) @@ -259,7 +259,7 @@ var ( // DuckDB checks for interrupts only between chunks, so a costly // expression can run a statement long past its deadline. DuckDBStatementOverruns = promauto.NewCounter(prometheus.CounterOpts{ - Name: "fanout_duckdb_statement_overruns_total", + Name: "pitot_duckdb_statement_overruns_total", Help: "Read statements seen running more than 25 seconds past their deadline", }) @@ -267,36 +267,36 @@ var ( // non-FORCE form refuses while another write transaction is open — so both // how long it takes and how often it does not happen are worth knowing. DuckDBCheckpoint = promauto.NewHistogram(prometheus.HistogramOpts{ - Name: "fanout_duckdb_checkpoint_seconds", + Name: "pitot_duckdb_checkpoint_seconds", Help: "Duration of an explicit DuckDB checkpoint on the rollup cache", Buckets: []float64{.001, .005, .01, .05, .1, .25, .5, 1, 2.5, 5, 10, 30}, }) DuckDBCheckpointFailures = promauto.NewCounter(prometheus.CounterOpts{ - Name: "fanout_duckdb_checkpoint_failures_total", + Name: "pitot_duckdb_checkpoint_failures_total", Help: "Explicit DuckDB checkpoints that returned an error", }) // HTTP metrics HTTPRequestsTotal = promauto.NewCounterVec(prometheus.CounterOpts{ - Name: "fanout_http_requests_total", + Name: "pitot_http_requests_total", Help: "Total HTTP requests", }, []string{"method", "path", "status"}) HTTPRequestDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "fanout_http_request_duration_seconds", + Name: "pitot_http_request_duration_seconds", Help: "HTTP request duration in seconds", Buckets: prometheus.DefBuckets, }, []string{"method", "path"}) // Authentication and authorization metrics. BrowserSessions = promauto.NewGaugeVec(prometheus.GaugeOpts{ - Name: "fanout_auth_browser_sessions", + Name: "pitot_auth_browser_sessions", Help: "Browser session rows by current lifecycle state", }, []string{"state"}) AuthAuditWriteFailures = promauto.NewCounter(prometheus.CounterOpts{ - Name: "fanout_auth_audit_write_failures_total", + Name: "pitot_auth_audit_write_failures_total", Help: "Security audit events that could not be persisted", }) ) @@ -344,7 +344,7 @@ type duckDBMemorySource struct { // actually predicts an out-of-memory kill is the gap between what the process // holds and what DuckDB admits to holding. Exporting the tags makes that gap // directly observable: untracked = process_resident_memory_bytes -// - sum(fanout_duckdb_memory_bytes) - go_memstats_heap_sys_bytes. Without it +// - sum(pitot_duckdb_memory_bytes) - go_memstats_heap_sys_bytes. Without it // every diagnosis of this process is an inference, which is how a whole day // got spent optimising a Go heap that was never the problem. var duckDBMemoryStats atomic.Pointer[duckDBMemorySource] @@ -363,13 +363,13 @@ func SetDuckDBMemorySource(interval time.Duration) (record func(map[string]int64 // Both series come from one immutable sample, so concurrent scrapes never see // a partial tag set or a timestamp belonging to a different sample. var duckDBMemoryDesc = prometheus.NewDesc( - "fanout_duckdb_memory_bytes", + "pitot_duckdb_memory_bytes", "Last sampled DuckDB memory usage by tag, as DuckDB itself accounts for it", []string{"tag"}, nil, ) var duckDBMemorySampleDesc = prometheus.NewDesc( - "fanout_duckdb_memory_last_success_timestamp_seconds", + "pitot_duckdb_memory_last_success_timestamp_seconds", "Unix timestamp of the last successful DuckDB memory sample, or zero before the first success", nil, nil, ) @@ -426,27 +426,27 @@ func poolStats() sql.DBStats { // nothing exported it. var ( _ = promauto.NewGaugeFunc(prometheus.GaugeOpts{ - Name: "fanout_duckdb_pool_in_use", + Name: "pitot_duckdb_pool_in_use", Help: "DuckDB read connections currently in use", }, func() float64 { return float64(poolStats().InUse) }) _ = promauto.NewGaugeFunc(prometheus.GaugeOpts{ - Name: "fanout_duckdb_pool_idle", + Name: "pitot_duckdb_pool_idle", Help: "DuckDB read connections currently idle", }, func() float64 { return float64(poolStats().Idle) }) _ = promauto.NewGaugeFunc(prometheus.GaugeOpts{ - Name: "fanout_duckdb_pool_max_open", + Name: "pitot_duckdb_pool_max_open", Help: "Configured DuckDB read connection limit", }, func() float64 { return float64(poolStats().MaxOpenConnections) }) _ = promauto.NewCounterFunc(prometheus.CounterOpts{ - Name: "fanout_duckdb_pool_waits_total", + Name: "pitot_duckdb_pool_waits_total", Help: "Times a caller waited for a free DuckDB read connection", }, func() float64 { return float64(poolStats().WaitCount) }) _ = promauto.NewCounterFunc(prometheus.CounterOpts{ - Name: "fanout_duckdb_pool_wait_seconds_total", + Name: "pitot_duckdb_pool_wait_seconds_total", Help: "Total time callers spent waiting for a free DuckDB read connection", }, func() float64 { return poolStats().WaitDuration.Seconds() }) ) @@ -582,7 +582,7 @@ func SetCompactionBacklogSource(count func() int) func() { } var _ = promauto.NewGaugeFunc(prometheus.GaugeOpts{ - Name: "fanout_compaction_backlog_batches", Help: "Live generation-0 batches, including underfilled groups and oversized terminal batches", + Name: "pitot_compaction_backlog_batches", Help: "Live generation-0 batches, including underfilled groups and oversized terminal batches", }, func() float64 { if source := compactionBacklog.Load(); source != nil { return float64(source.count()) diff --git a/internal/metrics/metrics_test.go b/internal/metrics/metrics_test.go index 6e27c0971..121c5a94c 100644 --- a/internal/metrics/metrics_test.go +++ b/internal/metrics/metrics_test.go @@ -130,10 +130,10 @@ func TestRecordTelemetryOperationOutcomes(t *testing.T) { t.Errorf("TelemetryOperationTotal[%s,%s] = %f, want 1", tc.operation, tc.result, got) } } - if got := histogramSampleCount(t, "fanout_telemetry_operation_duration_seconds", "operation", "compaction"); got != 1 { + if got := histogramSampleCount(t, "pitot_telemetry_operation_duration_seconds", "operation", "compaction"); got != 1 { t.Errorf("merge duration samples = %d, want 1 (skipped outcomes must not distort duration)", got) } - if got := histogramSampleCount(t, "fanout_telemetry_operation_duration_seconds", "operation", "maintenance"); got != 1 { + if got := histogramSampleCount(t, "pitot_telemetry_operation_duration_seconds", "operation", "maintenance"); got != 1 { t.Errorf("maintenance duration samples = %d, want 1", got) } } @@ -242,7 +242,7 @@ func TestCompactionBacklogSourceTracksCountAndOwner(t *testing.T) { } found := false for _, family := range families { - if family.GetName() == "fanout_compaction_backlog_batches" { + if family.GetName() == "pitot_compaction_backlog_batches" { found = true if got := family.Metric[0].GetGauge().GetValue(); got != 13 { t.Fatalf("count=%g", got) @@ -258,7 +258,7 @@ func TestCompactionBacklogSourceTracksCountAndOwner(t *testing.T) { t.Fatal(err) } for _, family := range families { - if family.GetName() == "fanout_compaction_backlog_batches" && family.Metric[0].GetGauge().GetValue() != 0 { + if family.GetName() == "pitot_compaction_backlog_batches" && family.Metric[0].GetGauge().GetValue() != 0 { t.Fatal("closed source retained") } } diff --git a/internal/metrics/panels.go b/internal/metrics/panels.go index 988092676..a78a11520 100644 --- a/internal/metrics/panels.go +++ b/internal/metrics/panels.go @@ -6,13 +6,13 @@ import ( ) var panelQueryDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "fanout_panel_query_duration_seconds", + Name: "pitot_panel_query_duration_seconds", Help: "Executed panel duration and outcome; panel is a built-in System overview ID or custom. Excludes result-cache hits and admission wait.", Buckets: []float64{.005, .01, .025, .05, .1, .2, .5, 1, 2, 5, 10}, }, []string{"panel", "status"}) var panelAdmissionDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{ - Name: "fanout_panel_admission_duration_seconds", + Name: "pitot_panel_admission_duration_seconds", Help: "Panel admission wait by bounded panel ID and outcome. Excludes result-cache hits.", Buckets: []float64{.005, .01, .025, .05, .1, .2, .5, 1, 2, 5, 10}, }, []string{"panel", "status"}) diff --git a/internal/observability/batch_reads_bench_test.go b/internal/observability/batch_reads_bench_test.go index 8e92c38c2..9dd2dd272 100644 --- a/internal/observability/batch_reads_bench_test.go +++ b/internal/observability/batch_reads_bench_test.go @@ -12,10 +12,10 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) // TestCompletedReadBenchmark measures actual dashboard methods over identical @@ -30,7 +30,7 @@ func TestCompletedReadBenchmark(t *testing.T) { defer repo.Close() at := time.Now().UTC().Truncate(time.Hour) rowsPerBatch := 25000 - if os.Getenv("FANOUT_READ_BENCH_LARGE") == "1" { + if os.Getenv("PITOT_READ_BENCH_LARGE") == "1" { rowsPerBatch = 100000 } for batch := range 12 { diff --git a/internal/observability/batch_reads_test.go b/internal/observability/batch_reads_test.go index 036989326..91dd6b5ba 100644 --- a/internal/observability/batch_reads_test.go +++ b/internal/observability/batch_reads_test.go @@ -8,10 +8,10 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func newCompletedReadTest(t *testing.T) (*engine.Duck, *telemetrystore.Repository, *Service) { diff --git a/internal/observability/contracts.go b/internal/observability/contracts.go index 5c1618e67..1bfab156b 100644 --- a/internal/observability/contracts.go +++ b/internal/observability/contracts.go @@ -24,7 +24,7 @@ type Provenance struct { // Result is the canonical query envelope shared by REST and MCP. // Summary is deliberately compact model context; Data remains authoritative. // UI selection is deliberately absent: MCP Apps link tools to UI resources -// through standard tool metadata rather than a Fanout-specific view registry. +// through standard tool metadata rather than a Pitot-specific view registry. type Result[T any] struct { Summary string `json:"summary"` Data T `json:"data"` diff --git a/internal/observability/dependencies_test.go b/internal/observability/dependencies_test.go index c374e517a..0591ceeff 100644 --- a/internal/observability/dependencies_test.go +++ b/internal/observability/dependencies_test.go @@ -4,13 +4,13 @@ import ( "context" "database/sql" "errors" - "github.com/labstack/fanout/internal/engine/querytest" + "github.com/labstack/pitot/internal/engine/querytest" "reflect" "testing" "time" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/queryrows" ) func TestDependenciesKeyedTraversalIsBoundedAndScoped(t *testing.T) { diff --git a/internal/observability/health_trend.go b/internal/observability/health_trend.go index 71ab62b39..a0150cf61 100644 --- a/internal/observability/health_trend.go +++ b/internal/observability/health_trend.go @@ -3,7 +3,7 @@ package observability import ( "context" "fmt" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" "time" ) diff --git a/internal/observability/service.go b/internal/observability/service.go index 6c26da7be..49d1d1d5b 100644 --- a/internal/observability/service.go +++ b/internal/observability/service.go @@ -7,8 +7,8 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" ) const ( diff --git a/internal/observability/service_test.go b/internal/observability/service_test.go index 6e0b6f2ad..20ab058f7 100644 --- a/internal/observability/service_test.go +++ b/internal/observability/service_test.go @@ -9,9 +9,9 @@ import ( "time" "github.com/DATA-DOG/go-sqlmock" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func newTestRepository(t *testing.T) *telemetrystore.Repository { diff --git a/internal/observability/sql_adapter_test.go b/internal/observability/sql_adapter_test.go index 512136b85..dadd44aa2 100644 --- a/internal/observability/sql_adapter_test.go +++ b/internal/observability/sql_adapter_test.go @@ -1,5 +1,5 @@ package observability -import "github.com/labstack/fanout/internal/queryrows" +import "github.com/labstack/pitot/internal/queryrows" func SQLDB(db queryrows.SQLQueryer) DB { return queryrows.SQLAdapter{DB: db} } diff --git a/internal/observability/topology.go b/internal/observability/topology.go index a7b93594e..1e5a3399c 100644 --- a/internal/observability/topology.go +++ b/internal/observability/topology.go @@ -3,7 +3,7 @@ package observability import ( "context" "fmt" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" "sort" ) diff --git a/internal/observability/topology_test.go b/internal/observability/topology_test.go index 48e20d46d..40589af87 100644 --- a/internal/observability/topology_test.go +++ b/internal/observability/topology_test.go @@ -9,9 +9,9 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestTopologyExternalPeerAggregatesAndScopes(t *testing.T) { diff --git a/internal/observability/trace.go b/internal/observability/trace.go index 29adf336b..2da7dcf5b 100644 --- a/internal/observability/trace.go +++ b/internal/observability/trace.go @@ -7,8 +7,8 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" ) const traceLogsQuery = ` diff --git a/internal/observability/trace_test.go b/internal/observability/trace_test.go index ec6e2793a..814fa318f 100644 --- a/internal/observability/trace_test.go +++ b/internal/observability/trace_test.go @@ -9,8 +9,8 @@ import ( "github.com/DATA-DOG/go-sqlmock" _ "github.com/duckdb/duckdb-go/v2" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) // A paged trace must still describe the trace. Limit bounds the spans that are diff --git a/internal/query/admission_test.go b/internal/query/admission_test.go index 3655117c3..d7eaea8e3 100644 --- a/internal/query/admission_test.go +++ b/internal/query/admission_test.go @@ -8,9 +8,9 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/queryrows" ) type pooledEngine struct { diff --git a/internal/query/annotation_scope_test.go b/internal/query/annotation_scope_test.go index 977a397f7..1dde467de 100644 --- a/internal/query/annotation_scope_test.go +++ b/internal/query/annotation_scope_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" ) func TestAnnotationScopeUsesCheckedAST(t *testing.T) { diff --git a/internal/query/backlog_pressure_test.go b/internal/query/backlog_pressure_test.go index 74e499426..cf012751d 100644 --- a/internal/query/backlog_pressure_test.go +++ b/internal/query/backlog_pressure_test.go @@ -20,22 +20,22 @@ import ( "time" duckdb "github.com/duckdb/duckdb-go/v2" - "github.com/labstack/fanout/internal/annotations" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/annotations" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "github.com/prometheus/client_golang/prometheus" ) // The deadline includes seeding. All disposable files stay in the private workspace. func pressureBatches(t *testing.T) int { t.Helper() - if raw := os.Getenv("FANOUT_BACKLOG_BATCHES"); raw != "" { + if raw := os.Getenv("PITOT_BACKLOG_BATCHES"); raw != "" { n, err := strconv.Atoi(raw) if err != nil || n < 1 { - t.Fatalf("invalid FANOUT_BACKLOG_BATCHES %q", raw) + t.Fatalf("invalid PITOT_BACKLOG_BATCHES %q", raw) } return n } @@ -43,10 +43,10 @@ func pressureBatches(t *testing.T) int { } func pressureDuration(t *testing.T) time.Duration { t.Helper() - if raw := os.Getenv("FANOUT_BACKLOG_DURATION"); raw != "" { + if raw := os.Getenv("PITOT_BACKLOG_DURATION"); raw != "" { d, err := time.ParseDuration(raw) if err != nil || d <= 0 { - t.Fatalf("invalid FANOUT_BACKLOG_DURATION %q", raw) + t.Fatalf("invalid PITOT_BACKLOG_DURATION %q", raw) } return d } @@ -200,7 +200,7 @@ func pressureDiagnostics(ctx context.Context, t *testing.T, d *engine.Duck, repo return } for _, f := range families { - if f.GetName() == "fanout_write_gate_wait_seconds" || f.GetName() == "fanout_write_gate_hold_seconds" { + if f.GetName() == "pitot_write_gate_wait_seconds" || f.GetName() == "pitot_write_gate_hold_seconds" { for _, m := range f.Metric { t.Logf("gate phase=%s metric=%s labels=%v count=%d seconds_sum=%.6f", phase, f.GetName(), m.Label, m.GetHistogram().GetSampleCount(), m.GetHistogram().GetSampleSum()) } diff --git a/internal/query/catalog.go b/internal/query/catalog.go index c21dc79e9..7e355e474 100644 --- a/internal/query/catalog.go +++ b/internal/query/catalog.go @@ -8,9 +8,9 @@ import ( "sort" "strings" - "github.com/labstack/fanout/internal/suggest" - "github.com/labstack/fanout/internal/telemetry" - "github.com/labstack/fanout/internal/telemetry/semconv" + "github.com/labstack/pitot/internal/suggest" + "github.com/labstack/pitot/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry/semconv" ) type FieldType string diff --git a/internal/query/check.go b/internal/query/check.go index 4bbc9e341..5e968521b 100644 --- a/internal/query/check.go +++ b/internal/query/check.go @@ -12,7 +12,7 @@ import ( "time" duckdb "github.com/duckdb/duckdb-go/v2" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" ) // Parser is the slice of the query engine that checks SQL text. *engine.Duck diff --git a/internal/query/check_test.go b/internal/query/check_test.go index 1db489a24..3a35d0835 100644 --- a/internal/query/check_test.go +++ b/internal/query/check_test.go @@ -7,7 +7,7 @@ import ( "time" duckdb "github.com/duckdb/duckdb-go/v2" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) type interruptingParser struct{ Parser } diff --git a/internal/query/compile.go b/internal/query/compile.go index cbb02d9ad..f9da74183 100644 --- a/internal/query/compile.go +++ b/internal/query/compile.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/engine" + "github.com/labstack/pitot/internal/engine" ) // Value is a variable's current value. JSON: a string, a list of strings, or diff --git a/internal/query/compile_expr_test.go b/internal/query/compile_expr_test.go index 5a78345c7..305394a9d 100644 --- a/internal/query/compile_expr_test.go +++ b/internal/query/compile_expr_test.go @@ -2,7 +2,7 @@ package query import ( "context" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" "strings" "testing" "time" diff --git a/internal/query/compile_test.go b/internal/query/compile_test.go index 529a6dfb7..dfaa1df61 100644 --- a/internal/query/compile_test.go +++ b/internal/query/compile_test.go @@ -3,9 +3,9 @@ package query import ( "math" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" "reflect" "strings" "testing" diff --git a/internal/query/confidence_ranking_test.go b/internal/query/confidence_ranking_test.go index d2a83b211..0472b9eaf 100644 --- a/internal/query/confidence_ranking_test.go +++ b/internal/query/confidence_ranking_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" ) type confidenceCounter struct { diff --git a/internal/query/deploy_split.go b/internal/query/deploy_split.go index 22080783f..6e732d1ac 100644 --- a/internal/query/deploy_split.go +++ b/internal/query/deploy_split.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/labstack/fanout/internal/annotations" + "github.com/labstack/pitot/internal/annotations" ) func (e *Executor) runDeploySplit(ctx context.Context, p *Panel, checked *Checked, scope Scope) (*Frame, string, error) { diff --git a/internal/query/diagnose.go b/internal/query/diagnose.go index 6749da8b4..c49ea3c38 100644 --- a/internal/query/diagnose.go +++ b/internal/query/diagnose.go @@ -8,7 +8,7 @@ import ( "strings" "unicode/utf8" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" ) // maxDiagnosedFilters bounds the reruns one empty panel can cost: the diff --git a/internal/query/diagnose_admission_test.go b/internal/query/diagnose_admission_test.go index 769029411..f8af31d85 100644 --- a/internal/query/diagnose_admission_test.go +++ b/internal/query/diagnose_admission_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" ) // Hold the first panel inside its admitted read while its sibling waits locally. diff --git a/internal/query/diagnose_regression_test.go b/internal/query/diagnose_regression_test.go index ec5909ef7..69d219e0c 100644 --- a/internal/query/diagnose_regression_test.go +++ b/internal/query/diagnose_regression_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" ) func TestDiagnosisHighlightOnlyWhenActiveFiltersMatch(t *testing.T) { diff --git a/internal/query/diagnose_types_test.go b/internal/query/diagnose_types_test.go index 69117ebb7..8659fb071 100644 --- a/internal/query/diagnose_types_test.go +++ b/internal/query/diagnose_types_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) // Attribute equality is typed: a number filter misses values stored as text. diff --git a/internal/query/distribution_test.go b/internal/query/distribution_test.go index 660f277c1..56629f1f1 100644 --- a/internal/query/distribution_test.go +++ b/internal/query/distribution_test.go @@ -9,8 +9,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestDistributionCounts(t *testing.T) { diff --git a/internal/query/drill_logs_test.go b/internal/query/drill_logs_test.go index b95cd2c06..5a7445b8f 100644 --- a/internal/query/drill_logs_test.go +++ b/internal/query/drill_logs_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) func TestDrillLogsKeepCheckedSelection(t *testing.T) { diff --git a/internal/query/exec.go b/internal/query/exec.go index 13bb483ad..dc1f186a4 100644 --- a/internal/query/exec.go +++ b/internal/query/exec.go @@ -15,10 +15,10 @@ import ( "time" duckdb "github.com/duckdb/duckdb-go/v2" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/metrics" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/metrics" + "github.com/labstack/pitot/internal/queryrows" "golang.org/x/sync/errgroup" ) @@ -73,7 +73,7 @@ type Result struct { // without guessing from the first populated bucket. ShiftMS int64 `json:"shift_ms,omitempty"` // Cached marks a result served from the result cache rather than run for - // this request; see FANOUT_QUERY_CACHE_TTL. + // this request; see PITOT_QUERY_CACHE_TTL. Cached bool `json:"cached,omitempty"` // partial marks a result missing part of what it would show: a sub-read // such as the previous period, annotations, table trends or the metric diff --git a/internal/query/exec_logging_test.go b/internal/query/exec_logging_test.go index 7d66831aa..592615905 100644 --- a/internal/query/exec_logging_test.go +++ b/internal/query/exec_logging_test.go @@ -12,7 +12,7 @@ import ( "time" duckdb "github.com/duckdb/duckdb-go/v2" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" ) func TestFailedLogsOperationalCauseExactlyOnce(t *testing.T) { diff --git a/internal/query/exec_test.go b/internal/query/exec_test.go index be19d5a9b..761dd5b69 100644 --- a/internal/query/exec_test.go +++ b/internal/query/exec_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/engine" + "github.com/labstack/pitot/internal/engine" ) func TestRunResolvesOneInstantForAllPanelWindows(t *testing.T) { diff --git a/internal/query/execution_limits_test.go b/internal/query/execution_limits_test.go index 10779dc67..86dda98d6 100644 --- a/internal/query/execution_limits_test.go +++ b/internal/query/execution_limits_test.go @@ -5,7 +5,7 @@ import ( "context" "errors" "fmt" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" "log/slog" "strings" "sync/atomic" @@ -13,7 +13,7 @@ import ( "time" "unicode/utf8" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) type slowBatchEngine struct { @@ -329,12 +329,12 @@ func TestPanelOperationalErrorsKeepDetailsInLogs(t *testing.T) { slog.SetDefault(slog.New(slog.NewJSONHandler(&logs, nil))) defer slog.SetDefault(old) detail := strings.Repeat("memory pressure; ", 80) + "final diagnostic" - got := failed(Result{ID: "p"}, fmt.Errorf("IO Error at /srv/fanout/private.parquet: %s", detail), nil) - if strings.Contains(got.Error, "/srv/fanout/private.parquet") || + got := failed(Result{ID: "p"}, fmt.Errorf("IO Error at /srv/pitot/private.parquet: %s", detail), nil) + if strings.Contains(got.Error, "/srv/pitot/private.parquet") || got.Error != ReadFailure { t.Fatalf("message lost or leaked: %q", got.Error) } - if !strings.Contains(logs.String(), "final diagnostic") || !strings.Contains(logs.String(), "/srv/fanout/private.parquet") { + if !strings.Contains(logs.String(), "final diagnostic") || !strings.Contains(logs.String(), "/srv/pitot/private.parquet") { t.Fatalf("missing operational cause in logs: %s", logs.String()) } } @@ -344,7 +344,7 @@ func TestPanelErrorsKeepLongLogBindingDiagnosticsRedacted(t *testing.T) { n := fixtureStart.UnixNano() commit(t, repo, nil, []telemetry.Log{{Namespace: "shop", Body: "token=bodysecret failed", BodyTemplate: "token=templatesecret failed", EventUnixNanos: n, IngestedAt: n}}) e := NewExecutor(engine, 30) - missing := strings.Repeat("missing_detail_", 60) + " /srv/fanout/private.parquet final diagnostic" + missing := strings.Repeat("missing_detail_", 60) + " /srv/pitot/private.parquet final diagnostic" p := Panel{ID: "p", Title: "SQL", Viz: "table", SQL: fmt.Sprintf(`SELECT body, body_template, %q FROM logs WHERE $__window(time)`, missing)} // Exercise the execution error boundary directly: Run's validation normally // catches binding failures before execution, using the same native binder. @@ -352,7 +352,7 @@ func TestPanelErrorsKeepLongLogBindingDiagnosticsRedacted(t *testing.T) { if got.Status != StatusError || strings.Contains(got.Error, "Binder Error") || len(got.Error) <= 500 || !strings.Contains(got.Error, "final diagnostic") { t.Fatalf("binding diagnostic lost: %+v", got) } - if strings.Contains(got.Error, "/srv/fanout/private.parquet") || strings.Contains(got.Error, "bodysecret") || strings.Contains(got.Error, "templatesecret") { + if strings.Contains(got.Error, "/srv/pitot/private.parquet") || strings.Contains(got.Error, "bodysecret") || strings.Contains(got.Error, "templatesecret") { t.Fatalf("unsafe binding diagnostic: %q", got.Error) } } diff --git a/internal/query/exemplar_bounds_test.go b/internal/query/exemplar_bounds_test.go index 4ee0a00cc..342872ad4 100644 --- a/internal/query/exemplar_bounds_test.go +++ b/internal/query/exemplar_bounds_test.go @@ -9,8 +9,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" ) type exemplarProbeEngine struct { diff --git a/internal/query/exemplar_index_test.go b/internal/query/exemplar_index_test.go index ac08de744..4a0412f59 100644 --- a/internal/query/exemplar_index_test.go +++ b/internal/query/exemplar_index_test.go @@ -3,9 +3,9 @@ package query import ( "context" "fmt" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "reflect" "testing" "time" diff --git a/internal/query/exemplars.go b/internal/query/exemplars.go index d1fc3057a..a785fbf1c 100644 --- a/internal/query/exemplars.go +++ b/internal/query/exemplars.go @@ -10,8 +10,8 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" ) type SelectionBucket struct { diff --git a/internal/query/exemplars_test.go b/internal/query/exemplars_test.go index 6f184856e..59ba9a44e 100644 --- a/internal/query/exemplars_test.go +++ b/internal/query/exemplars_test.go @@ -2,7 +2,7 @@ package query import ( "errors" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" "math" "testing" "time" diff --git a/internal/query/filter.go b/internal/query/filter.go index a00b685d7..9056b8611 100644 --- a/internal/query/filter.go +++ b/internal/query/filter.go @@ -7,7 +7,7 @@ import ( "slices" "strings" - "github.com/labstack/fanout/internal/engine" + "github.com/labstack/pitot/internal/engine" ) // Filter is one checked filter expression. diff --git a/internal/query/filter_test.go b/internal/query/filter_test.go index ded206139..e2521ff56 100644 --- a/internal/query/filter_test.go +++ b/internal/query/filter_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/queryrows" ) func TestCheckFilterAcceptsSafeExpressions(t *testing.T) { diff --git a/internal/query/frame.go b/internal/query/frame.go index 7570d05f0..deddac966 100644 --- a/internal/query/frame.go +++ b/internal/query/frame.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/queryrows" ) // Frame is a columnar query result: one array of values per column. diff --git a/internal/query/items_test.go b/internal/query/items_test.go index 88b6ee997..3c8d23e16 100644 --- a/internal/query/items_test.go +++ b/internal/query/items_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) func TestItemsExecute(t *testing.T) { diff --git a/internal/query/log_redaction_test.go b/internal/query/log_redaction_test.go index ea066b8ee..7985bd4ff 100644 --- a/internal/query/log_redaction_test.go +++ b/internal/query/log_redaction_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" ) func TestSQLPanelExecutionMatchesDescribedStructBinding(t *testing.T) { diff --git a/internal/query/log_source.go b/internal/query/log_source.go index e4d312455..dd548d523 100644 --- a/internal/query/log_source.go +++ b/internal/query/log_source.go @@ -1,6 +1,6 @@ package query -import "github.com/labstack/fanout/internal/observability" +import "github.com/labstack/pitot/internal/observability" func redactedLogSource() string { // Qualifying the physical relation also prevents an author's logs CTE from diff --git a/internal/query/log_window_test.go b/internal/query/log_window_test.go index 1ff6b7248..9f98ad4ca 100644 --- a/internal/query/log_window_test.go +++ b/internal/query/log_window_test.go @@ -2,7 +2,7 @@ package query import ( "fmt" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" "strings" "testing" "time" diff --git a/internal/query/measure.go b/internal/query/measure.go index b1f5b4c73..137c92f7b 100644 --- a/internal/query/measure.go +++ b/internal/query/measure.go @@ -2,14 +2,14 @@ package query import ( "fmt" - "github.com/labstack/fanout/internal/suggest" + "github.com/labstack/pitot/internal/suggest" "math" "regexp" "slices" "strconv" "strings" - "github.com/labstack/fanout/internal/sqlscan" + "github.com/labstack/pitot/internal/sqlscan" ) // Measure is one parsed aggregate. diff --git a/internal/query/metric_crosscheck_test.go b/internal/query/metric_crosscheck_test.go index 34fbd9704..36dad9bff 100644 --- a/internal/query/metric_crosscheck_test.go +++ b/internal/query/metric_crosscheck_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" ) func metricCrosscheckDashboard(name, measure string, start, end time.Time) Dashboard { @@ -274,9 +274,9 @@ func crosscheckMetricFrame(t *testing.T, engine Engine, name, measure string, st } func TestMetricDemoDataMatchesIndependentWindowSQL(t *testing.T) { - input := os.Getenv("FANOUT_PANEL_BENCH_DATA_DIR") + input := os.Getenv("PITOT_PANEL_BENCH_DATA_DIR") if input == "" { - t.Skip("FANOUT_PANEL_BENCH_DATA_DIR is unset") + t.Skip("PITOT_PANEL_BENCH_DATA_DIR is unset") } data := copyMetricCrosscheckData(t, input) engine, _ := panelBenchEngine(t, data) diff --git a/internal/query/metric_exponential_test.go b/internal/query/metric_exponential_test.go index ae93cf0fc..4f46c4a66 100644 --- a/internal/query/metric_exponential_test.go +++ b/internal/query/metric_exponential_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) // exponentialBuckets reads the explicit bounds and counts the metric series diff --git a/internal/query/metric_histogram_test.go b/internal/query/metric_histogram_test.go index 7e18262f9..a0b5a33ff 100644 --- a/internal/query/metric_histogram_test.go +++ b/internal/query/metric_histogram_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestHistogramMeasuresInterpolateSummedIncreases(t *testing.T) { diff --git a/internal/query/metric_intervals_test.go b/internal/query/metric_intervals_test.go index 49b563a61..7ad7a6f3c 100644 --- a/internal/query/metric_intervals_test.go +++ b/internal/query/metric_intervals_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestMetricGapDeltasAttributeWholeIncreaseAndBoundExpansion(t *testing.T) { diff --git a/internal/query/metric_kinds_golden_test.go b/internal/query/metric_kinds_golden_test.go index 5cceb6c95..07a3b8d45 100644 --- a/internal/query/metric_kinds_golden_test.go +++ b/internal/query/metric_kinds_golden_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) var updateMetricKindGolden = flag.Bool("update-metric-kinds", false, "rewrite testdata/metric_kinds.golden.json") diff --git a/internal/query/metric_measure_bench_test.go b/internal/query/metric_measure_bench_test.go index 916096744..79014f70a 100644 --- a/internal/query/metric_measure_bench_test.go +++ b/internal/query/metric_measure_bench_test.go @@ -10,10 +10,10 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) // This small review fixture is separate from the Phase B scale generator. @@ -133,7 +133,7 @@ func TestMetricMeasuresExecuteAtReviewScale(t *testing.T) { } p = d.Panels[0] scope := Scope{Start: start, End: end, Interval: shape.interval} - if dir := os.Getenv("FANOUT_METRIC_PROFILE_DIR"); dir != "" { + if dir := os.Getenv("PITOT_METRIC_PROFILE_DIR"); dir != "" { for _, stmt := range []string{"SET enable_profiling='json'", "SET profiling_output=" + sqlString(filepath.Join(t.TempDir(), "profile.json"))} { if _, err := db.Exec(stmt); err != nil { t.Fatal(err) diff --git a/internal/query/metric_measures_test.go b/internal/query/metric_measures_test.go index 6594fa4ec..86315d6b2 100644 --- a/internal/query/metric_measures_test.go +++ b/internal/query/metric_measures_test.go @@ -1,7 +1,7 @@ package query import ( - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" "math" "reflect" "strings" diff --git a/internal/query/metric_schema_test.go b/internal/query/metric_schema_test.go index db1f4d0a3..8c9088c88 100644 --- a/internal/query/metric_schema_test.go +++ b/internal/query/metric_schema_test.go @@ -2,7 +2,7 @@ package query import ( "encoding/json" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" "strings" "testing" "time" diff --git a/internal/query/metric_series_test.go b/internal/query/metric_series_test.go index 0283483fd..092a0b71b 100644 --- a/internal/query/metric_series_test.go +++ b/internal/query/metric_series_test.go @@ -11,8 +11,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func bindFixtureTimes(t *testing.T, text string, args []any) string { diff --git a/internal/query/metric_unit.go b/internal/query/metric_unit.go index 2abf7261d..9ee5abb33 100644 --- a/internal/query/metric_unit.go +++ b/internal/query/metric_unit.go @@ -5,7 +5,7 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" ) // metricUnitTTL bounds how long a metric's reported unit is reused; a diff --git a/internal/query/metric_unit_test.go b/internal/query/metric_unit_test.go index b802b9b26..eb2001377 100644 --- a/internal/query/metric_unit_test.go +++ b/internal/query/metric_unit_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) // A metric panel's value columns carry the unit the metric reports, mapped diff --git a/internal/query/metric_view_test.go b/internal/query/metric_view_test.go index ffcc5ada3..507004f9b 100644 --- a/internal/query/metric_view_test.go +++ b/internal/query/metric_view_test.go @@ -2,7 +2,7 @@ package query import ( "fmt" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" "math" "reflect" "testing" diff --git a/internal/query/panel_bench_data_test.go b/internal/query/panel_bench_data_test.go index f09eee01e..8cf08322a 100644 --- a/internal/query/panel_bench_data_test.go +++ b/internal/query/panel_bench_data_test.go @@ -17,11 +17,11 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" "github.com/parquet-go/parquet-go" "github.com/parquet-go/parquet-go/compress/zstd" "github.com/zeebo/xxh3" @@ -578,7 +578,7 @@ func panelBenchEngine(tb testing.TB, data panelBenchData) (*engine.Duck, config. tb.Helper() // Load validates authentication even though this harness never serves HTTP. // Only a dummy test auth value is supplied; storage sizing stays automatic. - cfg, err := config.Load(config.LoadOptions{Environ: []string{"FANOUT_DATA_DIR=" + data.Dir, "FANOUT_AUTH_CODE_SECRET=" + strings.Repeat("benchmark-only-", 3)}}) + cfg, err := config.Load(config.LoadOptions{Environ: []string{"PITOT_DATA_DIR=" + data.Dir, "PITOT_AUTH_CODE_SECRET=" + strings.Repeat("benchmark-only-", 3)}}) if err != nil { tb.Fatal(err) } diff --git a/internal/query/panel_bench_test.go b/internal/query/panel_bench_test.go index ac25e4902..93134c3c8 100644 --- a/internal/query/panel_bench_test.go +++ b/internal/query/panel_bench_test.go @@ -16,8 +16,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) func TestMetricReplayCopyPreservesSourceAndStartTime(t *testing.T) { @@ -98,19 +98,19 @@ func TestMetricReplayCopyPreservesSourceAndStartTime(t *testing.T) { func BenchmarkPanelQueries24Hours(b *testing.B) { b.StopTimer() var data panelBenchData - input := os.Getenv("FANOUT_PANEL_BENCH_DATA_DIR") + input := os.Getenv("PITOT_PANEL_BENCH_DATA_DIR") if input != "" { volume := 1 - if raw := os.Getenv("FANOUT_PANEL_BENCH_VOLUME"); raw != "" { + if raw := os.Getenv("PITOT_PANEL_BENCH_VOLUME"); raw != "" { var err error volume, err = strconv.Atoi(raw) if err != nil || (volume != 1 && volume != 10) { - b.Fatal("FANOUT_PANEL_BENCH_VOLUME must be 1 or 10") + b.Fatal("PITOT_PANEL_BENCH_VOLUME must be 1 or 10") } } data = preparePanelReplay(b, input, volume) } else { - if os.Getenv("FANOUT_PANEL_BENCH_VOLUME") != "" { + if os.Getenv("PITOT_PANEL_BENCH_VOLUME") != "" { b.Fatal("volume requires replay input") } data = preparePanelRegression(b) diff --git a/internal/query/pattern_context_test.go b/internal/query/pattern_context_test.go index fa543f55a..9e9e05c00 100644 --- a/internal/query/pattern_context_test.go +++ b/internal/query/pattern_context_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" ) type previewPatternCounter struct { diff --git a/internal/query/preview_patterns_test.go b/internal/query/preview_patterns_test.go index f1a81bade..097aee88f 100644 --- a/internal/query/preview_patterns_test.go +++ b/internal/query/preview_patterns_test.go @@ -2,7 +2,7 @@ package query import ( "encoding/json" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" "testing" "time" ) diff --git a/internal/query/ranking_expr_test.go b/internal/query/ranking_expr_test.go index 629bab6d5..e7c72a2ca 100644 --- a/internal/query/ranking_expr_test.go +++ b/internal/query/ranking_expr_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) func TestRankingFixtures(t *testing.T) { diff --git a/internal/query/result_cache.go b/internal/query/result_cache.go index 79de5ed84..b959f6279 100644 --- a/internal/query/result_cache.go +++ b/internal/query/result_cache.go @@ -14,9 +14,9 @@ import ( "sync/atomic" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/metrics" - "github.com/labstack/fanout/internal/observability" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/metrics" + "github.com/labstack/pitot/internal/observability" ) // The result cache keeps recent panel, exemplar and trace-detail results so a @@ -40,7 +40,7 @@ import ( type cacheKey [32]byte -// Lookup outcomes, also the result label of fanout_query_cache_requests_total. +// Lookup outcomes, also the result label of pitot_query_cache_requests_total. const ( cacheHit = "hit" cacheStale = "stale" diff --git a/internal/query/result_cache_test.go b/internal/query/result_cache_test.go index a9193020e..81f7f3f5b 100644 --- a/internal/query/result_cache_test.go +++ b/internal/query/result_cache_test.go @@ -11,9 +11,9 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" ) // cacheEngine counts reads, and can hold them until release closes or diff --git a/internal/query/rollup_compile_test.go b/internal/query/rollup_compile_test.go index 05c4acf94..6026c9c54 100644 --- a/internal/query/rollup_compile_test.go +++ b/internal/query/rollup_compile_test.go @@ -8,9 +8,9 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" ) func TestRollupPlan(t *testing.T) { diff --git a/internal/query/rollup_panels.go b/internal/query/rollup_panels.go index 7805b88f5..f6377cc1d 100644 --- a/internal/query/rollup_panels.go +++ b/internal/query/rollup_panels.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/labstack/fanout/internal/observability" + "github.com/labstack/pitot/internal/observability" ) type RollupReader interface { diff --git a/internal/query/rollup_panels_test.go b/internal/query/rollup_panels_test.go index e6fd0be9a..ac1dfc1a3 100644 --- a/internal/query/rollup_panels_test.go +++ b/internal/query/rollup_panels_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/observability" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/observability" + "github.com/labstack/pitot/internal/queryrows" ) func TestRollupPanelsReuseServices(t *testing.T) { diff --git a/internal/query/rowpanels_test.go b/internal/query/rowpanels_test.go index 93d3322ff..f6d5fe653 100644 --- a/internal/query/rowpanels_test.go +++ b/internal/query/rowpanels_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) func TestRowPanelCandidatesAreBounded(t *testing.T) { diff --git a/internal/query/schema.go b/internal/query/schema.go index 6c0cb53b5..a1f4f1837 100644 --- a/internal/query/schema.go +++ b/internal/query/schema.go @@ -11,9 +11,9 @@ import ( "sync" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - "github.com/labstack/fanout/internal/telemetry/semconv" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry/semconv" ) type SchemaRequest struct { diff --git a/internal/query/schema_discovery_test.go b/internal/query/schema_discovery_test.go index e769930f6..57644e3d2 100644 --- a/internal/query/schema_discovery_test.go +++ b/internal/query/schema_discovery_test.go @@ -11,8 +11,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" ) type gatedEngine struct { diff --git a/internal/query/schema_test.go b/internal/query/schema_test.go index d71937609..35615e149 100644 --- a/internal/query/schema_test.go +++ b/internal/query/schema_test.go @@ -7,8 +7,8 @@ import ( "slices" "testing" - "github.com/labstack/fanout/internal/telemetry" - "github.com/labstack/fanout/internal/telemetry/semconv" + "github.com/labstack/pitot/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry/semconv" ) func TestSchemaDiscoversColumnsAttributesAndValues(t *testing.T) { diff --git a/internal/query/service_input.go b/internal/query/service_input.go index ca4356ced..9526afaed 100644 --- a/internal/query/service_input.go +++ b/internal/query/service_input.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" ) // ServiceGuidance returns an empty message for an exact observed service name. diff --git a/internal/query/shape.go b/internal/query/shape.go index 27b56e89a..16995d76c 100644 --- a/internal/query/shape.go +++ b/internal/query/shape.go @@ -2,7 +2,7 @@ package query import ( "fmt" - "github.com/labstack/fanout/internal/suggest" + "github.com/labstack/pitot/internal/suggest" "slices" "strings" ) diff --git a/internal/query/spec.go b/internal/query/spec.go index 6a5cccc02..977cb9030 100644 --- a/internal/query/spec.go +++ b/internal/query/spec.go @@ -1,11 +1,11 @@ -// Package panel defines Fanout's dashboard spec: the typed, validated contract +// Package panel defines Pitot's dashboard spec: the typed, validated contract // between the agent, the API, storage and the browser renderer. The Go types // are the single source of the JSON Schema the MCP tools publish. package query import "time" -// SpecVersion is the only dashboard spec version Fanout reads. +// SpecVersion is the only dashboard spec version Pitot reads. const SpecVersion = 1 // AllValue selects All for a variable that offers it. diff --git a/internal/query/sqlpanel.go b/internal/query/sqlpanel.go index 10c0b2e2c..9a9e0eb87 100644 --- a/internal/query/sqlpanel.go +++ b/internal/query/sqlpanel.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/engine" + "github.com/labstack/pitot/internal/engine" ) var ( diff --git a/internal/query/sqlpanel_plan.go b/internal/query/sqlpanel_plan.go index c01bad903..e7b61b728 100644 --- a/internal/query/sqlpanel_plan.go +++ b/internal/query/sqlpanel_plan.go @@ -4,7 +4,7 @@ import ( "context" "time" - "github.com/labstack/fanout/internal/engine" + "github.com/labstack/pitot/internal/engine" ) // The physical format and approved relation schemas are fixed for an executor's diff --git a/internal/query/table_semantics_test.go b/internal/query/table_semantics_test.go index 82d3934e7..2bfc28fca 100644 --- a/internal/query/table_semantics_test.go +++ b/internal/query/table_semantics_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" ) type countingTableTrendEngine struct { diff --git a/internal/query/table_trends.go b/internal/query/table_trends.go index f813f0d3e..946db3f03 100644 --- a/internal/query/table_trends.go +++ b/internal/query/table_trends.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" ) func trendKey(values []string) string { raw, _ := json.Marshal(values); return string(raw) } diff --git a/internal/query/table_trends_test.go b/internal/query/table_trends_test.go index 49cbe04d8..326194182 100644 --- a/internal/query/table_trends_test.go +++ b/internal/query/table_trends_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" ) func TestStructuredTableSparklineRejectsDimension(t *testing.T) { diff --git a/internal/query/testhelpers_test.go b/internal/query/testhelpers_test.go index 36dc4f904..5e494d69d 100644 --- a/internal/query/testhelpers_test.go +++ b/internal/query/testhelpers_test.go @@ -11,12 +11,12 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/config" - "github.com/labstack/fanout/internal/engine" - "github.com/labstack/fanout/internal/engine/querytest" - "github.com/labstack/fanout/internal/queryrows" - "github.com/labstack/fanout/internal/telemetry" - telemetrystore "github.com/labstack/fanout/internal/telemetry/store" + "github.com/labstack/pitot/internal/config" + "github.com/labstack/pitot/internal/engine" + "github.com/labstack/pitot/internal/engine/querytest" + "github.com/labstack/pitot/internal/queryrows" + "github.com/labstack/pitot/internal/telemetry" + telemetrystore "github.com/labstack/pitot/internal/telemetry/store" ) // fixtureStart is the start of every fixture window: twelve hours of data diff --git a/internal/query/trace_exclude_test.go b/internal/query/trace_exclude_test.go index c78869f35..f23ca09db 100644 --- a/internal/query/trace_exclude_test.go +++ b/internal/query/trace_exclude_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) // A negated term on the traces viz drops every trace with a span that matches diff --git a/internal/query/variables.go b/internal/query/variables.go index c9edbeae7..bbf236091 100644 --- a/internal/query/variables.go +++ b/internal/query/variables.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "github.com/labstack/fanout/internal/queryrows" + "github.com/labstack/pitot/internal/queryrows" ) type Option struct { diff --git a/internal/server/clientca.go b/internal/server/clientca.go index a5ecb5056..14a1ddaa4 100644 --- a/internal/server/clientca.go +++ b/internal/server/clientca.go @@ -21,7 +21,7 @@ func RequireClientCertificates(srv *http.Server, pool *x509.CertPool) { srv.TLSConfig.ClientAuth = tls.RequireAndVerifyClientCert } -// LoadClientCAs reads the FANOUT_TLS_CLIENT_CA_FILE bundle: one or more PEM +// LoadClientCAs reads the PITOT_TLS_CLIENT_CA_FILE bundle: one or more PEM // CERTIFICATE blocks separated only by whitespace. It rejects anything else, // including text around the blocks and malformed blocks that pem.Decode would // otherwise skip, so a truncated or wrong file fails startup. Errors name the @@ -29,7 +29,7 @@ func RequireClientCertificates(srv *http.Server, pool *x509.CertPool) { func LoadClientCAs(path string) (*x509.CertPool, error) { data, err := os.ReadFile(path) if err != nil { - return nil, fmt.Errorf("FANOUT_TLS_CLIENT_CA_FILE: read %q: %w", path, err) + return nil, fmt.Errorf("PITOT_TLS_CLIENT_CA_FILE: read %q: %w", path, err) } pool := x509.NewCertPool() count := 0 @@ -43,21 +43,21 @@ func LoadClientCAs(path string) (*x509.CertPool, error) { // pem.Decode skips leading text and malformed blocks; only accept a // block that starts the remaining input and is the only one consumed. if block == nil || !bytes.HasPrefix(data, pemBegin) || bytes.Count(consumed, pemBegin) != 1 { - return nil, fmt.Errorf("FANOUT_TLS_CLIENT_CA_FILE: %q contains data that is not a PEM block after certificate %d", path, count) + return nil, fmt.Errorf("PITOT_TLS_CLIENT_CA_FILE: %q contains data that is not a PEM block after certificate %d", path, count) } if block.Type != "CERTIFICATE" { - return nil, fmt.Errorf("FANOUT_TLS_CLIENT_CA_FILE: %q contains a %q PEM block; only certificates are allowed", path, block.Type) + return nil, fmt.Errorf("PITOT_TLS_CLIENT_CA_FILE: %q contains a %q PEM block; only certificates are allowed", path, block.Type) } certificate, err := x509.ParseCertificate(block.Bytes) if err != nil { - return nil, fmt.Errorf("FANOUT_TLS_CLIENT_CA_FILE: parse certificate %d in %q: %w", count+1, path, err) + return nil, fmt.Errorf("PITOT_TLS_CLIENT_CA_FILE: parse certificate %d in %q: %w", count+1, path, err) } pool.AddCert(certificate) count++ data = rest } if count == 0 { - return nil, fmt.Errorf("FANOUT_TLS_CLIENT_CA_FILE: no PEM certificates in %q", path) + return nil, fmt.Errorf("PITOT_TLS_CLIENT_CA_FILE: no PEM certificates in %q", path) } return pool, nil } diff --git a/internal/server/clientca_test.go b/internal/server/clientca_test.go index 1ca87228a..725eadff6 100644 --- a/internal/server/clientca_test.go +++ b/internal/server/clientca_test.go @@ -67,7 +67,7 @@ func TestLoadClientCAs(t *testing.T) { } return } - if err == nil || !strings.HasPrefix(err.Error(), "FANOUT_TLS_CLIENT_CA_FILE:") || !strings.Contains(err.Error(), path) || strings.Contains(err.Error(), contents) { + if err == nil || !strings.HasPrefix(err.Error(), "PITOT_TLS_CLIENT_CA_FILE:") || !strings.Contains(err.Error(), path) || strings.Contains(err.Error(), contents) { t.Fatalf("error must name the variable and path without contents, got %v", err) } }) diff --git a/internal/server/http.go b/internal/server/http.go index 682dddd95..41bf9ae15 100644 --- a/internal/server/http.go +++ b/internal/server/http.go @@ -1,4 +1,4 @@ -// Package server serves Fanout's browser and OTLP surfaces on one listener. +// Package server serves Pitot's browser and OTLP surfaces on one listener. package server import ( diff --git a/internal/settings/ingest.go b/internal/settings/ingest.go index 9dc01cbcf..b3b52c4a6 100644 --- a/internal/settings/ingest.go +++ b/internal/settings/ingest.go @@ -12,11 +12,11 @@ import ( "unicode" "unicode/utf8" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/db/generated" - appid "github.com/labstack/fanout/internal/id" - "github.com/labstack/fanout/internal/secret" - appstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/db/generated" + appid "github.com/labstack/pitot/internal/id" + "github.com/labstack/pitot/internal/secret" + appstore "github.com/labstack/pitot/internal/store" ) const ( diff --git a/internal/settings/ingest_test.go b/internal/settings/ingest_test.go index 2fe341327..39181ad44 100644 --- a/internal/settings/ingest_test.go +++ b/internal/settings/ingest_test.go @@ -18,9 +18,9 @@ import ( "github.com/pressly/goose/v3" _ "modernc.org/sqlite" - "github.com/labstack/fanout/internal/db" - "github.com/labstack/fanout/internal/secret" - appstore "github.com/labstack/fanout/internal/store" + "github.com/labstack/pitot/internal/db" + "github.com/labstack/pitot/internal/secret" + appstore "github.com/labstack/pitot/internal/store" ) func newTestStore(t *testing.T) *Store { @@ -121,7 +121,7 @@ func TestMigrationMovesExistingTokenToDefaultAndStillAuthenticates(t *testing.T) } } -// An upgraded install whose token came from FANOUT_INGEST_TOKEN still carries +// An upgraded install whose token came from PITOT_INGEST_TOKEN still carries // that setting. It must not gain a second token, and revoking the migrated one // must not let the setting bring it back on the next start. func TestMigrationOfConfiguredTokenIsNotSeededAgain(t *testing.T) { diff --git a/internal/settings/store.go b/internal/settings/store.go index 2fada9e52..66c88fbcd 100644 --- a/internal/settings/store.go +++ b/internal/settings/store.go @@ -8,8 +8,8 @@ import ( "fmt" "time" - "github.com/labstack/fanout/internal/auth" - "github.com/labstack/fanout/internal/db/generated" + "github.com/labstack/pitot/internal/auth" + "github.com/labstack/pitot/internal/db/generated" ) type Store struct { diff --git a/internal/store/store.go b/internal/store/store.go index 6c89e750e..3d84415fa 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -6,7 +6,7 @@ import ( "fmt" "time" - appdb "github.com/labstack/fanout/internal/db" + appdb "github.com/labstack/pitot/internal/db" _ "modernc.org/sqlite" ) diff --git a/internal/telemetry/coerce_test.go b/internal/telemetry/coerce_test.go index 06545d8e8..b2fc82eb8 100644 --- a/internal/telemetry/coerce_test.go +++ b/internal/telemetry/coerce_test.go @@ -6,7 +6,7 @@ import ( "path/filepath" "testing" - "github.com/labstack/fanout/internal/telemetry/semconv" + "github.com/labstack/pitot/internal/telemetry/semconv" ) var coercions = []struct { diff --git a/internal/telemetry/columns.go b/internal/telemetry/columns.go index 8d75ea38a..f3e3b8420 100644 --- a/internal/telemetry/columns.go +++ b/internal/telemetry/columns.go @@ -5,7 +5,7 @@ import ( "reflect" "time" - "github.com/labstack/fanout/internal/telemetry/semconv" + "github.com/labstack/pitot/internal/telemetry/semconv" "github.com/parquet-go/parquet-go" "github.com/zeebo/xxh3" ) @@ -186,6 +186,7 @@ const metricNoRecordedValue = 1 // spillPrefix starts the footer key whose value counts the rows whose value // of a key could not be converted to its type. +// Preserve the published footer spelling so existing batches remain readable. const spillPrefix = "fanout.spill." // Spans keep trace locality, which the trace index depends on. Logs and diff --git a/internal/telemetry/compaction_debt_test.go b/internal/telemetry/compaction_debt_test.go index 3dbe23b96..ecb0926d2 100644 --- a/internal/telemetry/compaction_debt_test.go +++ b/internal/telemetry/compaction_debt_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/metrics" + "github.com/labstack/pitot/internal/metrics" "github.com/prometheus/client_golang/prometheus/promhttp" ) @@ -34,7 +34,7 @@ func TestMetricsScrapeDoesNotWaitForCatalogLock(t *testing.T) { case <-time.After(100 * time.Millisecond): t.Fatal("/metrics waited for the catalog lock") } - if recorder.Code != http.StatusOK || !strings.Contains(recorder.Body.String(), "fanout_compaction_backlog_batches 1\n") { + if recorder.Code != http.StatusOK || !strings.Contains(recorder.Body.String(), "pitot_compaction_backlog_batches 1\n") { t.Fatalf("scrape did not return the cached backlog: %d %s", recorder.Code, recorder.Body.String()) } } diff --git a/internal/telemetry/compaction_metrics_test.go b/internal/telemetry/compaction_metrics_test.go index 0e1c65492..eeb17bbb1 100644 --- a/internal/telemetry/compaction_metrics_test.go +++ b/internal/telemetry/compaction_metrics_test.go @@ -5,7 +5,7 @@ import ( "path/filepath" "testing" - "github.com/labstack/fanout/internal/metrics" + "github.com/labstack/pitot/internal/metrics" "github.com/prometheus/client_golang/prometheus/testutil" ) diff --git a/internal/telemetry/merge_lists_test.go b/internal/telemetry/merge_lists_test.go index 402800ae7..d2140c362 100644 --- a/internal/telemetry/merge_lists_test.go +++ b/internal/telemetry/merge_lists_test.go @@ -6,7 +6,7 @@ import ( "path/filepath" "testing" - "github.com/labstack/fanout/internal/telemetry/semconv" + "github.com/labstack/pitot/internal/telemetry/semconv" ) // List columns hold a row's elements as consecutive values. Compaction diff --git a/internal/telemetry/parquet.go b/internal/telemetry/parquet.go index ca8b98ab7..69723db3c 100644 --- a/internal/telemetry/parquet.go +++ b/internal/telemetry/parquet.go @@ -19,7 +19,7 @@ import ( "sync/atomic" "time" - "github.com/labstack/fanout/internal/metrics" + "github.com/labstack/pitot/internal/metrics" "github.com/parquet-go/parquet-go" "github.com/zeebo/xxh3" "golang.org/x/sync/errgroup" diff --git a/internal/telemetry/parquet_bytes_test.go b/internal/telemetry/parquet_bytes_test.go index 02e86da25..a831705ca 100644 --- a/internal/telemetry/parquet_bytes_test.go +++ b/internal/telemetry/parquet_bytes_test.go @@ -14,7 +14,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/telemetry/semconv" + "github.com/labstack/pitot/internal/telemetry/semconv" "github.com/parquet-go/parquet-go" ) diff --git a/internal/telemetry/parquet_codec.go b/internal/telemetry/parquet_codec.go index c8119e3fa..ef208b213 100644 --- a/internal/telemetry/parquet_codec.go +++ b/internal/telemetry/parquet_codec.go @@ -9,7 +9,7 @@ import ( "github.com/parquet-go/parquet-go/format" ) -// parquetCodec compresses every Parquet page Fanout writes. Each page is an +// parquetCodec compresses every Parquet page Pitot writes. Each page is an // independent zstd frame of about parquetPageSize bytes, so a 1 MiB window // covers a whole data page. The library's fastest level defaults to a 4 MiB // window, and each new encoder then allocates 8 MiB of match history. Pooled diff --git a/internal/telemetry/parquet_writer.go b/internal/telemetry/parquet_writer.go index 983d2289c..b588ae2dc 100644 --- a/internal/telemetry/parquet_writer.go +++ b/internal/telemetry/parquet_writer.go @@ -12,7 +12,7 @@ import ( "strings" "sync" - "github.com/labstack/fanout/internal/telemetry/semconv" + "github.com/labstack/pitot/internal/telemetry/semconv" "github.com/parquet-go/parquet-go" "github.com/parquet-go/parquet-go/variant" "golang.org/x/sync/errgroup" diff --git a/internal/telemetry/rows.go b/internal/telemetry/rows.go index da78976f6..0a3b911a4 100644 --- a/internal/telemetry/rows.go +++ b/internal/telemetry/rows.go @@ -1,5 +1,5 @@ // Package telemetry defines the canonical, storage-independent rows emitted by -// the OTLP decoder. These are the only telemetry write contracts in Fanout. +// the OTLP decoder. These are the only telemetry write contracts in Pitot. package telemetry type Span struct { diff --git a/internal/telemetry/semconv_columns_test.go b/internal/telemetry/semconv_columns_test.go index 3124dbfcf..06bfdf586 100644 --- a/internal/telemetry/semconv_columns_test.go +++ b/internal/telemetry/semconv_columns_test.go @@ -3,7 +3,7 @@ package telemetry import ( "testing" - "github.com/labstack/fanout/internal/telemetry/semconv" + "github.com/labstack/pitot/internal/telemetry/semconv" ) // Spans carry every standard key's column and logs and metrics every diff --git a/internal/telemetry/store/admission.go b/internal/telemetry/store/admission.go index 17ae35040..5ed2f4390 100644 --- a/internal/telemetry/store/admission.go +++ b/internal/telemetry/store/admission.go @@ -7,8 +7,8 @@ import ( "sync" "time" - "github.com/labstack/fanout/internal/metrics" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/metrics" + "github.com/labstack/pitot/internal/telemetry" ) const ( diff --git a/internal/telemetry/store/admission_test.go b/internal/telemetry/store/admission_test.go index f75282da5..2a3a1cb9e 100644 --- a/internal/telemetry/store/admission_test.go +++ b/internal/telemetry/store/admission_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) func TestAdmissionDebtAIMD(t *testing.T) { diff --git a/internal/telemetry/store/backpressure_test.go b/internal/telemetry/store/backpressure_test.go index 65596811c..5c8264d37 100644 --- a/internal/telemetry/store/backpressure_test.go +++ b/internal/telemetry/store/backpressure_test.go @@ -11,7 +11,7 @@ import ( "testing/synctest" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) type blockedCompactionCommitter struct { diff --git a/internal/telemetry/store/batch_bytes_test.go b/internal/telemetry/store/batch_bytes_test.go index f2f18ca2e..c7a84bc03 100644 --- a/internal/telemetry/store/batch_bytes_test.go +++ b/internal/telemetry/store/batch_bytes_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) func TestBatchBytesChargesResourceIdentityOnceAcrossSignals(t *testing.T) { diff --git a/internal/telemetry/store/compaction.go b/internal/telemetry/store/compaction.go index dedc8961f..7abf41c6e 100644 --- a/internal/telemetry/store/compaction.go +++ b/internal/telemetry/store/compaction.go @@ -11,8 +11,8 @@ import ( "sort" "time" - "github.com/labstack/fanout/internal/metrics" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/metrics" + "github.com/labstack/pitot/internal/telemetry" "golang.org/x/sync/errgroup" ) diff --git a/internal/telemetry/store/compaction_bytes_test.go b/internal/telemetry/store/compaction_bytes_test.go index 37371d212..4d6f56ebf 100644 --- a/internal/telemetry/store/compaction_bytes_test.go +++ b/internal/telemetry/store/compaction_bytes_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) // A merge holds every input's dictionaries and cursors at once, so the live diff --git a/internal/telemetry/store/compaction_day_test.go b/internal/telemetry/store/compaction_day_test.go index da9dc7d61..4b6168143 100644 --- a/internal/telemetry/store/compaction_day_test.go +++ b/internal/telemetry/store/compaction_day_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) // hourFiles returns one settled file per ingest hour in [from, to), as hour diff --git a/internal/telemetry/store/compaction_preemption_test.go b/internal/telemetry/store/compaction_preemption_test.go index 5cdb4b0a7..22104cbb3 100644 --- a/internal/telemetry/store/compaction_preemption_test.go +++ b/internal/telemetry/store/compaction_preemption_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) func TestHigherGenerationMergeYieldsWithoutBlockingDebtRetirement(t *testing.T) { diff --git a/internal/telemetry/store/compaction_pressure_test.go b/internal/telemetry/store/compaction_pressure_test.go index 48b3177fa..70f90a0ca 100644 --- a/internal/telemetry/store/compaction_pressure_test.go +++ b/internal/telemetry/store/compaction_pressure_test.go @@ -3,7 +3,7 @@ package store import ( "testing" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) func TestPressuredCompactionBoundsRowsAndPreservesNormalCeilings(t *testing.T) { diff --git a/internal/telemetry/store/compaction_starvation_test.go b/internal/telemetry/store/compaction_starvation_test.go index 38c80ec7a..793f2d2e3 100644 --- a/internal/telemetry/store/compaction_starvation_test.go +++ b/internal/telemetry/store/compaction_starvation_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) func genBatches(day int64, generation uint32, n int, rows int) []telemetry.BatchMetadata { diff --git a/internal/telemetry/store/publication_test.go b/internal/telemetry/store/publication_test.go index e2e0d1a15..b0454d46d 100644 --- a/internal/telemetry/store/publication_test.go +++ b/internal/telemetry/store/publication_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) func TestPublicationHorizonWaitsForEarlierAttempts(t *testing.T) { diff --git a/internal/telemetry/store/read_pressure_test.go b/internal/telemetry/store/read_pressure_test.go index 211693bde..35cf29400 100644 --- a/internal/telemetry/store/read_pressure_test.go +++ b/internal/telemetry/store/read_pressure_test.go @@ -3,7 +3,7 @@ package store import ( "context" "fmt" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" "testing" "time" ) diff --git a/internal/telemetry/store/repair.go b/internal/telemetry/store/repair.go index d0c5935a2..195c383d7 100644 --- a/internal/telemetry/store/repair.go +++ b/internal/telemetry/store/repair.go @@ -12,7 +12,7 @@ import ( "sync/atomic" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" "golang.org/x/sync/errgroup" ) diff --git a/internal/telemetry/store/repair_test.go b/internal/telemetry/store/repair_test.go index ae75d627c..2144696c8 100644 --- a/internal/telemetry/store/repair_test.go +++ b/internal/telemetry/store/repair_test.go @@ -11,7 +11,7 @@ import ( "strings" "testing" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" "github.com/parquet-go/parquet-go" ) diff --git a/internal/telemetry/store/repository.go b/internal/telemetry/store/repository.go index b02908e0d..b4a7e6c30 100644 --- a/internal/telemetry/store/repository.go +++ b/internal/telemetry/store/repository.go @@ -12,8 +12,8 @@ import ( "sync" "time" - "github.com/labstack/fanout/internal/metrics" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/metrics" + "github.com/labstack/pitot/internal/telemetry" ) type Batch struct { @@ -87,7 +87,7 @@ func Open(root string) (*Repository, error) { // the other saying something the code no longer guarantees. Guidance an // operator can act on wrongly is worse than guidance in one place they have to // open. TestUnresolvedCompactionRunbookExists keeps the link honest. -const compactionRunbookURL = "https://fanout.run/docs/guides/troubleshooting#an-unresolved-compaction-blocks-startup" +const compactionRunbookURL = "https://pitot.dev/docs/guides/troubleshooting#an-unresolved-compaction-blocks-startup" // logUnresolvedCompaction spells out the operator's options for a marker that // blocks startup. @@ -105,7 +105,7 @@ const compactionRunbookURL = "https://fanout.run/docs/guides/troubleshooting#an- // rollback warning is the kind of thing an operator has to be able to read // once, in full, at the moment the process refuses to come up. func (r *Repository) logUnresolvedCompaction(err error) { - slog.Error("Parquet compaction is unresolved; Fanout will not start", + slog.Error("Parquet compaction is unresolved; Pitot will not start", "err", err, "marker", filepath.Join(r.root, "COMPACTION.json"), "compaction_staging", filepath.Join(r.root, "compaction"), diff --git a/internal/telemetry/store/repository_test.go b/internal/telemetry/store/repository_test.go index 35d7d2cd0..ac5c6b4e0 100644 --- a/internal/telemetry/store/repository_test.go +++ b/internal/telemetry/store/repository_test.go @@ -13,7 +13,7 @@ import ( "time" _ "github.com/duckdb/duckdb-go/v2" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) type testParquetCompactor struct { diff --git a/internal/telemetry/store/writer.go b/internal/telemetry/store/writer.go index c5fcd1d7d..50f28e4a9 100644 --- a/internal/telemetry/store/writer.go +++ b/internal/telemetry/store/writer.go @@ -12,8 +12,8 @@ import ( "time" "github.com/google/uuid" - "github.com/labstack/fanout/internal/metrics" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/metrics" + "github.com/labstack/pitot/internal/telemetry" ) const ( diff --git a/internal/telemetry/store/writer_accounting_test.go b/internal/telemetry/store/writer_accounting_test.go index fc48f4531..049675f4b 100644 --- a/internal/telemetry/store/writer_accounting_test.go +++ b/internal/telemetry/store/writer_accounting_test.go @@ -9,7 +9,7 @@ import ( "testing/synctest" "time" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/telemetry" ) func accountingBatch() Batch { diff --git a/internal/telemetry/store/writer_test.go b/internal/telemetry/store/writer_test.go index 6e460544d..3b830ba0d 100644 --- a/internal/telemetry/store/writer_test.go +++ b/internal/telemetry/store/writer_test.go @@ -9,8 +9,8 @@ import ( "testing" "time" - "github.com/labstack/fanout/internal/metrics" - "github.com/labstack/fanout/internal/telemetry" + "github.com/labstack/pitot/internal/metrics" + "github.com/labstack/pitot/internal/telemetry" "github.com/prometheus/client_golang/prometheus/testutil" ) diff --git a/internal/telemetry/verify.go b/internal/telemetry/verify.go index 6c50bc14a..2ebe1f665 100644 --- a/internal/telemetry/verify.go +++ b/internal/telemetry/verify.go @@ -10,8 +10,8 @@ import ( "strings" driver "github.com/duckdb/duckdb-go/v2" - engine "github.com/labstack/fanout/internal/duckdb" - "github.com/labstack/fanout/internal/telemetry/semconv" + engine "github.com/labstack/pitot/internal/duckdb" + "github.com/labstack/pitot/internal/telemetry/semconv" "github.com/parquet-go/parquet-go" ) diff --git a/internal/telemetry/verify_test.go b/internal/telemetry/verify_test.go index 6309257b0..0310ebdce 100644 --- a/internal/telemetry/verify_test.go +++ b/internal/telemetry/verify_test.go @@ -11,7 +11,7 @@ import ( "time" driver "github.com/duckdb/duckdb-go/v2" - "github.com/labstack/fanout/internal/telemetry/semconv" + "github.com/labstack/pitot/internal/telemetry/semconv" "github.com/parquet-go/parquet-go" ) diff --git a/internal/ui/dist/assets/CopyButton-Btk7J2NS.js b/internal/ui/dist/assets/CopyButton-BIdC6qm1.js similarity index 92% rename from internal/ui/dist/assets/CopyButton-Btk7J2NS.js rename to internal/ui/dist/assets/CopyButton-BIdC6qm1.js index 2adedf01c..e90fb6b80 100644 --- a/internal/ui/dist/assets/CopyButton-Btk7J2NS.js +++ b/internal/ui/dist/assets/CopyButton-BIdC6qm1.js @@ -1 +1 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{Ft as r}from"./brand-CCQ0JT0F.js";var i=n(e(),1);function a(e={}){let t=e.timeout??2e3,[n,r]=(0,i.useState)(null),[a,o]=(0,i.useState)(!1),s=(0,i.useRef)(null);(0,i.useEffect)(()=>()=>{window.clearTimeout(s.current)},[]);let c=e=>{window.clearTimeout(s.current),s.current=window.setTimeout(()=>o(!1),t),o(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),c(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{o(!1),r(null),window.clearTimeout(s.current)},error:n,copied:a}}var o=t(),s={timeout:1e3};function c(e){let{children:t,timeout:n,value:i,...c}=r(`CopyButton`,s,e),l=a({timeout:n});return(0,o.jsx)(o.Fragment,{children:t({copy:()=>l.copy(i),copied:l.copied,...c})})}c.displayName=`@mantine/core/CopyButton`;export{c as t}; \ No newline at end of file +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{Ft as r}from"./brand-D6fP-cLS.js";var i=n(e(),1);function a(e={}){let t=e.timeout??2e3,[n,r]=(0,i.useState)(null),[a,o]=(0,i.useState)(!1),s=(0,i.useRef)(null);(0,i.useEffect)(()=>()=>{window.clearTimeout(s.current)},[]);let c=e=>{window.clearTimeout(s.current),s.current=window.setTimeout(()=>o(!1),t),o(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),c(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{o(!1),r(null),window.clearTimeout(s.current)},error:n,copied:a}}var o=t(),s={timeout:1e3};function c(e){let{children:t,timeout:n,value:i,...c}=r(`CopyButton`,s,e),l=a({timeout:n});return(0,o.jsx)(o.Fragment,{children:t({copy:()=>l.copy(i),copied:l.copied,...c})})}c.displayName=`@mantine/core/CopyButton`;export{c as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/NumberInput-B7uemOf3.js b/internal/ui/dist/assets/NumberInput-CixyOph4.js similarity index 99% rename from internal/ui/dist/assets/NumberInput-B7uemOf3.js rename to internal/ui/dist/assets/NumberInput-CixyOph4.js index 6cc1ec269..0dd25b9a8 100644 --- a/internal/ui/dist/assets/NumberInput-B7uemOf3.js +++ b/internal/ui/dist/assets/NumberInput-CixyOph4.js @@ -1,4 +1,4 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{Ft as r,N as i,Nt as a,Ot as o,Pt as s,Xt as c,Zt as l,en as u,nn as d,pn as f,tn as p,tt as m}from"./brand-CCQ0JT0F.js";import{t as h}from"./noop-mXPS5vjY.js";function g(e,t,n){return t===void 0&&n===void 0?e:t!==void 0&&n===void 0?Math.max(e,t):Math.min(t===void 0&&n!==void 0?e:Math.max(e,t),n)}var _=t(),v=n(e());function ee(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i=s?i+=N(`0`,o-s):i=(i.substring(0,o)||`0`)+`.`+i.substring(o),n+i}function ne(e,t,n){if([``,`-`].indexOf(e)!==-1)return e;var r=(e.indexOf(`.`)!==-1||n)&&t,i=A(e),a=i.beforeDecimal,o=i.afterDecimal,s=i.hasNegation,c=parseFloat(`0.`+(o||`0`)),l=(o.length<=t?`0.`+o:c.toFixed(t)).split(`.`),u=a;a&&Number(l[0])&&(u=a.split(``).reverse().reduce(function(e,t,n){return e.length>n?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e},l[0]));var d=M(l[1]||``,t,n),f=s?`-`:``,p=r?`.`:``;return``+f+u+p+d}function P(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var n=e.createTextRange();return n.move(`character`,t),n.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var F=x(function(e,t){for(var n=0,r=0,i=e.length,a=t.length;e[n]===t[n]&&nn&&i-r>n;)r++;return{from:{start:n,end:i-r},to:{start:n,end:a-r}}}),re=function(e,t){var n=Math.min(e.selectionStart,t);return{from:{start:n,end:e.selectionEnd},to:{start:n,end:t}}};function ie(e,t,n){return Math.min(Math.max(e,t),n)}function I(e){return Math.max(e.selectionStart,e.selectionEnd)}function ae(){return typeof navigator<`u`&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function L(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:``}}function R(e){var t=e.currentValue,n=e.formattedValue,r=e.currentValueIndex,i=e.formattedValueIndex;return t[r]===n[i]}function oe(e,t,n,r,i,a,o){o===void 0&&(o=R);var s=i.findIndex(function(e){return e}),c=e.slice(0,s);!t&&!n.startsWith(c)&&(t=c,n=c+n,r+=c.length);for(var l=n.length,u=e.length,d={},f=Array(l),p=0;p0&&f[g]===-1;)g--;var v=g===-1||f[g]===-1?0:f[g]+1;return v>_?_:r-v<_-r?v:_}function se(e,t,n,r){var i=e.length;if(t=ie(t,0,i),r===`left`){for(;t>=0&&!n[t];)t--;t===-1&&(t=n.indexOf(!0))}else{for(;t<=i&&!n[t];)t++;t>i&&(t=n.lastIndexOf(!0))}return t===-1&&(t=i),t}function ce(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),n=0,r=t.length;nC.length-o.length||xO||d>e.length-o.length)&&(D=d),e=e.substring(0,D),e=V(ee?`-`+e:e,i),e=(e.match(pe(m,!0))||[]).join(``);var k=e.indexOf(m);e=e.replace(new RegExp(E(m),`g`),function(e,t){return t===k?`.`:``});var j=A(e,i),M=j.beforeDecimal,N=j.afterDecimal,te=j.addNegation;return l.end-l.start=s?i+=N(`0`,o-s):i=(i.substring(0,o)||`0`)+`.`+i.substring(o),n+i}function ne(e,t,n){if([``,`-`].indexOf(e)!==-1)return e;var r=(e.indexOf(`.`)!==-1||n)&&t,i=A(e),a=i.beforeDecimal,o=i.afterDecimal,s=i.hasNegation,c=parseFloat(`0.`+(o||`0`)),l=(o.length<=t?`0.`+o:c.toFixed(t)).split(`.`),u=a;a&&Number(l[0])&&(u=a.split(``).reverse().reduce(function(e,t,n){return e.length>n?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e},l[0]));var d=M(l[1]||``,t,n),f=s?`-`:``,p=r?`.`:``;return``+f+u+p+d}function P(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var n=e.createTextRange();return n.move(`character`,t),n.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var F=x(function(e,t){for(var n=0,r=0,i=e.length,a=t.length;e[n]===t[n]&&nn&&i-r>n;)r++;return{from:{start:n,end:i-r},to:{start:n,end:a-r}}}),re=function(e,t){var n=Math.min(e.selectionStart,t);return{from:{start:n,end:e.selectionEnd},to:{start:n,end:t}}};function ie(e,t,n){return Math.min(Math.max(e,t),n)}function I(e){return Math.max(e.selectionStart,e.selectionEnd)}function ae(){return typeof navigator<`u`&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function L(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:``}}function R(e){var t=e.currentValue,n=e.formattedValue,r=e.currentValueIndex,i=e.formattedValueIndex;return t[r]===n[i]}function oe(e,t,n,r,i,a,o){o===void 0&&(o=R);var s=i.findIndex(function(e){return e}),c=e.slice(0,s);!t&&!n.startsWith(c)&&(t=c,n=c+n,r+=c.length);for(var l=n.length,u=e.length,d={},f=Array(l),p=0;p0&&f[g]===-1;)g--;var v=g===-1||f[g]===-1?0:f[g]+1;return v>_?_:r-v<_-r?v:_}function se(e,t,n,r){var i=e.length;if(t=ie(t,0,i),r===`left`){for(;t>=0&&!n[t];)t--;t===-1&&(t=n.indexOf(!0))}else{for(;t<=i&&!n[t];)t++;t>i&&(t=n.lastIndexOf(!0))}return t===-1&&(t=i),t}function ce(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),n=0,r=t.length;nC.length-o.length||xO||d>e.length-o.length)&&(D=d),e=e.substring(0,D),e=V(ee?`-`+e:e,i),e=(e.match(pe(m,!0))||[]).join(``);var k=e.indexOf(m);e=e.replace(new RegExp(E(m),`g`),function(e,t){return t===k?`.`:``});var j=A(e,i),M=j.beforeDecimal,N=j.afterDecimal,te=j.addNegation;return l.end-l.start{let a=i(n,{},r),{classNames:s,className:c,style:l,styles:u,...d}=a,f=h();return(0,_.jsx)(o,{component:e,...v(f,t),...f.getStyles(e,{className:c,classNames:s,style:l,styles:u,props:a}),...d})});return a.displayName=`@mantine/core/${n}`,a.classes=g,a}var b=y(`th`,{columnBorder:!0}),x=y(`td`,{columnBorder:!0}),S=y(`tr`,{rowBorder:!0,striped:!0,highlightOnHover:!0}),C=y(`thead`,{stickyHeader:!0}),w=y(`tbody`),T=y(`tfoot`),E=y(`caption`,{captionSide:!0}),D={type:`scrollarea`},O=s((e,{minWidth:t,maxHeight:n,type:r})=>({scrollContainer:{"--table-min-width":c(t),"--table-max-height":c(n),"--table-overflow":r===`native`?`auto`:void 0}})),k=r(e=>{let t=i(`TableScrollContainer`,D,e),{classNames:n,className:r,style:s,styles:c,unstyled:l,vars:u,children:f,minWidth:p,maxHeight:m,type:h,scrollAreaProps:v,attributes:y,...b}=t,x=a({name:`TableScrollContainer`,classes:g,props:t,className:r,style:s,classNames:n,styles:c,unstyled:l,attributes:y,vars:u,varsResolver:O,rootSelector:`scrollContainer`});return(0,_.jsx)(o,{component:h===`scrollarea`?d:`div`,...h===`scrollarea`?m?{offsetScrollbars:`xy`,...v}:{offsetScrollbars:`x`,...v}:{},...x(`scrollContainer`),...b,children:(0,_.jsx)(`div`,{...x(`scrollContainerInner`),children:f})})});k.classes=g,k.varsResolver=O,k.displayName=`@mantine/core/TableScrollContainer`;function A({data:e}){return(0,_.jsxs)(_.Fragment,{children:[e.caption&&(0,_.jsx)(E,{children:e.caption}),e.head&&(0,_.jsx)(C,{children:(0,_.jsx)(S,{children:e.head.map((e,t)=>(0,_.jsx)(b,{children:e},t))})}),e.body&&(0,_.jsx)(w,{children:e.body.map((e,t)=>(0,_.jsx)(S,{children:e.map((e,t)=>(0,_.jsx)(x,{children:e},t))},t))}),e.foot&&(0,_.jsx)(T,{children:(0,_.jsx)(S,{children:e.foot.map((e,t)=>(0,_.jsx)(b,{children:e},t))})})]})}A.displayName=`@mantine/core/TableDataRenderer`;var j=n(e(),1),M={withRowBorders:!0,verticalSpacing:7},N=s((e,{layout:t,captionSide:n,horizontalSpacing:r,verticalSpacing:i,borderColor:a,stripedColor:o,highlightOnHoverColor:s,striped:l,highlightOnHover:d,stickyHeaderOffset:p,stickyHeader:m})=>({table:{"--table-layout":t,"--table-caption-side":n,"--table-horizontal-spacing":u(r),"--table-vertical-spacing":u(i),"--table-border-color":a?f(a,e):void 0,"--table-striped-color":l&&o?f(o,e):void 0,"--table-highlight-on-hover-color":d&&s?f(s,e):void 0,"--table-sticky-header-offset":m?c(p):void 0}})),P=r(e=>{let t=i(`Table`,M,e),{classNames:n,className:r,style:s,styles:c,unstyled:l,vars:u,horizontalSpacing:d,verticalSpacing:f,captionSide:p,stripedColor:h,highlightOnHoverColor:v,striped:y,highlightOnHover:b,withColumnBorders:x,withRowBorders:S,withTableBorder:C,borderColor:w,layout:T,data:E,children:D,stickyHeader:O,stickyHeaderOffset:k,mod:P,tabularNums:F,attributes:I,...L}=t,R=a({name:`Table`,props:t,className:r,style:s,classes:g,classNames:n,styles:c,unstyled:l,attributes:I,rootSelector:`table`,vars:u,varsResolver:N,stable:!0}),z=y===!0?`odd`:y||void 0,B=p||`bottom`,V=(0,j.useMemo)(()=>({getStyles:R,stickyHeader:O,striped:z,highlightOnHover:b,withColumnBorders:x,withRowBorders:S,captionSide:B}),[R,O,z,b,x,S,B]);return(0,_.jsx)(m,{value:V,children:(0,_.jsx)(o,{component:`table`,mod:[{withTableBorder:C,tabularNums:F},P],...R(`table`),...L,children:D||!!E&&(0,_.jsx)(A,{data:E})})})});P.classes=g,P.varsResolver=N,P.displayName=`@mantine/core/Table`,P.Td=x,P.Th=b,P.Tr=S,P.Thead=C,P.Tbody=w,P.Tfoot=T,P.Caption=E,P.ScrollContainer=k,P.DataRenderer=A;export{p as n,P as t}; \ No newline at end of file +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{Dt as r,Ft as i,Nt as a,Tt as o,Zt as s,bn as c,gn as l,mn as u,nt as d,qt as f}from"./brand-D6fP-cLS.js";function p(){return`development`}var[m,h]=l(`Table component was not found in the tree`),g={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`},_=t();function v(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 y(e,t){let n=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,a=r(r=>{let a=i(n,{},r),{classNames:s,className:c,style:l,styles:u,...d}=a,f=h();return(0,_.jsx)(o,{component:e,...v(f,t),...f.getStyles(e,{className:c,classNames:s,style:l,styles:u,props:a}),...d})});return a.displayName=`@mantine/core/${n}`,a.classes=g,a}var b=y(`th`,{columnBorder:!0}),x=y(`td`,{columnBorder:!0}),S=y(`tr`,{rowBorder:!0,striped:!0,highlightOnHover:!0}),C=y(`thead`,{stickyHeader:!0}),w=y(`tbody`),T=y(`tfoot`),E=y(`caption`,{captionSide:!0}),D={type:`scrollarea`},O=s((e,{minWidth:t,maxHeight:n,type:r})=>({scrollContainer:{"--table-min-width":c(t),"--table-max-height":c(n),"--table-overflow":r===`native`?`auto`:void 0}})),k=r(e=>{let t=i(`TableScrollContainer`,D,e),{classNames:n,className:r,style:s,styles:c,unstyled:l,vars:u,children:f,minWidth:p,maxHeight:m,type:h,scrollAreaProps:v,attributes:y,...b}=t,x=a({name:`TableScrollContainer`,classes:g,props:t,className:r,style:s,classNames:n,styles:c,unstyled:l,attributes:y,vars:u,varsResolver:O,rootSelector:`scrollContainer`});return(0,_.jsx)(o,{component:h===`scrollarea`?d:`div`,...h===`scrollarea`?m?{offsetScrollbars:`xy`,...v}:{offsetScrollbars:`x`,...v}:{},...x(`scrollContainer`),...b,children:(0,_.jsx)(`div`,{...x(`scrollContainerInner`),children:f})})});k.classes=g,k.varsResolver=O,k.displayName=`@mantine/core/TableScrollContainer`;function A({data:e}){return(0,_.jsxs)(_.Fragment,{children:[e.caption&&(0,_.jsx)(E,{children:e.caption}),e.head&&(0,_.jsx)(C,{children:(0,_.jsx)(S,{children:e.head.map((e,t)=>(0,_.jsx)(b,{children:e},t))})}),e.body&&(0,_.jsx)(w,{children:e.body.map((e,t)=>(0,_.jsx)(S,{children:e.map((e,t)=>(0,_.jsx)(x,{children:e},t))},t))}),e.foot&&(0,_.jsx)(T,{children:(0,_.jsx)(S,{children:e.foot.map((e,t)=>(0,_.jsx)(b,{children:e},t))})})]})}A.displayName=`@mantine/core/TableDataRenderer`;var j=n(e(),1),M={withRowBorders:!0,verticalSpacing:7},N=s((e,{layout:t,captionSide:n,horizontalSpacing:r,verticalSpacing:i,borderColor:a,stripedColor:o,highlightOnHoverColor:s,striped:l,highlightOnHover:d,stickyHeaderOffset:p,stickyHeader:m})=>({table:{"--table-layout":t,"--table-caption-side":n,"--table-horizontal-spacing":u(r),"--table-vertical-spacing":u(i),"--table-border-color":a?f(a,e):void 0,"--table-striped-color":l&&o?f(o,e):void 0,"--table-highlight-on-hover-color":d&&s?f(s,e):void 0,"--table-sticky-header-offset":m?c(p):void 0}})),P=r(e=>{let t=i(`Table`,M,e),{classNames:n,className:r,style:s,styles:c,unstyled:l,vars:u,horizontalSpacing:d,verticalSpacing:f,captionSide:p,stripedColor:h,highlightOnHoverColor:v,striped:y,highlightOnHover:b,withColumnBorders:x,withRowBorders:S,withTableBorder:C,borderColor:w,layout:T,data:E,children:D,stickyHeader:O,stickyHeaderOffset:k,mod:P,tabularNums:F,attributes:I,...L}=t,R=a({name:`Table`,props:t,className:r,style:s,classes:g,classNames:n,styles:c,unstyled:l,attributes:I,rootSelector:`table`,vars:u,varsResolver:N,stable:!0}),z=y===!0?`odd`:y||void 0,B=p||`bottom`,V=(0,j.useMemo)(()=>({getStyles:R,stickyHeader:O,striped:z,highlightOnHover:b,withColumnBorders:x,withRowBorders:S,captionSide:B}),[R,O,z,b,x,S,B]);return(0,_.jsx)(m,{value:V,children:(0,_.jsx)(o,{component:`table`,mod:[{withTableBorder:C,tabularNums:F},P],...R(`table`),...L,children:D||!!E&&(0,_.jsx)(A,{data:E})})})});P.classes=g,P.varsResolver=N,P.displayName=`@mantine/core/Table`,P.Td=x,P.Th=b,P.Tr=S,P.Thead=C,P.Tbody=w,P.Tfoot=T,P.Caption=E,P.ScrollContainer=k,P.DataRenderer=A;export{p as n,P as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/Textarea-BewZUT1f.js b/internal/ui/dist/assets/Textarea-r3wuKNbO.js similarity index 96% rename from internal/ui/dist/assets/Textarea-BewZUT1f.js rename to internal/ui/dist/assets/Textarea-r3wuKNbO.js index 6bb1f668d..962a642c2 100644 --- a/internal/ui/dist/assets/Textarea-BewZUT1f.js +++ b/internal/ui/dist/assets/Textarea-r3wuKNbO.js @@ -1 +1 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{Dt as r,Ft as i,N as a,nn as o}from"./brand-CCQ0JT0F.js";import{n as s}from"./Table-Bid0E8qM.js";var c=n(e(),1),l=t(),u=[`borderBottomWidth`,`borderLeftWidth`,`borderRightWidth`,`borderTopWidth`,`boxSizing`,`fontFamily`,`fontSize`,`fontStyle`,`fontWeight`,`letterSpacing`,`lineHeight`,`paddingBottom`,`paddingLeft`,`paddingRight`,`paddingTop`,`tabSize`,`textIndent`,`textRendering`,`textTransform`,`width`,`wordBreak`,`wordSpacing`,`scrollbarGutter`],d={"min-height":`0`,"max-height":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`,display:`block`};function f(e){Object.keys(d).forEach(t=>{e.style.setProperty(t,d[t],`important`)})}function p(e){let t=window.getComputedStyle(e);if(t===null)return null;let n={};for(let e of u)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 m=null;function h(e,t,n=1,r=1/0){m||(m=document.createElement(`textarea`),m.setAttribute(`tabindex`,`-1`),m.setAttribute(`aria-hidden`,`true`),m.setAttribute(`aria-label`,`autosize measurement`),f(m)),m.parentNode===null&&document.body.appendChild(m);let{paddingSize:i,borderSize:a,sizingStyle:o}=e,{boxSizing:s}=o;Object.keys(o).forEach(e=>{m.style[e]=o[e]}),f(m),m.value=t;let c=s===`border-box`?m.scrollHeight+a:m.scrollHeight-i;m.value=t,c=s===`border-box`?m.scrollHeight+a:m.scrollHeight-i,m.value=`x`;let l=m.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 g({maxRows:e,minRows:t,onChange:n,ref:r,...i}){let a=i.value!==void 0,s=(0,c.useRef)(null),u=o(s,r),d=(0,c.useRef)(0),f=(0,c.useRef)(0),m=()=>{let n=s.current;if(!n)return;let r=p(n);if(!r)return;let[i]=h(r,n.value||n.placeholder||`x`,t,e);d.current!==i&&(d.current=i,n.style.setProperty(`height`,`${i}px`,`important`))},g=(0,c.useEffectEvent)(m),_=e=>{a||m(),n?.(e)};return(0,c.useLayoutEffect)(m),(0,c.useEffect)(()=>{let e=()=>m();return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,c.useEffect)(()=>{let e=s.current;if(!e||typeof ResizeObserver>`u`)return;f.current=e.offsetWidth;let t=0,n=new ResizeObserver(()=>{s.current&&s.current.offsetWidth!==f.current&&(f.current=s.current.offsetWidth,cancelAnimationFrame(t),t=requestAnimationFrame(g))});return n.observe(e),()=>{cancelAnimationFrame(t),n.disconnect()}},[]),(0,c.useEffect)(()=>{let e=()=>m();return document.fonts.addEventListener(`loadingdone`,e),()=>document.fonts.removeEventListener(`loadingdone`,e)},[]),(0,c.useEffect)(()=>{let e=e=>{if(s.current?.form===e.target&&!a){let e=s.current.value;requestAnimationFrame(()=>{s.current&&e!==s.current.value&&m()})}};return document.body.addEventListener(`reset`,e),()=>document.body.removeEventListener(`reset`,e)},[a]),(0,l.jsx)(`textarea`,{rows:t,...i,onChange:_,ref:u})}var _=r(e=>{let{autosize:t,maxRows:n,minRows:r,__staticSelector:o,resize:c,bottomSection:u,bottomSectionProps:d,...f}=i([`Input`,`InputWrapper`,`Textarea`],null,e),p=t&&s()!==`test`,m=p?{maxRows:n,minRows:r}:{};return(0,l.jsx)(a,{component:p?g:`textarea`,...f,__staticSelector:o||`Textarea`,__bottomSection:u,__bottomSectionProps:d,multiline:!0,"data-no-overflow":t&&n===void 0||void 0,__vars:{"--input-resize":c},...m})});_.classes=a.classes,_.displayName=`@mantine/core/Textarea`;export{_ as t}; \ No newline at end of file +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{Dt as r,Ft as i,N as a,nn as o}from"./brand-D6fP-cLS.js";import{n as s}from"./Table-D4ZwUno3.js";var c=n(e(),1),l=t(),u=[`borderBottomWidth`,`borderLeftWidth`,`borderRightWidth`,`borderTopWidth`,`boxSizing`,`fontFamily`,`fontSize`,`fontStyle`,`fontWeight`,`letterSpacing`,`lineHeight`,`paddingBottom`,`paddingLeft`,`paddingRight`,`paddingTop`,`tabSize`,`textIndent`,`textRendering`,`textTransform`,`width`,`wordBreak`,`wordSpacing`,`scrollbarGutter`],d={"min-height":`0`,"max-height":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`,display:`block`};function f(e){Object.keys(d).forEach(t=>{e.style.setProperty(t,d[t],`important`)})}function p(e){let t=window.getComputedStyle(e);if(t===null)return null;let n={};for(let e of u)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 m=null;function h(e,t,n=1,r=1/0){m||(m=document.createElement(`textarea`),m.setAttribute(`tabindex`,`-1`),m.setAttribute(`aria-hidden`,`true`),m.setAttribute(`aria-label`,`autosize measurement`),f(m)),m.parentNode===null&&document.body.appendChild(m);let{paddingSize:i,borderSize:a,sizingStyle:o}=e,{boxSizing:s}=o;Object.keys(o).forEach(e=>{m.style[e]=o[e]}),f(m),m.value=t;let c=s===`border-box`?m.scrollHeight+a:m.scrollHeight-i;m.value=t,c=s===`border-box`?m.scrollHeight+a:m.scrollHeight-i,m.value=`x`;let l=m.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 g({maxRows:e,minRows:t,onChange:n,ref:r,...i}){let a=i.value!==void 0,s=(0,c.useRef)(null),u=o(s,r),d=(0,c.useRef)(0),f=(0,c.useRef)(0),m=()=>{let n=s.current;if(!n)return;let r=p(n);if(!r)return;let[i]=h(r,n.value||n.placeholder||`x`,t,e);d.current!==i&&(d.current=i,n.style.setProperty(`height`,`${i}px`,`important`))},g=(0,c.useEffectEvent)(m),_=e=>{a||m(),n?.(e)};return(0,c.useLayoutEffect)(m),(0,c.useEffect)(()=>{let e=()=>m();return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,c.useEffect)(()=>{let e=s.current;if(!e||typeof ResizeObserver>`u`)return;f.current=e.offsetWidth;let t=0,n=new ResizeObserver(()=>{s.current&&s.current.offsetWidth!==f.current&&(f.current=s.current.offsetWidth,cancelAnimationFrame(t),t=requestAnimationFrame(g))});return n.observe(e),()=>{cancelAnimationFrame(t),n.disconnect()}},[]),(0,c.useEffect)(()=>{let e=()=>m();return document.fonts.addEventListener(`loadingdone`,e),()=>document.fonts.removeEventListener(`loadingdone`,e)},[]),(0,c.useEffect)(()=>{let e=e=>{if(s.current?.form===e.target&&!a){let e=s.current.value;requestAnimationFrame(()=>{s.current&&e!==s.current.value&&m()})}};return document.body.addEventListener(`reset`,e),()=>document.body.removeEventListener(`reset`,e)},[a]),(0,l.jsx)(`textarea`,{rows:t,...i,onChange:_,ref:u})}var _=r(e=>{let{autosize:t,maxRows:n,minRows:r,__staticSelector:o,resize:c,bottomSection:u,bottomSectionProps:d,...f}=i([`Input`,`InputWrapper`,`Textarea`],null,e),p=t&&s()!==`test`,m=p?{maxRows:n,minRows:r}:{};return(0,l.jsx)(a,{component:p?g:`textarea`,...f,__staticSelector:o||`Textarea`,__bottomSection:u,__bottomSectionProps:d,multiline:!0,"data-no-overflow":t&&n===void 0||void 0,__vars:{"--input-resize":c},...m})});_.classes=a.classes,_.displayName=`@mantine/core/Textarea`;export{_ as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/alerts-Czm6Z0m8.js b/internal/ui/dist/assets/alerts-CYKuszTJ.js similarity index 96% rename from internal/ui/dist/assets/alerts-Czm6Z0m8.js rename to internal/ui/dist/assets/alerts-CYKuszTJ.js index 5f72386dc..111017848 100644 --- a/internal/ui/dist/assets/alerts-Czm6Z0m8.js +++ b/internal/ui/dist/assets/alerts-CYKuszTJ.js @@ -1 +1 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{D as r,Dt as i,Ft as a,G as o,N as s,Pt as c,S as l,T as u,Tt as d,a as f,en as p,f as m,g as h,in as g,j as _,k as v,q as y,s as b,u as x,w as S}from"./brand-CCQ0JT0F.js";import{n as C}from"./useNavigate-B1zgPEUp.js";import{A as w,E as T,k as E}from"./search-DBgztReF.js";import{t as D}from"./NumberInput-B7uemOf3.js";import{t as O}from"./Table-Bid0E8qM.js";import{n as k}from"./format-fsvZ_y78.js";import{c as A,i as j,l as M,n as N,o as P,r as F,s as ee,t as te}from"./live-data-meta-CbLSAtC3.js";import{r as ne}from"./auth-K3NK-QpB.js";import{t as I}from"./Textarea-BewZUT1f.js";import{T as re,t as L}from"./useQuery-BLTYSIvG.js";import{t as R}from"./useMutation-rZS3GfBb.js";import{i as ie}from"./search-Bj_SOIkw.js";import{_ as ae,k as oe}from"./index-C5SsAUtw.js";import{t as se}from"./loading-skeleton-DEzWruJF.js";import{t as ce}from"./discard-BmoNOAJh.js";var z=n(e(),1),B=t(),V=i(e=>{let t=a([`Input`,`InputWrapper`,`Autocomplete`],{size:`sm`},e),{classNames:n,styles:r,unstyled:i,vars:o,dropdownOpened:l,defaultDropdownOpened:u,onDropdownClose:d,onDropdownOpen:f,onFocus:m,onBlur:h,onClick:_,onChange:v,data:y,value:b,defaultValue:x,selectFirstOptionOnChange:S,selectFirstOptionOnDropdownOpen:C,onOptionSubmit:w,comboboxProps:T,readOnly:E,disabled:D,filter:O,limit:k,withScrollArea:N,maxDropdownHeight:te,floatingHeight:ne,size:I,id:re,renderOption:L,autoComplete:R,scrollAreaProps:ie,onClear:ae,clearButtonProps:oe,error:se,clearable:ce,clearSectionMode:V,rightSection:H,autoSelectOnBlur:U,openOnFocus:W=!0,attributes:G,...K}=t,le=g(re),q=F({id:le,label:K.label,labelProps:K.labelProps,inputWrapperOrder:K.inputWrapperOrder}),ue=M(y),de=A(ue),[J,fe]=p({value:b,defaultValue:x,finalValue:``,onChange:v}),Y=ee({opened:l,defaultOpened:u,onDropdownOpen:()=>{f?.(),C&&Y.selectFirstOption()},onDropdownClose:()=>{d?.(),setTimeout(Y.resetSelectedOption,0)}}),X=e=>{fe(e),Y.resetSelectedOption()},{resolvedClassNames:Z,resolvedStyles:pe}=c({props:t,styles:r,classNames:n});(0,z.useEffect)(()=>{S&&Y.selectFirstOption()},[S,J]);let me=(0,B.jsx)(P.ClearButton,{...oe,onClear:()=>{X(``),ae?.()}});return(0,B.jsxs)(P,{store:Y,__staticSelector:`Autocomplete`,classNames:Z,styles:pe,unstyled:i,readOnly:E,size:I,attributes:G,floatingHeight:ne,keepMounted:U,onOptionSubmit:e=>{w?.(e),X(de[e].label),Y.closeDropdown()},...T,children:[(0,B.jsx)(P.Target,{autoComplete:R,withExpandedAttribute:!0,children:(0,B.jsx)(s,{...K,size:I,__staticSelector:`Autocomplete`,__clearSection:me,__clearable:ce&&!!J&&!D&&!E,__clearSectionMode:V,rightSection:H,disabled:D,readOnly:E,value:J,error:se,onChange:e=>{X(e.currentTarget.value),Y.openDropdown(),S&&Y.selectFirstOption()},onFocus:e=>{W&&Y.openDropdown(),m?.(e)},onBlur:e=>{U&&Y.clickSelectedOption(),Y.closeDropdown(),h?.(e)},onClick:e=>{Y.openDropdown(),_?.(e)},classNames:Z,styles:pe,unstyled:i,attributes:G,id:le})}),(0,B.jsx)(j,{data:ue,hidden:E||D,filter:O,search:J,limit:k,hiddenWhenEmpty:!0,withScrollArea:N,maxDropdownHeight:te,unstyled:i,labelId:q,"aria-label":q?void 0:K[`aria-label`],renderOption:L,scrollAreaProps:ie})]})});V.classes={...s.classes,...P.classes},V.displayName=`@mantine/core/Autocomplete`;var H=[`alerting`,`rules`],U=[`alerting`,`alerts`],W=[`alerting`,`email`],G=e=>`/api/alerting/rules/${encodeURIComponent(e)}`,K=e=>T(`/api/alerting/rules`,{signal:e}).then(e=>e.rules),le=e=>T(`/api/alerting/alerts`,{signal:e}).then(e=>e.alerts),q=e=>T(`/api/alerting/email`,{signal:e}),ue=e=>T(`/api/alerting/rules`,{method:`POST`,json:e}),de=(e,t)=>T(G(e),{method:`PUT`,json:t}),J=e=>T(G(e),{method:`DELETE`}),fe=e=>T(`/api/telemetry/schema?window=1h`,{signal:e}).then(e=>(e.services??[]).map(e=>e.value)),Y=e=>T(`${G(e)}/test`,{method:`POST`}),X=/\b(error_rate|p50|p95|throughput|log_count|z_score|health_score)(_delta)?\b/g;function Z(e){let t=e.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,`""`);return[...new Set(Array.from(t.matchAll(X),e=>e[0]))]}var pe=new Intl.NumberFormat(`en-US`,{style:`percent`,maximumFractionDigits:2}),me=new Intl.NumberFormat(`en-US`,{maximumFractionDigits:0}),Q=new Intl.NumberFormat(`en-US`,{maximumFractionDigits:2});function he(e,t){return e===`error_rate`?pe.format(t):e===`p50`||e===`p95`?`${Q.format(t)} ms`:e===`throughput`||e===`log_count`?me.format(t):e?.endsWith(`_delta`)?`${t>0?`+`:``}${Q.format(t)}%`:Q.format(t)}function ge(e){let t=e.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,`""`),n=/\berror_rate\s*[<>=!]=?\s*(\d+(?:\.\d+)?)/.exec(t)??/(\d+(?:\.\d+)?)\s*[<>=!]=?\s*error_rate\b/.exec(t),r=n?Number(n[1]):0;return r>1?`error_rate runs from 0 to 1, so ${n[1]} can never be reached. For ${n[1]}%, write ${Q.format(r/100)}.`:void 0}var _e=[{label:`Error rate`,expression:`error_rate > 0.05 && throughput > 10`},{label:`p95 latency`,expression:`p95 > 500 && throughput > 10`},{label:`Traffic drop`,expression:`throughput_delta < -50`},{label:`Log volume`,expression:`log_count > 1000`}],ve={name:``,description:``,enabled:!0,service:``,expression:``,for_seconds:60,cooldown_s:300,repeat_interval_s:3600,webhook_url:``,webhook_headers:``,webhook_template:``,notify_on_resolve:!1};function ye(e){if(!e)return ve;let{id:t,created_at:n,updated_at:r,email_status:i,email_status_detail:a,email_status_at:o,...s}=e;return{...ve,...s}}var be=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,xe=e=>[...e].some(e=>{let t=e.charCodeAt(0);return t<32&&t!==9||t===127});function Se(e){if(!e?.trim())return;let t;try{t=JSON.parse(e)}catch{return`Enter a JSON object`}if(typeof t!=`object`||!t||Array.isArray(t))return`Enter a JSON object`;for(let[e,n]of Object.entries(t).sort(([e],[t])=>et))){if(!be.test(e))return`"${e}" is not a valid header name`;if(typeof n!=`string`)return`Header ${e} must be a string`;if(xe(n))return`Header ${e} has a line break or control character`}}var Ce=e=>e.split(/[,\s]+/).filter(Boolean),we=/^[^\s@,<>]+@[^\s@,<>]+$/;function Te(e,t){let n=e.find(e=>!we.test(e));return n?`"${n}" is not an email address`:new Set(e.map(e=>e.toLowerCase())).size>t?`Enter at most ${t} addresses`:void 0}function Ee({rule:e,onClose:t,onSave:n}){let[i,a]=(0,z.useState)(()=>ye(e)),[s,c]=(0,z.useState)(!1),l=ce(JSON.stringify(i)!==JSON.stringify(ye(e)),t,e?`this rule`:`the new rule`),[f,p]=(0,z.useState)(),m=e=>{a(t=>({...t,...e})),p(void 0)},h=i.webhook_headers===e?.webhook_headers?void 0:Se(i.webhook_headers),g=L({queryKey:W,queryFn:({signal:e})=>q(e),staleTime:6e4,retry:!1}),[y,x]=(0,z.useState)(()=>(e?.email_recipients??[]).join(`, `)),C=(e?.email_recipients?.length??0)>0,T=JSON.stringify(i.email_recipients??[])===JSON.stringify(e?.email_recipients??[])?void 0:Te(i.email_recipients??[],g.data?.max_recipients??10),E=i.name.trim()!==``&&i.expression.trim()!==``&&!h&&!T,O=L({queryKey:[`alerting`,`services`],queryFn:({signal:e})=>fe(e),staleTime:6e4,retry:!1}),k=i.service?.trim()??``,A=k!==``&&O.data!==void 0&&!O.data.includes(k),j=ge(i.expression),M=(e,t,n)=>(0,B.jsx)(D,{label:e,description:n,min:0,step:30,value:i[t],onChange:e=>m({[t]:typeof e==`number`?e:0})}),P=async()=>{c(!0);try{await n({...i,name:i.name.trim(),expression:i.expression.trim()})}catch(e){p(e instanceof Error?e.message:`The rule could not be saved`)}finally{c(!1)}};return(0,B.jsxs)(r,{opened:!0,onClose:()=>{s||l.request()},closeOnEscape:!1,onKeyDown:s?void 0:l.onKeyDown,title:e?`Edit rule · ${e.name}`:`New alert rule`,size:`lg`,children:[l.prompt,(0,B.jsxs)(u,{gap:`sm`,children:[(0,B.jsx)(S,{label:`Name`,required:!0,value:i.name,onChange:e=>m({name:e.currentTarget.value}),"data-autofocus":!0}),(0,B.jsx)(S,{label:`Description`,value:i.description??``,onChange:e=>m({description:e.currentTarget.value})}),(0,B.jsx)(V,{label:`Service`,description:`Leave empty to evaluate every service.`,data:O.data??[],value:i.service??``,onChange:e=>m({service:e})}),A&&(0,B.jsxs)(_,{size:`xs`,c:`warn`,mt:-8,role:`status`,children:[`No telemetry from `,k,` in the last hour. Check the name; the rule still saves.`]}),(0,B.jsxs)(u,{gap:4,children:[(0,B.jsxs)(o,{justify:`space-between`,align:`flex-end`,children:[(0,B.jsx)(_,{size:`sm`,fw:500,children:`Expression`}),(0,B.jsxs)(w,{position:`bottom-end`,children:[(0,B.jsx)(w.Target,{children:(0,B.jsx)(v,{size:`compact-xs`,variant:`subtle`,children:`Start from a template`})}),(0,B.jsx)(w.Dropdown,{children:_e.map(e=>(0,B.jsxs)(w.Item,{onClick:()=>m({expression:e.expression}),children:[e.label,(0,B.jsx)(_,{size:`xs`,c:`dimmed`,ff:`monospace`,children:e.expression})]},e.label))})]})]}),(0,B.jsx)(I,{"aria-label":`Expression`,required:!0,autosize:!0,minRows:2,ff:`monospace`,value:i.expression,onChange:e=>m({expression:e.currentTarget.value}),description:`A CEL condition over one service's rollup, for example error_rate > 0.05 && throughput > 10. error_rate is 0 to 1; p95 is in milliseconds.`}),j&&(0,B.jsx)(_,{size:`xs`,c:`warn`,role:`status`,children:j})]}),(0,B.jsxs)(o,{grow:!0,align:`flex-start`,children:[M(`Hold for (s)`,`for_seconds`,`Condition must hold this long, from the first check that sees it`),M(`Cooldown (s)`,`cooldown_s`,`Quiet period after resolving`),M(`Repeat every (s)`,`repeat_interval_s`,`0 delivers once`)]}),(0,B.jsxs)(u,{gap:4,children:[(0,B.jsx)(S,{label:`Email recipients`,placeholder:`oncall@example.com, team@example.com`,disabled:!g.data?.available&&!C,value:y,error:T,description:g.data?.available?`Separate addresses with commas, up to ${g.data.max_recipients}.${g.data.default_destination?` Leave this and the webhook empty to use the default destination.`:``}`:void 0,onChange:e=>{let t=e.currentTarget.value,n=Ce(t);x(t),m({email_recipients:n.length>0?n:void 0})}}),g.data&&!g.data.available&&(0,B.jsx)(_,{size:`xs`,c:`warn`,role:`status`,children:g.data.message}),g.isError&&(0,B.jsx)(_,{size:`xs`,c:`warn`,role:`status`,children:`Email availability could not be checked.`})]}),(0,B.jsx)(S,{label:`Webhook URL`,value:i.webhook_url??``,onChange:e=>m({webhook_url:e.currentTarget.value})}),(0,B.jsx)(I,{label:`Webhook headers`,description:`A JSON object, for example {"Authorization": "Bearer …"}`,autosize:!0,minRows:1,ff:`monospace`,value:i.webhook_headers??``,error:h,onChange:e=>m({webhook_headers:e.currentTarget.value})}),(0,B.jsx)(I,{label:`Webhook body template`,description:`Go text/template; leave empty for the default payload.`,autosize:!0,minRows:1,ff:`monospace`,value:i.webhook_template??``,onChange:e=>m({webhook_template:e.currentTarget.value})}),(0,B.jsxs)(o,{children:[(0,B.jsx)(N,{label:`Notify when resolved`,checked:i.notify_on_resolve,onChange:e=>m({notify_on_resolve:e.currentTarget.checked})}),(0,B.jsx)(N,{label:`Enabled`,checked:i.enabled,onChange:e=>m({enabled:e.currentTarget.checked})})]}),f&&(0,B.jsx)(d,{children:(0,B.jsx)(b,{tone:`danger`,title:`Not saved`,children:f})}),(0,B.jsxs)(o,{justify:`flex-end`,gap:`xs`,children:[(0,B.jsx)(v,{variant:`default`,disabled:s,onClick:l.request,children:`Cancel`}),(0,B.jsx)(v,{loading:s,disabled:!E,onClick:()=>void P(),children:e?`Save rule`:`Create rule`})]})]})]})}var De={firing:`danger`,pending:`warning`,resolved:`neutral`},$=e=>e?k(e):`—`,Oe={error_rate:`spans | error_rate()`,p95:`spans | p95(duration)`,throughput:`spans | count()`,log_count:`logs | count()`};function ke(e){let[t,n]=Oe[Z(e.expression).map(e=>e.replace(/_delta$/,``)).find(e=>e in Oe)??`throughput`].split(` | `);return e.service?`${t} where service:"${e.service.replaceAll(`"`,`""`)}" | ${n} every auto`:`${t} | ${n} by service every auto`}var Ae=`Open in Explore charts raw telemetry, so values can differ slightly from a rule's rollups. Explore shows error rate as a percent: a rule's 0.05 is 5 there.`,je={failed:{tone:`danger`,label:`Email failed`},unavailable:{tone:`danger`,label:`Email unavailable`},suppressed:{tone:`warning`,label:`Email suppressed`},retrying:{tone:`warning`,label:`Email retrying`}};function Me({onExplore:e}){let t=re(),n=ne().role!==`viewer`,i=L({queryKey:H,queryFn:({signal:e})=>K(e),refetchInterval:3e4}),a=L({queryKey:U,queryFn:({signal:e})=>le(e),refetchInterval:3e4}),[s,c]=(0,z.useState)(),[d,p]=(0,z.useState)(),[g,S]=(0,z.useState)(),C=ae(),T=(0,z.useRef)(null),D=(0,z.useRef)(new Map),k=e=>C.remember(D.current.get(e.id)??null),A=()=>{c(void 0),C.restore(T.current)},j=()=>{p(void 0),C.restore(T.current)},M=()=>{t.invalidateQueries({queryKey:H}),t.invalidateQueries({queryKey:U})},P=R({mutationFn:e=>de(e.id,{...Ne(e),enabled:!e.enabled}),onSuccess:M}),F=R({mutationFn:e=>J(e.id),onSuccess:()=>{I.current++,j(),M()}}),ee=async e=>{s?.rule?await de(s.rule.id,e):await ue(e),A(),M()},I=(0,z.useRef)(0),ie=()=>{I.current++,S(void 0),C.restore(T.current)},ce=e=>{let t=++I.current;S({rule:e});let n=n=>{I.current===t&&S({rule:e,...n})};Y(e.id).then(e=>n({result:e}),e=>n({error:e instanceof Error?e.message:`The test failed`}))},V=new Map((i.data??[]).map(e=>[e.id,e])),W=e=>(a.data??[]).filter(t=>t.rule_id===e.id&&t.fired_at).map(e=>e.fired_at).sort().at(-1),G=e=>(a.data??[]).filter(t=>t.rule_id===e.id&&(t.state===`firing`||t.state===`pending`)),q=[...a.data??[]].sort((e,t)=>(t.fired_at??t.created_at).localeCompare(e.fired_at??e.created_at));return(0,B.jsxs)(u,{gap:`lg`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,maw:1600,mx:`auto`,"data-alerts":!0,children:[(0,B.jsx)(h,{title:`Alerts`,description:`Evaluate service rules and deliver notifications when they fire.`,meta:(0,B.jsx)(te,{updatedAt:a.dataUpdatedAt}),actions:n&&(0,B.jsx)(v,{ref:T,leftSection:(0,B.jsx)(oe,{size:14}),onClick:e=>{C.remember(e.currentTarget),c({})},children:`New rule`})}),(0,B.jsxs)(u,{gap:`xs`,children:[(0,B.jsx)(l,{order:2,fz:18,children:`Rules`}),i.data&&i.data.length>0&&(0,B.jsx)(_,{size:`xs`,c:`dimmed`,children:Ae}),i.isLoading?(0,B.jsx)(f,{state:`loading`,loadingLabel:`Loading alert rules`,skeleton:(0,B.jsx)(se,{shape:`table`,columns:7,rows:4})}):i.error?(0,B.jsx)(f,{state:`error`,error:{message:`Rules could not be loaded: ${i.error.message}`,onRetry:()=>void i.refetch()}}):i.data?.length===0?(0,B.jsx)(f,{state:`empty`,empty:{title:`No rules yet`,description:n?`Create a rule to get notified when a service misbehaves.`:`An operator or admin can create rules.`,action:n&&(0,B.jsx)(v,{onClick:e=>{C.remember(e.currentTarget),c({})},children:`New rule`})}}):(0,B.jsx)(O.ScrollContainer,{minWidth:760,children:(0,B.jsxs)(O,{verticalSpacing:`sm`,children:[(0,B.jsx)(O.Thead,{children:(0,B.jsxs)(O.Tr,{children:[(0,B.jsx)(O.Th,{children:`Rule`}),(0,B.jsx)(O.Th,{children:`Service`}),(0,B.jsx)(O.Th,{children:`Expression`}),(0,B.jsx)(O.Th,{children:`State`}),(0,B.jsx)(O.Th,{children:`Last fired`}),(0,B.jsx)(O.Th,{children:`Enabled`}),(0,B.jsx)(O.Th,{w:48,children:(0,B.jsx)(_,{size:`xs`,c:`dimmed`,children:`Actions`})})]})}),(0,B.jsx)(O.Tbody,{children:i.data?.map(t=>{let r=G(t);return(0,B.jsxs)(O.Tr,{children:[(0,B.jsxs)(O.Td,{children:[(0,B.jsx)(_,{size:`sm`,fw:500,children:t.name}),t.description&&(0,B.jsx)(_,{size:`xs`,c:`dimmed`,children:t.description}),t.email_status&&je[t.email_status]&&(0,B.jsxs)(o,{gap:6,mt:4,role:`status`,children:[(0,B.jsx)(m,{tone:je[t.email_status].tone,children:je[t.email_status].label}),t.email_status_detail&&(0,B.jsx)(_,{size:`xs`,c:`dimmed`,children:t.email_status_detail})]})]}),(0,B.jsx)(O.Td,{children:(0,B.jsx)(_,{size:`sm`,children:t.service||`All services`})}),(0,B.jsxs)(O.Td,{children:[(0,B.jsx)(_,{size:`xs`,ff:`monospace`,children:t.expression}),(0,B.jsx)(v,{size:`compact-xs`,variant:`subtle`,px:0,onClick:()=>e(ke(t)),children:`Open in Explore`})]}),(0,B.jsx)(O.Td,{children:t.enabled?a.isSuccess?r.length>0?(0,B.jsx)(o,{gap:4,children:r.map(e=>(0,B.jsxs)(m,{tone:De[e.state]??`neutral`,children:[e.state.charAt(0).toUpperCase()+e.state.slice(1),` · `,e.service]},e.id))}):(0,B.jsx)(m,{tone:`success`,children:`Ok`}):(0,B.jsx)(m,{tone:`neutral`,children:`Unknown`}):(0,B.jsx)(m,{tone:`neutral`,children:`Disabled`})}),(0,B.jsx)(O.Td,{children:(0,B.jsx)(_,{size:`sm`,ff:`monospace`,children:a.isSuccess?$(W(t)):`—`})}),(0,B.jsx)(O.Td,{children:(0,B.jsx)(N,{"aria-label":`Enable ${t.name}`,checked:t.enabled,disabled:!n||P.isPending,onChange:()=>P.mutate(t)})}),(0,B.jsx)(O.Td,{children:n&&(0,B.jsxs)(w,{position:`bottom-end`,children:[(0,B.jsx)(w.Target,{children:(0,B.jsx)(y,{ref:e=>{e?D.current.set(t.id,e):D.current.delete(t.id)},variant:`subtle`,color:`gray`,"aria-label":`${t.name} actions`,children:(0,B.jsx)(E,{size:18})})}),(0,B.jsxs)(w.Dropdown,{children:[(0,B.jsx)(w.Item,{onClick:()=>{k(t),c({rule:t})},children:`Edit`}),(0,B.jsx)(w.Item,{onClick:()=>{k(t),ce(t)},children:`Test against current data`}),(0,B.jsx)(w.Item,{color:`bad`,onClick:()=>{k(t),p(t)},children:`Delete`})]})]})})]},t.id)})})]})}),P.error&&(0,B.jsx)(b,{tone:`danger`,children:P.error.message})]}),(0,B.jsxs)(u,{gap:`xs`,children:[(0,B.jsx)(l,{order:2,fz:18,children:`History`}),a.isLoading?(0,B.jsx)(f,{state:`loading`,loadingLabel:`Loading alert history`,skeleton:(0,B.jsx)(se,{shape:`table`,columns:7,rows:4})}):a.error?(0,B.jsxs)(b,{tone:`danger`,children:[`Alert history could not be loaded: `,a.error.message]}):q.length===0?(0,B.jsx)(f,{state:`empty`,empty:{title:`Nothing has fired yet`,description:`Alerts appear here when a rule fires.`}}):(0,B.jsx)(O.ScrollContainer,{minWidth:760,scrollAreaProps:{viewportProps:{tabIndex:0,role:`region`,"aria-label":`Alert history`}},children:(0,B.jsxs)(O,{verticalSpacing:`xs`,children:[(0,B.jsx)(O.Thead,{children:(0,B.jsxs)(O.Tr,{children:[(0,B.jsx)(O.Th,{children:`State`}),(0,B.jsx)(O.Th,{children:`Rule`}),(0,B.jsx)(O.Th,{children:`Service`}),(0,B.jsx)(O.Th,{ta:`right`,children:`Value`}),(0,B.jsx)(O.Th,{children:`Fired`}),(0,B.jsx)(O.Th,{children:`Resolved`}),(0,B.jsx)(O.Th,{children:`Delivery`})]})}),(0,B.jsx)(O.Tbody,{children:q.map(e=>(0,B.jsxs)(O.Tr,{children:[(0,B.jsx)(O.Td,{children:(0,B.jsx)(m,{tone:De[e.state]??`neutral`,children:e.state.charAt(0).toUpperCase()+e.state.slice(1)})}),(0,B.jsx)(O.Td,{children:(0,B.jsx)(_,{size:`sm`,children:V.get(e.rule_id)?.name??e.rule_id})}),(0,B.jsx)(O.Td,{children:(0,B.jsx)(_,{size:`sm`,children:e.service})}),(0,B.jsx)(O.Td,{ta:`right`,children:(0,B.jsx)(_,{size:`sm`,ff:`monospace`,children:e.value===void 0?`—`:he(Z(V.get(e.rule_id)?.expression??``)[0],e.value)})}),(0,B.jsx)(O.Td,{children:(0,B.jsx)(_,{size:`sm`,ff:`monospace`,children:$(e.fired_at)})}),(0,B.jsx)(O.Td,{children:(0,B.jsx)(_,{size:`sm`,ff:`monospace`,children:$(e.resolved_at)})}),(0,B.jsx)(O.Td,{children:(0,B.jsx)(_,{size:`xs`,c:`dimmed`,children:e.last_delivery_status?`${e.last_delivery_status} · ${$(e.last_delivery_at)}`:`—`})})]},e.id))})]})})]}),s&&(0,B.jsx)(Ee,{rule:s.rule,onClose:A,onSave:ee}),d&&(0,B.jsxs)(x,{opened:!0,onClose:j,title:`Delete ${d.name}?`,confirmLabel:`Delete rule`,tone:`danger`,pending:F.isPending?`confirm`:null,error:F.error?.message,onConfirm:()=>F.mutate(d),children:[`The rule `,(0,B.jsx)(_,{span:!0,ff:`monospace`,children:d.name}),` and its alert history are removed. This cannot be undone.`]}),g&&(0,B.jsx)(r,{opened:!0,onClose:ie,closeButtonProps:{"aria-label":`Close test`},title:`Test · ${g.rule.name}`,children:g.error?(0,B.jsx)(b,{tone:`danger`,children:g.error}):g.result?g.result.results?.length?(0,B.jsx)(u,{gap:`xs`,children:g.result.results.map(e=>(0,B.jsxs)(u,{gap:2,children:[(0,B.jsxs)(o,{justify:`space-between`,children:[(0,B.jsx)(_,{size:`sm`,children:e.service}),e.error?(0,B.jsx)(_,{size:`xs`,c:`bad`,children:e.error}):e.no_data?(0,B.jsx)(m,{tone:`warning`,children:`No recent data`}):(0,B.jsx)(m,{tone:e.triggered?`danger`:`success`,children:e.triggered?`Would fire`:`Quiet`})]}),e.no_data?(0,B.jsx)(_,{size:`xs`,c:`dimmed`,children:`This service has sent no telemetry recently. Check its name.`}):(0,B.jsx)(_,{size:`xs`,c:`dimmed`,ff:`monospace`,children:Z(g.rule.expression).filter(t=>typeof e.env?.[t]==`number`).map(t=>`${t} ${he(t,e.env[t])}`).join(` · `)})]},e.service))}):(0,B.jsx)(f,{state:`empty`,empty:{title:`No services have data in the current window.`}}):(0,B.jsx)(f,{state:`loading`,loadingLabel:`Testing the rule`,rows:3})})]})}function Ne(e){let{id:t,created_at:n,updated_at:r,email_status:i,email_status_detail:a,email_status_at:o,...s}=e;return s}function Pe(){let e=C();return(0,B.jsx)(Me,{onExplore:t=>void e({to:`/explore`,search:ie({q:t,range:`1h`,tab:`query`})})})}export{Pe as component}; \ No newline at end of file +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{D as r,Dt as i,Ft as a,G as o,N as s,Pt as c,S as l,T as u,Tt as d,a as f,en as p,f as m,g as h,in as g,j as _,k as v,q as y,s as b,u as x,w as S}from"./brand-D6fP-cLS.js";import{n as C}from"./useNavigate-B1zgPEUp.js";import{A as w,E as T,k as E}from"./search-D_K9J6yO.js";import{t as D}from"./NumberInput-CixyOph4.js";import{t as O}from"./Table-D4ZwUno3.js";import{n as k}from"./format-BZjbsxwM.js";import{c as A,i as j,l as M,n as N,o as P,r as F,s as ee,t as te}from"./live-data-meta-CUyw2snU.js";import{r as ne}from"./auth-DWqIkMZS.js";import{t as I}from"./Textarea-r3wuKNbO.js";import{T as re,t as L}from"./useQuery-BLTYSIvG.js";import{t as R}from"./useMutation-B1CTivyp.js";import{i as ie}from"./search-CDra9nG2.js";import{_ as ae,k as oe}from"./index-C1Pd14SU.js";import{t as se}from"./loading-skeleton-D1hXpfUI.js";import{t as ce}from"./discard-NZfxCIcK.js";var z=n(e(),1),B=t(),V=i(e=>{let t=a([`Input`,`InputWrapper`,`Autocomplete`],{size:`sm`},e),{classNames:n,styles:r,unstyled:i,vars:o,dropdownOpened:l,defaultDropdownOpened:u,onDropdownClose:d,onDropdownOpen:f,onFocus:m,onBlur:h,onClick:_,onChange:v,data:y,value:b,defaultValue:x,selectFirstOptionOnChange:S,selectFirstOptionOnDropdownOpen:C,onOptionSubmit:w,comboboxProps:T,readOnly:E,disabled:D,filter:O,limit:k,withScrollArea:N,maxDropdownHeight:te,floatingHeight:ne,size:I,id:re,renderOption:L,autoComplete:R,scrollAreaProps:ie,onClear:ae,clearButtonProps:oe,error:se,clearable:ce,clearSectionMode:V,rightSection:H,autoSelectOnBlur:U,openOnFocus:W=!0,attributes:G,...K}=t,le=g(re),q=F({id:le,label:K.label,labelProps:K.labelProps,inputWrapperOrder:K.inputWrapperOrder}),ue=M(y),de=A(ue),[J,fe]=p({value:b,defaultValue:x,finalValue:``,onChange:v}),Y=ee({opened:l,defaultOpened:u,onDropdownOpen:()=>{f?.(),C&&Y.selectFirstOption()},onDropdownClose:()=>{d?.(),setTimeout(Y.resetSelectedOption,0)}}),X=e=>{fe(e),Y.resetSelectedOption()},{resolvedClassNames:Z,resolvedStyles:pe}=c({props:t,styles:r,classNames:n});(0,z.useEffect)(()=>{S&&Y.selectFirstOption()},[S,J]);let me=(0,B.jsx)(P.ClearButton,{...oe,onClear:()=>{X(``),ae?.()}});return(0,B.jsxs)(P,{store:Y,__staticSelector:`Autocomplete`,classNames:Z,styles:pe,unstyled:i,readOnly:E,size:I,attributes:G,floatingHeight:ne,keepMounted:U,onOptionSubmit:e=>{w?.(e),X(de[e].label),Y.closeDropdown()},...T,children:[(0,B.jsx)(P.Target,{autoComplete:R,withExpandedAttribute:!0,children:(0,B.jsx)(s,{...K,size:I,__staticSelector:`Autocomplete`,__clearSection:me,__clearable:ce&&!!J&&!D&&!E,__clearSectionMode:V,rightSection:H,disabled:D,readOnly:E,value:J,error:se,onChange:e=>{X(e.currentTarget.value),Y.openDropdown(),S&&Y.selectFirstOption()},onFocus:e=>{W&&Y.openDropdown(),m?.(e)},onBlur:e=>{U&&Y.clickSelectedOption(),Y.closeDropdown(),h?.(e)},onClick:e=>{Y.openDropdown(),_?.(e)},classNames:Z,styles:pe,unstyled:i,attributes:G,id:le})}),(0,B.jsx)(j,{data:ue,hidden:E||D,filter:O,search:J,limit:k,hiddenWhenEmpty:!0,withScrollArea:N,maxDropdownHeight:te,unstyled:i,labelId:q,"aria-label":q?void 0:K[`aria-label`],renderOption:L,scrollAreaProps:ie})]})});V.classes={...s.classes,...P.classes},V.displayName=`@mantine/core/Autocomplete`;var H=[`alerting`,`rules`],U=[`alerting`,`alerts`],W=[`alerting`,`email`],G=e=>`/api/alerting/rules/${encodeURIComponent(e)}`,K=e=>T(`/api/alerting/rules`,{signal:e}).then(e=>e.rules),le=e=>T(`/api/alerting/alerts`,{signal:e}).then(e=>e.alerts),q=e=>T(`/api/alerting/email`,{signal:e}),ue=e=>T(`/api/alerting/rules`,{method:`POST`,json:e}),de=(e,t)=>T(G(e),{method:`PUT`,json:t}),J=e=>T(G(e),{method:`DELETE`}),fe=e=>T(`/api/telemetry/schema?window=1h`,{signal:e}).then(e=>(e.services??[]).map(e=>e.value)),Y=e=>T(`${G(e)}/test`,{method:`POST`}),X=/\b(error_rate|p50|p95|throughput|log_count|z_score|health_score)(_delta)?\b/g;function Z(e){let t=e.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,`""`);return[...new Set(Array.from(t.matchAll(X),e=>e[0]))]}var pe=new Intl.NumberFormat(`en-US`,{style:`percent`,maximumFractionDigits:2}),me=new Intl.NumberFormat(`en-US`,{maximumFractionDigits:0}),Q=new Intl.NumberFormat(`en-US`,{maximumFractionDigits:2});function he(e,t){return e===`error_rate`?pe.format(t):e===`p50`||e===`p95`?`${Q.format(t)} ms`:e===`throughput`||e===`log_count`?me.format(t):e?.endsWith(`_delta`)?`${t>0?`+`:``}${Q.format(t)}%`:Q.format(t)}function ge(e){let t=e.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,`""`),n=/\berror_rate\s*[<>=!]=?\s*(\d+(?:\.\d+)?)/.exec(t)??/(\d+(?:\.\d+)?)\s*[<>=!]=?\s*error_rate\b/.exec(t),r=n?Number(n[1]):0;return r>1?`error_rate runs from 0 to 1, so ${n[1]} can never be reached. For ${n[1]}%, write ${Q.format(r/100)}.`:void 0}var _e=[{label:`Error rate`,expression:`error_rate > 0.05 && throughput > 10`},{label:`p95 latency`,expression:`p95 > 500 && throughput > 10`},{label:`Traffic drop`,expression:`throughput_delta < -50`},{label:`Log volume`,expression:`log_count > 1000`}],ve={name:``,description:``,enabled:!0,service:``,expression:``,for_seconds:60,cooldown_s:300,repeat_interval_s:3600,webhook_url:``,webhook_headers:``,webhook_template:``,notify_on_resolve:!1};function ye(e){if(!e)return ve;let{id:t,created_at:n,updated_at:r,email_status:i,email_status_detail:a,email_status_at:o,...s}=e;return{...ve,...s}}var be=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,xe=e=>[...e].some(e=>{let t=e.charCodeAt(0);return t<32&&t!==9||t===127});function Se(e){if(!e?.trim())return;let t;try{t=JSON.parse(e)}catch{return`Enter a JSON object`}if(typeof t!=`object`||!t||Array.isArray(t))return`Enter a JSON object`;for(let[e,n]of Object.entries(t).sort(([e],[t])=>et))){if(!be.test(e))return`"${e}" is not a valid header name`;if(typeof n!=`string`)return`Header ${e} must be a string`;if(xe(n))return`Header ${e} has a line break or control character`}}var Ce=e=>e.split(/[,\s]+/).filter(Boolean),we=/^[^\s@,<>]+@[^\s@,<>]+$/;function Te(e,t){let n=e.find(e=>!we.test(e));return n?`"${n}" is not an email address`:new Set(e.map(e=>e.toLowerCase())).size>t?`Enter at most ${t} addresses`:void 0}function Ee({rule:e,onClose:t,onSave:n}){let[i,a]=(0,z.useState)(()=>ye(e)),[s,c]=(0,z.useState)(!1),l=ce(JSON.stringify(i)!==JSON.stringify(ye(e)),t,e?`this rule`:`the new rule`),[f,p]=(0,z.useState)(),m=e=>{a(t=>({...t,...e})),p(void 0)},h=i.webhook_headers===e?.webhook_headers?void 0:Se(i.webhook_headers),g=L({queryKey:W,queryFn:({signal:e})=>q(e),staleTime:6e4,retry:!1}),[y,x]=(0,z.useState)(()=>(e?.email_recipients??[]).join(`, `)),C=(e?.email_recipients?.length??0)>0,T=JSON.stringify(i.email_recipients??[])===JSON.stringify(e?.email_recipients??[])?void 0:Te(i.email_recipients??[],g.data?.max_recipients??10),E=i.name.trim()!==``&&i.expression.trim()!==``&&!h&&!T,O=L({queryKey:[`alerting`,`services`],queryFn:({signal:e})=>fe(e),staleTime:6e4,retry:!1}),k=i.service?.trim()??``,A=k!==``&&O.data!==void 0&&!O.data.includes(k),j=ge(i.expression),M=(e,t,n)=>(0,B.jsx)(D,{label:e,description:n,min:0,step:30,value:i[t],onChange:e=>m({[t]:typeof e==`number`?e:0})}),P=async()=>{c(!0);try{await n({...i,name:i.name.trim(),expression:i.expression.trim()})}catch(e){p(e instanceof Error?e.message:`The rule could not be saved`)}finally{c(!1)}};return(0,B.jsxs)(r,{opened:!0,onClose:()=>{s||l.request()},closeOnEscape:!1,onKeyDown:s?void 0:l.onKeyDown,title:e?`Edit rule · ${e.name}`:`New alert rule`,size:`lg`,children:[l.prompt,(0,B.jsxs)(u,{gap:`sm`,children:[(0,B.jsx)(S,{label:`Name`,required:!0,value:i.name,onChange:e=>m({name:e.currentTarget.value}),"data-autofocus":!0}),(0,B.jsx)(S,{label:`Description`,value:i.description??``,onChange:e=>m({description:e.currentTarget.value})}),(0,B.jsx)(V,{label:`Service`,description:`Leave empty to evaluate every service.`,data:O.data??[],value:i.service??``,onChange:e=>m({service:e})}),A&&(0,B.jsxs)(_,{size:`xs`,c:`warn`,mt:-8,role:`status`,children:[`No telemetry from `,k,` in the last hour. Check the name; the rule still saves.`]}),(0,B.jsxs)(u,{gap:4,children:[(0,B.jsxs)(o,{justify:`space-between`,align:`flex-end`,children:[(0,B.jsx)(_,{size:`sm`,fw:500,children:`Expression`}),(0,B.jsxs)(w,{position:`bottom-end`,children:[(0,B.jsx)(w.Target,{children:(0,B.jsx)(v,{size:`compact-xs`,variant:`subtle`,children:`Start from a template`})}),(0,B.jsx)(w.Dropdown,{children:_e.map(e=>(0,B.jsxs)(w.Item,{onClick:()=>m({expression:e.expression}),children:[e.label,(0,B.jsx)(_,{size:`xs`,c:`dimmed`,ff:`monospace`,children:e.expression})]},e.label))})]})]}),(0,B.jsx)(I,{"aria-label":`Expression`,required:!0,autosize:!0,minRows:2,ff:`monospace`,value:i.expression,onChange:e=>m({expression:e.currentTarget.value}),description:`A CEL condition over one service's rollup, for example error_rate > 0.05 && throughput > 10. error_rate is 0 to 1; p95 is in milliseconds.`}),j&&(0,B.jsx)(_,{size:`xs`,c:`warn`,role:`status`,children:j})]}),(0,B.jsxs)(o,{grow:!0,align:`flex-start`,children:[M(`Hold for (s)`,`for_seconds`,`Condition must hold this long, from the first check that sees it`),M(`Cooldown (s)`,`cooldown_s`,`Quiet period after resolving`),M(`Repeat every (s)`,`repeat_interval_s`,`0 delivers once`)]}),(0,B.jsxs)(u,{gap:4,children:[(0,B.jsx)(S,{label:`Email recipients`,placeholder:`oncall@example.com, team@example.com`,disabled:!g.data?.available&&!C,value:y,error:T,description:g.data?.available?`Separate addresses with commas, up to ${g.data.max_recipients}.${g.data.default_destination?` Leave this and the webhook empty to use the default destination.`:``}`:void 0,onChange:e=>{let t=e.currentTarget.value,n=Ce(t);x(t),m({email_recipients:n.length>0?n:void 0})}}),g.data&&!g.data.available&&(0,B.jsx)(_,{size:`xs`,c:`warn`,role:`status`,children:g.data.message}),g.isError&&(0,B.jsx)(_,{size:`xs`,c:`warn`,role:`status`,children:`Email availability could not be checked.`})]}),(0,B.jsx)(S,{label:`Webhook URL`,value:i.webhook_url??``,onChange:e=>m({webhook_url:e.currentTarget.value})}),(0,B.jsx)(I,{label:`Webhook headers`,description:`A JSON object, for example {"Authorization": "Bearer …"}`,autosize:!0,minRows:1,ff:`monospace`,value:i.webhook_headers??``,error:h,onChange:e=>m({webhook_headers:e.currentTarget.value})}),(0,B.jsx)(I,{label:`Webhook body template`,description:`Go text/template; leave empty for the default payload.`,autosize:!0,minRows:1,ff:`monospace`,value:i.webhook_template??``,onChange:e=>m({webhook_template:e.currentTarget.value})}),(0,B.jsxs)(o,{children:[(0,B.jsx)(N,{label:`Notify when resolved`,checked:i.notify_on_resolve,onChange:e=>m({notify_on_resolve:e.currentTarget.checked})}),(0,B.jsx)(N,{label:`Enabled`,checked:i.enabled,onChange:e=>m({enabled:e.currentTarget.checked})})]}),f&&(0,B.jsx)(d,{children:(0,B.jsx)(b,{tone:`danger`,title:`Not saved`,children:f})}),(0,B.jsxs)(o,{justify:`flex-end`,gap:`xs`,children:[(0,B.jsx)(v,{variant:`default`,disabled:s,onClick:l.request,children:`Cancel`}),(0,B.jsx)(v,{loading:s,disabled:!E,onClick:()=>void P(),children:e?`Save rule`:`Create rule`})]})]})]})}var De={firing:`danger`,pending:`warning`,resolved:`neutral`},$=e=>e?k(e):`—`,Oe={error_rate:`spans | error_rate()`,p95:`spans | p95(duration)`,throughput:`spans | count()`,log_count:`logs | count()`};function ke(e){let[t,n]=Oe[Z(e.expression).map(e=>e.replace(/_delta$/,``)).find(e=>e in Oe)??`throughput`].split(` | `);return e.service?`${t} where service:"${e.service.replaceAll(`"`,`""`)}" | ${n} every auto`:`${t} | ${n} by service every auto`}var Ae=`Open in Explore charts raw telemetry, so values can differ slightly from a rule's rollups. Explore shows error rate as a percent: a rule's 0.05 is 5 there.`,je={failed:{tone:`danger`,label:`Email failed`},unavailable:{tone:`danger`,label:`Email unavailable`},suppressed:{tone:`warning`,label:`Email suppressed`},retrying:{tone:`warning`,label:`Email retrying`}};function Me({onExplore:e}){let t=re(),n=ne().role!==`viewer`,i=L({queryKey:H,queryFn:({signal:e})=>K(e),refetchInterval:3e4}),a=L({queryKey:U,queryFn:({signal:e})=>le(e),refetchInterval:3e4}),[s,c]=(0,z.useState)(),[d,p]=(0,z.useState)(),[g,S]=(0,z.useState)(),C=ae(),T=(0,z.useRef)(null),D=(0,z.useRef)(new Map),k=e=>C.remember(D.current.get(e.id)??null),A=()=>{c(void 0),C.restore(T.current)},j=()=>{p(void 0),C.restore(T.current)},M=()=>{t.invalidateQueries({queryKey:H}),t.invalidateQueries({queryKey:U})},P=R({mutationFn:e=>de(e.id,{...Ne(e),enabled:!e.enabled}),onSuccess:M}),F=R({mutationFn:e=>J(e.id),onSuccess:()=>{I.current++,j(),M()}}),ee=async e=>{s?.rule?await de(s.rule.id,e):await ue(e),A(),M()},I=(0,z.useRef)(0),ie=()=>{I.current++,S(void 0),C.restore(T.current)},ce=e=>{let t=++I.current;S({rule:e});let n=n=>{I.current===t&&S({rule:e,...n})};Y(e.id).then(e=>n({result:e}),e=>n({error:e instanceof Error?e.message:`The test failed`}))},V=new Map((i.data??[]).map(e=>[e.id,e])),W=e=>(a.data??[]).filter(t=>t.rule_id===e.id&&t.fired_at).map(e=>e.fired_at).sort().at(-1),G=e=>(a.data??[]).filter(t=>t.rule_id===e.id&&(t.state===`firing`||t.state===`pending`)),q=[...a.data??[]].sort((e,t)=>(t.fired_at??t.created_at).localeCompare(e.fired_at??e.created_at));return(0,B.jsxs)(u,{gap:`lg`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,maw:1600,mx:`auto`,"data-alerts":!0,children:[(0,B.jsx)(h,{title:`Alerts`,description:`Evaluate service rules and deliver notifications when they fire.`,meta:(0,B.jsx)(te,{updatedAt:a.dataUpdatedAt}),actions:n&&(0,B.jsx)(v,{ref:T,leftSection:(0,B.jsx)(oe,{size:14}),onClick:e=>{C.remember(e.currentTarget),c({})},children:`New rule`})}),(0,B.jsxs)(u,{gap:`xs`,children:[(0,B.jsx)(l,{order:2,fz:18,children:`Rules`}),i.data&&i.data.length>0&&(0,B.jsx)(_,{size:`xs`,c:`dimmed`,children:Ae}),i.isLoading?(0,B.jsx)(f,{state:`loading`,loadingLabel:`Loading alert rules`,skeleton:(0,B.jsx)(se,{shape:`table`,columns:7,rows:4})}):i.error?(0,B.jsx)(f,{state:`error`,error:{message:`Rules could not be loaded: ${i.error.message}`,onRetry:()=>void i.refetch()}}):i.data?.length===0?(0,B.jsx)(f,{state:`empty`,empty:{title:`No rules yet`,description:n?`Create a rule to get notified when a service misbehaves.`:`An operator or admin can create rules.`,action:n&&(0,B.jsx)(v,{onClick:e=>{C.remember(e.currentTarget),c({})},children:`New rule`})}}):(0,B.jsx)(O.ScrollContainer,{minWidth:760,children:(0,B.jsxs)(O,{verticalSpacing:`sm`,children:[(0,B.jsx)(O.Thead,{children:(0,B.jsxs)(O.Tr,{children:[(0,B.jsx)(O.Th,{children:`Rule`}),(0,B.jsx)(O.Th,{children:`Service`}),(0,B.jsx)(O.Th,{children:`Expression`}),(0,B.jsx)(O.Th,{children:`State`}),(0,B.jsx)(O.Th,{children:`Last fired`}),(0,B.jsx)(O.Th,{children:`Enabled`}),(0,B.jsx)(O.Th,{w:48,children:(0,B.jsx)(_,{size:`xs`,c:`dimmed`,children:`Actions`})})]})}),(0,B.jsx)(O.Tbody,{children:i.data?.map(t=>{let r=G(t);return(0,B.jsxs)(O.Tr,{children:[(0,B.jsxs)(O.Td,{children:[(0,B.jsx)(_,{size:`sm`,fw:500,children:t.name}),t.description&&(0,B.jsx)(_,{size:`xs`,c:`dimmed`,children:t.description}),t.email_status&&je[t.email_status]&&(0,B.jsxs)(o,{gap:6,mt:4,role:`status`,children:[(0,B.jsx)(m,{tone:je[t.email_status].tone,children:je[t.email_status].label}),t.email_status_detail&&(0,B.jsx)(_,{size:`xs`,c:`dimmed`,children:t.email_status_detail})]})]}),(0,B.jsx)(O.Td,{children:(0,B.jsx)(_,{size:`sm`,children:t.service||`All services`})}),(0,B.jsxs)(O.Td,{children:[(0,B.jsx)(_,{size:`xs`,ff:`monospace`,children:t.expression}),(0,B.jsx)(v,{size:`compact-xs`,variant:`subtle`,px:0,onClick:()=>e(ke(t)),children:`Open in Explore`})]}),(0,B.jsx)(O.Td,{children:t.enabled?a.isSuccess?r.length>0?(0,B.jsx)(o,{gap:4,children:r.map(e=>(0,B.jsxs)(m,{tone:De[e.state]??`neutral`,children:[e.state.charAt(0).toUpperCase()+e.state.slice(1),` · `,e.service]},e.id))}):(0,B.jsx)(m,{tone:`success`,children:`Ok`}):(0,B.jsx)(m,{tone:`neutral`,children:`Unknown`}):(0,B.jsx)(m,{tone:`neutral`,children:`Disabled`})}),(0,B.jsx)(O.Td,{children:(0,B.jsx)(_,{size:`sm`,ff:`monospace`,children:a.isSuccess?$(W(t)):`—`})}),(0,B.jsx)(O.Td,{children:(0,B.jsx)(N,{"aria-label":`Enable ${t.name}`,checked:t.enabled,disabled:!n||P.isPending,onChange:()=>P.mutate(t)})}),(0,B.jsx)(O.Td,{children:n&&(0,B.jsxs)(w,{position:`bottom-end`,children:[(0,B.jsx)(w.Target,{children:(0,B.jsx)(y,{ref:e=>{e?D.current.set(t.id,e):D.current.delete(t.id)},variant:`subtle`,color:`gray`,"aria-label":`${t.name} actions`,children:(0,B.jsx)(E,{size:18})})}),(0,B.jsxs)(w.Dropdown,{children:[(0,B.jsx)(w.Item,{onClick:()=>{k(t),c({rule:t})},children:`Edit`}),(0,B.jsx)(w.Item,{onClick:()=>{k(t),ce(t)},children:`Test against current data`}),(0,B.jsx)(w.Item,{color:`bad`,onClick:()=>{k(t),p(t)},children:`Delete`})]})]})})]},t.id)})})]})}),P.error&&(0,B.jsx)(b,{tone:`danger`,children:P.error.message})]}),(0,B.jsxs)(u,{gap:`xs`,children:[(0,B.jsx)(l,{order:2,fz:18,children:`History`}),a.isLoading?(0,B.jsx)(f,{state:`loading`,loadingLabel:`Loading alert history`,skeleton:(0,B.jsx)(se,{shape:`table`,columns:7,rows:4})}):a.error?(0,B.jsxs)(b,{tone:`danger`,children:[`Alert history could not be loaded: `,a.error.message]}):q.length===0?(0,B.jsx)(f,{state:`empty`,empty:{title:`Nothing has fired yet`,description:`Alerts appear here when a rule fires.`}}):(0,B.jsx)(O.ScrollContainer,{minWidth:760,scrollAreaProps:{viewportProps:{tabIndex:0,role:`region`,"aria-label":`Alert history`}},children:(0,B.jsxs)(O,{verticalSpacing:`xs`,children:[(0,B.jsx)(O.Thead,{children:(0,B.jsxs)(O.Tr,{children:[(0,B.jsx)(O.Th,{children:`State`}),(0,B.jsx)(O.Th,{children:`Rule`}),(0,B.jsx)(O.Th,{children:`Service`}),(0,B.jsx)(O.Th,{ta:`right`,children:`Value`}),(0,B.jsx)(O.Th,{children:`Fired`}),(0,B.jsx)(O.Th,{children:`Resolved`}),(0,B.jsx)(O.Th,{children:`Delivery`})]})}),(0,B.jsx)(O.Tbody,{children:q.map(e=>(0,B.jsxs)(O.Tr,{children:[(0,B.jsx)(O.Td,{children:(0,B.jsx)(m,{tone:De[e.state]??`neutral`,children:e.state.charAt(0).toUpperCase()+e.state.slice(1)})}),(0,B.jsx)(O.Td,{children:(0,B.jsx)(_,{size:`sm`,children:V.get(e.rule_id)?.name??e.rule_id})}),(0,B.jsx)(O.Td,{children:(0,B.jsx)(_,{size:`sm`,children:e.service})}),(0,B.jsx)(O.Td,{ta:`right`,children:(0,B.jsx)(_,{size:`sm`,ff:`monospace`,children:e.value===void 0?`—`:he(Z(V.get(e.rule_id)?.expression??``)[0],e.value)})}),(0,B.jsx)(O.Td,{children:(0,B.jsx)(_,{size:`sm`,ff:`monospace`,children:$(e.fired_at)})}),(0,B.jsx)(O.Td,{children:(0,B.jsx)(_,{size:`sm`,ff:`monospace`,children:$(e.resolved_at)})}),(0,B.jsx)(O.Td,{children:(0,B.jsx)(_,{size:`xs`,c:`dimmed`,children:e.last_delivery_status?`${e.last_delivery_status} · ${$(e.last_delivery_at)}`:`—`})})]},e.id))})]})})]}),s&&(0,B.jsx)(Ee,{rule:s.rule,onClose:A,onSave:ee}),d&&(0,B.jsxs)(x,{opened:!0,onClose:j,title:`Delete ${d.name}?`,confirmLabel:`Delete rule`,tone:`danger`,pending:F.isPending?`confirm`:null,error:F.error?.message,onConfirm:()=>F.mutate(d),children:[`The rule `,(0,B.jsx)(_,{span:!0,ff:`monospace`,children:d.name}),` and its alert history are removed. This cannot be undone.`]}),g&&(0,B.jsx)(r,{opened:!0,onClose:ie,closeButtonProps:{"aria-label":`Close test`},title:`Test · ${g.rule.name}`,children:g.error?(0,B.jsx)(b,{tone:`danger`,children:g.error}):g.result?g.result.results?.length?(0,B.jsx)(u,{gap:`xs`,children:g.result.results.map(e=>(0,B.jsxs)(u,{gap:2,children:[(0,B.jsxs)(o,{justify:`space-between`,children:[(0,B.jsx)(_,{size:`sm`,children:e.service}),e.error?(0,B.jsx)(_,{size:`xs`,c:`bad`,children:e.error}):e.no_data?(0,B.jsx)(m,{tone:`warning`,children:`No recent data`}):(0,B.jsx)(m,{tone:e.triggered?`danger`:`success`,children:e.triggered?`Would fire`:`Quiet`})]}),e.no_data?(0,B.jsx)(_,{size:`xs`,c:`dimmed`,children:`This service has sent no telemetry recently. Check its name.`}):(0,B.jsx)(_,{size:`xs`,c:`dimmed`,ff:`monospace`,children:Z(g.rule.expression).filter(t=>typeof e.env?.[t]==`number`).map(t=>`${t} ${he(t,e.env[t])}`).join(` · `)})]},e.service))}):(0,B.jsx)(f,{state:`empty`,empty:{title:`No services have data in the current window.`}}):(0,B.jsx)(f,{state:`loading`,loadingLabel:`Testing the rule`,rows:3})})]})}function Ne(e){let{id:t,created_at:n,updated_at:r,email_status:i,email_status_detail:a,email_status_at:o,...s}=e;return s}function Pe(){let e=C();return(0,B.jsx)(Me,{onExplore:t=>void e({to:`/explore`,search:ie({q:t,range:`1h`,tab:`query`})})})}export{Pe as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/auth-DWqIkMZS.js b/internal/ui/dist/assets/auth-DWqIkMZS.js new file mode 100644 index 000000000..800f93c15 --- /dev/null +++ b/internal/ui/dist/assets/auth-DWqIkMZS.js @@ -0,0 +1 @@ +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{Dt as r,Et as i,Ft as a,G as o,Nt as s,T as c,Tt as l,Xt as u,Zt as d,a as f,g as p,i as ee,j as m,k as h,m as g,n as _,o as te,qt as v,r as ne,s as y,w as b,x}from"./brand-D6fP-cLS.js";import{n as re}from"./useNavigate-B1zgPEUp.js";var S={root:`m_849cf0da`},C=t(),w={underline:`hover`},T=i(e=>{let{underline:t,className:n,unstyled:r,mod:i,...o}=a(`Anchor`,w,e);return(0,C.jsx)(m,{component:`a`,className:u({[S.root]:!r},n),...o,mod:[{underline:t},i],__staticSelector:`Anchor`,unstyled:r})});T.classes=S,T.displayName=`@mantine/core/Anchor`;var E={root:`m_b183c0a2`},D=d((e,{color:t})=>({root:{"--code-bg":t?v(t,e):void 0}})),O=r(e=>{let t=a(`Code`,null,e),{classNames:n,className:r,style:i,styles:o,unstyled:c,vars:u,color:d,block:f,mod:p,attributes:ee,...m}=t,h=s({name:`Code`,props:t,classes:E,className:r,style:i,classNames:n,styles:o,unstyled:c,attributes:ee,vars:u,varsResolver:D});return(0,C.jsx)(l,{component:f?`pre`:`code`,mod:[{block:f},p],...h(`root`),...m,dir:`ltr`})});O.classes=E,O.varsResolver=D,O.displayName=`@mantine/core/Code`;var k=n(e(),1),A=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,128l-72,72V56Z`,opacity:`0.2`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),ie=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z`,opacity:`0.2`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),j=k.forwardRef((e,t)=>k.createElement(x,{ref:t,...e,weights:A}));j.displayName=`ArrowRightIcon`;var ae=j,M=k.forwardRef((e,t)=>k.createElement(x,{ref:t,...e,weights:ie}));M.displayName=`UserPlusIcon`;var oe=M,N=class extends Error{status;problems;code;constructor(e,t,n=[],r=``){super(e),this.status=t,this.problems=n,this.code=r}},P=`pitot:unauthorized`,F=`/settings/ingest`;function I(){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!==F?``:`${t.pathname}${t.search}`}function se(){return I()||(window.location.pathname===F?F:``)}function ce(e){return!e||typeof e!=`object`||!(`id`in e)||typeof e.id!=`string`||e.id===``?`none`:`user`}function L(){window.dispatchEvent(new Event(P))}async function R(e,t={}){let n=new Headers(t.headers);n.set(`Pitot-Request`,`1`);let r=await fetch(e,{...t,headers:n,credentials:`same-origin`});if(r.status===401&&L(),r.status===403){let e=await r.clone().json().catch(()=>({}));throw new N(e.message??`You do not have permission to perform this action.`,r.status,[],e.code??``)}return r}async function z(){let e=await R(`/api/auth/logout`,{method:`POST`});if(!e.ok&&e.status!==401)throw Error(`Sign-out failed — your session is still active.`);e.status!==401&&L(),window.location.assign(`/`)}var B={home:`https://pitot.dev/docs`,ingest:`https://pitot.dev/docs/get-started/send-telemetry`,connect:`https://pitot.dev/docs/guides/mcp`,authentication:`https://pitot.dev/docs/concepts/authentication`},V=(0,k.createContext)(null);function H(){let e=(0,k.useContext)(V);if(!e)throw Error(`Pitot runtime status is unavailable`);return e}var le=(0,k.createContext)(null);function ue(){let e=(0,k.useContext)(le);if(!e)throw Error(`Pitot viewer is unavailable`);return e}function de(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 U(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 fe(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`setup_token`)??``}function pe(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`login_token`)??``}function W({children:e}){let t=re(),[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(!1),[s,l]=(0,k.useState)(`none`),[u,d]=(0,k.useState)(null),[v,x]=(0,k.useState)(!1),[S,w]=(0,k.useState)(``),[E,D]=(0,k.useState)(``),[A,ie]=(0,k.useState)(fe),[j,M]=(0,k.useState)(pe),[N,F]=(0,k.useState)(``),[L,R]=(0,k.useState)(!1),[z,H]=(0,k.useState)(0),[ue,W]=(0,k.useState)(()=>Date.now()),[me,G]=(0,k.useState)(null),[K,q]=(0,k.useState)(!1),[J,Y]=(0,k.useState)(``),[X,he]=(0,k.useState)(null),[ge,_e]=(0,k.useState)(!1),ve=(0,k.useRef)(null),Z=I(),Q=s===`user`;async function ye(){let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok){l(`none`),d(null);return}let t=await e.json().catch(()=>null);l(ce(t)),d(de(t))}async function $(){try{let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok)return;d(de(await e.json().catch(()=>null)))}catch{}}(0,k.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,k.useEffect)(()=>{U(`/api/auth/status`).then(r).catch(e=>Y(String(e))).finally(()=>a(!0)),ye().catch(()=>l(`none`)).finally(()=>x(!0));let e=()=>{l(`none`),d(null)};return window.addEventListener(P,e),()=>window.removeEventListener(P,e)},[]),(0,k.useEffect)(()=>{v&&s===`none`&&j&&(q(!0),Y(``),U(`/api/auth/link/verify`,{token:j}).then(()=>{l(`user`),$()}).catch(e=>Y(e instanceof Error?e.message:String(e))).finally(()=>{M(``),q(!1)}))},[j,v,s]),(0,k.useEffect)(()=>{Q&&v&&Z&&window.location.replace(Z)},[Q,Z,v]),(0,k.useEffect)(()=>{if(z<=Date.now())return;let e=setInterval(()=>{W(Date.now()),Date.now()>=z&&clearInterval(e)},1e3);return()=>clearInterval(e)},[z]);let be=Math.max(0,Math.ceil((z-ue)/1e3));async function xe(e){try{await navigator.clipboard.writeText(e),_e(!0)}catch{Y(`Clipboard access failed. Select and copy the token manually.`)}}if(X?.ingest_token)return(0,C.jsx)(g,{surface:`plain`,brand:(0,C.jsx)(_,{}),footer:(0,C.jsx)(T,{href:B.home,size:`xs`,target:`_blank`,rel:`noopener noreferrer`,children:`Docs`}),size:`lg`,children:(0,C.jsxs)(c,{gap:`lg`,children:[(0,C.jsx)(p,{eyebrow:`Setup complete`,title:`Save your ingest token`}),(0,C.jsx)(m,{c:`dimmed`,children:`Pitot shows this token once. Store it with your collector secrets before continuing.`}),(0,C.jsxs)(c,{gap:`xs`,children:[(0,C.jsx)(m,{size:`sm`,fw:600,children:`OTLP endpoint`}),(0,C.jsx)(O,{block:!0,children:X.suggested_endpoint??window.location.origin})]}),(0,C.jsxs)(c,{gap:`xs`,children:[(0,C.jsx)(m,{size:`sm`,fw:600,children:`Header`}),(0,C.jsxs)(O,{block:!0,children:[X.ingest_header_name??`Authorization`,`: Bearer `,X.ingest_token]})]}),J&&(0,C.jsx)(y,{tone:`danger`,children:J}),(0,C.jsxs)(o,{grow:!0,align:`stretch`,children:[(0,C.jsx)(h,{variant:`light`,radius:`md`,leftSection:ge?(0,C.jsx)(ee,{size:16,weight:`bold`}):(0,C.jsx)(ne,{size:16}),onClick:()=>void xe(`${X.ingest_header_name??`Authorization`}: Bearer ${X.ingest_token}`),children:ge?`Copied`:`Copy header`}),(0,C.jsx)(h,{radius:`md`,rightSection:(0,C.jsx)(ae,{size:16,weight:`bold`}),onClick:()=>{l(`user`),he(null),$()},children:`Continue to Pitot`})]}),(0,C.jsx)(h,{variant:`subtle`,size:`compact-xs`,onClick:()=>void xe(X.ingest_token??``),children:`Copy token only`})]})});if(!v||!i||j)return(0,C.jsx)(g,{surface:`plain`,brand:(0,C.jsx)(_,{}),footer:(0,C.jsx)(T,{href:B.home,size:`xs`,target:`_blank`,rel:`noopener noreferrer`,children:`Docs`}),children:(0,C.jsx)(f,{state:`loading`,loadingLabel:`Loading sign-in`,rows:4})});if(!n)return(0,C.jsx)(g,{surface:`plain`,brand:(0,C.jsx)(_,{}),footer:(0,C.jsx)(T,{href:B.home,size:`xs`,target:`_blank`,rel:`noopener noreferrer`,children:`Docs`}),children:(0,C.jsxs)(c,{gap:`lg`,children:[(0,C.jsx)(p,{title:`Pitot is unavailable`}),(0,C.jsx)(y,{tone:`danger`,children:J||`Authentication status could not be loaded.`})]})});if(Q&&Z)return null;if(Q)return(0,C.jsx)(V.Provider,{value:n,children:(0,C.jsx)(le.Provider,{value:u??{id:``,email:S,display_name:E,status:`active`,role:``},children:e})});if(n&&!n.setup_required&&n.auth_mode===`oidc`){let e=se(),t=e?`/api/auth/oidc/start?return_to=${encodeURIComponent(e)}`:`/api/auth/oidc/start`;return(0,C.jsx)(g,{surface:`plain`,brand:(0,C.jsx)(_,{}),footer:(0,C.jsx)(T,{href:B.home,size:`xs`,target:`_blank`,rel:`noopener noreferrer`,children:`Docs`}),children:(0,C.jsxs)(c,{gap:28,children:[(0,C.jsx)(p,{title:`Sign in to Pitot`,description:`Use your organization’s identity provider to continue.`}),J&&(0,C.jsx)(y,{tone:`danger`,children:J}),(0,C.jsx)(h,{component:`a`,href:t,size:`md`,radius:`md`,rightSection:(0,C.jsx)(ae,{size:17,weight:`bold`}),children:`Continue with SSO`})]})})}async function Se(){if(!(K||!n?.smtp_configured||L&&be>0)){q(!0),G(L?`resend`:`send`),Y(``);try{await U(`/api/auth/code/send`,{email:S}),R(!0),F(``),H(Date.now()+3e4),W(Date.now())}catch(e){Y(e instanceof Error?e.message:String(e))}finally{q(!1),G(null)}}}async function Ce(e){if(!(K||e.length!==6)){q(!0),G(`verify`),Y(``);try{await U(`/api/auth/code/verify`,{email:S,code:e}),l(`user`),R(!1),F(``),H(0),$()}catch(e){F(``),Y(e instanceof Error?e.message:String(e))}finally{q(!1),G(null)}}}function we(){R(!1),F(``),H(0),Y(``)}async function Te(e){e.preventDefault(),q(!0),Y(``);try{let e=await U(`/api/auth/setup`,{email:S,display_name:E,setup_token:A});e.ingest_token?he(e):(l(`user`),$())}catch(e){Y(e instanceof Error?e.message:String(e))}finally{q(!1)}}return n.setup_required?(0,C.jsx)(g,{surface:`plain`,brand:(0,C.jsx)(_,{}),footer:(0,C.jsx)(T,{href:B.home,size:`xs`,target:`_blank`,rel:`noopener noreferrer`,children:`Docs`}),children:(0,C.jsxs)(c,{gap:28,children:[(0,C.jsx)(p,{eyebrow:`One-time setup`,title:`Create the first admin`,description:`Use the one-time token printed by the Pitot process.`}),(0,C.jsx)(`form`,{onSubmit:Te,children:(0,C.jsxs)(c,{gap:`md`,children:[(0,C.jsx)(b,{label:`Email`,placeholder:`you@company.com`,type:`email`,required:!0,value:S,onChange:e=>w(e.currentTarget.value),autoFocus:!0}),(0,C.jsx)(b,{label:`Display name`,placeholder:`Your display name`,value:E,onChange:e=>D(e.currentTarget.value)}),(0,C.jsx)(b,{label:`Setup token`,placeholder:`from the setup URL printed at startup`,required:!0,value:A,onChange:e=>ie(e.currentTarget.value),autoComplete:`one-time-code`}),J&&(0,C.jsx)(y,{tone:`danger`,children:J}),(0,C.jsx)(h,{type:`submit`,loading:K,leftSection:(0,C.jsx)(oe,{size:17,weight:`bold`}),children:`Create admin`})]})})]})}):(0,C.jsx)(g,{surface:`plain`,brand:(0,C.jsx)(_,{}),footer:(0,C.jsx)(T,{href:B.home,size:`xs`,target:`_blank`,rel:`noopener noreferrer`,children:`Docs`}),children:(0,C.jsx)(`fieldset`,{disabled:!n.smtp_configured,style:{border:0,padding:0,margin:0,minWidth:0},children:(0,C.jsx)(te,{step:L?`code`:`email`,title:`Sign in to Pitot`,description:n.smtp_configured?n.self_signup?`We'll email you a 6-digit code. New here? This creates your account.`:`We'll email you a 6-digit code.`:`Email delivery is not configured. Ask the operator to run pitot login-link with your email address.`,email:S,onEmailChange:w,inputRef:ve,onSendCode:()=>{ve.current?.reportValidity()&&Se()},code:N,onCodeChange:F,onVerify:e=>void Ce(e),onChangeEmail:we,onResend:()=>void Se(),resendIn:be,pending:me,error:J||void 0,stepLabels:!1,expiresInMinutes:5,codeNote:(0,C.jsx)(m,{size:`xs`,c:`dimmed`,children:`Codes expire in 5 minutes. Check your spam folder if the email hasn’t arrived.`}),labels:{continue:`Continue with email`,verify:`Verify code`,resend:`Resend code`,changeEmail:`Change email`,codeSent:()=>(0,C.jsxs)(C.Fragment,{children:[`Enter the code sent to `,(0,C.jsx)(m,{span:!0,inherit:!0,fw:700,children:S}),`.`]}),resendIn:e=>`Resend in ${e}`}})})})}export{R as a,O as c,B as i,T as l,H as n,z as o,ue as r,N as s,W as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/auth-K3NK-QpB.js b/internal/ui/dist/assets/auth-K3NK-QpB.js deleted file mode 100644 index 5e1158c21..000000000 --- a/internal/ui/dist/assets/auth-K3NK-QpB.js +++ /dev/null @@ -1 +0,0 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{Dt as r,Et as i,Ft as a,G as o,Nt as s,T as c,Tt as l,Xt as u,Zt as d,a as f,g as p,i as ee,j as m,k as h,m as g,n as _,o as te,qt as v,r as ne,s as y,w as b,x}from"./brand-CCQ0JT0F.js";import{n as re}from"./useNavigate-B1zgPEUp.js";var S={root:`m_849cf0da`},C=t(),w={underline:`hover`},T=i(e=>{let{underline:t,className:n,unstyled:r,mod:i,...o}=a(`Anchor`,w,e);return(0,C.jsx)(m,{component:`a`,className:u({[S.root]:!r},n),...o,mod:[{underline:t},i],__staticSelector:`Anchor`,unstyled:r})});T.classes=S,T.displayName=`@mantine/core/Anchor`;var E={root:`m_b183c0a2`},D=d((e,{color:t})=>({root:{"--code-bg":t?v(t,e):void 0}})),O=r(e=>{let t=a(`Code`,null,e),{classNames:n,className:r,style:i,styles:o,unstyled:c,vars:u,color:d,block:f,mod:p,attributes:ee,...m}=t,h=s({name:`Code`,props:t,classes:E,className:r,style:i,classNames:n,styles:o,unstyled:c,attributes:ee,vars:u,varsResolver:D});return(0,C.jsx)(l,{component:f?`pre`:`code`,mod:[{block:f},p],...h(`root`),...m,dir:`ltr`})});O.classes=E,O.varsResolver=D,O.displayName=`@mantine/core/Code`;var k=n(e(),1),A=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,128l-72,72V56Z`,opacity:`0.2`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),ie=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z`,opacity:`0.2`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),j=k.forwardRef((e,t)=>k.createElement(x,{ref:t,...e,weights:A}));j.displayName=`ArrowRightIcon`;var ae=j,M=k.forwardRef((e,t)=>k.createElement(x,{ref:t,...e,weights:ie}));M.displayName=`UserPlusIcon`;var oe=M,N=class extends Error{status;problems;code;constructor(e,t,n=[],r=``){super(e),this.status=t,this.problems=n,this.code=r}},P=`fanout:unauthorized`,F=`/settings/ingest`;function I(){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!==F?``:`${t.pathname}${t.search}`}function se(){return I()||(window.location.pathname===F?F:``)}function ce(e){return!e||typeof e!=`object`||!(`id`in e)||typeof e.id!=`string`||e.id===``?`none`:`user`}function L(){window.dispatchEvent(new Event(P))}async function R(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&&L(),r.status===403){let e=await r.clone().json().catch(()=>({}));throw new N(e.message??`You do not have permission to perform this action.`,r.status,[],e.code??``)}return r}async function z(){let e=await R(`/api/auth/logout`,{method:`POST`});if(!e.ok&&e.status!==401)throw Error(`Sign-out failed — your session is still active.`);e.status!==401&&L(),window.location.assign(`/`)}var B={home:`https://fanout.run/docs`,ingest:`https://fanout.run/docs/get-started/send-telemetry`,connect:`https://fanout.run/docs/guides/mcp`,authentication:`https://fanout.run/docs/concepts/authentication`},V=(0,k.createContext)(null);function H(){let e=(0,k.useContext)(V);if(!e)throw Error(`Fanout runtime status is unavailable`);return e}var le=(0,k.createContext)(null);function ue(){let e=(0,k.useContext)(le);if(!e)throw Error(`Fanout viewer is unavailable`);return e}function de(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 U(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 fe(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`setup_token`)??``}function pe(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`login_token`)??``}function W({children:e}){let t=re(),[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(!1),[s,l]=(0,k.useState)(`none`),[u,d]=(0,k.useState)(null),[v,x]=(0,k.useState)(!1),[S,w]=(0,k.useState)(``),[E,D]=(0,k.useState)(``),[A,ie]=(0,k.useState)(fe),[j,M]=(0,k.useState)(pe),[N,F]=(0,k.useState)(``),[L,R]=(0,k.useState)(!1),[z,H]=(0,k.useState)(0),[ue,W]=(0,k.useState)(()=>Date.now()),[me,G]=(0,k.useState)(null),[K,q]=(0,k.useState)(!1),[J,Y]=(0,k.useState)(``),[X,he]=(0,k.useState)(null),[ge,_e]=(0,k.useState)(!1),ve=(0,k.useRef)(null),Z=I(),Q=s===`user`;async function ye(){let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok){l(`none`),d(null);return}let t=await e.json().catch(()=>null);l(ce(t)),d(de(t))}async function $(){try{let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok)return;d(de(await e.json().catch(()=>null)))}catch{}}(0,k.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,k.useEffect)(()=>{U(`/api/auth/status`).then(r).catch(e=>Y(String(e))).finally(()=>a(!0)),ye().catch(()=>l(`none`)).finally(()=>x(!0));let e=()=>{l(`none`),d(null)};return window.addEventListener(P,e),()=>window.removeEventListener(P,e)},[]),(0,k.useEffect)(()=>{v&&s===`none`&&j&&(q(!0),Y(``),U(`/api/auth/link/verify`,{token:j}).then(()=>{l(`user`),$()}).catch(e=>Y(e instanceof Error?e.message:String(e))).finally(()=>{M(``),q(!1)}))},[j,v,s]),(0,k.useEffect)(()=>{Q&&v&&Z&&window.location.replace(Z)},[Q,Z,v]),(0,k.useEffect)(()=>{if(z<=Date.now())return;let e=setInterval(()=>{W(Date.now()),Date.now()>=z&&clearInterval(e)},1e3);return()=>clearInterval(e)},[z]);let be=Math.max(0,Math.ceil((z-ue)/1e3));async function xe(e){try{await navigator.clipboard.writeText(e),_e(!0)}catch{Y(`Clipboard access failed. Select and copy the token manually.`)}}if(X?.ingest_token)return(0,C.jsx)(g,{surface:`plain`,brand:(0,C.jsx)(_,{}),footer:(0,C.jsx)(T,{href:B.home,size:`xs`,target:`_blank`,rel:`noopener noreferrer`,children:`Docs`}),size:`lg`,children:(0,C.jsxs)(c,{gap:`lg`,children:[(0,C.jsx)(p,{eyebrow:`Setup complete`,title:`Save your ingest token`}),(0,C.jsx)(m,{c:`dimmed`,children:`Fanout shows this token once. Store it with your collector secrets before continuing.`}),(0,C.jsxs)(c,{gap:`xs`,children:[(0,C.jsx)(m,{size:`sm`,fw:600,children:`OTLP endpoint`}),(0,C.jsx)(O,{block:!0,children:X.suggested_endpoint??window.location.origin})]}),(0,C.jsxs)(c,{gap:`xs`,children:[(0,C.jsx)(m,{size:`sm`,fw:600,children:`Header`}),(0,C.jsxs)(O,{block:!0,children:[X.ingest_header_name??`Authorization`,`: Bearer `,X.ingest_token]})]}),J&&(0,C.jsx)(y,{tone:`danger`,children:J}),(0,C.jsxs)(o,{grow:!0,align:`stretch`,children:[(0,C.jsx)(h,{variant:`light`,radius:`md`,leftSection:ge?(0,C.jsx)(ee,{size:16,weight:`bold`}):(0,C.jsx)(ne,{size:16}),onClick:()=>void xe(`${X.ingest_header_name??`Authorization`}: Bearer ${X.ingest_token}`),children:ge?`Copied`:`Copy header`}),(0,C.jsx)(h,{radius:`md`,rightSection:(0,C.jsx)(ae,{size:16,weight:`bold`}),onClick:()=>{l(`user`),he(null),$()},children:`Continue to Fanout`})]}),(0,C.jsx)(h,{variant:`subtle`,size:`compact-xs`,onClick:()=>void xe(X.ingest_token??``),children:`Copy token only`})]})});if(!v||!i||j)return(0,C.jsx)(g,{surface:`plain`,brand:(0,C.jsx)(_,{}),footer:(0,C.jsx)(T,{href:B.home,size:`xs`,target:`_blank`,rel:`noopener noreferrer`,children:`Docs`}),children:(0,C.jsx)(f,{state:`loading`,loadingLabel:`Loading sign-in`,rows:4})});if(!n)return(0,C.jsx)(g,{surface:`plain`,brand:(0,C.jsx)(_,{}),footer:(0,C.jsx)(T,{href:B.home,size:`xs`,target:`_blank`,rel:`noopener noreferrer`,children:`Docs`}),children:(0,C.jsxs)(c,{gap:`lg`,children:[(0,C.jsx)(p,{title:`Fanout is unavailable`}),(0,C.jsx)(y,{tone:`danger`,children:J||`Authentication status could not be loaded.`})]})});if(Q&&Z)return null;if(Q)return(0,C.jsx)(V.Provider,{value:n,children:(0,C.jsx)(le.Provider,{value:u??{id:``,email:S,display_name:E,status:`active`,role:``},children:e})});if(n&&!n.setup_required&&n.auth_mode===`oidc`){let e=se(),t=e?`/api/auth/oidc/start?return_to=${encodeURIComponent(e)}`:`/api/auth/oidc/start`;return(0,C.jsx)(g,{surface:`plain`,brand:(0,C.jsx)(_,{}),footer:(0,C.jsx)(T,{href:B.home,size:`xs`,target:`_blank`,rel:`noopener noreferrer`,children:`Docs`}),children:(0,C.jsxs)(c,{gap:28,children:[(0,C.jsx)(p,{title:`Sign in to Fanout`,description:`Use your organization’s identity provider to continue.`}),J&&(0,C.jsx)(y,{tone:`danger`,children:J}),(0,C.jsx)(h,{component:`a`,href:t,size:`md`,radius:`md`,rightSection:(0,C.jsx)(ae,{size:17,weight:`bold`}),children:`Continue with SSO`})]})})}async function Se(){if(!(K||!n?.smtp_configured||L&&be>0)){q(!0),G(L?`resend`:`send`),Y(``);try{await U(`/api/auth/code/send`,{email:S}),R(!0),F(``),H(Date.now()+3e4),W(Date.now())}catch(e){Y(e instanceof Error?e.message:String(e))}finally{q(!1),G(null)}}}async function Ce(e){if(!(K||e.length!==6)){q(!0),G(`verify`),Y(``);try{await U(`/api/auth/code/verify`,{email:S,code:e}),l(`user`),R(!1),F(``),H(0),$()}catch(e){F(``),Y(e instanceof Error?e.message:String(e))}finally{q(!1),G(null)}}}function we(){R(!1),F(``),H(0),Y(``)}async function Te(e){e.preventDefault(),q(!0),Y(``);try{let e=await U(`/api/auth/setup`,{email:S,display_name:E,setup_token:A});e.ingest_token?he(e):(l(`user`),$())}catch(e){Y(e instanceof Error?e.message:String(e))}finally{q(!1)}}return n.setup_required?(0,C.jsx)(g,{surface:`plain`,brand:(0,C.jsx)(_,{}),footer:(0,C.jsx)(T,{href:B.home,size:`xs`,target:`_blank`,rel:`noopener noreferrer`,children:`Docs`}),children:(0,C.jsxs)(c,{gap:28,children:[(0,C.jsx)(p,{eyebrow:`One-time setup`,title:`Create the first admin`,description:`Use the one-time token printed by the Fanout process.`}),(0,C.jsx)(`form`,{onSubmit:Te,children:(0,C.jsxs)(c,{gap:`md`,children:[(0,C.jsx)(b,{label:`Email`,placeholder:`you@company.com`,type:`email`,required:!0,value:S,onChange:e=>w(e.currentTarget.value),autoFocus:!0}),(0,C.jsx)(b,{label:`Display name`,placeholder:`Your display name`,value:E,onChange:e=>D(e.currentTarget.value)}),(0,C.jsx)(b,{label:`Setup token`,placeholder:`from the setup URL printed at startup`,required:!0,value:A,onChange:e=>ie(e.currentTarget.value),autoComplete:`one-time-code`}),J&&(0,C.jsx)(y,{tone:`danger`,children:J}),(0,C.jsx)(h,{type:`submit`,loading:K,leftSection:(0,C.jsx)(oe,{size:17,weight:`bold`}),children:`Create admin`})]})})]})}):(0,C.jsx)(g,{surface:`plain`,brand:(0,C.jsx)(_,{}),footer:(0,C.jsx)(T,{href:B.home,size:`xs`,target:`_blank`,rel:`noopener noreferrer`,children:`Docs`}),children:(0,C.jsx)(`fieldset`,{disabled:!n.smtp_configured,style:{border:0,padding:0,margin:0,minWidth:0},children:(0,C.jsx)(te,{step:L?`code`:`email`,title:`Sign in to Fanout`,description:n.smtp_configured?n.self_signup?`We'll email you a 6-digit code. New here? This creates your account.`:`We'll email you a 6-digit code.`:`Email delivery is not configured. Ask the operator to run fanout login-link with your email address.`,email:S,onEmailChange:w,inputRef:ve,onSendCode:()=>{ve.current?.reportValidity()&&Se()},code:N,onCodeChange:F,onVerify:e=>void Ce(e),onChangeEmail:we,onResend:()=>void Se(),resendIn:be,pending:me,error:J||void 0,stepLabels:!1,expiresInMinutes:5,codeNote:(0,C.jsx)(m,{size:`xs`,c:`dimmed`,children:`Codes expire in 5 minutes. Check your spam folder if the email hasn’t arrived.`}),labels:{continue:`Continue with email`,verify:`Verify code`,resend:`Resend code`,changeEmail:`Change email`,codeSent:()=>(0,C.jsxs)(C.Fragment,{children:[`Enter the code sent to `,(0,C.jsx)(m,{span:!0,inherit:!0,fw:700,children:S}),`.`]}),resendIn:e=>`Resend in ${e}`}})})})}export{R as a,O as c,B as i,T as l,H as n,z as o,ue as r,N as s,W as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/brand-CCQ0JT0F.js b/internal/ui/dist/assets/brand-D6fP-cLS.js similarity index 98% rename from internal/ui/dist/assets/brand-CCQ0JT0F.js rename to internal/ui/dist/assets/brand-D6fP-cLS.js index d67004466..25337d991 100644 --- a/internal/ui/dist/assets/brand-CCQ0JT0F.js +++ b/internal/ui/dist/assets/brand-D6fP-cLS.js @@ -38,4 +38,4 @@ import{a as e,i as t,r as n,s as r}from"./useRouter-ByJ6_rwb.js";var i=e((e=>{va `},Cc=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},wc=function(){o.useEffect(function(){return document.body.setAttribute(xc,(Cc()+1).toString()),function(){var e=Cc()-1;e<=0?document.body.removeAttribute(xc):document.body.setAttribute(xc,e.toString())}},[])},Tc=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;wc();var a=o.useMemo(function(){return yc(i)},[i]);return o.createElement(bc,{styles:Sc(a,!t,i,n?``:`!important`)})},Ec=!1;if(typeof window<`u`)try{var Dc=Object.defineProperty({},"passive",{get:function(){return Ec=!0,!0}});window.addEventListener(`test`,Dc,Dc),window.removeEventListener(`test`,Dc,Dc)}catch{Ec=!1}var Oc=Ec?{passive:!1}:!1,kc=function(e){return e.tagName===`TEXTAREA`},Ac=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!kc(e)&&n[t]===`visible`)},jc=function(e){return Ac(e,`overflowY`)},Mc=function(e){return Ac(e,`overflowX`)},Nc=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Ic(e,r)){var i=Lc(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Pc=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Fc=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Ic=function(e,t){return e===`v`?jc(t):Mc(t)},Lc=function(e,t){return e===`v`?Pc(t):Fc(t)},Rc=function(e,t){return e===`h`&&t===`rtl`?-1:1},zc=function(e,t,n,r,i){var a=Rc(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Lc(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Ic(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Bc=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Vc=function(e){return[e.deltaX,e.deltaY]},Hc=function(e){return e&&`current`in e?e.current:e},Uc=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Wc=function(e){return` .block-interactivity-${e} {pointer-events: none;} .allow-interactivity-${e} {pointer-events: all;} -`},Gc=0,Kc=[];function qc(e){var t=o.useRef([]),n=o.useRef([0,0]),r=o.useRef(),i=o.useState(Gc++)[0],a=o.useState(hc)[0],s=o.useRef(e);o.useEffect(function(){s.current=e},[e]),o.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Us([e.lockRef.current],(e.shards||[]).map(Hc),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var c=o.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!s.current.allowPinchZoom;var i=Bc(e),a=n.current,o=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(o)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Nc(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Nc(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(o||c)&&(r.current=l),!l)return!0;var h=r.current||l;return zc(h,t,e,h===`h`?o:c,!0)},[]),l=o.useCallback(function(e){var n=e;if(Kc.length&&Kc[Kc.length-1]===a){var r=`deltaY`in n?Vc(n):Bc(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Uc(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var o=(s.current.shards||[]).map(Hc).filter(Boolean).filter(function(e){return e.contains(n.target)});(o.length>0?c(n,o[0]):!s.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=o.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Jc(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=o.useCallback(function(e){n.current=Bc(e),r.current=void 0},[]),f=o.useCallback(function(t){u(t.type,Vc(t),t.target,c(t,e.lockRef.current))},[]),p=o.useCallback(function(t){u(t.type,Bc(t),t.target,c(t,e.lockRef.current))},[]);o.useEffect(function(){return Kc.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,l,Oc),document.addEventListener(`touchmove`,l,Oc),document.addEventListener(`touchstart`,d,Oc),function(){Kc=Kc.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,l,Oc),document.removeEventListener(`touchmove`,l,Oc),document.removeEventListener(`touchstart`,d,Oc)}},[]);var m=e.removeScrollBar,h=e.inert;return o.createElement(o.Fragment,null,h?o.createElement(a,{styles:Wc(i)}):null,m?o.createElement(Tc,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Jc(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Yc=ac(oc,qc),Xc=o.forwardRef(function(e,t){return o.createElement(cc,Vs({},e,{ref:t,sideCar:Yc}))});Xc.classNames=cc.classNames;function Zc({keepMounted:e,keepMountedMode:t=`activity`,opened:n,onClose:r,id:i,transitionProps:a,onExitTransitionEnd:o,onEnterTransitionEnd:s,trapFocus:l,closeOnEscape:u,returnFocus:d,closeOnClickOutside:f,withinPortal:p,portalProps:m,lockScroll:h,children:g,zIndex:_,shadow:v,padding:y,__vars:b,unstyled:x,removeScrollProps:C,__handledEscapeEvents:T,...E}){let{_id:D,titleMounted:k,bodyMounted:A,shouldLockScroll:j,setTitleMounted:M,setBodyMounted:N}=Bs({id:i,transitionProps:a,opened:n,trapFocus:l,closeOnEscape:u,onClose:r,returnFocus:d,handledEscapeEvents:T}),{key:P,...ee}=C||{};return(0,c.jsx)(ns,{...m,withinPortal:p,children:(0,c.jsx)(Ls,{value:{opened:n,onClose:r,closeOnClickOutside:f,onExitTransitionEnd:o,onEnterTransitionEnd:s,transitionProps:{...a,keepMounted:e,keepMountedMode:t},getTitleId:()=>`${D}-title`,getBodyId:()=>`${D}-body`,titleMounted:k,bodyMounted:A,setTitleMounted:M,setBodyMounted:N,trapFocus:l,closeOnEscape:u,zIndex:_,unstyled:x},children:(0,c.jsx)(Xc,{enabled:j&&h,...ee,children:(0,c.jsx)(q,{...E,id:D,__vars:{...b,"--mb-z-index":(_||S(`modal`)).toString(),"--mb-shadow":O(v),"--mb-padding":w(y)},children:g})},P)})})}Zc.displayName=`@mantine/core/ModalBase`;function Qc(){let e=Rs();return(0,o.useEffect)(()=>(e.setBodyMounted(!0),()=>e.setBodyMounted(!1)),[]),e.getBodyId()}var $c={title:`m_615af6c9`,header:`m_b5489c3c`,inner:`m_60c222c7`,content:`m_fd1ab0aa`,close:`m_606cb269`,body:`m_5df29311`};function el({className:e,...t}){let n=Qc(),r=Rs();return(0,c.jsx)(q,{id:n,className:U({[$c.body]:!r.unstyled},e),...t})}el.displayName=`@mantine/core/ModalBaseBody`;function tl({className:e,onClick:t,...n}){let r=Rs();return(0,c.jsx)(js,{...n,onClick:e=>{r.onClose(),t?.(e)},className:U({[$c.close]:!r.unstyled},e),unstyled:r.unstyled})}tl.displayName=`@mantine/core/ModalBaseCloseButton`;function nl({transitionProps:e,className:t,innerProps:n,onKeyDown:r,style:i,ref:a,...o}){let s=Rs();return(0,c.jsx)(cs,{mounted:s.opened,transition:`pop`,...s.transitionProps,onExited:()=>{s.onExitTransitionEnd?.(),s.transitionProps?.onExited?.()},onEntered:()=>{s.onEnterTransitionEnd?.(),s.transitionProps?.onEntered?.()},...e,children:e=>(0,c.jsx)(`div`,{...n,className:U({[$c.inner]:!s.unstyled},n.className),children:(0,c.jsx)(ls,{active:s.opened&&s.trapFocus,innerRef:a,children:(0,c.jsx)(Ko,{...o,component:`section`,role:`dialog`,tabIndex:-1,"aria-modal":!0,"aria-describedby":s.bodyMounted?s.getBodyId():void 0,"aria-labelledby":s.titleMounted?s.getTitleId():void 0,style:[i,e],className:U({[$c.content]:!s.unstyled},t),unstyled:s.unstyled,children:o.children})})})})}nl.displayName=`@mantine/core/ModalBaseContent`;function rl({className:e,...t}){let n=Rs();return(0,c.jsx)(q,{component:`header`,className:U({[$c.header]:!n.unstyled},e),...t})}rl.displayName=`@mantine/core/ModalBaseHeader`;var il={duration:200,timingFunction:`ease`,transition:`fade`};function al(e){let t=Rs();return{...il,...t.transitionProps,...e}}function ol({onClick:e,transitionProps:t,style:n,visible:r,...i}){let a=Rs(),o=al(t);return(0,c.jsx)(cs,{mounted:r===void 0?a.opened:r,...o,transition:`fade`,children:t=>(0,c.jsx)(Xo,{fixed:!0,style:[n,t],zIndex:a.zIndex,unstyled:a.unstyled,onClick:t=>{e?.(t),a.closeOnClickOutside&&a.onClose()},...i})})}ol.displayName=`@mantine/core/ModalBaseOverlay`;function sl(){let e=Rs();return(0,o.useEffect)(()=>(e.setTitleMounted(!0),()=>e.setTitleMounted(!1)),[]),e.getTitleId()}function cl({className:e,...t}){let n=sl(),r=Rs();return(0,c.jsx)(q,{component:`h2`,className:U({[$c.title]:!r.unstyled},e),id:n,...t})}cl.displayName=`@mantine/core/ModalBaseTitle`;function ll({children:e}){return(0,c.jsx)(c.Fragment,{children:e})}var ul=(0,o.createContext)({size:`sm`}),dl=K(e=>{let t=W(`InputClearButton`,null,e),{size:n,variant:r,vars:i,classNames:a,styles:s,...l}=t,u=(0,o.use)(ul),{resolvedClassNames:d,resolvedStyles:f}=mt({classNames:a,styles:s,props:t});return(0,c.jsx)(js,{variant:r||`transparent`,size:n||u?.size||`sm`,classNames:d,styles:f,__staticSelector:`InputClearButton`,style:{pointerEvents:`all`,background:`var(--input-bg)`,...l.style},...l})});dl.displayName=`@mantine/core/InputClearButton`;var fl={xs:7,sm:8,md:10,lg:12,xl:15};function pl({__clearable:e,__clearSection:t,rightSection:n,__defaultRightSection:r,size:i=`sm`,__clearSectionMode:a=`both`}){let o=e&&t;return a===`rightSection`?n===null?null:n||r:a===`clear`?n===null?null:o||r:o&&(n||r)?(0,c.jsxs)(`div`,{"data-combined-clear-section":!0,style:{display:`flex`,gap:2,alignItems:`center`,paddingInlineEnd:fl[i]},children:[o,n||r]}):n===null?null:n||o||r}var ml=(0,o.createContext)({offsetBottom:!1,offsetTop:!1,describedBy:void 0,getStyles:null,inputId:void 0,labelId:void 0}),hl={wrapper:`m_6c018570`,input:`m_8fb7ebe7`,bottomSection:`m_93f4ed57`,section:`m_82577fc2`,placeholder:`m_88bacfd0`,root:`m_46b77525`,label:`m_8fdc1311`,required:`m_78a94662`,error:`m_8f816625`,success:`m_9d9d40e0`,description:`m_fe47ce59`},gl=H((e,{size:t})=>({description:{"--input-description-size":t===void 0?void 0:`calc(${E(t)} - ${h(2)})`}})),_l=K(e=>{let t=W(`InputDescription`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,vars:l,__staticSelector:u,__inheritStyles:d=!0,attributes:f,...p}=W(`InputDescription`,null,t),m=(0,o.use)(ml),h=G({name:[`InputWrapper`,u],props:t,classes:hl,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:f,rootSelector:`description`,vars:l,varsResolver:gl}),g=d&&m?.getStyles||h;return(0,c.jsx)(q,{component:`p`,...g(`description`,m?.getStyles?{className:r,style:i}:void 0),...p})});_l.classes=hl,_l.varsResolver=gl,_l.displayName=`@mantine/core/InputDescription`;var vl=H((e,{size:t})=>({error:{"--input-error-size":t===void 0?void 0:`calc(${E(t)} - ${h(2)})`}})),yl=K(e=>{let t=W(`InputError`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,vars:l,attributes:u,__staticSelector:d,__inheritStyles:f=!0,...p}=t,m=G({name:[`InputWrapper`,d],props:t,classes:hl,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:u,rootSelector:`error`,vars:l,varsResolver:vl}),h=(0,o.use)(ml),g=f&&h?.getStyles||m;return(0,c.jsx)(q,{component:`p`,...g(`error`,h?.getStyles?{className:r,style:i}:void 0),...p})});yl.classes=hl,yl.varsResolver=vl,yl.displayName=`@mantine/core/InputError`;var bl={labelElement:`label`},xl=H((e,{size:t})=>({label:{"--input-label-size":E(t),"--input-asterisk-color":void 0}})),Sl=K(e=>{let t=W(`InputLabel`,bl,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,vars:l,labelElement:u,required:d,htmlFor:f,onMouseDown:p,children:m,__staticSelector:h,mod:g,attributes:_,...v}=t,y=G({name:[`InputWrapper`,h],props:t,classes:hl,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:_,rootSelector:`label`,vars:l,varsResolver:xl}),b=(0,o.use)(ml),x=b?.getStyles||y,S=v.component||u,C=typeof S!=`string`||S===`label`;return(0,c.jsxs)(q,{...x(`label`,b?.getStyles?{className:r,style:i}:void 0),component:u,htmlFor:C?f:void 0,mod:[{required:d},g],onMouseDown:e=>{p?.(e),!e.defaultPrevented&&e.detail>1&&e.preventDefault()},...v,children:[m,d&&(0,c.jsx)(`span`,{...x(`required`),"aria-hidden":!0,children:` *`})]})});Sl.classes=hl,Sl.varsResolver=xl,Sl.displayName=`@mantine/core/InputLabel`;var Cl=K(e=>{let t=W(`InputPlaceholder`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,__staticSelector:l,error:u,mod:d,attributes:f,...p}=t,m=G({name:[`InputPlaceholder`,l],props:t,classes:hl,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:f,rootSelector:`placeholder`});return(0,c.jsx)(q,{...m(`placeholder`),mod:[{error:!!u},d],component:`span`,...p})});Cl.classes=hl,Cl.displayName=`@mantine/core/InputPlaceholder`;var wl=H((e,{size:t})=>({success:{"--input-success-size":t===void 0?void 0:`calc(${E(t)} - ${h(2)})`}})),Tl=K(e=>{let t=W(`InputSuccess`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,vars:l,attributes:u,__staticSelector:d,__inheritStyles:f=!0,...p}=t,m=G({name:[`InputWrapper`,d],props:t,classes:hl,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:u,rootSelector:`success`,vars:l,varsResolver:wl}),h=(0,o.use)(ml),g=f&&h?.getStyles||m;return(0,c.jsx)(q,{component:`p`,...g(`success`,h?.getStyles?{className:r,style:i}:void 0),...p})});Tl.classes=hl,Tl.varsResolver=wl,Tl.displayName=`@mantine/core/InputSuccess`;function El(e,{hasDescription:t,hasError:n}){let r=e.findIndex(e=>e===`input`),i=e.slice(0,r),a=e.slice(r+1),o=t&&i.includes(`description`)||n&&i.includes(`error`);return{offsetBottom:t&&a.includes(`description`)||n&&a.includes(`error`),offsetTop:o}}var Dl={labelElement:`label`,inputContainer:e=>e,inputWrapperOrder:[`label`,`description`,`input`,`error`]},Ol=H((e,{size:t})=>({label:{"--input-label-size":E(t),"--input-asterisk-color":void 0},error:{"--input-error-size":t===void 0?void 0:`calc(${E(t)} - ${h(2)})`},success:{"--input-success-size":t===void 0?void 0:`calc(${E(t)} - ${h(2)})`},description:{"--input-description-size":t===void 0?void 0:`calc(${E(t)} - ${h(2)})`}})),kl=K(e=>{let t=W(`InputWrapper`,Dl,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,vars:l,size:u,variant:d,__staticSelector:f,inputContainer:p,inputWrapperOrder:m,label:h,error:g,success:_,description:v,labelProps:y,descriptionProps:b,errorProps:x,successProps:S,labelElement:C,children:w,withAsterisk:T,id:E,required:D,__stylesApiProps:O,mod:k,attributes:A,...j}=t,M=G({name:[`InputWrapper`,f],props:O||t,classes:hl,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:A,vars:l,varsResolver:Ol}),N={size:u,variant:d,__staticSelector:f},P=ce(E),ee=typeof T==`boolean`?T:D,F=x?.id||`${P}-error`,te=S?.id||`${P}-success`,I=b?.id||`${P}-description`,L=P,R=!!g&&typeof g!=`boolean`,ne=!!_&&typeof _!=`boolean`&&!g,re=!!v,ie=R&&m.includes(`error`),ae=ne&&m.includes(`error`),oe=re&&m.includes(`description`),se=`${ie?F:``} ${ae?te:``} ${oe?I:``}`,z=se.trim().length>0?se.trim():void 0,le=y?.id||`${P}-label`,ue=h&&(0,c.jsx)(Sl,{labelElement:C,id:le,htmlFor:L,required:ee,...N,...y,children:h},`label`),de=re&&(0,c.jsx)(_l,{...b,...N,size:b?.size||N.size,id:b?.id||I,children:v},`description`),B=(0,c.jsx)(o.Fragment,{children:p(w)},`input`),fe=R&&(0,o.createElement)(yl,{...x,...N,size:x?.size||N.size,key:`error`,id:x?.id||F},g),pe=ne&&(0,o.createElement)(Tl,{...S,...N,size:S?.size||N.size,key:`success`,id:S?.id||te},_),me=m.map(e=>{switch(e){case`label`:return ue;case`input`:return B;case`description`:return de;case`error`:return fe||pe;default:return null}});return(0,c.jsx)(ml,{value:{getStyles:M,describedBy:z,inputId:L,labelId:ue&&m.includes(`label`)?le:void 0,...El(m,{hasDescription:re,hasError:R||ne})},children:(0,c.jsx)(q,{variant:d,size:u,mod:[{error:!!g,success:!!_&&!g},k],id:C===`label`?void 0:E,...M(`root`),...j,children:me})})});kl.classes=hl,kl.varsResolver=Ol,kl.displayName=`@mantine/core/InputWrapper`;var Al={variant:`default`,leftSectionPointerEvents:`none`,rightSectionPointerEvents:`none`,withAria:!0,withErrorStyles:!0,withSuccessStyles:!0,size:`sm`,loading:!1,loadingPosition:`right`},jl=H((e,t,n)=>({wrapper:{"--input-margin-top":n.offsetTop?`calc(var(--mantine-spacing-xs) / 2)`:void 0,"--input-margin-bottom":n.offsetBottom?`calc(var(--mantine-spacing-xs) / 2)`:void 0,"--input-height":C(t.size,`input-height`),"--input-fz":E(t.size),"--input-radius":t.radius===void 0?void 0:T(t.radius),"--input-left-section-width":t.leftSectionWidth===void 0?void 0:h(t.leftSectionWidth),"--input-right-section-width":t.rightSectionWidth===void 0?void 0:h(t.rightSectionWidth),"--input-padding-y":t.multiline?C(t.size,`input-padding-y`):void 0,"--input-left-section-pointer-events":t.leftSectionPointerEvents,"--input-right-section-pointer-events":t.rightSectionPointerEvents}})),X=fn(e=>{let t=W(`Input`,Al,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,required:l,__staticSelector:u,__stylesApiProps:d,size:f,wrapperProps:p,error:m,success:h,disabled:g,leftSection:_,leftSectionProps:v,leftSectionWidth:y,rightSection:b,rightSectionProps:x,rightSectionWidth:S,rightSectionPointerEvents:C,leftSectionPointerEvents:w,variant:T,vars:E,pointer:D,multiline:O,radius:k,id:A,withAria:j,withErrorStyles:M,withSuccessStyles:N,mod:P,inputSize:ee,attributes:F,__clearSection:te,__clearable:I,__clearSectionMode:L,__defaultRightSection:R,loading:ne,loadingPosition:re,__bottomSection:ie,__bottomSectionProps:ae,rootRef:oe,dir:se,...z}=t,{styleProps:ce,rest:le}=It(z),ue=(0,o.use)(ml),de={offsetBottom:ue?.offsetBottom,offsetTop:ue?.offsetTop},B=G({name:[`Input`,u],props:d||t,classes:hl,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:F,stylesCtx:de,rootSelector:`wrapper`,vars:E,varsResolver:jl}),fe=j?{required:l,disabled:g,"aria-invalid":m?!0:void 0,"aria-describedby":ue?.describedBy,id:ue?.inputId||A}:{},pe=ne?(0,c.jsx)(vs,{size:re===`left`?`calc(var(--input-left-section-size) / 2)`:`calc(var(--input-right-section-size) / 2)`}):null,me=ne&&re===`left`?pe:_,he=pl({__clearable:I,__clearSection:te,rightSection:ne&&re===`right`?pe:b,__defaultRightSection:R,size:f,__clearSectionMode:L});return(0,c.jsx)(ul,{value:{size:f||`sm`},children:(0,c.jsxs)(q,{ref:oe,dir:se,...B(`wrapper`),...ce,...p,mod:[{error:!!m&&M,success:!!h&&!m&&N,pointer:D,disabled:g,multiline:O,withRightSection:!!he,withLeftSection:!!me,withBottomSection:!!ie},P],variant:T,size:f,children:[me&&(0,c.jsx)(`div`,{...v,"data-position":`left`,...B(`section`,{className:v?.className,style:v?.style}),children:me}),(0,c.jsx)(q,{component:`input`,...le,...fe,required:l,mod:{disabled:g,error:!!m&&M,success:!!h&&!m&&N},variant:T,__size:ee,...B(`input`)}),ie&&(0,c.jsx)(`div`,{...ae,...B(`bottomSection`,{className:ae?.className,style:ae?.style}),children:ie}),he&&(0,c.jsx)(`div`,{...x,"data-position":`right`,...B(`section`,{className:x?.className,style:x?.style}),children:he})]})})});X.classes=hl,X.varsResolver=jl,X.Wrapper=kl,X.Label=Sl,X.Error=yl,X.Success=Tl,X.Description=_l,X.Placeholder=Cl,X.ClearButton=dl,X.displayName=`@mantine/core/Input`;function Ml(e,t,n){let r=W([`Input`,`InputWrapper`,e],t,n),{label:i,description:a,error:o,success:s,required:c,classNames:l,styles:u,className:d,unstyled:f,__staticSelector:p,__stylesApiProps:m,errorProps:h,successProps:g,labelProps:_,descriptionProps:v,wrapperProps:y,id:b,size:x,style:S,inputContainer:C,inputWrapperOrder:w,withAsterisk:T,variant:E,vars:D,mod:O,attributes:k,...A}=r,{styleProps:j,rest:M}=It(A),N={label:i,description:a,error:o,success:s,required:c,classNames:l,className:d,__staticSelector:p,__stylesApiProps:m||r,errorProps:h,successProps:g,labelProps:_,descriptionProps:v,unstyled:f,styles:u,size:x,style:S,inputContainer:C,inputWrapperOrder:w,withAsterisk:T,variant:E,id:b,mod:O,attributes:k,...y};return{...M,classNames:l,styles:u,unstyled:f,wrapperProps:{...N,...j},inputProps:{required:c,classNames:l,styles:u,unstyled:f,size:x,__staticSelector:p,__stylesApiProps:m||r,error:o,success:s,variant:E,id:b,attributes:k}}}var Nl={__staticSelector:`InputBase`,withAria:!0,size:`sm`},Pl=fn(e=>{let{inputProps:t,wrapperProps:n,...r}=Ml(`InputBase`,Nl,e);return(0,c.jsx)(X.Wrapper,{...n,children:(0,c.jsx)(X,{...t,...r})})});Pl.classes={...X.classes,...X.Wrapper.classes},Pl.displayName=`@mantine/core/InputBase`;var Fl={gap:{type:`spacing`,property:`gap`},rowGap:{type:`spacing`,property:`rowGap`},columnGap:{type:`spacing`,property:`columnGap`},align:{type:`identity`,property:`alignItems`},justify:{type:`identity`,property:`justifyContent`},wrap:{type:`identity`,property:`flexWrap`},direction:{type:`identity`,property:`flexDirection`}},Il={root:`m_8bffd616`},Ll=fn(e=>{let t=W(`Flex`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,gap:l,rowGap:u,columnGap:d,align:f,justify:p,wrap:m,direction:h,attributes:g,...v}=t,y=G({name:`Flex`,classes:Il,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:g,vars:s}),b=dt(),x=on(),S=an({styleProps:{gap:l,rowGap:u,columnGap:d,align:f,justify:p,wrap:m,direction:h},theme:b,data:Fl}),C=et(),w=C&&S.hasResponsiveStyles?Ft(S.styles,S.media):x;return(0,c.jsxs)(c.Fragment,{children:[S.hasResponsiveStyles&&(0,c.jsx)(Nt,{selector:`.${w}`,styles:S.styles,media:S.media,deduplicate:C}),(0,c.jsx)(q,{...y(`root`,{className:w,style:_(S.inlineStyles)}),...v})]})});Ll.classes=Il,Ll.displayName=`@mantine/core/Flex`;function Rl({style:e,size:t=16,...n}){return(0,c.jsx)(`svg`,{viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:{...e,width:h(t),height:h(t),display:`block`},...n,children:(0,c.jsx)(`path`,{d:`M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})}Rl.displayName=`@mantine/core/AccordionChevron`;var zl={root:`m_b6d8b162`};function Bl(e){if(e===`start`)return`start`;if(e===`end`||e)return`end`}var Vl={inherit:!1},Hl=H((e,{variant:t,lineClamp:n,gradient:r,size:i,textWrap:a})=>({root:{"--text-fz":E(i),"--text-lh":D(i),"--text-gradient":t===`gradient`?Be(r,e):void 0,"--text-line-clamp":typeof n==`number`?n.toString():void 0,"--text-text-wrap":a}})),Z=fn(e=>{let t=W(`Text`,Vl,e),{lineClamp:n,truncate:r,inline:i,inherit:a,gradient:o,span:s,textWrap:l,__staticSelector:u,vars:d,className:f,style:p,classNames:m,styles:h,unstyled:g,variant:_,mod:v,size:y,attributes:b,...x}=t,S=G({name:[`Text`,u],props:t,classes:zl,className:f,style:p,classNames:m,styles:h,unstyled:g,attributes:b,vars:d,varsResolver:Hl});return(0,c.jsx)(q,{...S(`root`,{focusable:!0}),component:s?`span`:`p`,variant:_,mod:[{truncate:Bl(r),lineClamp:typeof n==`number`,inline:i,inherit:a},v],size:y,...x})});Z.classes=zl,Z.varsResolver=Hl,Z.displayName=`@mantine/core/Text`;var Ul={root:`m_347db0ec`,"root--dot":`m_fbd81e3d`,label:`m_5add502a`,section:`m_91fdda9b`},Wl=H((e,{radius:t,color:n,gradient:r,variant:i,size:a,autoContrast:o,circle:s})=>{let c=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||`filled`,autoContrast:o});return{root:{"--badge-height":C(a,`badge-height`),"--badge-padding-x":C(a,`badge-padding-x`),"--badge-fz":C(a,`badge-fz`),"--badge-radius":s||t===void 0?void 0:T(t),"--badge-bg":n||i?c.background:void 0,"--badge-color":n||i?c.color:void 0,"--badge-bd":n||i?c.border:void 0,"--badge-dot-color":i===`dot`?Le(n,e):void 0}}}),Gl=fn(e=>{let t=W(`Badge`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,radius:l,color:u,gradient:d,leftSection:f,rightSection:p,children:m,variant:h,fullWidth:g,autoContrast:_,circle:v,mod:y,attributes:b,...x}=t,S=G({name:`Badge`,props:t,classes:Ul,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:b,vars:s,varsResolver:Wl});return(0,c.jsxs)(q,{variant:h,mod:[{block:g,circle:v,"with-right-section":!!p,"with-left-section":!!f},y],...S(`root`,{variant:h}),...x,children:[f&&(0,c.jsx)(`span`,{...S(`section`),"data-position":`left`,children:f}),(0,c.jsx)(`span`,{...S(`label`),children:m}),p&&(0,c.jsx)(`span`,{...S(`section`),"data-position":`right`,children:p})]})});Gl.classes=Ul,Gl.varsResolver=Wl,Gl.displayName=`@mantine/core/Badge`;var Kl={root:`m_77c9d27d`,inner:`m_80f1301b`,label:`m_811560b9`,section:`m_a74036a`,loader:`m_a25b86ee`,group:`m_80d6d844`,groupSection:`m_70be2a01`},ql={orientation:`horizontal`},Jl=H((e,{borderWidth:t})=>({group:{"--button-border-width":h(t)}})),Yl=K(e=>{let t=W(`ButtonGroup`,ql,e),{className:n,style:r,classNames:i,styles:a,unstyled:o,orientation:s,vars:l,borderWidth:u,mod:d,attributes:f,...p}=W(`ButtonGroup`,ql,e),m=G({name:`ButtonGroup`,props:t,classes:Kl,className:n,style:r,classNames:i,styles:a,unstyled:o,attributes:f,vars:l,varsResolver:Jl,rootSelector:`group`});return(0,c.jsx)(q,{...m(`group`),mod:[{orientation:s},d],role:`group`,...p})});Yl.classes=Kl,Yl.varsResolver=Jl,Yl.displayName=`@mantine/core/ButtonGroup`;var Xl=H((e,{radius:t,color:n,gradient:r,variant:i,autoContrast:a,size:o})=>{let s=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||`filled`,autoContrast:a});return{groupSection:{"--section-height":C(o,`section-height`),"--section-padding-x":C(o,`section-padding-x`),"--section-fz":o?.includes(`compact`)?E(o.replace(`compact-`,``)):E(o),"--section-radius":t===void 0?void 0:T(t),"--section-bg":n||i?s.background:void 0,"--section-color":s.color,"--section-bd":n||i?s.border:void 0}}}),Zl=K(e=>{let t=W(`ButtonGroupSection`,null,e),{className:n,style:r,classNames:i,styles:a,unstyled:o,vars:s,gradient:l,radius:u,autoContrast:d,attributes:f,...p}=t,m=G({name:`ButtonGroupSection`,props:t,classes:Kl,className:n,style:r,classNames:i,styles:a,unstyled:o,attributes:f,vars:s,varsResolver:Xl,rootSelector:`groupSection`});return(0,c.jsx)(q,{...m(`groupSection`),...p})});Zl.classes=Kl,Zl.varsResolver=Xl,Zl.displayName=`@mantine/core/ButtonGroupSection`;var Ql={in:{opacity:1,transform:`translate(-50%, calc(-50% + ${h(1)}))`},out:{opacity:0,transform:`translate(-50%, -200%)`},common:{transformOrigin:`center`},transitionProperty:`transform, opacity`},$l=H((e,{radius:t,color:n,gradient:r,variant:i,size:a,justify:o,autoContrast:s})=>{let c=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||`filled`,autoContrast:s});return{root:{"--button-justify":o,"--button-height":C(a,`button-height`),"--button-padding-x":C(a,`button-padding-x`),"--button-fz":a?.includes(`compact`)?E(a.replace(`compact-`,``)):E(a),"--button-radius":t===void 0?void 0:T(t),"--button-bg":n||i?c.background:void 0,"--button-hover":n||i?c.hover:void 0,"--button-color":c.color,"--button-bd":n||i?c.border:void 0,"--button-hover-color":n||i?c.hoverColor:void 0}}}),Q=fn(e=>{let t=W(`Button`,null,e),{style:n,vars:r,className:i,color:a,disabled:o,children:s,leftSection:l,rightSection:u,fullWidth:d,variant:f,radius:p,loading:m,loaderProps:h,gradient:g,classNames:_,styles:v,unstyled:y,"data-disabled":b,autoContrast:x,mod:S,attributes:C,...w}=t,T=G({name:`Button`,props:t,classes:Kl,className:i,style:n,classNames:_,styles:v,unstyled:y,attributes:C,vars:r,varsResolver:$l}),E=!!l,D=!!u;return(0,c.jsxs)(Vo,{...T(`root`,{active:!o&&!m&&!b}),unstyled:y,variant:f,disabled:o||m,mod:[{disabled:o||b,loading:m,block:d,"with-left-section":E,"with-right-section":D},S],...w,children:[typeof m==`boolean`&&(0,c.jsx)(cs,{mounted:m,transition:Ql,duration:150,children:e=>(0,c.jsx)(q,{component:`span`,...T(`loader`,{style:e}),"aria-hidden":!0,children:(0,c.jsx)(vs,{color:`var(--button-color)`,size:`calc(var(--button-height) / 1.8)`,...h})})}),(0,c.jsxs)(`span`,{...T(`inner`),children:[l&&(0,c.jsx)(q,{component:`span`,...T(`section`),mod:{position:`left`},children:l}),(0,c.jsx)(q,{component:`span`,mod:{loading:m},...T(`label`),children:s}),u&&(0,c.jsx)(q,{component:`span`,...T(`section`),mod:{position:`right`},children:u})]})]})});Q.classes=Kl,Q.varsResolver=$l,Q.displayName=`@mantine/core/Button`,Q.Group=Yl,Q.GroupSection=Zl;var eu={root:`m_4451eb3a`},tu=fn(e=>{let t=W(`Center`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,inline:l,mod:u,attributes:d,...f}=t,p=G({name:`Center`,props:t,classes:eu,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:d,vars:s});return(0,c.jsx)(q,{mod:[{inline:l},u],...p(`root`),...f})});tu.classes=eu,tu.displayName=`@mantine/core/Center`;var nu={root:`m_3eebeb36`,label:`m_9e365f20`},ru={orientation:`horizontal`},iu=H((e,{color:t,variant:n,size:r})=>({root:{"--divider-color":t?Le(t,e):void 0,"--divider-border-style":n,"--divider-size":C(r,`divider-size`)}})),au=K(e=>{let t=W(`Divider`,ru,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,color:l,orientation:u,label:d,labelPosition:f,mod:p,attributes:m,...h}=t,g=G({name:`Divider`,classes:nu,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:m,vars:s,varsResolver:iu});return(0,c.jsx)(q,{mod:[{orientation:u,withLabel:!!d},p],role:`separator`,"aria-orientation":u,...g(`root`),...h,children:d&&(0,c.jsx)(q,{component:`span`,mod:{position:f},...g(`label`),children:d})})});au.classes=nu,au.varsResolver=iu,au.displayName=`@mantine/core/Divider`;var[ou,su]=b(`Modal component was not found in tree`),cu={root:`m_9df02822`,content:`m_54c44539`,inner:`m_1f958f16`,header:`m_d0e2b9cd`},lu=K(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=W(`ModalBody`,null,e),s=su();return(0,c.jsx)(el,{...s.getStyles(`body`,{classNames:t,style:r,styles:i,className:n}),...o})});lu.classes=cu,lu.displayName=`@mantine/core/ModalBody`;var uu=K(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=W(`ModalCloseButton`,null,e),s=su();return(0,c.jsx)(tl,{...s.getStyles(`close`,{classNames:t,style:r,styles:i,className:n}),...o})});uu.classes=cu,uu.displayName=`@mantine/core/ModalCloseButton`;var du=K(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:o,__hidden:s,...l}=W(`ModalContent`,null,e),u=su(),d=u.scrollAreaComponent||ll;return(0,c.jsx)(nl,{...u.getStyles(`content`,{className:n,style:r,styles:i,classNames:t}),innerProps:u.getStyles(`inner`,{className:n,style:r,styles:i,classNames:t}),"data-full-screen":u.fullScreen||void 0,"data-modal-content":!0,"data-hidden":s||void 0,...l,children:(0,c.jsx)(d,{style:{maxHeight:u.fullScreen?`100dvh`:`calc(100dvh - (${h(u.yOffset)} * 2))`},children:o})})});du.classes=cu,du.displayName=`@mantine/core/ModalContent`;var fu=K(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=W(`ModalHeader`,null,e),s=su();return(0,c.jsx)(rl,{...s.getStyles(`header`,{classNames:t,style:r,styles:i,className:n}),...o})});fu.classes=cu,fu.displayName=`@mantine/core/ModalHeader`;var pu=K(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=W(`ModalOverlay`,null,e),s=su();return(0,c.jsx)(ol,{...s.getStyles(`overlay`,{classNames:t,style:r,styles:i,className:n}),...o})});pu.classes=cu,pu.displayName=`@mantine/core/ModalOverlay`;var mu={__staticSelector:`Modal`,closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:S(`modal`),transitionProps:{duration:200,transition:`fade-down`},yOffset:`5dvh`},hu=H((e,{radius:t,size:n,yOffset:r,xOffset:i})=>({root:{"--modal-radius":t===void 0?void 0:T(t),"--modal-size":C(n,`modal-size`),"--modal-y-offset":h(r),"--modal-x-offset":h(i)}})),gu=K(e=>{let t=W(`ModalRoot`,mu,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,yOffset:l,scrollAreaComponent:u,radius:d,fullScreen:f,centered:p,xOffset:m,__staticSelector:h,attributes:g,..._}=t,v=G({name:h,classes:cu,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:g,vars:s,varsResolver:hu});return(0,c.jsx)(ou,{value:{yOffset:l,scrollAreaComponent:u,getStyles:v,fullScreen:f},children:(0,c.jsx)(Zc,{...v(`root`),"data-full-screen":f||void 0,"data-centered":p||void 0,"data-offset-scrollbars":u===Lo.Autosize||void 0,unstyled:o,..._})})});gu.classes=cu,gu.varsResolver=hu,gu.displayName=`@mantine/core/ModalRoot`;var _u=(0,o.createContext)(null);function vu({children:e}){let[t,n]=(0,o.useState)([]),[r,i]=(0,o.useState)(S(`modal`)),[a]=(0,o.useState)(()=>new WeakSet);return(0,c.jsx)(_u,{value:{stack:t,addModal:(e,t)=>{n(t=>[...new Set([...t,e])]),i(e=>typeof t==`number`&&typeof e==`number`?Math.max(e,t):e)},removeModal:e=>n(t=>t.filter(t=>t!==e)),getZIndex:e=>`calc(${r} + ${t.indexOf(e)} + 1)`,currentId:t[t.length-1],maxZIndex:r,handledEscapeEvents:a},children:e})}vu.displayName=`@mantine/core/ModalStack`;var yu=K(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=W(`ModalTitle`,null,e),s=su();return(0,c.jsx)(cl,{...s.getStyles(`title`,{classNames:t,style:r,styles:i,className:n}),...o})});yu.classes=cu,yu.displayName=`@mantine/core/ModalTitle`;var bu={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:S(`modal`),transitionProps:{duration:200,transition:`fade-down`},withOverlay:!0,withCloseButton:!0},xu=K(e=>{let{title:t,withOverlay:n,overlayProps:r,withCloseButton:i,closeButtonProps:a,children:s,radius:l,opened:u,stackId:d,zIndex:f,...p}=W(`Modal`,bu,e),m=(0,o.use)(_u),h=!!t||i,g=m&&d?{closeOnEscape:m.currentId===d,trapFocus:m.currentId===d,zIndex:m.getZIndex(d),__handledEscapeEvents:m.handledEscapeEvents}:{},_=n===!1?!1:d&&m?m.currentId===d:u;return(0,o.useEffect)(()=>{m&&d&&(u?m.addModal(d,f||S(`modal`)):m.removeModal(d))},[u,d,f]),(0,c.jsxs)(gu,{radius:l,opened:u,zIndex:m&&d?m.getZIndex(d):f,...p,...g,children:[n&&(0,c.jsx)(pu,{visible:_,transitionProps:m&&d?{duration:0}:void 0,...r}),(0,c.jsxs)(du,{radius:l,__hidden:m&&d&&u?d!==m.currentId:!1,children:[h&&(0,c.jsxs)(fu,{children:[t&&(0,c.jsx)(yu,{children:t}),i&&(0,c.jsx)(uu,{...a})]}),(0,c.jsx)(lu,{children:s})]})]})});xu.classes=cu,xu.displayName=`@mantine/core/Modal`,xu.Root=gu,xu.Overlay=pu,xu.Content=du,xu.Body=lu,xu.Header=fu,xu.Title=yu,xu.CloseButton=uu,xu.Stack=vu;var Su={root:`m_f0824112`,description:`m_57492dcc`,section:`m_690090b5`,label:`m_1f6ac4c4`,body:`m_f07af9d2`,children:`m_e17b862f`,chevron:`m_1fd8a00b`},Cu=H((e,{variant:t,color:n,childrenOffset:r,autoContrast:i})=>{let a=e.variantColorResolver({color:n||e.primaryColor,theme:e,variant:t||`light`,autoContrast:i});return{root:{"--nl-bg":n||t?a.background:void 0,"--nl-hover":n||t?a.hover:void 0,"--nl-color":n||t?a.color:void 0},children:{"--nl-offset":w(r)}}}),wu=fn(e=>{let t=W(`NavLink`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,opened:l,defaultOpened:u,onChange:d,children:f,active:p,disabled:m,leftSection:h,rightSection:g,label:_,description:v,disableRightSectionRotation:y,noWrap:b,childrenOffset:x,autoContrast:S,mod:C,attributes:w,onClick:T,onKeyDown:E,keepMounted:D,...O}=t,k=G({name:`NavLink`,props:t,classes:Su,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:w,vars:s,varsResolver:Cu}),[A,j]=fe({value:l,defaultValue:u,finalValue:!1,onChange:d}),M=!!f,N=e=>{T?.(e),M&&(e.preventDefault(),j(!A))};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(Vo,{...k(`root`),component:`a`,onClick:N,onKeyDown:e=>{E?.(e),e.nativeEvent.code===`Space`&&M&&(e.preventDefault(),j(!A))},unstyled:o,mod:[{disabled:m,active:p,expanded:A},C],...O,children:[h&&(0,c.jsx)(q,{component:`span`,...k(`section`),mod:{position:`left`},children:h}),(0,c.jsxs)(q,{...k(`body`),mod:{"no-wrap":b},children:[(0,c.jsx)(q,{component:`span`,...k(`label`),children:_}),(0,c.jsx)(q,{component:`span`,mod:{active:p},...k(`description`),children:v})]}),(M||g!==void 0)&&(0,c.jsx)(q,{...k(`section`),component:`span`,mod:{rotate:A&&!y,position:`right`},children:M&&g===void 0?(0,c.jsx)(Rl,{...k(`chevron`)}):g})]}),M&&(0,c.jsx)(Sn,{expanded:A,keepMounted:D,...k(`collapse`),children:(0,c.jsx)(`div`,{...k(`children`),children:f})})]})});wu.classes=Su,wu.varsResolver=Cu,wu.displayName=`@mantine/core/NavLink`;function Tu(e,t){if(e<1)return[];let n=Array(e).fill(``);if(t){let r=t.trim().split(``);for(let t=0;t({root:{"--pin-input-size":C(t??`sm`,`pin-input-size`)}})),Au=K(e=>{let{name:t,form:n,className:r,value:i,defaultValue:a,variant:s,gap:l,style:u,size:d,classNames:f,styles:p,unstyled:m,length:h,onChange:g,onComplete:_,manageFocus:v,autoFocus:y,error:b,success:x,radius:S,disabled:C,oneTimeCode:w,placeholder:T,type:E,mask:D,readOnly:O,inputType:k,inputMode:A,ariaLabel:j,vars:M,id:N,hiddenInputProps:P,rootRef:ee,getInputProps:F,attributes:te,ref:I,...L}=W([`Input`,`PinInput`],Ou,e),R=ce(N),ne=G({name:`PinInput`,classes:Eu,props:e,className:r,style:u,classNames:f,styles:p,unstyled:m,attributes:te,vars:M,varsResolver:ku}),{resolvedClassNames:re,resolvedStyles:ie}=mt({classNames:f,styles:p,props:e}),[ae,oe]=(0,o.useState)(-1),se=(0,o.useRef)([]),z=h??4,le=(0,o.useRef)(!1),[de,B]=fe({value:i===void 0?void 0:Tu(z,i),defaultValue:a?.split(``).slice(0,z),finalValue:Tu(z,``),onChange:e=>{let t=e.join(``).trim();g?.(t),t.length===z&&!le.current?(le.current=!0,_?.(t)):t.length(E instanceof RegExp?E:E&&E in Du?Du[E]:null)?.test(e),V=(e,t)=>{if(v){if(e===`next`){let e=t+1;e=0&&se.current[e]?.focus()}}},ge=(e,t)=>{let n=[...pe];return n[t]=e,B(n),n},_e=(e,t)=>{let n=e.target.value;if(n.length>1){if(n.length>2){if(he(n)){B(Tu(z,n));let e=Math.min(n.length,z);e{let{ctrlKey:n,metaKey:r,key:i,shiftKey:a,target:o}=e,s=o.value;if(A===`numeric`){let t=[`Backspace`,`Tab`,`Control`,`Delete`,`ArrowLeft`,`ArrowRight`],a=n||r;if(!(t.includes(i)||a||!Number.isNaN(Number(i)))){e.preventDefault();return}}switch(i){case`ArrowLeft`:e.preventDefault(),V(`prev`,t);break;case`ArrowRight`:e.preventDefault(),V(`next`,t);break;case`Tab`:a&&t>0&&v&&(e.preventDefault(),V(`prev`,t));break;case` `:e.preventDefault(),V(`next`,t);break;case`Delete`:e.preventDefault(),O||ge(``,t);break;case`Backspace`:O?e.preventDefault():s===``?(e.preventDefault(),V(`prev`,t)):(ge(``,t),t0&&i===pe[t]&&(e.preventDefault(),V(`next`,t))}},ye=(e,t)=>{e.target.select(),oe(t)},be=()=>{oe(-1)},H=e=>{if(e.preventDefault(),O)return;let t=e.clipboardData.getData(`text/plain`).replace(/[\n\r\s]+/g,``);if(he(t.trim())){let e=Tu(z,t);B(e);let n=e.filter(e=>e!==``).length;n>=z?se.current[z-1]?.focus():se.current[n]?.focus()}};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Is,{...L,...ne(`root`),ref:ee,role:`group`,id:R,gap:l,unstyled:m,wrap:`nowrap`,variant:s,__size:d,dir:`ltr`,children:pe.map((e,t)=>(0,o.createElement)(X,{component:`input`,...ne(`pinInput`,{style:{"--input-padding":`0`,"--input-text-align":`center`}}),classNames:re,styles:ie,size:d,__staticSelector:`PinInput`,id:`${R}-${t+1}`,key:`${R}-${t}`,inputMode:A||(E===`number`?`numeric`:`text`),onChange:e=>_e(e,t),onKeyDown:e=>ve(e,t),onFocus:e=>ye(e,t),onBlur:be,onPaste:H,type:k||(D?`password`:E===`number`?`tel`:`text`),radius:S,error:b,success:x,variant:s,disabled:C,ref:e=>{e&&(t===0&&ue(I,e),se.current[t]=e)},autoComplete:w?`one-time-code`:`off`,placeholder:ae===t?``:T,value:e,autoFocus:y&&t===0,unstyled:m,"aria-label":j,readOnly:O,...F?.(t)}))}),(0,c.jsx)(`input`,{type:`hidden`,name:t,form:n,value:me,...P})]})});Au.classes={...Eu,...Pl.classes},Au.varsResolver=ku,Au.displayName=`@mantine/core/PinInput`;var ju={root:`m_18320242`,"skeleton-fade":`m_299c329c`},Mu={visible:!0,animate:!0},Nu=H((e,{width:t,height:n,radius:r,circle:i})=>({root:{"--skeleton-height":h(n),"--skeleton-width":h(i?n:t),"--skeleton-radius":i?`1000px`:r===void 0?void 0:T(r)}})),Pu=K(e=>{let t=W(`Skeleton`,Mu,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,width:l,height:u,circle:d,visible:f,radius:p,animate:m,mod:h,attributes:g,..._}=t,v=G({name:`Skeleton`,classes:ju,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:g,vars:s,varsResolver:Nu});return(0,c.jsx)(q,{...v(`root`),mod:[{visible:f,animate:m},h],..._})});Pu.classes=ju,Pu.varsResolver=Nu,Pu.displayName=`@mantine/core/Skeleton`;var Fu={root:`m_6d731127`},Iu={gap:`md`,align:`stretch`,justify:`flex-start`},Lu=H((e,{gap:t,align:n,justify:r})=>({root:{"--stack-gap":w(t),"--stack-align":n,"--stack-justify":r}})),$=K(e=>{let t=W(`Stack`,Iu,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,align:l,justify:u,gap:d,variant:f,attributes:p,...m}=t,h=G({name:`Stack`,props:t,classes:Fu,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:p,vars:s,varsResolver:Lu});return(0,c.jsx)(q,{...h(`root`),variant:f,...m})});$.classes=Fu,$.varsResolver=Lu,$.displayName=`@mantine/core/Stack`;var Ru=K(e=>{let t=W([`Input`,`InputWrapper`,`TextInput`],null,e);return(0,c.jsx)(Pl,{component:`input`,...t,__staticSelector:`TextInput`})});Ru.classes=Pl.classes,Ru.displayName=`@mantine/core/TextInput`;var zu={root:`m_7341320d`},Bu=H((e,{size:t,radius:n,variant:r,gradient:i,color:a,autoContrast:o})=>{let s=e.variantColorResolver({color:a||e.primaryColor,theme:e,gradient:i,variant:r||`filled`,autoContrast:o});return{root:{"--ti-size":C(t,`ti-size`),"--ti-radius":n===void 0?void 0:T(n),"--ti-bg":a||r?s.background:void 0,"--ti-color":a||r?s.color:void 0,"--ti-bd":a||r?s.border:void 0}}}),Vu=K(e=>{let t=W(`ThemeIcon`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,autoContrast:l,attributes:u,...d}=t,f=G({name:`ThemeIcon`,classes:zu,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:u,vars:s,varsResolver:Bu});return(0,c.jsx)(q,{...f(`root`),...d})});Vu.classes=zu,Vu.varsResolver=Bu,Vu.displayName=`@mantine/core/ThemeIcon`;var Hu=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],Uu=[`xs`,`sm`,`md`,`lg`,`xl`];function Wu(e,t){let n=t===void 0?`h${e}`:t;return Hu.includes(n)?{fontSize:`var(--mantine-${n}-font-size)`,fontWeight:`var(--mantine-${n}-font-weight)`,lineHeight:`var(--mantine-${n}-line-height)`}:Uu.includes(n)?{fontSize:`var(--mantine-font-size-${n})`,fontWeight:`var(--mantine-h${e}-font-weight)`,lineHeight:`var(--mantine-h${e}-line-height)`}:{fontSize:h(n),fontWeight:`var(--mantine-h${e}-font-weight)`,lineHeight:`var(--mantine-h${e}-line-height)`}}var Gu={root:`m_8a5d1357`},Ku={order:1},qu=H((e,{order:t,size:n,lineClamp:r,textWrap:i})=>{let a=Wu(t||1,n);return{root:{"--title-fw":a.fontWeight,"--title-lh":a.lineHeight,"--title-fz":a.fontSize,"--title-line-clamp":typeof r==`number`?r.toString():void 0,"--title-text-wrap":i}}}),Ju=K(e=>{let t=W(`Title`,Ku,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,order:s,vars:l,size:u,variant:d,lineClamp:f,textWrap:p,mod:m,attributes:h,...g}=t,_=G({name:`Title`,props:t,classes:Gu,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:h,vars:l,varsResolver:qu});return[1,2,3,4,5,6].includes(s)?(0,c.jsx)(q,{..._(`root`),component:`h${s}`,variant:d,mod:[{order:s,lineClamp:typeof f==`number`},m],size:u,...g}):null});Ju.classes=Gu,Ju.varsResolver=qu,Ju.displayName=`@mantine/core/Title`;var Yu=(0,o.createContext)({color:`currentColor`,size:`1em`,weight:`regular`,mirrored:!1}),Xu=o.forwardRef((e,t)=>{let{alt:n,color:r,size:i,weight:a,mirrored:s,children:c,weights:l,...u}=e,{color:d=`currentColor`,size:f,weight:p=`regular`,mirrored:m=!1,...h}=o.useContext(Yu);return o.createElement(`svg`,{ref:t,xmlns:`http://www.w3.org/2000/svg`,width:i??f,height:i??f,fill:r??d,viewBox:`0 0 256 256`,transform:s||m?`scale(-1, 1)`:void 0,...h,...u},!!n&&o.createElement(`title`,null,n),c,l.get(a??p))});Xu.displayName=`IconBase`;var Zu=new Map([[`bold`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`}))]]),Qu=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:Zu}));Qu.displayName=`ArrowCounterClockwiseIcon`;var $u=Qu,ed=new Map([[`bold`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z`}))],[`duotone`,o.createElement(o.Fragment,null,o.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`}),o.createElement(`path`,{d:`M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`fill`,o.createElement(o.Fragment,null,o.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,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`light`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z`}))],[`regular`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`thin`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z`}))]]),td=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:ed}));td.displayName=`XIcon`;var nd=td,rd=new Map([[`bold`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M176.49,95.51a12,12,0,0,1,0,17l-56,56a12,12,0,0,1-17,0l-24-24a12,12,0,1,1,17-17L112,143l47.51-47.52A12,12,0,0,1,176.49,95.51ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z`}))],[`duotone`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),o.createElement(`path`,{d:`M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`fill`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,85.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`thin`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),id=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:rd}));id.displayName=`CheckCircleIcon`;var ad=new Map([[`bold`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`}))]]),od=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:ad}));od.displayName=`InfoIcon`;var sd=od,cd=new Map([[`bold`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M240.26,186.1,152.81,34.23h0a28.74,28.74,0,0,0-49.62,0L15.74,186.1a27.45,27.45,0,0,0,0,27.71A28.31,28.31,0,0,0,40.55,228h174.9a28.31,28.31,0,0,0,24.79-14.19A27.45,27.45,0,0,0,240.26,186.1Zm-20.8,15.7a4.46,4.46,0,0,1-4,2.2H40.55a4.46,4.46,0,0,1-4-2.2,3.56,3.56,0,0,1,0-3.73L124,46.2a4.77,4.77,0,0,1,8,0l87.44,151.87A3.56,3.56,0,0,1,219.46,201.8ZM116,136V104a12,12,0,0,1,24,0v32a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,176Z`}))],[`duotone`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z`,opacity:`0.2`}),o.createElement(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z`}))],[`fill`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z`}))],[`light`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M235.07,189.09,147.61,37.22h0a22.75,22.75,0,0,0-39.22,0L20.93,189.09a21.53,21.53,0,0,0,0,21.72A22.35,22.35,0,0,0,40.55,222h174.9a22.35,22.35,0,0,0,19.6-11.19A21.53,21.53,0,0,0,235.07,189.09ZM224.66,204.8a10.46,10.46,0,0,1-9.21,5.2H40.55a10.46,10.46,0,0,1-9.21-5.2,9.51,9.51,0,0,1,0-9.72L118.79,43.21a10.75,10.75,0,0,1,18.42,0l87.46,151.87A9.51,9.51,0,0,1,224.66,204.8ZM122,144V104a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,180Z`}))],[`regular`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z`}))],[`thin`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M233.34,190.09,145.88,38.22h0a20.75,20.75,0,0,0-35.76,0L22.66,190.09a19.52,19.52,0,0,0,0,19.71A20.36,20.36,0,0,0,40.54,220H215.46a20.36,20.36,0,0,0,17.86-10.2A19.52,19.52,0,0,0,233.34,190.09ZM226.4,205.8a12.47,12.47,0,0,1-10.94,6.2H40.54a12.47,12.47,0,0,1-10.94-6.2,11.45,11.45,0,0,1,0-11.72L117.05,42.21a12.76,12.76,0,0,1,21.9,0L226.4,194.08A11.45,11.45,0,0,1,226.4,205.8ZM124,144V104a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,180Z`}))]]),ld=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:cd}));ld.displayName=`WarningIcon`;var ud=new Map([[`bold`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M168.49,104.49,145,128l23.52,23.51a12,12,0,0,1-17,17L128,145l-23.51,23.52a12,12,0,0,1-17-17L111,128,87.51,104.49a12,12,0,0,1,17-17L128,111l23.51-23.52a12,12,0,0,1,17,17ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z`}))],[`duotone`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),o.createElement(`path`,{d:`M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`fill`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm37.66,130.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`light`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M164.24,100.24,136.48,128l27.76,27.76a6,6,0,1,1-8.48,8.48L128,136.48l-27.76,27.76a6,6,0,0,1-8.48-8.48L119.52,128,91.76,100.24a6,6,0,0,1,8.48-8.48L128,119.52l27.76-27.76a6,6,0,0,1,8.48,8.48ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`thin`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M162.83,98.83,133.66,128l29.17,29.17a4,4,0,0,1-5.66,5.66L128,133.66,98.83,162.83a4,4,0,0,1-5.66-5.66L122.34,128,93.17,98.83a4,4,0,0,1,5.66-5.66L128,122.34l29.17-29.17a4,4,0,1,1,5.66,5.66ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),dd=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:ud}));dd.displayName=`XCircleIcon`;var fd=new Map([[`bold`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M208,28H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28Zm-4,24v92H179.31a19.86,19.86,0,0,0-14.14,5.86L147,168H109L90.83,149.86A19.86,19.86,0,0,0,76.69,144H52V52ZM52,204V168H75l18.14,18.14A19.86,19.86,0,0,0,107.31,192h41.38a19.86,19.86,0,0,0,14.14-5.86L181,168h23v36Z`}))],[`duotone`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,48V160H179.31a8,8,0,0,0-5.66,2.34l-19.31,19.32a8,8,0,0,1-5.66,2.34H107.31a8,8,0,0,1-5.66-2.34L82.34,162.34A8,8,0,0,0,76.68,160H40V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z`,opacity:`0.2`}),o.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,16V152h-28.7A15.86,15.86,0,0,0,168,156.69L148.69,176H107.31L88,156.68A15.89,15.89,0,0,0,76.69,152H48V48Zm0,160H48V168H76.69L96,187.32A15.89,15.89,0,0,0,107.31,192h41.38A15.86,15.86,0,0,0,160,187.31L179.31,168H208v40Z`}))],[`fill`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,176H48V168H76.69L96,187.32A15.89,15.89,0,0,0,107.31,192h41.38A15.86,15.86,0,0,0,160,187.31L179.31,168H208v40Z`}))],[`light`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M208,34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34ZM48,46H208a2,2,0,0,1,2,2V154H179.31a13.94,13.94,0,0,0-9.9,4.1L150.1,177.41a2,2,0,0,1-1.41.59H107.31a2,2,0,0,1-1.41-.58L86.59,158.1a13.94,13.94,0,0,0-9.9-4.1H46V48A2,2,0,0,1,48,46ZM208,210H48a2,2,0,0,1-2-2V166H76.69a2,2,0,0,1,1.41.58L97.41,185.9a13.94,13.94,0,0,0,9.9,4.1h41.38a13.94,13.94,0,0,0,9.9-4.1l19.31-19.31a2,2,0,0,1,1.41-.59H210v42A2,2,0,0,1,208,210Z`}))],[`regular`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,16V152h-28.7A15.86,15.86,0,0,0,168,156.69L148.69,176H107.31L88,156.69A15.86,15.86,0,0,0,76.69,152H48V48Zm0,160H48V168H76.69L96,187.31A15.86,15.86,0,0,0,107.31,192h41.38A15.86,15.86,0,0,0,160,187.31L179.31,168H208v40Z`}))],[`thin`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M208,36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36ZM48,44H208a4,4,0,0,1,4,4V156H179.31a12,12,0,0,0-8.48,3.51l-19.32,19.32a4,4,0,0,1-2.82,1.17H107.31a4,4,0,0,1-2.82-1.17L85.17,159.51A12,12,0,0,0,76.69,156H44V48A4,4,0,0,1,48,44ZM208,212H48a4,4,0,0,1-4-4V164H76.69a4,4,0,0,1,2.82,1.17l19.32,19.32a12,12,0,0,0,8.48,3.51h41.38a12,12,0,0,0,8.48-3.51l19.32-19.32a4,4,0,0,1,2.82-1.17H212v44A4,4,0,0,1,208,212Z`}))]]),pd=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:fd}));pd.displayName=`TrayIcon`;var md=new Map([[`bold`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`}))]]),hd=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:md}));hd.displayName=`WarningCircleIcon`;var gd=hd,_d=new Map([[`bold`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M196,76a16,16,0,1,1-16-16A16,16,0,0,1,196,76Zm48,22.74A84.3,84.3,0,0,1,160.11,180H160a83.52,83.52,0,0,1-23.65-3.38l-7.86,7.87A12,12,0,0,1,120,188H108v12a12,12,0,0,1-12,12H84v12a12,12,0,0,1-12,12H40a20,20,0,0,1-20-20V187.31a19.86,19.86,0,0,1,5.86-14.14l53.52-53.52A84,84,0,1,1,244,98.74ZM202.43,53.57A59.48,59.48,0,0,0,158,36c-32,1-58,27.89-58,59.89a59.69,59.69,0,0,0,4.2,22.19,12,12,0,0,1-2.55,13.21L44,189v23H60V200a12,12,0,0,1,12-12H84V176a12,12,0,0,1,12-12h19l9.65-9.65a12,12,0,0,1,13.22-2.55A59.58,59.58,0,0,0,160,156h.08c32,0,58.87-26.07,59.89-58A59.55,59.55,0,0,0,202.43,53.57Z`}))],[`duotone`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M232,98.36C230.73,136.92,198.67,168,160.09,168a71.68,71.68,0,0,1-26.92-5.17h0L120,176H96v24H72v24H40a8,8,0,0,1-8-8V187.31a8,8,0,0,1,2.34-5.65l58.83-58.83h0A71.68,71.68,0,0,1,88,95.91c0-38.58,31.08-70.64,69.64-71.87A72,72,0,0,1,232,98.36Z`,opacity:`0.2`}),o.createElement(`path`,{d:`M216.57,39.43A80,80,0,0,0,83.91,120.78L28.69,176A15.86,15.86,0,0,0,24,187.31V216a16,16,0,0,0,16,16H72a8,8,0,0,0,8-8V208H96a8,8,0,0,0,8-8V184h16a8,8,0,0,0,5.66-2.34l9.56-9.57A79.73,79.73,0,0,0,160,176h.1A80,80,0,0,0,216.57,39.43ZM224,98.1c-1.09,34.09-29.75,61.86-63.89,61.9H160a63.7,63.7,0,0,1-23.65-4.51,8,8,0,0,0-8.84,1.68L116.69,168H96a8,8,0,0,0-8,8v16H72a8,8,0,0,0-8,8v16H40V187.31l58.83-58.82a8,8,0,0,0,1.68-8.84A63.72,63.72,0,0,1,96,95.92c0-34.14,27.81-62.8,61.9-63.89A64,64,0,0,1,224,98.1ZM192,76a12,12,0,1,1-12-12A12,12,0,0,1,192,76Z`}))],[`fill`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216.57,39.43A80,80,0,0,0,83.91,120.78L28.69,176A15.86,15.86,0,0,0,24,187.31V216a16,16,0,0,0,16,16H72a8,8,0,0,0,8-8V208H96a8,8,0,0,0,8-8V184h16a8,8,0,0,0,5.66-2.34l9.56-9.57A79.73,79.73,0,0,0,160,176h.1A80,80,0,0,0,216.57,39.43ZM180,92a16,16,0,1,1,16-16A16,16,0,0,1,180,92Z`}))],[`light`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M215.15,40.85A78,78,0,0,0,86.2,121.31l-56.1,56.1a13.94,13.94,0,0,0-4.1,9.9V216a14,14,0,0,0,14,14H72a6,6,0,0,0,6-6V206H96a6,6,0,0,0,6-6V182h18a6,6,0,0,0,4.24-1.76l10.45-10.44A77.59,77.59,0,0,0,160,174h.1A78,78,0,0,0,215.15,40.85ZM226,98.16c-1.12,35.16-30.67,63.8-65.88,63.84a65.93,65.93,0,0,1-24.51-4.67,6,6,0,0,0-6.64,1.26L117.51,170H96a6,6,0,0,0-6,6v18H72a6,6,0,0,0-6,6v18H40a2,2,0,0,1-2-2V187.31a2,2,0,0,1,.58-1.41l58.83-58.83a6,6,0,0,0,1.26-6.64A65.61,65.61,0,0,1,94,95.92C94,60.71,122.68,31.16,157.83,30A66,66,0,0,1,226,98.16ZM190,76a10,10,0,1,1-10-10A10,10,0,0,1,190,76Z`}))],[`regular`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216.57,39.43A80,80,0,0,0,83.91,120.78L28.69,176A15.86,15.86,0,0,0,24,187.31V216a16,16,0,0,0,16,16H72a8,8,0,0,0,8-8V208H96a8,8,0,0,0,8-8V184h16a8,8,0,0,0,5.66-2.34l9.56-9.57A79.73,79.73,0,0,0,160,176h.1A80,80,0,0,0,216.57,39.43ZM224,98.1c-1.09,34.09-29.75,61.86-63.89,61.9H160a63.7,63.7,0,0,1-23.65-4.51,8,8,0,0,0-8.84,1.68L116.69,168H96a8,8,0,0,0-8,8v16H72a8,8,0,0,0-8,8v16H40V187.31l58.83-58.82a8,8,0,0,0,1.68-8.84A63.72,63.72,0,0,1,96,95.92c0-34.14,27.81-62.8,61.9-63.89A64,64,0,0,1,224,98.1ZM192,76a12,12,0,1,1-12-12A12,12,0,0,1,192,76Z`}))],[`thin`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M213.74,42.26A76,76,0,0,0,88.51,121.84l-57,57A11.93,11.93,0,0,0,28,187.31V216a12,12,0,0,0,12,12H72a4,4,0,0,0,4-4V204H96a4,4,0,0,0,4-4V180h20a4,4,0,0,0,2.83-1.17l11.33-11.34A75.72,75.72,0,0,0,160,172h.1A76,76,0,0,0,213.74,42.26Zm14.22,56c-1.15,36.22-31.6,65.72-67.87,65.77H160a67.52,67.52,0,0,1-25.21-4.83,4,4,0,0,0-4.45.83l-12,12H96a4,4,0,0,0-4,4v20H72a4,4,0,0,0-4,4v20H40a4,4,0,0,1-4-4V187.31a4.06,4.06,0,0,1,1.17-2.83L96,125.66a4,4,0,0,0,.83-4.45A67.51,67.51,0,0,1,92,95.91C92,59.64,121.55,29.19,157.77,28A68,68,0,0,1,228,98.23ZM188,76a8,8,0,1,1-8-8A8,8,0,0,1,188,76Z`}))]]),vd=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:_d}));vd.displayName=`KeyIcon`;var yd={sm:`26rem`,md:`32rem`,lg:`48rem`};function bd({brand:e,brandPlacement:t=`above`,children:n,footer:r,size:i,aside:a,surface:o=`card`}){let s=a!=null,l=o===`plain`&&!s,u=s&&i===`sm`?`md`:i??(s?`lg`:`sm`),d=e!=null&&(0,c.jsx)(Is,{justify:`center`,gap:`xs`,children:typeof e==`string`?(0,c.jsx)(Z,{fw:700,size:`lg`,children:e}):e});return(0,c.jsx)(tu,{mih:`100dvh`,px:`md`,py:`xl`,children:(0,c.jsxs)($,{gap:`lg`,w:`100%`,maw:yd[u],children:[t===`above`&&d,(0,c.jsx)(Ko,{"data-labstack-auth-surface":l?`plain`:`card`,withBorder:!l,bg:l?`transparent`:void 0,p:s||l?0:{base:`lg`,sm:`xl`},style:{overflow:`hidden`},children:(0,c.jsxs)(Ll,{direction:{base:`column`,sm:`row`},gap:s?0:`lg`,children:[s&&(0,c.jsx)(q,{"data-labstack-auth-aside":!0,visibleFrom:`sm`,p:`md`,style:{flex:`1 1 0`,minWidth:`10rem`,overflowWrap:`anywhere`,background:`var(--labstack-inset, var(--mantine-color-default-hover))`},children:a}),(0,c.jsx)(q,{miw:{base:0,sm:s?`20rem`:0},p:s?{base:`lg`,sm:`xl`}:0,style:{flex:`1 1 0`},children:(0,c.jsxs)($,{gap:`lg`,children:[t===`inside`&&d,n]})})]})}),r!=null&&(0,c.jsx)(q,{ta:`center`,fz:`xs`,c:`dimmed`,children:r})]})})}var xd={neutral:`gray`,info:`blue`,success:`green`,warning:`yellow`,danger:`red`};function Sd(e,t){return e.other.labstackTones?.[t]??xd[t]}function Cd(e){return Sd(dt(),e)}function wd(e){return`var(--mantine-color-${e.split(`.`)[0]}-text)`}function Td(e){return`var(--mantine-color-${e.split(`.`)[0]}-light)`}var Ed={neutral:null,info:od,success:id,warning:ld,danger:dd};function Dd(e){return Ed[e]!=null}function Od({tone:e,size:t=`1em`,weight:n=`regular`}){let r=Ed[e];return r?(0,c.jsx)(r,{size:t,weight:n,"aria-hidden":`true`}):null}function kd({tone:e,title:t,children:n,detail:r,onRetry:i,retryLabel:a=`Try again`,onDismiss:o,dismissLabel:s=`Dismiss`,prominent:l=e===`warning`||e===`danger`,live:u=!0}){let d=Cd(e),f=Cd(`neutral`),p=e===`danger`;return(0,c.jsx)(Ko,{py:`sm`,pl:`sm`,pr:i||o?`xs`:`sm`,bg:l?Td(d):`var(--mantine-color-default-hover)`,style:{borderInlineStart:`3px solid ${wd(d)}`,borderStartStartRadius:0,borderEndStartRadius:0},role:u?p?`alert`:`status`:void 0,"aria-live":u?p?`assertive`:`polite`:void 0,children:(0,c.jsxs)(Is,{gap:`sm`,align:`flex-start`,wrap:`nowrap`,children:[(0,c.jsx)(Z,{component:`span`,lh:1,pt:2,c:wd(d),flex:`0 0 auto`,children:(0,c.jsx)(Od,{tone:e,size:18,weight:`fill`})}),(0,c.jsxs)(Ll,{flex:1,miw:0,gap:`xs`,direction:{base:`column`,sm:`row`},align:`flex-start`,children:[(0,c.jsxs)(q,{flex:1,miw:0,py:1,children:[t!=null&&(0,c.jsx)(Z,{component:`div`,size:`sm`,fw:600,mb:2,children:t}),(0,c.jsxs)(Z,{component:`div`,size:`sm`,style:{overflowWrap:`anywhere`},children:[n,r!=null&&(0,c.jsxs)(Z,{component:`span`,inherit:!0,c:`dimmed`,children:[` `,r]})]})]}),i&&(0,c.jsx)(Q,{variant:`subtle`,color:f,size:`compact-sm`,leftSection:(0,c.jsx)(Qu,{size:14,weight:`bold`,"aria-hidden":`true`}),onClick:i,type:`button`,children:a})]}),o&&(0,c.jsx)(Es,{variant:`subtle`,color:f,size:`md`,onClick:o,"aria-label":s,children:(0,c.jsx)(td,{size:14,"aria-hidden":`true`})})]})})}function Ad({opened:e,onClose:t,title:n,children:r,confirmLabel:i,onConfirm:a,cancelLabel:s=`Cancel`,pending:l=null,error:u,tone:d=`danger`,confirmText:f}){let p=dt(),m=d===`primary`?void 0:Sd(p,d),h=l===`confirm`,g=N(`(max-width: 36em)`),[_,v]=(0,o.useState)(``),y=(0,o.useRef)(null);(0,o.useEffect)(()=>{e&&h&&y.current?.focus()},[e,h]),(0,o.useEffect)(()=>{e||v(``)},[e]);let b=f!=null&&_!==f;return(0,c.jsx)(xu,{opened:e,onClose:h?()=>{}:t,title:(0,c.jsx)(Z,{component:`span`,fw:600,size:`lg`,children:n}),centered:!0,closeOnEscape:!h,closeOnClickOutside:!h,withCloseButton:!h,closeButtonProps:{"aria-label":`Close`},children:(0,c.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),!b&&!h&&a()},children:(0,c.jsxs)($,{gap:`md`,children:[(0,c.jsx)(Z,{component:`div`,size:`sm`,c:`dimmed`,ref:y,tabIndex:-1,"data-autofocus":h||void 0,children:r}),f!=null&&(0,c.jsx)(Ru,{label:(0,c.jsxs)(c.Fragment,{children:[`Type`,` `,(0,c.jsx)(Z,{component:`span`,inherit:!0,ff:`monospace`,fw:600,children:f}),` `,`to confirm`]}),value:_,onChange:e=>v(e.currentTarget.value),disabled:h,autoComplete:`off`,"data-autofocus":!h||void 0}),u!=null&&(0,c.jsx)(kd,{tone:`danger`,children:u}),(0,c.jsxs)(Is,{justify:`flex-end`,gap:`sm`,style:g?{flexDirection:`column-reverse`,alignItems:`stretch`}:void 0,children:[(0,c.jsx)(Q,{variant:`default`,"data-autofocus":!h&&f==null||void 0,onClick:t,disabled:h,type:`button`,children:s}),(0,c.jsx)(Q,{color:m,type:`submit`,loading:h,disabled:b,children:i})]})]})})})}var jd=`calc(var(--mantine-spacing-xs) * 2 + var(--mantine-font-size-sm) * var(--mantine-line-height))`;function Md({state:e,loadingLabel:t=`Loading…`,rows:n=3,skeleton:r,empty:i,error:a,variant:o=`inline`,children:s}){let l=Cd(`danger`),u=Cd(`neutral`);if(e===`ready`)return s;let d=o===`page`;if(e===`loading`)return r!=null&&r!==!1&&r!==!0&&r!==``?(0,c.jsxs)(q,{role:`status`,children:[(0,c.jsx)(Uo,{children:t}),(0,c.jsx)(q,{"aria-hidden":`true`,inert:!0,children:r})]}):d?(0,c.jsx)(tu,{mih:`60dvh`,p:`xl`,children:(0,c.jsxs)($,{align:`center`,gap:`sm`,role:`status`,children:[(0,c.jsx)(vs,{size:`md`,"aria-hidden":`true`}),(0,c.jsx)(Z,{size:`sm`,c:`dimmed`,children:t})]})}):(0,c.jsxs)($,{gap:`sm`,role:`status`,children:[(0,c.jsx)(Z,{size:`sm`,c:`dimmed`,children:t}),(0,c.jsx)($,{gap:4,children:Array.from({length:n},(e,t)=>(0,c.jsx)(Pu,{height:jd},t))})]});if(e===`empty`){let e=(0,c.jsxs)($,{align:`center`,gap:`sm`,ta:`center`,maw:`28rem`,mx:`auto`,children:[(0,c.jsx)(Vu,{variant:`light`,color:u,size:d?56:44,children:i?.icon??(0,c.jsx)(pd,{size:d?28:22,"aria-hidden":`true`})}),(0,c.jsx)(Z,{component:`div`,fw:600,size:d?`xl`:`lg`,children:i?.title??`Nothing here yet`}),i?.description!=null&&(0,c.jsx)(Z,{component:`div`,size:`sm`,c:`dimmed`,children:i.description}),i?.action!=null&&(0,c.jsx)(q,{mt:`xs`,children:i.action})]});return d?(0,c.jsx)(tu,{mih:`60dvh`,p:`xl`,children:e}):(0,c.jsx)(Ko,{withBorder:!0,py:`xl`,px:`lg`,children:e})}return d?(0,c.jsx)(tu,{mih:`60dvh`,p:`xl`,children:(0,c.jsxs)($,{align:`center`,gap:`sm`,ta:`center`,maw:`28rem`,role:`alert`,children:[(0,c.jsx)(Vu,{variant:`light`,color:l,size:56,children:(0,c.jsx)(hd,{size:28,"aria-hidden":`true`})}),(0,c.jsx)(Ju,{order:2,size:`h3`,children:a?.title??a?.message??`Something went wrong`}),a?.title!=null&&(0,c.jsx)(Z,{component:`div`,c:`dimmed`,children:a.message}),a?.detail!=null&&(0,c.jsx)(Z,{component:`div`,size:`sm`,c:`dimmed`,children:a.detail}),a?.onRetry&&(0,c.jsx)(Q,{mt:`xs`,leftSection:(0,c.jsx)(Qu,{size:16,weight:`bold`,"aria-hidden":`true`}),onClick:a.onRetry,type:`button`,children:a.retryLabel??`Try again`})]})}):(0,c.jsx)(kd,{tone:`danger`,title:a?.title,detail:a?.detail,onRetry:a?.onRetry,retryLabel:a?.retryLabel,children:a?.message??`Something went wrong.`})}var Nd={emailLabel:`Email`,emailPlaceholder:`you@example.com`,continue:`Continue`,or:`or`,passkey:`Sign in with a passkey`,passkeyUnavailable:`Passkeys are not available on this device. Use an email code.`,passkeyPending:`Complete the passkey request in your browser or password manager.`,useCode:`Use email code instead`,codeTitle:`Check your email`,codeSent:(e,t,n)=>(0,c.jsxs)(c.Fragment,{children:[`If `,e,` can sign in, a `,t,`-digit code is on its way.`,n!=null&&` It works for ${n} minutes.`]}),codeLabel:`Verification code`,verify:`Verify and continue`,verifying:`Verifying…`,incompleteCode:e=>`Enter all ${e} digits of the code.`,resend:`Send a new code`,resendIn:e=>`Send a new code in ${e}`,changeEmail:`Use a different email`};function Pd(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`}function Fd({children:e}){return(0,c.jsx)(Z,{component:`div`,size:`xs`,fw:600,tt:`uppercase`,lts:`0.08em`,c:`dimmed`,children:e})}function Id({children:e}){return(0,c.jsx)(Z,{component:`div`,size:`xs`,c:`dimmed`,ta:`center`,children:e})}function Ld({step:e,title:t=`Sign in`,description:n=`Use your email. No password needed.`,invitation:r,email:i,onEmailChange:a,onSendCode:s,emailError:l,code:u,onCodeChange:d,onVerify:f,codeLength:p=6,autoVerify:m=!0,expiresInMinutes:h,codeNote:g,resendIn:_=0,onResend:v,onChangeEmail:y,pending:b=null,error:x,notice:S,passkey:C,footer:w,stepLabels:T={},labels:E,inputRef:D,autoFocus:O=!0}){let k={...Nd,...E},A=Cd(`neutral`),j=(0,o.useRef)(null),M=(0,o.useRef)(C?.autofill);M.current=C?.autofill;let N=C?.autofill!=null,P=C?.available;(0,o.useEffect)(()=>{if(e!==`email`||!P||!N||b!=null)return;let t=new AbortController;return j.current=t,M.current?.(t.signal),()=>t.abort()},[e,P,N,b]);let ee=(0,o.useRef)(null),F=B(ee,D),te=(0,o.useRef)(null);(0,o.useEffect)(()=>{u.length{I&&(e.length{re&&I&&ee.current?.focus()},[re,I]);let ie=(0,c.jsxs)(c.Fragment,{children:[x!=null&&(0,c.jsx)(kd,{tone:`danger`,children:x}),x==null&&L&&e===`code`&&(0,c.jsx)(kd,{tone:`danger`,children:k.incompleteCode(p)}),S!=null&&(0,c.jsx)(kd,{tone:`info`,children:S})]});if(e===`code`){let e=b===`verify`;return(0,c.jsxs)($,{gap:`lg`,children:[(0,c.jsxs)($,{gap:8,children:[T&&(0,c.jsx)(Fd,{children:T.code??`2 · Code`}),(0,c.jsx)(Ju,{order:1,size:`h2`,children:k.codeTitle}),(0,c.jsx)(Z,{size:`sm`,c:`dimmed`,children:k.codeSent((0,c.jsx)(Z,{component:`span`,inherit:!0,c:`var(--mantine-color-text)`,fw:500,style:{overflowWrap:`anywhere`},children:i}),p,h)})]}),(0,c.jsx)(`form`,{noValidate:!0,onSubmit:e=>{e.preventDefault(),ne(u)},children:(0,c.jsxs)($,{gap:`md`,children:[(0,c.jsx)(Au,{ref:F,length:p,type:`number`,oneTimeCode:!0,autoFocus:O,size:`md`,gap:`xs`,placeholder:``,ariaLabel:k.codeLabel,getInputProps:e=>({"aria-label":`${k.codeLabel}, digit ${e+1} of ${p}`}),value:u,onChange:e=>{d(e),R(!1),e.length0?(0,c.jsx)(Z,{size:`sm`,c:`dimmed`,ta:`center`,children:k.resendIn(Pd(_))}):(0,c.jsx)(Q,{variant:`subtle`,size:`sm`,disabled:!I&&b!==`resend`,loading:b===`resend`,onClick:v,type:`button`,children:k.resend})),(0,c.jsx)(Q,{variant:`subtle`,color:A,size:`sm`,disabled:e,onClick:y,type:`button`,children:k.changeEmail})]}),w!=null&&(0,c.jsx)(Id,{children:w})]})}let ae=b===`passkey`;return(0,c.jsxs)($,{gap:`lg`,children:[(0,c.jsxs)($,{gap:8,children:[T&&(0,c.jsx)(Fd,{children:T.email??`1 · Email`}),(0,c.jsx)(Ju,{order:1,size:`h2`,children:t}),n!=null&&(0,c.jsx)(Z,{size:`sm`,c:`dimmed`,children:n}),r!=null&&(0,c.jsx)(Z,{size:`sm`,fw:500,children:r})]}),(0,c.jsx)(`form`,{noValidate:!0,onSubmit:e=>{e.preventDefault(),I&&(j.current?.abort(),s())},children:(0,c.jsxs)($,{gap:`md`,children:[(0,c.jsx)(Ru,{ref:F,size:`md`,label:k.emailLabel,type:`email`,name:`email`,autoComplete:C?`email webauthn`:`email`,autoFocus:O,required:!0,withAsterisk:!1,placeholder:k.emailPlaceholder,value:i,error:l,onChange:e=>a(e.currentTarget.value),disabled:b===`send`||ae}),ie,(0,c.jsx)(Q,{type:`submit`,fullWidth:!0,size:`md`,loading:b===`send`,disabled:ae,children:k.continue})]})}),C&&(0,c.jsxs)($,{gap:`sm`,children:[(0,c.jsx)(au,{label:k.or,labelPosition:`center`}),(0,c.jsx)(Q,{variant:`default`,fullWidth:!0,size:`md`,leftSection:(0,c.jsx)(vd,{size:18,"aria-hidden":`true`}),onClick:()=>{j.current?.abort(),C.onStart()},loading:ae,disabled:!C.available||b===`send`,type:`button`,children:k.passkey}),!C.available&&(0,c.jsx)(Z,{size:`sm`,c:`dimmed`,ta:`center`,role:`status`,children:k.passkeyUnavailable}),ae&&(0,c.jsxs)(q,{ta:`center`,children:[(0,c.jsx)(Z,{size:`sm`,c:`dimmed`,role:`status`,children:k.passkeyPending}),C.onUseCode&&(0,c.jsx)(Q,{variant:`subtle`,color:A,size:`sm`,mt:4,onClick:C.onUseCode,type:`button`,children:k.useCode})]})]}),w!=null&&(0,c.jsx)(Id,{children:w})]})}function Rd({items:e,label:t,emptyValue:n=`Not set`,layout:r=`columns`,labelWidth:i=`12rem`,withDividers:a=!0}){let o=r===`columns`;return(0,c.jsx)(q,{component:`dl`,"aria-label":t,m:0,children:e.map((e,t)=>(0,c.jsxs)(q,{display:o?{base:`block`,sm:`flex`}:`block`,py:`sm`,style:a&&t>0?{borderTop:`1px solid var(--labstack-border, var(--mantine-color-default-border))`}:void 0,children:[(0,c.jsx)(q,{component:`dt`,w:o?{sm:i}:void 0,miw:o?{sm:i}:void 0,pr:o?{sm:`md`}:void 0,mb:o?{base:4,sm:0}:4,children:(0,c.jsx)(Z,{component:`span`,size:`sm`,c:`dimmed`,style:{overflowWrap:`anywhere`},children:e.label})}),(0,c.jsxs)(q,{component:`dd`,m:0,style:{flex:1,minWidth:0},children:[e.value==null||e.value===``?(0,c.jsx)(Z,{component:`span`,size:`sm`,c:`dimmed`,fs:`italic`,children:n}):(0,c.jsx)(Z,{component:`div`,size:`sm`,fw:500,style:{overflowWrap:`anywhere`},children:e.value}),e.hint!=null&&(0,c.jsx)(Z,{component:`div`,size:`xs`,c:`dimmed`,mt:2,style:{overflowWrap:`anywhere`},children:e.hint})]})]},t))})}(0,o.forwardRef)(function({current:e=`page`,active:t,...n},r){return(0,c.jsx)(wu,{ref:r,active:t,"aria-current":t?e:void 0,...n})});function zd({title:e,eyebrow:t,description:n,meta:r,actions:i,order:a=1,withDivider:o=!1}){let s=(0,c.jsxs)($,{component:`header`,gap:a===1?6:4,children:[t!=null&&(0,c.jsx)(Z,{component:`div`,size:`xs`,fw:600,tt:`uppercase`,lts:`0.08em`,c:`dimmed`,children:t}),(0,c.jsxs)(Is,{justify:`space-between`,align:`flex-start`,wrap:`wrap`,gap:`md`,children:[(0,c.jsxs)($,{gap:a===1?6:4,flex:`1 1 24rem`,miw:0,children:[(0,c.jsx)(Ju,{order:a,style:{textWrap:`balance`},children:e}),n!=null&&(0,c.jsx)(Z,{component:`div`,c:`dimmed`,size:a===1?`md`:`sm`,maw:`65ch`,children:n}),r!=null&&(0,c.jsx)(Z,{component:`div`,size:`sm`,c:`dimmed`,mt:2,children:r})]}),i!=null&&(0,c.jsx)(Is,{gap:`sm`,wrap:`wrap`,children:i})]})]});return o?(0,c.jsxs)($,{gap:`md`,children:[s,(0,c.jsx)(au,{})]}):s}var Bd={sm:12,md:14,lg:16};function Vd({tone:e,children:t,icon:n,variant:r,size:i=`md`}){let a=Cd(e),o=n===!1?null:n??(Dd(e)?(0,c.jsx)(Od,{tone:e,size:Bd[i],weight:`bold`}):null),s=r??(e===`neutral`?`outline`:`light`),l=s===`outline`&&a===xd.neutral?{root:{"--badge-bd":`1px solid var(--labstack-control-border, var(--mantine-color-default-border))`,"--badge-color":`var(--labstack-muted, var(--mantine-color-dimmed))`}}:void 0;return(0,c.jsx)(Gl,{color:a,variant:s,vars:l?()=>l:void 0,size:i,tt:`none`,fw:500,leftSection:o??void 0,styles:{root:{flexShrink:0,maxWidth:`none`},label:{whiteSpace:`nowrap`,overflow:`visible`}},children:t})}function Hd(e){if(!/^#?(?:[\da-f]{3}|[\da-f]{6})$/i.test(e))throw Error(`Expected a 3- or 6-digit hex color, received ${e}`);let t=e.replace(/^#/,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=[0,2,4].map(e=>{let t=Number.parseInt(n.slice(e,e+2),16)/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4});return r[0]*.2126+r[1]*.7152+r[2]*.0722}function Ud(e,t){let n=Hd(e),r=Hd(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Wd(e){return Ud(e,`#000000`)>Ud(e,`#ffffff`)?`#000000`:`#ffffff`}var Gd={primary:`ink`,accent:[`#F1F0FF`,`#E4E2FF`,`#CDC9FF`,`#B5B0FF`,`#A29CFF`,`#8F8CFF`,`#756DEB`,`#5A50D8`,`#463DAE`,`#332B81`],colors:{ok:[`#eefbe6`,`#dcf7cc`,`#c2f0a6`,`#a5e880`,`#8fe06c`,`#7fd962`,`#66c04b`,`#4f9c3a`,`#3b7a2c`,`#2a5a1f`],warn:[`#fff5e6`,`#ffe9c9`,`#ffd79b`,`#ffc571`,`#ffbc62`,`#ffb454`,`#ef9c33`,`#c87d21`,`#9c5f16`,`#74460f`],bad:[`#fdecee`,`#fbd9dc`,`#f8b6bc`,`#f59099`,`#f37d87`,`#f26d78`,`#e04d5a`,`#c03642`,`#96262f`,`#6f1a21`],info:[`#e8f6ff`,`#ccebff`,`#a3daff`,`#7dcbff`,`#66c5ff`,`#59c2ff`,`#33a7e6`,`#1e86bd`,`#146694`,`#0d4a6d`]},tones:{success:`ok`,warning:`warn`,danger:`bad`,info:`info`},fontFamily:`"Geist Variable", "Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,fontFamilyMonospace:`"Geist Mono Variable", "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,displayWeight:600,radius:`soft`,elevation:`bordered`,density:`compact`,controlSizes:{sm:32,md:36,lg:40},focus:`ring`,surfaces:{light:{ground:`#F5F5F6`,raised:`#FFFFFF`,inset:`#EFEFF1`,hover:`#EDEDEF`,border:`#E3E3E6`,borderSoft:`#ECECEE`,controlBorder:`#6D6D73`,text:`#111113`,muted:`#53535B`},dark:{ground:`#0B0B0C`,raised:`#121214`,inset:`#08080A`,hover:`#1A1A1D`,border:`#232327`,borderSoft:`#1A1A1E`,controlBorder:`#828288`,text:`#EDEDEF`,muted:`#A1A1A9`}},typeScale:{small:12,body:14,title:16,section:20,page:28},chart:{series:{light:[`#2a78d6`,`#eb6834`,`#19a170`,`#4a3aa7`,`#bd8000`,`#ce6d92`],dark:[`#3987e5`,`#d95926`,`#199e70`,`#9085e9`,`#c98500`,`#d55181`]}}},Kd={micro:11,small:12,body:14,title:16,section:22,page:28},qd={prose:720,article:960,page:1200,app:1500},Jd={light:7,dark:5},Yd={square:{control:0,surface:0,overlay:0},soft:{control:4,surface:8,overlay:12},round:{control:6,surface:16,overlay:24}};function Xd(e){return`#${e.map(e=>Math.round(e).toString(16).padStart(2,`0`)).join(``)}`}function Zd(e,t,n){let r=e=>{let t=e.replace(/^#/,``);return t.length===3?[...t].map(e=>e+e).join(``):t},i=r(e),a=r(t);return Xd([0,2,4].map(e=>{let t=Number.parseInt(i.slice(e,e+2),16);return t+(Number.parseInt(a.slice(e,e+2),16)-t)*n}))}function Qd(e,t){if(typeof e!=`string`||!/^#(?:[\da-f]{3}|[\da-f]{6})$/i.test(e))throw Error(`${t} must be opaque 3/6-digit hex`)}var $d=new WeakSet;function ef(e){let t=e.currentTarget;!t.readOnly&&!t.disabled&&t.select()}function tf(e){let t=e.currentTarget;$d.delete(t),t!==t.ownerDocument.activeElement&&!t.readOnly&&!t.disabled&&($d.add(t),t.select())}function nf(e){$d.delete(e.currentTarget)&&!e.currentTarget.readOnly&&e.currentTarget.select()}function rf(e,t,n){let r=e=>t.every(t=>Ud(e,t)>=n);if(r(e))return e;let i=[`#000000`,`#ffffff`].find(r);if(!i)throw Error(`Neutral surfaces cannot share accessible text`);for(let t=1;t<=100;t++){let n=Zd(e,i,t/100);if(r(n))return n}return i}function af(e,t){if(!Number.isFinite(t))throw Error(`neutralTint hue must be finite`);let n=(t%360+360)%360;return e.map(e=>{let t=[1,3,5].map(t=>Number.parseInt(e.slice(t,t+2),16)/255),r=(Math.max(...t)+Math.min(...t))/2,i=.08*Math.min(r,1-r);return Xd([0,8,4].map(e=>{let t=(e+n/30)%12;return 255*(r-i*Math.max(-1,Math.min(t-3,9-t,1)))}))})}function of(e,t){let n=Ie({color:e,theme:t});if(n.isThemeColor)return`var(--labstack-color-${n.color}${n.shade===void 0?``:`-${n.shade}`}-contrast)`;if(/^#(?:[\da-f]{3}|[\da-f]{6})$/i.test(e))return Wd(e)}var sf=e=>{let t=e.color||e.theme.primaryColor,n=e.variant??`filled`,r=Ue({...e,color:t,variant:n});if(n!==`filled`||e.autoContrast===!1)return r;let i=of(t,e.theme);if(!i)return r;let a=Ie({color:t,theme:e.theme});return{...r,color:i,...a.isThemeColor&&a.shade!==void 0?{hover:`var(--labstack-color-${a.color}-${a.shade}-hover)`}:a.isThemeColor?{}:{hover:rf(Zd(t,`#000000`,.1),[i],4.5)}}};function cf(e,t){return t.iconColor||!(t.autoContrast??e.autoContrast)?void 0:of(t.color||e.primaryColor,e)}function lf(e){let t=/^var\(--mantine-color-(.+)-(filled|\d)\)$/.exec(e??``);return t?`var(--labstack-color-${t[1]}${t[2]===`filled`?``:`-${t[2]}`}-contrast)`:e&&/^#(?:[\da-f]{3}|[\da-f]{6})$/i.test(e)?Wd(e):void 0}function uf(e,t){return o.Children.map(e,e=>(0,o.isValidElement)(e)?e.props.__vars?.[`--sc-label-color`]?(0,o.cloneElement)(e,{__vars:{...e.props.__vars,"--sc-label-color":t}}):e.props.children?(0,o.cloneElement)(e,{children:uf(e.props.children,t)}):e:e)}function df(e,t,n){let{gray:r,dark:i}=e.colors,a=t===`dark`,o=n.surfaces?.[t];if(n.surfaces&&!o)throw Error(`surfaces (${t}) ground/raised/inset/hover are required`);if(o){for(let e of[`ground`,`raised`,`inset`,`hover`])Qd(o[e],`surfaces (${t}) ${e}`);for(let[e,n]of Object.entries(o))n!==void 0&&Qd(n,`surfaces (${t}) ${e}`)}let s=o?.ground??(a?i[7]:r[0]),c=o?.raised??(a?i[6]:e.white),l=o?.inset??(a?i[8]:r[1]),u=o?.hover??(a?i[5]:r[2]),d=(e,t=!1)=>a?Zd(c,e[5],t?.22:.15):e[t?2:1],f=[s,c,l,u],p=[s,c,l,u,...[...new Set([`brand`,...n.accent?[`accent`]:[],...Object.values(e.other.labstackTones).map(t=>Ie({color:t,theme:e}).color)])].flatMap(t=>{let n=e.colors[t];return n?[d(n),d(n,!0)]:[]})],m=Ie({color:e.other.labstackTones.danger,theme:e}).color,h=Ie({color:e.other.labstackTones.neutral,theme:e}).color,g=(e,n,r)=>{let i=o?.[e];if(i===void 0)try{return rf(n,e===`controlBorder`?f:p,r)}catch{throw Error(`surfaces (${t}) ${e} cannot meet ${r}:1 on every surface`)}if(p.some(e=>Ud(i,e)[`--labstack-${e}`,t]));if(o?.borderSoft!==void 0&&(n.primary===`ink`||Object.values(e.other.labstackTones).some(t=>Ie({color:t,theme:e}).color===`ink`)))for(let e of[v.hover,v[`border-soft`]]){let n=Ud(v.text,e);if(n<4.5)throw Error(`surfaces (${t}) borderSoft makes ink light hover text ${n.toFixed(2)}:1; need 4.5:1`)}n.elevation===`ring`&&(y[`--labstack-ring`]=a?`0 0 0 1px rgba(255,255,255,.09), 0 2px 2px rgba(0,0,0,.12)`:`0 0 0 1px rgba(0,0,0,.08), 0 2px 2px rgba(0,0,0,.04)`);let b=e=>`var(--labstack-${e})`;Object.assign(y,{"--mantine-color-body":b(`ground`),"--mantine-color-text":b(`text`),"--mantine-color-dimmed":b(`muted`),"--mantine-color-placeholder":b(`muted`),"--mantine-color-anchor":`var(--mantine-color-${n.accent?`accent`:`brand`}-text)`,"--labstack-focus":`var(--mantine-color-${n.accent?`accent`:`brand`}-text)`,"--labstack-selected":`var(--mantine-color-${n.accent?`accent`:`brand`}-light)`,"--labstack-selected-text":`var(--mantine-color-${n.accent?`accent`:`brand`}-text)`,"--mantine-color-disabled":b(`inset`),"--mantine-color-disabled-color":b(`faint`),"--mantine-color-disabled-border":b(`border`),...n.controlSizes?{"--labstack-control-sm":`${n.controlSizes.sm}px`,"--labstack-control-md":`${n.controlSizes.md}px`,"--labstack-control-lg":`${n.controlSizes.lg}px`}:{},"--mantine-color-default":b(`raised`),"--mantine-color-default-hover":b(`hover`),"--mantine-color-default-color":b(`text`),"--mantine-color-default-border":b(`control-border`),"--mantine-color-error":`var(--mantine-color-${m}-text)`,"--mantine-primary-color-contrast":`var(--labstack-color-brand-contrast)`});for(let[n,o]of Object.entries(e.colors)){let s=Jd[t];if((n===m||n===`red`)&&Wd(o[s])===`#000000`){for(let e=s+1;e<=9;e++)if(Ud(`#ffffff`,o[e])>=4.5){s=e;break}}let c=s,l=o[c],u=(n===m||n===`red`)&&Ud(`#ffffff`,l)>=4.5?`#ffffff`:Wd(l),g=e=>o[e===9?8:e+1],_=d(o),v=d(o,!0),b=o[a?Math.max(c-4,0):c],x=[...n===`brand`||n===`accent`||n===h||n===m?p:f,_,v,...n===m?[a?i[6]:e.white,a?i[5]:r[1]]:[],...f.map(e=>Zd(e,b,.05))],S;for(let e=c;e>=0&&e<=9;e+=a?-1:1)if(x.every(t=>Ud(o[e],t)>=4.5)){S=o[e];break}S??=rf(a?o[2]:o[9],x,4.5),Object.assign(y,{[`--labstack-color-${n}-contrast`]:u,[`--mantine-color-${n}-filled`]:l,[`--mantine-color-${n}-filled-hover`]:rf(g(c),[u],4.5),[`--mantine-color-${n}-text`]:S,[`--mantine-color-${n}-light`]:_,[`--mantine-color-${n}-light-hover`]:v,[`--mantine-color-${n}-light-color`]:S,[`--mantine-color-${n}-outline`]:S}),o.forEach((e,t)=>{let r=Wd(e);y[`--labstack-color-${n}-${t}-contrast`]=r,y[`--labstack-color-${n}-${t}-hover`]=rf(g(t),[r],4.5)})}for(let t of[...n.primary===`ink`?[`brand`]:[],...Object.values(e.other.labstackTones).includes(`ink`)?[`ink`]:[]]){let e=v.text,n=Wd(e);Object.assign(y,{[`--mantine-color-${t}-filled`]:e,[`--mantine-color-${t}-filled-hover`]:rf(v.muted,[n],4.5),[`--labstack-color-${t}-contrast`]:n,[`--mantine-color-${t}-text`]:e,[`--mantine-color-${t}-light-color`]:e,[`--mantine-color-${t}-outline`]:e,[`--mantine-color-${t}-light`]:v.hover,[`--mantine-color-${t}-light-hover`]:v[`border-soft`]})}if(o)for(let e of[`gray`,`dark`])Object.assign(y,{[`--mantine-color-${e}-light`]:v.hover,[`--mantine-color-${e}-light-hover`]:v[`border-soft`],[`--mantine-color-${e}-light-color`]:v.text});for(let[e,r]of Object.entries(n.variants??{})){let n=r[t];for(let[r,i]of Object.entries(n))if(i!==void 0&&(r!==`background`&&r!==`hover`||i!==`transparent`)&&!/^#(?:[\da-f]{3}|[\da-f]{6})$/i.test(i))throw Error(`Variant ${e} (${t}) ${r} must be opaque hex`);let i=[n.background,n.hover??n.background].flatMap(e=>e===`transparent`?f:[e]),a=n.color??(n.background===`transparent`?v.text:Wd(n.background));if(i.some(e=>Ud(a,e)<4.5))throw Error(`Variant ${e} (${t}) text must meet 4.5:1 at rest and hover`);let o=n.border;if(o&&[...f,...i].some(e=>Ud(o,e)<3))throw Error(`Variant ${e} (${t}) border must meet 3:1`);Object.assign(y,{[`--labstack-variant-${e}-background`]:n.background,[`--labstack-variant-${e}-hover`]:n.hover??n.background,[`--labstack-variant-${e}-color`]:a,[`--labstack-variant-${e}-border`]:n.border??`transparent`})}return y}var ff=[`NavLink`,`Tabs`,`Checkbox`,`Radio`,`Switch`,`Pagination`,`Chip`,`Stepper`,`Slider`,`RangeSlider`];function pf(e=Gd){if(!e.displayFont&&(e.displayWeight===700||e.displayTracking===-.03))throw Error(`Weight 700 and tracking -0.03em require displayFont`);let t=new Set([`filled`,`light`,`outline`,`subtle`,`transparent`,`white`,`default`,`gradient`]);for(let n of Object.keys(e.variants??{}))if(!/^[a-z][a-z0-9-]*$/.test(n)||t.has(n))throw Error(`Variant ${n} must be a new kebab-case name`);let n=e.lineWeight===void 0||e.lineWeight===1?{}:{borderWidth:`${e.lineWeight}px`},r=e.displayFont?{fontFamily:e.displayFont,fontWeight:e.displayWeight??650}:{},i=`${e.displayTracking??-.02}em`,a=Object.fromEntries(Object.entries(xd).map(([t,n])=>[t,e.tones?.[t]??n]));for(let[t,n]of Object.entries(e.colors??{})){if([`brand`,`ink`,`accent`].includes(t)||Object.hasOwn(rt.colors,t))throw Error(`colors ${t} cannot replace a built-in palette`);if(!Array.isArray(n)||n.length!==10)throw Error(`colors ${t} must have exactly ten colors`);for(let e of n)Qd(e,`colors ${t}`)}if(e.accent!==void 0){if(!Array.isArray(e.accent)||e.accent.length!==10)throw Error(`accent must have exactly ten colors`);for(let t of e.accent)Qd(t,`accent`)}if(e.surfaces){let t=new Set([...Object.keys(rt.colors),`brand`,`ink`,...e.accent?[`accent`]:[],...Object.keys(e.colors??{})]);for(let[n,r]of Object.entries({...a,...typeof e.primary==`string`?{primary:e.primary}:{}})){let e=r.replace(/\.\d$/,``);if(!t.has(e))throw Error(`tones ${n} uses unregistered palette ${e}; pass it in brand.colors`)}}let s={...Kd};for(let t of[`small`,`body`,`title`,`section`,`page`])s[t]=e.typeScale?.[t]??Kd[t];for(let t of Object.keys(e.typeScale??{}))if(![`small`,`body`,`title`,`section`,`page`].includes(t))throw Error(`typeScale ${t} is not a brand input`);let c={small:[12,14],body:[14,16],title:[16,20],section:[20,28],page:[28,36]},l=0;for(let e of Object.keys(c)){let t=s[e],[n,r]=c[e];if(!Number.isInteger(t)||tr||t<=l&&(e!==`body`||t!==14||l!==14))throw Error(`typeScale ${e} must be an integer in ${n}–${r} and increase strictly (small/body may both be 14)`);l=t}let u=typeof e.radius==`object`?e.radius:Yd[e.radius??`soft`],d=0;for(let e of[`control`,`surface`,`overlay`]){if(!u||!Number.isInteger(u[e])||u[e]32)throw Error(`radius ${e} must be an integer with 0 ≤ control ≤ surface ≤ overlay ≤ 32`);d=u[e]}if(e.density!==void 0&&![`default`,`compact`].includes(e.density))throw Error(`density must be default or compact`);if(e.focus!==void 0&&![`ring`,`border`].includes(e.focus))throw Error(`focus input must be ring or border`);if(e.elevation!==void 0&&![`bordered`,`shadow`,`ring`].includes(e.elevation))throw Error(`elevation must be bordered, shadow or ring`);if(e.controlSizes){let t=23;for(let n of[`sm`,`md`,`lg`]){let r=e.controlSizes[n];if(!Number.isInteger(r)||r<=t||r>56)throw Error(`controlSizes ${n} must be an integer with 24 ≤ sm < md < lg ≤ 56`);t=r}}let f=e.density===`compact`?{size:`sm`}:{},p=u.control===0?{radius:0}:{},m=t=>e.controlSizes?Object.fromEntries([`xs`,`sm`,`md`,`lg`,`xl`].map(n=>[`--${t}-${n}`,`${e.controlSizes?.[n===`xs`?`sm`:n===`xl`?`lg`:n]}px`])):{},h=e=>`${e/16}rem`,g=e.elevation===`shadow`,_=typeof e.neutralTint==`number`?{gray:af(rt.colors.gray,e.neutralTint),dark:af(rt.colors.dark,e.neutralTint)}:e.neutralTint,v={defaultProps:{radius:u.surface,withBorder:!g&&e.elevation!==`ring`,shadow:g?`xs`:`none`},styles:(t,r)=>({root:{backgroundColor:`var(--labstack-raised)`,borderColor:`var(--labstack-border)`,...n,...r.variant===`outline`?{border:`${e.lineWeight??1}px solid var(--labstack-border)`,boxShadow:`none`}:r.variant===`flat`?{backgroundColor:`var(--labstack-inset)`,border:`none`,boxShadow:`none`}:e.elevation===`ring`&&(r.shadow??`none`)===`none`?{boxShadow:`var(--labstack-ring)`}:{}}})},y=pt({primaryColor:`brand`,primaryShade:Jd,colors:{...e.colors,...e.accent?{accent:e.accent}:{},..._,...Object.values(a).includes(`ink`)?{ink:_?.gray??rt.colors.gray}:{},brand:e.primary===`ink`?_?.gray??rt.colors.gray:e.primary},fontFamily:e.fontFamily??rt.fontFamily,fontFamilyMonospace:e.fontFamilyMonospace??rt.fontFamilyMonospace,fontSizes:{xs:h(s.small),sm:h(s.body),md:h(s.body),lg:h(s.title),xl:h(s.section)},lineHeights:{xs:`1.5`,sm:`1.5`,md:`1.5`,lg:`1.5`,xl:`1.5`},headings:{...e.displayFont?{fontFamily:e.displayFont}:{},fontWeight:String(e.displayWeight??650),textWrap:`balance`,sizes:{h1:{fontSize:h(s.page),lineHeight:`1.25`},h2:{fontSize:h(s.section),lineHeight:`1.25`},h3:{fontSize:h(s.title),lineHeight:`1.25`},h4:{fontSize:h(s.body),lineHeight:`1.25`},h5:{fontSize:h(s.small),lineHeight:`1.25`},h6:{fontSize:h(s.small),lineHeight:`1.25`}}},defaultRadius:`sm`,radius:{xs:`${u.control}px`,sm:`${u.control}px`,md:`${u.surface}px`,lg:`${u.overlay}px`,xl:`${u.overlay}px`},respectReducedMotion:!0,autoContrast:!0,variantColorResolver:t=>{let n=t.variant??`filled`;if(!Object.hasOwn(e.variants??{},n))return sf(t);let r=e=>`var(--labstack-variant-${n}-${e})`;return{background:r(`background`),hover:r(`hover`),color:r(`color`),border:`${e.lineWeight??1}px solid ${r(`border`)}`}},components:{Paper:v,Card:v,Button:{defaultProps:{radius:u.control,...f},...e.controlSizes?{vars:()=>({root:m(`button-height`)})}:{},styles:(t,i)=>({root:{...r,...n,...e.variants?.[i.variant??`filled`]?.underline?{textDecoration:`underline`,textUnderlineOffset:`0.2em`}:{}}})},Accordion:{styles:{control:r,item:n}},Text:{styles:(e,t)=>({root:t.variant===`numeral`?{...r,letterSpacing:i,fontVariantNumeric:`tabular-nums`}:{}})},Select:{defaultProps:{...f,checkIconPosition:`right`,onFocus:ef,onMouseDown:tf,onClick:nf}},Autocomplete:{defaultProps:{...f,onFocus:ef,onMouseDown:tf,onClick:nf}},...e.density===`compact`?{TextInput:{defaultProps:f},MultiSelect:{defaultProps:f},NumberInput:{defaultProps:f},PasswordInput:{defaultProps:f},Textarea:{defaultProps:f},TagsInput:{defaultProps:f},PillsInput:{defaultProps:f},JsonInput:{defaultProps:f},NativeSelect:{defaultProps:f},ColorInput:{defaultProps:f},FileInput:{defaultProps:f}}:{},Anchor:{defaultProps:{underline:`always`}},Blockquote:{vars:(e,t)=>t.color?{root:{}}:{root:{"--bq-bd":`var(--labstack-border)`,"--bq-bg-light":`transparent`,"--bq-bg-dark":`transparent`}}},Code:{styles:{root:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,color:`var(--mantine-color-text)`}}},InputWrapper:{styles:{label:r},defaultProps:{inputWrapperOrder:[`label`,`input`,`description`,`error`]}},PinInput:{defaultProps:{placeholder:``}},Rating:{defaultProps:{color:a.warning}},Table:{defaultProps:{verticalSpacing:`xs`,horizontalSpacing:`sm`,...e.density===`compact`?{fz:`sm`}:{}},vars:(e,t)=>({table:{"--table-border-color":t.borderColor?void 0:`var(--labstack-border)`,"--table-striped-color":t.stripedColor?void 0:`color-mix(in srgb, var(--labstack-text) 4%, transparent)`,"--table-highlight-on-hover-color":t.highlightOnHoverColor?void 0:`var(--labstack-hover)`}}),styles:{td:{fontVariantNumeric:`tabular-nums`},th:{whiteSpace:`nowrap`,...e.lineWeight&&e.lineWeight!==1?{borderBottom:`${e.lineWeight}px solid var(--labstack-border)`}:{}}}},ActionIcon:{defaultProps:{radius:u.control,...f},...e.controlSizes?{vars:()=>({root:{...m(`ai-size`),...m(`ai-size-input`)}})}:{},styles:{root:n}},...e.focus===`border`?{PinInput:{defaultProps:{placeholder:``},classNames:{input:`labstack-border-focus`}},Combobox:{classNames:{search:`labstack-border-focus`}}}:{},Input:{...e.focus===`border`?{classNames:{input:`labstack-border-focus`}}:{},styles:{input:n},defaultProps:{radius:u.control,...f},vars:(e,t)=>({wrapper:{...m(`input-height`),"--input-bg":(t.variant??`default`)==="default"&&!t.disabled?`var(--labstack-raised)`:void 0,"--input-bd":(t.variant??`default`)==="default"&&!t.disabled&&!t.error&&!t.success?`var(--labstack-control-border)`:void 0}})},Skeleton:{defaultProps:{radius:u.control},classNames:{root:`labstack-Skeleton-root`}},ThemeIcon:{defaultProps:{radius:u.control}},Title:{styles:{root:{letterSpacing:i}}},Badge:{defaultProps:{variant:`light`,fw:600,tt:`none`,...f},styles:{root:{height:`auto`,maxWidth:`100%`,minHeight:`var(--badge-height)`},label:{whiteSpace:`normal`,overflowWrap:`anywhere`}},vars:(t,n)=>({root:{...[`xs`,`sm`,`md`].includes(n.size??`md`)?{"--badge-fz":`calc(0.75rem * var(--mantine-scale))`}:{},...e.primary===`ink`&&n.color===void 0&&(n.variant??`light`)===`light`?{"--badge-bg":`var(--labstack-inset)`,"--badge-color":`var(--labstack-text)`,"--badge-bd":`1px solid var(--labstack-border)`}:{}}})},Modal:{defaultProps:{centered:!0,radius:u.overlay,shadow:`lg`,overlayProps:{blur:3},closeButtonProps:{"aria-label":`Close`}},styles:{header:{background:`var(--labstack-raised)`},title:{fontWeight:e.displayWeight??650,fontSize:h(s.title)}}},Drawer:{defaultProps:{shadow:`lg`,closeButtonProps:{"aria-label":`Close`}},styles:{header:{background:`var(--labstack-raised)`},title:{fontWeight:e.displayWeight??650,fontSize:h(s.title)}}},Tooltip:{defaultProps:{radius:u.control},styles:{tooltip:{fontSize:h(s.small)}}},Alert:{defaultProps:{color:a.info,variant:`light`}},MultiSelect:{defaultProps:{checkIconPosition:`right`,...f}},Menu:{defaultProps:{withInitialFocusPlaceholder:!1,radius:u.overlay,shadow:`md`},styles:{dropdown:{background:`var(--labstack-raised)`,borderColor:`var(--labstack-border)`,...n}}},Popover:{defaultProps:{radius:u.overlay,shadow:`md`},styles:{dropdown:{background:`var(--labstack-raised)`,borderColor:`var(--labstack-border)`,...n}}},Divider:{vars:(e,t)=>({root:{"--divider-color":t.color?void 0:`var(--labstack-border-soft)`}})},Switch:{classNames:{track:`labstack-Switch-track`},defaultProps:{withThumbIndicator:!1,...p},vars:(e,t)=>({track:{"--labstack-switch-contrast":e.autoContrast?of(t.color||e.primaryColor,e):void 0}})},Checkbox:{styles:{input:n,label:r},vars:(e,t)=>({root:{"--checkbox-icon-color":cf(e,t)}})},CheckboxIndicator:{vars:(e,t)=>({indicator:{"--checkbox-icon-color":cf(e,t)}})},Radio:{styles:{radio:n,label:r},vars:(e,t)=>({root:{"--radio-icon-color":cf(e,t)}})},RadioIndicator:{vars:(e,t)=>({indicator:{"--radio-icon-color":cf(e,t)}})},SegmentedControl:{styles:{label:r},vars:(e,t)=>({root:{"--labstack-sc-contrast":t.color&&(t.autoContrast??e.autoContrast)?of(t.color,e):void 0}}),defaultProps:{...f,renderRoot:e=>{let t=e.style?.[`--labstack-sc-contrast`];return(0,o.createElement)(`div`,e,t?uf(e.children,t):e.children)}}},Stepper:{vars:(e,t)=>({root:{"--stepper-icon-color":t.autoContrast??e.autoContrast?of(t.color||e.primaryColor,e):void 0,"--labstack-step-icon-opt-out":t.autoContrast??e.autoContrast?void 0:`var(--mantine-color-white)`}})},StepperStep:{defaultProps:{renderRoot:e=>{let t=e.style,n=lf(t?.[`--step-color`]);return(0,o.createElement)(`button`,{type:`button`,...e,style:{...n?{"--stepper-icon-color":`var(--labstack-step-icon-opt-out, ${n})`}:{},...t}})}}},ProgressSection:{defaultProps:{renderRoot:e=>{let t=e.style,n=lf(t?.[`--progress-section-color`]);return(0,o.createElement)(`div`,{...e,style:{...t,...n&&t?.[`--progress-label-color`]?{"--progress-label-color":n}:{}}})}}},Tabs:{vars:(e,t)=>({root:{"--tabs-text-color":of(t.color||e.primaryColor,e)}})},TabsTab:{defaultProps:{styles:(e,t)=>({tab:{"--tabs-text-color":t.color?of(t.color,e):void 0}})}},...e.controlSizes?{Avatar:{vars:()=>({root:{"--avatar-size-sm":`${e.controlSizes?.sm}px`,"--avatar-size-md":`${e.controlSizes?.md}px`,"--avatar-size-lg":`${e.controlSizes?.lg}px`}})}}:{},Slider:{defaultProps:{...p}},RangeSlider:{defaultProps:{...p}},Chip:{defaultProps:{variant:`filled`,...f,...p},...e.controlSizes?{vars:()=>({root:m(`chip-size`)})}:{}},Pagination:{defaultProps:{...f,getControlProps:e=>({"aria-label":{first:`First page`,previous:`Previous page`,next:`Next page`,last:`Last page`}[e]})},vars:(e,t)=>({root:{...m(`pagination-control-size`),"--pagination-active-color":of(t.color||e.primaryColor,e)}})}},other:{labstackTones:a,labstack:{typeScale:s,contentWidths:qd}}});if(e.accent){y.components??={};let e=y.components,t=e.SegmentedControl??{},n=t.vars;e.SegmentedControl={...t,vars:(e,t,r)=>{let i=(typeof n==`function`?n(e,t,r):n)??{};return t.color?i:{...i,root:{...i.root,"--sc-color":`var(--mantine-color-accent-light)`,"--sc-label-color":`var(--mantine-color-accent-text)`}}}};for(let t of ff){let n=e[t]??{};e[t]={...n,defaultProps:{...n.defaultProps,color:`accent`}}}}let b=ct(rt,y),x=t=>{let n=df(b,t,e),r=e.chart?.series?.[t];if(e.chart?.series&&!r)throw Error(`chart.series.${t} is required`);let i=r??(t===`light`?[`#2a78d6`,`#eb6834`,`#1aa674`,`#4a3aa7`,`#c28400`,`#d57197`]:[`#3987e5`,`#d95926`,`#199e70`,`#9085e9`,`#c98500`,`#d55181`]);if(i.length!==6)throw Error(`chart.series (${t}) series must have exactly six colors`);let a=Array.from(i,(e,i)=>{if(Qd(e,`chart.series (${t}) series[${i}]`),!r)return rf(e,[n[`--labstack-raised`]],3);if(Ud(e,n[`--labstack-raised`])<3)throw Error(`chart.series (${t}) series[${i}] must meet 3:1 on raised`);return e});return{text:n[`--labstack-text`],muted:n[`--labstack-muted`],grid:n[`--labstack-border-soft`],surface:n[`--labstack-raised`],border:n[`--labstack-border`],series:a}};return{theme:y,chart:{light:x(`light`),dark:x(`dark`)},cssVariablesResolver:t=>({variables:{},light:df(t,`light`,e),dark:df(t,`dark`,e)})}}var mf=new Map([[`bold`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z`}))],[`duotone`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z`,opacity:`0.2`}),o.createElement(`path`,{d:`M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`fill`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z`}))]]),hf=new Map([[`bold`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z`}))],[`duotone`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,40V168H168V88H88V40Z`,opacity:`0.2`}),o.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`fill`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32Zm-8,128H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`light`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,34H88a6,6,0,0,0-6,6V82H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H168a6,6,0,0,0,6-6V174h42a6,6,0,0,0,6-6V40A6,6,0,0,0,216,34ZM162,210H46V94H162Zm48-48H174V88a6,6,0,0,0-6-6H94V46H210Z`}))],[`regular`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`thin`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,36H88a4,4,0,0,0-4,4V84H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H168a4,4,0,0,0,4-4V172h44a4,4,0,0,0,4-4V40A4,4,0,0,0,216,36ZM164,212H44V92H164Zm48-48H172V88a4,4,0,0,0-4-4H92V44H212Z`}))]]),gf=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:mf}));gf.displayName=`CheckIcon`;var _f=gf,vf=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:hf}));vf.displayName=`CopyIcon`;var yf=vf,bf={small:{fontSize:15,gap:12,tracking:`0.16em`},regular:{fontSize:18,gap:14,tracking:`0.17em`},large:{fontSize:22,gap:16,tracking:`0.18em`}};function xf({size:e=`regular`}){let t=bf[e];return(0,c.jsxs)(Is,{component:`span`,gap:t.gap,wrap:`nowrap`,"aria-label":`Fanout`,children:[(0,c.jsx)(Sf,{size:e}),(0,c.jsx)(Z,{component:`span`,fz:t.fontSize,fw:800,lh:1,lts:t.tracking,tt:`uppercase`,children:`Fanout`})]})}function Sf({size:e=`regular`}){let t={small:32,regular:46,large:50}[e];return(0,c.jsx)(Vu,{size:t,variant:`transparent`,"aria-hidden":`true`,children:(0,c.jsx)(Cf,{})})}function Cf(){let e=(0,o.useId)().replace(/[^a-zA-Z0-9-]/g,``),t=`fo-top-${e}`,n=`fo-mid-${e}`,r=`fo-bot-${e}`;return(0,c.jsxs)(`svg`,{viewBox:`35 44 200 200`,width:`100%`,height:`100%`,"aria-hidden":`true`,children:[(0,c.jsxs)(`defs`,{children:[(0,c.jsxs)(`linearGradient`,{id:t,x1:`54`,y1:`52`,x2:`210`,y2:`104`,gradientUnits:`userSpaceOnUse`,children:[(0,c.jsx)(`stop`,{offset:`0`,stopColor:`#5FE8CE`}),(0,c.jsx)(`stop`,{offset:`0.55`,stopColor:`#81E4B9`}),(0,c.jsx)(`stop`,{offset:`1`,stopColor:`#D9F276`})]}),(0,c.jsxs)(`linearGradient`,{id:n,x1:`58`,y1:`112`,x2:`176`,y2:`154`,gradientUnits:`userSpaceOnUse`,children:[(0,c.jsx)(`stop`,{offset:`0`,stopColor:`#536FFF`}),(0,c.jsx)(`stop`,{offset:`0.52`,stopColor:`#41B6F8`}),(0,c.jsx)(`stop`,{offset:`1`,stopColor:`#66D0EE`})]}),(0,c.jsxs)(`linearGradient`,{id:r,x1:`58`,y1:`166`,x2:`145`,y2:`220`,gradientUnits:`userSpaceOnUse`,children:[(0,c.jsx)(`stop`,{offset:`0`,stopColor:`#725BFF`}),(0,c.jsx)(`stop`,{offset:`0.52`,stopColor:`#9A50F4`}),(0,c.jsx)(`stop`,{offset:`1`,stopColor:`#CB55E8`})]})]}),(0,c.jsx)(`path`,{d:`M58 116V88C58 67 75 52 96 52H191C204 52 212 61 212 72C212 84 203 94 191 94H101C82 94 67 102 58 116Z`,fill:`url(#${t})`}),(0,c.jsx)(`path`,{d:`M58 170V139C58 120 72 107 91 107H162C174 107 182 115 182 126C182 137 174 145 162 145H99C79 145 66 154 58 170Z`,fill:`url(#${n})`}),(0,c.jsx)(`path`,{d:`M58 219V188C58 170 71 157 89 157H126C138 157 146 165 146 176C146 187 138 195 126 195H100C89 195 84 200 84 211C84 225 74 235 61 235H58Z`,fill:`url(#${r})`})]})}export{Ko as $,pe as $t,Gl as A,on as At,nl as B,Ge as Bt,Vu as C,a as Cn,Sn as Ct,xu as D,K as Dt,Pu as E,fn as Et,ml as F,W as Ft,Is as G,ze as Gt,el as H,$e as Ht,ll as I,ft as It,vs as J,Ie as Jt,js as K,Re as Kt,cl as L,dt as Lt,Rl as M,Nt as Mt,Pl as N,G as Nt,tu as O,dn as Ot,X as P,mt as Pt,Xo as Q,be as Qt,ol as R,rt as Rt,Ju as S,l as Sn,Ln as St,$ as T,q as Tt,Zc as U,Je as Ut,tl as V,Ke as Vt,Xc as W,He as Wt,cs as X,U as Xt,ls as Y,Ee as Yt,ns as Z,H as Zt,gd as _,y as _n,Aa as _t,Md as a,te as an,go as at,$u as b,h as bn,pa as bt,Ud as c,N as cn,Eo as ct,Cd as d,T as dn,Ao as dt,fe as en,Uo as et,Vd as f,O as fn,La as ft,zd as g,b as gn,Ma as gt,pf as h,S as hn,Ia as ht,_f as i,ce as in,Po as it,Z as j,It as jt,Q as k,sn as kt,Rd as l,A as ln,uo as lt,bd as m,w as mn,Fa as mt,Sf as n,B as nn,Lo as nt,Ld as o,F as on,So as ot,qd as p,C as pn,Na as pt,Es as q,Le as qt,yf as r,le as rn,ho as rt,kd as s,P as sn,wo as st,xf as t,ue as tn,Vo as tt,Ad as u,E as un,Oo as ut,sd as v,_ as vn,ja as vt,Ru as w,bn as wt,Xu as x,d as xn,xr as xt,nd as y,g as yn,Pa as yt,rl as z,We as zt}; \ No newline at end of file +`},Gc=0,Kc=[];function qc(e){var t=o.useRef([]),n=o.useRef([0,0]),r=o.useRef(),i=o.useState(Gc++)[0],a=o.useState(hc)[0],s=o.useRef(e);o.useEffect(function(){s.current=e},[e]),o.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Us([e.lockRef.current],(e.shards||[]).map(Hc),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var c=o.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!s.current.allowPinchZoom;var i=Bc(e),a=n.current,o=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(o)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Nc(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Nc(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(o||c)&&(r.current=l),!l)return!0;var h=r.current||l;return zc(h,t,e,h===`h`?o:c,!0)},[]),l=o.useCallback(function(e){var n=e;if(Kc.length&&Kc[Kc.length-1]===a){var r=`deltaY`in n?Vc(n):Bc(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Uc(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var o=(s.current.shards||[]).map(Hc).filter(Boolean).filter(function(e){return e.contains(n.target)});(o.length>0?c(n,o[0]):!s.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=o.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Jc(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=o.useCallback(function(e){n.current=Bc(e),r.current=void 0},[]),f=o.useCallback(function(t){u(t.type,Vc(t),t.target,c(t,e.lockRef.current))},[]),p=o.useCallback(function(t){u(t.type,Bc(t),t.target,c(t,e.lockRef.current))},[]);o.useEffect(function(){return Kc.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,l,Oc),document.addEventListener(`touchmove`,l,Oc),document.addEventListener(`touchstart`,d,Oc),function(){Kc=Kc.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,l,Oc),document.removeEventListener(`touchmove`,l,Oc),document.removeEventListener(`touchstart`,d,Oc)}},[]);var m=e.removeScrollBar,h=e.inert;return o.createElement(o.Fragment,null,h?o.createElement(a,{styles:Wc(i)}):null,m?o.createElement(Tc,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Jc(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Yc=ac(oc,qc),Xc=o.forwardRef(function(e,t){return o.createElement(cc,Vs({},e,{ref:t,sideCar:Yc}))});Xc.classNames=cc.classNames;function Zc({keepMounted:e,keepMountedMode:t=`activity`,opened:n,onClose:r,id:i,transitionProps:a,onExitTransitionEnd:o,onEnterTransitionEnd:s,trapFocus:l,closeOnEscape:u,returnFocus:d,closeOnClickOutside:f,withinPortal:p,portalProps:m,lockScroll:h,children:g,zIndex:_,shadow:v,padding:y,__vars:b,unstyled:x,removeScrollProps:C,__handledEscapeEvents:T,...E}){let{_id:D,titleMounted:k,bodyMounted:A,shouldLockScroll:j,setTitleMounted:M,setBodyMounted:N}=Bs({id:i,transitionProps:a,opened:n,trapFocus:l,closeOnEscape:u,onClose:r,returnFocus:d,handledEscapeEvents:T}),{key:P,...ee}=C||{};return(0,c.jsx)(ns,{...m,withinPortal:p,children:(0,c.jsx)(Ls,{value:{opened:n,onClose:r,closeOnClickOutside:f,onExitTransitionEnd:o,onEnterTransitionEnd:s,transitionProps:{...a,keepMounted:e,keepMountedMode:t},getTitleId:()=>`${D}-title`,getBodyId:()=>`${D}-body`,titleMounted:k,bodyMounted:A,setTitleMounted:M,setBodyMounted:N,trapFocus:l,closeOnEscape:u,zIndex:_,unstyled:x},children:(0,c.jsx)(Xc,{enabled:j&&h,...ee,children:(0,c.jsx)(q,{...E,id:D,__vars:{...b,"--mb-z-index":(_||S(`modal`)).toString(),"--mb-shadow":O(v),"--mb-padding":w(y)},children:g})},P)})})}Zc.displayName=`@mantine/core/ModalBase`;function Qc(){let e=Rs();return(0,o.useEffect)(()=>(e.setBodyMounted(!0),()=>e.setBodyMounted(!1)),[]),e.getBodyId()}var $c={title:`m_615af6c9`,header:`m_b5489c3c`,inner:`m_60c222c7`,content:`m_fd1ab0aa`,close:`m_606cb269`,body:`m_5df29311`};function el({className:e,...t}){let n=Qc(),r=Rs();return(0,c.jsx)(q,{id:n,className:U({[$c.body]:!r.unstyled},e),...t})}el.displayName=`@mantine/core/ModalBaseBody`;function tl({className:e,onClick:t,...n}){let r=Rs();return(0,c.jsx)(js,{...n,onClick:e=>{r.onClose(),t?.(e)},className:U({[$c.close]:!r.unstyled},e),unstyled:r.unstyled})}tl.displayName=`@mantine/core/ModalBaseCloseButton`;function nl({transitionProps:e,className:t,innerProps:n,onKeyDown:r,style:i,ref:a,...o}){let s=Rs();return(0,c.jsx)(cs,{mounted:s.opened,transition:`pop`,...s.transitionProps,onExited:()=>{s.onExitTransitionEnd?.(),s.transitionProps?.onExited?.()},onEntered:()=>{s.onEnterTransitionEnd?.(),s.transitionProps?.onEntered?.()},...e,children:e=>(0,c.jsx)(`div`,{...n,className:U({[$c.inner]:!s.unstyled},n.className),children:(0,c.jsx)(ls,{active:s.opened&&s.trapFocus,innerRef:a,children:(0,c.jsx)(Ko,{...o,component:`section`,role:`dialog`,tabIndex:-1,"aria-modal":!0,"aria-describedby":s.bodyMounted?s.getBodyId():void 0,"aria-labelledby":s.titleMounted?s.getTitleId():void 0,style:[i,e],className:U({[$c.content]:!s.unstyled},t),unstyled:s.unstyled,children:o.children})})})})}nl.displayName=`@mantine/core/ModalBaseContent`;function rl({className:e,...t}){let n=Rs();return(0,c.jsx)(q,{component:`header`,className:U({[$c.header]:!n.unstyled},e),...t})}rl.displayName=`@mantine/core/ModalBaseHeader`;var il={duration:200,timingFunction:`ease`,transition:`fade`};function al(e){let t=Rs();return{...il,...t.transitionProps,...e}}function ol({onClick:e,transitionProps:t,style:n,visible:r,...i}){let a=Rs(),o=al(t);return(0,c.jsx)(cs,{mounted:r===void 0?a.opened:r,...o,transition:`fade`,children:t=>(0,c.jsx)(Xo,{fixed:!0,style:[n,t],zIndex:a.zIndex,unstyled:a.unstyled,onClick:t=>{e?.(t),a.closeOnClickOutside&&a.onClose()},...i})})}ol.displayName=`@mantine/core/ModalBaseOverlay`;function sl(){let e=Rs();return(0,o.useEffect)(()=>(e.setTitleMounted(!0),()=>e.setTitleMounted(!1)),[]),e.getTitleId()}function cl({className:e,...t}){let n=sl(),r=Rs();return(0,c.jsx)(q,{component:`h2`,className:U({[$c.title]:!r.unstyled},e),id:n,...t})}cl.displayName=`@mantine/core/ModalBaseTitle`;function ll({children:e}){return(0,c.jsx)(c.Fragment,{children:e})}var ul=(0,o.createContext)({size:`sm`}),dl=K(e=>{let t=W(`InputClearButton`,null,e),{size:n,variant:r,vars:i,classNames:a,styles:s,...l}=t,u=(0,o.use)(ul),{resolvedClassNames:d,resolvedStyles:f}=mt({classNames:a,styles:s,props:t});return(0,c.jsx)(js,{variant:r||`transparent`,size:n||u?.size||`sm`,classNames:d,styles:f,__staticSelector:`InputClearButton`,style:{pointerEvents:`all`,background:`var(--input-bg)`,...l.style},...l})});dl.displayName=`@mantine/core/InputClearButton`;var fl={xs:7,sm:8,md:10,lg:12,xl:15};function pl({__clearable:e,__clearSection:t,rightSection:n,__defaultRightSection:r,size:i=`sm`,__clearSectionMode:a=`both`}){let o=e&&t;return a===`rightSection`?n===null?null:n||r:a===`clear`?n===null?null:o||r:o&&(n||r)?(0,c.jsxs)(`div`,{"data-combined-clear-section":!0,style:{display:`flex`,gap:2,alignItems:`center`,paddingInlineEnd:fl[i]},children:[o,n||r]}):n===null?null:n||o||r}var ml=(0,o.createContext)({offsetBottom:!1,offsetTop:!1,describedBy:void 0,getStyles:null,inputId:void 0,labelId:void 0}),hl={wrapper:`m_6c018570`,input:`m_8fb7ebe7`,bottomSection:`m_93f4ed57`,section:`m_82577fc2`,placeholder:`m_88bacfd0`,root:`m_46b77525`,label:`m_8fdc1311`,required:`m_78a94662`,error:`m_8f816625`,success:`m_9d9d40e0`,description:`m_fe47ce59`},gl=H((e,{size:t})=>({description:{"--input-description-size":t===void 0?void 0:`calc(${E(t)} - ${h(2)})`}})),_l=K(e=>{let t=W(`InputDescription`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,vars:l,__staticSelector:u,__inheritStyles:d=!0,attributes:f,...p}=W(`InputDescription`,null,t),m=(0,o.use)(ml),h=G({name:[`InputWrapper`,u],props:t,classes:hl,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:f,rootSelector:`description`,vars:l,varsResolver:gl}),g=d&&m?.getStyles||h;return(0,c.jsx)(q,{component:`p`,...g(`description`,m?.getStyles?{className:r,style:i}:void 0),...p})});_l.classes=hl,_l.varsResolver=gl,_l.displayName=`@mantine/core/InputDescription`;var vl=H((e,{size:t})=>({error:{"--input-error-size":t===void 0?void 0:`calc(${E(t)} - ${h(2)})`}})),yl=K(e=>{let t=W(`InputError`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,vars:l,attributes:u,__staticSelector:d,__inheritStyles:f=!0,...p}=t,m=G({name:[`InputWrapper`,d],props:t,classes:hl,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:u,rootSelector:`error`,vars:l,varsResolver:vl}),h=(0,o.use)(ml),g=f&&h?.getStyles||m;return(0,c.jsx)(q,{component:`p`,...g(`error`,h?.getStyles?{className:r,style:i}:void 0),...p})});yl.classes=hl,yl.varsResolver=vl,yl.displayName=`@mantine/core/InputError`;var bl={labelElement:`label`},xl=H((e,{size:t})=>({label:{"--input-label-size":E(t),"--input-asterisk-color":void 0}})),Sl=K(e=>{let t=W(`InputLabel`,bl,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,vars:l,labelElement:u,required:d,htmlFor:f,onMouseDown:p,children:m,__staticSelector:h,mod:g,attributes:_,...v}=t,y=G({name:[`InputWrapper`,h],props:t,classes:hl,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:_,rootSelector:`label`,vars:l,varsResolver:xl}),b=(0,o.use)(ml),x=b?.getStyles||y,S=v.component||u,C=typeof S!=`string`||S===`label`;return(0,c.jsxs)(q,{...x(`label`,b?.getStyles?{className:r,style:i}:void 0),component:u,htmlFor:C?f:void 0,mod:[{required:d},g],onMouseDown:e=>{p?.(e),!e.defaultPrevented&&e.detail>1&&e.preventDefault()},...v,children:[m,d&&(0,c.jsx)(`span`,{...x(`required`),"aria-hidden":!0,children:` *`})]})});Sl.classes=hl,Sl.varsResolver=xl,Sl.displayName=`@mantine/core/InputLabel`;var Cl=K(e=>{let t=W(`InputPlaceholder`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,__staticSelector:l,error:u,mod:d,attributes:f,...p}=t,m=G({name:[`InputPlaceholder`,l],props:t,classes:hl,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:f,rootSelector:`placeholder`});return(0,c.jsx)(q,{...m(`placeholder`),mod:[{error:!!u},d],component:`span`,...p})});Cl.classes=hl,Cl.displayName=`@mantine/core/InputPlaceholder`;var wl=H((e,{size:t})=>({success:{"--input-success-size":t===void 0?void 0:`calc(${E(t)} - ${h(2)})`}})),Tl=K(e=>{let t=W(`InputSuccess`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,vars:l,attributes:u,__staticSelector:d,__inheritStyles:f=!0,...p}=t,m=G({name:[`InputWrapper`,d],props:t,classes:hl,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:u,rootSelector:`success`,vars:l,varsResolver:wl}),h=(0,o.use)(ml),g=f&&h?.getStyles||m;return(0,c.jsx)(q,{component:`p`,...g(`success`,h?.getStyles?{className:r,style:i}:void 0),...p})});Tl.classes=hl,Tl.varsResolver=wl,Tl.displayName=`@mantine/core/InputSuccess`;function El(e,{hasDescription:t,hasError:n}){let r=e.findIndex(e=>e===`input`),i=e.slice(0,r),a=e.slice(r+1),o=t&&i.includes(`description`)||n&&i.includes(`error`);return{offsetBottom:t&&a.includes(`description`)||n&&a.includes(`error`),offsetTop:o}}var Dl={labelElement:`label`,inputContainer:e=>e,inputWrapperOrder:[`label`,`description`,`input`,`error`]},Ol=H((e,{size:t})=>({label:{"--input-label-size":E(t),"--input-asterisk-color":void 0},error:{"--input-error-size":t===void 0?void 0:`calc(${E(t)} - ${h(2)})`},success:{"--input-success-size":t===void 0?void 0:`calc(${E(t)} - ${h(2)})`},description:{"--input-description-size":t===void 0?void 0:`calc(${E(t)} - ${h(2)})`}})),kl=K(e=>{let t=W(`InputWrapper`,Dl,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,vars:l,size:u,variant:d,__staticSelector:f,inputContainer:p,inputWrapperOrder:m,label:h,error:g,success:_,description:v,labelProps:y,descriptionProps:b,errorProps:x,successProps:S,labelElement:C,children:w,withAsterisk:T,id:E,required:D,__stylesApiProps:O,mod:k,attributes:A,...j}=t,M=G({name:[`InputWrapper`,f],props:O||t,classes:hl,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:A,vars:l,varsResolver:Ol}),N={size:u,variant:d,__staticSelector:f},P=ce(E),ee=typeof T==`boolean`?T:D,F=x?.id||`${P}-error`,te=S?.id||`${P}-success`,I=b?.id||`${P}-description`,L=P,R=!!g&&typeof g!=`boolean`,ne=!!_&&typeof _!=`boolean`&&!g,re=!!v,ie=R&&m.includes(`error`),ae=ne&&m.includes(`error`),oe=re&&m.includes(`description`),se=`${ie?F:``} ${ae?te:``} ${oe?I:``}`,z=se.trim().length>0?se.trim():void 0,le=y?.id||`${P}-label`,ue=h&&(0,c.jsx)(Sl,{labelElement:C,id:le,htmlFor:L,required:ee,...N,...y,children:h},`label`),de=re&&(0,c.jsx)(_l,{...b,...N,size:b?.size||N.size,id:b?.id||I,children:v},`description`),B=(0,c.jsx)(o.Fragment,{children:p(w)},`input`),fe=R&&(0,o.createElement)(yl,{...x,...N,size:x?.size||N.size,key:`error`,id:x?.id||F},g),pe=ne&&(0,o.createElement)(Tl,{...S,...N,size:S?.size||N.size,key:`success`,id:S?.id||te},_),me=m.map(e=>{switch(e){case`label`:return ue;case`input`:return B;case`description`:return de;case`error`:return fe||pe;default:return null}});return(0,c.jsx)(ml,{value:{getStyles:M,describedBy:z,inputId:L,labelId:ue&&m.includes(`label`)?le:void 0,...El(m,{hasDescription:re,hasError:R||ne})},children:(0,c.jsx)(q,{variant:d,size:u,mod:[{error:!!g,success:!!_&&!g},k],id:C===`label`?void 0:E,...M(`root`),...j,children:me})})});kl.classes=hl,kl.varsResolver=Ol,kl.displayName=`@mantine/core/InputWrapper`;var Al={variant:`default`,leftSectionPointerEvents:`none`,rightSectionPointerEvents:`none`,withAria:!0,withErrorStyles:!0,withSuccessStyles:!0,size:`sm`,loading:!1,loadingPosition:`right`},jl=H((e,t,n)=>({wrapper:{"--input-margin-top":n.offsetTop?`calc(var(--mantine-spacing-xs) / 2)`:void 0,"--input-margin-bottom":n.offsetBottom?`calc(var(--mantine-spacing-xs) / 2)`:void 0,"--input-height":C(t.size,`input-height`),"--input-fz":E(t.size),"--input-radius":t.radius===void 0?void 0:T(t.radius),"--input-left-section-width":t.leftSectionWidth===void 0?void 0:h(t.leftSectionWidth),"--input-right-section-width":t.rightSectionWidth===void 0?void 0:h(t.rightSectionWidth),"--input-padding-y":t.multiline?C(t.size,`input-padding-y`):void 0,"--input-left-section-pointer-events":t.leftSectionPointerEvents,"--input-right-section-pointer-events":t.rightSectionPointerEvents}})),X=fn(e=>{let t=W(`Input`,Al,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,required:l,__staticSelector:u,__stylesApiProps:d,size:f,wrapperProps:p,error:m,success:h,disabled:g,leftSection:_,leftSectionProps:v,leftSectionWidth:y,rightSection:b,rightSectionProps:x,rightSectionWidth:S,rightSectionPointerEvents:C,leftSectionPointerEvents:w,variant:T,vars:E,pointer:D,multiline:O,radius:k,id:A,withAria:j,withErrorStyles:M,withSuccessStyles:N,mod:P,inputSize:ee,attributes:F,__clearSection:te,__clearable:I,__clearSectionMode:L,__defaultRightSection:R,loading:ne,loadingPosition:re,__bottomSection:ie,__bottomSectionProps:ae,rootRef:oe,dir:se,...z}=t,{styleProps:ce,rest:le}=It(z),ue=(0,o.use)(ml),de={offsetBottom:ue?.offsetBottom,offsetTop:ue?.offsetTop},B=G({name:[`Input`,u],props:d||t,classes:hl,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:F,stylesCtx:de,rootSelector:`wrapper`,vars:E,varsResolver:jl}),fe=j?{required:l,disabled:g,"aria-invalid":m?!0:void 0,"aria-describedby":ue?.describedBy,id:ue?.inputId||A}:{},pe=ne?(0,c.jsx)(vs,{size:re===`left`?`calc(var(--input-left-section-size) / 2)`:`calc(var(--input-right-section-size) / 2)`}):null,me=ne&&re===`left`?pe:_,he=pl({__clearable:I,__clearSection:te,rightSection:ne&&re===`right`?pe:b,__defaultRightSection:R,size:f,__clearSectionMode:L});return(0,c.jsx)(ul,{value:{size:f||`sm`},children:(0,c.jsxs)(q,{ref:oe,dir:se,...B(`wrapper`),...ce,...p,mod:[{error:!!m&&M,success:!!h&&!m&&N,pointer:D,disabled:g,multiline:O,withRightSection:!!he,withLeftSection:!!me,withBottomSection:!!ie},P],variant:T,size:f,children:[me&&(0,c.jsx)(`div`,{...v,"data-position":`left`,...B(`section`,{className:v?.className,style:v?.style}),children:me}),(0,c.jsx)(q,{component:`input`,...le,...fe,required:l,mod:{disabled:g,error:!!m&&M,success:!!h&&!m&&N},variant:T,__size:ee,...B(`input`)}),ie&&(0,c.jsx)(`div`,{...ae,...B(`bottomSection`,{className:ae?.className,style:ae?.style}),children:ie}),he&&(0,c.jsx)(`div`,{...x,"data-position":`right`,...B(`section`,{className:x?.className,style:x?.style}),children:he})]})})});X.classes=hl,X.varsResolver=jl,X.Wrapper=kl,X.Label=Sl,X.Error=yl,X.Success=Tl,X.Description=_l,X.Placeholder=Cl,X.ClearButton=dl,X.displayName=`@mantine/core/Input`;function Ml(e,t,n){let r=W([`Input`,`InputWrapper`,e],t,n),{label:i,description:a,error:o,success:s,required:c,classNames:l,styles:u,className:d,unstyled:f,__staticSelector:p,__stylesApiProps:m,errorProps:h,successProps:g,labelProps:_,descriptionProps:v,wrapperProps:y,id:b,size:x,style:S,inputContainer:C,inputWrapperOrder:w,withAsterisk:T,variant:E,vars:D,mod:O,attributes:k,...A}=r,{styleProps:j,rest:M}=It(A),N={label:i,description:a,error:o,success:s,required:c,classNames:l,className:d,__staticSelector:p,__stylesApiProps:m||r,errorProps:h,successProps:g,labelProps:_,descriptionProps:v,unstyled:f,styles:u,size:x,style:S,inputContainer:C,inputWrapperOrder:w,withAsterisk:T,variant:E,id:b,mod:O,attributes:k,...y};return{...M,classNames:l,styles:u,unstyled:f,wrapperProps:{...N,...j},inputProps:{required:c,classNames:l,styles:u,unstyled:f,size:x,__staticSelector:p,__stylesApiProps:m||r,error:o,success:s,variant:E,id:b,attributes:k}}}var Nl={__staticSelector:`InputBase`,withAria:!0,size:`sm`},Pl=fn(e=>{let{inputProps:t,wrapperProps:n,...r}=Ml(`InputBase`,Nl,e);return(0,c.jsx)(X.Wrapper,{...n,children:(0,c.jsx)(X,{...t,...r})})});Pl.classes={...X.classes,...X.Wrapper.classes},Pl.displayName=`@mantine/core/InputBase`;var Fl={gap:{type:`spacing`,property:`gap`},rowGap:{type:`spacing`,property:`rowGap`},columnGap:{type:`spacing`,property:`columnGap`},align:{type:`identity`,property:`alignItems`},justify:{type:`identity`,property:`justifyContent`},wrap:{type:`identity`,property:`flexWrap`},direction:{type:`identity`,property:`flexDirection`}},Il={root:`m_8bffd616`},Ll=fn(e=>{let t=W(`Flex`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,gap:l,rowGap:u,columnGap:d,align:f,justify:p,wrap:m,direction:h,attributes:g,...v}=t,y=G({name:`Flex`,classes:Il,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:g,vars:s}),b=dt(),x=on(),S=an({styleProps:{gap:l,rowGap:u,columnGap:d,align:f,justify:p,wrap:m,direction:h},theme:b,data:Fl}),C=et(),w=C&&S.hasResponsiveStyles?Ft(S.styles,S.media):x;return(0,c.jsxs)(c.Fragment,{children:[S.hasResponsiveStyles&&(0,c.jsx)(Nt,{selector:`.${w}`,styles:S.styles,media:S.media,deduplicate:C}),(0,c.jsx)(q,{...y(`root`,{className:w,style:_(S.inlineStyles)}),...v})]})});Ll.classes=Il,Ll.displayName=`@mantine/core/Flex`;function Rl({style:e,size:t=16,...n}){return(0,c.jsx)(`svg`,{viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:{...e,width:h(t),height:h(t),display:`block`},...n,children:(0,c.jsx)(`path`,{d:`M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})}Rl.displayName=`@mantine/core/AccordionChevron`;var zl={root:`m_b6d8b162`};function Bl(e){if(e===`start`)return`start`;if(e===`end`||e)return`end`}var Vl={inherit:!1},Hl=H((e,{variant:t,lineClamp:n,gradient:r,size:i,textWrap:a})=>({root:{"--text-fz":E(i),"--text-lh":D(i),"--text-gradient":t===`gradient`?Be(r,e):void 0,"--text-line-clamp":typeof n==`number`?n.toString():void 0,"--text-text-wrap":a}})),Z=fn(e=>{let t=W(`Text`,Vl,e),{lineClamp:n,truncate:r,inline:i,inherit:a,gradient:o,span:s,textWrap:l,__staticSelector:u,vars:d,className:f,style:p,classNames:m,styles:h,unstyled:g,variant:_,mod:v,size:y,attributes:b,...x}=t,S=G({name:[`Text`,u],props:t,classes:zl,className:f,style:p,classNames:m,styles:h,unstyled:g,attributes:b,vars:d,varsResolver:Hl});return(0,c.jsx)(q,{...S(`root`,{focusable:!0}),component:s?`span`:`p`,variant:_,mod:[{truncate:Bl(r),lineClamp:typeof n==`number`,inline:i,inherit:a},v],size:y,...x})});Z.classes=zl,Z.varsResolver=Hl,Z.displayName=`@mantine/core/Text`;var Ul={root:`m_347db0ec`,"root--dot":`m_fbd81e3d`,label:`m_5add502a`,section:`m_91fdda9b`},Wl=H((e,{radius:t,color:n,gradient:r,variant:i,size:a,autoContrast:o,circle:s})=>{let c=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||`filled`,autoContrast:o});return{root:{"--badge-height":C(a,`badge-height`),"--badge-padding-x":C(a,`badge-padding-x`),"--badge-fz":C(a,`badge-fz`),"--badge-radius":s||t===void 0?void 0:T(t),"--badge-bg":n||i?c.background:void 0,"--badge-color":n||i?c.color:void 0,"--badge-bd":n||i?c.border:void 0,"--badge-dot-color":i===`dot`?Le(n,e):void 0}}}),Gl=fn(e=>{let t=W(`Badge`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,radius:l,color:u,gradient:d,leftSection:f,rightSection:p,children:m,variant:h,fullWidth:g,autoContrast:_,circle:v,mod:y,attributes:b,...x}=t,S=G({name:`Badge`,props:t,classes:Ul,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:b,vars:s,varsResolver:Wl});return(0,c.jsxs)(q,{variant:h,mod:[{block:g,circle:v,"with-right-section":!!p,"with-left-section":!!f},y],...S(`root`,{variant:h}),...x,children:[f&&(0,c.jsx)(`span`,{...S(`section`),"data-position":`left`,children:f}),(0,c.jsx)(`span`,{...S(`label`),children:m}),p&&(0,c.jsx)(`span`,{...S(`section`),"data-position":`right`,children:p})]})});Gl.classes=Ul,Gl.varsResolver=Wl,Gl.displayName=`@mantine/core/Badge`;var Kl={root:`m_77c9d27d`,inner:`m_80f1301b`,label:`m_811560b9`,section:`m_a74036a`,loader:`m_a25b86ee`,group:`m_80d6d844`,groupSection:`m_70be2a01`},ql={orientation:`horizontal`},Jl=H((e,{borderWidth:t})=>({group:{"--button-border-width":h(t)}})),Yl=K(e=>{let t=W(`ButtonGroup`,ql,e),{className:n,style:r,classNames:i,styles:a,unstyled:o,orientation:s,vars:l,borderWidth:u,mod:d,attributes:f,...p}=W(`ButtonGroup`,ql,e),m=G({name:`ButtonGroup`,props:t,classes:Kl,className:n,style:r,classNames:i,styles:a,unstyled:o,attributes:f,vars:l,varsResolver:Jl,rootSelector:`group`});return(0,c.jsx)(q,{...m(`group`),mod:[{orientation:s},d],role:`group`,...p})});Yl.classes=Kl,Yl.varsResolver=Jl,Yl.displayName=`@mantine/core/ButtonGroup`;var Xl=H((e,{radius:t,color:n,gradient:r,variant:i,autoContrast:a,size:o})=>{let s=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||`filled`,autoContrast:a});return{groupSection:{"--section-height":C(o,`section-height`),"--section-padding-x":C(o,`section-padding-x`),"--section-fz":o?.includes(`compact`)?E(o.replace(`compact-`,``)):E(o),"--section-radius":t===void 0?void 0:T(t),"--section-bg":n||i?s.background:void 0,"--section-color":s.color,"--section-bd":n||i?s.border:void 0}}}),Zl=K(e=>{let t=W(`ButtonGroupSection`,null,e),{className:n,style:r,classNames:i,styles:a,unstyled:o,vars:s,gradient:l,radius:u,autoContrast:d,attributes:f,...p}=t,m=G({name:`ButtonGroupSection`,props:t,classes:Kl,className:n,style:r,classNames:i,styles:a,unstyled:o,attributes:f,vars:s,varsResolver:Xl,rootSelector:`groupSection`});return(0,c.jsx)(q,{...m(`groupSection`),...p})});Zl.classes=Kl,Zl.varsResolver=Xl,Zl.displayName=`@mantine/core/ButtonGroupSection`;var Ql={in:{opacity:1,transform:`translate(-50%, calc(-50% + ${h(1)}))`},out:{opacity:0,transform:`translate(-50%, -200%)`},common:{transformOrigin:`center`},transitionProperty:`transform, opacity`},$l=H((e,{radius:t,color:n,gradient:r,variant:i,size:a,justify:o,autoContrast:s})=>{let c=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||`filled`,autoContrast:s});return{root:{"--button-justify":o,"--button-height":C(a,`button-height`),"--button-padding-x":C(a,`button-padding-x`),"--button-fz":a?.includes(`compact`)?E(a.replace(`compact-`,``)):E(a),"--button-radius":t===void 0?void 0:T(t),"--button-bg":n||i?c.background:void 0,"--button-hover":n||i?c.hover:void 0,"--button-color":c.color,"--button-bd":n||i?c.border:void 0,"--button-hover-color":n||i?c.hoverColor:void 0}}}),Q=fn(e=>{let t=W(`Button`,null,e),{style:n,vars:r,className:i,color:a,disabled:o,children:s,leftSection:l,rightSection:u,fullWidth:d,variant:f,radius:p,loading:m,loaderProps:h,gradient:g,classNames:_,styles:v,unstyled:y,"data-disabled":b,autoContrast:x,mod:S,attributes:C,...w}=t,T=G({name:`Button`,props:t,classes:Kl,className:i,style:n,classNames:_,styles:v,unstyled:y,attributes:C,vars:r,varsResolver:$l}),E=!!l,D=!!u;return(0,c.jsxs)(Vo,{...T(`root`,{active:!o&&!m&&!b}),unstyled:y,variant:f,disabled:o||m,mod:[{disabled:o||b,loading:m,block:d,"with-left-section":E,"with-right-section":D},S],...w,children:[typeof m==`boolean`&&(0,c.jsx)(cs,{mounted:m,transition:Ql,duration:150,children:e=>(0,c.jsx)(q,{component:`span`,...T(`loader`,{style:e}),"aria-hidden":!0,children:(0,c.jsx)(vs,{color:`var(--button-color)`,size:`calc(var(--button-height) / 1.8)`,...h})})}),(0,c.jsxs)(`span`,{...T(`inner`),children:[l&&(0,c.jsx)(q,{component:`span`,...T(`section`),mod:{position:`left`},children:l}),(0,c.jsx)(q,{component:`span`,mod:{loading:m},...T(`label`),children:s}),u&&(0,c.jsx)(q,{component:`span`,...T(`section`),mod:{position:`right`},children:u})]})]})});Q.classes=Kl,Q.varsResolver=$l,Q.displayName=`@mantine/core/Button`,Q.Group=Yl,Q.GroupSection=Zl;var eu={root:`m_4451eb3a`},tu=fn(e=>{let t=W(`Center`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,inline:l,mod:u,attributes:d,...f}=t,p=G({name:`Center`,props:t,classes:eu,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:d,vars:s});return(0,c.jsx)(q,{mod:[{inline:l},u],...p(`root`),...f})});tu.classes=eu,tu.displayName=`@mantine/core/Center`;var nu={root:`m_3eebeb36`,label:`m_9e365f20`},ru={orientation:`horizontal`},iu=H((e,{color:t,variant:n,size:r})=>({root:{"--divider-color":t?Le(t,e):void 0,"--divider-border-style":n,"--divider-size":C(r,`divider-size`)}})),au=K(e=>{let t=W(`Divider`,ru,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,color:l,orientation:u,label:d,labelPosition:f,mod:p,attributes:m,...h}=t,g=G({name:`Divider`,classes:nu,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:m,vars:s,varsResolver:iu});return(0,c.jsx)(q,{mod:[{orientation:u,withLabel:!!d},p],role:`separator`,"aria-orientation":u,...g(`root`),...h,children:d&&(0,c.jsx)(q,{component:`span`,mod:{position:f},...g(`label`),children:d})})});au.classes=nu,au.varsResolver=iu,au.displayName=`@mantine/core/Divider`;var[ou,su]=b(`Modal component was not found in tree`),cu={root:`m_9df02822`,content:`m_54c44539`,inner:`m_1f958f16`,header:`m_d0e2b9cd`},lu=K(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=W(`ModalBody`,null,e),s=su();return(0,c.jsx)(el,{...s.getStyles(`body`,{classNames:t,style:r,styles:i,className:n}),...o})});lu.classes=cu,lu.displayName=`@mantine/core/ModalBody`;var uu=K(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=W(`ModalCloseButton`,null,e),s=su();return(0,c.jsx)(tl,{...s.getStyles(`close`,{classNames:t,style:r,styles:i,className:n}),...o})});uu.classes=cu,uu.displayName=`@mantine/core/ModalCloseButton`;var du=K(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:o,__hidden:s,...l}=W(`ModalContent`,null,e),u=su(),d=u.scrollAreaComponent||ll;return(0,c.jsx)(nl,{...u.getStyles(`content`,{className:n,style:r,styles:i,classNames:t}),innerProps:u.getStyles(`inner`,{className:n,style:r,styles:i,classNames:t}),"data-full-screen":u.fullScreen||void 0,"data-modal-content":!0,"data-hidden":s||void 0,...l,children:(0,c.jsx)(d,{style:{maxHeight:u.fullScreen?`100dvh`:`calc(100dvh - (${h(u.yOffset)} * 2))`},children:o})})});du.classes=cu,du.displayName=`@mantine/core/ModalContent`;var fu=K(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=W(`ModalHeader`,null,e),s=su();return(0,c.jsx)(rl,{...s.getStyles(`header`,{classNames:t,style:r,styles:i,className:n}),...o})});fu.classes=cu,fu.displayName=`@mantine/core/ModalHeader`;var pu=K(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=W(`ModalOverlay`,null,e),s=su();return(0,c.jsx)(ol,{...s.getStyles(`overlay`,{classNames:t,style:r,styles:i,className:n}),...o})});pu.classes=cu,pu.displayName=`@mantine/core/ModalOverlay`;var mu={__staticSelector:`Modal`,closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:S(`modal`),transitionProps:{duration:200,transition:`fade-down`},yOffset:`5dvh`},hu=H((e,{radius:t,size:n,yOffset:r,xOffset:i})=>({root:{"--modal-radius":t===void 0?void 0:T(t),"--modal-size":C(n,`modal-size`),"--modal-y-offset":h(r),"--modal-x-offset":h(i)}})),gu=K(e=>{let t=W(`ModalRoot`,mu,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,yOffset:l,scrollAreaComponent:u,radius:d,fullScreen:f,centered:p,xOffset:m,__staticSelector:h,attributes:g,..._}=t,v=G({name:h,classes:cu,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:g,vars:s,varsResolver:hu});return(0,c.jsx)(ou,{value:{yOffset:l,scrollAreaComponent:u,getStyles:v,fullScreen:f},children:(0,c.jsx)(Zc,{...v(`root`),"data-full-screen":f||void 0,"data-centered":p||void 0,"data-offset-scrollbars":u===Lo.Autosize||void 0,unstyled:o,..._})})});gu.classes=cu,gu.varsResolver=hu,gu.displayName=`@mantine/core/ModalRoot`;var _u=(0,o.createContext)(null);function vu({children:e}){let[t,n]=(0,o.useState)([]),[r,i]=(0,o.useState)(S(`modal`)),[a]=(0,o.useState)(()=>new WeakSet);return(0,c.jsx)(_u,{value:{stack:t,addModal:(e,t)=>{n(t=>[...new Set([...t,e])]),i(e=>typeof t==`number`&&typeof e==`number`?Math.max(e,t):e)},removeModal:e=>n(t=>t.filter(t=>t!==e)),getZIndex:e=>`calc(${r} + ${t.indexOf(e)} + 1)`,currentId:t[t.length-1],maxZIndex:r,handledEscapeEvents:a},children:e})}vu.displayName=`@mantine/core/ModalStack`;var yu=K(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=W(`ModalTitle`,null,e),s=su();return(0,c.jsx)(cl,{...s.getStyles(`title`,{classNames:t,style:r,styles:i,className:n}),...o})});yu.classes=cu,yu.displayName=`@mantine/core/ModalTitle`;var bu={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:S(`modal`),transitionProps:{duration:200,transition:`fade-down`},withOverlay:!0,withCloseButton:!0},xu=K(e=>{let{title:t,withOverlay:n,overlayProps:r,withCloseButton:i,closeButtonProps:a,children:s,radius:l,opened:u,stackId:d,zIndex:f,...p}=W(`Modal`,bu,e),m=(0,o.use)(_u),h=!!t||i,g=m&&d?{closeOnEscape:m.currentId===d,trapFocus:m.currentId===d,zIndex:m.getZIndex(d),__handledEscapeEvents:m.handledEscapeEvents}:{},_=n===!1?!1:d&&m?m.currentId===d:u;return(0,o.useEffect)(()=>{m&&d&&(u?m.addModal(d,f||S(`modal`)):m.removeModal(d))},[u,d,f]),(0,c.jsxs)(gu,{radius:l,opened:u,zIndex:m&&d?m.getZIndex(d):f,...p,...g,children:[n&&(0,c.jsx)(pu,{visible:_,transitionProps:m&&d?{duration:0}:void 0,...r}),(0,c.jsxs)(du,{radius:l,__hidden:m&&d&&u?d!==m.currentId:!1,children:[h&&(0,c.jsxs)(fu,{children:[t&&(0,c.jsx)(yu,{children:t}),i&&(0,c.jsx)(uu,{...a})]}),(0,c.jsx)(lu,{children:s})]})]})});xu.classes=cu,xu.displayName=`@mantine/core/Modal`,xu.Root=gu,xu.Overlay=pu,xu.Content=du,xu.Body=lu,xu.Header=fu,xu.Title=yu,xu.CloseButton=uu,xu.Stack=vu;var Su={root:`m_f0824112`,description:`m_57492dcc`,section:`m_690090b5`,label:`m_1f6ac4c4`,body:`m_f07af9d2`,children:`m_e17b862f`,chevron:`m_1fd8a00b`},Cu=H((e,{variant:t,color:n,childrenOffset:r,autoContrast:i})=>{let a=e.variantColorResolver({color:n||e.primaryColor,theme:e,variant:t||`light`,autoContrast:i});return{root:{"--nl-bg":n||t?a.background:void 0,"--nl-hover":n||t?a.hover:void 0,"--nl-color":n||t?a.color:void 0},children:{"--nl-offset":w(r)}}}),wu=fn(e=>{let t=W(`NavLink`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,opened:l,defaultOpened:u,onChange:d,children:f,active:p,disabled:m,leftSection:h,rightSection:g,label:_,description:v,disableRightSectionRotation:y,noWrap:b,childrenOffset:x,autoContrast:S,mod:C,attributes:w,onClick:T,onKeyDown:E,keepMounted:D,...O}=t,k=G({name:`NavLink`,props:t,classes:Su,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:w,vars:s,varsResolver:Cu}),[A,j]=fe({value:l,defaultValue:u,finalValue:!1,onChange:d}),M=!!f,N=e=>{T?.(e),M&&(e.preventDefault(),j(!A))};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(Vo,{...k(`root`),component:`a`,onClick:N,onKeyDown:e=>{E?.(e),e.nativeEvent.code===`Space`&&M&&(e.preventDefault(),j(!A))},unstyled:o,mod:[{disabled:m,active:p,expanded:A},C],...O,children:[h&&(0,c.jsx)(q,{component:`span`,...k(`section`),mod:{position:`left`},children:h}),(0,c.jsxs)(q,{...k(`body`),mod:{"no-wrap":b},children:[(0,c.jsx)(q,{component:`span`,...k(`label`),children:_}),(0,c.jsx)(q,{component:`span`,mod:{active:p},...k(`description`),children:v})]}),(M||g!==void 0)&&(0,c.jsx)(q,{...k(`section`),component:`span`,mod:{rotate:A&&!y,position:`right`},children:M&&g===void 0?(0,c.jsx)(Rl,{...k(`chevron`)}):g})]}),M&&(0,c.jsx)(Sn,{expanded:A,keepMounted:D,...k(`collapse`),children:(0,c.jsx)(`div`,{...k(`children`),children:f})})]})});wu.classes=Su,wu.varsResolver=Cu,wu.displayName=`@mantine/core/NavLink`;function Tu(e,t){if(e<1)return[];let n=Array(e).fill(``);if(t){let r=t.trim().split(``);for(let t=0;t({root:{"--pin-input-size":C(t??`sm`,`pin-input-size`)}})),Au=K(e=>{let{name:t,form:n,className:r,value:i,defaultValue:a,variant:s,gap:l,style:u,size:d,classNames:f,styles:p,unstyled:m,length:h,onChange:g,onComplete:_,manageFocus:v,autoFocus:y,error:b,success:x,radius:S,disabled:C,oneTimeCode:w,placeholder:T,type:E,mask:D,readOnly:O,inputType:k,inputMode:A,ariaLabel:j,vars:M,id:N,hiddenInputProps:P,rootRef:ee,getInputProps:F,attributes:te,ref:I,...L}=W([`Input`,`PinInput`],Ou,e),R=ce(N),ne=G({name:`PinInput`,classes:Eu,props:e,className:r,style:u,classNames:f,styles:p,unstyled:m,attributes:te,vars:M,varsResolver:ku}),{resolvedClassNames:re,resolvedStyles:ie}=mt({classNames:f,styles:p,props:e}),[ae,oe]=(0,o.useState)(-1),se=(0,o.useRef)([]),z=h??4,le=(0,o.useRef)(!1),[de,B]=fe({value:i===void 0?void 0:Tu(z,i),defaultValue:a?.split(``).slice(0,z),finalValue:Tu(z,``),onChange:e=>{let t=e.join(``).trim();g?.(t),t.length===z&&!le.current?(le.current=!0,_?.(t)):t.length(E instanceof RegExp?E:E&&E in Du?Du[E]:null)?.test(e),V=(e,t)=>{if(v){if(e===`next`){let e=t+1;e=0&&se.current[e]?.focus()}}},ge=(e,t)=>{let n=[...pe];return n[t]=e,B(n),n},_e=(e,t)=>{let n=e.target.value;if(n.length>1){if(n.length>2){if(he(n)){B(Tu(z,n));let e=Math.min(n.length,z);e{let{ctrlKey:n,metaKey:r,key:i,shiftKey:a,target:o}=e,s=o.value;if(A===`numeric`){let t=[`Backspace`,`Tab`,`Control`,`Delete`,`ArrowLeft`,`ArrowRight`],a=n||r;if(!(t.includes(i)||a||!Number.isNaN(Number(i)))){e.preventDefault();return}}switch(i){case`ArrowLeft`:e.preventDefault(),V(`prev`,t);break;case`ArrowRight`:e.preventDefault(),V(`next`,t);break;case`Tab`:a&&t>0&&v&&(e.preventDefault(),V(`prev`,t));break;case` `:e.preventDefault(),V(`next`,t);break;case`Delete`:e.preventDefault(),O||ge(``,t);break;case`Backspace`:O?e.preventDefault():s===``?(e.preventDefault(),V(`prev`,t)):(ge(``,t),t0&&i===pe[t]&&(e.preventDefault(),V(`next`,t))}},ye=(e,t)=>{e.target.select(),oe(t)},be=()=>{oe(-1)},H=e=>{if(e.preventDefault(),O)return;let t=e.clipboardData.getData(`text/plain`).replace(/[\n\r\s]+/g,``);if(he(t.trim())){let e=Tu(z,t);B(e);let n=e.filter(e=>e!==``).length;n>=z?se.current[z-1]?.focus():se.current[n]?.focus()}};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Is,{...L,...ne(`root`),ref:ee,role:`group`,id:R,gap:l,unstyled:m,wrap:`nowrap`,variant:s,__size:d,dir:`ltr`,children:pe.map((e,t)=>(0,o.createElement)(X,{component:`input`,...ne(`pinInput`,{style:{"--input-padding":`0`,"--input-text-align":`center`}}),classNames:re,styles:ie,size:d,__staticSelector:`PinInput`,id:`${R}-${t+1}`,key:`${R}-${t}`,inputMode:A||(E===`number`?`numeric`:`text`),onChange:e=>_e(e,t),onKeyDown:e=>ve(e,t),onFocus:e=>ye(e,t),onBlur:be,onPaste:H,type:k||(D?`password`:E===`number`?`tel`:`text`),radius:S,error:b,success:x,variant:s,disabled:C,ref:e=>{e&&(t===0&&ue(I,e),se.current[t]=e)},autoComplete:w?`one-time-code`:`off`,placeholder:ae===t?``:T,value:e,autoFocus:y&&t===0,unstyled:m,"aria-label":j,readOnly:O,...F?.(t)}))}),(0,c.jsx)(`input`,{type:`hidden`,name:t,form:n,value:me,...P})]})});Au.classes={...Eu,...Pl.classes},Au.varsResolver=ku,Au.displayName=`@mantine/core/PinInput`;var ju={root:`m_18320242`,"skeleton-fade":`m_299c329c`},Mu={visible:!0,animate:!0},Nu=H((e,{width:t,height:n,radius:r,circle:i})=>({root:{"--skeleton-height":h(n),"--skeleton-width":h(i?n:t),"--skeleton-radius":i?`1000px`:r===void 0?void 0:T(r)}})),Pu=K(e=>{let t=W(`Skeleton`,Mu,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,width:l,height:u,circle:d,visible:f,radius:p,animate:m,mod:h,attributes:g,..._}=t,v=G({name:`Skeleton`,classes:ju,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:g,vars:s,varsResolver:Nu});return(0,c.jsx)(q,{...v(`root`),mod:[{visible:f,animate:m},h],..._})});Pu.classes=ju,Pu.varsResolver=Nu,Pu.displayName=`@mantine/core/Skeleton`;var Fu={root:`m_6d731127`},Iu={gap:`md`,align:`stretch`,justify:`flex-start`},Lu=H((e,{gap:t,align:n,justify:r})=>({root:{"--stack-gap":w(t),"--stack-align":n,"--stack-justify":r}})),$=K(e=>{let t=W(`Stack`,Iu,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,align:l,justify:u,gap:d,variant:f,attributes:p,...m}=t,h=G({name:`Stack`,props:t,classes:Fu,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:p,vars:s,varsResolver:Lu});return(0,c.jsx)(q,{...h(`root`),variant:f,...m})});$.classes=Fu,$.varsResolver=Lu,$.displayName=`@mantine/core/Stack`;var Ru=K(e=>{let t=W([`Input`,`InputWrapper`,`TextInput`],null,e);return(0,c.jsx)(Pl,{component:`input`,...t,__staticSelector:`TextInput`})});Ru.classes=Pl.classes,Ru.displayName=`@mantine/core/TextInput`;var zu={root:`m_7341320d`},Bu=H((e,{size:t,radius:n,variant:r,gradient:i,color:a,autoContrast:o})=>{let s=e.variantColorResolver({color:a||e.primaryColor,theme:e,gradient:i,variant:r||`filled`,autoContrast:o});return{root:{"--ti-size":C(t,`ti-size`),"--ti-radius":n===void 0?void 0:T(n),"--ti-bg":a||r?s.background:void 0,"--ti-color":a||r?s.color:void 0,"--ti-bd":a||r?s.border:void 0}}}),Vu=K(e=>{let t=W(`ThemeIcon`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,autoContrast:l,attributes:u,...d}=t,f=G({name:`ThemeIcon`,classes:zu,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:u,vars:s,varsResolver:Bu});return(0,c.jsx)(q,{...f(`root`),...d})});Vu.classes=zu,Vu.varsResolver=Bu,Vu.displayName=`@mantine/core/ThemeIcon`;var Hu=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],Uu=[`xs`,`sm`,`md`,`lg`,`xl`];function Wu(e,t){let n=t===void 0?`h${e}`:t;return Hu.includes(n)?{fontSize:`var(--mantine-${n}-font-size)`,fontWeight:`var(--mantine-${n}-font-weight)`,lineHeight:`var(--mantine-${n}-line-height)`}:Uu.includes(n)?{fontSize:`var(--mantine-font-size-${n})`,fontWeight:`var(--mantine-h${e}-font-weight)`,lineHeight:`var(--mantine-h${e}-line-height)`}:{fontSize:h(n),fontWeight:`var(--mantine-h${e}-font-weight)`,lineHeight:`var(--mantine-h${e}-line-height)`}}var Gu={root:`m_8a5d1357`},Ku={order:1},qu=H((e,{order:t,size:n,lineClamp:r,textWrap:i})=>{let a=Wu(t||1,n);return{root:{"--title-fw":a.fontWeight,"--title-lh":a.lineHeight,"--title-fz":a.fontSize,"--title-line-clamp":typeof r==`number`?r.toString():void 0,"--title-text-wrap":i}}}),Ju=K(e=>{let t=W(`Title`,Ku,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,order:s,vars:l,size:u,variant:d,lineClamp:f,textWrap:p,mod:m,attributes:h,...g}=t,_=G({name:`Title`,props:t,classes:Gu,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:h,vars:l,varsResolver:qu});return[1,2,3,4,5,6].includes(s)?(0,c.jsx)(q,{..._(`root`),component:`h${s}`,variant:d,mod:[{order:s,lineClamp:typeof f==`number`},m],size:u,...g}):null});Ju.classes=Gu,Ju.varsResolver=qu,Ju.displayName=`@mantine/core/Title`;var Yu=(0,o.createContext)({color:`currentColor`,size:`1em`,weight:`regular`,mirrored:!1}),Xu=o.forwardRef((e,t)=>{let{alt:n,color:r,size:i,weight:a,mirrored:s,children:c,weights:l,...u}=e,{color:d=`currentColor`,size:f,weight:p=`regular`,mirrored:m=!1,...h}=o.useContext(Yu);return o.createElement(`svg`,{ref:t,xmlns:`http://www.w3.org/2000/svg`,width:i??f,height:i??f,fill:r??d,viewBox:`0 0 256 256`,transform:s||m?`scale(-1, 1)`:void 0,...h,...u},!!n&&o.createElement(`title`,null,n),c,l.get(a??p))});Xu.displayName=`IconBase`;var Zu=new Map([[`bold`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`}))]]),Qu=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:Zu}));Qu.displayName=`ArrowCounterClockwiseIcon`;var $u=Qu,ed=new Map([[`bold`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z`}))],[`duotone`,o.createElement(o.Fragment,null,o.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`}),o.createElement(`path`,{d:`M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`fill`,o.createElement(o.Fragment,null,o.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,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`light`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z`}))],[`regular`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`thin`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z`}))]]),td=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:ed}));td.displayName=`XIcon`;var nd=td,rd=new Map([[`bold`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M176.49,95.51a12,12,0,0,1,0,17l-56,56a12,12,0,0,1-17,0l-24-24a12,12,0,1,1,17-17L112,143l47.51-47.52A12,12,0,0,1,176.49,95.51ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z`}))],[`duotone`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),o.createElement(`path`,{d:`M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`fill`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,85.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`thin`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),id=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:rd}));id.displayName=`CheckCircleIcon`;var ad=new Map([[`bold`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`}))]]),od=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:ad}));od.displayName=`InfoIcon`;var sd=od,cd=new Map([[`bold`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M240.26,186.1,152.81,34.23h0a28.74,28.74,0,0,0-49.62,0L15.74,186.1a27.45,27.45,0,0,0,0,27.71A28.31,28.31,0,0,0,40.55,228h174.9a28.31,28.31,0,0,0,24.79-14.19A27.45,27.45,0,0,0,240.26,186.1Zm-20.8,15.7a4.46,4.46,0,0,1-4,2.2H40.55a4.46,4.46,0,0,1-4-2.2,3.56,3.56,0,0,1,0-3.73L124,46.2a4.77,4.77,0,0,1,8,0l87.44,151.87A3.56,3.56,0,0,1,219.46,201.8ZM116,136V104a12,12,0,0,1,24,0v32a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,176Z`}))],[`duotone`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z`,opacity:`0.2`}),o.createElement(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z`}))],[`fill`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z`}))],[`light`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M235.07,189.09,147.61,37.22h0a22.75,22.75,0,0,0-39.22,0L20.93,189.09a21.53,21.53,0,0,0,0,21.72A22.35,22.35,0,0,0,40.55,222h174.9a22.35,22.35,0,0,0,19.6-11.19A21.53,21.53,0,0,0,235.07,189.09ZM224.66,204.8a10.46,10.46,0,0,1-9.21,5.2H40.55a10.46,10.46,0,0,1-9.21-5.2,9.51,9.51,0,0,1,0-9.72L118.79,43.21a10.75,10.75,0,0,1,18.42,0l87.46,151.87A9.51,9.51,0,0,1,224.66,204.8ZM122,144V104a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,180Z`}))],[`regular`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z`}))],[`thin`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M233.34,190.09,145.88,38.22h0a20.75,20.75,0,0,0-35.76,0L22.66,190.09a19.52,19.52,0,0,0,0,19.71A20.36,20.36,0,0,0,40.54,220H215.46a20.36,20.36,0,0,0,17.86-10.2A19.52,19.52,0,0,0,233.34,190.09ZM226.4,205.8a12.47,12.47,0,0,1-10.94,6.2H40.54a12.47,12.47,0,0,1-10.94-6.2,11.45,11.45,0,0,1,0-11.72L117.05,42.21a12.76,12.76,0,0,1,21.9,0L226.4,194.08A11.45,11.45,0,0,1,226.4,205.8ZM124,144V104a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,180Z`}))]]),ld=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:cd}));ld.displayName=`WarningIcon`;var ud=new Map([[`bold`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M168.49,104.49,145,128l23.52,23.51a12,12,0,0,1-17,17L128,145l-23.51,23.52a12,12,0,0,1-17-17L111,128,87.51,104.49a12,12,0,0,1,17-17L128,111l23.51-23.52a12,12,0,0,1,17,17ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z`}))],[`duotone`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),o.createElement(`path`,{d:`M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`fill`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm37.66,130.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`light`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M164.24,100.24,136.48,128l27.76,27.76a6,6,0,1,1-8.48,8.48L128,136.48l-27.76,27.76a6,6,0,0,1-8.48-8.48L119.52,128,91.76,100.24a6,6,0,0,1,8.48-8.48L128,119.52l27.76-27.76a6,6,0,0,1,8.48,8.48ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`thin`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M162.83,98.83,133.66,128l29.17,29.17a4,4,0,0,1-5.66,5.66L128,133.66,98.83,162.83a4,4,0,0,1-5.66-5.66L122.34,128,93.17,98.83a4,4,0,0,1,5.66-5.66L128,122.34l29.17-29.17a4,4,0,1,1,5.66,5.66ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),dd=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:ud}));dd.displayName=`XCircleIcon`;var fd=new Map([[`bold`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M208,28H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28Zm-4,24v92H179.31a19.86,19.86,0,0,0-14.14,5.86L147,168H109L90.83,149.86A19.86,19.86,0,0,0,76.69,144H52V52ZM52,204V168H75l18.14,18.14A19.86,19.86,0,0,0,107.31,192h41.38a19.86,19.86,0,0,0,14.14-5.86L181,168h23v36Z`}))],[`duotone`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,48V160H179.31a8,8,0,0,0-5.66,2.34l-19.31,19.32a8,8,0,0,1-5.66,2.34H107.31a8,8,0,0,1-5.66-2.34L82.34,162.34A8,8,0,0,0,76.68,160H40V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z`,opacity:`0.2`}),o.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,16V152h-28.7A15.86,15.86,0,0,0,168,156.69L148.69,176H107.31L88,156.68A15.89,15.89,0,0,0,76.69,152H48V48Zm0,160H48V168H76.69L96,187.32A15.89,15.89,0,0,0,107.31,192h41.38A15.86,15.86,0,0,0,160,187.31L179.31,168H208v40Z`}))],[`fill`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,176H48V168H76.69L96,187.32A15.89,15.89,0,0,0,107.31,192h41.38A15.86,15.86,0,0,0,160,187.31L179.31,168H208v40Z`}))],[`light`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M208,34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34ZM48,46H208a2,2,0,0,1,2,2V154H179.31a13.94,13.94,0,0,0-9.9,4.1L150.1,177.41a2,2,0,0,1-1.41.59H107.31a2,2,0,0,1-1.41-.58L86.59,158.1a13.94,13.94,0,0,0-9.9-4.1H46V48A2,2,0,0,1,48,46ZM208,210H48a2,2,0,0,1-2-2V166H76.69a2,2,0,0,1,1.41.58L97.41,185.9a13.94,13.94,0,0,0,9.9,4.1h41.38a13.94,13.94,0,0,0,9.9-4.1l19.31-19.31a2,2,0,0,1,1.41-.59H210v42A2,2,0,0,1,208,210Z`}))],[`regular`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,16V152h-28.7A15.86,15.86,0,0,0,168,156.69L148.69,176H107.31L88,156.69A15.86,15.86,0,0,0,76.69,152H48V48Zm0,160H48V168H76.69L96,187.31A15.86,15.86,0,0,0,107.31,192h41.38A15.86,15.86,0,0,0,160,187.31L179.31,168H208v40Z`}))],[`thin`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M208,36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36ZM48,44H208a4,4,0,0,1,4,4V156H179.31a12,12,0,0,0-8.48,3.51l-19.32,19.32a4,4,0,0,1-2.82,1.17H107.31a4,4,0,0,1-2.82-1.17L85.17,159.51A12,12,0,0,0,76.69,156H44V48A4,4,0,0,1,48,44ZM208,212H48a4,4,0,0,1-4-4V164H76.69a4,4,0,0,1,2.82,1.17l19.32,19.32a12,12,0,0,0,8.48,3.51h41.38a12,12,0,0,0,8.48-3.51l19.32-19.32a4,4,0,0,1,2.82-1.17H212v44A4,4,0,0,1,208,212Z`}))]]),pd=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:fd}));pd.displayName=`TrayIcon`;var md=new Map([[`bold`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`}))]]),hd=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:md}));hd.displayName=`WarningCircleIcon`;var gd=hd,_d=new Map([[`bold`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M196,76a16,16,0,1,1-16-16A16,16,0,0,1,196,76Zm48,22.74A84.3,84.3,0,0,1,160.11,180H160a83.52,83.52,0,0,1-23.65-3.38l-7.86,7.87A12,12,0,0,1,120,188H108v12a12,12,0,0,1-12,12H84v12a12,12,0,0,1-12,12H40a20,20,0,0,1-20-20V187.31a19.86,19.86,0,0,1,5.86-14.14l53.52-53.52A84,84,0,1,1,244,98.74ZM202.43,53.57A59.48,59.48,0,0,0,158,36c-32,1-58,27.89-58,59.89a59.69,59.69,0,0,0,4.2,22.19,12,12,0,0,1-2.55,13.21L44,189v23H60V200a12,12,0,0,1,12-12H84V176a12,12,0,0,1,12-12h19l9.65-9.65a12,12,0,0,1,13.22-2.55A59.58,59.58,0,0,0,160,156h.08c32,0,58.87-26.07,59.89-58A59.55,59.55,0,0,0,202.43,53.57Z`}))],[`duotone`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M232,98.36C230.73,136.92,198.67,168,160.09,168a71.68,71.68,0,0,1-26.92-5.17h0L120,176H96v24H72v24H40a8,8,0,0,1-8-8V187.31a8,8,0,0,1,2.34-5.65l58.83-58.83h0A71.68,71.68,0,0,1,88,95.91c0-38.58,31.08-70.64,69.64-71.87A72,72,0,0,1,232,98.36Z`,opacity:`0.2`}),o.createElement(`path`,{d:`M216.57,39.43A80,80,0,0,0,83.91,120.78L28.69,176A15.86,15.86,0,0,0,24,187.31V216a16,16,0,0,0,16,16H72a8,8,0,0,0,8-8V208H96a8,8,0,0,0,8-8V184h16a8,8,0,0,0,5.66-2.34l9.56-9.57A79.73,79.73,0,0,0,160,176h.1A80,80,0,0,0,216.57,39.43ZM224,98.1c-1.09,34.09-29.75,61.86-63.89,61.9H160a63.7,63.7,0,0,1-23.65-4.51,8,8,0,0,0-8.84,1.68L116.69,168H96a8,8,0,0,0-8,8v16H72a8,8,0,0,0-8,8v16H40V187.31l58.83-58.82a8,8,0,0,0,1.68-8.84A63.72,63.72,0,0,1,96,95.92c0-34.14,27.81-62.8,61.9-63.89A64,64,0,0,1,224,98.1ZM192,76a12,12,0,1,1-12-12A12,12,0,0,1,192,76Z`}))],[`fill`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216.57,39.43A80,80,0,0,0,83.91,120.78L28.69,176A15.86,15.86,0,0,0,24,187.31V216a16,16,0,0,0,16,16H72a8,8,0,0,0,8-8V208H96a8,8,0,0,0,8-8V184h16a8,8,0,0,0,5.66-2.34l9.56-9.57A79.73,79.73,0,0,0,160,176h.1A80,80,0,0,0,216.57,39.43ZM180,92a16,16,0,1,1,16-16A16,16,0,0,1,180,92Z`}))],[`light`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M215.15,40.85A78,78,0,0,0,86.2,121.31l-56.1,56.1a13.94,13.94,0,0,0-4.1,9.9V216a14,14,0,0,0,14,14H72a6,6,0,0,0,6-6V206H96a6,6,0,0,0,6-6V182h18a6,6,0,0,0,4.24-1.76l10.45-10.44A77.59,77.59,0,0,0,160,174h.1A78,78,0,0,0,215.15,40.85ZM226,98.16c-1.12,35.16-30.67,63.8-65.88,63.84a65.93,65.93,0,0,1-24.51-4.67,6,6,0,0,0-6.64,1.26L117.51,170H96a6,6,0,0,0-6,6v18H72a6,6,0,0,0-6,6v18H40a2,2,0,0,1-2-2V187.31a2,2,0,0,1,.58-1.41l58.83-58.83a6,6,0,0,0,1.26-6.64A65.61,65.61,0,0,1,94,95.92C94,60.71,122.68,31.16,157.83,30A66,66,0,0,1,226,98.16ZM190,76a10,10,0,1,1-10-10A10,10,0,0,1,190,76Z`}))],[`regular`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216.57,39.43A80,80,0,0,0,83.91,120.78L28.69,176A15.86,15.86,0,0,0,24,187.31V216a16,16,0,0,0,16,16H72a8,8,0,0,0,8-8V208H96a8,8,0,0,0,8-8V184h16a8,8,0,0,0,5.66-2.34l9.56-9.57A79.73,79.73,0,0,0,160,176h.1A80,80,0,0,0,216.57,39.43ZM224,98.1c-1.09,34.09-29.75,61.86-63.89,61.9H160a63.7,63.7,0,0,1-23.65-4.51,8,8,0,0,0-8.84,1.68L116.69,168H96a8,8,0,0,0-8,8v16H72a8,8,0,0,0-8,8v16H40V187.31l58.83-58.82a8,8,0,0,0,1.68-8.84A63.72,63.72,0,0,1,96,95.92c0-34.14,27.81-62.8,61.9-63.89A64,64,0,0,1,224,98.1ZM192,76a12,12,0,1,1-12-12A12,12,0,0,1,192,76Z`}))],[`thin`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M213.74,42.26A76,76,0,0,0,88.51,121.84l-57,57A11.93,11.93,0,0,0,28,187.31V216a12,12,0,0,0,12,12H72a4,4,0,0,0,4-4V204H96a4,4,0,0,0,4-4V180h20a4,4,0,0,0,2.83-1.17l11.33-11.34A75.72,75.72,0,0,0,160,172h.1A76,76,0,0,0,213.74,42.26Zm14.22,56c-1.15,36.22-31.6,65.72-67.87,65.77H160a67.52,67.52,0,0,1-25.21-4.83,4,4,0,0,0-4.45.83l-12,12H96a4,4,0,0,0-4,4v20H72a4,4,0,0,0-4,4v20H40a4,4,0,0,1-4-4V187.31a4.06,4.06,0,0,1,1.17-2.83L96,125.66a4,4,0,0,0,.83-4.45A67.51,67.51,0,0,1,92,95.91C92,59.64,121.55,29.19,157.77,28A68,68,0,0,1,228,98.23ZM188,76a8,8,0,1,1-8-8A8,8,0,0,1,188,76Z`}))]]),vd=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:_d}));vd.displayName=`KeyIcon`;var yd={sm:`26rem`,md:`32rem`,lg:`48rem`};function bd({brand:e,brandPlacement:t=`above`,children:n,footer:r,size:i,aside:a,surface:o=`card`}){let s=a!=null,l=o===`plain`&&!s,u=s&&i===`sm`?`md`:i??(s?`lg`:`sm`),d=e!=null&&(0,c.jsx)(Is,{justify:`center`,gap:`xs`,children:typeof e==`string`?(0,c.jsx)(Z,{fw:700,size:`lg`,children:e}):e});return(0,c.jsx)(tu,{mih:`100dvh`,px:`md`,py:`xl`,children:(0,c.jsxs)($,{gap:`lg`,w:`100%`,maw:yd[u],children:[t===`above`&&d,(0,c.jsx)(Ko,{"data-labstack-auth-surface":l?`plain`:`card`,withBorder:!l,bg:l?`transparent`:void 0,p:s||l?0:{base:`lg`,sm:`xl`},style:{overflow:`hidden`},children:(0,c.jsxs)(Ll,{direction:{base:`column`,sm:`row`},gap:s?0:`lg`,children:[s&&(0,c.jsx)(q,{"data-labstack-auth-aside":!0,visibleFrom:`sm`,p:`md`,style:{flex:`1 1 0`,minWidth:`10rem`,overflowWrap:`anywhere`,background:`var(--labstack-inset, var(--mantine-color-default-hover))`},children:a}),(0,c.jsx)(q,{miw:{base:0,sm:s?`20rem`:0},p:s?{base:`lg`,sm:`xl`}:0,style:{flex:`1 1 0`},children:(0,c.jsxs)($,{gap:`lg`,children:[t===`inside`&&d,n]})})]})}),r!=null&&(0,c.jsx)(q,{ta:`center`,fz:`xs`,c:`dimmed`,children:r})]})})}var xd={neutral:`gray`,info:`blue`,success:`green`,warning:`yellow`,danger:`red`};function Sd(e,t){return e.other.labstackTones?.[t]??xd[t]}function Cd(e){return Sd(dt(),e)}function wd(e){return`var(--mantine-color-${e.split(`.`)[0]}-text)`}function Td(e){return`var(--mantine-color-${e.split(`.`)[0]}-light)`}var Ed={neutral:null,info:od,success:id,warning:ld,danger:dd};function Dd(e){return Ed[e]!=null}function Od({tone:e,size:t=`1em`,weight:n=`regular`}){let r=Ed[e];return r?(0,c.jsx)(r,{size:t,weight:n,"aria-hidden":`true`}):null}function kd({tone:e,title:t,children:n,detail:r,onRetry:i,retryLabel:a=`Try again`,onDismiss:o,dismissLabel:s=`Dismiss`,prominent:l=e===`warning`||e===`danger`,live:u=!0}){let d=Cd(e),f=Cd(`neutral`),p=e===`danger`;return(0,c.jsx)(Ko,{py:`sm`,pl:`sm`,pr:i||o?`xs`:`sm`,bg:l?Td(d):`var(--mantine-color-default-hover)`,style:{borderInlineStart:`3px solid ${wd(d)}`,borderStartStartRadius:0,borderEndStartRadius:0},role:u?p?`alert`:`status`:void 0,"aria-live":u?p?`assertive`:`polite`:void 0,children:(0,c.jsxs)(Is,{gap:`sm`,align:`flex-start`,wrap:`nowrap`,children:[(0,c.jsx)(Z,{component:`span`,lh:1,pt:2,c:wd(d),flex:`0 0 auto`,children:(0,c.jsx)(Od,{tone:e,size:18,weight:`fill`})}),(0,c.jsxs)(Ll,{flex:1,miw:0,gap:`xs`,direction:{base:`column`,sm:`row`},align:`flex-start`,children:[(0,c.jsxs)(q,{flex:1,miw:0,py:1,children:[t!=null&&(0,c.jsx)(Z,{component:`div`,size:`sm`,fw:600,mb:2,children:t}),(0,c.jsxs)(Z,{component:`div`,size:`sm`,style:{overflowWrap:`anywhere`},children:[n,r!=null&&(0,c.jsxs)(Z,{component:`span`,inherit:!0,c:`dimmed`,children:[` `,r]})]})]}),i&&(0,c.jsx)(Q,{variant:`subtle`,color:f,size:`compact-sm`,leftSection:(0,c.jsx)(Qu,{size:14,weight:`bold`,"aria-hidden":`true`}),onClick:i,type:`button`,children:a})]}),o&&(0,c.jsx)(Es,{variant:`subtle`,color:f,size:`md`,onClick:o,"aria-label":s,children:(0,c.jsx)(td,{size:14,"aria-hidden":`true`})})]})})}function Ad({opened:e,onClose:t,title:n,children:r,confirmLabel:i,onConfirm:a,cancelLabel:s=`Cancel`,pending:l=null,error:u,tone:d=`danger`,confirmText:f}){let p=dt(),m=d===`primary`?void 0:Sd(p,d),h=l===`confirm`,g=N(`(max-width: 36em)`),[_,v]=(0,o.useState)(``),y=(0,o.useRef)(null);(0,o.useEffect)(()=>{e&&h&&y.current?.focus()},[e,h]),(0,o.useEffect)(()=>{e||v(``)},[e]);let b=f!=null&&_!==f;return(0,c.jsx)(xu,{opened:e,onClose:h?()=>{}:t,title:(0,c.jsx)(Z,{component:`span`,fw:600,size:`lg`,children:n}),centered:!0,closeOnEscape:!h,closeOnClickOutside:!h,withCloseButton:!h,closeButtonProps:{"aria-label":`Close`},children:(0,c.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),!b&&!h&&a()},children:(0,c.jsxs)($,{gap:`md`,children:[(0,c.jsx)(Z,{component:`div`,size:`sm`,c:`dimmed`,ref:y,tabIndex:-1,"data-autofocus":h||void 0,children:r}),f!=null&&(0,c.jsx)(Ru,{label:(0,c.jsxs)(c.Fragment,{children:[`Type`,` `,(0,c.jsx)(Z,{component:`span`,inherit:!0,ff:`monospace`,fw:600,children:f}),` `,`to confirm`]}),value:_,onChange:e=>v(e.currentTarget.value),disabled:h,autoComplete:`off`,"data-autofocus":!h||void 0}),u!=null&&(0,c.jsx)(kd,{tone:`danger`,children:u}),(0,c.jsxs)(Is,{justify:`flex-end`,gap:`sm`,style:g?{flexDirection:`column-reverse`,alignItems:`stretch`}:void 0,children:[(0,c.jsx)(Q,{variant:`default`,"data-autofocus":!h&&f==null||void 0,onClick:t,disabled:h,type:`button`,children:s}),(0,c.jsx)(Q,{color:m,type:`submit`,loading:h,disabled:b,children:i})]})]})})})}var jd=`calc(var(--mantine-spacing-xs) * 2 + var(--mantine-font-size-sm) * var(--mantine-line-height))`;function Md({state:e,loadingLabel:t=`Loading…`,rows:n=3,skeleton:r,empty:i,error:a,variant:o=`inline`,children:s}){let l=Cd(`danger`),u=Cd(`neutral`);if(e===`ready`)return s;let d=o===`page`;if(e===`loading`)return r!=null&&r!==!1&&r!==!0&&r!==``?(0,c.jsxs)(q,{role:`status`,children:[(0,c.jsx)(Uo,{children:t}),(0,c.jsx)(q,{"aria-hidden":`true`,inert:!0,children:r})]}):d?(0,c.jsx)(tu,{mih:`60dvh`,p:`xl`,children:(0,c.jsxs)($,{align:`center`,gap:`sm`,role:`status`,children:[(0,c.jsx)(vs,{size:`md`,"aria-hidden":`true`}),(0,c.jsx)(Z,{size:`sm`,c:`dimmed`,children:t})]})}):(0,c.jsxs)($,{gap:`sm`,role:`status`,children:[(0,c.jsx)(Z,{size:`sm`,c:`dimmed`,children:t}),(0,c.jsx)($,{gap:4,children:Array.from({length:n},(e,t)=>(0,c.jsx)(Pu,{height:jd},t))})]});if(e===`empty`){let e=(0,c.jsxs)($,{align:`center`,gap:`sm`,ta:`center`,maw:`28rem`,mx:`auto`,children:[(0,c.jsx)(Vu,{variant:`light`,color:u,size:d?56:44,children:i?.icon??(0,c.jsx)(pd,{size:d?28:22,"aria-hidden":`true`})}),(0,c.jsx)(Z,{component:`div`,fw:600,size:d?`xl`:`lg`,children:i?.title??`Nothing here yet`}),i?.description!=null&&(0,c.jsx)(Z,{component:`div`,size:`sm`,c:`dimmed`,children:i.description}),i?.action!=null&&(0,c.jsx)(q,{mt:`xs`,children:i.action})]});return d?(0,c.jsx)(tu,{mih:`60dvh`,p:`xl`,children:e}):(0,c.jsx)(Ko,{withBorder:!0,py:`xl`,px:`lg`,children:e})}return d?(0,c.jsx)(tu,{mih:`60dvh`,p:`xl`,children:(0,c.jsxs)($,{align:`center`,gap:`sm`,ta:`center`,maw:`28rem`,role:`alert`,children:[(0,c.jsx)(Vu,{variant:`light`,color:l,size:56,children:(0,c.jsx)(hd,{size:28,"aria-hidden":`true`})}),(0,c.jsx)(Ju,{order:2,size:`h3`,children:a?.title??a?.message??`Something went wrong`}),a?.title!=null&&(0,c.jsx)(Z,{component:`div`,c:`dimmed`,children:a.message}),a?.detail!=null&&(0,c.jsx)(Z,{component:`div`,size:`sm`,c:`dimmed`,children:a.detail}),a?.onRetry&&(0,c.jsx)(Q,{mt:`xs`,leftSection:(0,c.jsx)(Qu,{size:16,weight:`bold`,"aria-hidden":`true`}),onClick:a.onRetry,type:`button`,children:a.retryLabel??`Try again`})]})}):(0,c.jsx)(kd,{tone:`danger`,title:a?.title,detail:a?.detail,onRetry:a?.onRetry,retryLabel:a?.retryLabel,children:a?.message??`Something went wrong.`})}var Nd={emailLabel:`Email`,emailPlaceholder:`you@example.com`,continue:`Continue`,or:`or`,passkey:`Sign in with a passkey`,passkeyUnavailable:`Passkeys are not available on this device. Use an email code.`,passkeyPending:`Complete the passkey request in your browser or password manager.`,useCode:`Use email code instead`,codeTitle:`Check your email`,codeSent:(e,t,n)=>(0,c.jsxs)(c.Fragment,{children:[`If `,e,` can sign in, a `,t,`-digit code is on its way.`,n!=null&&` It works for ${n} minutes.`]}),codeLabel:`Verification code`,verify:`Verify and continue`,verifying:`Verifying…`,incompleteCode:e=>`Enter all ${e} digits of the code.`,resend:`Send a new code`,resendIn:e=>`Send a new code in ${e}`,changeEmail:`Use a different email`};function Pd(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`}function Fd({children:e}){return(0,c.jsx)(Z,{component:`div`,size:`xs`,fw:600,tt:`uppercase`,lts:`0.08em`,c:`dimmed`,children:e})}function Id({children:e}){return(0,c.jsx)(Z,{component:`div`,size:`xs`,c:`dimmed`,ta:`center`,children:e})}function Ld({step:e,title:t=`Sign in`,description:n=`Use your email. No password needed.`,invitation:r,email:i,onEmailChange:a,onSendCode:s,emailError:l,code:u,onCodeChange:d,onVerify:f,codeLength:p=6,autoVerify:m=!0,expiresInMinutes:h,codeNote:g,resendIn:_=0,onResend:v,onChangeEmail:y,pending:b=null,error:x,notice:S,passkey:C,footer:w,stepLabels:T={},labels:E,inputRef:D,autoFocus:O=!0}){let k={...Nd,...E},A=Cd(`neutral`),j=(0,o.useRef)(null),M=(0,o.useRef)(C?.autofill);M.current=C?.autofill;let N=C?.autofill!=null,P=C?.available;(0,o.useEffect)(()=>{if(e!==`email`||!P||!N||b!=null)return;let t=new AbortController;return j.current=t,M.current?.(t.signal),()=>t.abort()},[e,P,N,b]);let ee=(0,o.useRef)(null),F=B(ee,D),te=(0,o.useRef)(null);(0,o.useEffect)(()=>{u.length{I&&(e.length{re&&I&&ee.current?.focus()},[re,I]);let ie=(0,c.jsxs)(c.Fragment,{children:[x!=null&&(0,c.jsx)(kd,{tone:`danger`,children:x}),x==null&&L&&e===`code`&&(0,c.jsx)(kd,{tone:`danger`,children:k.incompleteCode(p)}),S!=null&&(0,c.jsx)(kd,{tone:`info`,children:S})]});if(e===`code`){let e=b===`verify`;return(0,c.jsxs)($,{gap:`lg`,children:[(0,c.jsxs)($,{gap:8,children:[T&&(0,c.jsx)(Fd,{children:T.code??`2 · Code`}),(0,c.jsx)(Ju,{order:1,size:`h2`,children:k.codeTitle}),(0,c.jsx)(Z,{size:`sm`,c:`dimmed`,children:k.codeSent((0,c.jsx)(Z,{component:`span`,inherit:!0,c:`var(--mantine-color-text)`,fw:500,style:{overflowWrap:`anywhere`},children:i}),p,h)})]}),(0,c.jsx)(`form`,{noValidate:!0,onSubmit:e=>{e.preventDefault(),ne(u)},children:(0,c.jsxs)($,{gap:`md`,children:[(0,c.jsx)(Au,{ref:F,length:p,type:`number`,oneTimeCode:!0,autoFocus:O,size:`md`,gap:`xs`,placeholder:``,ariaLabel:k.codeLabel,getInputProps:e=>({"aria-label":`${k.codeLabel}, digit ${e+1} of ${p}`}),value:u,onChange:e=>{d(e),R(!1),e.length0?(0,c.jsx)(Z,{size:`sm`,c:`dimmed`,ta:`center`,children:k.resendIn(Pd(_))}):(0,c.jsx)(Q,{variant:`subtle`,size:`sm`,disabled:!I&&b!==`resend`,loading:b===`resend`,onClick:v,type:`button`,children:k.resend})),(0,c.jsx)(Q,{variant:`subtle`,color:A,size:`sm`,disabled:e,onClick:y,type:`button`,children:k.changeEmail})]}),w!=null&&(0,c.jsx)(Id,{children:w})]})}let ae=b===`passkey`;return(0,c.jsxs)($,{gap:`lg`,children:[(0,c.jsxs)($,{gap:8,children:[T&&(0,c.jsx)(Fd,{children:T.email??`1 · Email`}),(0,c.jsx)(Ju,{order:1,size:`h2`,children:t}),n!=null&&(0,c.jsx)(Z,{size:`sm`,c:`dimmed`,children:n}),r!=null&&(0,c.jsx)(Z,{size:`sm`,fw:500,children:r})]}),(0,c.jsx)(`form`,{noValidate:!0,onSubmit:e=>{e.preventDefault(),I&&(j.current?.abort(),s())},children:(0,c.jsxs)($,{gap:`md`,children:[(0,c.jsx)(Ru,{ref:F,size:`md`,label:k.emailLabel,type:`email`,name:`email`,autoComplete:C?`email webauthn`:`email`,autoFocus:O,required:!0,withAsterisk:!1,placeholder:k.emailPlaceholder,value:i,error:l,onChange:e=>a(e.currentTarget.value),disabled:b===`send`||ae}),ie,(0,c.jsx)(Q,{type:`submit`,fullWidth:!0,size:`md`,loading:b===`send`,disabled:ae,children:k.continue})]})}),C&&(0,c.jsxs)($,{gap:`sm`,children:[(0,c.jsx)(au,{label:k.or,labelPosition:`center`}),(0,c.jsx)(Q,{variant:`default`,fullWidth:!0,size:`md`,leftSection:(0,c.jsx)(vd,{size:18,"aria-hidden":`true`}),onClick:()=>{j.current?.abort(),C.onStart()},loading:ae,disabled:!C.available||b===`send`,type:`button`,children:k.passkey}),!C.available&&(0,c.jsx)(Z,{size:`sm`,c:`dimmed`,ta:`center`,role:`status`,children:k.passkeyUnavailable}),ae&&(0,c.jsxs)(q,{ta:`center`,children:[(0,c.jsx)(Z,{size:`sm`,c:`dimmed`,role:`status`,children:k.passkeyPending}),C.onUseCode&&(0,c.jsx)(Q,{variant:`subtle`,color:A,size:`sm`,mt:4,onClick:C.onUseCode,type:`button`,children:k.useCode})]})]}),w!=null&&(0,c.jsx)(Id,{children:w})]})}function Rd({items:e,label:t,emptyValue:n=`Not set`,layout:r=`columns`,labelWidth:i=`12rem`,withDividers:a=!0}){let o=r===`columns`;return(0,c.jsx)(q,{component:`dl`,"aria-label":t,m:0,children:e.map((e,t)=>(0,c.jsxs)(q,{display:o?{base:`block`,sm:`flex`}:`block`,py:`sm`,style:a&&t>0?{borderTop:`1px solid var(--labstack-border, var(--mantine-color-default-border))`}:void 0,children:[(0,c.jsx)(q,{component:`dt`,w:o?{sm:i}:void 0,miw:o?{sm:i}:void 0,pr:o?{sm:`md`}:void 0,mb:o?{base:4,sm:0}:4,children:(0,c.jsx)(Z,{component:`span`,size:`sm`,c:`dimmed`,style:{overflowWrap:`anywhere`},children:e.label})}),(0,c.jsxs)(q,{component:`dd`,m:0,style:{flex:1,minWidth:0},children:[e.value==null||e.value===``?(0,c.jsx)(Z,{component:`span`,size:`sm`,c:`dimmed`,fs:`italic`,children:n}):(0,c.jsx)(Z,{component:`div`,size:`sm`,fw:500,style:{overflowWrap:`anywhere`},children:e.value}),e.hint!=null&&(0,c.jsx)(Z,{component:`div`,size:`xs`,c:`dimmed`,mt:2,style:{overflowWrap:`anywhere`},children:e.hint})]})]},t))})}(0,o.forwardRef)(function({current:e=`page`,active:t,...n},r){return(0,c.jsx)(wu,{ref:r,active:t,"aria-current":t?e:void 0,...n})});function zd({title:e,eyebrow:t,description:n,meta:r,actions:i,order:a=1,withDivider:o=!1}){let s=(0,c.jsxs)($,{component:`header`,gap:a===1?6:4,children:[t!=null&&(0,c.jsx)(Z,{component:`div`,size:`xs`,fw:600,tt:`uppercase`,lts:`0.08em`,c:`dimmed`,children:t}),(0,c.jsxs)(Is,{justify:`space-between`,align:`flex-start`,wrap:`wrap`,gap:`md`,children:[(0,c.jsxs)($,{gap:a===1?6:4,flex:`1 1 24rem`,miw:0,children:[(0,c.jsx)(Ju,{order:a,style:{textWrap:`balance`},children:e}),n!=null&&(0,c.jsx)(Z,{component:`div`,c:`dimmed`,size:a===1?`md`:`sm`,maw:`65ch`,children:n}),r!=null&&(0,c.jsx)(Z,{component:`div`,size:`sm`,c:`dimmed`,mt:2,children:r})]}),i!=null&&(0,c.jsx)(Is,{gap:`sm`,wrap:`wrap`,children:i})]})]});return o?(0,c.jsxs)($,{gap:`md`,children:[s,(0,c.jsx)(au,{})]}):s}var Bd={sm:12,md:14,lg:16};function Vd({tone:e,children:t,icon:n,variant:r,size:i=`md`}){let a=Cd(e),o=n===!1?null:n??(Dd(e)?(0,c.jsx)(Od,{tone:e,size:Bd[i],weight:`bold`}):null),s=r??(e===`neutral`?`outline`:`light`),l=s===`outline`&&a===xd.neutral?{root:{"--badge-bd":`1px solid var(--labstack-control-border, var(--mantine-color-default-border))`,"--badge-color":`var(--labstack-muted, var(--mantine-color-dimmed))`}}:void 0;return(0,c.jsx)(Gl,{color:a,variant:s,vars:l?()=>l:void 0,size:i,tt:`none`,fw:500,leftSection:o??void 0,styles:{root:{flexShrink:0,maxWidth:`none`},label:{whiteSpace:`nowrap`,overflow:`visible`}},children:t})}function Hd(e){if(!/^#?(?:[\da-f]{3}|[\da-f]{6})$/i.test(e))throw Error(`Expected a 3- or 6-digit hex color, received ${e}`);let t=e.replace(/^#/,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=[0,2,4].map(e=>{let t=Number.parseInt(n.slice(e,e+2),16)/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4});return r[0]*.2126+r[1]*.7152+r[2]*.0722}function Ud(e,t){let n=Hd(e),r=Hd(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Wd(e){return Ud(e,`#000000`)>Ud(e,`#ffffff`)?`#000000`:`#ffffff`}var Gd={primary:`ink`,accent:[`#F1F0FF`,`#E4E2FF`,`#CDC9FF`,`#B5B0FF`,`#A29CFF`,`#8F8CFF`,`#756DEB`,`#5A50D8`,`#463DAE`,`#332B81`],colors:{ok:[`#eefbe6`,`#dcf7cc`,`#c2f0a6`,`#a5e880`,`#8fe06c`,`#7fd962`,`#66c04b`,`#4f9c3a`,`#3b7a2c`,`#2a5a1f`],warn:[`#fff5e6`,`#ffe9c9`,`#ffd79b`,`#ffc571`,`#ffbc62`,`#ffb454`,`#ef9c33`,`#c87d21`,`#9c5f16`,`#74460f`],bad:[`#fdecee`,`#fbd9dc`,`#f8b6bc`,`#f59099`,`#f37d87`,`#f26d78`,`#e04d5a`,`#c03642`,`#96262f`,`#6f1a21`],info:[`#e8f6ff`,`#ccebff`,`#a3daff`,`#7dcbff`,`#66c5ff`,`#59c2ff`,`#33a7e6`,`#1e86bd`,`#146694`,`#0d4a6d`]},tones:{success:`ok`,warning:`warn`,danger:`bad`,info:`info`},fontFamily:`"Geist Variable", "Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,fontFamilyMonospace:`"Geist Mono Variable", "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,displayWeight:600,radius:`soft`,elevation:`bordered`,density:`compact`,controlSizes:{sm:32,md:36,lg:40},focus:`ring`,surfaces:{light:{ground:`#F5F5F6`,raised:`#FFFFFF`,inset:`#EFEFF1`,hover:`#EDEDEF`,border:`#E3E3E6`,borderSoft:`#ECECEE`,controlBorder:`#6D6D73`,text:`#111113`,muted:`#53535B`},dark:{ground:`#0B0B0C`,raised:`#121214`,inset:`#08080A`,hover:`#1A1A1D`,border:`#232327`,borderSoft:`#1A1A1E`,controlBorder:`#828288`,text:`#EDEDEF`,muted:`#A1A1A9`}},typeScale:{small:12,body:14,title:16,section:20,page:28},chart:{series:{light:[`#2a78d6`,`#eb6834`,`#19a170`,`#4a3aa7`,`#bd8000`,`#ce6d92`],dark:[`#3987e5`,`#d95926`,`#199e70`,`#9085e9`,`#c98500`,`#d55181`]}}},Kd={micro:11,small:12,body:14,title:16,section:22,page:28},qd={prose:720,article:960,page:1200,app:1500},Jd={light:7,dark:5},Yd={square:{control:0,surface:0,overlay:0},soft:{control:4,surface:8,overlay:12},round:{control:6,surface:16,overlay:24}};function Xd(e){return`#${e.map(e=>Math.round(e).toString(16).padStart(2,`0`)).join(``)}`}function Zd(e,t,n){let r=e=>{let t=e.replace(/^#/,``);return t.length===3?[...t].map(e=>e+e).join(``):t},i=r(e),a=r(t);return Xd([0,2,4].map(e=>{let t=Number.parseInt(i.slice(e,e+2),16);return t+(Number.parseInt(a.slice(e,e+2),16)-t)*n}))}function Qd(e,t){if(typeof e!=`string`||!/^#(?:[\da-f]{3}|[\da-f]{6})$/i.test(e))throw Error(`${t} must be opaque 3/6-digit hex`)}var $d=new WeakSet;function ef(e){let t=e.currentTarget;!t.readOnly&&!t.disabled&&t.select()}function tf(e){let t=e.currentTarget;$d.delete(t),t!==t.ownerDocument.activeElement&&!t.readOnly&&!t.disabled&&($d.add(t),t.select())}function nf(e){$d.delete(e.currentTarget)&&!e.currentTarget.readOnly&&e.currentTarget.select()}function rf(e,t,n){let r=e=>t.every(t=>Ud(e,t)>=n);if(r(e))return e;let i=[`#000000`,`#ffffff`].find(r);if(!i)throw Error(`Neutral surfaces cannot share accessible text`);for(let t=1;t<=100;t++){let n=Zd(e,i,t/100);if(r(n))return n}return i}function af(e,t){if(!Number.isFinite(t))throw Error(`neutralTint hue must be finite`);let n=(t%360+360)%360;return e.map(e=>{let t=[1,3,5].map(t=>Number.parseInt(e.slice(t,t+2),16)/255),r=(Math.max(...t)+Math.min(...t))/2,i=.08*Math.min(r,1-r);return Xd([0,8,4].map(e=>{let t=(e+n/30)%12;return 255*(r-i*Math.max(-1,Math.min(t-3,9-t,1)))}))})}function of(e,t){let n=Ie({color:e,theme:t});if(n.isThemeColor)return`var(--labstack-color-${n.color}${n.shade===void 0?``:`-${n.shade}`}-contrast)`;if(/^#(?:[\da-f]{3}|[\da-f]{6})$/i.test(e))return Wd(e)}var sf=e=>{let t=e.color||e.theme.primaryColor,n=e.variant??`filled`,r=Ue({...e,color:t,variant:n});if(n!==`filled`||e.autoContrast===!1)return r;let i=of(t,e.theme);if(!i)return r;let a=Ie({color:t,theme:e.theme});return{...r,color:i,...a.isThemeColor&&a.shade!==void 0?{hover:`var(--labstack-color-${a.color}-${a.shade}-hover)`}:a.isThemeColor?{}:{hover:rf(Zd(t,`#000000`,.1),[i],4.5)}}};function cf(e,t){return t.iconColor||!(t.autoContrast??e.autoContrast)?void 0:of(t.color||e.primaryColor,e)}function lf(e){let t=/^var\(--mantine-color-(.+)-(filled|\d)\)$/.exec(e??``);return t?`var(--labstack-color-${t[1]}${t[2]===`filled`?``:`-${t[2]}`}-contrast)`:e&&/^#(?:[\da-f]{3}|[\da-f]{6})$/i.test(e)?Wd(e):void 0}function uf(e,t){return o.Children.map(e,e=>(0,o.isValidElement)(e)?e.props.__vars?.[`--sc-label-color`]?(0,o.cloneElement)(e,{__vars:{...e.props.__vars,"--sc-label-color":t}}):e.props.children?(0,o.cloneElement)(e,{children:uf(e.props.children,t)}):e:e)}function df(e,t,n){let{gray:r,dark:i}=e.colors,a=t===`dark`,o=n.surfaces?.[t];if(n.surfaces&&!o)throw Error(`surfaces (${t}) ground/raised/inset/hover are required`);if(o){for(let e of[`ground`,`raised`,`inset`,`hover`])Qd(o[e],`surfaces (${t}) ${e}`);for(let[e,n]of Object.entries(o))n!==void 0&&Qd(n,`surfaces (${t}) ${e}`)}let s=o?.ground??(a?i[7]:r[0]),c=o?.raised??(a?i[6]:e.white),l=o?.inset??(a?i[8]:r[1]),u=o?.hover??(a?i[5]:r[2]),d=(e,t=!1)=>a?Zd(c,e[5],t?.22:.15):e[t?2:1],f=[s,c,l,u],p=[s,c,l,u,...[...new Set([`brand`,...n.accent?[`accent`]:[],...Object.values(e.other.labstackTones).map(t=>Ie({color:t,theme:e}).color)])].flatMap(t=>{let n=e.colors[t];return n?[d(n),d(n,!0)]:[]})],m=Ie({color:e.other.labstackTones.danger,theme:e}).color,h=Ie({color:e.other.labstackTones.neutral,theme:e}).color,g=(e,n,r)=>{let i=o?.[e];if(i===void 0)try{return rf(n,e===`controlBorder`?f:p,r)}catch{throw Error(`surfaces (${t}) ${e} cannot meet ${r}:1 on every surface`)}if(p.some(e=>Ud(i,e)[`--labstack-${e}`,t]));if(o?.borderSoft!==void 0&&(n.primary===`ink`||Object.values(e.other.labstackTones).some(t=>Ie({color:t,theme:e}).color===`ink`)))for(let e of[v.hover,v[`border-soft`]]){let n=Ud(v.text,e);if(n<4.5)throw Error(`surfaces (${t}) borderSoft makes ink light hover text ${n.toFixed(2)}:1; need 4.5:1`)}n.elevation===`ring`&&(y[`--labstack-ring`]=a?`0 0 0 1px rgba(255,255,255,.09), 0 2px 2px rgba(0,0,0,.12)`:`0 0 0 1px rgba(0,0,0,.08), 0 2px 2px rgba(0,0,0,.04)`);let b=e=>`var(--labstack-${e})`;Object.assign(y,{"--mantine-color-body":b(`ground`),"--mantine-color-text":b(`text`),"--mantine-color-dimmed":b(`muted`),"--mantine-color-placeholder":b(`muted`),"--mantine-color-anchor":`var(--mantine-color-${n.accent?`accent`:`brand`}-text)`,"--labstack-focus":`var(--mantine-color-${n.accent?`accent`:`brand`}-text)`,"--labstack-selected":`var(--mantine-color-${n.accent?`accent`:`brand`}-light)`,"--labstack-selected-text":`var(--mantine-color-${n.accent?`accent`:`brand`}-text)`,"--mantine-color-disabled":b(`inset`),"--mantine-color-disabled-color":b(`faint`),"--mantine-color-disabled-border":b(`border`),...n.controlSizes?{"--labstack-control-sm":`${n.controlSizes.sm}px`,"--labstack-control-md":`${n.controlSizes.md}px`,"--labstack-control-lg":`${n.controlSizes.lg}px`}:{},"--mantine-color-default":b(`raised`),"--mantine-color-default-hover":b(`hover`),"--mantine-color-default-color":b(`text`),"--mantine-color-default-border":b(`control-border`),"--mantine-color-error":`var(--mantine-color-${m}-text)`,"--mantine-primary-color-contrast":`var(--labstack-color-brand-contrast)`});for(let[n,o]of Object.entries(e.colors)){let s=Jd[t];if((n===m||n===`red`)&&Wd(o[s])===`#000000`){for(let e=s+1;e<=9;e++)if(Ud(`#ffffff`,o[e])>=4.5){s=e;break}}let c=s,l=o[c],u=(n===m||n===`red`)&&Ud(`#ffffff`,l)>=4.5?`#ffffff`:Wd(l),g=e=>o[e===9?8:e+1],_=d(o),v=d(o,!0),b=o[a?Math.max(c-4,0):c],x=[...n===`brand`||n===`accent`||n===h||n===m?p:f,_,v,...n===m?[a?i[6]:e.white,a?i[5]:r[1]]:[],...f.map(e=>Zd(e,b,.05))],S;for(let e=c;e>=0&&e<=9;e+=a?-1:1)if(x.every(t=>Ud(o[e],t)>=4.5)){S=o[e];break}S??=rf(a?o[2]:o[9],x,4.5),Object.assign(y,{[`--labstack-color-${n}-contrast`]:u,[`--mantine-color-${n}-filled`]:l,[`--mantine-color-${n}-filled-hover`]:rf(g(c),[u],4.5),[`--mantine-color-${n}-text`]:S,[`--mantine-color-${n}-light`]:_,[`--mantine-color-${n}-light-hover`]:v,[`--mantine-color-${n}-light-color`]:S,[`--mantine-color-${n}-outline`]:S}),o.forEach((e,t)=>{let r=Wd(e);y[`--labstack-color-${n}-${t}-contrast`]=r,y[`--labstack-color-${n}-${t}-hover`]=rf(g(t),[r],4.5)})}for(let t of[...n.primary===`ink`?[`brand`]:[],...Object.values(e.other.labstackTones).includes(`ink`)?[`ink`]:[]]){let e=v.text,n=Wd(e);Object.assign(y,{[`--mantine-color-${t}-filled`]:e,[`--mantine-color-${t}-filled-hover`]:rf(v.muted,[n],4.5),[`--labstack-color-${t}-contrast`]:n,[`--mantine-color-${t}-text`]:e,[`--mantine-color-${t}-light-color`]:e,[`--mantine-color-${t}-outline`]:e,[`--mantine-color-${t}-light`]:v.hover,[`--mantine-color-${t}-light-hover`]:v[`border-soft`]})}if(o)for(let e of[`gray`,`dark`])Object.assign(y,{[`--mantine-color-${e}-light`]:v.hover,[`--mantine-color-${e}-light-hover`]:v[`border-soft`],[`--mantine-color-${e}-light-color`]:v.text});for(let[e,r]of Object.entries(n.variants??{})){let n=r[t];for(let[r,i]of Object.entries(n))if(i!==void 0&&(r!==`background`&&r!==`hover`||i!==`transparent`)&&!/^#(?:[\da-f]{3}|[\da-f]{6})$/i.test(i))throw Error(`Variant ${e} (${t}) ${r} must be opaque hex`);let i=[n.background,n.hover??n.background].flatMap(e=>e===`transparent`?f:[e]),a=n.color??(n.background===`transparent`?v.text:Wd(n.background));if(i.some(e=>Ud(a,e)<4.5))throw Error(`Variant ${e} (${t}) text must meet 4.5:1 at rest and hover`);let o=n.border;if(o&&[...f,...i].some(e=>Ud(o,e)<3))throw Error(`Variant ${e} (${t}) border must meet 3:1`);Object.assign(y,{[`--labstack-variant-${e}-background`]:n.background,[`--labstack-variant-${e}-hover`]:n.hover??n.background,[`--labstack-variant-${e}-color`]:a,[`--labstack-variant-${e}-border`]:n.border??`transparent`})}return y}var ff=[`NavLink`,`Tabs`,`Checkbox`,`Radio`,`Switch`,`Pagination`,`Chip`,`Stepper`,`Slider`,`RangeSlider`];function pf(e=Gd){if(!e.displayFont&&(e.displayWeight===700||e.displayTracking===-.03))throw Error(`Weight 700 and tracking -0.03em require displayFont`);let t=new Set([`filled`,`light`,`outline`,`subtle`,`transparent`,`white`,`default`,`gradient`]);for(let n of Object.keys(e.variants??{}))if(!/^[a-z][a-z0-9-]*$/.test(n)||t.has(n))throw Error(`Variant ${n} must be a new kebab-case name`);let n=e.lineWeight===void 0||e.lineWeight===1?{}:{borderWidth:`${e.lineWeight}px`},r=e.displayFont?{fontFamily:e.displayFont,fontWeight:e.displayWeight??650}:{},i=`${e.displayTracking??-.02}em`,a=Object.fromEntries(Object.entries(xd).map(([t,n])=>[t,e.tones?.[t]??n]));for(let[t,n]of Object.entries(e.colors??{})){if([`brand`,`ink`,`accent`].includes(t)||Object.hasOwn(rt.colors,t))throw Error(`colors ${t} cannot replace a built-in palette`);if(!Array.isArray(n)||n.length!==10)throw Error(`colors ${t} must have exactly ten colors`);for(let e of n)Qd(e,`colors ${t}`)}if(e.accent!==void 0){if(!Array.isArray(e.accent)||e.accent.length!==10)throw Error(`accent must have exactly ten colors`);for(let t of e.accent)Qd(t,`accent`)}if(e.surfaces){let t=new Set([...Object.keys(rt.colors),`brand`,`ink`,...e.accent?[`accent`]:[],...Object.keys(e.colors??{})]);for(let[n,r]of Object.entries({...a,...typeof e.primary==`string`?{primary:e.primary}:{}})){let e=r.replace(/\.\d$/,``);if(!t.has(e))throw Error(`tones ${n} uses unregistered palette ${e}; pass it in brand.colors`)}}let s={...Kd};for(let t of[`small`,`body`,`title`,`section`,`page`])s[t]=e.typeScale?.[t]??Kd[t];for(let t of Object.keys(e.typeScale??{}))if(![`small`,`body`,`title`,`section`,`page`].includes(t))throw Error(`typeScale ${t} is not a brand input`);let c={small:[12,14],body:[14,16],title:[16,20],section:[20,28],page:[28,36]},l=0;for(let e of Object.keys(c)){let t=s[e],[n,r]=c[e];if(!Number.isInteger(t)||tr||t<=l&&(e!==`body`||t!==14||l!==14))throw Error(`typeScale ${e} must be an integer in ${n}–${r} and increase strictly (small/body may both be 14)`);l=t}let u=typeof e.radius==`object`?e.radius:Yd[e.radius??`soft`],d=0;for(let e of[`control`,`surface`,`overlay`]){if(!u||!Number.isInteger(u[e])||u[e]32)throw Error(`radius ${e} must be an integer with 0 ≤ control ≤ surface ≤ overlay ≤ 32`);d=u[e]}if(e.density!==void 0&&![`default`,`compact`].includes(e.density))throw Error(`density must be default or compact`);if(e.focus!==void 0&&![`ring`,`border`].includes(e.focus))throw Error(`focus input must be ring or border`);if(e.elevation!==void 0&&![`bordered`,`shadow`,`ring`].includes(e.elevation))throw Error(`elevation must be bordered, shadow or ring`);if(e.controlSizes){let t=23;for(let n of[`sm`,`md`,`lg`]){let r=e.controlSizes[n];if(!Number.isInteger(r)||r<=t||r>56)throw Error(`controlSizes ${n} must be an integer with 24 ≤ sm < md < lg ≤ 56`);t=r}}let f=e.density===`compact`?{size:`sm`}:{},p=u.control===0?{radius:0}:{},m=t=>e.controlSizes?Object.fromEntries([`xs`,`sm`,`md`,`lg`,`xl`].map(n=>[`--${t}-${n}`,`${e.controlSizes?.[n===`xs`?`sm`:n===`xl`?`lg`:n]}px`])):{},h=e=>`${e/16}rem`,g=e.elevation===`shadow`,_=typeof e.neutralTint==`number`?{gray:af(rt.colors.gray,e.neutralTint),dark:af(rt.colors.dark,e.neutralTint)}:e.neutralTint,v={defaultProps:{radius:u.surface,withBorder:!g&&e.elevation!==`ring`,shadow:g?`xs`:`none`},styles:(t,r)=>({root:{backgroundColor:`var(--labstack-raised)`,borderColor:`var(--labstack-border)`,...n,...r.variant===`outline`?{border:`${e.lineWeight??1}px solid var(--labstack-border)`,boxShadow:`none`}:r.variant===`flat`?{backgroundColor:`var(--labstack-inset)`,border:`none`,boxShadow:`none`}:e.elevation===`ring`&&(r.shadow??`none`)===`none`?{boxShadow:`var(--labstack-ring)`}:{}}})},y=pt({primaryColor:`brand`,primaryShade:Jd,colors:{...e.colors,...e.accent?{accent:e.accent}:{},..._,...Object.values(a).includes(`ink`)?{ink:_?.gray??rt.colors.gray}:{},brand:e.primary===`ink`?_?.gray??rt.colors.gray:e.primary},fontFamily:e.fontFamily??rt.fontFamily,fontFamilyMonospace:e.fontFamilyMonospace??rt.fontFamilyMonospace,fontSizes:{xs:h(s.small),sm:h(s.body),md:h(s.body),lg:h(s.title),xl:h(s.section)},lineHeights:{xs:`1.5`,sm:`1.5`,md:`1.5`,lg:`1.5`,xl:`1.5`},headings:{...e.displayFont?{fontFamily:e.displayFont}:{},fontWeight:String(e.displayWeight??650),textWrap:`balance`,sizes:{h1:{fontSize:h(s.page),lineHeight:`1.25`},h2:{fontSize:h(s.section),lineHeight:`1.25`},h3:{fontSize:h(s.title),lineHeight:`1.25`},h4:{fontSize:h(s.body),lineHeight:`1.25`},h5:{fontSize:h(s.small),lineHeight:`1.25`},h6:{fontSize:h(s.small),lineHeight:`1.25`}}},defaultRadius:`sm`,radius:{xs:`${u.control}px`,sm:`${u.control}px`,md:`${u.surface}px`,lg:`${u.overlay}px`,xl:`${u.overlay}px`},respectReducedMotion:!0,autoContrast:!0,variantColorResolver:t=>{let n=t.variant??`filled`;if(!Object.hasOwn(e.variants??{},n))return sf(t);let r=e=>`var(--labstack-variant-${n}-${e})`;return{background:r(`background`),hover:r(`hover`),color:r(`color`),border:`${e.lineWeight??1}px solid ${r(`border`)}`}},components:{Paper:v,Card:v,Button:{defaultProps:{radius:u.control,...f},...e.controlSizes?{vars:()=>({root:m(`button-height`)})}:{},styles:(t,i)=>({root:{...r,...n,...e.variants?.[i.variant??`filled`]?.underline?{textDecoration:`underline`,textUnderlineOffset:`0.2em`}:{}}})},Accordion:{styles:{control:r,item:n}},Text:{styles:(e,t)=>({root:t.variant===`numeral`?{...r,letterSpacing:i,fontVariantNumeric:`tabular-nums`}:{}})},Select:{defaultProps:{...f,checkIconPosition:`right`,onFocus:ef,onMouseDown:tf,onClick:nf}},Autocomplete:{defaultProps:{...f,onFocus:ef,onMouseDown:tf,onClick:nf}},...e.density===`compact`?{TextInput:{defaultProps:f},MultiSelect:{defaultProps:f},NumberInput:{defaultProps:f},PasswordInput:{defaultProps:f},Textarea:{defaultProps:f},TagsInput:{defaultProps:f},PillsInput:{defaultProps:f},JsonInput:{defaultProps:f},NativeSelect:{defaultProps:f},ColorInput:{defaultProps:f},FileInput:{defaultProps:f}}:{},Anchor:{defaultProps:{underline:`always`}},Blockquote:{vars:(e,t)=>t.color?{root:{}}:{root:{"--bq-bd":`var(--labstack-border)`,"--bq-bg-light":`transparent`,"--bq-bg-dark":`transparent`}}},Code:{styles:{root:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,color:`var(--mantine-color-text)`}}},InputWrapper:{styles:{label:r},defaultProps:{inputWrapperOrder:[`label`,`input`,`description`,`error`]}},PinInput:{defaultProps:{placeholder:``}},Rating:{defaultProps:{color:a.warning}},Table:{defaultProps:{verticalSpacing:`xs`,horizontalSpacing:`sm`,...e.density===`compact`?{fz:`sm`}:{}},vars:(e,t)=>({table:{"--table-border-color":t.borderColor?void 0:`var(--labstack-border)`,"--table-striped-color":t.stripedColor?void 0:`color-mix(in srgb, var(--labstack-text) 4%, transparent)`,"--table-highlight-on-hover-color":t.highlightOnHoverColor?void 0:`var(--labstack-hover)`}}),styles:{td:{fontVariantNumeric:`tabular-nums`},th:{whiteSpace:`nowrap`,...e.lineWeight&&e.lineWeight!==1?{borderBottom:`${e.lineWeight}px solid var(--labstack-border)`}:{}}}},ActionIcon:{defaultProps:{radius:u.control,...f},...e.controlSizes?{vars:()=>({root:{...m(`ai-size`),...m(`ai-size-input`)}})}:{},styles:{root:n}},...e.focus===`border`?{PinInput:{defaultProps:{placeholder:``},classNames:{input:`labstack-border-focus`}},Combobox:{classNames:{search:`labstack-border-focus`}}}:{},Input:{...e.focus===`border`?{classNames:{input:`labstack-border-focus`}}:{},styles:{input:n},defaultProps:{radius:u.control,...f},vars:(e,t)=>({wrapper:{...m(`input-height`),"--input-bg":(t.variant??`default`)==="default"&&!t.disabled?`var(--labstack-raised)`:void 0,"--input-bd":(t.variant??`default`)==="default"&&!t.disabled&&!t.error&&!t.success?`var(--labstack-control-border)`:void 0}})},Skeleton:{defaultProps:{radius:u.control},classNames:{root:`labstack-Skeleton-root`}},ThemeIcon:{defaultProps:{radius:u.control}},Title:{styles:{root:{letterSpacing:i}}},Badge:{defaultProps:{variant:`light`,fw:600,tt:`none`,...f},styles:{root:{height:`auto`,maxWidth:`100%`,minHeight:`var(--badge-height)`},label:{whiteSpace:`normal`,overflowWrap:`anywhere`}},vars:(t,n)=>({root:{...[`xs`,`sm`,`md`].includes(n.size??`md`)?{"--badge-fz":`calc(0.75rem * var(--mantine-scale))`}:{},...e.primary===`ink`&&n.color===void 0&&(n.variant??`light`)===`light`?{"--badge-bg":`var(--labstack-inset)`,"--badge-color":`var(--labstack-text)`,"--badge-bd":`1px solid var(--labstack-border)`}:{}}})},Modal:{defaultProps:{centered:!0,radius:u.overlay,shadow:`lg`,overlayProps:{blur:3},closeButtonProps:{"aria-label":`Close`}},styles:{header:{background:`var(--labstack-raised)`},title:{fontWeight:e.displayWeight??650,fontSize:h(s.title)}}},Drawer:{defaultProps:{shadow:`lg`,closeButtonProps:{"aria-label":`Close`}},styles:{header:{background:`var(--labstack-raised)`},title:{fontWeight:e.displayWeight??650,fontSize:h(s.title)}}},Tooltip:{defaultProps:{radius:u.control},styles:{tooltip:{fontSize:h(s.small)}}},Alert:{defaultProps:{color:a.info,variant:`light`}},MultiSelect:{defaultProps:{checkIconPosition:`right`,...f}},Menu:{defaultProps:{withInitialFocusPlaceholder:!1,radius:u.overlay,shadow:`md`},styles:{dropdown:{background:`var(--labstack-raised)`,borderColor:`var(--labstack-border)`,...n}}},Popover:{defaultProps:{radius:u.overlay,shadow:`md`},styles:{dropdown:{background:`var(--labstack-raised)`,borderColor:`var(--labstack-border)`,...n}}},Divider:{vars:(e,t)=>({root:{"--divider-color":t.color?void 0:`var(--labstack-border-soft)`}})},Switch:{classNames:{track:`labstack-Switch-track`},defaultProps:{withThumbIndicator:!1,...p},vars:(e,t)=>({track:{"--labstack-switch-contrast":e.autoContrast?of(t.color||e.primaryColor,e):void 0}})},Checkbox:{styles:{input:n,label:r},vars:(e,t)=>({root:{"--checkbox-icon-color":cf(e,t)}})},CheckboxIndicator:{vars:(e,t)=>({indicator:{"--checkbox-icon-color":cf(e,t)}})},Radio:{styles:{radio:n,label:r},vars:(e,t)=>({root:{"--radio-icon-color":cf(e,t)}})},RadioIndicator:{vars:(e,t)=>({indicator:{"--radio-icon-color":cf(e,t)}})},SegmentedControl:{styles:{label:r},vars:(e,t)=>({root:{"--labstack-sc-contrast":t.color&&(t.autoContrast??e.autoContrast)?of(t.color,e):void 0}}),defaultProps:{...f,renderRoot:e=>{let t=e.style?.[`--labstack-sc-contrast`];return(0,o.createElement)(`div`,e,t?uf(e.children,t):e.children)}}},Stepper:{vars:(e,t)=>({root:{"--stepper-icon-color":t.autoContrast??e.autoContrast?of(t.color||e.primaryColor,e):void 0,"--labstack-step-icon-opt-out":t.autoContrast??e.autoContrast?void 0:`var(--mantine-color-white)`}})},StepperStep:{defaultProps:{renderRoot:e=>{let t=e.style,n=lf(t?.[`--step-color`]);return(0,o.createElement)(`button`,{type:`button`,...e,style:{...n?{"--stepper-icon-color":`var(--labstack-step-icon-opt-out, ${n})`}:{},...t}})}}},ProgressSection:{defaultProps:{renderRoot:e=>{let t=e.style,n=lf(t?.[`--progress-section-color`]);return(0,o.createElement)(`div`,{...e,style:{...t,...n&&t?.[`--progress-label-color`]?{"--progress-label-color":n}:{}}})}}},Tabs:{vars:(e,t)=>({root:{"--tabs-text-color":of(t.color||e.primaryColor,e)}})},TabsTab:{defaultProps:{styles:(e,t)=>({tab:{"--tabs-text-color":t.color?of(t.color,e):void 0}})}},...e.controlSizes?{Avatar:{vars:()=>({root:{"--avatar-size-sm":`${e.controlSizes?.sm}px`,"--avatar-size-md":`${e.controlSizes?.md}px`,"--avatar-size-lg":`${e.controlSizes?.lg}px`}})}}:{},Slider:{defaultProps:{...p}},RangeSlider:{defaultProps:{...p}},Chip:{defaultProps:{variant:`filled`,...f,...p},...e.controlSizes?{vars:()=>({root:m(`chip-size`)})}:{}},Pagination:{defaultProps:{...f,getControlProps:e=>({"aria-label":{first:`First page`,previous:`Previous page`,next:`Next page`,last:`Last page`}[e]})},vars:(e,t)=>({root:{...m(`pagination-control-size`),"--pagination-active-color":of(t.color||e.primaryColor,e)}})}},other:{labstackTones:a,labstack:{typeScale:s,contentWidths:qd}}});if(e.accent){y.components??={};let e=y.components,t=e.SegmentedControl??{},n=t.vars;e.SegmentedControl={...t,vars:(e,t,r)=>{let i=(typeof n==`function`?n(e,t,r):n)??{};return t.color?i:{...i,root:{...i.root,"--sc-color":`var(--mantine-color-accent-light)`,"--sc-label-color":`var(--mantine-color-accent-text)`}}}};for(let t of ff){let n=e[t]??{};e[t]={...n,defaultProps:{...n.defaultProps,color:`accent`}}}}let b=ct(rt,y),x=t=>{let n=df(b,t,e),r=e.chart?.series?.[t];if(e.chart?.series&&!r)throw Error(`chart.series.${t} is required`);let i=r??(t===`light`?[`#2a78d6`,`#eb6834`,`#1aa674`,`#4a3aa7`,`#c28400`,`#d57197`]:[`#3987e5`,`#d95926`,`#199e70`,`#9085e9`,`#c98500`,`#d55181`]);if(i.length!==6)throw Error(`chart.series (${t}) series must have exactly six colors`);let a=Array.from(i,(e,i)=>{if(Qd(e,`chart.series (${t}) series[${i}]`),!r)return rf(e,[n[`--labstack-raised`]],3);if(Ud(e,n[`--labstack-raised`])<3)throw Error(`chart.series (${t}) series[${i}] must meet 3:1 on raised`);return e});return{text:n[`--labstack-text`],muted:n[`--labstack-muted`],grid:n[`--labstack-border-soft`],surface:n[`--labstack-raised`],border:n[`--labstack-border`],series:a}};return{theme:y,chart:{light:x(`light`),dark:x(`dark`)},cssVariablesResolver:t=>({variables:{},light:df(t,`light`,e),dark:df(t,`dark`,e)})}}var mf=new Map([[`bold`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z`}))],[`duotone`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z`,opacity:`0.2`}),o.createElement(`path`,{d:`M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`fill`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z`}))]]),hf=new Map([[`bold`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z`}))],[`duotone`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,40V168H168V88H88V40Z`,opacity:`0.2`}),o.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`fill`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32Zm-8,128H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`light`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,34H88a6,6,0,0,0-6,6V82H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H168a6,6,0,0,0,6-6V174h42a6,6,0,0,0,6-6V40A6,6,0,0,0,216,34ZM162,210H46V94H162Zm48-48H174V88a6,6,0,0,0-6-6H94V46H210Z`}))],[`regular`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`thin`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M216,36H88a4,4,0,0,0-4,4V84H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H168a4,4,0,0,0,4-4V172h44a4,4,0,0,0,4-4V40A4,4,0,0,0,216,36ZM164,212H44V92H164Zm48-48H172V88a4,4,0,0,0-4-4H92V44H212Z`}))]]),gf=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:mf}));gf.displayName=`CheckIcon`;var _f=gf,vf=o.forwardRef((e,t)=>o.createElement(Xu,{ref:t,...e,weights:hf}));vf.displayName=`CopyIcon`;var yf=vf,bf={small:{fontSize:15,gap:12,tracking:`0.16em`},regular:{fontSize:18,gap:14,tracking:`0.17em`},large:{fontSize:22,gap:16,tracking:`0.18em`}};function xf({size:e=`regular`}){let t=bf[e];return(0,c.jsxs)(Is,{component:`span`,gap:t.gap,wrap:`nowrap`,"aria-label":`Pitot`,children:[(0,c.jsx)(Sf,{size:e}),(0,c.jsx)(Z,{component:`span`,fz:t.fontSize,fw:800,lh:1,lts:t.tracking,tt:`uppercase`,children:`Pitot`})]})}function Sf({size:e=`regular`}){let t={small:32,regular:46,large:50}[e];return(0,c.jsx)(Vu,{size:t,variant:`transparent`,"aria-hidden":`true`,children:(0,c.jsx)(Cf,{})})}function Cf(){let e=(0,o.useId)().replace(/[^a-zA-Z0-9-]/g,``),t=`fo-top-${e}`,n=`fo-mid-${e}`,r=`fo-bot-${e}`;return(0,c.jsxs)(`svg`,{viewBox:`35 44 200 200`,width:`100%`,height:`100%`,"aria-hidden":`true`,children:[(0,c.jsxs)(`defs`,{children:[(0,c.jsxs)(`linearGradient`,{id:t,x1:`54`,y1:`52`,x2:`210`,y2:`104`,gradientUnits:`userSpaceOnUse`,children:[(0,c.jsx)(`stop`,{offset:`0`,stopColor:`#5FE8CE`}),(0,c.jsx)(`stop`,{offset:`0.55`,stopColor:`#81E4B9`}),(0,c.jsx)(`stop`,{offset:`1`,stopColor:`#D9F276`})]}),(0,c.jsxs)(`linearGradient`,{id:n,x1:`58`,y1:`112`,x2:`176`,y2:`154`,gradientUnits:`userSpaceOnUse`,children:[(0,c.jsx)(`stop`,{offset:`0`,stopColor:`#536FFF`}),(0,c.jsx)(`stop`,{offset:`0.52`,stopColor:`#41B6F8`}),(0,c.jsx)(`stop`,{offset:`1`,stopColor:`#66D0EE`})]}),(0,c.jsxs)(`linearGradient`,{id:r,x1:`58`,y1:`166`,x2:`145`,y2:`220`,gradientUnits:`userSpaceOnUse`,children:[(0,c.jsx)(`stop`,{offset:`0`,stopColor:`#725BFF`}),(0,c.jsx)(`stop`,{offset:`0.52`,stopColor:`#9A50F4`}),(0,c.jsx)(`stop`,{offset:`1`,stopColor:`#CB55E8`})]})]}),(0,c.jsx)(`path`,{d:`M58 116V88C58 67 75 52 96 52H191C204 52 212 61 212 72C212 84 203 94 191 94H101C82 94 67 102 58 116Z`,fill:`url(#${t})`}),(0,c.jsx)(`path`,{d:`M58 170V139C58 120 72 107 91 107H162C174 107 182 115 182 126C182 137 174 145 162 145H99C79 145 66 154 58 170Z`,fill:`url(#${n})`}),(0,c.jsx)(`path`,{d:`M58 219V188C58 170 71 157 89 157H126C138 157 146 165 146 176C146 187 138 195 126 195H100C89 195 84 200 84 211C84 225 74 235 61 235H58Z`,fill:`url(#${r})`})]})}export{Ko as $,pe as $t,Gl as A,on as At,nl as B,Ge as Bt,Vu as C,a as Cn,Sn as Ct,xu as D,K as Dt,Pu as E,fn as Et,ml as F,W as Ft,Is as G,ze as Gt,el as H,$e as Ht,ll as I,ft as It,vs as J,Ie as Jt,js as K,Re as Kt,cl as L,dt as Lt,Rl as M,Nt as Mt,Pl as N,G as Nt,tu as O,dn as Ot,X as P,mt as Pt,Xo as Q,be as Qt,ol as R,rt as Rt,Ju as S,l as Sn,Ln as St,$ as T,q as Tt,Zc as U,Je as Ut,tl as V,Ke as Vt,Xc as W,He as Wt,cs as X,U as Xt,ls as Y,Ee as Yt,ns as Z,H as Zt,gd as _,y as _n,Aa as _t,Md as a,te as an,go as at,$u as b,h as bn,pa as bt,Ud as c,N as cn,Eo as ct,Cd as d,T as dn,Ao as dt,fe as en,Uo as et,Vd as f,O as fn,La as ft,zd as g,b as gn,Ma as gt,pf as h,S as hn,Ia as ht,_f as i,ce as in,Po as it,Z as j,It as jt,Q as k,sn as kt,Rd as l,A as ln,uo as lt,bd as m,w as mn,Fa as mt,Sf as n,B as nn,Lo as nt,Ld as o,F as on,So as ot,qd as p,C as pn,Na as pt,Es as q,Le as qt,yf as r,le as rn,ho as rt,kd as s,P as sn,wo as st,xf as t,ue as tn,Vo as tt,Ad as u,E as un,Oo as ut,sd as v,_ as vn,ja as vt,Ru as w,bn as wt,Xu as x,d as xn,xr as xt,nd as y,g as yn,Pa as yt,rl as z,We as zt}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat-Bv0H8gs5.js b/internal/ui/dist/assets/chat-Bv0H8gs5.js deleted file mode 100644 index b872f0de8..000000000 --- a/internal/ui/dist/assets/chat-Bv0H8gs5.js +++ /dev/null @@ -1,2 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mcp-app-frame-D0JRq0Ru.js","assets/useRouter-ByJ6_rwb.js","assets/brand-CCQ0JT0F.js","assets/auth-K3NK-QpB.js","assets/useNavigate-B1zgPEUp.js","assets/index-C5SsAUtw.js","assets/preload-helper-DJZNfKNH.js","assets/lazyRouteComponent-DfXsrbdH.js","assets/theme-B_iWg-Ot.js","assets/search-DBgztReF.js","assets/noop-mXPS5vjY.js","assets/format-fsvZ_y78.js","assets/useQuery-BLTYSIvG.js","assets/search-Bj_SOIkw.js","assets/index-CzwgFH1g.css"])))=>i.map(i=>d[i]); -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{$ as r,Ct as i,Dt as a,Ft as o,G as s,Nt as c,S as l,T as u,Tt as d,Zt as f,a as p,f as m,g as h,i as g,j as _,k as v,n as y,p as b,pn as x,q as S,r as C,s as w,tt as T,x as E}from"./brand-CCQ0JT0F.js";import{n as D,t as ee}from"./preload-helper-DJZNfKNH.js";import{t as O}from"./Table-Bid0E8qM.js";import{a as k,n as A,t as j}from"./format-fsvZ_y78.js";import{t as M}from"./Textarea-BewZUT1f.js";import{n as N,r as P,t as F}from"./lib-8mi5olAL.js";import{C as I,D as L,E as te,S as ne,T as re,b as ie,ct as R,w as ae,x as z,y as oe}from"./index-C5SsAUtw.js";import{t as se}from"./dashboard-change-chips-DMsA4yET.js";var B={root:`m_7485cace`},V=t(),ce={strategy:`block`},H=f((e,{size:t,fluid:n})=>({root:{"--container-size":n?void 0:x(t,`container-size`)}})),U=a(e=>{let t=o(`Container`,ce,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,vars:l,fluid:u,mod:f,attributes:p,strategy:m,...h}=t,g=c({name:`Container`,classes:B,props:t,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:p,vars:l,varsResolver:H});return(0,V.jsx)(d,{mod:[{fluid:u,strategy:m},f],...g(`root`),...h})});U.classes=B,U.varsResolver=H,U.displayName=`@mantine/core/Container`;var W={root:`m_d08caa0`},G=a(e=>{let t=o(`Typography`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,attributes:l,...u}=t,f=c({name:`Typography`,classes:W,props:t,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:l});return(0,V.jsx)(d,{...f(`root`),...u})});G.classes=W,G.displayName=`@mantine/core/Typography`;var K=n(e(),1),le=new Map([[`bold`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.createElement(`path`,{d:`M200,144l-72,72L56,144Z`,opacity:`0.2`}),K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.createElement(`path`,{d:`M176,128,96,208V48Z`,opacity:`0.2`}),K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`}),K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`}),K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`,K.createElement(K.Fragment,null,K.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`}))]]),q=K.forwardRef((e,t)=>K.createElement(E,{ref:t,...e,weights:le}));q.displayName=`ArrowDownIcon`;var pe=q,J=K.forwardRef((e,t)=>K.createElement(E,{ref:t,...e,weights:ue}));J.displayName=`CaretRightIcon`;var Y=J,X=K.forwardRef((e,t)=>K.createElement(E,{ref:t,...e,weights:de}));X.displayName=`PaperPlaneTiltIcon`;var me=X,he=K.forwardRef((e,t)=>K.createElement(E,{ref:t,...e,weights:fe}));he.displayName=`StopIcon`;var ge=he;function _e(e){return e.dashboard.panels.length===1?e.dashboard.panels[0].title:e.dashboard.name}function ve(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`,`invalid`].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 ye=new WeakSet;function be(e){if(!e||typeof e!=`object`||Array.isArray(e))return;if(ye.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{ve(t.tool_result)}catch{return}return ye.add(t),t}}var xe=16,Se=new Set([`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `]);function Ce(e){let t=(0,K.useRef)(null),n=(0,K.useRef)(null),r=(0,K.useRef)(null),i=(0,K.useRef)(!0),a=(0,K.useRef)(e),o=(0,K.useRef)(()=>{}),s=(0,K.useRef)(null),c=(0,K.useRef)(new Set),l=(0,K.useRef)(null),u=(0,K.useRef)(null),[d,f]=(0,K.useState)(!1),p=(0,K.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,K.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,K.useCallback)((e,t)=>{e.scrollTop=t,u.current=e.scrollTop},[]),g=(0,K.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-xe-t)}px`,i.current&&h(e,e.scrollTop+r.current.getBoundingClientRect().top-e.getBoundingClientRect().top-e.clientTop-xe)}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,K.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,K.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&&Se.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,K.useCallback)(e=>{n.current=e,_()},[_]),b=(0,K.useCallback)(e=>{r.current?.style.removeProperty(`min-height`),r.current=e,_()},[_]);return(0,K.useLayoutEffect)(()=>{a.current!==e&&(a.current=e,i.current=!0,l.current=null),_(),g()}),{scrollRef:v,contentRef:y,turnRef:b,showJump:d,jumpToLatest:(0,K.useCallback)(()=>{let e=t.current;e&&(e.focus({preventScroll:!0}),i.current=!1,h(e,e.scrollHeight),m(),p())},[m,h,p])}}function we(e=1500){let[t,n]=(0,K.useState)(`idle`),r=(0,K.useRef)(null);(0,K.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!==`invalid`&&e!==`not_run`;function Te({receipt:e,running:t=!1,activity:n=``,awaitingAnswer:a=!1,initialExpanded:o=!1}){let[c,l]=(0,K.useState)(o),d=(0,K.useId)(),f=e.saved,h=f?.receipt.save_check,g=t=>Object.hasOwn(e.panel_titles,t)?e.panel_titles[t]:t,y=(h?.panels??e.panels).filter(e=>e.status===`invalid`).length,b=[...new Set([...e.explanations.filter(t=>!e.problems.some(e=>t.startsWith(`${g(e.panel_id)}:`))),...e.problems.map(e=>`${g(e.panel_id)}: ${e.message}`)])],x=Object.values(e.stages).filter(e=>e.state===`complete`).length,S=[e.stages.schema.state===`complete`?`Read telemetry`:void 0,e.panel_count===void 0?void 0:k(e.panel_count,`panel`),h?.checked?`Checked in ${j(h.elapsed_ms)}`:void 0,f?`Saved v${f.version}`:void 0].filter(Boolean).join(` · `)||`Building dashboard`,C=[...f?ne(f.receipt):[],...new Map(e.corrections.map(e=>[e.panel_id,`Fixed ${e.title}`])).values()];return(0,V.jsx)(r,{"data-build-receipt":e.turn_id,"data-dashboard-result":f?.id,"data-chat-anchor":!0,withBorder:!0,radius:`md`,p:`sm`,children:(0,V.jsxs)(u,{gap:6,children:[(0,V.jsxs)(s,{gap:`xs`,justify:`space-between`,children:[(0,V.jsxs)(_,{component:`div`,size:`sm`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[S,y>0&&(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsx)(m,{tone:`danger`,children:k(y,`invalid panel`)})]}),(0,V.jsxs)(_,{span:!0,c:`dimmed`,size:`xs`,children:[` · `,k(x,`stage`),` complete`]})]}),(0,V.jsxs)(v,{component:`button`,variant:`subtle`,color:`gray`,size:`compact-xs`,"aria-expanded":c,"aria-controls":d,onClick:()=>l(e=>!e),children:[`Details`,C.length>4?` (+${C.length-4})`:``]})]}),t&&a&&(0,V.jsx)(`div`,{"data-build-running":!0,children:(0,V.jsx)(p,{state:`loading`,loadingLabel:n||`Analyzing your system`,rows:0})}),(0,V.jsx)(se,{labels:C.slice(0,4)}),b.map(e=>t?e.split(` · `).filter(e=>!e.endsWith(`: incomplete`)).join(` · `):e).filter(Boolean).map((e,t)=>(0,V.jsx)(_,{size:`xs`,c:`dimmed`,"data-receipt-attention":!0,children:e},t)),f&&(0,V.jsx)(v,{renderRoot:e=>(0,V.jsx)(D,{...e,to:`/dashboards/$dashboardId`,params:{dashboardId:f.id},search:{}}),variant:`subtle`,size:`compact-sm`,color:`gray`,style:{alignSelf:`flex-start`},children:`Open dashboard`}),(0,V.jsx)(i,{expanded:c,id:d,children:(0,V.jsxs)(u,{gap:4,children:[f&&(0,V.jsxs)(_,{size:`xs`,children:[f.label,` `,f.name,` · opens the current dashboard`]}),(0,V.jsx)(_,{size:`xs`,fw:600,children:`Build stages`}),Object.entries(e.stages).map(([n,r])=>(0,V.jsxs)(_,{component:`div`,size:`xs`,children:[(0,V.jsxs)(m,{tone:r.state===`failed`?`danger`:r.state===`complete`?`success`:r.state===`interrupted`?`warning`:`neutral`,children:[ae[n],`: `,t&&r.state===`incomplete`?`in progress`:r.state]}),r.elapsed_ms!==void 0&&(r.state===`complete`||n===`preview`&&e.panels.some(e=>Z(e.status)))?` · ${j(r.elapsed_ms)}`:``]},n)),e.save_attempts.map((e,t)=>e.state===`retried`&&(0,V.jsxs)(_,{size:`xs`,c:`dimmed`,children:[`Save attempt `,t+1,`: retried`]},e.call_id)),!!e.context_counts.deploys&&(0,V.jsxs)(_,{size:`xs`,children:[e.context_counts.deploys,` deploys observed`]}),!!e.context_counts.anomalies&&(0,V.jsxs)(_,{size:`xs`,children:[e.context_counts.anomalies,` anomalies observed`]}),(0,V.jsx)(_,{size:`xs`,fw:600,children:`Panel preview`}),e.panels.map(e=>(0,V.jsxs)(_,{component:`div`,size:`xs`,children:[`Preview · `,g(e.id),`: `,(0,V.jsx)(m,{tone:e.status===`ok`?`success`:e.status===`empty`||e.status===`not_run`?`neutral`:`danger`,children:e.status===`ok`?`Ok`:e.status.charAt(0).toUpperCase()+e.status.slice(1)}),Z(e.status)&&e.elapsed_ms!==void 0?` · ${j(e.elapsed_ms)}`:``]},e.id)),h&&(0,V.jsx)(_,{size:`xs`,fw:600,children:`Save verification`}),h&&(0,V.jsxs)(_,{size:`xs`,children:[`Save check: `,h.checked?`checked`:`incomplete`,h.checked?` · ${j(h.elapsed_ms)}`:``]}),h?.panels.map(e=>(0,V.jsxs)(_,{component:`div`,size:`xs`,children:[`Save · `,g(e.id),`: `,(0,V.jsx)(m,{tone:e.status===`ok`?`success`:e.status===`empty`||e.status===`not_run`?`neutral`:`danger`,children:e.status===`ok`?`Ok`:e.status.charAt(0).toUpperCase()+e.status.slice(1)}),Z(e.status)&&` · ${k(e.rows??0,`row`)}`,Z(e.status)&&e.elapsed_ms!==void 0?` · ${j(e.elapsed_ms)}`:``]},e.id)),C.slice(4).map((e,t)=>(0,V.jsx)(_,{size:`xs`,children:e},t)),e.corrections.map((e,t)=>(0,V.jsxs)(_,{size:`xs`,children:[`Fixed `,e.title,`: `,e.message]},t))]})})]})})}var Ee=(0,K.lazy)(()=>ee(()=>import(`./mcp-app-frame-D0JRq0Ru.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),De=e=>e.tool_result.view.kind===`preset`;function Oe(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=>De(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:De(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=be(t.content);e&&r.push({id:t.id,content:e})}return i(),{views:t,duplicates:n}}function ke(e,t){return Array.isArray(e)?e.flatMap(e=>{if(!L(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 Ae(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)?re(e.function.arguments)?.dashboard:void 0,r=L(t)&&Array.isArray(t.panels)?t.panels.map(e=>L(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=re(a.content);if(!a.error&&!e?.error&&e?.isError!==!0)continue;let o=n.get(a.toolCallId);if(o&&te.has(o.name)&&I(a))continue;let s=L(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:oe(o?.name??``),message:d,details:f?ke(e?.problems,o?.titles):[],readOnly:s?.code===`answer_only`,rejected:f}),t.set(l,u)}}return t}function je({failures:e}){let[t,n]=(0,K.useState)({rejected:!1,failed:!1}),r=e.filter(e=>e.rejected),i=e.filter(e=>!e.readOnly&&!e.rejected),a=[{key:`rejected`,items:r,label:`${r.length} ${r.length===1?`draft`:`drafts`} rejected`},{key:`failed`,items:i,label:`${i.length} ${i.length===1?`step`:`steps`} failed`}];return(0,V.jsxs)(d,{"data-chat-anchor":!0,children:[e.some(e=>e.readOnly)&&(0,V.jsx)(_,{size:`sm`,c:`dimmed`,children:`Not saved: Explain is read-only`}),a.map(({key:e,items:r,label:i})=>r.length>0&&(0,V.jsxs)(d,{children:[(0,V.jsxs)(T,{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)(P,{size:14}):(0,V.jsx)(Y,{size:14})}),(0,V.jsx)(`span`,{className:`chat-app-summary`,children:i})]}),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)(_,{size:`sm`,c:`dimmed`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:e},`${t}-${n}`)))})]},e))]})}function Me({view:e}){let[t,n]=(0,K.useState)(e.expanded);(0,K.useEffect)(()=>n(e.expanded),[e.expanded]);let i=e.content.tool_result,a=_e(i),o=[...new Set(i.dashboard.panels.map(e=>e.viz===`timeseries`?`time series`:e.viz.replaceAll(`_`,` `)))].join(`, `),s=i.results.reduce((e,t)=>e+(t.frame?.rows??0),0),c=new Map;for(let e of i.results)e.status!==`ok`&&c.set(e.status,(c.get(e.status)??0)+1);let l=i.dashboard.panels.length>1?Array.from(c,([e,t])=>`${t} ${e}`).join(` · `):c.size?[...c.keys()].join(`, `):`${s} ${s===1?`row`:`rows`}`;return(0,V.jsxs)(r,{"data-chat-app":!0,"data-chat-anchor":!0,withBorder:!0,radius:`md`,style:{overflow:`hidden`},children:[(0,V.jsxs)(T,{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)(P,{size:14}):(0,V.jsx)(Y,{size:14})}),(0,V.jsx)(`span`,{className:`chat-app-summary`,children:[a,o,l].filter(Boolean).join(` · `)})]}),t&&(0,V.jsx)(K.Suspense,{fallback:(0,V.jsx)(p,{state:`loading`,loadingLabel:`Preparing view…`}),children:(0,V.jsx)(Ee,{content:e.content})})]})}var Ne=[`Summarize system health for the last hour`,`Find the source of elevated errors`,`Map the current service dependencies`,`Show the slowest endpoints`];function Pe(){let{agentAvailable:e,messages:t,messageTimes:n,ready:i,running:a,activity:o,stopped:c,error:l,threadMissing:f,send:m,retry:g,reloadThread:y,newThread:b}=z(),x=ie(t),C=t.filter(e=>e.role===`user`).at(-1)?.id,{scrollRef:T,contentRef:E,turnRef:D,showJump:ee,jumpToLatest:O}=Ce(C);if(!e)return(0,V.jsx)(U,{size:`sm`,py:96,children:(0,V.jsx)(r,{withBorder:!0,radius:`md`,p:{base:`xl`,sm:40},children:(0,V.jsxs)(u,{gap:`md`,children:[(0,V.jsx)(_,{fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Optional capability`}),(0,V.jsx)(h,{title:`Chat`,description:`Chat is not configured`}),(0,V.jsx)(_,{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)(v,{component:`a`,href:`/dashboards`,variant:`light`,mt:`sm`,children:`Open dashboards`})]})})});let k=Oe(t),A=Ae(t),j=t.filter(e=>k.duplicates.has(e.id)?!1:e.role===`tool`?A.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`),M=t.findIndex(e=>e.id===C),N=t.slice(M+1).some(e=>e.role===`assistant`&&!e.toolCalls?.length&&typeof e.content==`string`&&e.content.length>0),P=t.slice(M+1).filter(e=>e.role===`assistant`&&!e.toolCalls?.length&&typeof e.content==`string`&&e.content.trim().length>0).at(-1),F=[];for(let e of j)(e.role===`user`||F.length===0)&&F.push({id:e.id,messages:[]}),F.at(-1).messages.push(e);F.length===0&&F.push({id:`draft`,messages:[]});let I=e=>A.has(e.id)?(0,V.jsx)(je,{failures:A.get(e.id)},e.id):(0,V.jsxs)(d,{children:[(0,V.jsx)(Le,{message:e,time:n[e.id],appView:k.views.get(e.id)}),x.has(e.id)&&(0,V.jsx)(d,{mt:`sm`,children:(0,V.jsx)(Te,{receipt:x.get(e.id),running:a&&e.id===C,awaitingAnswer:!N,activity:o})})]},e.id);return(0,V.jsxs)(d,{className:`chat-pane`,children:[(0,V.jsx)(U,{size:880,w:`100%`,px:{base:`md`,sm:`xl`},py:`md`,children:(0,V.jsx)(h,{title:`Chat`,description:`Investigate your telemetry with Fanout.`})}),(0,V.jsxs)(d,{className:`chat-viewport`,children:[(0,V.jsx)(d,{className:`chat-scroll`,ref:T,tabIndex:0,role:`log`,"aria-label":`Conversation`,children:(0,V.jsxs)(U,{size:880,px:{base:`md`,sm:`xl`},py:`lg`,ref:E,children:[f&&(0,V.jsx)(w,{tone:`warning`,title:`This chat no longer exists`,children:(0,V.jsxs)(s,{justify:`space-between`,children:[(0,V.jsx)(_,{size:`sm`,children:`It was deleted, or the link is wrong.`}),(0,V.jsx)(v,{size:`compact-sm`,variant:`light`,onClick:b,children:`New chat`})]})}),!f&&!i&&l&&(0,V.jsx)(Q,{message:l,onRetry:y,onNewThread:b}),!f&&!i&&!l&&(0,V.jsx)(p,{state:`loading`,loadingLabel:`Loading chat`,rows:5}),!f&&i&&(0,V.jsxs)(V.Fragment,{children:[j.length===0&&(0,V.jsx)(Ie,{onSelect:m}),(0,V.jsx)(u,{gap:`lg`,children:F.map((e,t)=>(0,V.jsxs)(u,{gap:`lg`,ref:e.id===C?D:void 0,"data-chat-turn":e.id===C?C:void 0,children:[e.messages.filter(e=>e.id!==P?.id).map(I),t===F.length-1&&(0,V.jsxs)(V.Fragment,{children:[P&&(0,V.jsx)(d,{"data-answer-position":!0,children:(0,V.jsx)(Le,{message:P,time:n[P.id]})},`answer-${C??`draft`}`),a&&!N&&!x.has(C??``)&&(0,V.jsx)(p,{state:`loading`,loadingLabel:o||`Analyzing your system`,rows:0}),c&&(0,V.jsx)(_,{c:`dimmed`,size:`sm`,children:`Stopped`}),l&&(0,V.jsx)(Q,{message:l,onRetry:g})]})]},e.id))})]})]})}),ee&&(0,V.jsx)(R,{label:`Jump to latest`,children:(0,V.jsx)(S,{className:`chat-jump`,variant:`default`,size:36,"aria-label":`Jump to latest`,onClick:O,children:(0,V.jsx)(pe,{size:18,"aria-hidden":`true`})})})]}),!f&&(0,V.jsx)(Fe,{})]})}function Q({message:e,onRetry:t,onNewThread:n}){return(0,V.jsx)(w,{tone:`danger`,title:`Something went wrong`,children:(0,V.jsxs)(s,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,V.jsx)(_,{size:`sm`,children:e}),(0,V.jsxs)(s,{gap:`xs`,wrap:`nowrap`,children:[n&&(0,V.jsx)(v,{size:`compact-sm`,variant:`subtle`,color:`bad`,onClick:n,children:`New chat`}),(0,V.jsx)(v,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:t,children:`Retry`})]})]})})}function Fe(){let{input:e,setInput:t,inputRef:n,submit:i,send:a,stop:o,ready:c,running:l}=z();return(0,V.jsx)(d,{className:`chat-composer`,children:(0,V.jsxs)(U,{size:880,px:{base:`md`,sm:`xl`},children:[(0,V.jsx)(r,{component:`form`,onSubmit:i,className:`chat-composer-field`,style:{borderColor:`var(--composer-border, var(--labstack-control-border))`},withBorder:!0,radius:`sm`,py:6,pl:`lg`,pr:6,children:(0,V.jsxs)(s,{align:`flex-end`,gap:`xs`,wrap:`nowrap`,children:[(0,V.jsx)(M,{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:!c,autosize:!0,minRows:1,maxRows:8,variant:`unstyled`,flex:1}),l?(0,V.jsx)(R,{label:`Stop`,children:(0,V.jsx)(S,{type:`button`,variant:`default`,size:40,"aria-label":`Stop`,onClick:o,children:(0,V.jsx)(ge,{size:16,weight:`fill`})})}):(0,V.jsx)(S,{type:`submit`,variant:`filled`,size:40,disabled:!e.trim()||!c,"aria-label":`Send message`,children:(0,V.jsx)(me,{size:17,weight:`fill`})})]})}),(0,V.jsx)(_,{c:`dimmed`,size:`xs`,ta:`center`,mt:6,children:`Enter to send, Shift+Enter for a new line`})]})})}function Ie({onSelect:e}){return(0,V.jsxs)(u,{align:`center`,gap:`md`,pt:{base:32,sm:88},pb:`xl`,ta:`center`,children:[(0,V.jsx)(y,{size:`large`}),(0,V.jsx)(l,{order:2,fz:24,fw:500,lh:1.25,maw:560,children:`What do you want to know about your system?`}),(0,V.jsx)(s,{justify:`center`,gap:`xs`,mt:`xs`,maw:b.prose,children:Ne.map(t=>(0,V.jsx)(v,{variant:`default`,size:`sm`,onClick:()=>void e(t),children:t},t))})]})}function Le({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)(_,{c:`dimmed`,size:`sm`,"data-chat-anchor":!0,children:e.content.message}):(0,V.jsx)(d,{"data-chat-anchor":!0,children:(0,V.jsx)(w,{tone:`danger`,title:`Something went wrong`,children:e.content.message})}):e.activityType===`mcp-app`?n?(0,V.jsx)(Me,{view:n}):(0,V.jsx)(d,{"data-chat-anchor":!0,children:(0,V.jsx)(w,{tone:`danger`,children:`This view could not be loaded. Please try again.`})}):null;if(e.role===`assistant`&&e.toolCalls?.length)return null;let i=typeof e.content==`string`?e.content:JSON.stringify(e.content);if(!i&&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)(d,{className:`chat-message`,"data-chat-anchor":!0,"data-role":a?`user`:`assistant`,children:[a?(0,V.jsx)(r,{radius:`md`,px:`md`,py:`sm`,bg:`var(--labstack-inset)`,maw:`70%`,ml:`auto`,w:`fit-content`,children:(0,V.jsx)(_,{style:{whiteSpace:`pre-wrap`},children:i})}):(0,V.jsx)(G,{className:`chat-markdown`,children:(0,V.jsx)(N,{remarkPlugins:[F,ze],components:Be,children:i})}),(o||!a)&&(0,V.jsxs)(s,{className:`chat-message-meta`,gap:6,justify:a?`flex-end`:`flex-start`,mt:4,h:24,children:[o&&t&&(0,V.jsx)(_,{c:`dimmed`,size:`xs`,title:A(t),children:o}),!a&&(0,V.jsx)(Re,{text:i,label:`Copy message`})]})]})}function Re({text:e,label:t}){let{state:n,copy:r}=we();return(0,V.jsx)(R,{label:n===`failed`?`Could not copy`:n===`copied`?`Copied`:t,children:(0,V.jsx)(S,{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)(g,{size:13,weight:`bold`}):(0,V.jsx)(C,{size:13})})})}function ze(){return e=>{let t=[],n=e=>{if(e.type===`table`&&e.children){let t=e=>e.value??e.children?.map(t).join(``)??``,n=e.children.slice(1);e.align=(e.children[0]?.children??[]).map((r,i)=>n.length&&n.every(e=>/^[-+−]?\d[\d,.]*(?:%|\s?(?:ms|s|K|M))?$/.test(t(e.children?.[i]??{type:`text`}).trim()))?`right`:e.align?.[i]??null)}if(e.type===`heading`&&e.depth!==void 0){let n=e.depth;for(;t.length&&t.at(-1)>=n;)t.pop();t.push(n),e.depth=Math.min(6,t.length+1)}e.children?.forEach(n)};n(e)}}var Be={table:({children:e})=>(0,V.jsx)(d,{className:`chat-table`,children:(0,V.jsx)(O,{stickyHeader:!0,highlightOnHover:!0,withTableBorder:!0,verticalSpacing:`xs`,fz:`sm`,children:e})}),thead:({children:e})=>(0,V.jsx)(O.Thead,{children:e}),tbody:({children:e})=>(0,V.jsx)(O.Tbody,{children:e}),tr:({children:e})=>(0,V.jsx)(O.Tr,{children:e}),th:({children:e,style:t})=>(0,V.jsx)(O.Th,{style:t,children:e}),td:({children:e,style:t})=>(0,V.jsx)(O.Td,{style:t,ta:typeof e==`string`&&/^[-+−]?\d[\d,.]*(?:%|\s?(?:ms|s|K|M))?$/.test(e.trim())?`right`:void 0,ff:typeof e==`string`&&/^[-+−]?\d/.test(e.trim())?`monospace`:void 0,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)(d,{className:`chat-code`,pos:`relative`,children:[(0,V.jsx)(d,{className:`chat-code-actions`,pos:`absolute`,top:6,right:6,children:(0,V.jsx)(Re,{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{be as n,Pe as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat-DMtvX_Pa.js b/internal/ui/dist/assets/chat-DMtvX_Pa.js new file mode 100644 index 000000000..0776df0a4 --- /dev/null +++ b/internal/ui/dist/assets/chat-DMtvX_Pa.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mcp-app-frame-C1fa0h58.js","assets/useRouter-ByJ6_rwb.js","assets/brand-D6fP-cLS.js","assets/auth-DWqIkMZS.js","assets/useNavigate-B1zgPEUp.js","assets/index-C1Pd14SU.js","assets/preload-helper-DJZNfKNH.js","assets/lazyRouteComponent-DiWTNBZT.js","assets/theme-DXTVNXHm.js","assets/search-D_K9J6yO.js","assets/noop-mXPS5vjY.js","assets/format-BZjbsxwM.js","assets/useQuery-BLTYSIvG.js","assets/search-CDra9nG2.js","assets/index-CzwgFH1g.css"])))=>i.map(i=>d[i]); +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{$ as r,Ct as i,Dt as a,Ft as o,G as s,Nt as c,S as l,T as u,Tt as d,Zt as f,a as p,f as m,g as h,i as g,j as _,k as v,n as y,p as b,pn as x,q as S,r as C,s as w,tt as T,x as E}from"./brand-D6fP-cLS.js";import{n as D,t as ee}from"./preload-helper-DJZNfKNH.js";import{t as O}from"./Table-D4ZwUno3.js";import{a as k,n as A,t as j}from"./format-BZjbsxwM.js";import{t as M}from"./Textarea-r3wuKNbO.js";import{n as N,r as P,t as F}from"./lib-BLIvzI-_.js";import{C as I,D as L,E as te,S as ne,T as re,b as ie,ct as R,w as ae,x as oe,y as se}from"./index-C1Pd14SU.js";import{t as ce}from"./dashboard-change-chips-BJ-GZE9U.js";var z={root:`m_7485cace`},B=t(),le={strategy:`block`},V=f((e,{size:t,fluid:n})=>({root:{"--container-size":n?void 0:x(t,`container-size`)}})),H=a(e=>{let t=o(`Container`,le,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,vars:l,fluid:u,mod:f,attributes:p,strategy:m,...h}=t,g=c({name:`Container`,classes:z,props:t,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:p,vars:l,varsResolver:V});return(0,B.jsx)(d,{mod:[{fluid:u,strategy:m},f],...g(`root`),...h})});H.classes=z,H.varsResolver=V,H.displayName=`@mantine/core/Container`;var U={root:`m_d08caa0`},W=a(e=>{let t=o(`Typography`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,attributes:l,...u}=t,f=c({name:`Typography`,classes:U,props:t,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:l});return(0,B.jsx)(d,{...f(`root`),...u})});W.classes=U,W.displayName=`@mantine/core/Typography`;var G=n(e(),1),ue=new Map([[`bold`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M200,144l-72,72L56,144Z`,opacity:`0.2`}),G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}))]]),de=new Map([[`bold`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M176,128,96,208V48Z`,opacity:`0.2`}),G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}))]]),fe=new Map([[`bold`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}),G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}))]]),pe=new Map([[`bold`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}),G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}))]]),K=G.forwardRef((e,t)=>G.createElement(E,{ref:t,...e,weights:ue}));K.displayName=`ArrowDownIcon`;var me=K,q=G.forwardRef((e,t)=>G.createElement(E,{ref:t,...e,weights:de}));q.displayName=`CaretRightIcon`;var J=q,he=G.forwardRef((e,t)=>G.createElement(E,{ref:t,...e,weights:fe}));he.displayName=`PaperPlaneTiltIcon`;var ge=he,_e=G.forwardRef((e,t)=>G.createElement(E,{ref:t,...e,weights:pe}));_e.displayName=`StopIcon`;var ve=_e;function ye(e){return e.dashboard.panels.length===1?e.dashboard.panels[0].title:e.dashboard.name}function be(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`,`invalid`].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 xe=new WeakSet;function Y(e){if(!e||typeof e!=`object`||Array.isArray(e))return;if(xe.has(e))return e;let t=e;if(t.resource_uri===`ui://fanout/panels.html`)return Y({...t,resource_uri:`ui://pitot/panels.html`});if(Object.keys(t).sort().join(`,`)===`is_error,resource_uri,tool_input,tool_name,tool_result`&&t.resource_uri===`ui://pitot/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{be(t.tool_result)}catch{return}return xe.add(t),t}}var Se=16,Ce=new Set([`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `]);function we(e){let t=(0,G.useRef)(null),n=(0,G.useRef)(null),r=(0,G.useRef)(null),i=(0,G.useRef)(!0),a=(0,G.useRef)(e),o=(0,G.useRef)(()=>{}),s=(0,G.useRef)(null),c=(0,G.useRef)(new Set),l=(0,G.useRef)(null),u=(0,G.useRef)(null),[d,f]=(0,G.useState)(!1),p=(0,G.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,G.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,G.useCallback)((e,t)=>{e.scrollTop=t,u.current=e.scrollTop},[]),g=(0,G.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,G.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,G.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,G.useCallback)(e=>{n.current=e,_()},[_]),b=(0,G.useCallback)(e=>{r.current?.style.removeProperty(`min-height`),r.current=e,_()},[_]);return(0,G.useLayoutEffect)(()=>{a.current!==e&&(a.current=e,i.current=!0,l.current=null),_(),g()}),{scrollRef:v,contentRef:y,turnRef:b,showJump:d,jumpToLatest:(0,G.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,G.useState)(`idle`),r=(0,G.useRef)(null);(0,G.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 X=e=>e!==`invalid`&&e!==`not_run`;function Ee({receipt:e,running:t=!1,activity:n=``,awaitingAnswer:a=!1,initialExpanded:o=!1}){let[c,l]=(0,G.useState)(o),d=(0,G.useId)(),f=e.saved,h=f?.receipt.save_check,g=t=>Object.hasOwn(e.panel_titles,t)?e.panel_titles[t]:t,y=(h?.panels??e.panels).filter(e=>e.status===`invalid`).length,b=[...new Set([...e.explanations.filter(t=>!e.problems.some(e=>t.startsWith(`${g(e.panel_id)}:`))),...e.problems.map(e=>`${g(e.panel_id)}: ${e.message}`)])],x=Object.values(e.stages).filter(e=>e.state===`complete`).length,S=[e.stages.schema.state===`complete`?`Read telemetry`:void 0,e.panel_count===void 0?void 0:k(e.panel_count,`panel`),h?.checked?`Checked in ${j(h.elapsed_ms)}`:void 0,f?`Saved v${f.version}`:void 0].filter(Boolean).join(` · `)||`Building dashboard`,C=[...f?ne(f.receipt):[],...new Map(e.corrections.map(e=>[e.panel_id,`Fixed ${e.title}`])).values()];return(0,B.jsx)(r,{"data-build-receipt":e.turn_id,"data-dashboard-result":f?.id,"data-chat-anchor":!0,withBorder:!0,radius:`md`,p:`sm`,children:(0,B.jsxs)(u,{gap:6,children:[(0,B.jsxs)(s,{gap:`xs`,justify:`space-between`,children:[(0,B.jsxs)(_,{component:`div`,size:`sm`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[S,y>0&&(0,B.jsxs)(B.Fragment,{children:[` · `,(0,B.jsx)(m,{tone:`danger`,children:k(y,`invalid panel`)})]}),(0,B.jsxs)(_,{span:!0,c:`dimmed`,size:`xs`,children:[` · `,k(x,`stage`),` complete`]})]}),(0,B.jsxs)(v,{component:`button`,variant:`subtle`,color:`gray`,size:`compact-xs`,"aria-expanded":c,"aria-controls":d,onClick:()=>l(e=>!e),children:[`Details`,C.length>4?` (+${C.length-4})`:``]})]}),t&&a&&(0,B.jsx)(`div`,{"data-build-running":!0,children:(0,B.jsx)(p,{state:`loading`,loadingLabel:n||`Analyzing your system`,rows:0})}),(0,B.jsx)(ce,{labels:C.slice(0,4)}),b.map(e=>t?e.split(` · `).filter(e=>!e.endsWith(`: incomplete`)).join(` · `):e).filter(Boolean).map((e,t)=>(0,B.jsx)(_,{size:`xs`,c:`dimmed`,"data-receipt-attention":!0,children:e},t)),f&&(0,B.jsx)(v,{renderRoot:e=>(0,B.jsx)(D,{...e,to:`/dashboards/$dashboardId`,params:{dashboardId:f.id},search:{}}),variant:`subtle`,size:`compact-sm`,color:`gray`,style:{alignSelf:`flex-start`},children:`Open dashboard`}),(0,B.jsx)(i,{expanded:c,id:d,children:(0,B.jsxs)(u,{gap:4,children:[f&&(0,B.jsxs)(_,{size:`xs`,children:[f.label,` `,f.name,` · opens the current dashboard`]}),(0,B.jsx)(_,{size:`xs`,fw:600,children:`Build stages`}),Object.entries(e.stages).map(([n,r])=>(0,B.jsxs)(_,{component:`div`,size:`xs`,children:[(0,B.jsxs)(m,{tone:r.state===`failed`?`danger`:r.state===`complete`?`success`:r.state===`interrupted`?`warning`:`neutral`,children:[ae[n],`: `,t&&r.state===`incomplete`?`in progress`:r.state]}),r.elapsed_ms!==void 0&&(r.state===`complete`||n===`preview`&&e.panels.some(e=>X(e.status)))?` · ${j(r.elapsed_ms)}`:``]},n)),e.save_attempts.map((e,t)=>e.state===`retried`&&(0,B.jsxs)(_,{size:`xs`,c:`dimmed`,children:[`Save attempt `,t+1,`: retried`]},e.call_id)),!!e.context_counts.deploys&&(0,B.jsxs)(_,{size:`xs`,children:[e.context_counts.deploys,` deploys observed`]}),!!e.context_counts.anomalies&&(0,B.jsxs)(_,{size:`xs`,children:[e.context_counts.anomalies,` anomalies observed`]}),(0,B.jsx)(_,{size:`xs`,fw:600,children:`Panel preview`}),e.panels.map(e=>(0,B.jsxs)(_,{component:`div`,size:`xs`,children:[`Preview · `,g(e.id),`: `,(0,B.jsx)(m,{tone:e.status===`ok`?`success`:e.status===`empty`||e.status===`not_run`?`neutral`:`danger`,children:e.status===`ok`?`Ok`:e.status.charAt(0).toUpperCase()+e.status.slice(1)}),X(e.status)&&e.elapsed_ms!==void 0?` · ${j(e.elapsed_ms)}`:``]},e.id)),h&&(0,B.jsx)(_,{size:`xs`,fw:600,children:`Save verification`}),h&&(0,B.jsxs)(_,{size:`xs`,children:[`Save check: `,h.checked?`checked`:`incomplete`,h.checked?` · ${j(h.elapsed_ms)}`:``]}),h?.panels.map(e=>(0,B.jsxs)(_,{component:`div`,size:`xs`,children:[`Save · `,g(e.id),`: `,(0,B.jsx)(m,{tone:e.status===`ok`?`success`:e.status===`empty`||e.status===`not_run`?`neutral`:`danger`,children:e.status===`ok`?`Ok`:e.status.charAt(0).toUpperCase()+e.status.slice(1)}),X(e.status)&&` · ${k(e.rows??0,`row`)}`,X(e.status)&&e.elapsed_ms!==void 0?` · ${j(e.elapsed_ms)}`:``]},e.id)),C.slice(4).map((e,t)=>(0,B.jsx)(_,{size:`xs`,children:e},t)),e.corrections.map((e,t)=>(0,B.jsxs)(_,{size:`xs`,children:[`Fixed `,e.title,`: `,e.message]},t))]})})]})})}var De=(0,G.lazy)(()=>ee(()=>import(`./mcp-app-frame-C1fa0h58.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),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=Y(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(!L(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)?re(e.function.arguments)?.dashboard:void 0,r=L(t)&&Array.isArray(t.panels)?t.panels.map(e=>L(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=re(a.content);if(!a.error&&!e?.error&&e?.isError!==!0)continue;let o=n.get(a.toolCallId);if(o&&te.has(o.name)&&I(a))continue;let s=L(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:se(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,G.useState)({rejected:!1,failed:!1}),r=e.filter(e=>e.rejected),i=e.filter(e=>!e.readOnly&&!e.rejected),a=[{key:`rejected`,items:r,label:`${r.length} ${r.length===1?`draft`:`drafts`} rejected`},{key:`failed`,items:i,label:`${i.length} ${i.length===1?`step`:`steps`} failed`}];return(0,B.jsxs)(d,{"data-chat-anchor":!0,children:[e.some(e=>e.readOnly)&&(0,B.jsx)(_,{size:`sm`,c:`dimmed`,children:`Not saved: Explain is read-only`}),a.map(({key:e,items:r,label:i})=>r.length>0&&(0,B.jsxs)(d,{children:[(0,B.jsxs)(T,{className:`chat-app-toggle`,"aria-expanded":t[e],onClick:()=>n(t=>({...t,[e]:!t[e]})),style:{color:`var(--mantine-color-dimmed)`},children:[(0,B.jsx)(`span`,{className:`chat-app-chevron`,"aria-hidden":`true`,children:t[e]?(0,B.jsx)(P,{size:14}):(0,B.jsx)(J,{size:14})}),(0,B.jsx)(`span`,{className:`chat-app-summary`,children:i})]}),t[e]&&(0,B.jsx)(u,{gap:`xs`,pl:`md`,children:r.flatMap((e,t)=>(e.details.length?e.details:[`${e.name}: ${e.message}`]).map((e,n)=>(0,B.jsx)(_,{size:`sm`,c:`dimmed`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:e},`${t}-${n}`)))})]},e))]})}function Ne({view:e}){let[t,n]=(0,G.useState)(e.expanded);(0,G.useEffect)(()=>n(e.expanded),[e.expanded]);let i=e.content.tool_result,a=ye(i),o=[...new Set(i.dashboard.panels.map(e=>e.viz===`timeseries`?`time series`:e.viz.replaceAll(`_`,` `)))].join(`, `),s=i.results.reduce((e,t)=>e+(t.frame?.rows??0),0),c=new Map;for(let e of i.results)e.status!==`ok`&&c.set(e.status,(c.get(e.status)??0)+1);let l=i.dashboard.panels.length>1?Array.from(c,([e,t])=>`${t} ${e}`).join(` · `):c.size?[...c.keys()].join(`, `):`${s} ${s===1?`row`:`rows`}`;return(0,B.jsxs)(r,{"data-chat-app":!0,"data-chat-anchor":!0,withBorder:!0,radius:`md`,style:{overflow:`hidden`},children:[(0,B.jsxs)(T,{className:`chat-app-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,B.jsx)(`span`,{className:`chat-app-chevron`,"aria-hidden":`true`,children:t?(0,B.jsx)(P,{size:14}):(0,B.jsx)(J,{size:14})}),(0,B.jsx)(`span`,{className:`chat-app-summary`,children:[a,o,l].filter(Boolean).join(` · `)})]}),t&&(0,B.jsx)(G.Suspense,{fallback:(0,B.jsx)(p,{state:`loading`,loadingLabel:`Preparing view…`}),children:(0,B.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:i,running:a,activity:o,stopped:c,error:l,threadMissing:f,send:m,retry:g,reloadThread:y,newThread:b}=oe(),x=ie(t),C=t.filter(e=>e.role===`user`).at(-1)?.id,{scrollRef:T,contentRef:E,turnRef:D,showJump:ee,jumpToLatest:O}=we(C);if(!e)return(0,B.jsx)(H,{size:`sm`,py:96,children:(0,B.jsx)(r,{withBorder:!0,radius:`md`,p:{base:`xl`,sm:40},children:(0,B.jsxs)(u,{gap:`md`,children:[(0,B.jsx)(_,{fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Optional capability`}),(0,B.jsx)(h,{title:`Chat`,description:`Chat is not configured`}),(0,B.jsx)(_,{c:`dimmed`,children:`Add an AI provider key to enable chat. Telemetry ingest, dashboards, traces, logs, and metrics remain available without it.`}),(0,B.jsx)(v,{component:`a`,href:`/dashboards`,variant:`light`,mt:`sm`,children:`Open dashboards`})]})})});let k=ke(t),A=je(t),j=t.filter(e=>k.duplicates.has(e.id)?!1:e.role===`tool`?A.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`),M=t.findIndex(e=>e.id===C),N=t.slice(M+1).some(e=>e.role===`assistant`&&!e.toolCalls?.length&&typeof e.content==`string`&&e.content.length>0),P=t.slice(M+1).filter(e=>e.role===`assistant`&&!e.toolCalls?.length&&typeof e.content==`string`&&e.content.trim().length>0).at(-1),F=[];for(let e of j)(e.role===`user`||F.length===0)&&F.push({id:e.id,messages:[]}),F.at(-1).messages.push(e);F.length===0&&F.push({id:`draft`,messages:[]});let I=e=>A.has(e.id)?(0,B.jsx)(Me,{failures:A.get(e.id)},e.id):(0,B.jsxs)(d,{children:[(0,B.jsx)(Re,{message:e,time:n[e.id],appView:k.views.get(e.id)}),x.has(e.id)&&(0,B.jsx)(d,{mt:`sm`,children:(0,B.jsx)(Ee,{receipt:x.get(e.id),running:a&&e.id===C,awaitingAnswer:!N,activity:o})})]},e.id);return(0,B.jsxs)(d,{className:`chat-pane`,children:[(0,B.jsx)(H,{size:880,w:`100%`,px:{base:`md`,sm:`xl`},py:`md`,children:(0,B.jsx)(h,{title:`Chat`,description:`Investigate your telemetry with Pitot.`})}),(0,B.jsxs)(d,{className:`chat-viewport`,children:[(0,B.jsx)(d,{className:`chat-scroll`,ref:T,tabIndex:0,role:`log`,"aria-label":`Conversation`,children:(0,B.jsxs)(H,{size:880,px:{base:`md`,sm:`xl`},py:`lg`,ref:E,children:[f&&(0,B.jsx)(w,{tone:`warning`,title:`This chat no longer exists`,children:(0,B.jsxs)(s,{justify:`space-between`,children:[(0,B.jsx)(_,{size:`sm`,children:`It was deleted, or the link is wrong.`}),(0,B.jsx)(v,{size:`compact-sm`,variant:`light`,onClick:b,children:`New chat`})]})}),!f&&!i&&l&&(0,B.jsx)(Z,{message:l,onRetry:y,onNewThread:b}),!f&&!i&&!l&&(0,B.jsx)(p,{state:`loading`,loadingLabel:`Loading chat`,rows:5}),!f&&i&&(0,B.jsxs)(B.Fragment,{children:[j.length===0&&(0,B.jsx)(Le,{onSelect:m}),(0,B.jsx)(u,{gap:`lg`,children:F.map((e,t)=>(0,B.jsxs)(u,{gap:`lg`,ref:e.id===C?D:void 0,"data-chat-turn":e.id===C?C:void 0,children:[e.messages.filter(e=>e.id!==P?.id).map(I),t===F.length-1&&(0,B.jsxs)(B.Fragment,{children:[P&&(0,B.jsx)(d,{"data-answer-position":!0,children:(0,B.jsx)(Re,{message:P,time:n[P.id]})},`answer-${C??`draft`}`),a&&!N&&!x.has(C??``)&&(0,B.jsx)(p,{state:`loading`,loadingLabel:o||`Analyzing your system`,rows:0}),c&&(0,B.jsx)(_,{c:`dimmed`,size:`sm`,children:`Stopped`}),l&&(0,B.jsx)(Z,{message:l,onRetry:g})]})]},e.id))})]})]})}),ee&&(0,B.jsx)(R,{label:`Jump to latest`,children:(0,B.jsx)(S,{className:`chat-jump`,variant:`default`,size:36,"aria-label":`Jump to latest`,onClick:O,children:(0,B.jsx)(me,{size:18,"aria-hidden":`true`})})})]}),!f&&(0,B.jsx)(Ie,{})]})}function Z({message:e,onRetry:t,onNewThread:n}){return(0,B.jsx)(w,{tone:`danger`,title:`Something went wrong`,children:(0,B.jsxs)(s,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,B.jsx)(_,{size:`sm`,children:e}),(0,B.jsxs)(s,{gap:`xs`,wrap:`nowrap`,children:[n&&(0,B.jsx)(v,{size:`compact-sm`,variant:`subtle`,color:`bad`,onClick:n,children:`New chat`}),(0,B.jsx)(v,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:t,children:`Retry`})]})]})})}function Ie(){let{input:e,setInput:t,inputRef:n,submit:i,send:a,stop:o,ready:c,running:l}=oe();return(0,B.jsx)(d,{className:`chat-composer`,children:(0,B.jsxs)(H,{size:880,px:{base:`md`,sm:`xl`},children:[(0,B.jsx)(r,{component:`form`,onSubmit:i,className:`chat-composer-field`,style:{borderColor:`var(--composer-border, var(--labstack-control-border))`},withBorder:!0,radius:`sm`,py:6,pl:`lg`,pr:6,children:(0,B.jsxs)(s,{align:`flex-end`,gap:`xs`,wrap:`nowrap`,children:[(0,B.jsx)(M,{ref:n,"aria-label":`Message Pitot`,value:e,onChange:e=>t(e.currentTarget.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),a(e))},placeholder:l?`Pitot is working…`:`Ask about health, errors, or latency…`,disabled:!c,autosize:!0,minRows:1,maxRows:8,variant:`unstyled`,flex:1}),l?(0,B.jsx)(R,{label:`Stop`,children:(0,B.jsx)(S,{type:`button`,variant:`default`,size:40,"aria-label":`Stop`,onClick:o,children:(0,B.jsx)(ve,{size:16,weight:`fill`})})}):(0,B.jsx)(S,{type:`submit`,variant:`filled`,size:40,disabled:!e.trim()||!c,"aria-label":`Send message`,children:(0,B.jsx)(ge,{size:17,weight:`fill`})})]})}),(0,B.jsx)(_,{c:`dimmed`,size:`xs`,ta:`center`,mt:6,children:`Enter to send, Shift+Enter for a new line`})]})})}function Le({onSelect:e}){return(0,B.jsxs)(u,{align:`center`,gap:`md`,pt:{base:32,sm:88},pb:`xl`,ta:`center`,children:[(0,B.jsx)(y,{size:`large`}),(0,B.jsx)(l,{order:2,fz:24,fw:500,lh:1.25,maw:560,children:`What do you want to know about your system?`}),(0,B.jsx)(s,{justify:`center`,gap:`xs`,mt:`xs`,maw:b.prose,children:Pe.map(t=>(0,B.jsx)(v,{variant:`default`,size:`sm`,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,B.jsx)(_,{c:`dimmed`,size:`sm`,"data-chat-anchor":!0,children:e.content.message}):(0,B.jsx)(d,{"data-chat-anchor":!0,children:(0,B.jsx)(w,{tone:`danger`,title:`Something went wrong`,children:e.content.message})}):e.activityType===`mcp-app`?n?(0,B.jsx)(Ne,{view:n}):(0,B.jsx)(d,{"data-chat-anchor":!0,children:(0,B.jsx)(w,{tone:`danger`,children:`This view could not be loaded. Please try again.`})}):null;if(e.role===`assistant`&&e.toolCalls?.length)return null;let i=typeof e.content==`string`?e.content:JSON.stringify(e.content);if(!i&&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,B.jsxs)(d,{className:`chat-message`,"data-chat-anchor":!0,"data-role":a?`user`:`assistant`,children:[a?(0,B.jsx)(r,{radius:`md`,px:`md`,py:`sm`,bg:`var(--labstack-inset)`,maw:`70%`,ml:`auto`,w:`fit-content`,children:(0,B.jsx)(_,{style:{whiteSpace:`pre-wrap`},children:i})}):(0,B.jsx)(W,{className:`chat-markdown`,children:(0,B.jsx)(N,{remarkPlugins:[F,ze],components:Be,children:i})}),(o||!a)&&(0,B.jsxs)(s,{className:`chat-message-meta`,gap:6,justify:a?`flex-end`:`flex-start`,mt:4,h:24,children:[o&&t&&(0,B.jsx)(_,{c:`dimmed`,size:`xs`,title:A(t),children:o}),!a&&(0,B.jsx)(Q,{text:i,label:`Copy message`})]})]})}function Q({text:e,label:t}){let{state:n,copy:r}=Te();return(0,B.jsx)(R,{label:n===`failed`?`Could not copy`:n===`copied`?`Copied`:t,children:(0,B.jsx)(S,{variant:`subtle`,color:`gray`,size:`sm`,"aria-label":t,"data-state":n===`idle`?void 0:n,onClick:()=>r(e),children:n===`copied`?(0,B.jsx)(g,{size:13,weight:`bold`}):(0,B.jsx)(C,{size:13})})})}function ze(){return e=>{let t=[],n=e=>{if(e.type===`table`&&e.children){let t=e=>e.value??e.children?.map(t).join(``)??``,n=e.children.slice(1);e.align=(e.children[0]?.children??[]).map((r,i)=>n.length&&n.every(e=>/^[-+−]?\d[\d,.]*(?:%|\s?(?:ms|s|K|M))?$/.test(t(e.children?.[i]??{type:`text`}).trim()))?`right`:e.align?.[i]??null)}if(e.type===`heading`&&e.depth!==void 0){let n=e.depth;for(;t.length&&t.at(-1)>=n;)t.pop();t.push(n),e.depth=Math.min(6,t.length+1)}e.children?.forEach(n)};n(e)}}var Be={table:({children:e})=>(0,B.jsx)(d,{className:`chat-table`,children:(0,B.jsx)(O,{stickyHeader:!0,highlightOnHover:!0,withTableBorder:!0,verticalSpacing:`xs`,fz:`sm`,children:e})}),thead:({children:e})=>(0,B.jsx)(O.Thead,{children:e}),tbody:({children:e})=>(0,B.jsx)(O.Tbody,{children:e}),tr:({children:e})=>(0,B.jsx)(O.Tr,{children:e}),th:({children:e,style:t})=>(0,B.jsx)(O.Th,{style:t,children:e}),td:({children:e,style:t})=>(0,B.jsx)(O.Td,{style:t,ta:typeof e==`string`&&/^[-+−]?\d[\d,.]*(?:%|\s?(?:ms|s|K|M))?$/.test(e.trim())?`right`:void 0,ff:typeof e==`string`&&/^[-+−]?\d/.test(e.trim())?`monospace`:void 0,children:e}),pre:({children:e})=>(0,B.jsx)(Ve,{children:e}),a:({href:e,children:t})=>(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t})};function Ve({children:e}){let t=$(e);return(0,B.jsxs)(d,{className:`chat-code`,pos:`relative`,children:[(0,B.jsx)(d,{className:`chat-code-actions`,pos:`absolute`,top:6,right:6,children:(0,B.jsx)(Q,{text:t,label:`Copy code`})}),(0,B.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{Y as n,Fe as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat._threadId-CEunwapm.js b/internal/ui/dist/assets/chat._threadId-CEunwapm.js deleted file mode 100644 index 052365616..000000000 --- a/internal/ui/dist/assets/chat._threadId-CEunwapm.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./chat-Bv0H8gs5.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat._threadId-D5uvUdcn.js b/internal/ui/dist/assets/chat._threadId-D5uvUdcn.js new file mode 100644 index 000000000..282ccdb8b --- /dev/null +++ b/internal/ui/dist/assets/chat._threadId-D5uvUdcn.js @@ -0,0 +1 @@ +import{t as e}from"./chat-DMtvX_Pa.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat.index-CEunwapm.js b/internal/ui/dist/assets/chat.index-CEunwapm.js deleted file mode 100644 index 052365616..000000000 --- a/internal/ui/dist/assets/chat.index-CEunwapm.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./chat-Bv0H8gs5.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat.index-D5uvUdcn.js b/internal/ui/dist/assets/chat.index-D5uvUdcn.js new file mode 100644 index 000000000..282ccdb8b --- /dev/null +++ b/internal/ui/dist/assets/chat.index-D5uvUdcn.js @@ -0,0 +1 @@ +import{t as e}from"./chat-DMtvX_Pa.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboard-change-chips-DMsA4yET.js b/internal/ui/dist/assets/dashboard-change-chips-BJ-GZE9U.js similarity index 84% rename from internal/ui/dist/assets/dashboard-change-chips-DMsA4yET.js rename to internal/ui/dist/assets/dashboard-change-chips-BJ-GZE9U.js index ecefe0cc4..f42da627c 100644 --- a/internal/ui/dist/assets/dashboard-change-chips-DMsA4yET.js +++ b/internal/ui/dist/assets/dashboard-change-chips-BJ-GZE9U.js @@ -1 +1 @@ -import{r as e}from"./useRouter-ByJ6_rwb.js";import{A as t,G as n}from"./brand-CCQ0JT0F.js";var r=e();function i({labels:e}){return e.length?(0,r.jsx)(n,{gap:4,"data-edit-chips":!0,children:e.map((e,n)=>(0,r.jsx)(t,{color:`gray`,variant:`light`,size:`sm`,tt:`none`,maw:`100%`,title:e,style:{color:`var(--mantine-color-text)`,height:`auto`,whiteSpace:`normal`,overflowWrap:`anywhere`},children:e},n))}):null}export{i as t}; \ No newline at end of file +import{r as e}from"./useRouter-ByJ6_rwb.js";import{A as t,G as n}from"./brand-D6fP-cLS.js";var r=e();function i({labels:e}){return e.length?(0,r.jsx)(n,{gap:4,"data-edit-chips":!0,children:e.map((e,n)=>(0,r.jsx)(t,{color:`gray`,variant:`light`,size:`sm`,tt:`none`,maw:`100%`,title:e,style:{color:`var(--mantine-color-text)`,height:`auto`,whiteSpace:`normal`,overflowWrap:`anywhere`},children:e},n))}):null}export{i as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboards._dashboardId-Bw6ECcx6.js b/internal/ui/dist/assets/dashboards._dashboardId-C_KLDd8s.js similarity index 63% rename from internal/ui/dist/assets/dashboards._dashboardId-Bw6ECcx6.js rename to internal/ui/dist/assets/dashboards._dashboardId-C_KLDd8s.js index 04c13cfcf..2a7be1cf6 100644 --- a/internal/ui/dist/assets/dashboards._dashboardId-Bw6ECcx6.js +++ b/internal/ui/dist/assets/dashboards._dashboardId-C_KLDd8s.js @@ -1 +1 @@ -import{r as e}from"./useRouter-ByJ6_rwb.js";import{n as t}from"./useNavigate-B1zgPEUp.js";import{i as n,s as r}from"./search-DBgztReF.js";import{t as i}from"./page-DZ5HGDWI.js";import{t as a}from"./index-C5SsAUtw.js";var o=e();function s(){let{dashboardId:e}=a.useParams(),s=n(a.useSearch()),c=t(),l=(t,n,i)=>void c({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:r(n),replace:i,resetScroll:t!==e});return(0,o.jsx)(i,{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{i as n,s as r}from"./search-D_K9J6yO.js";import{t as i}from"./page-BABqeqdg.js";import{t as a}from"./index-C1Pd14SU.js";var o=e();function s(){let{dashboardId:e}=a.useParams(),s=n(a.useSearch()),c=t(),l=(t,n,i)=>void c({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:r(n),replace:i,resetScroll:t!==e});return(0,o.jsx)(i,{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-CRdyk0DX.js b/internal/ui/dist/assets/dashboards.index-N7UkPeK5.js similarity index 56% rename from internal/ui/dist/assets/dashboards.index-CRdyk0DX.js rename to internal/ui/dist/assets/dashboards.index-N7UkPeK5.js index f6258adcc..dabb3fe73 100644 --- a/internal/ui/dist/assets/dashboards.index-CRdyk0DX.js +++ b/internal/ui/dist/assets/dashboards.index-N7UkPeK5.js @@ -1 +1 @@ -import{r as e}from"./useRouter-ByJ6_rwb.js";import{n as t}from"./useNavigate-B1zgPEUp.js";import{i as n,s as r}from"./search-DBgztReF.js";import{t as i}from"./page-DZ5HGDWI.js";import{n as a}from"./index-C5SsAUtw.js";var o=e();function s(){let e=n(a.useSearch()),s=t();return(0,o.jsx)(i,{search:e,onSearch:()=>void 0,onOpen:(t,n)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:r(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{i as n,s as r}from"./search-D_K9J6yO.js";import{t as i}from"./page-BABqeqdg.js";import{n as a}from"./index-C1Pd14SU.js";var o=e();function s(){let e=n(a.useSearch()),s=t();return(0,o.jsx)(i,{search:e,onSearch:()=>void 0,onOpen:(t,n)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:r(e),replace:n})})}export{s as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/discard-BmoNOAJh.js b/internal/ui/dist/assets/discard-NZfxCIcK.js similarity index 92% rename from internal/ui/dist/assets/discard-BmoNOAJh.js rename to internal/ui/dist/assets/discard-NZfxCIcK.js index 5e01e0329..45e708549 100644 --- a/internal/ui/dist/assets/discard-BmoNOAJh.js +++ b/internal/ui/dist/assets/discard-NZfxCIcK.js @@ -1 +1 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{j as r,u as i}from"./brand-CCQ0JT0F.js";var a=n(e(),1),o=t();function s(e,t,n){let[s,c]=(0,a.useState)(!1),l=(0,a.useRef)(null),u=()=>{if(!e){t();return}l.current=document.activeElement instanceof HTMLElement?document.activeElement:null,c(!0)},d=()=>{c(!1);let e=l.current?.isConnected&&l.current!==document.body?l.current:null;requestAnimationFrame(()=>e?.focus())};return{request:u,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||e.nativeEvent.isComposing||e.target instanceof Element&&e.target.getAttribute(`aria-expanded`)===`true`||(s?d():u())},prompt:s&&(0,o.jsxs)(i,{opened:s,onClose:d,title:`Discard changes?`,confirmLabel:`Discard changes`,cancelLabel:`Keep editing`,tone:`danger`,onConfirm:t,children:[`Your changes to `,(0,o.jsx)(r,{span:!0,ff:`monospace`,children:n}),` have not been saved.`]})}}export{s as t}; \ No newline at end of file +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{j as r,u as i}from"./brand-D6fP-cLS.js";var a=n(e(),1),o=t();function s(e,t,n){let[s,c]=(0,a.useState)(!1),l=(0,a.useRef)(null),u=()=>{if(!e){t();return}l.current=document.activeElement instanceof HTMLElement?document.activeElement:null,c(!0)},d=()=>{c(!1);let e=l.current?.isConnected&&l.current!==document.body?l.current:null;requestAnimationFrame(()=>e?.focus())};return{request:u,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||e.nativeEvent.isComposing||e.target instanceof Element&&e.target.getAttribute(`aria-expanded`)===`true`||(s?d():u())},prompt:s&&(0,o.jsxs)(i,{opened:s,onClose:d,title:`Discard changes?`,confirmLabel:`Discard changes`,cancelLabel:`Keep editing`,tone:`danger`,onConfirm:t,children:[`Your changes to `,(0,o.jsx)(r,{span:!0,ff:`monospace`,children:n}),` have not been saved.`]})}}export{s as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/explore-SPpRMYjX.js b/internal/ui/dist/assets/explore-D4KpDh3K.js similarity index 57% rename from internal/ui/dist/assets/explore-SPpRMYjX.js rename to internal/ui/dist/assets/explore-D4KpDh3K.js index e120dfc8a..ebc7c5c6f 100644 --- a/internal/ui/dist/assets/explore-SPpRMYjX.js +++ b/internal/ui/dist/assets/explore-D4KpDh3K.js @@ -1 +1 @@ -import{r as e}from"./useRouter-ByJ6_rwb.js";import{n as t}from"./useNavigate-B1zgPEUp.js";import{i as n,r}from"./search-Bj_SOIkw.js";import{a as i}from"./index-C5SsAUtw.js";import{t as a}from"./page-DI98kZbw.js";var o=e();function s(){let e=r(i.useSearch()),s=t();return(0,o.jsx)(a,{search:e,onSearch:(e,t)=>void s({to:`/explore`,search:n(e),replace:t}),onSaved:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e}})})}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{i as n,r}from"./search-CDra9nG2.js";import{a as i}from"./index-C1Pd14SU.js";import{t as a}from"./page-1Rod7OFH.js";var o=e();function s(){let e=r(i.useSearch()),s=t();return(0,o.jsx)(a,{search:e,onSearch:(e,t)=>void s({to:`/explore`,search:n(e),replace:t}),onSaved:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e}})})}export{s as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/format-fsvZ_y78.js b/internal/ui/dist/assets/format-BZjbsxwM.js similarity index 98% rename from internal/ui/dist/assets/format-fsvZ_y78.js rename to internal/ui/dist/assets/format-BZjbsxwM.js index 6efc1f43b..5545eab16 100644 --- a/internal/ui/dist/assets/format-fsvZ_y78.js +++ b/internal/ui/dist/assets/format-BZjbsxwM.js @@ -1 +1 @@ -import{i as e,r as t}from"./useRouter-ByJ6_rwb.js";import{wt as n}from"./brand-CCQ0JT0F.js";e();function r(e){return e?.props?.ref}function i(e,t,n,r){return e===`center`||r===`center`?{top:t}:e===`end`?{bottom:n}:e===`start`?{top:n}:{}}function a(e,t,n,r,i){return e===`center`||r===`center`?{left:t}:e===`end`?{[i===`ltr`?`right`:`left`]:n}:e===`start`?{[i===`ltr`?`left`:`right`]:n}:{}}var o={bottom:`borderTopLeftRadius`,left:`borderTopRightRadius`,right:`borderBottomLeftRadius`,top:`borderBottomRightRadius`};function s({position:e,arrowSize:t,dir:n}){let[r,i]=e.split(`-`);if(!i)return;let a={width:t,height:t,position:`absolute`};if(r===`bottom`){let e=i===`start`,r=e?n===`ltr`?`left`:`right`:n===`ltr`?`right`:`left`;return{...a,top:-t,[r]:0,clipPath:e===(n===`rtl`)?`polygon(100% 0%, 0% 100%, 100% 100%)`:`polygon(0% 0%, 0% 100%, 100% 100%)`}}if(r===`top`){let e=i===`start`,r=e?n===`ltr`?`left`:`right`:n===`ltr`?`right`:`left`;return{...a,bottom:-t,[r]:0,clipPath:e===(n===`rtl`)?`polygon(0% 0%, 100% 0%, 100% 100%)`:`polygon(0% 0%, 100% 0%, 0% 100%)`}}if(r===`left`)return{...a,right:-t,[i===`start`?`top`:`bottom`]:0,clipPath:i===`start`?`polygon(0% 0%, 100% 0%, 0% 100%)`:`polygon(0% 0%, 0% 100%, 100% 100%)`};if(r===`right`)return{...a,left:-t,[i===`start`?`top`:`bottom`]:0,clipPath:i===`start`?`polygon(0% 0%, 100% 0%, 100% 100%)`:`polygon(100% 0%, 0% 100%, 100% 100%)`}}function c({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:c,arrowX:l,arrowY:u,dir:d}){if(c===`merge`){let n=s({position:e,arrowSize:t,dir:d});if(n)return n}let[f,p=`center`]=e.split(`-`),m={width:t,height:t,transform:`rotate(45deg)`,position:`absolute`,[o[f]]:r},h=-t/2;return f===`left`?{...m,...i(p,u,n,c),right:h,borderLeftColor:`transparent`,borderBottomColor:`transparent`,clipPath:`polygon(100% 0, 0 0, 100% 100%)`}:f===`right`?{...m,...i(p,u,n,c),left:h,borderRightColor:`transparent`,borderTopColor:`transparent`,clipPath:`polygon(0 100%, 0 0, 100% 100%)`}:f===`top`?{...m,...a(p,l,n,c,d),bottom:h,borderTopColor:`transparent`,borderLeftColor:`transparent`,clipPath:`polygon(0 100%, 100% 100%, 100% 0)`}:f===`bottom`?{...m,...a(p,l,n,c,d),top:h,borderBottomColor:`transparent`,borderRightColor:`transparent`,clipPath:`polygon(0 100%, 0 0, 100% 0)`}:{}}function l({position:e,dir:t}){let[n,r]=e.split(`-`);if(!r)return;let i=r===`start`&&t===`ltr`||r===`end`&&t===`rtl`;if(n===`bottom`)return i?{borderTopLeftRadius:0}:{borderTopRightRadius:0};if(n===`top`)return i?{borderBottomLeftRadius:0}:{borderBottomRightRadius:0};if(n===`left`)return r===`start`?{borderTopRightRadius:0}:{borderBottomRightRadius:0};if(n===`right`)return r===`start`?{borderTopLeftRadius:0}:{borderBottomLeftRadius:0}}var u=t();function d({position:e,arrowSize:t,arrowOffset:r,arrowRadius:i,arrowPosition:a,visible:o,arrowX:s,arrowY:l,style:d,...f}){let{dir:p}=n();return o?(0,u.jsx)(`div`,{role:`presentation`,...f,style:{...d,...c({position:e,arrowSize:t,arrowOffset:r,arrowRadius:i,arrowPosition:a,dir:p,arrowX:s,arrowY:l})}}):null}d.displayName=`@mantine/core/FloatingArrow`;function f(e,t){if(e===`rtl`&&(t.includes(`right`)||t.includes(`left`))){let[e,n]=t.split(`-`),r=e===`right`?`left`:`right`;return n===void 0?r:`${r}-${n}`}return t}var p=(e,t)=>`${e} ${t}${e===1?``:`s`}`,m=(e,t)=>String(Number(e.toFixed(t))),h=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function g(e){return Number.isFinite(e)?e>0&&e<1e-4?`<0.01%`:`${(e*100).toFixed(e>=.1?1:2)}%`:`—`}function _(e){if(!Number.isFinite(e))return`—`;if(e<0)return`-${_(-e)}`;if(e===0)return`0 ms`;if(e<.01)return`<0.01 ms`;if(e<1)return`${m(e,2)} ms`;if(Math.round(e*10)/10<100)return`${m(e,1)} ms`;if(Math.round(e)<1e3)return`${Math.round(e)} ms`;let t=Math.round(e/100)/10;if(t<10)return`${m(e/1e3,2)} s`;if(t<60)return`${m(t,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 v(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`})}export{p as a,l as c,g as i,r as l,v as n,f as o,h as r,d as s,_ as t}; \ No newline at end of file +import{i as e,r as t}from"./useRouter-ByJ6_rwb.js";import{wt as n}from"./brand-D6fP-cLS.js";e();function r(e){return e?.props?.ref}function i(e,t,n,r){return e===`center`||r===`center`?{top:t}:e===`end`?{bottom:n}:e===`start`?{top:n}:{}}function a(e,t,n,r,i){return e===`center`||r===`center`?{left:t}:e===`end`?{[i===`ltr`?`right`:`left`]:n}:e===`start`?{[i===`ltr`?`left`:`right`]:n}:{}}var o={bottom:`borderTopLeftRadius`,left:`borderTopRightRadius`,right:`borderBottomLeftRadius`,top:`borderBottomRightRadius`};function s({position:e,arrowSize:t,dir:n}){let[r,i]=e.split(`-`);if(!i)return;let a={width:t,height:t,position:`absolute`};if(r===`bottom`){let e=i===`start`,r=e?n===`ltr`?`left`:`right`:n===`ltr`?`right`:`left`;return{...a,top:-t,[r]:0,clipPath:e===(n===`rtl`)?`polygon(100% 0%, 0% 100%, 100% 100%)`:`polygon(0% 0%, 0% 100%, 100% 100%)`}}if(r===`top`){let e=i===`start`,r=e?n===`ltr`?`left`:`right`:n===`ltr`?`right`:`left`;return{...a,bottom:-t,[r]:0,clipPath:e===(n===`rtl`)?`polygon(0% 0%, 100% 0%, 100% 100%)`:`polygon(0% 0%, 100% 0%, 0% 100%)`}}if(r===`left`)return{...a,right:-t,[i===`start`?`top`:`bottom`]:0,clipPath:i===`start`?`polygon(0% 0%, 100% 0%, 0% 100%)`:`polygon(0% 0%, 0% 100%, 100% 100%)`};if(r===`right`)return{...a,left:-t,[i===`start`?`top`:`bottom`]:0,clipPath:i===`start`?`polygon(0% 0%, 100% 0%, 100% 100%)`:`polygon(100% 0%, 0% 100%, 100% 100%)`}}function c({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:c,arrowX:l,arrowY:u,dir:d}){if(c===`merge`){let n=s({position:e,arrowSize:t,dir:d});if(n)return n}let[f,p=`center`]=e.split(`-`),m={width:t,height:t,transform:`rotate(45deg)`,position:`absolute`,[o[f]]:r},h=-t/2;return f===`left`?{...m,...i(p,u,n,c),right:h,borderLeftColor:`transparent`,borderBottomColor:`transparent`,clipPath:`polygon(100% 0, 0 0, 100% 100%)`}:f===`right`?{...m,...i(p,u,n,c),left:h,borderRightColor:`transparent`,borderTopColor:`transparent`,clipPath:`polygon(0 100%, 0 0, 100% 100%)`}:f===`top`?{...m,...a(p,l,n,c,d),bottom:h,borderTopColor:`transparent`,borderLeftColor:`transparent`,clipPath:`polygon(0 100%, 100% 100%, 100% 0)`}:f===`bottom`?{...m,...a(p,l,n,c,d),top:h,borderBottomColor:`transparent`,borderRightColor:`transparent`,clipPath:`polygon(0 100%, 0 0, 100% 0)`}:{}}function l({position:e,dir:t}){let[n,r]=e.split(`-`);if(!r)return;let i=r===`start`&&t===`ltr`||r===`end`&&t===`rtl`;if(n===`bottom`)return i?{borderTopLeftRadius:0}:{borderTopRightRadius:0};if(n===`top`)return i?{borderBottomLeftRadius:0}:{borderBottomRightRadius:0};if(n===`left`)return r===`start`?{borderTopRightRadius:0}:{borderBottomRightRadius:0};if(n===`right`)return r===`start`?{borderTopLeftRadius:0}:{borderBottomLeftRadius:0}}var u=t();function d({position:e,arrowSize:t,arrowOffset:r,arrowRadius:i,arrowPosition:a,visible:o,arrowX:s,arrowY:l,style:d,...f}){let{dir:p}=n();return o?(0,u.jsx)(`div`,{role:`presentation`,...f,style:{...d,...c({position:e,arrowSize:t,arrowOffset:r,arrowRadius:i,arrowPosition:a,dir:p,arrowX:s,arrowY:l})}}):null}d.displayName=`@mantine/core/FloatingArrow`;function f(e,t){if(e===`rtl`&&(t.includes(`right`)||t.includes(`left`))){let[e,n]=t.split(`-`),r=e===`right`?`left`:`right`;return n===void 0?r:`${r}-${n}`}return t}var p=(e,t)=>`${e} ${t}${e===1?``:`s`}`,m=(e,t)=>String(Number(e.toFixed(t))),h=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function g(e){return Number.isFinite(e)?e>0&&e<1e-4?`<0.01%`:`${(e*100).toFixed(e>=.1?1:2)}%`:`—`}function _(e){if(!Number.isFinite(e))return`—`;if(e<0)return`-${_(-e)}`;if(e===0)return`0 ms`;if(e<.01)return`<0.01 ms`;if(e<1)return`${m(e,2)} ms`;if(Math.round(e*10)/10<100)return`${m(e,1)} ms`;if(Math.round(e)<1e3)return`${Math.round(e)} ms`;let t=Math.round(e/100)/10;if(t<10)return`${m(e/1e3,2)} s`;if(t<60)return`${m(t,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 v(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`})}export{p as a,l as c,g as i,r as l,v as n,f as o,h as r,d as s,_ as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/index-C5SsAUtw.js b/internal/ui/dist/assets/index-C1Pd14SU.js similarity index 94% rename from internal/ui/dist/assets/index-C5SsAUtw.js rename to internal/ui/dist/assets/index-C1Pd14SU.js index 53b282a1f..dc32a4589 100644 --- a/internal/ui/dist/assets/index-C5SsAUtw.js +++ b/internal/ui/dist/assets/index-C1Pd14SU.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/new-dashboard-xnHgERfr.js","assets/useRouter-ByJ6_rwb.js","assets/brand-CCQ0JT0F.js","assets/search-DBgztReF.js","assets/noop-mXPS5vjY.js","assets/format-fsvZ_y78.js","assets/auth-K3NK-QpB.js","assets/useNavigate-B1zgPEUp.js","assets/useQuery-BLTYSIvG.js","assets/page-DI98kZbw.js","assets/toolbar-DV2TSB0G.js","assets/theme-B_iWg-Ot.js","assets/CopyButton-Btk7J2NS.js","assets/Table-Bid0E8qM.js","assets/live-data-meta-CbLSAtC3.js","assets/lib-8mi5olAL.js","assets/loading-skeleton-DEzWruJF.js","assets/NumberInput-B7uemOf3.js","assets/search-Bj_SOIkw.js","assets/save-dialog-EDUaI5f8.js","assets/discard-BmoNOAJh.js","assets/routes-D2AdaqvY.js","assets/alerts-Czm6Z0m8.js","assets/Textarea-BewZUT1f.js","assets/useMutation-rZS3GfBb.js","assets/explore-SPpRMYjX.js","assets/logs-BlzRGSJn.js","assets/search-page-Cs7GeQyA.js","assets/settings-D9KXz_MJ.js","assets/settings-CXC__vby.js","assets/traces-BoRV7xaS.js","assets/chat.index-CEunwapm.js","assets/chat-Bv0H8gs5.js","assets/preload-helper-DJZNfKNH.js","assets/dashboard-change-chips-DMsA4yET.js","assets/chat._threadId-CEunwapm.js","assets/dashboards.index-CRdyk0DX.js","assets/page-DZ5HGDWI.js","assets/dashboards._dashboardId-Bw6ECcx6.js","assets/settings_.ingest-BmeDHL8A.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{Bt as s,C as c,Cn as l,D as u,Dt as d,Et as f,Ft as p,G as m,Gt as h,Ht as g,It as _,Kt as v,Lt as y,Mt as b,Nt as x,Qt as ee,Rt as S,Sn as C,T as te,Tt as w,Ut as ne,Vt as re,W as ie,Wt as ae,X as oe,Xt as se,Yt as ce,Z as le,Zt as ue,_t as de,a as fe,at as pe,bn as T,bt as me,cn as he,ct as ge,dn as _e,dt as ve,ft as ye,gn as be,hn as xe,ht as Se,in as Ce,it as E,j as D,k as we,kt as Te,lt as Ee,mn as De,mt as Oe,nn as ke,nt as O,ot as Ae,pn as je,pt as Me,q as Ne,qt as Pe,rn as Fe,rt as Ie,s as Le,sn as Re,st as ze,t as Be,tt as Ve,u as He,ut as Ue,vt as We,w as Ge,wt as Ke,x as qe,xn as Je,xt as Ye,yn as Xe,zt as Ze}from"./brand-CCQ0JT0F.js";import{i as Qe,n as $e,t as et}from"./useNavigate-B1zgPEUp.js";import{a as tt,d as nt,g as rt,i as it,m as at,o as ot,t as st,u as ct}from"./preload-helper-DJZNfKNH.js";import{a as lt,i as ut,n as dt,r as ft,t as pt}from"./lazyRouteComponent-DfXsrbdH.js";import{_ as mt,a as ht,c as gt,d as _t,f as vt,g as yt,h as bt,m as xt,n as St,o as Ct,p as wt,r as Tt,s as Et,u as Dt}from"./theme-B_iWg-Ot.js";import{A as Ot,c as kt,i as At,k as jt,l as Mt,m as Nt,p as Pt,s as Ft,y as It}from"./search-DBgztReF.js";import{t as Lt}from"./noop-mXPS5vjY.js";import{c as Rt,i as zt,l as Bt,o as Vt,s as Ht,t as Ut}from"./format-fsvZ_y78.js";import{a as Wt,i as Gt,n as Kt,o as qt,r as Jt,t as Yt}from"./auth-K3NK-QpB.js";import{C as Xt,T as Zt,_ as Qt,a as $t,b as en,c as tn,d as nn,f as rn,g as an,h as on,i as sn,l as cn,m as ln,n as un,o as dn,p as fn,r as pn,s as mn,t as hn,u as gn,v as _n,w as vn,y as yn}from"./useQuery-BLTYSIvG.js";import{i as bn,r as xn}from"./search-Bj_SOIkw.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 Sn=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,ee||(ee=!0,re());else{var t=n(l);t!==null&&oe(x,t.startTime-e)}}}var ee=!1,S=-1,C=5,te=-1;function w(){return g?!0:!(e.unstable_now()-tet&&w());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&oe(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?re():ee=!1}}}var re;if(typeof y==`function`)re=function(){y(ne)};else if(typeof MessageChannel<`u`){var ie=new MessageChannel,ae=ie.port2;ie.port1.onmessage=ne,re=function(){ae.postMessage(null)}}else re=function(){_(ne,0)};function oe(t,n){S=_(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(S),S=-1):h=!0,oe(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,re()))),r},e.unstable_shouldYield=w,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Cn=e(((e,t)=>{t.exports=Sn()})),wn=e((e=>{var n=Cn(),r=t(),i=l();function a(e){var t=`https://react.dev/errors/`+e;if(1Ee||(e.current=Te[Ee],Te[Ee]=null,Ee--)}function ke(e,t){Ee++,Te[Ee]=e.current,e.current=t}var O=De(null),Ae=De(null),je=De(null),Me=De(null);function Ne(e,t){switch(ke(je,t),ke(Ae,e),ke(O,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Sp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Sp(t),e=Cp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}Oe(O),ke(O,e)}function Pe(){Oe(O),Oe(Ae),Oe(je)}function Fe(e){var t=e.memoizedState;t!==null&&(yh._currentValue=t.memoizedState,ke(Me,e)),t=O.current;var n=Cp(t,e.type);t!==n&&(ke(Ae,e),ke(O,n))}function Ie(e){Ae.current===e&&(Oe(O),Oe(Ae)),Me.current===e&&(Oe(Me),yh._currentValue=we)}var Le,Re;function ze(e){if(Le===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Le=t&&t[1]||``,Re=-1i.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{Bt as s,C as c,Cn as l,D as u,Dt as d,Et as f,Ft as p,G as m,Gt as h,Ht as g,It as _,Kt as v,Lt as y,Mt as b,Nt as x,Qt as ee,Rt as S,Sn as C,T as te,Tt as w,Ut as ne,Vt as re,W as ie,Wt as ae,X as oe,Xt as se,Yt as ce,Z as le,Zt as ue,_t as de,a as fe,at as pe,bn as T,bt as me,cn as he,ct as ge,dn as _e,dt as ve,ft as ye,gn as be,hn as xe,ht as Se,in as Ce,it as E,j as D,k as we,kt as Te,lt as Ee,mn as De,mt as Oe,nn as ke,nt as O,ot as Ae,pn as je,pt as Me,q as Ne,qt as Pe,rn as Fe,rt as Ie,s as Le,sn as Re,st as ze,t as Be,tt as Ve,u as He,ut as Ue,vt as We,w as Ge,wt as Ke,x as qe,xn as Je,xt as Ye,yn as Xe,zt as Ze}from"./brand-D6fP-cLS.js";import{i as Qe,n as $e,t as et}from"./useNavigate-B1zgPEUp.js";import{a as tt,d as nt,g as rt,i as it,m as at,o as ot,t as st,u as ct}from"./preload-helper-DJZNfKNH.js";import{a as lt,i as ut,n as dt,r as ft,t as pt}from"./lazyRouteComponent-DiWTNBZT.js";import{_ as mt,a as ht,c as gt,d as _t,f as vt,g as yt,h as bt,m as xt,n as St,o as Ct,p as wt,r as Tt,s as Et,u as Dt}from"./theme-DXTVNXHm.js";import{A as Ot,c as kt,i as At,k as jt,l as Mt,m as Nt,p as Pt,s as Ft,y as It}from"./search-D_K9J6yO.js";import{t as Lt}from"./noop-mXPS5vjY.js";import{c as Rt,i as zt,l as Bt,o as Vt,s as Ht,t as Ut}from"./format-BZjbsxwM.js";import{a as Wt,i as Gt,n as Kt,o as qt,r as Jt,t as Yt}from"./auth-DWqIkMZS.js";import{C as Xt,T as Zt,_ as Qt,a as $t,b as en,c as tn,d as nn,f as rn,g as an,h as on,i as sn,l as cn,m as ln,n as un,o as dn,p as fn,r as pn,s as mn,t as hn,u as gn,v as _n,w as vn,y as yn}from"./useQuery-BLTYSIvG.js";import{i as bn,r as xn}from"./search-CDra9nG2.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 Sn=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,ee||(ee=!0,re());else{var t=n(l);t!==null&&oe(x,t.startTime-e)}}}var ee=!1,S=-1,C=5,te=-1;function w(){return g?!0:!(e.unstable_now()-tet&&w());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&oe(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?re():ee=!1}}}var re;if(typeof y==`function`)re=function(){y(ne)};else if(typeof MessageChannel<`u`){var ie=new MessageChannel,ae=ie.port2;ie.port1.onmessage=ne,re=function(){ae.postMessage(null)}}else re=function(){_(ne,0)};function oe(t,n){S=_(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(S),S=-1):h=!0,oe(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,re()))),r},e.unstable_shouldYield=w,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Cn=e(((e,t)=>{t.exports=Sn()})),wn=e((e=>{var n=Cn(),r=t(),i=l();function a(e){var t=`https://react.dev/errors/`+e;if(1Ee||(e.current=Te[Ee],Te[Ee]=null,Ee--)}function ke(e,t){Ee++,Te[Ee]=e.current,e.current=t}var O=De(null),Ae=De(null),je=De(null),Me=De(null);function Ne(e,t){switch(ke(je,t),ke(Ae,e),ke(O,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Sp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Sp(t),e=Cp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}Oe(O),ke(O,e)}function Pe(){Oe(O),Oe(Ae),Oe(je)}function Fe(e){var t=e.memoizedState;t!==null&&(yh._currentValue=t.memoizedState,ke(Me,e)),t=O.current;var n=Cp(t,e.type);t!==n&&(ke(Ae,e),ke(O,n))}function Ie(e){Ae.current===e&&(Oe(O),Oe(Ae)),Me.current===e&&(Oe(Me),yh._currentValue=we)}var Le,Re;function ze(e){if(Le===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Le=t&&t[1]||``,Re=-1)`:-11&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function $p(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;$p(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var em=new Set([`type`,`properties`,`required`,`additionalProperties`]),tm=[`oneOf`,`anyOf`];function nm(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function rm(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!em.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??nm(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Js(n,r,e.length===1?e[0]:rm(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=nm(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function im(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of em)if(t in e)return;let n=t.filter(e=>tm.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=rm(t);else{let e=n[0],i=tm.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>rm([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,qp(e,r))}function am(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):qp(i,s),qp(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())$p(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])im(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}qp(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Js(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:cm(t,`input`,e.processors),output:cm(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function om(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return om(r.element,n);if(r.type===`set`)return om(r.valueType,n);if(r.type===`lazy`)return om(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return om(r.innerType,n);if(r.type===`intersection`)return om(r.left,n)||om(r.right,n);if(r.type===`record`||r.type===`map`)return om(r.keyType,n)||om(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:om(r.in,n)||om(r.out,n);if(r.type===`object`){for(let e in r.shape)if(om(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(om(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(om(e,n))return!0;return!!(r.rest&&om(r.rest,n))}return!1}var sm=(e,t={})=>n=>{let r=Jp({...n,processors:t});return Xp(e,r),Qp(r,e),am(r,e)},cm=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Jp({...i??{},target:a,io:t,processors:n});return Xp(e,o),Qp(o,e),am(o,e)},lm=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},um=(e,t,n)=>{(e[t]===void 0||n{lm(e,`minimum`,t),um(e,`maximum`,t)},fm=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},pm=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},mm=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},hm=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},gm=(e,t)=>lm(e,`minimum`,t.minimum),_m=(e,t)=>um(e,`maximum`,t.maximum),vm=e=>(t,n)=>{hm(t,n.format);let[r,i]=e[n.format];lm(t,`minimum`,r),um(t,`maximum`,i)},ym={greater_than:(e,t)=>lm(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>um(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>fm(e,t.value),number_format:vm(mc),bigint_format:vm(hc),min_length:gm,max_length:_m,length_equals:(e,t)=>dm(e,t.length),min_size:gm,max_size:_m,size_equals:(e,t)=>dm(e,t.size),string_format:(e,t)=>{hm(e,t.format),t.pattern&&pm(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>mm(e,t.mime)};function bm(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)ym[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&lm(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&lm(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&um(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&um(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&fm(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&mm(t,i.mime);for(let e of i.patterns??[])pm(t,e);return t}var xm={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Sm=new Map([[md,Xl],[gd,Zl]]),Cm=e=>Sm.get(e)??e,wm=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=bm(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=xm[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Cm);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Tm=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=bm(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Yp(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Em=(e,t,n,r)=>{n.type=`boolean`},Dm=(e,t,n,r)=>{Yp(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},Om=(e,t,n,r)=>{Yp(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},km=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Am=(e,t,n,r)=>{Yp(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},jm=(e,t,n,r)=>{Yp(e,t,n,r,`Void cannot be represented in JSON Schema`)},Mm=(e,t,n,r)=>{n.not={}},Nm=(e,t,n,r)=>{},Pm=(e,t,n,r)=>{},Fm=(e,t,n,r)=>{Yp(e,t,n,r,`Date cannot be represented in JSON Schema`)},Im=(e,t,n,r)=>{let i=e._zod.def,a=Rs(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Lm=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Yp(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Yp(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Rm=(e,t,n,r)=>{Yp(e,t,n,r,`NaN cannot be represented in JSON Schema`)},zm=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Bm=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=bm(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},Vm=(e,t,n,r)=>{n.type=`boolean`},Hm=(e,t,n,r)=>{Yp(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Um=(e,t,n,r)=>{Yp(e,t,n,r,`Function types cannot be represented in JSON Schema`)},Wm=(e,t,n,r)=>{Yp(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Gm=(e,t,n,r)=>{Yp(e,t,n,r,`Map cannot be represented in JSON Schema`)},Km=(e,t,n,r)=>{Yp(e,t,n,r,`Set cannot be represented in JSON Schema`)},qm=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=bm(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Xp(a.element,t,{...r,path:[...r.path,`items`]})};function Jm(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Jm(t.out):t.type===`catch`?Jm(t.innerType):e._zod.optin}var Ym=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Yp(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Js(i.properties,e,Xp(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Jm(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Xp(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Xm=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Xp(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Zm=(e,t,n,r)=>{let i=e._zod.def,a=Xp(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Xp(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Qm=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Xp(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Xp(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?Jm(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=bm(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function $m(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=$m(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>$m(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?cu:su).source),p):p}var eh=new WeakMap;function th(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of eh.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=$m(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var nh=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=bm(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Xp(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)Js(i.patternProperties,Cm(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Xp(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=eh.get(t);n||(n=[],eh.set(t,n),t.deferred.push(()=>th(t))),n.push(e)}i.additionalProperties=Xp(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Jm(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},rh=(e,t,n,r)=>{let i=e._zod.def,a=Xp(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},ih=(e,t,n,r)=>{let i=e._zod.def;Xp(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ah=Symbol();function oh(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Yp(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),ah):JSON.parse(o)}var sh=(e,t,n,r)=>{let i=e._zod.def;Xp(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=oh(i.defaultValue,e,t,n,r);o!==ah&&(n.default=o)},ch=(e,t,n,r)=>{let i=e._zod.def;Xp(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=oh(i.defaultValue,e,t,n,r);o!==ah&&(n._prefault=o)},lh=(e,t,n,r)=>{let i=e._zod.def;Xp(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Yp(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},uh=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Xp(o,t,r);let s=t.seen.get(e);s.ref=o},dh=(e,t,n,r)=>{let i=e._zod.def;Xp(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},fh=(e,t,n,r)=>{let i=e._zod.def;Xp(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ph=(e,t,n,r)=>{let i=e._zod.def;Xp(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},mh=(e,t,n,r)=>{let i=e._zod.innerType;Xp(i,t,r);let a=t.seen.get(e);a.ref=i},hh={string:wm,number:Tm,boolean:Em,bigint:Dm,symbol:Om,null:km,undefined:Am,void:jm,never:Mm,any:Nm,unknown:Pm,date:Fm,enum:Im,literal:Lm,nan:Rm,template_literal:zm,file:Bm,success:Vm,custom:Hm,function:Um,transform:Wm,map:Gm,set:Km,array:qm,object:Ym,union:Xm,intersection:Zm,tuple:Qm,record:nh,nullable:rh,nonoptional:ih,default:sh,prefault:ch,catch:lh,pipe:uh,readonly:dh,promise:fh,optional:ph,lazy:mh};function gh(e,t){if(`_idmap`in e){let n=e,r=Jp({...t,processors:hh}),i={};for(let e of n._idmap.entries()){let[t,n]=e;Xp(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Qp(r,n),Js(a,t,am(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Jp({...t,processors:hh});return Xp(e,n),Qp(n,e),am(n,e)}var _h=new WeakSet([Object.prototype,Error.prototype]);function vh(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var yh=R(`ZodError`,(e,t)=>{ul.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);_h.has(n)||(_h.add(n),vh(n,`format`,e=>t=>pl(e,t)),vh(n,`flatten`,e=>t=>fl(e,t)),vh(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Bs,2)}),vh(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Bs,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),bh=hl(yh),xh=gl(yh),Sh=_l(yh),Ch=yl(yh),wh=Tl(yh),Th=El(yh),Eh=Dl(yh),Dh=Ol(yh),Oh=kl(yh),kh=Al(yh),Ah=jl(yh),jh=Ml(yh);function Mh(){nl.localeError||rl(Ff())}function Nh(){nl.memoizer||rl({memoizer:Mf()})}var Ph=R(`ZodType`,(e,t)=>(Mh(),Pu.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(tc(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return dc(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(l_(e,t))},superRefine(e,t){return this.check(u_(e,t))},overwrite(e){return this.check(Ip(e))},optional(){return Vg(this)},exactOptional(){return Ug(this)},nullable(){return Gg(this)},nullish(){return Vg(Gg(this))},nonoptional(e){return Zg(this,e)},array(){return wg(this)},or(e){return Og([this,e])},and(e){return Mg(this,e)},transform(e){return t_(this,zg(e))},default(e){return qg(this,e)},prefault(e){return Yg(this,e)},catch(e){return $g(this,e)},pipe(e){return t_(this,e)},readonly(){return i_(this)},describe(e){let t=this.clone();return zf.add(t,{description:e}),t},meta(...e){if(e.length===0)return zf.get(this);let t=this.clone();return zf.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return zc(this,`~standard`,{...Lu(this),jsonSchema:{input:cm(this,`input`),output:cm(this,`output`)}})},set"~standard"(e){Rc(this,`~standard`,e)},parse:function e(t,n){return bh(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await xh(this,t,n,{callee:e})},safeParse(e,t){return Sh(this,e,t)},async safeParseAsync(e,t){return Ch(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Rc(this,`spa`,e)},validate(e,t){return Sl(this,e,t)},validateAsync(e,t){return wl(this,e,t)},encode:function e(t,n){return wh(this,t,n,{callee:e})},decode:function e(t,n){return Th(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Eh(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Dh(this,t,n,{callee:e})},safeEncode(e,t){return Oh(this,e,t)},safeDecode(e,t){return kh(this,e,t)},async safeEncodeAsync(e,t){return Ah(this,e,t)},async safeDecodeAsync(e,t){return jh(this,e,t)},toJSONSchema(e){return sm(this,{})(e)},get description(){return zf.get(this)?.description},get _def(){return this._zod.def}}),Fh=R(`_ZodString`,(e,t)=>{Ru.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wm(e,t,n,r)},Bc({format:e=>bm(e).format??null,minLength:e=>bm(e).minimum??null,maxLength:e=>bm(e).maximum??null},{regex(...e){return this.check(Ap(...e))},includes(...e){return this.check(Np(...e))},startsWith(...e){return this.check(Pp(...e))},endsWith(...e){return this.check(Fp(...e))},min(...e){return this.check(Op(...e))},max(...e){return this.check(Dp(...e))},length(...e){return this.check(kp(...e))},nonempty(...e){return this.check(Op(1,...e))},lowercase(e){return this.check(jp(e))},uppercase(e){return this.check(Mp(e))},trim(){return this.check(Rp())},normalize(...e){return this.check(Lp(...e))},toLowerCase(){return this.check(zp())},toUpperCase(){return this.check(Bp())},slugify(){return this.check(Vp())}})),Ih=R(`ZodString`,(e,t)=>{Ru.init(e,t),Fh.init(e,t)},{email(e){return this.check(Hf(Hh,e))},url(e){return this.check(Jf(Kh,e))},jwt(e){return this.check(cp(cg,e))},emoji(e){return this.check(Yf(Jh,e))},guid(e){return this.check(Uf(Wh,e))},uuid(e){return this.check(Wf(Gh,e))},uuidv4(e){return this.check(Gf(Gh,e))},uuidv6(e){return this.check(Kf(Gh,e))},uuidv7(e){return this.check(qf(Gh,e))},nanoid(e){return this.check(Xf(Yh,e))},cuid(e){return this.check(Zf(Xh,e))},cuid2(e){return this.check(Qf(Zh,e))},ulid(e){return this.check(V(Qh,e))},base64(e){return this.check(ap(ag,e))},base64url(e){return this.check(op(og,e))},xid(e){return this.check($f($h,e))},ksuid(e){return this.check(ep(eg,e))},ipv4(e){return this.check(tp(tg,e))},ipv6(e){return this.check(np(ng,e))},cidrv4(e){return this.check(rp(rg,e))},cidrv6(e){return this.check(ip(ig,e))},e164(e){return this.check(sp(sg,e))},datetime(e){return this.check(lp(Rh,e))},date(e){return this.check(up(zh,e))},time(e){return this.check(dp(Bh,e))},duration(e){return this.check(fp(Vh,e))}});function H(e){return Vf(Ih,e)}var Lh=R(`ZodStringFormat`,(e,t)=>{zu.init(e,t),Fh.init(e,t)}),Rh=R(`ZodISODateTime`,(e,t)=>{id.init(e,t),Lh.init(e,t)}),zh=R(`ZodISODate`,(e,t)=>{ad.init(e,t),Lh.init(e,t)}),Bh=R(`ZodISOTime`,(e,t)=>{od.init(e,t),Lh.init(e,t)}),Vh=R(`ZodISODuration`,(e,t)=>{sd.init(e,t),Lh.init(e,t)}),Hh=R(`ZodEmail`,(e,t)=>{Hu.init(e,t),Lh.init(e,t)});function Uh(e){return Hf(Hh,e)}var Wh=R(`ZodGUID`,(e,t)=>{Bu.init(e,t),Lh.init(e,t)}),Gh=R(`ZodUUID`,(e,t)=>{Vu.init(e,t),Lh.init(e,t)}),Kh=R(`ZodURL`,(e,t)=>{Xu.init(e,t),Lh.init(e,t)});function qh(e){return Jf(Kh,e)}var Jh=R(`ZodEmoji`,(e,t)=>{Zu.init(e,t),Lh.init(e,t)}),Yh=R(`ZodNanoID`,(e,t)=>{Qu.init(e,t),Lh.init(e,t)}),Xh=R(`ZodCUID`,(e,t)=>{$u.init(e,t),Lh.init(e,t)}),Zh=R(`ZodCUID2`,(e,t)=>{ed.init(e,t),Lh.init(e,t)}),Qh=R(`ZodULID`,(e,t)=>{td.init(e,t),Lh.init(e,t)}),$h=R(`ZodXID`,(e,t)=>{nd.init(e,t),Lh.init(e,t)}),eg=R(`ZodKSUID`,(e,t)=>{rd.init(e,t),Lh.init(e,t)}),tg=R(`ZodIPv4`,(e,t)=>{cd.init(e,t),Lh.init(e,t)}),ng=R(`ZodIPv6`,(e,t)=>{ld.init(e,t),Lh.init(e,t)}),rg=R(`ZodCIDRv4`,(e,t)=>{ud.init(e,t),Lh.init(e,t)}),ig=R(`ZodCIDRv6`,(e,t)=>{fd.init(e,t),Lh.init(e,t)}),ag=R(`ZodBase64`,(e,t)=>{hd.init(e,t),Lh.init(e,t)}),og=R(`ZodBase64URL`,(e,t)=>{vd.init(e,t),Lh.init(e,t)}),sg=R(`ZodE164`,(e,t)=>{yd.init(e,t),Lh.init(e,t)}),cg=R(`ZodJWT`,(e,t)=>{xd.init(e,t),Lh.init(e,t)}),lg=R(`ZodNumber`,(e,t)=>{Sd.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tm(e,t,n,r),e.isFinite=!0},Bc({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=bm(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=bm(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=bm(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>bm(e).format??null},{gt(e,t){return this.check(wp(e,t))},gte(e,t){return this.check(Tp(e,t))},min(e,t){return this.check(Tp(e,t))},lt(e,t){return this.check(Sp(e,t))},lte(e,t){return this.check(Cp(e,t))},max(e,t){return this.check(Cp(e,t))},int(e){return this.check(U(e))},safe(e){return this.check(U(e))},positive(e){return this.check(wp(0,e))},nonnegative(e){return this.check(Tp(0,e))},negative(e){return this.check(Sp(0,e))},nonpositive(e){return this.check(Cp(0,e))},multipleOf(e,t){return this.check(Ep(e,t))},step(e,t){return this.check(Ep(e,t))},finite(){return this}}));function ug(e){return pp(lg,e)}var dg=R(`ZodNumberFormat`,(e,t)=>{Cd.init(e,t),lg.init(e,t)});function U(e){return hp(dg,e)}var fg=R(`ZodBoolean`,(e,t)=>{wd.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Em(e,t,n,r)});function pg(e){return gp(fg,e)}var mg=R(`ZodUndefined`,(e,t)=>{Td.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Am(e,t,n,r)});function hg(e){return _p(mg,e)}var gg=R(`ZodNull`,(e,t)=>{Ed.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>km(e,t,n,r)});function _g(e){return vp(gg,e)}var vg=R(`ZodAny`,(e,t)=>{Dd.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function W(){return yp(vg)}var yg=R(`ZodUnknown`,(e,t)=>{Od.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function bg(){return bp(yg)}var xg=R(`ZodNever`,(e,t)=>{kd.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mm(e,t,n,r)});function Sg(e){return xp(xg,e)}var Cg=R(`ZodArray`,(e,t)=>{Nh(),Nd.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qm(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Op(e,t))},nonempty(e){return this.check(Op(1,e))},max(e,t){return this.check(Dp(e,t))},length(e,t){return this.check(kp(e,t))},unwrap(){return this.element}});function wg(e,t){return Hp(Cg,e,t)}var Tg=R(`ZodObject`,(e,t)=>{Nh(),zd.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ym(e,t,n,r),Kc(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Ig(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(tc(this._zod.def,{catchall:e}))},passthrough(){return this.clone(tc(this._zod.def,{catchall:bg()}))},loose(){return this.clone(tc(this._zod.def,{catchall:bg()}))},strict(){return this.clone(tc(this._zod.def,{catchall:Sg()}))},strip(){return this.clone(tc(this._zod.def,{catchall:void 0}))},extend(e){return yc(this,e)},safeExtend(e){return xc(this,e)},merge(e){return Sc(this,e)},pick(e){return gc(this,e)},omit(e){return vc(this,e)},partial(...e){return Cc(Bg,this,e[0])},exactPartial(...e){return Cc(Hg,this,e[0],`exactPartial`)},required(...e){return wc(Xg,this,e[0])}});function Eg(e,t){return new Tg({type:`object`,shape:e??{},...I(t)})}function G(e,t){return new Tg({type:`object`,shape:e,catchall:bg(),...I(t)})}var Dg=R(`ZodUnion`,(e,t)=>{Vd.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xm(e,t,n,r),e.options=t.options});function Og(e,t){return new Dg({type:`union`,options:e,...I(t)})}var kg=R(`ZodDiscriminatedUnion`,(e,t)=>{Dg.init(e,t),Ud.init(e,t)});function Ag(e,t,n){return new kg({type:`union`,options:t,discriminator:e,...I(n)})}var jg=R(`ZodIntersection`,(e,t)=>{Wd.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zm(e,t,n,r)});function Mg(e,t){return new jg({type:`intersection`,left:e,right:t})}var Ng=R(`ZodRecord`,(e,t)=>{Nh(),qd.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nh(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Pg(e,t,n){return!t||!t._zod?new Ng({type:`record`,keyType:H(),valueType:e,...I(t)}):new Ng({type:`record`,keyType:e,valueType:t,...I(n)})}var Fg=R(`ZodEnum`,(e,t)=>{Jd.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Im(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 Fg({...t,checks:[],...I(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 Fg({...t,checks:[],...I(r),entries:i})}});function Ig(e,t){return new Fg({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...I(t)})}var Lg=R(`ZodLiteral`,(e,t)=>{Yd.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lm(e,t,n,r),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]}})});function K(e,t){return new Lg({type:`literal`,values:Array.isArray(e)?e:[e],...I(t)})}var Rg=R(`ZodTransform`,(e,t)=>{Nh(),Xd.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wm(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new tl(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ic(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Ic(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function zg(e){return new Rg({type:`transform`,transform:e})}var Bg=R(`ZodOptional`,(e,t)=>{Qd.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ph(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vg(e){return new Bg({type:`optional`,innerType:e})}var Hg=R(`ZodExactOptional`,(e,t)=>{$d.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ph(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ug(e){return new Hg({type:`optional`,innerType:e})}var Wg=R(`ZodNullable`,(e,t)=>{ef.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rh(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gg(e){return new Wg({type:`nullable`,innerType:e})}var Kg=R(`ZodDefault`,(e,t)=>{tf.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sh(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function qg(e,t){return new Kg({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():cc(t)}})}var Jg=R(`ZodPrefault`,(e,t)=>{rf.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ch(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Yg(e,t){return new Jg({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():cc(t)}})}var Xg=R(`ZodNonOptional`,(e,t)=>{af.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ih(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Zg(e,t){return new Xg({type:`nonoptional`,innerType:e,...I(t)})}var Qg=R(`ZodCatch`,(e,t)=>{cf.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lh(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function $g(e,t){return new Qg({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Jc(t)})}var e_=R(`ZodPipe`,(e,t)=>{lf.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uh(e,t,n,r),e.in=t.in,e.out=t.out});function t_(e,t){return new e_({type:`pipe`,in:e,out:t})}var n_=R(`ZodPreprocess`,(e,t)=>{e_.init(e,t),df.init(e,t)}),r_=R(`ZodReadonly`,(e,t)=>{ff.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dh(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function i_(e){return new r_({type:`readonly`,innerType:e})}var a_=R(`ZodLazy`,(e,t)=>{mf.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mh(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function o_(e){return new a_({type:`lazy`,getter:e})}var s_=R(`ZodCustom`,(e,t)=>{hf.init(e,t),Ph.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hm(e,t,n,r)});function c_(e,t){return Up(s_,e??(()=>!0),t)}function l_(e,t={}){return Wp(s_,e,t)}function u_(e,t){return Gp(e,t)}function d_(e,t){return new n_({type:`pipe`,in:zg(e),out:t})}var f_=Ig(j),q=c_(e=>typeof e==`object`&&!!e&&!Array.isArray(e)),J=H(),p_=Ig([`developer`,`system`,`assistant`,`user`]),m_=G({type:K(j.TEXT_MESSAGE_START),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),messageId:H(),role:p_.optional(),name:H().optional()}),h_=G({type:K(j.TEXT_MESSAGE_CONTENT),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),messageId:H(),delta:H()}),g_=G({type:K(j.TEXT_MESSAGE_END),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),messageId:H()}),__=G({type:K(j.TEXT_MESSAGE_CHUNK),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),messageId:H().optional(),role:p_.optional(),delta:H().optional(),name:H().optional()}),v_=G({type:K(j.TOOL_CALL_START),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),toolCallId:H(),toolCallName:H(),parentMessageId:H().optional()}),y_=G({type:K(j.TOOL_CALL_ARGS),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),toolCallId:H(),delta:H()}),b_=G({type:K(j.TOOL_CALL_END),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),toolCallId:H()}),x_=G({type:K(j.TOOL_CALL_CHUNK),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),toolCallId:H().optional(),toolCallName:H().optional(),parentMessageId:H().optional(),delta:H().optional()}),S_=G({type:K(`text`),id:H().optional(),text:H(),metadata:W().refine(e=>e!==null).optional()}),C_=Ag(`type`,[G({type:K(`data`),value:H(),mimeType:H()}),G({type:K(`url`),value:H(),mimeType:H().optional()}),G({type:K(`file`),value:H(),provider:H().optional(),mimeType:H().optional()})]),w_=Ag(`type`,[S_,G({type:K(`image`),id:H().optional(),source:C_,metadata:W().refine(e=>e!==null).optional()}),G({type:K(`audio`),id:H().optional(),source:C_,metadata:W().refine(e=>e!==null).optional()}),G({type:K(`video`),id:H().optional(),source:C_,metadata:W().refine(e=>e!==null).optional()}),G({type:K(`document`),id:H().optional(),source:C_,metadata:W().refine(e=>e!==null).optional()})]),T_=G({type:K(j.TOOL_CALL_RESULT),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),messageId:H(),toolCallId:H(),content:Og([H(),wg(w_)]),role:K(`tool`).optional()}),E_=W(),D_=G({type:K(j.STATE_SNAPSHOT),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),snapshot:E_.refine(e=>e!==void 0)}),O_=H().regex(RegExp(`^(/([^/~]|~[01])*)*$`)),k_=wg(Ag(`op`,[G({op:K(`add`),path:O_,value:W().refine(e=>e!==void 0)}).meta({specOpen:!0}),G({op:K(`remove`),path:O_}).meta({specOpen:!0}),G({op:K(`replace`),path:O_,value:W().refine(e=>e!==void 0)}).meta({specOpen:!0}),G({op:K(`move`),from:O_,path:O_}).meta({specOpen:!0}),G({op:K(`copy`),from:O_,path:O_}).meta({specOpen:!0}),G({op:K(`test`),path:O_,value:W().refine(e=>e!==void 0)}).meta({specOpen:!0})])),A_=G({type:K(j.STATE_DELTA),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),delta:k_}),j_=G({subagentRunId:J.optional(),id:H(),role:K(`developer`),name:H().optional(),encryptedValue:H().optional(),metadata:q.optional(),content:H()}),M_=G({subagentRunId:J.optional(),id:H(),role:K(`system`),name:H().optional(),encryptedValue:H().optional(),metadata:q.optional(),content:H()}),N_=G({name:H(),arguments:H()}),P_=G({id:H(),type:K(`function`),function:N_,encryptedValue:H().optional(),metadata:q.optional()}),F_=Ag(`role`,[j_,M_,G({subagentRunId:J.optional(),id:H(),role:K(`assistant`),name:H().optional(),encryptedValue:H().optional(),metadata:q.optional(),content:H().optional(),toolCalls:wg(P_).optional()}),G({subagentRunId:J.optional(),id:H(),role:K(`user`),name:H().optional(),encryptedValue:H().optional(),metadata:q.optional(),content:Og([H(),wg(w_)])}),G({subagentRunId:J.optional(),id:H(),role:K(`tool`),content:Og([H(),wg(w_)]),toolCallId:H(),error:H().optional(),encryptedValue:H().optional(),metadata:q.optional()}),G({subagentRunId:J.optional(),id:H(),role:K(`activity`),activityType:H(),content:c_(e=>typeof e==`object`&&!!e&&!Array.isArray(e)),metadata:q.optional()}),G({subagentRunId:J.optional(),id:H(),role:K(`reasoning`),content:H(),encryptedValue:H().optional(),metadata:q.optional()})]),I_=G({type:K(j.MESSAGES_SNAPSHOT),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),messages:wg(F_)}),L_=G({type:K(j.ACTIVITY_SNAPSHOT),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),messageId:H(),activityType:H(),content:c_(e=>typeof e==`object`&&!!e&&!Array.isArray(e)),replace:pg().optional()}),R_=G({type:K(j.ACTIVITY_DELTA),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),messageId:H(),activityType:H(),patch:k_}),z_=G({type:K(j.RAW),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),event:W().refine(e=>e!==void 0),source:H().optional()}),B_=G({type:K(j.CUSTOM),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),name:H(),value:W().refine(e=>e!==void 0)}),V_=G({name:H(),description:H(),parameters:W().refine(e=>e!==null).optional(),metadata:q.optional()}),H_=G({description:H(),value:H()}),U_=G({interruptId:H(),status:Ig([`resolved`,`cancelled`]),payload:W().refine(e=>e!==null).optional(),metadata:q.optional()}),W_=G({threadId:H(),runId:H(),protocolVersion:H().optional(),parentRunId:H().optional(),state:E_.refine(e=>e!==null).nullable().transform(e=>e??void 0).optional(),messages:wg(F_),tools:wg(V_).default(()=>[]),context:wg(H_).default(()=>[]),forwardedProps:W().refine(e=>e!==null).optional(),resume:wg(U_).optional()}),G_=G({type:K(j.RUN_STARTED),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),threadId:H(),runId:H(),protocolVersion:H().optional(),parentRunId:H().optional(),input:W_.optional()}),K_=G({type:K(`success`),pendingToolCallIds:wg(H()).optional()}),q_=G({subagentRunId:J.optional(),id:H(),reason:H(),message:H().optional(),toolCallId:H().optional(),responseSchema:c_(e=>typeof e==`object`&&!!e&&!Array.isArray(e)).optional(),expiresAt:H().optional(),metadata:q.optional()}),J_=Ag(`type`,[K_,G({type:K(`interrupt`),interrupts:wg(q_).min(1)}),G({type:K(`cancelled`)})]),Y_=G({provider:H().optional(),model:H().optional(),inputTokens:U().min(0).max(9007199254740991).optional(),outputTokens:U().min(0).max(9007199254740991).optional(),totalTokens:U().min(0).max(9007199254740991).optional(),reasoningTokens:U().min(0).max(9007199254740991).optional(),cachedInputTokens:U().min(0).max(9007199254740991).optional(),cacheWriteInputTokens:U().min(0).max(9007199254740991).optional()}),X_=G({type:K(j.RUN_FINISHED),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),threadId:H(),runId:H(),result:W().refine(e=>e!==null).optional(),outcome:J_.optional(),usage:wg(Y_).optional()}),Z_=G({type:K(j.RUN_ERROR),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),message:H(),code:H().optional(),usage:wg(Y_).optional()}),Q_=G({type:K(j.STEP_STARTED),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),stepName:H()}),$_=G({type:K(j.STEP_FINISHED),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),stepName:H()}),ev=G({type:K(j.REASONING_START),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),messageId:H()}),tv=G({type:K(j.REASONING_MESSAGE_START),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),messageId:H(),role:K(`reasoning`)}),nv=G({type:K(j.REASONING_MESSAGE_CONTENT),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),messageId:H(),delta:H()}),rv=G({type:K(j.REASONING_MESSAGE_END),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),messageId:H()}),iv=G({type:K(j.REASONING_MESSAGE_CHUNK),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),messageId:H().optional(),delta:H().optional()}),av=G({type:K(j.REASONING_END),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),messageId:H()}),ov=Ig([`tool-call`,`message`]),sv=G({type:K(j.REASONING_ENCRYPTED_VALUE),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J.optional(),subtype:ov,entityId:H(),encryptedValue:H()}),cv=G({type:K(j.SUBAGENT_STARTED),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J,name:H(),description:H().optional(),parentSubagentRunId:J.optional(),parentToolCallId:H().optional(),parentMessageId:H().optional()}),lv=Ag(`type`,[G({type:K(`success`)}),G({type:K(`suspended`),interruptIds:wg(H()).optional()})]),uv=Ag(`type`,[m_,h_,g_,__,v_,y_,b_,x_,T_,D_,A_,I_,L_,R_,z_,B_,G_,X_,Z_,Q_,$_,ev,tv,nv,rv,iv,av,sv,cv,G({type:K(j.SUBAGENT_FINISHED),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J,result:W().refine(e=>e!==null).optional(),outcome:lv.optional()}),G({type:K(j.SUBAGENT_ERROR),timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional(),subagentRunId:J,message:H(),code:H().optional()})]);Ig([`developer`,`system`,`assistant`,`user`,`tool`,`activity`,`reasoning`]);var dv=G({name:H(),description:H().optional()}),fv=G({name:H().optional(),type:H().optional(),description:H().optional(),version:H().optional(),provider:H().optional(),documentationUrl:H().optional(),metadata:q.optional()}),pv=G({streaming:pg().optional(),websocket:pg().optional(),httpBinary:pg().optional(),pushNotifications:pg().optional(),resumable:pg().optional()}),mv=G({supported:pg().optional(),items:wg(V_).optional(),parallelCalls:pg().optional(),clientProvided:pg().optional()}),hv=G({structuredOutput:pg().optional(),supportedMimeTypes:wg(H()).optional()}),gv=G({snapshots:pg().optional(),deltas:pg().optional(),memory:pg().optional(),persistentState:pg().optional()}),_v=G({supported:pg().optional(),delegation:pg().optional(),handoffs:pg().optional(),subagents:wg(dv).optional()}),vv=G({supported:pg().optional(),streaming:pg().optional(),encrypted:pg().optional()}),yv=G({image:pg().optional(),audio:pg().optional(),video:pg().optional(),pdf:pg().optional(),file:pg().optional()}),bv=G({image:pg().optional(),audio:pg().optional()}),xv=G({input:yv.optional(),output:bv.optional()}),Sv=G({codeExecution:pg().optional(),sandboxed:pg().optional(),maxIterations:U().min(0).max(9007199254740991).optional(),maxExecutionTime:U().min(0).max(9007199254740991).optional()}),Cv=G({supported:pg().optional(),approvals:pg().optional(),interventions:pg().optional(),feedback:pg().optional(),interrupts:pg().optional(),approveWithEdits:pg().optional()});G({identity:fv.optional(),transport:pv.optional(),tools:mv.optional(),output:hv.optional(),state:gv.optional(),multiAgent:_v.optional(),reasoning:vv.optional(),multimodal:xv.optional(),execution:Sv.optional(),humanInTheLoop:Cv.optional(),custom:c_(e=>typeof e==`object`&&!!e&&!Array.isArray(e)).optional()}),G({subagentRunId:J.optional()}),G({type:f_,timestamp:U().min(-9007199254740991).max(9007199254740991).optional(),rawEvent:W().refine(e=>e!==null).optional(),metadata:q.optional()}),G({subagentRunId:J.optional(),id:H(),role:H(),name:H().optional(),encryptedValue:H().optional(),metadata:q.optional()}),q.optional();function wv(){let e=this.buf,t=this.pos,n=0,r=0;for(let i=0;i<28;i+=7){let a=e[t++];if(n|=(a&127)<>4,!(i&128)){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}for(let i=3;i<=31;i+=7){let a=e[t++];if(r|=(a&127)<=Tv&&(i+=r/Tv|0,r%=Tv)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?jv(r,i):Av(r,i)}function Dv(e,t){let n=Av(e,t),r=n.hi&2147483648;r&&(n=jv(n.lo,n.hi));let i=Ov(n.lo,n.hi);return r?`-`+i:i}function Ov(e,t){if({lo:e,hi:t}=kv(e,t),t<=2097151)return String(Tv*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,i=t>>16&65535,a=n+r*6777216+i*6710656,o=r+i*8147497,s=i*2,c=1e7;return a>=c&&(o+=Math.floor(a/c),a%=c),o>=c&&(s+=Math.floor(o/c),o%=c),s.toString()+Mv(o)+Mv(a)}function kv(e,t){return{lo:e>>>0,hi:t>>>0}}function Av(e,t){return{lo:e|0,hi:t|0}}function jv(e,t){return t=~t,e?e=~e+1:t+=1,Av(e,t)}var Mv=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function Nv(){let e=this.buf[this.pos++];if(!(e&128))return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}var Pv=Fv();function Fv(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt==`function`&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`&&(globalThis.Deno||globalThis.Bun||typeof process!=`object`||{}.BUF_BIGINT_DISABLE!==`1`)){let t=BigInt(`-9223372036854775808`),n=BigInt(`9223372036854775807`),r=BigInt(`0`),i=BigInt(`18446744073709551615`);return{zero:BigInt(0),supported:!0,parse(e){let r=typeof e==`bigint`?e:BigInt(e);if(r>n||ri||ta.call(e)),zv(i)}return Rv}function Vv(e){return(t,n)=>{let r=e(t);return n.set(r),{written:r.byteLength}}}var Hv;(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(Hv||={});var Y=class{constructor(e){this.stackPos=[],this.encodeUtf8Into=e?Vv(e):Bv().encodeUtf8Into,this.buffer=Gv,this.viewCache=Kv,this.pos=0}ensureCapacity(e){let t=this.pos+e;if(t>this.buffer.length){let e=this.buffer.length||Uv;for(;e0&&n.set(this.buffer),this.buffer=n}}view(){let e=this.buffer,t=this.viewCache;if(t.byteLength===e.byteLength)return t;let n=new DataView(e.buffer);return this.viewCache=n,n}finish(){let e=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],e}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(Wv),this.buffer[this.pos++]=0,this}join(){let e=this.stackPos.pop();if(e===void 0)throw Error(`invalid state, fork stack empty`);let t=this.pos-e-Wv,n=Jv(t);return n>Wv&&(this.ensureCapacity(n-Wv),this.buffer.copyWithin(e+n,e+Wv,this.pos)),this.pos=e,this.uint32(t),this.pos+=t,this}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.ensureCapacity(e.length),this.buffer.set(e,this.pos),this.pos+=e.length,this}uint32(e){if(Xv(e),this.ensureCapacity(5),e<128)return this.buffer[this.pos++]=e,this;for(;e>127;)this.buffer[this.pos++]=e&127|128,e>>>=7;return this.buffer[this.pos++]=e,this}int32(e){if(Yv(e),e>=0)return this.uint32(e);this.ensureCapacity(10);for(let t=0;t<9;t++)this.buffer[this.pos++]=e&127|128,e>>=7;return this.buffer[this.pos++]=1,this}bool(e){return this.ensureCapacity(1),this.buffer[this.pos++]=+!!e,this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){typeof e!=`string`&&(e=String(e));let t=e.length;if(t<=qv){this.ensureCapacity(t+1);let n=this.buffer,r=this.pos;n[r++]=t;let i=0;for(;i127)break;n[r++]=t}if(i==t)return this.pos=r,this}this.ensureCapacity(t*3+5);let n=Jv(t),r=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(e,r.subarray(i+n)),o=Jv(a);return o!=n&&r.copyWithin(i+o,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(e){return Zv(e),this.ensureCapacity(4),this.view().setFloat32(this.pos,e,!0),this.pos+=4,this}double(e){return this.ensureCapacity(8),this.view().setFloat64(this.pos,e,!0),this.pos+=8,this}fixed32(e){return Xv(e),this.ensureCapacity(4),this.view().setUint32(this.pos,e,!0),this.pos+=4,this}sfixed32(e){return Yv(e),this.ensureCapacity(4),this.view().setInt32(this.pos,e,!0),this.pos+=4,this}sint32(e){return Yv(e),this.uint32((e<<1^e>>31)>>>0)}sfixed64(e){let t=Pv.enc(e);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,t.lo,!0),n.setInt32(this.pos+4,t.hi,!0),this.pos+=8,this}fixed64(e){let t=Pv.uEnc(e);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,t.lo,!0),n.setInt32(this.pos+4,t.hi,!0),this.pos+=8,this}int64(e){let t=Pv.enc(e);return this.writeVarint64(t.lo,t.hi)}sint64(e){let t=Pv.enc(e),n=t.hi>>31,r=t.lo<<1^n,i=(t.hi<<1|t.lo>>>31)^n;return this.writeVarint64(r,i)}uint64(e){let t=Pv.uEnc(e);return this.writeVarint64(t.lo,t.hi)}writeVarint64(e,t){this.ensureCapacity(10);let n=this.buffer,r=this.pos;for(let i=0;i<28;i+=7){let a=e>>>i,o=!(!(a>>>7)&&t==0);if(n[r++]=(o?a|128:a)&255,!o)return this.pos=r,this}let i=e>>>28&15|(t&7)<<4,a=!!(t>>3);if(n[r++]=(a?i|128:i)&255,!a)return this.pos=r,this;for(let e=3;e<31;e+=7){let i=t>>>e,a=!!(i>>>7);if(n[r++]=(a?i|128:i)&255,!a)return this.pos=r,this}return n[r++]=t>>>31&1,this.pos=r,this}},Uv=128,Wv=1,Gv=new Uint8Array,Kv=new DataView(Gv.buffer),qv=32;function Jv(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var X=class{constructor(e,t=Bv().decodeUtf8){this.decodeUtf8=t,this.varint64Lo=0,this.varint64Hi=0,this.varint64=wv,this.uint32=Nv,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.pos,t=this.uint32(),n=this.pos-e;if(n>5||n==5&&this.buf[this.pos-1]>15)throw Error(`illegal tag: varint overflows uint32`);let r=t>>>3,i=t&7;if(r<=0||i>5)throw Error(`illegal tag: field no `+r+` wire type `+i);return[r,i]}skip(e,t,n=100){let r=this.pos;switch(e){case Hv.Varint:for(;this.buf[this.pos++]&128;);break;case Hv.Bit64:this.pos+=4;case Hv.Bit32:this.pos+=4;break;case Hv.LengthDelimited:let r=this.uint32();this.pos+=r;break;case Hv.StartGroup:if(n<=0)throw Error(`maximum recursion depth reached`);for(;;){let[e,r]=this.tag();if(r===Hv.EndGroup){if(t!==void 0&&e!==t)throw Error(`invalid end group tag`);break}this.skip(r,e,n-1)}break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return this.varint64(),Pv.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Pv.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let e=this.varint64Lo,t=this.varint64Hi,n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,Pv.dec(e,t)}bool(){let e=this.buf[this.pos];return e<128?(this.pos++,e!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Pv.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Pv.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(e){let t=this.bytes(),n=t.length;if(n<=qv){let r=Array(n);for(let i=0;i127)return this.decodeUtf8(t,e);r[i]=n}return String.fromCharCode.apply(String,r)}return this.decodeUtf8(t,e)}};function Yv(e){if(typeof e==`string`)e=Number(e);else if(typeof e!=`number`)throw Error(`invalid int32: `+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw Error(`invalid int32: `+e)}function Xv(e){if(typeof e==`string`)e=Number(e);else if(typeof e!=`number`)throw Error(`invalid uint32: `+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw Error(`invalid uint32: `+e)}function Zv(e){if(typeof e==`string`){let t=e;if(e=Number(e),Number.isNaN(e)&&t!==`NaN`)throw Error(`invalid float32: `+t)}else if(typeof e!=`number`)throw Error(`invalid float32: `+typeof e);if(!Number.isFinite(Math.fround(e))&&Number.isFinite(e))throw Error(`invalid float32: `+e)}var Qv=function(e){return e[e.NULL_VALUE=0]=`NULL_VALUE`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function $v(){return{fields:{}}}var ey={encode(e,t=new Y){return Object.entries(e.fields).forEach(([e,n])=>{n!==void 0&&ny.encode({key:e,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=$v();for(;n.pos>>3){case 1:{if(e!==10)break;let t=ny.decode(n,n.uint32());t.value!==void 0&&(i.fields[t.key]=t.value);continue}}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return ey.fromPartial(e??{})},fromPartial(e){let t=$v();return t.fields=Object.entries(e.fields??{}).reduce((e,[t,n])=>(n!==void 0&&(e[t]=n),e),{}),t},wrap(e){let t=$v();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};function ty(){return{key:``,value:void 0}}var ny={encode(e,t=new Y){return e.key!==``&&t.uint32(10).string(e.key),e.value!==void 0&&Z.encode(Z.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=ty();for(;n.pos>>3){case 1:if(e!==10)break;i.key=n.string();continue;case 2:if(e!==18)break;i.value=Z.unwrap(Z.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return ny.fromPartial(e??{})},fromPartial(e){let t=ty();return t.key=e.key??``,t.value=e.value??void 0,t}};function ry(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var Z={encode(e,t=new Y){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&ey.encode(ey.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&ay.encode(ay.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=ry();for(;n.pos>>3){case 1:if(e!==8)break;i.nullValue=n.int32();continue;case 2:if(e!==17)break;i.numberValue=n.double();continue;case 3:if(e!==26)break;i.stringValue=n.string();continue;case 4:if(e!==32)break;i.boolValue=n.bool();continue;case 5:if(e!==42)break;i.structValue=ey.unwrap(ey.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.listValue=ay.unwrap(ay.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Z.fromPartial(e??{})},fromPartial(e){let t=ry();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=ry();if(e===null)t.nullValue=Qv.NULL_VALUE;else if(typeof e==`boolean`)t.boolValue=e;else if(typeof e==`number`)t.numberValue=e;else if(typeof e==`string`)t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if(typeof e==`object`)t.structValue=e;else if(e!==void 0)throw new globalThis.Error(`Unsupported any value type: `+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function iy(){return{values:[]}}var ay={encode(e,t=new Y){for(let n of e.values)Z.encode(Z.wrap(n),t.uint32(10).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=iy();for(;n.pos>>3){case 1:if(e!==10)break;i.values.push(Z.unwrap(Z.decode(n,n.uint32())));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return ay.fromPartial(e??{})},fromPartial(e){let t=iy();return t.values=e.values?.map(e=>e)||[],t},wrap(e){let t=iy();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty(`values`)&&globalThis.Array.isArray(e.values)?e.values:e}},oy=function(e){return e[e.ADD=0]=`ADD`,e[e.REMOVE=1]=`REMOVE`,e[e.REPLACE=2]=`REPLACE`,e[e.MOVE=3]=`MOVE`,e[e.COPY=4]=`COPY`,e[e.TEST=5]=`TEST`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function sy(){return{op:0,path:``,from:void 0,value:void 0}}var cy={encode(e,t=new Y){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==``&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&Z.encode(Z.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=sy();for(;n.pos>>3){case 1:if(e!==8)break;i.op=n.int32();continue;case 2:if(e!==18)break;i.path=n.string();continue;case 3:if(e!==26)break;i.from=n.string();continue;case 4:if(e!==34)break;i.value=Z.unwrap(Z.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return cy.fromPartial(e??{})},fromPartial(e){let t=sy();return t.op=e.op??0,t.path=e.path??``,t.from=e.from??void 0,t.value=e.value??void 0,t}};function ly(){return{text:``,id:void 0,metadata:void 0}}var uy={encode(e,t=new Y){return e.text!==``&&t.uint32(10).string(e.text),e.id!==void 0&&t.uint32(18).string(e.id),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(26).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=ly();for(;n.pos>>3){case 1:if(e!==10)break;i.text=n.string();continue;case 2:if(e!==18)break;i.id=n.string();continue;case 3:if(e!==26)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return uy.fromPartial(e??{})},fromPartial(e){let t=ly();return t.text=e.text??``,t.id=e.id??void 0,t.metadata=e.metadata??void 0,t}};function dy(){return{source:void 0,metadata:void 0,id:void 0}}var fy={encode(e,t=new Y){return e.source!==void 0&&by.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(18).fork()).join(),e.id!==void 0&&t.uint32(26).string(e.id),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=dy();for(;n.pos>>3){case 1:if(e!==10)break;i.source=by.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.id=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return fy.fromPartial(e??{})},fromPartial(e){let t=dy();return t.source=e.source!==void 0&&e.source!==null?by.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t.id=e.id??void 0,t}};function py(){return{value:``,mimeType:``}}var my={encode(e,t=new Y){return e.value!==``&&t.uint32(10).string(e.value),e.mimeType!==``&&t.uint32(18).string(e.mimeType),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=py();for(;n.pos>>3){case 1:if(e!==10)break;i.value=n.string();continue;case 2:if(e!==18)break;i.mimeType=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return my.fromPartial(e??{})},fromPartial(e){let t=py();return t.value=e.value??``,t.mimeType=e.mimeType??``,t}};function hy(){return{value:``,mimeType:void 0}}var gy={encode(e,t=new Y){return e.value!==``&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=hy();for(;n.pos>>3){case 1:if(e!==10)break;i.value=n.string();continue;case 2:if(e!==18)break;i.mimeType=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return gy.fromPartial(e??{})},fromPartial(e){let t=hy();return t.value=e.value??``,t.mimeType=e.mimeType??void 0,t}};function _y(){return{value:``,provider:void 0,mimeType:void 0}}var vy={encode(e,t=new Y){return e.value!==``&&t.uint32(10).string(e.value),e.provider!==void 0&&t.uint32(18).string(e.provider),e.mimeType!==void 0&&t.uint32(26).string(e.mimeType),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=_y();for(;n.pos>>3){case 1:if(e!==10)break;i.value=n.string();continue;case 2:if(e!==18)break;i.provider=n.string();continue;case 3:if(e!==26)break;i.mimeType=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return vy.fromPartial(e??{})},fromPartial(e){let t=_y();return t.value=e.value??``,t.provider=e.provider??void 0,t.mimeType=e.mimeType??void 0,t}};function yy(){return{data:void 0,url:void 0,file:void 0}}var by={encode(e,t=new Y){return e.data!==void 0&&my.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&gy.encode(e.url,t.uint32(18).fork()).join(),e.file!==void 0&&vy.encode(e.file,t.uint32(26).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=yy();for(;n.pos>>3){case 1:if(e!==10)break;i.data=my.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.url=gy.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.file=vy.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return by.fromPartial(e??{})},fromPartial(e){let t=yy();return t.data=e.data!==void 0&&e.data!==null?my.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?gy.fromPartial(e.url):void 0,t.file=e.file!==void 0&&e.file!==null?vy.fromPartial(e.file):void 0,t}};function xy(){return{source:void 0,metadata:void 0,id:void 0}}var Sy={encode(e,t=new Y){return e.source!==void 0&&by.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(18).fork()).join(),e.id!==void 0&&t.uint32(26).string(e.id),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=xy();for(;n.pos>>3){case 1:if(e!==10)break;i.source=by.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.id=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Sy.fromPartial(e??{})},fromPartial(e){let t=xy();return t.source=e.source!==void 0&&e.source!==null?by.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t.id=e.id??void 0,t}};function Cy(){return{source:void 0,metadata:void 0,id:void 0}}var wy={encode(e,t=new Y){return e.source!==void 0&&by.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(18).fork()).join(),e.id!==void 0&&t.uint32(26).string(e.id),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Cy();for(;n.pos>>3){case 1:if(e!==10)break;i.source=by.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.id=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return wy.fromPartial(e??{})},fromPartial(e){let t=Cy();return t.source=e.source!==void 0&&e.source!==null?by.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t.id=e.id??void 0,t}};function Ty(){return{source:void 0,metadata:void 0,id:void 0}}var Ey={encode(e,t=new Y){return e.source!==void 0&&by.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(18).fork()).join(),e.id!==void 0&&t.uint32(26).string(e.id),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Ty();for(;n.pos>>3){case 1:if(e!==10)break;i.source=by.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.id=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ey.fromPartial(e??{})},fromPartial(e){let t=Ty();return t.source=e.source!==void 0&&e.source!==null?by.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t.id=e.id??void 0,t}};function Dy(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var Oy={encode(e,t=new Y){return e.text!==void 0&&uy.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&fy.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Sy.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&wy.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Ey.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Dy();for(;n.pos>>3){case 1:if(e!==10)break;i.text=uy.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.image=fy.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.audio=Sy.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.video=wy.decode(n,n.uint32());continue;case 5:if(e!==42)break;i.document=Ey.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Oy.fromPartial(e??{})},fromPartial(e){let t=Dy();return t.text=e.text!==void 0&&e.text!==null?uy.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?fy.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Sy.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?wy.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Ey.fromPartial(e.document):void 0,t}};function ky(){return{id:``,type:``,function:void 0,metadata:void 0,encryptedValue:void 0}}var Ay={encode(e,t=new Y){return e.id!==``&&t.uint32(10).string(e.id),e.type!==``&&t.uint32(18).string(e.type),e.function!==void 0&&My.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&ey.encode(ey.wrap(e.metadata),t.uint32(34).fork()).join(),e.encryptedValue!==void 0&&t.uint32(42).string(e.encryptedValue),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=ky();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.type=n.string();continue;case 3:if(e!==26)break;i.function=My.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.metadata=ey.unwrap(ey.decode(n,n.uint32()));continue;case 5:if(e!==42)break;i.encryptedValue=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ay.fromPartial(e??{})},fromPartial(e){let t=ky();return t.id=e.id??``,t.type=e.type??``,t.function=e.function!==void 0&&e.function!==null?My.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t.encryptedValue=e.encryptedValue??void 0,t}};function jy(){return{name:``,arguments:``}}var My={encode(e,t=new Y){return e.name!==``&&t.uint32(10).string(e.name),e.arguments!==``&&t.uint32(18).string(e.arguments),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=jy();for(;n.pos>>3){case 1:if(e!==10)break;i.name=n.string();continue;case 2:if(e!==18)break;i.arguments=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return My.fromPartial(e??{})},fromPartial(e){let t=jy();return t.name=e.name??``,t.arguments=e.arguments??``,t}};function Ny(){return{id:``,role:``,content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0,encryptedValue:void 0,activityType:void 0,activityContent:void 0}}var Py={encode(e,t=new Y){e.id!==``&&t.uint32(10).string(e.id),e.role!==``&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let n of e.toolCalls)Ay.encode(n,t.uint32(42).fork()).join();e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error);for(let n of e.contentParts)Oy.encode(n,t.uint32(66).fork()).join();return e.metadata!==void 0&&ey.encode(ey.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),e.encryptedValue!==void 0&&t.uint32(90).string(e.encryptedValue),e.activityType!==void 0&&t.uint32(98).string(e.activityType),e.activityContent!==void 0&&ey.encode(ey.wrap(e.activityContent),t.uint32(106).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Ny();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.role=n.string();continue;case 3:if(e!==26)break;i.content=n.string();continue;case 4:if(e!==34)break;i.name=n.string();continue;case 5:if(e!==42)break;i.toolCalls.push(Ay.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.toolCallId=n.string();continue;case 7:if(e!==58)break;i.error=n.string();continue;case 8:if(e!==66)break;i.contentParts.push(Oy.decode(n,n.uint32()));continue;case 9:if(e!==74)break;i.metadata=ey.unwrap(ey.decode(n,n.uint32()));continue;case 10:if(e!==82)break;i.subagentRunId=n.string();continue;case 11:if(e!==90)break;i.encryptedValue=n.string();continue;case 12:if(e!==98)break;i.activityType=n.string();continue;case 13:if(e!==106)break;i.activityContent=ey.unwrap(ey.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Py.fromPartial(e??{})},fromPartial(e){let t=Ny();return t.id=e.id??``,t.role=e.role??``,t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(e=>Ay.fromPartial(e))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(e=>Oy.fromPartial(e))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t.encryptedValue=e.encryptedValue??void 0,t.activityType=e.activityType??void 0,t.activityContent=e.activityContent??void 0,t}};function Fy(){return{name:``,description:``,parameters:void 0,metadata:void 0}}var Iy={encode(e,t=new Y){return e.name!==``&&t.uint32(10).string(e.name),e.description!==``&&t.uint32(18).string(e.description),e.parameters!==void 0&&Z.encode(Z.wrap(e.parameters),t.uint32(26).fork()).join(),e.metadata!==void 0&&ey.encode(ey.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Fy();for(;n.pos>>3){case 1:if(e!==10)break;i.name=n.string();continue;case 2:if(e!==18)break;i.description=n.string();continue;case 3:if(e!==26)break;i.parameters=Z.unwrap(Z.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.metadata=ey.unwrap(ey.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Iy.fromPartial(e??{})},fromPartial(e){let t=Fy();return t.name=e.name??``,t.description=e.description??``,t.parameters=e.parameters??void 0,t.metadata=e.metadata??void 0,t}};function Ly(){return{description:``,value:``}}var Ry={encode(e,t=new Y){return e.description!==``&&t.uint32(10).string(e.description),e.value!==``&&t.uint32(18).string(e.value),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Ly();for(;n.pos>>3){case 1:if(e!==10)break;i.description=n.string();continue;case 2:if(e!==18)break;i.value=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ry.fromPartial(e??{})},fromPartial(e){let t=Ly();return t.description=e.description??``,t.value=e.value??``,t}};function zy(){return{interruptId:``,status:``,payload:void 0,metadata:void 0}}var By={encode(e,t=new Y){return e.interruptId!==``&&t.uint32(10).string(e.interruptId),e.status!==``&&t.uint32(18).string(e.status),e.payload!==void 0&&Z.encode(Z.wrap(e.payload),t.uint32(26).fork()).join(),e.metadata!==void 0&&ey.encode(ey.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=zy();for(;n.pos>>3){case 1:if(e!==10)break;i.interruptId=n.string();continue;case 2:if(e!==18)break;i.status=n.string();continue;case 3:if(e!==26)break;i.payload=Z.unwrap(Z.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.metadata=ey.unwrap(ey.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return By.fromPartial(e??{})},fromPartial(e){let t=zy();return t.interruptId=e.interruptId??``,t.status=e.status??``,t.payload=e.payload??void 0,t.metadata=e.metadata??void 0,t}};function Vy(){return{threadId:``,runId:``,parentRunId:void 0,state:void 0,messages:[],tools:[],context:[],forwardedProps:void 0,resume:[],protocolVersion:void 0}}var Hy={encode(e,t=new Y){e.threadId!==``&&t.uint32(10).string(e.threadId),e.runId!==``&&t.uint32(18).string(e.runId),e.parentRunId!==void 0&&t.uint32(26).string(e.parentRunId),e.state!==void 0&&Z.encode(Z.wrap(e.state),t.uint32(34).fork()).join();for(let n of e.messages)Py.encode(n,t.uint32(42).fork()).join();for(let n of e.tools)Iy.encode(n,t.uint32(50).fork()).join();for(let n of e.context)Ry.encode(n,t.uint32(58).fork()).join();e.forwardedProps!==void 0&&Z.encode(Z.wrap(e.forwardedProps),t.uint32(66).fork()).join();for(let n of e.resume)By.encode(n,t.uint32(74).fork()).join();return e.protocolVersion!==void 0&&t.uint32(82).string(e.protocolVersion),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Vy();for(;n.pos>>3){case 1:if(e!==10)break;i.threadId=n.string();continue;case 2:if(e!==18)break;i.runId=n.string();continue;case 3:if(e!==26)break;i.parentRunId=n.string();continue;case 4:if(e!==34)break;i.state=Z.unwrap(Z.decode(n,n.uint32()));continue;case 5:if(e!==42)break;i.messages.push(Py.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.tools.push(Iy.decode(n,n.uint32()));continue;case 7:if(e!==58)break;i.context.push(Ry.decode(n,n.uint32()));continue;case 8:if(e!==66)break;i.forwardedProps=Z.unwrap(Z.decode(n,n.uint32()));continue;case 9:if(e!==74)break;i.resume.push(By.decode(n,n.uint32()));continue;case 10:if(e!==82)break;i.protocolVersion=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Hy.fromPartial(e??{})},fromPartial(e){let t=Vy();return t.threadId=e.threadId??``,t.runId=e.runId??``,t.parentRunId=e.parentRunId??void 0,t.state=e.state??void 0,t.messages=e.messages?.map(e=>Py.fromPartial(e))||[],t.tools=e.tools?.map(e=>Iy.fromPartial(e))||[],t.context=e.context?.map(e=>Ry.fromPartial(e))||[],t.forwardedProps=e.forwardedProps??void 0,t.resume=e.resume?.map(e=>By.fromPartial(e))||[],t.protocolVersion=e.protocolVersion??void 0,t}};function Uy(){return{id:``,reason:``,message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var Wy={encode(e,t=new Y){return e.id!==``&&t.uint32(10).string(e.id),e.reason!==``&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&Z.encode(Z.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&Z.encode(Z.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Uy();for(;n.pos>>3){case 1:if(e!==10)break;i.id=n.string();continue;case 2:if(e!==18)break;i.reason=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.toolCallId=n.string();continue;case 5:if(e!==42)break;i.responseSchema=Z.unwrap(Z.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.expiresAt=n.string();continue;case 7:if(e!==58)break;i.metadata=Z.unwrap(Z.decode(n,n.uint32()));continue;case 8:if(e!==66)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Wy.fromPartial(e??{})},fromPartial(e){let t=Uy();return t.id=e.id??``,t.reason=e.reason??``,t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}},Gy=function(e){return e[e.TEXT_MESSAGE_START=0]=`TEXT_MESSAGE_START`,e[e.TEXT_MESSAGE_CONTENT=1]=`TEXT_MESSAGE_CONTENT`,e[e.TEXT_MESSAGE_END=2]=`TEXT_MESSAGE_END`,e[e.TOOL_CALL_START=3]=`TOOL_CALL_START`,e[e.TOOL_CALL_ARGS=4]=`TOOL_CALL_ARGS`,e[e.TOOL_CALL_END=5]=`TOOL_CALL_END`,e[e.STATE_SNAPSHOT=6]=`STATE_SNAPSHOT`,e[e.STATE_DELTA=7]=`STATE_DELTA`,e[e.MESSAGES_SNAPSHOT=8]=`MESSAGES_SNAPSHOT`,e[e.RAW=9]=`RAW`,e[e.CUSTOM=10]=`CUSTOM`,e[e.RUN_STARTED=11]=`RUN_STARTED`,e[e.RUN_FINISHED=12]=`RUN_FINISHED`,e[e.RUN_ERROR=13]=`RUN_ERROR`,e[e.STEP_STARTED=14]=`STEP_STARTED`,e[e.STEP_FINISHED=15]=`STEP_FINISHED`,e[e.SUBAGENT_STARTED=16]=`SUBAGENT_STARTED`,e[e.SUBAGENT_FINISHED=17]=`SUBAGENT_FINISHED`,e[e.SUBAGENT_ERROR=18]=`SUBAGENT_ERROR`,e[e.TEXT_MESSAGE_CHUNK=19]=`TEXT_MESSAGE_CHUNK`,e[e.TOOL_CALL_CHUNK=20]=`TOOL_CALL_CHUNK`,e[e.TOOL_CALL_RESULT=21]=`TOOL_CALL_RESULT`,e[e.ACTIVITY_SNAPSHOT=22]=`ACTIVITY_SNAPSHOT`,e[e.ACTIVITY_DELTA=23]=`ACTIVITY_DELTA`,e[e.REASONING_START=24]=`REASONING_START`,e[e.REASONING_MESSAGE_START=25]=`REASONING_MESSAGE_START`,e[e.REASONING_MESSAGE_CONTENT=26]=`REASONING_MESSAGE_CONTENT`,e[e.REASONING_MESSAGE_END=27]=`REASONING_MESSAGE_END`,e[e.REASONING_MESSAGE_CHUNK=28]=`REASONING_MESSAGE_CHUNK`,e[e.REASONING_END=29]=`REASONING_END`,e[e.REASONING_ENCRYPTED_VALUE=30]=`REASONING_ENCRYPTED_VALUE`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function Ky(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var Q={encode(e,t=new Y){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&Z.encode(Z.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&ey.encode(ey.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Ky();for(;n.pos>>3){case 1:if(e!==8)break;i.type=n.int32();continue;case 2:if(e!==16)break;i.timestamp=ax(n.int64());continue;case 3:if(e!==26)break;i.rawEvent=Z.unwrap(Z.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.metadata=ey.unwrap(ey.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Q.fromPartial(e??{})},fromPartial(e){let t=Ky();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t.metadata=e.metadata??void 0,t}};function qy(){return{baseEvent:void 0,messageId:``,role:void 0,name:void 0,subagentRunId:void 0}}var Jy={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=qy();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.role=n.string();continue;case 4:if(e!==34)break;i.name=n.string();continue;case 5:if(e!==42)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Jy.fromPartial(e??{})},fromPartial(e){let t=qy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.role=e.role??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function Yy(){return{baseEvent:void 0,messageId:``,delta:``,subagentRunId:void 0}}var Xy={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.delta!==``&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Yy();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.delta=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Xy.fromPartial(e??{})},fromPartial(e){let t=Yy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.delta=e.delta??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Zy(){return{baseEvent:void 0,messageId:``,subagentRunId:void 0}}var Qy={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==``&&t.uint32(18).string(e.messageId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Zy();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Qy.fromPartial(e??{})},fromPartial(e){let t=Zy();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.subagentRunId=e.subagentRunId??void 0,t}};function $y(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var eb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=$y();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messageId=n.string();continue;case 3:if(e!==26)break;i.role=n.string();continue;case 4:if(e!==34)break;i.delta=n.string();continue;case 5:if(e!==42)break;i.name=n.string();continue;case 6:if(e!==50)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return eb.fromPartial(e??{})},fromPartial(e){let t=$y();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function tb(){return{baseEvent:void 0,toolCallId:``,toolCallName:``,parentMessageId:void 0,subagentRunId:void 0}}var nb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.toolCallName!==``&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=tb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.toolCallName=n.string();continue;case 4:if(e!==34)break;i.parentMessageId=n.string();continue;case 5:if(e!==42)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return nb.fromPartial(e??{})},fromPartial(e){let t=tb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.toolCallName=e.toolCallName??``,t.parentMessageId=e.parentMessageId??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function rb(){return{baseEvent:void 0,toolCallId:``,delta:``,subagentRunId:void 0}}var ib={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.delta!==``&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=rb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.delta=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return ib.fromPartial(e??{})},fromPartial(e){let t=rb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.delta=e.delta??``,t.subagentRunId=e.subagentRunId??void 0,t}};function ab(){return{baseEvent:void 0,toolCallId:``,subagentRunId:void 0}}var ob={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==``&&t.uint32(18).string(e.toolCallId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=ab();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return ob.fromPartial(e??{})},fromPartial(e){let t=ab();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.subagentRunId=e.subagentRunId??void 0,t}};function sb(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var cb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=sb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.toolCallId=n.string();continue;case 3:if(e!==26)break;i.toolCallName=n.string();continue;case 4:if(e!==34)break;i.parentMessageId=n.string();continue;case 5:if(e!==42)break;i.delta=n.string();continue;case 6:if(e!==50)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return cb.fromPartial(e??{})},fromPartial(e){let t=sb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function lb(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``,toolCallId:``,content:void 0,role:void 0,contentParts:[]}}var ub={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),e.toolCallId!==``&&t.uint32(34).string(e.toolCallId),e.content!==void 0&&t.uint32(42).string(e.content),e.role!==void 0&&t.uint32(50).string(e.role);for(let n of e.contentParts)Oy.encode(n,t.uint32(58).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=lb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.toolCallId=n.string();continue;case 5:if(e!==42)break;i.content=n.string();continue;case 6:if(e!==50)break;i.role=n.string();continue;case 7:if(e!==58)break;i.contentParts.push(Oy.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return ub.fromPartial(e??{})},fromPartial(e){let t=lb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t.toolCallId=e.toolCallId??``,t.content=e.content??void 0,t.role=e.role??void 0,t.contentParts=e.contentParts?.map(e=>Oy.fromPartial(e))||[],t}};function db(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var fb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&Z.encode(Z.wrap(e.snapshot),t.uint32(18).fork()).join(),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=db();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.snapshot=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return fb.fromPartial(e??{})},fromPartial(e){let t=db();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function pb(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var mb={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.delta)cy.encode(n,t.uint32(18).fork()).join();return e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=pb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.delta.push(cy.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return mb.fromPartial(e??{})},fromPartial(e){let t=pb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(e=>cy.fromPartial(e))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function hb(){return{baseEvent:void 0,messages:[]}}var gb={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.messages)Py.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=hb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messages.push(Py.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return gb.fromPartial(e??{})},fromPartial(e){let t=hb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(e=>Py.fromPartial(e))||[],t}};function _b(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``,activityType:``,content:void 0,replace:void 0}}var vb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),e.activityType!==``&&t.uint32(34).string(e.activityType),e.content!==void 0&&ey.encode(ey.wrap(e.content),t.uint32(42).fork()).join(),e.replace!==void 0&&t.uint32(48).bool(e.replace),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=_b();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.activityType=n.string();continue;case 5:if(e!==42)break;i.content=ey.unwrap(ey.decode(n,n.uint32()));continue;case 6:if(e!==48)break;i.replace=n.bool();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return vb.fromPartial(e??{})},fromPartial(e){let t=_b();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t.activityType=e.activityType??``,t.content=e.content??void 0,t.replace=e.replace??void 0,t}};function yb(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``,activityType:``,patch:[]}}var bb={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),e.activityType!==``&&t.uint32(34).string(e.activityType);for(let n of e.patch)cy.encode(n,t.uint32(42).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=yb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.activityType=n.string();continue;case 5:if(e!==42)break;i.patch.push(cy.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return bb.fromPartial(e??{})},fromPartial(e){let t=yb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t.activityType=e.activityType??``,t.patch=e.patch?.map(e=>cy.fromPartial(e))||[],t}};function xb(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var Sb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&Z.encode(Z.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=xb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.event=Z.unwrap(Z.decode(n,n.uint32()));continue;case 3:if(e!==26)break;i.source=n.string();continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Sb.fromPartial(e??{})},fromPartial(e){let t=xb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function Cb(){return{baseEvent:void 0,name:``,value:void 0,subagentRunId:void 0}}var wb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==``&&t.uint32(18).string(e.name),e.value!==void 0&&Z.encode(Z.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Cb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.name=n.string();continue;case 3:if(e!==26)break;i.value=Z.unwrap(Z.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return wb.fromPartial(e??{})},fromPartial(e){let t=Cb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.name=e.name??``,t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function Tb(){return{baseEvent:void 0,threadId:``,runId:``,parentRunId:void 0,input:void 0,protocolVersion:void 0}}var Eb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==``&&t.uint32(18).string(e.threadId),e.runId!==``&&t.uint32(26).string(e.runId),e.parentRunId!==void 0&&t.uint32(34).string(e.parentRunId),e.input!==void 0&&Hy.encode(e.input,t.uint32(42).fork()).join(),e.protocolVersion!==void 0&&t.uint32(50).string(e.protocolVersion),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Tb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.threadId=n.string();continue;case 3:if(e!==26)break;i.runId=n.string();continue;case 4:if(e!==34)break;i.parentRunId=n.string();continue;case 5:if(e!==42)break;i.input=Hy.decode(n,n.uint32());continue;case 6:if(e!==50)break;i.protocolVersion=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Eb.fromPartial(e??{})},fromPartial(e){let t=Tb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??``,t.runId=e.runId??``,t.parentRunId=e.parentRunId??void 0,t.input=e.input!==void 0&&e.input!==null?Hy.fromPartial(e.input):void 0,t.protocolVersion=e.protocolVersion??void 0,t}};function Db(){return{baseEvent:void 0,threadId:``,runId:``,result:void 0,outcome:``,interrupts:[],usage:[],pendingToolCallIds:[]}}var Ob={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==``&&t.uint32(18).string(e.threadId),e.runId!==``&&t.uint32(26).string(e.runId),e.result!==void 0&&Z.encode(Z.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==``&&t.uint32(42).string(e.outcome);for(let n of e.interrupts)Wy.encode(n,t.uint32(50).fork()).join();for(let n of e.usage)ix.encode(n,t.uint32(58).fork()).join();for(let n of e.pendingToolCallIds)t.uint32(66).string(n);return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Db();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.threadId=n.string();continue;case 3:if(e!==26)break;i.runId=n.string();continue;case 4:if(e!==34)break;i.result=Z.unwrap(Z.decode(n,n.uint32()));continue;case 5:if(e!==42)break;i.outcome=n.string();continue;case 6:if(e!==50)break;i.interrupts.push(Wy.decode(n,n.uint32()));continue;case 7:if(e!==58)break;i.usage.push(ix.decode(n,n.uint32()));continue;case 8:if(e!==66)break;i.pendingToolCallIds.push(n.string());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ob.fromPartial(e??{})},fromPartial(e){let t=Db();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??``,t.runId=e.runId??``,t.result=e.result??void 0,t.outcome=e.outcome??``,t.interrupts=e.interrupts?.map(e=>Wy.fromPartial(e))||[],t.usage=e.usage?.map(e=>ix.fromPartial(e))||[],t.pendingToolCallIds=e.pendingToolCallIds?.map(e=>e)||[],t}};function kb(){return{baseEvent:void 0,code:void 0,message:``,usage:[]}}var Ab={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==``&&t.uint32(26).string(e.message);for(let n of e.usage)ix.encode(n,t.uint32(34).fork()).join();return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=kb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.code=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.usage.push(ix.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ab.fromPartial(e??{})},fromPartial(e){let t=kb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??``,t.usage=e.usage?.map(e=>ix.fromPartial(e))||[],t}};function jb(){return{baseEvent:void 0,stepName:``,subagentRunId:void 0}}var Mb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==``&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=jb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.stepName=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Mb.fromPartial(e??{})},fromPartial(e){let t=jb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Nb(){return{baseEvent:void 0,stepName:``,subagentRunId:void 0}}var Pb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==``&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Nb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.stepName=n.string();continue;case 3:if(e!==26)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Pb.fromPartial(e??{})},fromPartial(e){let t=Nb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Fb(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``}}var Ib={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Fb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Ib.fromPartial(e??{})},fromPartial(e){let t=Fb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t}};function Lb(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``,role:``}}var Rb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),e.role!==``&&t.uint32(34).string(e.role),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Lb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.role=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Rb.fromPartial(e??{})},fromPartial(e){let t=Lb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t.role=e.role??``,t}};function zb(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``,delta:``}}var Bb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),e.delta!==``&&t.uint32(34).string(e.delta),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=zb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.delta=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Bb.fromPartial(e??{})},fromPartial(e){let t=zb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t.delta=e.delta??``,t}};function Vb(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``}}var Hb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Vb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Hb.fromPartial(e??{})},fromPartial(e){let t=Vb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t}};function Ub(){return{baseEvent:void 0,subagentRunId:void 0,messageId:void 0,delta:void 0}}var Wb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==void 0&&t.uint32(26).string(e.messageId),e.delta!==void 0&&t.uint32(34).string(e.delta),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Ub();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue;case 4:if(e!==34)break;i.delta=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Wb.fromPartial(e??{})},fromPartial(e){let t=Ub();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??void 0,t.delta=e.delta??void 0,t}};function Gb(){return{baseEvent:void 0,subagentRunId:void 0,messageId:``}}var Kb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.messageId!==``&&t.uint32(26).string(e.messageId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Gb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.messageId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Kb.fromPartial(e??{})},fromPartial(e){let t=Gb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.messageId=e.messageId??``,t}};function qb(){return{baseEvent:void 0,subagentRunId:void 0,subtype:``,entityId:``,encryptedValue:``}}var Jb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==void 0&&t.uint32(18).string(e.subagentRunId),e.subtype!==``&&t.uint32(26).string(e.subtype),e.entityId!==``&&t.uint32(34).string(e.entityId),e.encryptedValue!==``&&t.uint32(42).string(e.encryptedValue),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=qb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.subtype=n.string();continue;case 4:if(e!==34)break;i.entityId=n.string();continue;case 5:if(e!==42)break;i.encryptedValue=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Jb.fromPartial(e??{})},fromPartial(e){let t=qb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??void 0,t.subtype=e.subtype??``,t.entityId=e.entityId??``,t.encryptedValue=e.encryptedValue??``,t}};function Yb(){return{baseEvent:void 0,subagentRunId:``,name:``,description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var Xb={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.name!==``&&t.uint32(26).string(e.name),e.description!==void 0&&t.uint32(34).string(e.description),e.parentSubagentRunId!==void 0&&t.uint32(42).string(e.parentSubagentRunId),e.parentToolCallId!==void 0&&t.uint32(50).string(e.parentToolCallId),e.parentMessageId!==void 0&&t.uint32(58).string(e.parentMessageId),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Yb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.name=n.string();continue;case 4:if(e!==34)break;i.description=n.string();continue;case 5:if(e!==42)break;i.parentSubagentRunId=n.string();continue;case 6:if(e!==50)break;i.parentToolCallId=n.string();continue;case 7:if(e!==58)break;i.parentMessageId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Xb.fromPartial(e??{})},fromPartial(e){let t=Yb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.name=e.name??``,t.description=e.description??void 0,t.parentSubagentRunId=e.parentSubagentRunId??void 0,t.parentToolCallId=e.parentToolCallId??void 0,t.parentMessageId=e.parentMessageId??void 0,t}};function Zb(){return{baseEvent:void 0,subagentRunId:``,result:void 0,outcome:``,interruptIds:[]}}var Qb={encode(e,t=new Y){e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&Z.encode(Z.wrap(e.result),t.uint32(26).fork()).join(),e.outcome!==``&&t.uint32(34).string(e.outcome);for(let n of e.interruptIds)t.uint32(42).string(n);return t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=Zb();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.result=Z.unwrap(Z.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.outcome=n.string();continue;case 5:if(e!==42)break;i.interruptIds.push(n.string());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Qb.fromPartial(e??{})},fromPartial(e){let t=Zb();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.result=e.result??void 0,t.outcome=e.outcome??``,t.interruptIds=e.interruptIds?.map(e=>e)||[],t}};function $b(){return{baseEvent:void 0,subagentRunId:``,message:``,code:void 0}}var ex={encode(e,t=new Y){return e.baseEvent!==void 0&&Q.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.message!==``&&t.uint32(26).string(e.message),e.code!==void 0&&t.uint32(34).string(e.code),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=$b();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=Q.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.message=n.string();continue;case 4:if(e!==34)break;i.code=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return ex.fromPartial(e??{})},fromPartial(e){let t=$b();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Q.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.message=e.message??``,t.code=e.code??void 0,t}};function tx(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0,subagentStarted:void 0,subagentFinished:void 0,subagentError:void 0,toolCallResult:void 0,activitySnapshot:void 0,activityDelta:void 0,reasoningStart:void 0,reasoningMessageStart:void 0,reasoningMessageContent:void 0,reasoningMessageEnd:void 0,reasoningMessageChunk:void 0,reasoningEnd:void 0,reasoningEncryptedValue:void 0}}var nx={encode(e,t=new Y){return e.textMessageStart!==void 0&&Jy.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Xy.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Qy.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&nb.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&ib.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&ob.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&fb.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&mb.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&gb.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Sb.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&wb.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Eb.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&Ob.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Ab.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Mb.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Pb.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&eb.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&cb.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&Xb.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&Qb.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&ex.encode(e.subagentError,t.uint32(170).fork()).join(),e.toolCallResult!==void 0&&ub.encode(e.toolCallResult,t.uint32(178).fork()).join(),e.activitySnapshot!==void 0&&vb.encode(e.activitySnapshot,t.uint32(186).fork()).join(),e.activityDelta!==void 0&&bb.encode(e.activityDelta,t.uint32(194).fork()).join(),e.reasoningStart!==void 0&&Ib.encode(e.reasoningStart,t.uint32(202).fork()).join(),e.reasoningMessageStart!==void 0&&Rb.encode(e.reasoningMessageStart,t.uint32(210).fork()).join(),e.reasoningMessageContent!==void 0&&Bb.encode(e.reasoningMessageContent,t.uint32(218).fork()).join(),e.reasoningMessageEnd!==void 0&&Hb.encode(e.reasoningMessageEnd,t.uint32(226).fork()).join(),e.reasoningMessageChunk!==void 0&&Wb.encode(e.reasoningMessageChunk,t.uint32(234).fork()).join(),e.reasoningEnd!==void 0&&Kb.encode(e.reasoningEnd,t.uint32(242).fork()).join(),e.reasoningEncryptedValue!==void 0&&Jb.encode(e.reasoningEncryptedValue,t.uint32(250).fork()).join(),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=tx();for(;n.pos>>3){case 1:if(e!==10)break;i.textMessageStart=Jy.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.textMessageContent=Xy.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.textMessageEnd=Qy.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.toolCallStart=nb.decode(n,n.uint32());continue;case 5:if(e!==42)break;i.toolCallArgs=ib.decode(n,n.uint32());continue;case 6:if(e!==50)break;i.toolCallEnd=ob.decode(n,n.uint32());continue;case 7:if(e!==58)break;i.stateSnapshot=fb.decode(n,n.uint32());continue;case 8:if(e!==66)break;i.stateDelta=mb.decode(n,n.uint32());continue;case 9:if(e!==74)break;i.messagesSnapshot=gb.decode(n,n.uint32());continue;case 10:if(e!==82)break;i.raw=Sb.decode(n,n.uint32());continue;case 11:if(e!==90)break;i.custom=wb.decode(n,n.uint32());continue;case 12:if(e!==98)break;i.runStarted=Eb.decode(n,n.uint32());continue;case 13:if(e!==106)break;i.runFinished=Ob.decode(n,n.uint32());continue;case 14:if(e!==114)break;i.runError=Ab.decode(n,n.uint32());continue;case 15:if(e!==122)break;i.stepStarted=Mb.decode(n,n.uint32());continue;case 16:if(e!==130)break;i.stepFinished=Pb.decode(n,n.uint32());continue;case 17:if(e!==138)break;i.textMessageChunk=eb.decode(n,n.uint32());continue;case 18:if(e!==146)break;i.toolCallChunk=cb.decode(n,n.uint32());continue;case 19:if(e!==154)break;i.subagentStarted=Xb.decode(n,n.uint32());continue;case 20:if(e!==162)break;i.subagentFinished=Qb.decode(n,n.uint32());continue;case 21:if(e!==170)break;i.subagentError=ex.decode(n,n.uint32());continue;case 22:if(e!==178)break;i.toolCallResult=ub.decode(n,n.uint32());continue;case 23:if(e!==186)break;i.activitySnapshot=vb.decode(n,n.uint32());continue;case 24:if(e!==194)break;i.activityDelta=bb.decode(n,n.uint32());continue;case 25:if(e!==202)break;i.reasoningStart=Ib.decode(n,n.uint32());continue;case 26:if(e!==210)break;i.reasoningMessageStart=Rb.decode(n,n.uint32());continue;case 27:if(e!==218)break;i.reasoningMessageContent=Bb.decode(n,n.uint32());continue;case 28:if(e!==226)break;i.reasoningMessageEnd=Hb.decode(n,n.uint32());continue;case 29:if(e!==234)break;i.reasoningMessageChunk=Wb.decode(n,n.uint32());continue;case 30:if(e!==242)break;i.reasoningEnd=Kb.decode(n,n.uint32());continue;case 31:if(e!==250)break;i.reasoningEncryptedValue=Jb.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return nx.fromPartial(e??{})},fromPartial(e){let t=tx();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Jy.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Xy.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Qy.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?nb.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?ib.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?ob.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?fb.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?mb.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?gb.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Sb.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?wb.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Eb.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?Ob.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Ab.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Mb.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Pb.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?eb.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?cb.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?Xb.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?Qb.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?ex.fromPartial(e.subagentError):void 0,t.toolCallResult=e.toolCallResult!==void 0&&e.toolCallResult!==null?ub.fromPartial(e.toolCallResult):void 0,t.activitySnapshot=e.activitySnapshot!==void 0&&e.activitySnapshot!==null?vb.fromPartial(e.activitySnapshot):void 0,t.activityDelta=e.activityDelta!==void 0&&e.activityDelta!==null?bb.fromPartial(e.activityDelta):void 0,t.reasoningStart=e.reasoningStart!==void 0&&e.reasoningStart!==null?Ib.fromPartial(e.reasoningStart):void 0,t.reasoningMessageStart=e.reasoningMessageStart!==void 0&&e.reasoningMessageStart!==null?Rb.fromPartial(e.reasoningMessageStart):void 0,t.reasoningMessageContent=e.reasoningMessageContent!==void 0&&e.reasoningMessageContent!==null?Bb.fromPartial(e.reasoningMessageContent):void 0,t.reasoningMessageEnd=e.reasoningMessageEnd!==void 0&&e.reasoningMessageEnd!==null?Hb.fromPartial(e.reasoningMessageEnd):void 0,t.reasoningMessageChunk=e.reasoningMessageChunk!==void 0&&e.reasoningMessageChunk!==null?Wb.fromPartial(e.reasoningMessageChunk):void 0,t.reasoningEnd=e.reasoningEnd!==void 0&&e.reasoningEnd!==null?Kb.fromPartial(e.reasoningEnd):void 0,t.reasoningEncryptedValue=e.reasoningEncryptedValue!==void 0&&e.reasoningEncryptedValue!==null?Jb.fromPartial(e.reasoningEncryptedValue):void 0,t}};function rx(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0,cacheWriteInputTokens:void 0}}var ix={encode(e,t=new Y){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),e.cacheWriteInputTokens!==void 0&&t.uint32(64).int64(e.cacheWriteInputTokens),t},decode(e,t){let n=e instanceof X?e:new X(e),r=t===void 0?n.len:n.pos+t,i=rx();for(;n.pos>>3){case 1:if(e!==10)break;i.provider=n.string();continue;case 2:if(e!==18)break;i.model=n.string();continue;case 3:if(e!==24)break;i.inputTokens=ax(n.int64());continue;case 4:if(e!==32)break;i.outputTokens=ax(n.int64());continue;case 5:if(e!==40)break;i.totalTokens=ax(n.int64());continue;case 6:if(e!==48)break;i.reasoningTokens=ax(n.int64());continue;case 7:if(e!==56)break;i.cachedInputTokens=ax(n.int64());continue;case 8:if(e!==64)break;i.cacheWriteInputTokens=ax(n.int64());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return ix.fromPartial(e??{})},fromPartial(e){let t=rx();return t.provider=e.provider??void 0,t.model=e.model??void 0,t.inputTokens=e.inputTokens??void 0,t.outputTokens=e.outputTokens??void 0,t.totalTokens=e.totalTokens??void 0,t.reasoningTokens=e.reasoningTokens??void 0,t.cachedInputTokens=e.cachedInputTokens??void 0,t.cacheWriteInputTokens=e.cacheWriteInputTokens??void 0,t}};function ax(e){let t=globalThis.Number(e.toString());if(t>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error(`Value is larger than Number.MAX_SAFE_INTEGER`);if(te&&typeof e==`object`?e:void 0,sx=e=>Array.isArray(e)?e:[],cx=()=>typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS,lx=()=>{cx()||console.warn(`[ag-ui][proto] Dropped a content part this build does not know: the protocol has a variant this SDK predates.`)};new Set(Object.values(j));var ux={textMessageStart:`TEXT_MESSAGE_START`,textMessageContent:`TEXT_MESSAGE_CONTENT`,textMessageEnd:`TEXT_MESSAGE_END`,textMessageChunk:`TEXT_MESSAGE_CHUNK`,toolCallStart:`TOOL_CALL_START`,toolCallArgs:`TOOL_CALL_ARGS`,toolCallEnd:`TOOL_CALL_END`,toolCallChunk:`TOOL_CALL_CHUNK`,toolCallResult:`TOOL_CALL_RESULT`,stateSnapshot:`STATE_SNAPSHOT`,stateDelta:`STATE_DELTA`,messagesSnapshot:`MESSAGES_SNAPSHOT`,activitySnapshot:`ACTIVITY_SNAPSHOT`,activityDelta:`ACTIVITY_DELTA`,raw:`RAW`,custom:`CUSTOM`,runStarted:`RUN_STARTED`,runFinished:`RUN_FINISHED`,runError:`RUN_ERROR`,stepStarted:`STEP_STARTED`,stepFinished:`STEP_FINISHED`,reasoningStart:`REASONING_START`,reasoningMessageStart:`REASONING_MESSAGE_START`,reasoningMessageContent:`REASONING_MESSAGE_CONTENT`,reasoningMessageEnd:`REASONING_MESSAGE_END`,reasoningMessageChunk:`REASONING_MESSAGE_CHUNK`,reasoningEnd:`REASONING_END`,reasoningEncryptedValue:`REASONING_ENCRYPTED_VALUE`,subagentStarted:`SUBAGENT_STARTED`,subagentFinished:`SUBAGENT_FINISHED`,subagentError:`SUBAGENT_ERROR`},dx=new Set([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]),fx=e=>{let t=ox(e);if(t){if([t.data,t.url,t.file].filter(Boolean).length>1)throw Error(`Invalid event: source carries more than one arm`);if(t.data){let e=t.data;return{type:`data`,value:e.value,mimeType:e.mimeType}}if(t.url){let e=t.url;return{type:`url`,value:e.value,mimeType:e.mimeType}}if(t.file){let e=t.file;return{type:`file`,value:e.value,provider:e.provider,mimeType:e.mimeType}}}},px=e=>{let t=ox(e);if(t){if([t.text,t.image,t.audio,t.video,t.document].filter(Boolean).length>1)throw Error(`Invalid event: content part carries more than one arm`);if(t.text){let e=t.text;return{type:`text`,id:e.id,text:e.text,metadata:e.metadata}}if(t.image){let e=t.image;return e.source!==void 0&&fx(e.source)===void 0?void 0:{type:`image`,id:e.id,source:fx(e.source),metadata:e.metadata}}if(t.audio){let e=t.audio;return e.source!==void 0&&fx(e.source)===void 0?void 0:{type:`audio`,id:e.id,source:fx(e.source),metadata:e.metadata}}if(t.video){let e=t.video;return e.source!==void 0&&fx(e.source)===void 0?void 0:{type:`video`,id:e.id,source:fx(e.source),metadata:e.metadata}}if(t.document){let e=t.document;return e.source!==void 0&&fx(e.source)===void 0?void 0:{type:`document`,id:e.id,source:fx(e.source),metadata:e.metadata}}}},mx=new Set([`activity`]),hx=new Set([`user`,`tool`]),gx=new Set([`developer`,`system`,`assistant`,`user`,`tool`,`activity`,`reasoning`]),_x=e=>{let t=ox(e)??{},n={...t},r=typeof t.role==`string`?t.role:``,i=gx.has(r),a=i?hx.has(r):sx(t.contentParts).length>0,o=i?mx.has(r):!a&&t.activityContent!==void 0;if(!i&&(t.content===void 0?0:1)+ +(sx(t.contentParts).length>0)+(t.activityContent===void 0?0:1)>1)throw Error(`Invalid event: message carries more than one content form`);if(i){if(!a&&sx(t.contentParts).length>0)throw Error(`Invalid event: message carries content parts for a role that has none`);if(t.activityContent!==void 0&&!o)throw Error(`Invalid event: message carries activity content for a non-activity role`);if(o&&t.content!==void 0)throw Error(`Invalid event: activity content cannot ride with other content forms`);if(a&&t.content!==void 0&&sx(t.contentParts).length>0)throw Error(`Invalid event: message carries both string content and content parts`)}return a&&t.content===void 0&&(n.content=sx(t.contentParts).map(e=>{let t=px(e);return t===void 0&&lx(),t}).filter(e=>e!==void 0)),o&&t.activityContent!==void 0&&(n.content=t.activityContent),delete n.activityContent,delete n.contentParts,sx(t.toolCalls).length===0&&delete n.toolCalls,Object.keys(n).forEach(e=>{n[e]===void 0&&delete n[e]}),n},vx=e=>{if(Array.isArray(e)){for(let t of e)vx(t);return}let t=ox(e);if(t)for(let e of Object.keys(t))t[e]===void 0?delete t[e]:vx(t[e])},yx=e=>{let t=ox(e);if(!t)return;let n={};return t.threadId!==void 0&&(n.threadId=t.threadId),t.runId!==void 0&&(n.runId=t.runId),t.protocolVersion!==void 0&&(n.protocolVersion=t.protocolVersion),t.parentRunId!==void 0&&(n.parentRunId=t.parentRunId),t.state!==void 0&&(n.state=t.state),n.messages=sx(t.messages).map(_x).filter(e=>e!==void 0),n.tools=sx(t.tools),n.context=sx(t.context),t.forwardedProps!==void 0&&(n.forwardedProps=t.forwardedProps),n.resume=sx(t.resume),n},bx={TextMessageStartEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},BaseEvent:{singular:new Set([3,4]),descend:{},google:{3:`google.protobuf.Value`,4:`google.protobuf.Struct`}},TextMessageContentEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},TextMessageEndEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ToolCallStartEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ToolCallArgsEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ToolCallEndEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},StateSnapshotEvent:{singular:new Set([1,2]),descend:{1:`BaseEvent`},google:{2:`google.protobuf.Value`}},StateDeltaEvent:{singular:new Set([1]),descend:{1:`BaseEvent`,2:`JsonPatchOperation`}},JsonPatchOperation:{singular:new Set([4]),descend:{},google:{4:`google.protobuf.Value`}},MessagesSnapshotEvent:{singular:new Set([1]),descend:{1:`BaseEvent`,2:`Message`}},Message:{singular:new Set([9,13]),descend:{5:`ToolCall`,8:`InputContent`},google:{9:`google.protobuf.Struct`,13:`google.protobuf.Struct`}},ToolCall:{singular:new Set([3,4]),descend:{},google:{4:`google.protobuf.Struct`}},InputContent:{singular:new Set([1,2,3,4,5]),descend:{1:`TextInputPart`,2:`ImageInputPart`,3:`AudioInputPart`,4:`VideoInputPart`,5:`DocumentInputPart`},arms:new Set([1,2,3,4,5])},TextInputPart:{singular:new Set([3]),descend:{},google:{3:`google.protobuf.Value`}},ImageInputPart:{singular:new Set([1,2]),descend:{1:`InputContentSource`},google:{2:`google.protobuf.Value`}},InputContentSource:{singular:new Set([1,2,3]),descend:{},arms:new Set([1,2,3])},AudioInputPart:{singular:new Set([1,2]),descend:{1:`InputContentSource`},google:{2:`google.protobuf.Value`}},VideoInputPart:{singular:new Set([1,2]),descend:{1:`InputContentSource`},google:{2:`google.protobuf.Value`}},DocumentInputPart:{singular:new Set([1,2]),descend:{1:`InputContentSource`},google:{2:`google.protobuf.Value`}},RawEvent:{singular:new Set([1,2]),descend:{1:`BaseEvent`},google:{2:`google.protobuf.Value`}},CustomEvent:{singular:new Set([1,3]),descend:{1:`BaseEvent`},google:{3:`google.protobuf.Value`}},RunStartedEvent:{singular:new Set([1,5]),descend:{1:`BaseEvent`,5:`RunAgentInput`}},RunAgentInput:{singular:new Set([4,8]),descend:{5:`Message`,6:`Tool`,9:`ResumeEntry`},google:{4:`google.protobuf.Value`,8:`google.protobuf.Value`}},Tool:{singular:new Set([3,4]),descend:{},google:{3:`google.protobuf.Value`,4:`google.protobuf.Struct`}},ResumeEntry:{singular:new Set([3,4]),descend:{},google:{3:`google.protobuf.Value`,4:`google.protobuf.Struct`}},RunFinishedEvent:{singular:new Set([1,4]),descend:{1:`BaseEvent`,6:`Interrupt`},google:{4:`google.protobuf.Value`}},Interrupt:{singular:new Set([5,7]),descend:{},google:{5:`google.protobuf.Value`,7:`google.protobuf.Value`}},RunErrorEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},StepStartedEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},StepFinishedEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},TextMessageChunkEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ToolCallChunkEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},SubagentStartedEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},SubagentFinishedEvent:{singular:new Set([1,3]),descend:{1:`BaseEvent`},google:{3:`google.protobuf.Value`}},SubagentErrorEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ToolCallResultEvent:{singular:new Set([1]),descend:{1:`BaseEvent`,7:`InputContent`}},ActivitySnapshotEvent:{singular:new Set([1,5]),descend:{1:`BaseEvent`},google:{5:`google.protobuf.Struct`}},ActivityDeltaEvent:{singular:new Set([1]),descend:{1:`BaseEvent`,5:`JsonPatchOperation`}},ReasoningStartEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningMessageStartEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningMessageContentEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningMessageEndEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningMessageChunkEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningEndEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},ReasoningEncryptedValueEvent:{singular:new Set([1]),descend:{1:`BaseEvent`}},"google.protobuf.Struct":{singular:new Set,descend:{1:`google.protobuf.Struct.FieldsEntry`}},"google.protobuf.Struct.FieldsEntry":{singular:new Set([2]),descend:{2:`google.protobuf.Value`}},"google.protobuf.Value":{singular:new Set([5,6]),descend:{5:`google.protobuf.Struct`,6:`google.protobuf.ListValue`},arms:new Set([1,2,3,4,5,6]),armWireTypes:{1:0,2:1,3:2,4:0,5:2,6:2}},"google.protobuf.ListValue":{singular:new Set,descend:{1:`google.protobuf.Value`}}},xx={1:`TextMessageStartEvent`,2:`TextMessageContentEvent`,3:`TextMessageEndEvent`,4:`ToolCallStartEvent`,5:`ToolCallArgsEvent`,6:`ToolCallEndEvent`,7:`StateSnapshotEvent`,8:`StateDeltaEvent`,9:`MessagesSnapshotEvent`,10:`RawEvent`,11:`CustomEvent`,12:`RunStartedEvent`,13:`RunFinishedEvent`,14:`RunErrorEvent`,15:`StepStartedEvent`,16:`StepFinishedEvent`,17:`TextMessageChunkEvent`,18:`ToolCallChunkEvent`,19:`SubagentStartedEvent`,20:`SubagentFinishedEvent`,21:`SubagentErrorEvent`,22:`ToolCallResultEvent`,23:`ActivitySnapshotEvent`,24:`ActivityDeltaEvent`,25:`ReasoningStartEvent`,26:`ReasoningMessageStartEvent`,27:`ReasoningMessageContentEvent`,28:`ReasoningMessageEndEvent`,29:`ReasoningMessageChunkEvent`,30:`ReasoningEndEvent`,31:`ReasoningEncryptedValueEvent`};function Sx(e,t){let n=0,r=0;for(;;){if(t.offset>=e.length)throw Error(`Invalid event`);let i=e[t.offset++];if(r<28?n+=(i&127)*2**r:r===28&&(n+=(i&15)*2**28),r+=7,!(i&128))return n}}function Cx(e,t){let n={offset:0},r=0,i=0;for(;n.offsete.length)throw Error(`Invalid event`);if(r===0){if(t.arms?.has(o)){if(i!==0&&i!==o)throw Error(`Invalid event`);i=o}let r=t.descend[o];if(r!==void 0){let t=bx[r];t!==void 0&&Cx(e.subarray(n.offset,n.offset+a),t)}}n.offset+=a}else if(s===5)n.offset+=4;else throw Error(`Invalid event`);if(n.offset>e.length)throw Error(`Invalid event`)}if(r!==0)throw Error(`Invalid event`)}function wx(e){let t=new Set,n={offset:0},r=0;for(;n.offset0&&!t.has(a))throw Error(`Invalid event`);t.add(a)}if(o===0)Sx(e,n);else if(o===1)n.offset+=8;else if(o===2){let t=Sx(e,n);if(n.offset+t>e.length)throw Error(`Invalid event`);if(r===0){let r=xx[a];if(r!==void 0){let i=bx[r];i!==void 0&&Cx(e.subarray(n.offset,n.offset+t),i)}}n.offset+=t}else if(o===5)n.offset+=4;else throw Error(`Invalid event`);if(n.offset>e.length)throw Error(`Invalid event`)}if(r!==0)throw Error(`Invalid event`)}function Tx(e){if(e.length===1)return e[0];let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t}function Ex(e,t){let n=new X(e),r=[],i=new Map,a,o=!1;for(;n.pos1||n!==t){s.push(new Y().uint32(e.number*8+2).bytes(n).finish()),o=!0;continue}}s.push(e.raw)}return o?Tx(s):e}var Dx=class extends Error{constructor(e=`Unknown event type`){super(e),this.name=`AGUIUnknownEventTypeError`}};function Ox(e,t,n,r){let i=0,a=0,o=0;for(;;){if(t.offset>=e.length||o>=n)return-1;let s=e[t.offset++];if(o+=1,o===n&&s>r)return-1;if(i+=(s&127)*2**a,a+=7,!(s&128))return i}}var kx=(e,t)=>Ox(e,t,5,15),Ax=(e,t)=>Ox(e,t,10,1);function jx(e){let t={offset:0},n=[];for(;t.offsete.length)return!1;t.offset+=n}else return!1;if(t.offset>e.length)return!1}return n.length===0}function Mx(e){let t={offset:0},n=[],r=0;for(;t.offsete.length)return!1;if(s){if(dx.has(a)||!jx(e.subarray(t.offset,t.offset+n)))return!1;r+=1}t.offset+=n}else return!1;if(t.offset>e.length)return!1}return n.length===0&&r>0}function Nx(e){wx(e);let t=nx.decode(Ex(e,{singular:dx,descend:xx})),n=Object.entries(t).filter(([,e])=>e!==void 0);if(n.length!==1)throw n.length===0&&Mx(e)?new Dx:Error(`Invalid event`);let r=n[0],i=ux[r[0]];if(i===void 0)throw Error(`Invalid event`);let a=r[1],o=ox(a.baseEvent);if(!o)throw Error(`Invalid event`);let s=Gy[o.type];if(s!==i)throw Error(`Invalid event: envelope carries `+i+` but the base event declares `+String(s));if(a.type=i,a.timestamp=o.timestamp,a.rawEvent=o.rawEvent,o.metadata!==void 0&&(a.metadata=o.metadata),delete a.baseEvent,a.type===`MESSAGES_SNAPSHOT`&&Array.isArray(a.messages)&&(a.messages=a.messages.map(_x).filter(e=>e!==void 0)),a.type===`RUN_FINISHED`){let e=a,t=typeof e.outcome==`string`&&e.outcome!==``?e.outcome:void 0,n={};n.pendingToolCallIds=e.pendingToolCallIds,delete e.pendingToolCallIds,n.interrupts=e.interrupts,delete e.interrupts,delete e.outcome,t===void 0&&(sx(n.pendingToolCallIds).length>0&&(e.pendingToolCallIds=n.pendingToolCallIds),sx(n.interrupts).length>0&&(e.interrupts=n.interrupts)),t===`success`&&(e.outcome={type:`success`,...sx(n.pendingToolCallIds).length>0?{pendingToolCallIds:n.pendingToolCallIds}:{},...sx(n.interrupts).length>0?{interrupts:n.interrupts}:{}}),t===`interrupt`&&(e.outcome={type:`interrupt`,interrupts:sx(n.interrupts),...sx(n.pendingToolCallIds).length>0?{pendingToolCallIds:n.pendingToolCallIds}:{}}),t===`cancelled`&&(e.outcome={type:`cancelled`,...sx(n.pendingToolCallIds).length>0?{pendingToolCallIds:n.pendingToolCallIds}:{},...sx(n.interrupts).length>0?{interrupts:n.interrupts}:{}}),t!==void 0&&![`success`,`interrupt`,`cancelled`].includes(t)&&(e.outcome={type:t,...sx(n.pendingToolCallIds).length>0?{pendingToolCallIds:n.pendingToolCallIds}:{},...sx(n.interrupts).length>0?{interrupts:n.interrupts}:{}})}if(a.type===`SUBAGENT_FINISHED`){let e=a,t=typeof e.outcome==`string`&&e.outcome!==``?e.outcome:void 0,n={};n.interruptIds=e.interruptIds,delete e.interruptIds,delete e.outcome,t===void 0&&sx(n.interruptIds).length>0&&(e.interruptIds=n.interruptIds),t===`success`&&(e.outcome={type:`success`,...sx(n.interruptIds).length>0?{interruptIds:n.interruptIds}:{}}),t===`suspended`&&(e.outcome={type:`suspended`,...sx(n.interruptIds).length>0?{interruptIds:n.interruptIds}:{}}),t!==void 0&&![`success`,`suspended`].includes(t)&&(e.outcome={type:t,...sx(n.interruptIds).length>0?{interruptIds:n.interruptIds}:{}})}if(a.type===`STATE_DELTA`&&Array.isArray(a.delta)&&(a.delta=a.delta.map(e=>{let t=oy[e.op];return e.op=typeof t==`string`&&t!==`UNRECOGNIZED`?t.toLowerCase():String(e.op),Object.keys(e).forEach(t=>{e[t]===void 0&&delete e[t]}),e})),a.type===`ACTIVITY_DELTA`&&Array.isArray(a.patch)&&(a.patch=a.patch.map(e=>{let t=oy[e.op];return e.op=typeof t==`string`&&t!==`UNRECOGNIZED`?t.toLowerCase():String(e.op),Object.keys(e).forEach(t=>{e[t]===void 0&&delete e[t]}),e})),a.type===`RUN_FINISHED`&&Array.isArray(a.usage)&&a.usage.length===0&&delete a.usage,a.type===`RUN_ERROR`&&Array.isArray(a.usage)&&a.usage.length===0&&delete a.usage,a.type===`TOOL_CALL_RESULT`){let e=a;if(e.content!==void 0&&sx(e.contentParts).length>0)throw Error(`Invalid event: content carries both string content and content parts`);e.content===void 0&&(e.content=sx(e.contentParts).map(e=>{let t=px(e);return t===void 0&&lx(),t}).filter(e=>e!==void 0)),delete e.contentParts}return a.type===`RUN_STARTED`&&a.input!==void 0&&(a.input=yx(a.input)),vx(a),a}var Px=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Fx=e=>{if(typeof e!=`string`)throw TypeError(`Invalid argument expected string`);let t=e.match(Px);if(!t)throw Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Ix=e=>e===`*`||e===`x`||e===`X`,Lx=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},Rx=(e,t)=>typeof e==typeof t?[e,t]:[String(e),String(t)],zx=(e,t)=>{if(Ix(e)||Ix(t))return 0;let[n,r]=Rx(Lx(e),Lx(t));return n>r?1:n{for(let n=0;n{let n=Fx(e),r=Fx(t),i=n.pop(),a=r.pop(),o=Bx(n,r);return o===0?i&&a?Bx(i.split(`.`),a.split(`.`)):i||a?i?-1:1:0:o},Hx=e=>typeof e==`string`&&/^[v\d]/.test(e)&&Px.test(e),Ux=`@ag-ui/client`;function Wx(e){if(!e.metadata||!Object.prototype.hasOwnProperty.call(e.metadata,Ux))return;let t=e.metadata?.[Ux];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 $=e=>{if(typeof structuredClone==`function`)return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Gx(){return qi()}function Kx(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 qx(e){if(Object.freeze(e),typeof e==`object`&&e)for(let t of Object.values(e))typeof t==`object`&&t&&!Object.isFrozen(t)&&qx(t);return e}var Jx=524288;function Yx(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 Xx(e,t,n,r){let i=typeof process<`u`&&!0,a=i&&!!{}.VITEST_WORKER_ID,o=i&&!!{}.VITEST_WORKER_ID,s=o&&!Yx(t,n,Jx),c=s?$(t):t,l=s?$(n):n,u=!1,d=!1,f;for(let t of e)try{s&&(qx(c),qx(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=$(e.messages),u=!0,n=!0),e.state!==void 0&&e.state!==l&&(l=$(e.state),d=!0,n=!0),s&&n&&Yx(c,l,Jx)&&(s=!1),f=e.stopPropagation,f===!0)break}catch(e){if(a&&e instanceof TypeError)throw e;s&&o&&Kx(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)?$(c):c}:{},...d?{state:Object.isFrozen(l)?$(l):l}:{},...f===void 0?{}:{stopPropagation:f}}}function Zx(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 Qx(e){if(e instanceof $x)return e;if(e===!0)return new $x(Zx(!0))}var $x=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 eS(e){return e.enabled?new $x(e):void 0}function tS(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 nS(e,t){return!e||t.metadata===void 0?!1:(e.metadata=$i(e.metadata,$(t.metadata)),!0)}var rS=e=>typeof e==`object`&&e?e.role:void 0;function iS(e){if(rS(e)!==`assistant`)return[];let t=e.toolCalls;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e.id;typeof t==`string`&&n.push(t)}return n}function aS(e){let t=new Map,n=new Map,r=(e,t)=>{t.answered=!0,n.set(e,n.get(e)-1)},i=new Map,a=new Map,o=(e,t,n)=>{let r=e.get(t);r?r.push(n):e.set(t,[n])},s=-1;for(let c=0;c=0&&u[e].issuer===s;e--)u[e].answered||(d=u[e]);if(d){r(e,d);continue}n.get(e)>0&&o(i,e,c)}else if(u!==`activity`&&u!==`reasoning`){s=c;for(let e of iS(l))o(t,e,{issuer:c,answered:!1}),n.set(e,(n.get(e)??0)+1)}}let c=new Map,l=[],u=(e,t,n)=>{r(e,n),o(c,n.issuer,t),l[t]=!0};for(let[e,n]of i){let r=t.get(e),i=r.length-1;for(let t=n.length-1;t>=0;t--){let a=n[t];for(;i>=0&&(r[i].answered||r[i].issuer>=a);)i--;if(i<0)break;u(e,a,r[i])}}for(let[e,n]of a){let r=t.get(e);r?.length!==1||r[0].answered||u(e,n[0],r[0])}if(c.size===0)return e;for(let e of c.values())e.sort((e,t)=>e-t);let d=[],f,p=()=>{if(f){let t=d.length;for(let e=d.length-1;e>=0;e--){let n=d[e],r=rS(n);if(typeof n==`object`&&n&&r!==`activity`&&r!==`reasoning`)break;r===`reasoning`&&(t=e)}let n=d.splice(t);for(let t of f)d.push(e[t]);for(let e of n)d.push(e)}f=void 0};for(let t=0;te?.function?{...e,function:{...e.function}}:{...e})),t}function sS(e,t,n){let r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let i of r){let r=i===`content`?n:e[i],a=t[i];if(i===`toolCalls`&&Array.isArray(r)&&Array.isArray(a)){if(!cS(r,a))return!1}else if(r!==a)return!1}return!0}function cS(e,t){if(e.length!==t.length)return!1;for(let n=0;n{let a=Qx(i),o=$(n.messages),s=$(e.state),c={},l=new Set,u=new Set,d=[],f=new Set,p=e=>{let t=e.outcome?.type===`success`?e.outcome.pendingToolCallIds:void 0;return t!==void 0&&t.length>0?[...t]:d.filter(e=>!f.has(e))},m=e=>{e.messages!==void 0&&(o=e.messages,c.messages=e.messages),e.state!==void 0&&(s=e.state,c.state=e.state)},h=new WeakMap,g=e=>e.map(e=>{let t=h.get(e);if(t!==void 0&&sS(t.copy,e,t.content))return t.copy;let n=oS(e);return h.set(e,{copy:n,content:e.content}),n}),_=()=>{let e={};return c.messages!==void 0&&(e.messages=g(c.messages)),c.state!==void 0&&(e.state=$(c.state)),c={},e.messages!==void 0||e.state!==void 0?_s(e):zo};return t.pipe(Os(async t=>{let i=await Xx(r,o,s,(r,i,a)=>r.onEvent?.({event:t,agent:n,input:e,messages:i,state:a}));if(m(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 _();switch(t.type){case j.TEXT_MESSAGE_START:{let i=await Xx(r,o,s,(r,i,a)=>r.onTextMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(m(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`),_();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=nS(s,t);(!a||c)&&m({messages:o})}return _()}case j.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}'`),_();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`),_();let l=await Xx(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 m(l),l.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,nS(c,t),m({messages:o})),_()}case j.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}'`),_();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`),_();let c=await Xx(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 m(c),c.stopPropagation!==!0&&nS(a,t)&&m({messages:o}),await Promise.all(r.map(t=>t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e}))),_()}case j.TOOL_CALL_START:{let i=await Xx(r,o,s,(r,i,a)=>r.onToolCallStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(m(i),i.stopPropagation!==!0){let{toolCallId:e,toolCallName:n,parentMessageId:r,subagentRunId:i}=t;d.includes(e)||d.push(e);let a=o.find(t=>t.toolCalls?.some(t=>t.id===e))?.toolCalls?.find(t=>t.id===e);if(l.has(e)||(l.add(e),a&&u.add(e)),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),(nS(a,t)||r)&&m({messages:o}),_()}let s=new Set(o.map(e=>e.id)),c=tS(o,r,e);!s.has(c.id)&&i!=null&&c.subagentRunId===void 0&&(c.subagentRunId=i),c.toolCalls??=[];let f={id:e,type:`function`,function:{name:n,arguments:``}};c.toolCalls.push(f),nS(f,t),m({messages:o})}return _()}case j.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}'`),_();let l=c.toolCalls?.find(e=>e.id===i);if(!l)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${i}'`),_();let d=await Xx(r,o,s,(r,a,o)=>{let s=u.has(i)?``:l.function.arguments,c=l.function.name,d={};try{d=Ls(s)}catch{}return r.onToolCallArgsEvent?.({event:t,messages:a,state:o,agent:n,input:e,toolCallBuffer:s,toolCallName:c,partialToolCallArgs:d})});return m(d),d.stopPropagation!==!0&&(u.delete(i)?l.function.arguments=a:l.function.arguments+=a,nS(l,t),m({messages:o})),_()}case j.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}'`),_();let c=a.toolCalls?.find(e=>e.id===i);if(!c)return console.warn(`TOOL_CALL_END: No tool call found with ID '${i}'`),_();let d=await Xx(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 m(d),d.stopPropagation!==!0&&(l.delete(i),u.delete(i)),d.stopPropagation!==!0&&nS(c,t)&&m({messages:o}),await Promise.all(r.map(t=>t.onNewToolCall?.({toolCall:c,messages:o,state:s,agent:n,input:e}))),_()}case j.TOOL_CALL_RESULT:{let i=await Xx(r,o,s,(r,i,a)=>r.onToolCallResultEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(m(i),i.stopPropagation!==!0){let{messageId:i,toolCallId:a,content:c,role:l,subagentRunId:u}=t;f.add(a);let d=o.findIndex(e=>e.id===i&&e.role===`tool`&&e.toolCallId===a),p={...d===-1?{}:o[d],id:i,toolCallId:a,role:l||`tool`,content:c,...u!=null&&{subagentRunId:u}};if(u??delete p.subagentRunId,nS(p,t),d!==-1)o[d]=p;else{let t=-1,i=-1,c=!1;for(let e=o.length-1;e>=0;e--){let n=o[e];if(rS(n)===`tool`&&n.toolCallId===a)c=!0;else if(iS(n).includes(a)){if(i===-1&&(i=e),!c){t=e;break}c=!1}}if(t===-1&&(t=i),t===-1)o.push(p);else{let e=t+1;for(;et.onNewMessage?.({message:p,messages:o,state:s,agent:n,input:e})))}m({messages:o})}return _()}case j.STATE_SNAPSHOT:{let i=await Xx(r,o,s,(r,i,a)=>r.onStateSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(m(i),i.stopPropagation!==!0){let{snapshot:e}=t;s=$(e),m({state:s})}return _()}case j.STATE_DELTA:{let i=await Xx(r,o,s,(r,i,a)=>r.onStateDeltaEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(m(i),i.stopPropagation!==!0){let{delta:e}=t;try{s=Ia.applyPatch(s,$(e),!0,!1).newDocument,m({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 _()}case j.MESSAGES_SNAPSHOT:{let i=await Xx(r,o,s,(r,i,a)=>r.onMessagesSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(m(i),i.stopPropagation!==!0){let e=$(t.messages).map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}),n=new Map(e.map(e=>[e.id,e])),r=Wx(t),i=e.some(e=>e.role===`activity`),a=e.some(e=>e.role===`reasoning`),s=e=>e.role===`activity`&&(r?!r.includes(e.activityType):r!==null&&!i)||e.role===`reasoning`&&!a;o=o.filter(e=>n.has(e.id)||s(e)).map(e=>n.get(e.id)??e);let c=new Set(o.map(e=>e.id));for(let t of e)c.has(t.id)||o.push(t);o=aS(o),m({messages:o})}return _()}case j.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 Xx(r,o,s,(t,r,a)=>t.onActivitySnapshotEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:l,existingMessage:c}));if(m(d),d.stopPropagation!==!0){let t={id:i.messageId,role:`activity`,activityType:i.activityType,content:$(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:$(i.content),subagentRunId:i.subagentRunId},i.subagentRunId??delete o[a].subagentRunId),d=o[a]):u&&(o[a]=t,c=t,d=t),nS(d,i),m({messages:o}),c&&await Promise.all(r.map(t=>t.onNewMessage?.({message:c,messages:o,state:s,agent:n,input:e})))}return _()}case j.ACTIVITY_DELTA:{let i=t,a=o.findIndex(e=>e.id===i.messageId);if(a===-1)return _();let c=o[a];if(c.role!==`activity`)return console.warn(`ACTIVITY_DELTA: Message '${i.messageId}' is not an activity message`),_();let l=c,u=await Xx(r,o,s,(t,r,a)=>t.onActivityDeltaEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:l}));if(m(u),u.stopPropagation!==!0)try{nS(l,i)&&m({messages:o});let e=$(l.content??{}),t=Ia.applyPatch(e,i.patch??[],!0,!1).newDocument;o[a]={...l,content:$(t),activityType:i.activityType},m({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 _()}case j.RAW:return m(await Xx(r,o,s,(r,i,a)=>r.onRawEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),_();case j.CUSTOM:return m(await Xx(r,o,s,(r,i,a)=>r.onCustomEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),_();case j.RUN_STARTED:{let i=await Xx(r,o,s,(r,i,a)=>r.onRunStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(m(i),d=[],f=new Set,i.stopPropagation!==!0){l.clear(),u.clear();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)}m({messages:o})}}return _()}case j.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:p(i)},c=await Xx(r,o,s,(t,r,i)=>t.onRunFinishedEvent?.({...a,messages:r,state:i,agent:n,input:e}));return m(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}):[]),_()}case j.RUN_ERROR:return m(await Xx(r,o,s,(r,i,a)=>r.onRunErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),_();case j.STEP_STARTED:return m(await Xx(r,o,s,(r,i,a)=>r.onStepStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),_();case j.STEP_FINISHED:return m(await Xx(r,o,s,(r,i,a)=>r.onStepFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),_();case j.TEXT_MESSAGE_CHUNK:throw Error(`TEXT_MESSAGE_CHUNK must be transformed before being applied`);case j.TOOL_CALL_CHUNK:throw Error(`TOOL_CALL_CHUNK must be transformed before being applied`);case j.REASONING_START:return m(await Xx(r,o,s,(r,i,a)=>r.onReasoningStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),_();case j.REASONING_MESSAGE_START:{let i=await Xx(r,o,s,(r,i,a)=>r.onReasoningMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(m(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`),_();let i=r;if(!i){let t={id:e,role:`reasoning`,content:``,...n!=null&&{subagentRunId:n}};o.push(t),i=t}let a=nS(i,t);(!r||a)&&m({messages:o})}return _()}case j.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}'`),_();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`),_();let l=await Xx(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 m(l),l.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,nS(c,t),m({messages:o})),_()}case j.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}'`),_();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`),_();let c=await Xx(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 m(c),c.stopPropagation!==!0&&nS(a,t)&&m({messages:o}),await Promise.all(r.map(t=>t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e}))),_()}case j.REASONING_MESSAGE_CHUNK:throw Error(`REASONING_MESSAGE_CHUNK must be transformed before being applied`);case j.REASONING_END:return m(await Xx(r,o,s,(r,i,a)=>r.onReasoningEndEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),_();case j.REASONING_ENCRYPTED_VALUE:{let{subtype:i,entityId:a,encryptedValue:l}=t,u=await Xx(r,o,s,(r,i,a)=>r.onReasoningEncryptedValueEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(m(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 _()}case j.SUBAGENT_STARTED:return m(await Xx(r,o,s,(r,i,a)=>r.onSubagentStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),_();case j.SUBAGENT_FINISHED:return m(await Xx(r,o,s,(r,i,a)=>r.onSubagentFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),_();case j.SUBAGENT_ERROR:return m(await Xx(r,o,s,(r,i,a)=>r.onSubagentErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),_()}return t.type,_()}),Cs(),r.length>0?js({}):e=>e)};function uS(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 dS=e=>t=>{let n=Qx(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 M(`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 M(`Cannot send '${e}': subagentRunId '${t}' does not match the ${r} '${i}' opener's subagent '${n.subagentRunId??`(the parent agent)`}'.`)};return t.pipe(Ss(e=>{let t=e.type;if(n?.event(`VERIFY`,`Event:`,e,{type:e.type}),l&&t!==j.RUN_STARTED)return F(()=>new M(`Cannot send event type '${t}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(c&&t!==j.RUN_ERROR&&t!==j.RUN_STARTED)return F(()=>new M(`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!==j.RUN_STARTED&&t!==j.RUN_ERROR)return F(()=>new M(`First event must be 'RUN_STARTED'`))}else if(t===j.RUN_STARTED){if(g&&!c&&!l)return F(()=>new M(`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,uS(`subagentRunId: null`,`an absent field`));let{subagentRunId:t,...n}=e;e=n}if(t===j.SUBAGENT_STARTED||t===j.SUBAGENT_FINISHED||t===j.SUBAGENT_ERROR){let n=t===j.SUBAGENT_STARTED?[`description`,`parentSubagentRunId`,`parentToolCallId`,`parentMessageId`]:t===j.SUBAGENT_FINISHED?[`outcome`]:[`code`];for(let r of n)if(e[r]===null)return F(()=>new M(`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 F(()=>new M(`Cannot send '${t}' with outcome type '${String(r.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(r&&r.interruptIds===null)return F(()=>new M(`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 F(()=>new M(`Cannot send '${t}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(t===j.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 F(()=>new M(`Cannot send 'RUN_FINISHED' with an interrupt (id '${e.id}') carrying 'subagentRunId: null'. The field is optional — omit it entirely.`))}}switch(t){case j.TEXT_MESSAGE_START:{let n=e.messageId;if(r.has(n))return F(()=>new M(`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 F(()=>r)}return r.add(n),i||s.message.set(n,{subagentRunId:e.subagentRunId}),_s(e)}case j.TEXT_MESSAGE_CONTENT:{let n=e.messageId;if(!r.has(n))return F(()=>new M(`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?F(()=>i):_s(e)}case j.TEXT_MESSAGE_END:{let n=e.messageId;if(!r.has(n))return F(()=>new M(`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?F(()=>i):(r.delete(n),_s(e))}case j.TOOL_CALL_START:{let n=e.toolCallId;if(i.has(n))return F(()=>new M(`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 F(()=>new M(`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 F(()=>e);if(a===void 0&&o&&o.subagentRunId!==c.subagentRunId)return F(()=>new M(`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}),_s(e)}case j.TOOL_CALL_ARGS:{let n=e.toolCallId;if(!i.has(n))return F(()=>new M(`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?F(()=>r):_s(e)}case j.TOOL_CALL_END:{let n=e.toolCallId;if(!i.has(n))return F(()=>new M(`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?F(()=>r):(i.delete(n),_s(e))}case j.STEP_STARTED:{let t=e.stepName,n=e.subagentRunId;return f(n).has(t)?F(()=>new M(`Step "${t}" is already active for 'STEP_STARTED'${n===void 0?``:` in subagent '${n}'`}`)):(f(n).set(t,!0),_s(e))}case j.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 F(r?()=>new M(`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 M(`Cannot send 'STEP_FINISHED' for step "${t}" that was not started`))}return f(n).delete(t),_s(e)}case j.ACTIVITY_SNAPSHOT:{let t=e.messageId;return(!s.activity.has(t)||e.replace!==!1)&&s.activity.set(t,{subagentRunId:e.subagentRunId}),_s(e)}case j.TOOL_CALL_RESULT:{let t=e.messageId;return typeof t==`string`&&s.message.set(t,{subagentRunId:e.subagentRunId}),_s(e)}case j.REASONING_START:case j.REASONING_MESSAGE_START:{let n=e.messageId,r=t===j.REASONING_START,i=r?a:o;if(i.has(n))return F(()=>new M(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 F(()=>r)}return i.add(n),c||s.reasoning.set(n,{subagentRunId:e.subagentRunId}),_s(e)}case j.REASONING_MESSAGE_CONTENT:case j.REASONING_MESSAGE_END:case j.REASONING_END:{let n=e.messageId,r=t===j.REASONING_END,i=r?a:o;if(!i.has(n))return F(()=>new M(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?F(()=>c):((t===j.REASONING_END||t===j.REASONING_MESSAGE_END)&&i.delete(n),_s(e))}case j.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?F(()=>o):_s(e)}case j.ACTIVITY_DELTA:{let n=e.messageId,r=b(t,e.subagentRunId,s.activity.get(n),`activity`,n);return r?F(()=>r):_s(e)}case j.SUBAGENT_STARTED:{if(typeof e.subagentRunId!=`string`)return F(()=>new M(`Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'.`));if(typeof e.name!=`string`)return F(()=>new M(`Cannot send 'SUBAGENT_STARTED' without a 'name'.`));let t=e.subagentRunId,n=e.parentSubagentRunId;return m.has(t)?F(()=>new M(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):h.has(t)?F(()=>new M(`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)?F(()=>new M(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${n}' has not been started in this run.`)):(m.set(t,!0),_s(e))}case j.SUBAGENT_FINISHED:case j.SUBAGENT_ERROR:{if(typeof e.subagentRunId!=`string`)return F(()=>new M(`Cannot send '${t}' without a 'subagentRunId'.`));if(t===j.SUBAGENT_ERROR&&typeof e.message!=`string`)return F(()=>new M(`Cannot send 'SUBAGENT_ERROR' without a 'message'.`));let n=e.subagentRunId;return m.has(n)?(m.delete(n),h.add(n),_s(e)):F(()=>new M(`Cannot send '${t}': no active subagent found with ID '${n}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case j.MESSAGES_SNAPSHOT:{let t=y(e.messages,!0);if(t)return F(()=>t)}return _s(e);case j.RUN_STARTED:g=!0;{let t=y((e.input??{}).messages,!1);if(t)return F(()=>t)}return _s(e);case j.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 F(()=>new M(`Cannot send 'RUN_FINISHED' while steps are still active: ${t}`))}if(r.size>0){let e=Array.from(r.keys()).join(`, `);return F(()=>new M(`Cannot send 'RUN_FINISHED' while text messages are still active: ${e}`))}if(o.size>0){let e=Array.from(o.keys()).join(`, `);return F(()=>new M(`Cannot send 'RUN_FINISHED' while reasoning messages are still active: ${e}`))}if(a.size>0){let e=Array.from(a.keys()).join(`, `);return F(()=>new M(`Cannot send 'RUN_FINISHED' while reasoning spans are still active: ${e}`))}if(i.size>0){let e=Array.from(i.keys()).join(`, `);return F(()=>new M(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${e}`))}if(m.size>0){let e=Array.from(m.keys()).join(`, `);return F(()=>new M(`Cannot send 'RUN_FINISHED' while subagents are still active: ${e}`))}return c=!0,_s(e);case j.RUN_ERROR:return l=!0,_s(e);case j.CUSTOM:return _s(e);default:return _s(e)}}))},fS=function(e){return e.HEADERS=`headers`,e.DATA=`data`,e}({}),pS=e=>Ts(()=>gs(e())).pipe(Ns(e=>{if(!e.ok){let t=e.headers.get(`content-type`)||``;return gs(e.text()).pipe(Ss(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,F(()=>i)}))}let t={type:fS.HEADERS,status:e.status,headers:e.headers},n=e.body?.getReader();return n?new Eo(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:fS.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)})}}):F(()=>Error(`Failed to getReader() from response`))})),mS=10485760,hS=(e,t)=>{let n=Qx(t),r=new Fo,i=new TextDecoder(`utf-8`,{fatal:!1}),a=``;e.subscribe({next:e=>{if(e.type!==fS.HEADERS&&e.type===fS.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>mS){r.error(Error(`SSE buffer size exceeded maximum limit of ${mS/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()},gS=10485760,_S=()=>typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS,vS=(e,t)=>{let n=Qx(t),r=new Fo,i=new Uint8Array,a=!1;e.subscribe({next:e=>{if(e.type!==fS.HEADERS&&e.type===fS.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>gS){r.error(Error(`Protobuf message size exceeded maximum limit of ${gS/1048576} MB`));return}if(i.length{let n=Qx(t),r=new Fo,i=new Ro(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===fS.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`?vS(i,n).subscribe({next:e=>r.next(e),error:e=>l(e),complete:()=>u()}):hS(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:j.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()},bS={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`},xS=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 SS(e,t){return ta(t)&&CS(`[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.`),ea(t)}var CS=e=>{typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(e)},wS=(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(Ss(r=>{switch(r.type){case j.TEXT_MESSAGE_START:{let e=r;return[{type:bS.TextMessageStart,messageId:e.messageId,role:e.role}]}case j.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:bS.TextMessageContent,messageId:e.messageId,content:e.delta}]}case j.TEXT_MESSAGE_END:{let e=r;return[{type:bS.TextMessageEnd,messageId:e.messageId}]}case j.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:bS.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case j.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return CS(`[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(Ls(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:bS.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...f?[{type:bS.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case j.TOOL_CALL_END:{let e=r;return[{type:bS.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case j.TOOL_CALL_RESULT:{let e=r,t=d[e.toolCallId];return(t===void 0||t===``)&&CS(`[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:bS.ActionExecutionResult,actionExecutionId:e.toolCallId,result:SS(e.toolCallId,e.content),actionName:t||`unknown`}]}case j.RAW:return f||(f=!0,CS(`[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 j.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:bS.MetaEvent,name:e.name,value:e.value}]}case j.STATE_SNAPSHOT:return p(r.snapshot),[{type:bS.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case j.STATE_DELTA:{let c=r,l;try{l=Ia.applyPatch(i,c.delta,!0,!1).newDocument}catch(e){let t=e instanceof Error?e.message:String(e);return CS(`[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:bS.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]}case j.MESSAGES_SNAPSHOT:return c=r.messages,[{type:bS.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case j.RUN_STARTED:return[];case j.RUN_FINISHED:{if(c&&(i.messages=c),Object.keys(i).length===0)return[];let r=null;if(c)try{r=TS(c)}catch(e){return[{type:bS.RunError,message:e.message}]}return[{type:bS.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...r?{messages:r}:{}}),active:!1}]}case j.RUN_ERROR:{let e=r;return[{type:bS.RunError,message:e.message,code:e.code}]}case j.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:bS.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case j.STEP_FINISHED:return u=[],l=null,[{type:bS.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function TS(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=xS(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:SS(n.toolCallId,n.content),actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var ES=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,DS=e=>e===`tool`?`toolCallId`:`messageId`,OS=(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}'`}.`)},kS=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},AS=(e,t)=>{let n=kS(e,t);return t.rawEvent===void 0?n:{...n,rawEvent:t.rawEvent}},jS=e=>new Set(Object.keys(e.shape)),MS=jS(__),NS=jS(x_),PS=jS(iv),FS=(e,t)=>{let n;for(let r of Object.keys(e))t.has(r)||((n??={})[r]=e[r]);return n},IS=e=>{typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][transform] ${e} Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)},LS=(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&&IS(`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}},RS=e=>t=>{let n=Qx(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:j.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:j.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:j.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&&ES(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 ${DS(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(Ss(e=>{switch(e.type){case j.TEXT_MESSAGE_START:case j.TEXT_MESSAGE_CONTENT:case j.TEXT_MESSAGE_END:case j.TOOL_CALL_START:case j.TOOL_CALL_ARGS:case j.TOOL_CALL_END:case j.TOOL_CALL_RESULT:case j.STATE_SNAPSHOT:case j.STATE_DELTA:case j.CUSTOM:case j.STEP_STARTED:case j.STEP_FINISHED:case j.REASONING_START:case j.REASONING_MESSAGE_START:case j.REASONING_MESSAGE_CONTENT:case j.REASONING_MESSAGE_END:case j.REASONING_END:return[...i(e.subagentRunId??void 0),e];case j.RUN_STARTED:case j.RUN_FINISHED:case j.RUN_ERROR:case j.MESSAGES_SNAPSHOT:return[...a(),e];case j.RAW:case j.ACTIVITY_SNAPSHOT:case j.ACTIVITY_DELTA:case j.REASONING_ENCRYPTED_VALUE:case j.SUBAGENT_STARTED:return[e];case j.SUBAGENT_FINISHED:case j.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case j.TEXT_MESSAGE_CHUNK:{let t=e,a=FS(e,MS),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))OS(`text message`,c.fields.messageId,`role`,t.role,c.fields.role),OS(`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=kS({type:j.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=AS({...a,type:j.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:j.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 LS(l,a,u,`TEXT_MESSAGE_CHUNK`),l}case j.TOOL_CALL_CHUNK:{let t=e,a=FS(e,NS),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))OS(`tool call`,c.fields.toolCallId,`toolCallName`,t.toolCallName,c.fields.toolCallName),OS(`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=kS({type:j.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=AS({...a,type:j.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:j.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 LS(l,a,u,`TOOL_CALL_CHUNK`),l}case j.REASONING_MESSAGE_CHUNK:{let t=e,a=FS(e,PS),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=kS({type:j.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=AS({...a,type:j.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:j.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 LS(l,a,u,`REASONING_MESSAGE_CHUNK`),l}}return e.type,[e]}),Ms(()=>{a()}))},zS=1e6;function BS(e){if(e===void 0)return zS;if(e===1/0||Number.isSafeInteger(e)&&e>0)return e;throw new M(`Invalid enforcement entry budget ${String(e)}: expected a positive integer, or Infinity to disable it.`)}var VS=class extends M{constructor(e,t){super(`Enforcement limit exceeded at '${t||`(root)`}': the payload has more than ${e} entries to validate. If it is legitimate, raise or disable the limit (maxEnforcedEntries on the agent, or maxEntries in the enforcement options).`),this.name=`AGUIEnforcementLimitError`,this.limit=e,this.path=t}},HS=Symbol(`agui.strip.drop`);function US(e,t,n){if(e.used+=t,e.used>e.max)throw new VS(e.max,n)}function WS(e){let t=e;for(;;){if(t instanceof Bg||t instanceof Wg||t instanceof Kg||t instanceof r_||t instanceof Qg){t=t.unwrap();continue}if(t instanceof e_){t=t.def.in;continue}if(t instanceof a_){t=t.def.getter();continue}return t}}function GS(e){let t=e.def;return typeof t?.discriminator==`string`?t.discriminator:void 0}function KS(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 qS(e){let t=WS(e);return t instanceof Lg?KS(t):void 0}function JS(e,t,n,r,i){let a=WS(t);if(a instanceof Tg){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t=a.shape,o=e,s={},c=a.meta()?.specOpen===!0,l=Object.keys(o);US(i,l.length,n);for(let e of l){let a=Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;if(a===void 0){if(c){s[e]=o[e];continue}r.push(`${n}/${e}`);continue}let l=r.length,u=JS(o[e],a,`${n}/${e}`,r,i);if(u===HS){if(r.length=l,a.safeParse(void 0).success){r.push(`${n}/${e}`);continue}return HS}s[e]=u}return s}if(a instanceof Cg){if(!Array.isArray(e))return e;US(i,e.length,n);let t=a.element,o=[];return e.forEach((e,a)=>{let s=r.length,c=JS(e,t,`${n}/${a}`,r,i);if(c===HS){r.length=s,r.push(`${n}/${a}`);return}o.push(c)}),o}if(a instanceof Ng){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t=a.def.valueType,o=e,s={},c=Object.keys(o);US(i,c.length,n);for(let e of c){let a=r.length,c=JS(o[e],t,`${n}/${e}`,r,i);if(c===HS){r.length=a,r.push(`${n}/${e}`);continue}s[e]=c}return s}if(a instanceof Dg){let t=a.options,o=GS(a);if(o!==void 0){if(typeof e!=`object`||!e||Array.isArray(e))return e;let a=e[o];for(let s of t){let t=WS(s);if(!(t instanceof Tg))continue;let c=t.shape;if(qS(c[o])===a)return JS(e,s,n,r,i)}return HS}let s=t.filter(e=>WS(e)instanceof Tg),c=typeof e==`object`&&!!e&&!Array.isArray(e);if(s.length>1&&c)return e;for(let a of t){let t=WS(a);if(t instanceof Cg&&Array.isArray(e)||t instanceof Tg&&c)return JS(e,a,n,r,i)}return e}return e}function YS(e,t,n){let r=[],i=JS(e,t,``,r,{used:0,max:BS(n?.maxEntries)});if(i===HS)throw Error(`Internal error: the stripper found the whole value unrecognisable, which the schemas are not supposed to allow — schema/stripper mismatch.`);return{value:i,stripped:r}}var XS=new Set(Object.values(j));function ZS(e){return XS.has(e.type)}var QS=new Map(uv.options.map(e=>{let t=e.shape;return[String(KS(t.type)),e]})),$S=()=>typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS;function eC(e){$S()||console.warn(`[ag-ui][enforce] ${e}`)}var tC=(e,t)=>{let n=BS(t?.maxEntries);return t=>{let r=Qx(e);return t.pipe(Ss(e=>{if(!ZS(e)){eC(`Dropping unrecognised event '${String(e.type)}': no middleware translated it and the protocol does not describe it.`);let t={type:e.type};return r?.event(`ENFORCE`,`Unrecognised event dropped:`,t,t),zo}let t=QS.get(e.type);if(t===void 0)throw Error(`No validator for recognised event type '${String(e.type)}'`);let{value:i,stripped:a}=YS(e,t,{maxEntries:n});for(let t of a)eC(`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 _s(t.parse(i))}))}};function nC(e,t){let n=BS(t?.maxEntries),{value:r,stripped:i}=YS(Zi(e,`RunAgentInput`),W_,{maxEntries:n});for(let e of i)eC(`Removed unrecognised material at '${e}' from the outgoing input.`);return W_.parse(r)}var rC=class{runNext(e,t){return t.run(e).pipe(RS(!1))}runNextWithState(e,t){let n=$(e.messages||[]),r=$(e.state===void 0?{}:e.state),i=new Ro;return lS(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(Os(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:$(n),state:$(r)})))}},iC=class extends rC{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function aC(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function oC(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function sC(e){let t=aC(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 cC(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 lC(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.flatMap(e=>{if(oC(e)){let n=sC(e);return n.type!==`binary`&&t.some(t=>cC(t,n,e.filename))?[]:[n]}return[e]});return{...e,content:n}}var uC=`THINKING_START`,dC=`THINKING_END`,fC=`THINKING_TEXT_MESSAGE_START`,pC=`THINKING_TEXT_MESSAGE_CONTENT`,mC=`THINKING_TEXT_MESSAGE_END`;function hC(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var gC={event:[`rawEvent`,`subagentRunId`],[j.RUN_STARTED]:[`parentRunId`,`input`],[j.RUN_FINISHED]:[`result`,`outcome`],[j.RUN_ERROR]:[`usage`],[j.SUBAGENT_FINISHED]:[`result`],[j.TOOL_CALL_START]:[`parentMessageId`],[j.TOOL_CALL_CHUNK]:[`parentMessageId`],[j.TOOL_CALL_RESULT]:[`role`],"RUN_FINISHED.outcome":[`pendingToolCallIds`],"RUN_FINISHED.usage[]":[`provider`,`reasoningTokens`,`cachedInputTokens`,`cacheWriteInputTokens`],RunAgentInput:[`forwardedProps`],Tool:[`parameters`],ResumeEntry:[`payload`],"input content":[`metadata`]},_C=new Map(Object.entries(gC).filter(([e])=>Object.values(j).includes(e))),vC=e=>uS(e,`an absent field`);function yC(e,t,n,r){if(!hC(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 bC(e,t,n){if(!hC(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 xC(e,t){return bC(e,`content`,e=>{if(!hC(e))return e;switch(e.type){case`image`:case`audio`:case`video`:case`document`:return yC(e,gC[`input content`],`${e.type} input content`,t);default:return e}})}function SC(e,t=vC){let n=yC(e,gC.RunAgentInput,`RunAgentInput`,t);return n=bC(n,`tools`,e=>yC(e,gC.Tool,`Tool`,t)),n=bC(n,`resume`,e=>yC(e,gC.ResumeEntry,`ResumeEntry`,t)),bC(n,`messages`,e=>xC(e,t))}var CC=class extends rC{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),uS(e,`an absent field`))}}warn(e,t){uS(e,t)}mintedContinuationId(e,t){if(t!==null)return t;let n=Gx();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(lC),t.run(e).pipe(bs(e=>this.transformEvent(e)))}transformEvent(e){let t=this.noticeNullOncePerRun;e.type===j.RUN_STARTED&&this.nullsNoticedThisRun.clear(),e=yC(e,gC.event,void 0,t);let n=_C.get(e.type);switch(n&&(e=yC(e,n,e.type,t)),e.type){case uC:{this.currentReasoningId=Gx();let{title:t,...n}=e;return this.warn(uC,j.REASONING_START),t!==void 0&&this.warnAside(`Dropping ${uC}.title ${JSON.stringify(t)}: ${j.REASONING_START} has no title field, so the span's label cannot be carried and nothing downstream can recover it.`),{...n,type:j.REASONING_START,messageId:this.currentReasoningId}}case fC:return this.currentMessageId=Gx(),this.warn(fC,j.REASONING_MESSAGE_START),{...e,type:j.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`reasoning`};case pC:{let{delta:t,...n}=e;return this.warn(pC,j.REASONING_MESSAGE_CONTENT),{...n,type:j.REASONING_MESSAGE_CONTENT,messageId:this.mintedContinuationId(pC,this.currentMessageId),delta:t}}case mC:{let t=this.mintedContinuationId(mC,this.currentMessageId);return this.currentMessageId=null,this.warn(mC,j.REASONING_MESSAGE_END),{...e,type:j.REASONING_MESSAGE_END,messageId:t}}case dC:{let t=this.mintedContinuationId(dC,this.currentReasoningId);return this.currentReasoningId=null,this.warn(dC,j.REASONING_END),{...e,type:j.REASONING_END,messageId:t}}case j.RUN_FINISHED:{let n=e,r=yC(n.outcome,gC[`RUN_FINISHED.outcome`],`RUN_FINISHED.outcome`,t);return bC(r===n.outcome?n:{...n,outcome:r},`usage`,e=>yC(e,gC[`RUN_FINISHED.usage[]`],`RUN_FINISHED.usage[]`,t))}case j.MESSAGES_SNAPSHOT:{let t=e;return Array.isArray(t.messages)?{...t,messages:t.messages.map(e=>this.upgradeInboundMessage(e))}:e}case j.RUN_STARTED:{let n=SC(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=xC(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`),lC(e))}},wC=()=>e=>Ts(()=>{let t=new CC;return e.pipe(bs(e=>t.transformEvent(e)))});function TC(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}function EC(){return typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS}function DC(e){EC()||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 OC(e){EC()||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 kC(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 OC(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&&DC(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 AC=class extends rC{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(kC)};return this.runNext(i,t)}},jC=`THINKING_START`,MC=`THINKING_END`,NC=`THINKING_TEXT_MESSAGE_START`,PC=`THINKING_TEXT_MESSAGE_CONTENT`,FC=`THINKING_TEXT_MESSAGE_END`,IC=class extends rC{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(bs(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case jC:{this.currentReasoningId=Gx();let{title:t,...n}=e;return this.warnAboutTransformation(jC,j.REASONING_START),{...n,type:j.REASONING_START,messageId:this.currentReasoningId}}case NC:return this.currentMessageId=Gx(),this.warnAboutTransformation(NC,j.REASONING_MESSAGE_START),{...e,type:j.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`reasoning`};case PC:{let{delta:t,...n}=e;return this.warnAboutTransformation(PC,j.REASONING_MESSAGE_CONTENT),{...n,type:j.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Gx(),delta:t}}case FC:{let t=this.currentMessageId??Gx();return this.warnAboutTransformation(FC,j.REASONING_MESSAGE_END),{...e,type:j.REASONING_MESSAGE_END,messageId:t}}case MC:{let t=this.currentReasoningId??Gx();return this.warnAboutTransformation(MC,j.REASONING_END),{...e,type:j.REASONING_END,messageId:t}}default:return e}}},LC=`SUBAGENT_STARTED`,RC=`SUBAGENT_FINISHED`,zC=`SUBAGENT_ERROR`;function BC(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function VC(e){return e.map(e=>BC(e))}var HC=class extends rC{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=>BC(e))};return this.runNext(n,t).pipe(Fs(e=>{let t=e.type;(t===LC||t===RC||t===zC)&&this.warnDroppedLifecycleEvent(t)}),Es(e=>{let t=e.type;return t!==LC&&t!==RC&&t!==zC}),bs(e=>{let t=BC(e);if(t.type===j.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:VC(e.messages)}}if(t.type===j.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>BC(e))}}}if(t.type===j.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:VC(e.input.messages)}}}return t}))}},UC=`1.0.4`,WC=!1,GC=new WeakSet,KC=(e,t)=>/^\d+\.\d+$/.test(e)?Vx(e,t)>0?`newer`:`not-newer`:`uninterpretable`,qC=e=>{let t=e.protocolVersion;if(t!==void 0&&t!==`1.0`)switch(KC(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}},JC=class e{resolvePeerCeiling(t){if(this.resolvingPeerCeiling)return UC;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 UC;let a=t===`maxProtocolVersion`?n:r;if(!a)return UC;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&&!WC&&(WC=!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=Zx(e),this._debugLogger=eS(this._debug)}get threadId(){return this._threadId??=qi()}set threadId(e){this._threadId=e}get maxEnforcedEntries(){return this._maxEnforcedEntries}set maxEnforcedEntries(e){this._maxEnforcedEntries=BS(e)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?eS(Zx(!0)):void 0:e}resolvedCeilingDuringConstruction(){let e=this.maxProtocolVersion;if(typeof e!=`string`||!Hx(e))throw new M(`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,maxEnforcedEntries:o}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.resolvingPeerCeiling=!1,this.agentId=e,this.description=t??``,this._threadId=n,this.messages=$(r??[]),this.state=$(i??{}),this._debug=Zx(a),this._debugLogger=eS(this._debug),this._maxEnforcedEntries=BS(o);let s=this.resolvedCeilingDuringConstruction();Vx(s,`0.0.39`)<=0&&this.middlewares.unshift(new AC),Vx(s,`0.0.45`)<=0&&this.middlewares.unshift(new IC),Vx(s,`0.0.57`)<=0&&this.middlewares.unshift(new HC)}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 iC(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??qi();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})=>qC(e),onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];GC.add(n),await this.onInitialize(n,a),this.activeRunDetach$=new Fo;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await ys(wo(()=>[...this.middlewares,new CC].reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),tC(this.debugLogger,{maxEntries:this.maxEnforcedEntries}),RS(this.debugLogger),dS(this.debugLogger),e=>e.pipe(Ps(this.activeRunDetach$)),e=>this.applyBeforeSourceError(n,e,a),Ds(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))),Ms(()=>{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}))(_s(null)));let s=$(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new Qi}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??qi();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunStartedEvent:({event:e})=>qC(e),onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new Fo;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await ys(wo(()=>Ts(()=>this.connect(n)),e=>tC(this.debugLogger,{maxEntries:this.maxEnforcedEntries})(wC()(e)),RS(this.debugLogger),dS(this.debugLogger),e=>e.pipe(Ps(this.activeRunDetach$)),e=>this.applyBeforeSourceError(n,e,a),Ds(e=>(this.isRunning=!1,e instanceof Qi?zo:this.onError(n,e,a))),Ms(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(_s(null)),{defaultValue:void 0});let s=$(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 Ts(()=>{let r,i=t.pipe(Ds(e=>(r={error:e},zo)));return this.processApplyEvents(e,this.apply(e,i,n),n).pipe(As(Ts(()=>{let e=r;return e?F(()=>e.error):zo})))})}apply(e,t,n){return lS(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(Fs(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=$(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=aS(t.filter(e=>e.role!==`activity`));return{threadId:this.threadId,runId:e?.runId||qi(),...Vx(this.maxProtocolVersion,UC)>=0&&{protocolVersion:`1.0`},tools:$(e?.tools??[]),context:$(e?.context??[]),forwardedProps:$(e?.forwardedProps??{}),state:$(this.state),messages:n,...e?.resume===void 0?{}:{resume:$(e.resume)}}}async onInitialize(e,t){if(GC.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 M(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let t of this.pendingInterrupts)if(TC(t)&&(e.resume??[]).find(e=>e.interruptId===t.id)?.status!==`cancelled`)throw new M(`Interrupt ${t.id} expired at ${t.expiresAt} and can no longer be answered. Cancel it to continue the thread.`)}let n=await Xx(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=aS(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 gs(Xx(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(bs(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 Xx(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=$(this.messages),e.state=$(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e._maxEnforcedEntries=this._maxEnforcedEntries,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=$(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=$(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=$(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??qi();let t=this.prepareRunAgentInput(e);return[...this.middlewares,new CC].reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t).pipe(tC(this.debugLogger,{maxEntries:this.maxEnforcedEntries}),RS(this.debugLogger),dS(this.debugLogger),wS(this.threadId,t.runId,this.agentId),e=>e.pipe(bs(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function YC(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 XC=class extends JC{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(YC(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=$(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return yS(pS(()=>this.fetch(this.url,this.requestInit(nC(e,{maxEntries:this.maxEnforcedEntries})))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=$(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}},ZC=class extends pn{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:$t(t,n.data),hasPreviousPage:dn(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},QC=class extends mn{#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||$C(),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=tn({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),gn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function $C(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ew=class extends rn{#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 QC({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=tw(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=tw(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=tw(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=tw(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){gn.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=>an(t,e))}findAll(e={}){return this.getAll().filter(t=>an(e,t))}notify(e){gn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return gn.batch(()=>Promise.all(e.map(e=>e.continue().catch(_n))))}};function tw(e){return e.options.scope?.id}var nw=class extends rn{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??on(r,t),a=this.get(i);return a||(a=new sn({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(){gn.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=>Qt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Qt(e,t)):t}notify(e){gn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){gn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){gn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},rw=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new nw,this.#t=e.mutationCache||new ew,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=nn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=cn.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(en(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=fn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return gn.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;gn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return gn.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=gn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(_n).catch(_n)}invalidateQueries(e,t={}){return gn.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=gn.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(_n)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(_n)}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(en(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(en(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_n).catch(_n)}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(_n).catch(_n)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return cn.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(ln(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{yn(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ln(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{yn(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||=on(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===Xt&&(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()}};function iw(e,t){return un(e,ZC,t)}var aw=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M225.29,165.93C216.61,151,212,129.57,212,104a84,84,0,0,0-168,0c0,25.58-4.59,47-13.27,61.93A20.08,20.08,0,0,0,30.66,186,19.77,19.77,0,0,0,48,196H84.18a44,44,0,0,0,87.64,0H208a19.77,19.77,0,0,0,17.31-10A20.08,20.08,0,0,0,225.29,165.93ZM128,212a20,20,0,0,1-19.6-16h39.2A20,20,0,0,1,128,212ZM54.66,172C63.51,154,68,131.14,68,104a60,60,0,0,1,120,0c0,27.13,4.48,50,13.33,68Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M208,192H48a8,8,0,0,1-6.88-12C47.71,168.6,56,139.81,56,104a72,72,0,0,1,144,0c0,35.82,8.3,64.6,14.9,76A8,8,0,0,1,208,192Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M221.8,175.94C216.25,166.38,208,139.33,208,104a80,80,0,1,0-160,0c0,35.34-8.26,62.38-13.81,71.94A16,16,0,0,0,48,200H88.81a40,40,0,0,0,78.38,0H208a16,16,0,0,0,13.8-24.06ZM128,216a24,24,0,0,1-22.62-16h45.24A24,24,0,0,1,128,216ZM48,184c7.7-13.24,16-43.92,16-80a64,64,0,1,1,128,0c0,36.05,8.28,66.73,16,80Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M221.8,175.94C216.25,166.38,208,139.33,208,104a80,80,0,1,0-160,0c0,35.34-8.26,62.38-13.81,71.94A16,16,0,0,0,48,200H88.81a40,40,0,0,0,78.38,0H208a16,16,0,0,0,13.8-24.06ZM128,216a24,24,0,0,1-22.62-16h45.24A24,24,0,0,1,128,216Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220.07,176.94C214.41,167.2,206,139.73,206,104a78,78,0,1,0-156,0c0,35.74-8.42,63.2-14.08,72.94A14,14,0,0,0,48,198H90.48a38,38,0,0,0,75,0H208a14,14,0,0,0,12.06-21.06ZM128,218a26,26,0,0,1-25.29-20h50.58A26,26,0,0,1,128,218Zm81.71-33a1.9,1.9,0,0,1-1.7,1H48a1.9,1.9,0,0,1-1.7-1,2,2,0,0,1,0-2C53.87,170,62,139.69,62,104a66,66,0,1,1,132,0c0,35.68,8.14,65.95,15.71,79A2,2,0,0,1,209.71,185Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M221.8,175.94C216.25,166.38,208,139.33,208,104a80,80,0,1,0-160,0c0,35.34-8.26,62.38-13.81,71.94A16,16,0,0,0,48,200H88.81a40,40,0,0,0,78.38,0H208a16,16,0,0,0,13.8-24.06ZM128,216a24,24,0,0,1-22.62-16h45.24A24,24,0,0,1,128,216ZM48,184c7.7-13.24,16-43.92,16-80a64,64,0,1,1,128,0c0,36.05,8.28,66.73,16,80Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M218.35,178C212.58,168,204,140.13,204,104a76,76,0,1,0-152,0c0,36.13-8.59,64-14.36,73.95A12,12,0,0,0,48,196H92.23a36,36,0,0,0,71.54,0H208A12,12,0,0,0,218.35,178ZM128,220a28,28,0,0,1-27.71-24h55.42A28,28,0,0,1,128,220Zm83.45-34a3.91,3.91,0,0,1-3.44,2H48a3.91,3.91,0,0,1-3.44-2,4,4,0,0,1,0-4C52,169.17,60,139.32,60,104a68,68,0,1,1,136,0c0,35.31,8,65.17,15.44,78A4,4,0,0,1,211.45,186Z`}))]]),ow=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),sw=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,20A108,108,0,0,0,31.85,177.23L21,209.66A20,20,0,0,0,46.34,235l32.43-10.81A108,108,0,1,0,128,20Zm0,192a84,84,0,0,1-42.06-11.27,12,12,0,0,0-6-1.62,12.1,12.1,0,0,0-3.8.62l-29.79,9.93,9.93-29.79a12,12,0,0,0-1-9.81A84,84,0,1,1,128,212Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.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`}),k.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M232,128A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,26A102,102,0,0,0,38.35,176.69L26.73,211.56a14,14,0,0,0,17.71,17.71l34.87-11.62A102,102,0,1,0,128,26Zm0,192a90,90,0,0,1-45.06-12.08,6.09,6.09,0,0,0-3-.81,6.2,6.2,0,0,0-1.9.31L40.65,217.88a2,2,0,0,1-2.53-2.53L50.58,178a6,6,0,0,0-.5-4.91A90,90,0,1,1,128,218Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,28A100,100,0,0,0,40.53,176.5l-11.9,35.69a12,12,0,0,0,15.18,15.18l35.69-11.9A100,100,0,1,0,128,28Zm0,192a92,92,0,0,1-46.07-12.35,4.05,4.05,0,0,0-2-.54,3.93,3.93,0,0,0-1.27.21L41.28,219.78a4,4,0,0,1-5.06-5.06l12.46-37.38a4,4,0,0,0-.33-3.27A92,92,0,1,1,128,220Z`}))]]),cw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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,212ZM163.27,77l-56,24a12,12,0,0,0-6.3,6.3l-24,56A12,12,0,0,0,92.73,179l56-24a12,12,0,0,0,6.3-6.3l24-56A12,12,0,0,0,163.27,77Zm-28.41,57.89-24,10.29,10.29-24,24-10.29Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,32a96,96,0,1,0,96,96A96,96,0,0,0,128,32Zm16,112L80,176l32-64,64-32Z`,opacity:`0.2`}),k.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,216ZM172.42,72.84l-64,32a8.05,8.05,0,0,0-3.58,3.58l-32,64A8,8,0,0,0,80,184a8.1,8.1,0,0,0,3.58-.84l64-32a8.05,8.05,0,0,0,3.58-3.58l32-64a8,8,0,0,0-10.74-10.74ZM138,138,97.89,158.11,118,118l40.15-20.07Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm51.58,57.79-32,64a4.08,4.08,0,0,1-1.79,1.79l-64,32a4,4,0,0,1-5.37-5.37l32-64a4.08,4.08,0,0,1,1.79-1.79l64-32A4,4,0,0,1,179.58,81.79Z`}))],[`light`,k.createElement(k.Fragment,null,k.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,218ZM173.32,74.63l-64,32a6,6,0,0,0-2.69,2.69l-32,64A6,6,0,0,0,80,182a6.06,6.06,0,0,0,2.68-.63l64-32a6,6,0,0,0,2.69-2.69l32-64a6,6,0,0,0-8.05-8.05Zm-33.79,64.9L93.42,162.58l23-46.11,46.11-23Z`}))],[`regular`,k.createElement(k.Fragment,null,k.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,216ZM172.42,72.84l-64,32a8.05,8.05,0,0,0-3.58,3.58l-32,64A8,8,0,0,0,80,184a8.1,8.1,0,0,0,3.58-.84l64-32a8.05,8.05,0,0,0,3.58-3.58l32-64a8,8,0,0,0-10.74-10.74ZM138,138,97.89,158.11,118,118l40.15-20.07Z`}))],[`thin`,k.createElement(k.Fragment,null,k.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,220ZM174.21,76.42l-64,32a4.08,4.08,0,0,0-1.79,1.79l-32,64A4,4,0,0,0,80,180a4.05,4.05,0,0,0,1.79-.42l64-32a4.08,4.08,0,0,0,1.79-1.79l32-64a4,4,0,0,0-5.37-5.37ZM141,141l-52.08,26L115,115l52.08-26Z`}))]]),lw=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,76a52,52,0,1,0,52,52A52.06,52.06,0,0,0,128,76Zm0,80a28,28,0,1,1,28-28A28,28,0,0,1,128,156Zm92-27.21v-1.58l14-17.51a12,12,0,0,0,2.23-10.59A111.75,111.75,0,0,0,225,71.89,12,12,0,0,0,215.89,66L193.61,63.5l-1.11-1.11L190,40.1A12,12,0,0,0,184.11,31a111.67,111.67,0,0,0-27.23-11.27A12,12,0,0,0,146.3,22L128.79,36h-1.58L109.7,22a12,12,0,0,0-10.59-2.23A111.75,111.75,0,0,0,71.89,31.05,12,12,0,0,0,66,40.11L63.5,62.39,62.39,63.5,40.1,66A12,12,0,0,0,31,71.89,111.67,111.67,0,0,0,19.77,99.12,12,12,0,0,0,22,109.7l14,17.51v1.58L22,146.3a12,12,0,0,0-2.23,10.59,111.75,111.75,0,0,0,11.29,27.22A12,12,0,0,0,40.11,190l22.28,2.48,1.11,1.11L66,215.9A12,12,0,0,0,71.89,225a111.67,111.67,0,0,0,27.23,11.27A12,12,0,0,0,109.7,234l17.51-14h1.58l17.51,14a12,12,0,0,0,10.59,2.23A111.75,111.75,0,0,0,184.11,225a12,12,0,0,0,5.91-9.06l2.48-22.28,1.11-1.11L215.9,190a12,12,0,0,0,9.06-5.91,111.67,111.67,0,0,0,11.27-27.23A12,12,0,0,0,234,146.3Zm-24.12-4.89a70.1,70.1,0,0,1,0,8.2,12,12,0,0,0,2.61,8.22l12.84,16.05A86.47,86.47,0,0,1,207,166.86l-20.43,2.27a12,12,0,0,0-7.65,4,69,69,0,0,1-5.8,5.8,12,12,0,0,0-4,7.65L166.86,207a86.47,86.47,0,0,1-10.49,4.35l-16.05-12.85a12,12,0,0,0-7.5-2.62c-.24,0-.48,0-.72,0a70.1,70.1,0,0,1-8.2,0,12.06,12.06,0,0,0-8.22,2.6L99.63,211.33A86.47,86.47,0,0,1,89.14,207l-2.27-20.43a12,12,0,0,0-4-7.65,69,69,0,0,1-5.8-5.8,12,12,0,0,0-7.65-4L49,166.86a86.47,86.47,0,0,1-4.35-10.49l12.84-16.05a12,12,0,0,0,2.61-8.22,70.1,70.1,0,0,1,0-8.2,12,12,0,0,0-2.61-8.22L44.67,99.63A86.47,86.47,0,0,1,49,89.14l20.43-2.27a12,12,0,0,0,7.65-4,69,69,0,0,1,5.8-5.8,12,12,0,0,0,4-7.65L89.14,49a86.47,86.47,0,0,1,10.49-4.35l16.05,12.85a12.06,12.06,0,0,0,8.22,2.6,70.1,70.1,0,0,1,8.2,0,12,12,0,0,0,8.22-2.6l16.05-12.85A86.47,86.47,0,0,1,166.86,49l2.27,20.43a12,12,0,0,0,4,7.65,69,69,0,0,1,5.8,5.8,12,12,0,0,0,7.65,4L207,89.14a86.47,86.47,0,0,1,4.35,10.49l-12.84,16.05A12,12,0,0,0,195.88,123.9Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M207.86,123.18l16.78-21a99.14,99.14,0,0,0-10.07-24.29l-26.7-3a81,81,0,0,0-6.81-6.81l-3-26.71a99.43,99.43,0,0,0-24.3-10l-21,16.77a81.59,81.59,0,0,0-9.64,0l-21-16.78A99.14,99.14,0,0,0,77.91,41.43l-3,26.7a81,81,0,0,0-6.81,6.81l-26.71,3a99.43,99.43,0,0,0-10,24.3l16.77,21a81.59,81.59,0,0,0,0,9.64l-16.78,21a99.14,99.14,0,0,0,10.07,24.29l26.7,3a81,81,0,0,0,6.81,6.81l3,26.71a99.43,99.43,0,0,0,24.3,10l21-16.77a81.59,81.59,0,0,0,9.64,0l21,16.78a99.14,99.14,0,0,0,24.29-10.07l3-26.7a81,81,0,0,0,6.81-6.81l26.71-3a99.43,99.43,0,0,0,10-24.3l-16.77-21A81.59,81.59,0,0,0,207.86,123.18ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Zm88-29.84q.06-2.16,0-4.32l14.92-18.64a8,8,0,0,0,1.48-7.06,107.6,107.6,0,0,0-10.88-26.25,8,8,0,0,0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186,40.54a8,8,0,0,0-3.94-6,107.29,107.29,0,0,0-26.25-10.86,8,8,0,0,0-7.06,1.48L130.16,40Q128,40,125.84,40L107.2,25.11a8,8,0,0,0-7.06-1.48A107.6,107.6,0,0,0,73.89,34.51a8,8,0,0,0-3.93,6L67.32,64.27q-1.56,1.49-3,3L40.54,70a8,8,0,0,0-6,3.94,107.71,107.71,0,0,0-10.87,26.25,8,8,0,0,0,1.49,7.06L40,125.84Q40,128,40,130.16L25.11,148.8a8,8,0,0,0-1.48,7.06,107.6,107.6,0,0,0,10.88,26.25,8,8,0,0,0,6,3.93l23.72,2.64q1.49,1.56,3,3L70,215.46a8,8,0,0,0,3.94,6,107.71,107.71,0,0,0,26.25,10.87,8,8,0,0,0,7.06-1.49L125.84,216q2.16.06,4.32,0l18.64,14.92a8,8,0,0,0,7.06,1.48,107.21,107.21,0,0,0,26.25-10.88,8,8,0,0,0,3.93-6l2.64-23.72q1.56-1.48,3-3L215.46,186a8,8,0,0,0,6-3.94,107.71,107.71,0,0,0,10.87-26.25,8,8,0,0,0-1.49-7.06Zm-16.1-6.5a73.93,73.93,0,0,1,0,8.68,8,8,0,0,0,1.74,5.48l14.19,17.73a91.57,91.57,0,0,1-6.23,15L187,173.11a8,8,0,0,0-5.1,2.64,74.11,74.11,0,0,1-6.14,6.14,8,8,0,0,0-2.64,5.1l-2.51,22.58a91.32,91.32,0,0,1-15,6.23l-17.74-14.19a8,8,0,0,0-5-1.75h-.48a73.93,73.93,0,0,1-8.68,0,8.06,8.06,0,0,0-5.48,1.74L100.45,215.8a91.57,91.57,0,0,1-15-6.23L82.89,187a8,8,0,0,0-2.64-5.1,74.11,74.11,0,0,1-6.14-6.14,8,8,0,0,0-5.1-2.64L46.43,170.6a91.32,91.32,0,0,1-6.23-15l14.19-17.74a8,8,0,0,0,1.74-5.48,73.93,73.93,0,0,1,0-8.68,8,8,0,0,0-1.74-5.48L40.2,100.45a91.57,91.57,0,0,1,6.23-15L69,82.89a8,8,0,0,0,5.1-2.64,74.11,74.11,0,0,1,6.14-6.14A8,8,0,0,0,82.89,69L85.4,46.43a91.32,91.32,0,0,1,15-6.23l17.74,14.19a8,8,0,0,0,5.48,1.74,73.93,73.93,0,0,1,8.68,0,8.06,8.06,0,0,0,5.48-1.74L155.55,40.2a91.57,91.57,0,0,1,15,6.23L173.11,69a8,8,0,0,0,2.64,5.1,74.11,74.11,0,0,1,6.14,6.14,8,8,0,0,0,5.1,2.64l22.58,2.51a91.32,91.32,0,0,1,6.23,15l-14.19,17.74A8,8,0,0,0,199.87,123.66Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,130.16q.06-2.16,0-4.32l14.92-18.64a8,8,0,0,0,1.48-7.06,107.6,107.6,0,0,0-10.88-26.25,8,8,0,0,0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186,40.54a8,8,0,0,0-3.94-6,107.29,107.29,0,0,0-26.25-10.86,8,8,0,0,0-7.06,1.48L130.16,40Q128,40,125.84,40L107.2,25.11a8,8,0,0,0-7.06-1.48A107.6,107.6,0,0,0,73.89,34.51a8,8,0,0,0-3.93,6L67.32,64.27q-1.56,1.49-3,3L40.54,70a8,8,0,0,0-6,3.94,107.71,107.71,0,0,0-10.87,26.25,8,8,0,0,0,1.49,7.06L40,125.84Q40,128,40,130.16L25.11,148.8a8,8,0,0,0-1.48,7.06,107.6,107.6,0,0,0,10.88,26.25,8,8,0,0,0,6,3.93l23.72,2.64q1.49,1.56,3,3L70,215.46a8,8,0,0,0,3.94,6,107.71,107.71,0,0,0,26.25,10.87,8,8,0,0,0,7.06-1.49L125.84,216q2.16.06,4.32,0l18.64,14.92a8,8,0,0,0,7.06,1.48,107.21,107.21,0,0,0,26.25-10.88,8,8,0,0,0,3.93-6l2.64-23.72q1.56-1.48,3-3L215.46,186a8,8,0,0,0,6-3.94,107.71,107.71,0,0,0,10.87-26.25,8,8,0,0,0-1.49-7.06ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,82a46,46,0,1,0,46,46A46.06,46.06,0,0,0,128,82Zm0,80a34,34,0,1,1,34-34A34,34,0,0,1,128,162ZM214,130.84c.06-1.89.06-3.79,0-5.68L229.33,106a6,6,0,0,0,1.11-5.29A105.34,105.34,0,0,0,219.76,74.9a6,6,0,0,0-4.53-3l-24.45-2.71q-1.93-2.07-4-4l-2.72-24.46a6,6,0,0,0-3-4.53,105.65,105.65,0,0,0-25.77-10.66A6,6,0,0,0,150,26.68l-19.2,15.37c-1.89-.06-3.79-.06-5.68,0L106,26.67a6,6,0,0,0-5.29-1.11A105.34,105.34,0,0,0,74.9,36.24a6,6,0,0,0-3,4.53L69.23,65.22q-2.07,1.94-4,4L40.76,72a6,6,0,0,0-4.53,3,105.65,105.65,0,0,0-10.66,25.77A6,6,0,0,0,26.68,106l15.37,19.2c-.06,1.89-.06,3.79,0,5.68L26.67,150.05a6,6,0,0,0-1.11,5.29A105.34,105.34,0,0,0,36.24,181.1a6,6,0,0,0,4.53,3l24.45,2.71q1.94,2.07,4,4L72,215.24a6,6,0,0,0,3,4.53,105.65,105.65,0,0,0,25.77,10.66,6,6,0,0,0,5.29-1.11L125.16,214c1.89.06,3.79.06,5.68,0l19.21,15.38a6,6,0,0,0,3.75,1.31,6.2,6.2,0,0,0,1.54-.2,105.34,105.34,0,0,0,25.76-10.68,6,6,0,0,0,3-4.53l2.71-24.45q2.07-1.93,4-4l24.46-2.72a6,6,0,0,0,4.53-3,105.49,105.49,0,0,0,10.66-25.77,6,6,0,0,0-1.11-5.29Zm-3.1,41.63-23.64,2.63a6,6,0,0,0-3.82,2,75.14,75.14,0,0,1-6.31,6.31,6,6,0,0,0-2,3.82l-2.63,23.63A94.28,94.28,0,0,1,155.14,218l-18.57-14.86a6,6,0,0,0-3.75-1.31h-.36a78.07,78.07,0,0,1-8.92,0,6,6,0,0,0-4.11,1.3L100.87,218a94.13,94.13,0,0,1-17.34-7.17L80.9,187.21a6,6,0,0,0-2-3.82,75.14,75.14,0,0,1-6.31-6.31,6,6,0,0,0-3.82-2l-23.63-2.63A94.28,94.28,0,0,1,38,155.14l14.86-18.57a6,6,0,0,0,1.3-4.11,78.07,78.07,0,0,1,0-8.92,6,6,0,0,0-1.3-4.11L38,100.87a94.13,94.13,0,0,1,7.17-17.34L68.79,80.9a6,6,0,0,0,3.82-2,75.14,75.14,0,0,1,6.31-6.31,6,6,0,0,0,2-3.82l2.63-23.63A94.28,94.28,0,0,1,100.86,38l18.57,14.86a6,6,0,0,0,4.11,1.3,78.07,78.07,0,0,1,8.92,0,6,6,0,0,0,4.11-1.3L155.13,38a94.13,94.13,0,0,1,17.34,7.17l2.63,23.64a6,6,0,0,0,2,3.82,75.14,75.14,0,0,1,6.31,6.31,6,6,0,0,0,3.82,2l23.63,2.63A94.28,94.28,0,0,1,218,100.86l-14.86,18.57a6,6,0,0,0-1.3,4.11,78.07,78.07,0,0,1,0,8.92,6,6,0,0,0,1.3,4.11L218,155.13A94.13,94.13,0,0,1,210.85,172.47Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Zm88-29.84q.06-2.16,0-4.32l14.92-18.64a8,8,0,0,0,1.48-7.06,107.21,107.21,0,0,0-10.88-26.25,8,8,0,0,0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186,40.54a8,8,0,0,0-3.94-6,107.71,107.71,0,0,0-26.25-10.87,8,8,0,0,0-7.06,1.49L130.16,40Q128,40,125.84,40L107.2,25.11a8,8,0,0,0-7.06-1.48A107.6,107.6,0,0,0,73.89,34.51a8,8,0,0,0-3.93,6L67.32,64.27q-1.56,1.49-3,3L40.54,70a8,8,0,0,0-6,3.94,107.71,107.71,0,0,0-10.87,26.25,8,8,0,0,0,1.49,7.06L40,125.84Q40,128,40,130.16L25.11,148.8a8,8,0,0,0-1.48,7.06,107.21,107.21,0,0,0,10.88,26.25,8,8,0,0,0,6,3.93l23.72,2.64q1.49,1.56,3,3L70,215.46a8,8,0,0,0,3.94,6,107.71,107.71,0,0,0,26.25,10.87,8,8,0,0,0,7.06-1.49L125.84,216q2.16.06,4.32,0l18.64,14.92a8,8,0,0,0,7.06,1.48,107.21,107.21,0,0,0,26.25-10.88,8,8,0,0,0,3.93-6l2.64-23.72q1.56-1.48,3-3L215.46,186a8,8,0,0,0,6-3.94,107.71,107.71,0,0,0,10.87-26.25,8,8,0,0,0-1.49-7.06Zm-16.1-6.5a73.93,73.93,0,0,1,0,8.68,8,8,0,0,0,1.74,5.48l14.19,17.73a91.57,91.57,0,0,1-6.23,15L187,173.11a8,8,0,0,0-5.1,2.64,74.11,74.11,0,0,1-6.14,6.14,8,8,0,0,0-2.64,5.1l-2.51,22.58a91.32,91.32,0,0,1-15,6.23l-17.74-14.19a8,8,0,0,0-5-1.75h-.48a73.93,73.93,0,0,1-8.68,0,8,8,0,0,0-5.48,1.74L100.45,215.8a91.57,91.57,0,0,1-15-6.23L82.89,187a8,8,0,0,0-2.64-5.1,74.11,74.11,0,0,1-6.14-6.14,8,8,0,0,0-5.1-2.64L46.43,170.6a91.32,91.32,0,0,1-6.23-15l14.19-17.74a8,8,0,0,0,1.74-5.48,73.93,73.93,0,0,1,0-8.68,8,8,0,0,0-1.74-5.48L40.2,100.45a91.57,91.57,0,0,1,6.23-15L69,82.89a8,8,0,0,0,5.1-2.64,74.11,74.11,0,0,1,6.14-6.14A8,8,0,0,0,82.89,69L85.4,46.43a91.32,91.32,0,0,1,15-6.23l17.74,14.19a8,8,0,0,0,5.48,1.74,73.93,73.93,0,0,1,8.68,0,8,8,0,0,0,5.48-1.74L155.55,40.2a91.57,91.57,0,0,1,15,6.23L173.11,69a8,8,0,0,0,2.64,5.1,74.11,74.11,0,0,1,6.14,6.14,8,8,0,0,0,5.1,2.64l22.58,2.51a91.32,91.32,0,0,1,6.23,15l-14.19,17.74A8,8,0,0,0,199.87,123.66Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,80a36,36,0,1,1,36-36A36,36,0,0,1,128,164Zm83.93-32.49q.13-3.51,0-7l15.83-19.79a4,4,0,0,0,.75-3.53A103.64,103.64,0,0,0,218,75.9a4,4,0,0,0-3-2l-25.19-2.8c-1.58-1.71-3.24-3.37-4.95-4.95L182.07,41a4,4,0,0,0-2-3A104,104,0,0,0,154.82,27.5a4,4,0,0,0-3.53.74L131.51,44.07q-3.51-.14-7,0L104.7,28.24a4,4,0,0,0-3.53-.75A103.64,103.64,0,0,0,75.9,38a4,4,0,0,0-2,3l-2.8,25.19c-1.71,1.58-3.37,3.24-4.95,4.95L41,73.93a4,4,0,0,0-3,2A104,104,0,0,0,27.5,101.18a4,4,0,0,0,.74,3.53l15.83,19.78q-.14,3.51,0,7L28.24,151.3a4,4,0,0,0-.75,3.53A103.64,103.64,0,0,0,38,180.1a4,4,0,0,0,3,2l25.19,2.8c1.58,1.71,3.24,3.37,4.95,4.95l2.8,25.2a4,4,0,0,0,2,3,104,104,0,0,0,25.28,10.46,4,4,0,0,0,3.53-.74l19.78-15.83q3.51.13,7,0l19.79,15.83a4,4,0,0,0,2.5.88,4,4,0,0,0,1-.13A103.64,103.64,0,0,0,180.1,218a4,4,0,0,0,2-3l2.8-25.19c1.71-1.58,3.37-3.24,4.95-4.95l25.2-2.8a4,4,0,0,0,3-2,104,104,0,0,0,10.46-25.28,4,4,0,0,0-.74-3.53Zm.17,42.83-24.67,2.74a4,4,0,0,0-2.55,1.32,76.2,76.2,0,0,1-6.48,6.48,4,4,0,0,0-1.32,2.55l-2.74,24.66a95.45,95.45,0,0,1-19.64,8.15l-19.38-15.51a4,4,0,0,0-2.5-.87h-.24a73.67,73.67,0,0,1-9.16,0,4,4,0,0,0-2.74.87l-19.37,15.5a95.33,95.33,0,0,1-19.65-8.13l-2.74-24.67a4,4,0,0,0-1.32-2.55,76.2,76.2,0,0,1-6.48-6.48,4,4,0,0,0-2.55-1.32l-24.66-2.74a95.45,95.45,0,0,1-8.15-19.64l15.51-19.38a4,4,0,0,0,.87-2.74,77.76,77.76,0,0,1,0-9.16,4,4,0,0,0-.87-2.74l-15.5-19.37A95.33,95.33,0,0,1,43.9,81.66l24.67-2.74a4,4,0,0,0,2.55-1.32,76.2,76.2,0,0,1,6.48-6.48,4,4,0,0,0,1.32-2.55l2.74-24.66a95.45,95.45,0,0,1,19.64-8.15l19.38,15.51a4,4,0,0,0,2.74.87,73.67,73.67,0,0,1,9.16,0,4,4,0,0,0,2.74-.87l19.37-15.5a95.33,95.33,0,0,1,19.65,8.13l2.74,24.67a4,4,0,0,0,1.32,2.55,76.2,76.2,0,0,1,6.48,6.48,4,4,0,0,0,2.55,1.32l24.66,2.74a95.45,95.45,0,0,1,8.15,19.64l-15.51,19.38a4,4,0,0,0-.87,2.74,77.76,77.76,0,0,1,0,9.16,4,4,0,0,0,.87,2.74l15.5,19.37A95.33,95.33,0,0,1,212.1,174.34Z`}))]]),uw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,144a32,32,0,1,1-32-32A32,32,0,0,1,216,144Z`,opacity:`0.2`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),dw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),fw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),pw=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M200,164a36.07,36.07,0,0,0-33.94,24H72a28,28,0,0,1,0-56h96a44,44,0,0,0,0-88H72a12,12,0,0,0,0,24h96a20,20,0,0,1,0,40H72a52,52,0,0,0,0,104h94.06A36,36,0,1,0,200,164Zm0,48a12,12,0,1,1,12-12A12,12,0,0,1,200,212Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,200a24,24,0,1,1-24-24A24,24,0,0,1,224,200Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M200,168a32.06,32.06,0,0,0-31,24H72a32,32,0,0,1,0-64h96a40,40,0,0,0,0-80H72a8,8,0,0,0,0,16h96a24,24,0,0,1,0,48H72a48,48,0,0,0,0,96h97a32,32,0,1,0,31-40Zm0,48a16,16,0,1,1,16-16A16,16,0,0,1,200,216Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,200a28,28,0,0,1-54.83,8H72a48,48,0,0,1,0-96h96a24,24,0,0,0,0-48H72a8,8,0,0,1,0-16h96a40,40,0,0,1,0,80H72a32,32,0,0,0,0,64H173.17A28,28,0,0,1,228,200Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M200,170a30.05,30.05,0,0,0-29.4,24H72a34,34,0,0,1,0-68h96a38,38,0,0,0,0-76H72a6,6,0,0,0,0,12h96a26,26,0,0,1,0,52H72a46,46,0,0,0,0,92h98.6A30,30,0,1,0,200,170Zm0,48a18,18,0,1,1,18-18A18,18,0,0,1,200,218Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M200,168a32.06,32.06,0,0,0-31,24H72a32,32,0,0,1,0-64h96a40,40,0,0,0,0-80H72a8,8,0,0,0,0,16h96a24,24,0,0,1,0,48H72a48,48,0,0,0,0,96h97a32,32,0,1,0,31-40Zm0,48a16,16,0,1,1,16-16A16,16,0,0,1,200,216Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M200,172a28,28,0,0,0-27.71,24H72a36,36,0,0,1,0-72h96a36,36,0,0,0,0-72H72a4,4,0,0,0,0,8h96a28,28,0,0,1,0,56H72a44,44,0,0,0,0,88H172.29A28,28,0,1,0,200,172Zm0,48a20,20,0,1,1,20-20A20,20,0,0,1,200,220Z`}))]]),mw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),hw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),gw=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M144,180a16,16,0,1,1-16-16A16,16,0,0,1,144,180Zm92-52A108,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,128ZM128,64c-24.26,0-44,17.94-44,40v4a12,12,0,0,0,24,0v-4c0-8.82,9-16,20-16s20,7.18,20,16-9,16-20,16a12,12,0,0,0-12,12v8a12,12,0,0,0,23.73,2.56C158.31,137.88,172,122.37,172,104,172,81.94,152.26,64,128,64Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,168a12,12,0,1,1,12-12A12,12,0,0,1,128,192Zm8-48.72V144a8,8,0,0,1-16,0v-8a8,8,0,0,1,8-8c13.23,0,24-9,24-20s-10.77-20-24-20-24,9-24,20v4a8,8,0,0,1-16,0v-4c0-19.85,17.94-36,40-36s40,16.15,40,36C168,125.38,154.24,139.93,136,143.28Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M138,180a10,10,0,1,1-10-10A10,10,0,0,1,138,180ZM128,74c-21,0-38,15.25-38,34v4a6,6,0,0,0,12,0v-4c0-12.13,11.66-22,26-22s26,9.87,26,22-11.66,22-26,22a6,6,0,0,0-6,6v8a6,6,0,0,0,12,0v-2.42c18.11-2.58,32-16.66,32-33.58C166,89.25,149,74,128,74Zm102,54A102,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`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M136,180a8,8,0,1,1-8-8A8,8,0,0,1,136,180ZM128,76c-19.85,0-36,14.36-36,32v4a4,4,0,0,0,8,0v-4c0-13.23,12.56-24,28-24s28,10.77,28,24-12.56,24-28,24a4,4,0,0,0-4,4v8a4,4,0,0,0,8,0v-4.2c18-1.77,32-15.36,32-31.8C164,90.36,147.85,76,128,76Zm100,52A100,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`}))]]),_w=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,36H40A20,20,0,0,0,20,56V200a20,20,0,0,0,20,20H216a20,20,0,0,0,20-20V56A20,20,0,0,0,216,36ZM44,60H76V196H44ZM212,196H100V60H212Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M88,48V208H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,160H88V56H216V200Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,42H40A14,14,0,0,0,26,56V200a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A14,14,0,0,0,216,42ZM38,200V56a2,2,0,0,1,2-2H82V202H40A2,2,0,0,1,38,200Zm180,0a2,2,0,0,1-2,2H94V54H216a2,2,0,0,1,2,2Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,44H40A12,12,0,0,0,28,56V200a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A12,12,0,0,0,216,44ZM36,200V56a4,4,0,0,1,4-4H84V204H40A4,4,0,0,1,36,200Zm184,0a4,4,0,0,1-4,4H92V52H216a4,4,0,0,1,4,4Z`}))]]),vw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),yw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),bw=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M100,36H56A20,20,0,0,0,36,56v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V56A20,20,0,0,0,100,36ZM96,96H60V60H96ZM200,36H156a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,60H160V60h36Zm-96,40H56a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V156A20,20,0,0,0,100,136Zm-4,60H60V160H96Zm104-60H156a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V156A20,20,0,0,0,200,136Zm-4,60H160V160h36Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M112,56v48a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8h48A8,8,0,0,1,112,56Zm88-8H152a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V56A8,8,0,0,0,200,48Zm-96,96H56a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V152A8,8,0,0,0,104,144Zm96,0H152a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V152A8,8,0,0,0,200,144Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M200,136H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48v48ZM104,40H56A16,16,0,0,0,40,56v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,104,40Zm0,64H56V56h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,64H152V56h48v48Zm-96,32H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm0,64H56V152h48v48Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M120,56v48a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40h48A16,16,0,0,1,120,56Zm80-16H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm-96,96H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm96,0H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M104,42H56A14,14,0,0,0,42,56v48a14,14,0,0,0,14,14h48a14,14,0,0,0,14-14V56A14,14,0,0,0,104,42Zm2,62a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2h48a2,2,0,0,1,2,2Zm94-62H152a14,14,0,0,0-14,14v48a14,14,0,0,0,14,14h48a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,62a2,2,0,0,1-2,2H152a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2h48a2,2,0,0,1,2,2Zm-98,34H56a14,14,0,0,0-14,14v48a14,14,0,0,0,14,14h48a14,14,0,0,0,14-14V152A14,14,0,0,0,104,138Zm2,62a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V152a2,2,0,0,1,2-2h48a2,2,0,0,1,2,2Zm94-62H152a14,14,0,0,0-14,14v48a14,14,0,0,0,14,14h48a14,14,0,0,0,14-14V152A14,14,0,0,0,200,138Zm2,62a2,2,0,0,1-2,2H152a2,2,0,0,1-2-2V152a2,2,0,0,1,2-2h48a2,2,0,0,1,2,2Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M104,40H56A16,16,0,0,0,40,56v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,104,40Zm0,64H56V56h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,64H152V56h48v48Zm-96,32H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm0,64H56V152h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48v48Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M104,44H56A12,12,0,0,0,44,56v48a12,12,0,0,0,12,12h48a12,12,0,0,0,12-12V56A12,12,0,0,0,104,44Zm4,60a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4Zm92-60H152a12,12,0,0,0-12,12v48a12,12,0,0,0,12,12h48a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,60a4,4,0,0,1-4,4H152a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4ZM104,140H56a12,12,0,0,0-12,12v48a12,12,0,0,0,12,12h48a12,12,0,0,0,12-12V152A12,12,0,0,0,104,140Zm4,60a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V152a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4Zm92-60H152a12,12,0,0,0-12,12v48a12,12,0,0,0,12,12h48a12,12,0,0,0,12-12V152A12,12,0,0,0,200,140Zm4,60a4,4,0,0,1-4,4H152a4,4,0,0,1-4-4V152a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4Z`}))]]),xw=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M243,96a20.33,20.33,0,0,0-17.74-14l-56.59-4.57L146.83,24.62a20.36,20.36,0,0,0-37.66,0L87.35,77.44,30.76,82A20.45,20.45,0,0,0,19.1,117.88l43.18,37.24-13.2,55.7A20.37,20.37,0,0,0,79.57,233L128,203.19,176.43,233a20.39,20.39,0,0,0,30.49-22.15l-13.2-55.7,43.18-37.24A20.43,20.43,0,0,0,243,96ZM172.53,141.7a12,12,0,0,0-3.84,11.86L181.58,208l-47.29-29.08a12,12,0,0,0-12.58,0L74.42,208l12.89-54.4a12,12,0,0,0-3.84-11.86L41.2,105.24l55.4-4.47a12,12,0,0,0,10.13-7.38L128,41.89l21.27,51.5a12,12,0,0,0,10.13,7.38l55.4,4.47Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M229.06,108.79l-48.7,42,14.88,62.79a8.4,8.4,0,0,1-12.52,9.17L128,189.09,73.28,222.74a8.4,8.4,0,0,1-12.52-9.17l14.88-62.79-48.7-42A8.46,8.46,0,0,1,31.73,94L95.64,88.8l24.62-59.6a8.36,8.36,0,0,1,15.48,0l24.62,59.6L224.27,94A8.46,8.46,0,0,1,229.06,108.79Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M234.29,114.85l-45,38.83L203,211.75a16.4,16.4,0,0,1-24.5,17.82L128,198.49,77.47,229.57A16.4,16.4,0,0,1,53,211.75l13.76-58.07-45-38.83A16.46,16.46,0,0,1,31.08,86l59-4.76,22.76-55.08a16.36,16.36,0,0,1,30.27,0l22.75,55.08,59,4.76a16.46,16.46,0,0,1,9.37,28.86Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M237.28,97.87A14.18,14.18,0,0,0,224.76,88l-60.25-4.87-23.22-56.2a14.37,14.37,0,0,0-26.58,0L91.49,83.11,31.24,88a14.18,14.18,0,0,0-12.52,9.89A14.43,14.43,0,0,0,23,113.32L69,152.93l-14,59.25a14.4,14.4,0,0,0,5.59,15,14.1,14.1,0,0,0,15.91.6L128,196.12l51.58,31.71a14.1,14.1,0,0,0,15.91-.6,14.4,14.4,0,0,0,5.59-15l-14-59.25L233,113.32A14.43,14.43,0,0,0,237.28,97.87Zm-12.14,6.37-48.69,42a6,6,0,0,0-1.92,5.92l14.88,62.79a2.35,2.35,0,0,1-.95,2.57,2.24,2.24,0,0,1-2.6.1L131.14,184a6,6,0,0,0-6.28,0L70.14,217.61a2.24,2.24,0,0,1-2.6-.1,2.35,2.35,0,0,1-1-2.57l14.88-62.79a6,6,0,0,0-1.92-5.92l-48.69-42a2.37,2.37,0,0,1-.73-2.65,2.28,2.28,0,0,1,2.07-1.65l63.92-5.16a6,6,0,0,0,5.06-3.69l24.63-59.6a2.35,2.35,0,0,1,4.38,0l24.63,59.6a6,6,0,0,0,5.06,3.69l63.92,5.16a2.28,2.28,0,0,1,2.07,1.65A2.37,2.37,0,0,1,225.14,104.24Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M235.36,98.49A12.21,12.21,0,0,0,224.59,90l-61.47-5L139.44,27.67a12.37,12.37,0,0,0-22.88,0L92.88,85,31.41,90a12.45,12.45,0,0,0-7.07,21.84l46.85,40.41L56.87,212.64a12.35,12.35,0,0,0,18.51,13.49L128,193.77l52.62,32.36a12.12,12.12,0,0,0,13.69-.51,12.28,12.28,0,0,0,4.82-13l-14.32-60.42,46.85-40.41A12.29,12.29,0,0,0,235.36,98.49Zm-8.93,7.26-48.68,42a4,4,0,0,0-1.28,3.95l14.87,62.79a4.37,4.37,0,0,1-1.72,4.65,4.24,4.24,0,0,1-4.81.18L130.1,185.67a4,4,0,0,0-4.2,0L71.19,219.32a4.24,4.24,0,0,1-4.81-.18,4.37,4.37,0,0,1-1.72-4.65L79.53,151.7a4,4,0,0,0-1.28-3.95l-48.68-42A4.37,4.37,0,0,1,28.25,101a4.31,4.31,0,0,1,3.81-3L96,92.79a4,4,0,0,0,3.38-2.46L124,30.73a4.35,4.35,0,0,1,8.08,0l24.62,59.6A4,4,0,0,0,160,92.79l63.9,5.15a4.31,4.31,0,0,1,3.81,3A4.37,4.37,0,0,1,226.43,105.75Z`}))]]),Sw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),Cw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:aw}));Cw.displayName=`BellIcon`;var ww=Cw,Tw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:ow}));Tw.displayName=`BookOpenIcon`;var Ew=Tw,Dw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:sw}));Dw.displayName=`ChatCircleIcon`;var Ow=Dw,kw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:cw}));kw.displayName=`CompassIcon`;var Aw=kw,jw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:lw}));jw.displayName=`GearIcon`;var Mw=jw,Nw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:uw}));Nw.displayName=`ListMagnifyingGlassIcon`;var Pw=Nw,Fw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:dw}));Fw.displayName=`MagnifyingGlassIcon`;var Iw=Fw,Lw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:fw}));Lw.displayName=`MoonIcon`;var Rw=Lw,zw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:pw}));zw.displayName=`PathIcon`;var Bw=zw,Vw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:mw}));Vw.displayName=`PlugsConnectedIcon`;var Hw=Vw,Uw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:hw}));Uw.displayName=`PlusIcon`;var Ww=Uw,Gw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:gw}));Gw.displayName=`QuestionIcon`;var Kw=Gw,qw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:_w}));qw.displayName=`SidebarSimpleIcon`;var Jw=qw,Yw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:vw}));Yw.displayName=`SignOutIcon`;var Xw=Yw,Zw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:yw}));Zw.displayName=`SparkleIcon`;var Qw=Zw,$w=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:bw}));$w.displayName=`SquaresFourIcon`;var eT=$w,tT=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:xw}));tT.displayName=`StarIcon`;var nT=tT,rT=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:Sw}));rT.displayName=`SunIcon`;var iT=rT,aT=[`agent-threads`];async function oT(e){let t=await Wt(e);if(!t.ok)throw Error(`Request failed (${t.status})`);return t.json()}var sT=new Set([`create_dashboard`,`edit_dashboard`,`replace_dashboard`,`restore_dashboard_version`]);function cT(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function lT(e){if(typeof e==`string`)try{let t=JSON.parse(e);if(cT(t))return t}catch{}}var uT=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),dT=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0;function fT(e){return cT(e)&&typeof e.id==`string`&&[`ok`,`empty`,`error`,`invalid`,`not_run`,`partial`,`stale`].includes(String(e.status))&&(e.rows===void 0||dT(e.rows))&&(e.elapsed_ms===void 0||dT(e.elapsed_ms))&&(e.diagnosis===void 0||typeof e.diagnosis==`string`)&&(e.error===void 0||typeof e.error==`string`)}function pT(e){if(!cT(e)||!Number.isInteger(e.base_version)||Number(e.base_version)<0||!Number.isInteger(e.version)||Number(e.version)<1||!Array.isArray(e.changes)||typeof e.layout_changed!=`boolean`||e.dashboard_fields!==void 0&&!uT(e.dashboard_fields)||!e.changes.every(e=>cT(e)&&typeof e.panel_id==`string`&&typeof e.title==`string`&&[`added`,`changed`,`removed`].includes(String(e.kind))&&(e.fields===void 0||uT(e.fields)&&!e.fields.includes(`grid`))&&(e.position_changed===void 0||typeof e.position_changed==`boolean`)))return!1;let t=e.save_check;return cT(t)&&typeof t.checked==`boolean`&&dT(t.elapsed_ms)&&Array.isArray(t.panels)&&t.panels.every(e=>fT(e)&&Number.isInteger(e.rows)&&Number(e.rows)>=0)&&new Set(t.panels.map(e=>e.id)).size===t.panels.length&&(t.reason===void 0||typeof t.reason==`string`)&&(!t.checked||t.panels.every(e=>e.status!==`not_run`))}function mT(e,t,n){let r=-1;n.forEach((n,i)=>{n.role===`tool`&&n.toolCallId===e&&n.content===t&&(r=i)});let i=r<0?n.length:r,a=-1;if(n.slice(0,i).forEach((e,t)=>{e.role===`user`&&(a=t)}),a<0)return null;let o=n.slice(a+1,i).flatMap(e=>e.role===`assistant`?e.toolCalls??[]:[]).filter(t=>t.id===e),s=o.length===1?o[0].function.name:void 0;if(!s||!sT.has(s))return null;let c=lT(t),l=c?.dashboard,u=c?.receipt;return!c||c.error||c.isError||!cT(l)||typeof l.id!=`string`||!l.id||typeof l.name!=`string`||!l.name||!pT(u)||l.version!==u.version||r>=0&&n[r].error?null:{id:l.id,name:l.name,version:u.version,label:s===`create_dashboard`?`Created`:s===`restore_dashboard_version`?`Restored`:`Updated`,receipt:u}}var hT={viz:`chart type`,sql:`SQL`,content:`text`,x_unit:`x-axis unit`,options:`display options`,drill:`drill-down`,click:`click action`,time:`time range`,annotations:`markers`,better:`better direction`,reduce:`summary`,min:`minimum`,max:`maximum`},gT=e=>Object.hasOwn(hT,e)?hT[e]:e.replaceAll(`_`,` `),_T=e=>e.kind===`added`?`+ ${e.title}`:e.kind===`removed`?`− ${e.title}`:`~ ${e.title}${e.fields?.length?`: `+e.fields.map(gT).join(`, `):``}${e.position_changed?` · moved`:``}`;function vT(e){return[...e.changes.map(_T),...e.layout_changed?[`Layout adjusted`]:[],...e.dashboard_fields?.map(e=>`Dashboard: ${gT(e)}`)??[]]}function yT(e,t,n){return e.filter(e=>n.has(e.panel_id)&&!t.some(t=>t.panel_id===e.panel_id&&t.path===e.path))}var bT={schema:`Telemetry`,context:`Context`,draft:`Draft`,validation:`Validation`,preview:`Preview`,save:`Save`},xT=new Set([`get_insights`,`query_telemetry`,`get_overview`,`get_service_topology`,`get_service_dependencies`,`get_service_performance`,`inspect_trace`,`search_logs`]),ST=(e,t)=>Array.isArray(e)?e.flatMap(e=>cT(e)&&typeof e.path==`string`&&typeof e.message==`string`?[{panel_id:t,path:e.path,message:e.message}]:[]):[],CT=e=>{let t=lT(e)?.error;return cT(t)?t.code:void 0},wT=e=>e.role===`tool`&&CT(e.content)===`interrupted`,TT=e=>![`invalid`,`not_run`].includes(e.status);function ET(e,t){let n=e.findIndex(e=>e.id===t&&e.role===`user`);if(n<0)return null;let r=e.findIndex((e,t)=>t>n&&e.role===`user`),i=e.slice(n+1,r<0?void 0:r),a=new Set(i.flatMap(e=>e.role===`tool`&&CT(e.content)===`answer_only`?[e.toolCallId]:[])),o=i.flatMap((e,t)=>e.role===`assistant`?(e.toolCalls??[]).map(e=>({call:e,index:t})):[]).filter(({call:e})=>!a.has(e.id));if(!o.some(({call:e})=>sT.has(e.function.name)||e.function.name===`preview_panels`))return null;let s={schema:{state:`unobserved`},context:{state:`unobserved`},draft:{state:`unobserved`},validation:{state:`unobserved`},preview:{state:`unobserved`},save:{state:`unobserved`}},c={turn_id:t,stages:s,panel_titles:{},panels:[],problems:[],corrections:[],save_attempts:[],explanations:[],context_counts:{deploys:0,anomalies:0}},l=new Map,u=new Map;for(let{call:e}of o)l.set(e.id,(l.get(e.id)??0)+1);i.forEach((e,t)=>{if(e.role===`tool`){let n=u.get(e.toolCallId)??[];n.push({index:t,message:e}),u.set(e.toolCallId,n)}});let d=new Map,f=new Map,p=[],m,h=!1,g=!1,_=(e,t)=>{for(let n of yT(y.get(e)??[],t,new Set([e])))p.some(e=>e.panel_id===n.panel_id&&e.path===n.path)||p.push(n);y.set(e,t)},v=new Map,y=new Map,b=new Set,x=!1,ee=!1;for(let{call:t,index:n}of o){if(l.get(t.id)!==1)continue;let r=t.function.name,i=lT(t.function.arguments),a=(u.get(t.id)??[]).filter(e=>e.index>n),o=a.length===1||sT.has(r)&&a.length>1&&a.slice(0,-1).every(e=>wT(e.message))?a.at(-1).message:void 0,S=o&&lT(o.content),C=!!S&&o?.role===`tool`&&!o.error&&!S.error&&!S.isError,te=o?C?`complete`:`failed`:`incomplete`;if(r===`get_telemetry_schema`&&(s.schema={state:te}),xT.has(r)){let e=o?.role===`tool`&&!o.error&&!S?.error&&!S?.isError&&typeof o.content==`string`&&o.content.length>0;if(s.context={state:o?e?`complete`:`failed`:`incomplete`},C)for(let[e,t]of[[`deploys`,[`deploys`,`deployments`]],[`anomalies`,[`anomalies`]]])for(let n of t)Array.isArray(S[n])&&(c.context_counts[e]+=S[n].length)}if(r===`preview_panels`||r===`create_dashboard`||r===`replace_dashboard`){let e=r===`preview_panels`?i?.panels:cT(i?.dashboard)?i.dashboard.panels:void 0;if(Array.isArray(e)){c.panel_count=e.length,s.draft={state:`complete`};for(let t of e)cT(t)&&typeof t.id==`string`&&typeof t.title==`string`&&t.title.trim()&&f.set(t.id,t.title)}}if(r===`preview_panels`){x=!0;let e=Array.isArray(i?.panels)?i.panels.flatMap(e=>cT(e)&&typeof e.id==`string`?[e.id]:[]):[];for(let t of e)v.set(t,{id:t,status:`not_run`});let t=C&&Array.isArray(S.panels)&&S.panels.every(fT)?S.panels:void 0,n=typeof S?.elapsed_ms==`number`&&S.elapsed_ms>=0?S.elapsed_ms:void 0;if(s.validation={state:t?t.some(e=>e.status===`invalid`||e.status===`not_run`)||ST(S?.problems,`dashboard`).length?`failed`:`complete`:te===`complete`?`failed`:te},s.preview={state:t?t.every(TT)?`complete`:`incomplete`:te===`complete`?`failed`:te,elapsed_ms:n},!t||e.length===0||t.length!==e.length||new Set(t.map(e=>e.id)).size!==e.length||t.some(t=>!e.includes(t.id))){ee=e.length===0;for(let t of e)o&&b.add(t);continue}ee=!1;for(let t of e)b.delete(t);for(let e of t){let t=ST(e.problems,e.id);if(e.status!==`not_run`)_(e.id,t);else{let n=y.get(e.id)??[];y.set(e.id,[...n,...t.filter(e=>!n.some(t=>t.path===e.path))])}v.set(e.id,e)}c.problems=[...y.values()].flat().concat(ST(S?.problems,`dashboard`))}if(sT.has(r)){let n=o&&mT(t.id,o.content,e),r=!!o&&wT(o),i=!r&&o?.role===`tool`&&(!!o.error||!!S?.error||!!S?.isError);if(g=!!i,h=!!o&&!n&&!i&&!r,s.save={state:n?`complete`:r?`interrupted`:i?`failed`:`incomplete`},n)for(let e of c.save_attempts)e.state===`failed`&&(e.state=`retried`);if(c.save_attempts.push({call_id:t.id,state:s.save.state}),n){m?.id!==n.id&&(m=n,d.clear());for(let e of n.receipt.changes){e.title.trim()&&f.set(e.panel_id,e.title);let t=d.get(e.panel_id);if(t?.kind===`added`&&e.kind===`removed`){d.delete(e.panel_id);continue}if(t?.kind===`added`){d.set(e.panel_id,{panel_id:e.panel_id,title:e.title,kind:`added`});continue}if(e.kind===`removed`){d.set(e.panel_id,e);continue}t&&e.kind===`changed`?d.set(e.panel_id,{...e,fields:[...new Set([...t.fields??[],...e.fields??[]])].sort(),position_changed:t.position_changed||e.position_changed}):d.set(e.panel_id,t?.kind===`removed`&&e.kind===`added`?{...e,kind:`changed`}:e)}let e=S?.dashboard,t=cT(e)?e.spec:void 0;if(cT(t)&&Array.isArray(t.panels))for(let e of t.panels)cT(e)&&typeof e.id==`string`&&typeof e.title==`string`&&e.title.trim()&&f.set(e.id,e.title);let r=c.saved?.id===n.id?c.saved.receipt:void 0;c.saved={...n,label:m.label,receipt:{...n.receipt,base_version:m.receipt.base_version,changes:[...d.values()],layout_changed:m.receipt.base_version!==0&&(n.receipt.layout_changed||!!r?.layout_changed),dashboard_fields:m.receipt.base_version===0?void 0:[...new Set([...r?.dashboard_fields??[],...n.receipt.dashboard_fields??[]])].sort()}},c.panel_count=n.receipt.save_check.panels.length,s.draft={state:`complete`};let i=new Set(n.receipt.save_check.panels.map(e=>e.id));for(let e of n.receipt.save_check.panels)e.status===`invalid`?_(e.id,ST(e.problems,e.id)):TT(e)&&(_(e.id,[]),b.delete(e.id));p=p.filter(e=>i.has(e.panel_id)),c.problems=[...y.values()].flat().filter(e=>i.has(e.panel_id))}}}if(h)return null;c.panel_titles=Object.fromEntries(f),c.corrections=p.map(e=>({...e,title:f.get(e.panel_id)??e.panel_id}));let S=c.saved?new Set(c.saved.receipt.save_check.panels.map(e=>e.id)):void 0;if(c.panels=[...v.values()].filter(e=>!S||S.has(e.id)),x){let e=ee||[...b].some(e=>!S||S.has(e)),t=c.panels.some(e=>e.status===`not_run`),n=c.problems.length>0;s.validation.state=e||n?`failed`:t?`incomplete`:`complete`,s.preview.state=e?`failed`:t||n||c.panels.some(e=>e.status===`invalid`)?`incomplete`:`complete`}let C=c.saved?.receipt.save_check;C&&!C.checked&&c.explanations.push(`Save check incomplete: ${C.reason||`Panels were not checked`}`);for(let e of C?.panels??c.panels)e.status!==`ok`&&c.explanations.push(`${f.get(e.id)??e.id}: ${e.status}${e.error||e.diagnosis?` — ${e.error||e.diagnosis}`:``}`);for(let e of c.problems)c.explanations.push(`${f.get(e.panel_id)??e.panel_id}: ${e.message}`);let te=Object.entries(s).filter(([,e])=>e.state===`incomplete`||e.state===`failed`).map(([e,t])=>`${bT[e]}: ${t.state}`);return te.length&&c.explanations.push(te.join(` · `)),s.save.state===`interrupted`&&c.explanations.push(`Save interrupted · outcome unknown`),g&&c.explanations.push(c.saved?`A later change failed; v${c.saved.version} remains saved`:`Save failed · dashboard was not saved`),c}var DT=(0,k.createContext)(null);function OT(){let e=(0,k.useContext)(DT);if(!e)throw Error(`Fanout app context is unavailable`);return e}var kT=`Build me a dashboard for my services, showing request volume, latency, and errors. Ask me which services to monitor first.`,AT={query_telemetry:{activity:`Querying telemetry…`,title:`Telemetry panels`},get_overview:{activity:`Checking system health…`,title:`System health`},get_service_topology:{activity:`Mapping service dependencies…`,title:`Service map`},get_service_dependencies:{activity:`Tracing service dependencies…`,title:`Service dependencies`},list_panel_exemplars:{activity:`Finding example traces…`,title:`Example traces`},resolve_panel_variables:{activity:`Reading filter choices…`,title:`Filter choices`},query_panel_fragment:{activity:`Refreshing panels…`,title:`Panel refresh`},get_service_performance:{activity:`Reading performance signals…`,title:`Performance`},inspect_trace:{activity:`Inspecting a trace…`,title:`Trace lookup`},search_logs:{activity:`Searching logs…`,title:`Logs`},get_insights:{activity:`Reviewing detected anomalies…`,title:`Detected anomalies`},get_telemetry_schema:{activity:`Reading what telemetry exists…`,title:`Telemetry discovery`},preview_panels:{activity:`Checking dashboard panels…`,title:`Panel check`},list_dashboards:{activity:`Looking through your dashboards…`,title:`Dashboards`},get_dashboard:{activity:`Opening your dashboard…`,title:`Dashboard`},create_dashboard:{activity:`Building your dashboard…`,title:`Dashboard save`},edit_dashboard:{activity:`Updating your dashboard…`,title:`Dashboard save`},replace_dashboard:{activity:`Redesigning your dashboard…`,title:`Dashboard save`},list_dashboard_versions:{activity:`Reading your dashboard history…`,title:`Dashboard history`},restore_dashboard_version:{activity:`Restoring your dashboard…`,title:`Dashboard`}};function jT(e){return AT[e]?.activity??`Working on it…`}function MT(e){return AT[e]?.title??`Analysis step`}function NT(e){switch(e){case`provider_unavailable`:return`Fanout could not reach the model provider. Please try again.`;case`step_limit`:return`Fanout reached its step limit before finishing. Try a narrower question.`;case`time_limit`:return`Fanout reached its 5-minute time limit. Try a smaller request.`;default:return`Fanout could not complete this analysis. Please try again.`}}function PT(e){let t=(0,k.useRef)(new Map);return(0,k.useMemo)(()=>{let n=new Map,r=new Set,i=e.flatMap((e,t)=>e.role===`user`?[t]:[]);i.forEach((a,o)=>{let s=i[o+1]??e.length,c=e[a],l=e[s-1];r.add(c.id);let u=t.current.get(c.id),d=u&&u.last===l&&u.length===s-a?u.receipt:ET(e.slice(a,s),c.id);oe.msecs?(e.seq=UT(n),e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function HT(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??=UT(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 UT(e){return(e[6]&127)<<24|e[7]<<16|e[8]<<8|e[9]}function WT(){return BT()}function GT(){let{setColorScheme:e}=ar(),t=cr(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`,[r,i]=(0,k.useState)(!1);return(0,A.jsx)(Bi,{label:`Switch to ${n} theme`,opened:r,children:(0,A.jsx)(Ne,{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,A.jsx)(iT,{size:17,weight:`bold`}):(0,A.jsx)(Rw,{size:17,weight:`bold`})})})}function KT(){let e=(0,k.useRef)(null);return(0,k.useRef)({remember(t){e.current=t instanceof HTMLElement?t:null},restore(t){let n=e.current;requestAnimationFrame(()=>(n?.isConnected?n:t)?.focus())}}).current}var qT=`fanout:shortcuts`,JT=0,YT=new Set,XT=()=>{for(let e of YT)e()};function ZT(e){(0,k.useEffect)(()=>(window.addEventListener(qT,e),JT+=1,XT(),()=>{window.removeEventListener(qT,e),--JT,XT()}),[e])}function QT(){return(0,k.useSyncExternalStore)(e=>(YT.add(e),()=>YT.delete(e)),()=>JT>0,()=>!1)}function $T(){let e=QT(),t=(0,k.useRef)(null);return(0,A.jsxs)(Ot,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,A.jsx)(Ot.Target,{children:(0,A.jsx)(Bi,{label:`Help`,children:(0,A.jsx)(Ne,{ref:t,variant:`subtle`,color:`gray`,"aria-label":`Help`,children:(0,A.jsx)(Kw,{size:18,weight:`bold`})})})}),(0,A.jsxs)(Ot.Dropdown,{children:[(0,A.jsx)(Ot.Item,{component:`a`,href:Gt.home,target:`_blank`,rel:`noopener noreferrer`,leftSection:(0,A.jsx)(Ew,{size:15}),children:`Documentation`}),e&&(0,A.jsx)(Ot.Item,{leftSection:(0,A.jsx)(Et,{size:15}),rightSection:(0,A.jsx)(Ei,{size:`xs`,children:`?`}),onClick:()=>{t.current?.focus(),window.dispatchEvent(new Event(qT))},children:`Keyboard shortcuts`})]})]})}var eE=new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}),tE=new Intl.NumberFormat(`en`,{maximumFractionDigits:2});function nE(e){return Math.abs(e)<1e-4?e.toExponential(2).replace(/\.?(0+)(?=e)/,``):String(Number(e.toPrecision(3)))}function rE(e,t=tE){return e!==0&&Math.abs(e)<1?nE(e):t.format(e)}function iE(e,t){let n=t===`s`?e*1e3:t===`ns`?e/1e6:e;return e!==0&&n===0?`${nE(e)} ${t}`:n!==0&&Math.abs(n)<1?`${nE(n)} ms`:Ut(n)}var aE=[`B`,`KiB`,`MiB`,`GiB`,`TiB`];function oE(e){let t=e,n=0;for(;Math.abs(t)>=1024&&n=1e4?eE:tE);default:return rE(t,Math.abs(t)>=1e4?eE:tE)}}var cE={ms:1,s:1e3,ns:1e-6},lE=[[36e5,`h`],[6e4,`m`],[1e3,`s`],[1,`ms`]];function uE(e,t){let n=e===void 0?void 0:cE[e];if(e===`bytes`&&t&&t.interval>0){let e=Math.max(Math.abs(t.min),Math.abs(t.max)),n=[4,3,2,1].find(n=>e>=1024**n&&Math.abs(t.interval/1024**n*100-Math.round(t.interval/1024**n*100))<1e-6)??0;return e=>Number.isFinite(e)?`${rE(e/1024**n)} ${aE[n]}`:`—`}if(e===`percent`&&t&&t.interval>0){let e=[0,1,2,3,4].find(e=>{let n=t.interval*10**e;return Math.round(n)!==0&&Math.abs(n-Math.round(n))<1e-6*Math.abs(n)});if(e!==void 0){let t=new Intl.NumberFormat(`en`,{minimumFractionDigits:e,maximumFractionDigits:e});return e=>Number.isFinite(e)?`${t.format(e)}%`:`—`}}if(n!==void 0&&t&&t.interval>0){let e=Math.max(Math.abs(t.min),Math.abs(t.max))*n,r=t.interval*n,[i,a]=lE.find(([t])=>e>=t&&Math.abs(r/t*100-Math.round(r/t*100))<1e-6)??[1,`ms`];return e=>Number.isFinite(e)?`${rE(e*n/i)} ${a}`:`—`}return t=>(!e||e===`count`)&&Math.abs(t)>=1e3?rE(t,eE):e===`ms`||e===`s`||e===`ns`?sE(e,t).replace(/(\.\d*?)0+([a-z]*)$/,`$1$2`).replace(/\.([a-z]*)$/,`$1`):sE(e,t)}function dE(e){return e!==void 0&&e!==`count`&&/[^\d\s]$/.test(uE(e)(1).trim())}function fE(e,t,n){return uE(e,n)(t??NaN).replace(/(?<=\d)(ms|ns|s|m|h)\b/g,` $1`)}function pE(e){return Math.max(3,Math.min(10,Math.round(e/70)))-1}function mE(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(t===`bytes`){let t=Math.min(4,Math.max(0,Math.floor(Math.log(e)/Math.log(1024)))),n=r(Math.max(e/1024**t,+(t===0)));return(n>=1e3&&t<4?1024:n)*1024**t}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 hE(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=pE(r),a=mE(Math.max(t-e,2**-52)/i,n);for(let r=0;r<64&&Math.ceil(t/a)-Math.floor(e/a)>i;r++)a=mE(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 gE(e,t){if(e.type!==`value`&&e.type!==`log`)return e;if(e.type!==`value`||typeof e.min!=`number`||typeof e.max!=`number`)return{...e,splitNumber:pE(t)};let n=typeof e.fanout_unit==`string`?e.fanout_unit:void 0,r=hE(e.min,e.max,n,t);return{...e,...r,...n&&(n in cE||n===`bytes`||n===`percent`)?{axisLabel:{...e.axisLabel,formatter:uE(n,r)}}:{}}}function _E(e,t,n){let r=e=>sE(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 vE(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 yE(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(`:`)}`}var bE=[{path:`/explore`,label:`Explore`,Icon:Aw},{path:`/logs`,label:`Logs`,Icon:Pw},{path:`/traces`,label:`Traces`,Icon:Bw},{path:`/alerts`,label:`Alerts`,Icon:ww},{path:`/settings`,label:`Settings`,Icon:Mw}];async function xE(e,t){let n=new URLSearchParams({page_size:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await Wt(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function SE({collapsed:e=!1,agentAvailable:t,activeThreadID:n,activeDashboardID:r,activePath:i,autoFocusSearch:a=!1,onNewChat:o,onSelectThread:s,onDeletedThread:l,onSelectDashboard:d,onCreateDashboard:f,onNewDashboard:p,onNavigate:h,onInvestigateService:g,ref:_}){let v=Zt(),[y,b]=(0,k.useState)(``),[x]=er(y.trim(),250),[ee,S]=(0,k.useState)(null),[C,w]=(0,k.useState)(null),[ne,re]=(0,k.useState)(``),[ie,ae]=(0,k.useState)(``),[oe,se]=(0,k.useState)(!1),ce=(0,k.useRef)(null);(0,k.useImperativeHandle)(_,()=>({focusSearch:()=>ce.current?.focus()}),[]),(0,k.useEffect)(()=>{a&&requestAnimationFrame(()=>ce.current?.focus())},[a]);let le=iw({queryKey:[...aT,x],queryFn:({pageParam:e})=>xE(x,e),initialPageParam:``,getNextPageParam:e=>e.next_cursor??void 0,enabled:t}),ue=hn({queryKey:Pt,queryFn:It,refetchInterval:3e4,staleTime:Nt}),de=(0,k.useMemo)(()=>le.data?.pages.flatMap(e=>e.items)??[],[le.data]),pe=(0,k.useMemo)(()=>OE(de),[de]),T=hn({queryKey:[`telemetry-schema`,`1h`],queryFn:()=>oT(`/api/telemetry/schema?window=1h`),enabled:t&&!!x&&!!g,staleTime:6e4}),me=(0,k.useMemo)(()=>{if(!x)return[];let e=x.toLowerCase();return(T.data?.services??[]).map(e=>e.value).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[T.data,x]),he=(0,k.useMemo)(()=>{let e=ue.data??[],t=x.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[ue.data,x]);function ge(e){ae(``),re(e.title),S(e)}async function _e(){if(ee&&ne.trim()){se(!0),ae(``);try{let e=await Wt(`/api/agent/threads/${encodeURIComponent(ee.id)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:ne.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await v.invalidateQueries({queryKey:aT}),S(null)}catch(e){ae(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{se(!1)}}}async function ve(){if(C){se(!0),ae(``);try{let e=await Wt(`/api/agent/threads/${encodeURIComponent(C.id)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=C.id;w(null),await v.invalidateQueries({queryKey:aT}),await v.invalidateQueries({queryKey:Pt}),l(t)}catch(e){ae(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{se(!1)}}}return e?(0,A.jsxs)(te,{gap:4,component:`nav`,"aria-label":`Navigation`,children:[t&&(0,A.jsx)(Ne,{variant:`subtle`,color:`gray`,size:46,"aria-label":`New chat`,title:`New chat`,onClick:o,children:(0,A.jsx)(Ww,{size:18})}),t&&(0,A.jsxs)(Ot,{position:`right-start`,withinPortal:!0,shadow:`md`,children:[(0,A.jsx)(Ot.Target,{children:(0,A.jsx)(Ne,{variant:`subtle`,color:`gray`,size:46,"aria-label":`Chats`,title:`Chats`,className:`rail-row`,"data-active":!!n||void 0,children:(0,A.jsx)(Ow,{size:18})})}),(0,A.jsxs)(Ot.Dropdown,{maw:280,children:[(0,A.jsx)(Ot.Label,{children:`Recent chats`}),le.isPending?(0,A.jsx)(Ot.Item,{disabled:!0,children:`Loading chats…`}):le.isError?(0,A.jsx)(Ot.Item,{onClick:()=>void le.refetch(),children:`Chats could not be loaded. Retry`}):de.length===0&&(0,A.jsx)(Ot.Item,{disabled:!0,children:`No chats yet`}),de.slice(0,10).map(e=>(0,A.jsx)(Ot.Item,{"aria-current":e.id===n?`page`:void 0,fw:e.id===n?600:void 0,onClick:()=>s(e.id),children:(0,A.jsx)(D,{size:`sm`,truncate:!0,children:e.title||`Untitled chat`})},e.id))]})]}),bE.map(({path:e,label:t,Icon:n})=>(0,A.jsx)(Ne,{component:`a`,href:e,title:t,"aria-label":t,"aria-current":i===e||i?.startsWith(`${e}/`)?`page`:void 0,className:`rail-row`,"data-active":i===e||i?.startsWith(`${e}/`)||void 0,variant:`subtle`,color:`gray`,size:46,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),h(e))},children:(0,A.jsx)(n,{size:18})},e)),(0,A.jsxs)(Ot,{position:`right-start`,withinPortal:!0,shadow:`md`,children:[(0,A.jsx)(Ot.Target,{children:(0,A.jsx)(Ne,{variant:`subtle`,color:`gray`,size:46,"aria-label":`Dashboards`,title:`Dashboards`,className:`rail-row`,"data-active":!!r||void 0,children:(0,A.jsx)(eT,{size:18})})}),(0,A.jsxs)(Ot.Dropdown,{maw:280,children:[(0,A.jsx)(Ot.Label,{children:`Dashboards`}),ue.isPending&&(0,A.jsx)(Ot.Item,{disabled:!0,children:`Loading dashboards…`}),ue.isError&&(0,A.jsx)(Ot.Item,{onClick:()=>void ue.refetch(),children:`Dashboards could not be loaded. Retry`}),(ue.data??[]).map(e=>(0,A.jsx)(Ot.Item,{"aria-current":e.id===r?`page`:void 0,fw:e.id===r?600:void 0,onClick:()=>d(e.id),children:(0,A.jsx)(D,{size:`sm`,truncate:!0,children:e.name})},e.id)),ue.data?.length?(0,A.jsx)(Ot.Divider,{}):null,(0,A.jsx)(Ot.Item,{leftSection:(0,A.jsx)(Ww,{size:14}),onClick:p,children:`New dashboard`})]})]})]}):(0,A.jsxs)(te,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[t&&(0,A.jsx)(we,{leftSection:(0,A.jsx)(Ww,{size:16,weight:`bold`}),onClick:o,children:`New chat`}),(0,A.jsx)(O,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,A.jsxs)(te,{gap:`lg`,pb:`sm`,children:[t&&(0,A.jsxs)(te,{gap:4,children:[(0,A.jsx)(CE,{children:`Chats`}),le.isLoading&&(0,A.jsx)(fe,{state:`loading`,rows:3}),le.isError&&(0,A.jsx)(fe,{state:`error`,error:{message:`Chats could not be loaded.`,onRetry:()=>void le.refetch()}}),!le.isLoading&&!le.isError&&de.length===0&&(0,A.jsx)(D,{size:`xs`,c:`dimmed`,px:`sm`,children:x?`No matching chats. Try another name.`:`No chats yet. Start one above.`}),pe.map(e=>(0,A.jsxs)(te,{gap:2,children:[pe.length>1&&(0,A.jsx)(D,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,A.jsx)(wE,{thread:e,active:(i?i.startsWith(`/chat/`):!r)&&e.id===n,onSelect:()=>s(e.id),onRename:()=>ge(e),onDelete:()=>{ae(``),w(e)}},e.id))]},e.label)),le.hasNextPage&&(0,A.jsx)(we,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:le.isFetchingNextPage,onClick:()=>void le.fetchNextPage(),children:`See all`})]}),t&&x&&g&&T.isLoading&&(0,A.jsx)(fe,{state:`loading`,rows:3}),t&&x&&g&&(T.isSuccess||T.isError)&&(0,A.jsxs)(te,{gap:4,children:[(0,A.jsx)(CE,{children:`Services`}),T.isError&&(0,A.jsx)(D,{c:`dimmed`,size:`sm`,px:`sm`,children:`Services could not be searched`}),T.isSuccess&&me.length===0&&(0,A.jsx)(fe,{state:`empty`,variant:`inline`,empty:{title:`No matching services`,description:`Try a different service name.`,action:(0,A.jsx)(we,{variant:`subtle`,size:`compact-xs`,onClick:()=>b(``),children:`Clear search`})}}),me.map(e=>(0,A.jsx)(Ve,{className:`rail-row`,p:`sm`,onClick:()=>g(e),children:(0,A.jsx)(D,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,A.jsx)(te,{gap:0,children:bE.map(({path:e,label:t,Icon:n})=>{let r=i===e;return(0,A.jsx)(Ve,{component:`a`,href:e,className:`rail-row`,"data-active":r||void 0,"aria-current":r?`page`:void 0,p:`sm`,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),h(e))},children:(0,A.jsxs)(m,{gap:`xs`,wrap:`nowrap`,children:[(0,A.jsx)(n,{size:16}),(0,A.jsx)(D,{size:`sm`,fw:r?600:500,children:t})]})},e)})}),(0,A.jsxs)(te,{gap:4,children:[(0,A.jsx)(CE,{children:`Dashboards`}),ue.isLoading&&(0,A.jsx)(fe,{state:`loading`,rows:3}),ue.isError&&(0,A.jsx)(Le,{tone:`danger`,children:`Dashboards could not be loaded.`}),!ue.isLoading&&!ue.isError&&x&&he.length===0&&(0,A.jsx)(fe,{state:`empty`,variant:`inline`,empty:{title:`No matching dashboards`,description:`Try a different dashboard name.`,action:(0,A.jsx)(we,{variant:`subtle`,size:`compact-xs`,onClick:()=>b(``),children:`Clear search`})}}),he.map(e=>{let n=(!i||i.startsWith(`/dashboards`))&&e.id===r;return(0,A.jsxs)(te,{gap:0,children:[(0,A.jsx)(Ve,{component:`a`,href:`/dashboards/${encodeURIComponent(e.id)}`,className:`rail-row`,"data-active":n||void 0,"aria-current":n?`page`:void 0,p:`sm`,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),d(e.id))},children:(0,A.jsxs)(m,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,A.jsxs)(m,{gap:`xs`,wrap:`nowrap`,style:{minWidth:0,flex:1},children:[(0,A.jsx)(eT,{size:16,style:{flexShrink:0}}),(0,A.jsx)(D,{size:`sm`,fw:n?600:500,truncate:!0,title:e.name,children:e.name})]}),e.is_default&&(0,A.jsx)(Bi,{label:`Default`,children:(0,A.jsx)(c,{size:16,variant:`light`,color:`gray`,role:`img`,"aria-label":`Default`,style:{flexShrink:0},children:(0,A.jsx)(nT,{size:12,weight:`fill`,"aria-hidden":`true`})})})]})}),t&&e.origin&&(0,A.jsx)(Ve,{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(),s(e.origin.thread_id))},children:(0,A.jsxs)(D,{size:`xs`,c:`dimmed`,lineClamp:2,title:`Built from: ${e.origin.request_excerpt}`,children:[`Built from: `,e.origin.request_excerpt]})})]},e.id)}),(0,A.jsx)(we,{variant:`subtle`,color:`gray`,size:`sm`,px:`sm`,justify:`flex-start`,leftSection:(0,A.jsx)(Ww,{size:14}),onClick:p,children:`New dashboard`}),t&&(0,A.jsx)(we,{variant:`subtle`,color:`gray`,size:`sm`,px:`sm`,justify:`flex-start`,leftSection:(0,A.jsx)(Qw,{size:14,weight:`fill`}),onClick:f,children:`Create with AI`})]})]})}),(0,A.jsx)(Ge,{ref:ce,value:y,onChange:e=>b(e.currentTarget.value),leftSection:(0,A.jsx)(Iw,{size:15}),rightSection:(0,A.jsx)(Ei,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,A.jsx)(u,{opened:ee!==null,onClose:()=>!oe&&S(null),title:`Rename chat`,centered:!0,children:(0,A.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),_e()},children:(0,A.jsxs)(te,{children:[(0,A.jsx)(Ge,{label:`Name`,value:ne,onChange:e=>re(e.currentTarget.value),maxLength:120,autoFocus:!0}),ie&&(0,A.jsx)(Le,{tone:`danger`,children:ie}),(0,A.jsxs)(m,{justify:`flex-end`,children:[(0,A.jsx)(we,{variant:`default`,onClick:()=>S(null),disabled:oe,children:`Cancel`}),(0,A.jsx)(we,{type:`submit`,loading:oe,disabled:!ne.trim(),children:`Save`})]})]})})}),(0,A.jsxs)(He,{opened:C!==null,onClose:()=>w(null),title:`Delete chat?`,confirmLabel:`Delete chat`,tone:`danger`,pending:oe?`confirm`:null,error:ie||void 0,onConfirm:()=>void ve(),children:[`This permanently removes `,(0,A.jsx)(D,{span:!0,ff:`monospace`,children:C?.title}),` and its saved messages.`]})]})}function CE({children:e}){return(0,A.jsx)(D,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function wE({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,A.jsx)(w,{"data-active":t||void 0,className:`rail-row`,children:(0,A.jsxs)(m,{gap:2,wrap:`nowrap`,children:[(0,A.jsx)(Ve,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,A.jsxs)(te,{gap:0,pl:24,style:{position:`relative`},children:[(0,A.jsx)(Ow,{size:16,style:{position:`absolute`,left:0,top:2}}),(0,A.jsx)(D,{size:`sm`,fw:t?600:500,truncate:!0,title:e.title,children:e.title}),(0,A.jsx)(D,{c:`dimmed`,size:`xs`,ff:`monospace`,children:kE(e.updated_at)})]})}),(0,A.jsxs)(Ot,{position:`bottom-end`,withinPortal:!0,children:[(0,A.jsx)(Ot.Target,{children:(0,A.jsx)(Ne,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,A.jsx)(jt,{size:18,weight:`bold`})})}),(0,A.jsxs)(Ot.Dropdown,{children:[(0,A.jsx)(Ot.Item,{leftSection:(0,A.jsx)(Ct,{size:15}),onClick:r,children:`Rename`}),(0,A.jsx)(Ot.Item,{color:`bad`,leftSection:(0,A.jsx)(ht,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function TE(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function EE(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var DE=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function OE(e){let t=EE(new Date),n=new Map;for(let r of e){let e=Math.floor((t-EE(TE(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 DE.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function kE(e){return yE(TE(e).valueOf())}var AE=(0,k.lazy)(()=>st(()=>import(`./new-dashboard-xnHgERfr.js`).then(e=>({default:e.NewDashboard})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])));function jE({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=OT(),s=$e(),c=Qn({select:e=>e.location.pathname}),{dashboardId:l}=ut({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=tr(!1),[p,h]=(0,k.useState)(!1),[g,_]=(0,k.useState)(!1),[v,y]=(0,k.useState)(``),[b,x]=(0,k.useState)(!1),ee=(0,k.useRef)(null),S=(0,k.useRef)(null),C=KT(),te=he(`(max-width: 62em)`),ne=he(`(max-width: 48em)`),re=(0,k.useRef)(te),ie=()=>{te?(_(!0),f.open()):(h(!1),requestAnimationFrame(()=>ee.current?.focusSearch()))};re.current=te,(0,k.useEffect)(()=>{f.close()},[c]),(0,k.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),re.current?(_(!0),f.open()):(h(!1),requestAnimationFrame(()=>ee.current?.focusSearch())))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let ae={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,activePath:c,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{}}),onCreateDashboard:()=>o(kT),onNewDashboard:()=>{C.remember(re.current?S.current:document.activeElement),f.close(),x(!0)},onNavigate:e=>void s({to:e}),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)},oe=()=>{x(!1),C.restore()};return(0,A.jsxs)(li,{header:{height:56},navbar:{width:p?56:248,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,A.jsx)(`a`,{className:`skip-link`,href:`#main`,children:`Skip to content`}),(0,A.jsx)(li.Header,{children:(0,A.jsxs)(m,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,A.jsxs)(m,{gap:`sm`,wrap:`nowrap`,children:[(0,A.jsx)(Ci,{ref:S,hiddenFrom:`md`,opened:d,"aria-expanded":d,onClick:()=>{_(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,A.jsx)(Ne,{visibleFrom:`md`,variant:`subtle`,color:`gray`,"aria-label":p?`Expand navigation`:`Collapse navigation`,"aria-expanded":!p,onClick:()=>h(e=>!e),children:(0,A.jsx)(Jw,{size:18})}),(0,A.jsx)(Be,{size:`small`})]}),ne?(0,A.jsx)(Ne,{variant:`default`,size:`lg`,"aria-label":`Search`,onClick:ie,children:(0,A.jsx)(Iw,{size:16})}):(0,A.jsx)(we,{variant:`default`,color:`gray`,leftSection:(0,A.jsx)(Iw,{size:16}),onClick:ie,children:`Search · ⌘K`}),(0,A.jsx)(w,{id:`shell-time-range`,visibleFrom:`sm`}),(0,A.jsxs)(m,{gap:`xs`,wrap:`nowrap`,children:[(0,A.jsx)($T,{}),(0,A.jsx)(GT,{}),(0,A.jsx)(ME,{onError:y})]})]})}),(0,A.jsx)(li.Navbar,{p:p?4:`sm`,children:(0,A.jsx)(SE,{ref:ee,...ae,collapsed:p})}),(0,A.jsx)(gt,{opened:d,onClose:f.close,returnFocus:!b,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,A.jsx)(Be,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,A.jsx)(SE,{...ae,autoFocusSearch:d&&g})}),(0,A.jsxs)(li.Main,{id:`main`,tabIndex:-1,children:[v&&(0,A.jsx)(Le,{tone:`danger`,onDismiss:()=>y(``),children:v}),e]}),b&&(0,A.jsx)(k.Suspense,{fallback:null,children:(0,A.jsx)(AE,{onClose:oe,onCreated:e=>{x(!1),s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{}})}})})]})}function ME({onError:e}){let t=$e(),n=Jt(),r=(n.display_name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,A.jsxs)(Ot,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,A.jsx)(Ot.Target,{children:(0,A.jsx)(Ne,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`${r} account menu`,children:(0,A.jsx)(bi,{size:26,radius:`xl`,color:`gray`,children:r})})}),(0,A.jsxs)(Ot.Dropdown,{children:[(0,A.jsx)(Ot.Label,{children:n.email||`Signed in`}),(0,A.jsx)(Ot.Item,{leftSection:(0,A.jsx)(Hw,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,A.jsx)(Ot.Divider,{}),(0,A.jsx)(Ot.Item,{leftSection:(0,A.jsx)(Xw,{size:15}),onClick:()=>void qt().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function NE(){let{agent_available:e}=Kt(),t=$e(),n=Zt(),{threadId:r}=ut({strict:!1}),[i,a]=(0,k.useState)(WT),o=(0,k.useRef)(new Set),s=r??i,[c,l]=(0,k.useState)([]),[u,d]=(0,k.useState)({}),[f,p]=(0,k.useState)(``),[m,h]=(0,k.useState)(!1),[g,_]=(0,k.useState)(!1),[v,y]=(0,k.useState)(``),[b,x]=(0,k.useState)(!1),ee=(0,k.useRef)(!1),[S,C]=(0,k.useState)(``),[te,w]=(0,k.useState)(``),[ne,re]=(0,k.useState)(0),ie=(0,k.useRef)(null),ae=(0,k.useRef)({}),oe=(0,k.useRef)(null),se=(0,k.useRef)(new Map),ce=(0,k.useMemo)(()=>new XC({url:`/api/agent/runs`,threadId:s,fetch:(e,t)=>Wt(e,t)}),[s]),le=!e||f===s;function ue(){se.current.clear(),y(``)}function de(e){return ee.current||e instanceof Error&&e.name===`AbortError`}(0,k.useEffect)(()=>{let t=!0;if(l([]),ae.current={},d({}),p(``),h(!1),_(!1),ee.current=!1,x(!1),ue(),w(``),!e){p(s);return}!r||o.current.has(s)?(ce.setMessages([]),p(s)):Wt(`/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}ce.setMessages(e.messages??[]),l(e.messages??[]),p(s)}}).catch(()=>{t&&(ie.current=null,w(`This chat could not be restored. Start a new chat or try again.`))});let i=ce.subscribe({onMessagesChanged:({messages:e})=>l([...e]),onRunInitialized:()=>{ee.current=!1,x(!1),_(!0),w(``)},onTextMessageContentEvent:({event:e})=>{e.delta&&y(``)},onToolCallStartEvent:({event:e})=>{se.current.set(e.toolCallId,jT(e.toolCallName)),y(jT(e.toolCallName))},onToolCallResultEvent:({event:e,messages:t})=>{se.current.delete(e.toolCallId),y([...se.current.values()].at(-1)??`Analyzing your system`);let r=mT(e.toolCallId,e.content,t);r&&(n.invalidateQueries({queryKey:Pt}),n.invalidateQueries({queryKey:[`dashboard`,r.id]}),n.invalidateQueries({queryKey:[`dashboard-versions`,r.id]}))},onRunErrorEvent:({event:e})=>{e.code===`abort`||ee.current?(w(``),x(!0)):(console.warn(`Agent run error`,e.code),w(NT(e.code))),_(!1),ue()},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),ue(),o.current.delete(s),n.invalidateQueries({queryKey:aT})},onRunFailed:e=>{de(e.error)?(w(``),x(!0)):(console.error(`Agent run failed`,e),w(NT())),_(!1),ue(),o.current.delete(s),n.invalidateQueries({queryKey:aT})}});return()=>{t=!1,i.unsubscribe(),ce.abortRun()}},[ce,e,n,ne,s]),(0,k.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(()=>oe.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>oe.current?.focus()))),e.key===`Escape`&&n===oe.current&&(C(``),oe.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function fe(){_(!0),w(``);try{let{context:e=[],...t}=ae.current;await ce.runAgent({context:e,forwardedProps:t})}catch(e){de(e)?(w(``),x(!0)):(console.error(`Agent run failed`,e),w(NT())),_(!1),ue(),o.current.delete(s)}}async function pe(n,i){let a=n.trim();if(!e||!a||g||!le||m)return;ae.current={...i},r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let c={id:WT(),role:`user`,content:a};ce.addMessage(c),l([...ce.messages]),d(e=>({...e,[c.id]:Date.now()})),C(``),await fe()}(0,k.useEffect)(()=>{let e=ie.current;le&&r&&e&&(ie.current=null,pe(e.text,e.options))},[le,r,s]);function T(e){e.preventDefault(),pe(S)}function me(){ee.current=!0,w(``),x(!0),ce.abortRun(),_(!1),ue(),o.current.delete(s)}function he(){!g&&ce.messages.some(e=>e.role===`user`)&&fe()}function ge(n,r){if(!e)return;let i=WT();o.current.add(i),ie.current=n?{text:n,options:{...r}}:null,t({to:`/chat/$threadId`,params:{threadId:i}})}function _e(){ce.abortRun(),ie.current=null,ae.current={},a(WT()),t({to:`/chat`})}function ve(e){ie.current=null,ae.current={},t({to:`/chat/$threadId`,params:{threadId:e}})}function ye(){re(e=>e+1)}return(0,A.jsx)(DT.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:le,running:g,activity:v,stopped:b,input:S,setInput:C,error:te,inputRef:oe,send:pe,submit:T,stop:me,retry:he,reloadThread:ye,openChat:ge,newThread:_e,selectThread:ve},children:(0,A.jsx)(jE,{children:(0,A.jsx)(Hn,{})})})}function PE(){let e=(0,k.useMemo)(()=>new rw,[]);return(0,A.jsx)(vn,{client:e,children:(0,A.jsx)(Yt,{children:(0,A.jsx)(NE,{})})})}var FE=ft({component:PE,notFoundComponent:()=>(0,A.jsx)(et,{to:`/`,replace:!0})}),IE=dt(`/`)({component:pt(()=>st(()=>import(`./routes-D2AdaqvY.js`),__vite__mapDeps([21,1,7])),`component`)}),LE=dt(`/alerts`)({component:pt(()=>st(()=>import(`./alerts-Czm6Z0m8.js`),__vite__mapDeps([22,1,2,7,3,4,5,6,17,13,14,23,8,24,18,16,20])),`component`)}),RE=dt(`/explore`)({component:pt(()=>st(()=>import(`./explore-SPpRMYjX.js`),__vite__mapDeps([25,1,7,18,3,2,4,5,6,9,10,11,12,13,14,8,15,16,17,19])),`component`),validateSearch:e=>bn(xn(e))}),zE=dt(`/logs`)({component:pt(()=>st(()=>import(`./logs-BlzRGSJn.js`),__vite__mapDeps([26,1,7,18,3,2,4,5,6,27,10,11,12,13,14,8,15,16,17,19])),`component`),validateSearch:e=>bn(xn(e))}),BE=dt(`/settings`)({component:pt(()=>st(()=>import(`./settings-D9KXz_MJ.js`),__vite__mapDeps([28,29,1,2,12,6,7,8,24,16])),`component`)}),VE=dt(`/traces`)({component:pt(()=>st(()=>import(`./traces-BoRV7xaS.js`),__vite__mapDeps([30,1,7,18,3,2,4,5,6,27,10,11,12,13,14,8,15,16,17,19])),`component`),validateSearch:e=>bn(xn(e))}),HE=dt(`/chat/`)({component:pt(()=>st(()=>import(`./chat.index-CEunwapm.js`),__vite__mapDeps([31,32,1,2,33,13,5,23,15,34])),`component`)}),UE=dt(`/chat/$threadId`)({component:pt(()=>st(()=>import(`./chat._threadId-CEunwapm.js`),__vite__mapDeps([35,32,1,2,33,13,5,23,15,34])),`component`)}),WE=dt(`/dashboards/`)({component:pt(()=>st(()=>import(`./dashboards.index-CRdyk0DX.js`),__vite__mapDeps([36,1,7,3,2,4,5,6,37,33,11,10,12,13,14,8,15,16,24,34])),`component`),validateSearch:e=>Ft(At(e))}),GE=dt(`/dashboards/$dashboardId`)({component:pt(()=>st(()=>import(`./dashboards._dashboardId-Bw6ECcx6.js`),__vite__mapDeps([38,1,7,3,2,4,5,6,37,33,11,10,12,13,14,8,15,16,24,34])),`component`),validateSearch:e=>Ft(At(e))}),KE=dt(`/settings_/ingest`)({component:pt(()=>st(()=>import(`./settings_.ingest-BmeDHL8A.js`),__vite__mapDeps([39,29,1,2,12,6,7,8,24,16])),`component`)}),qE=IE.update({id:`/`,path:`/`,getParentRoute:()=>FE}),JE=LE.update({id:`/alerts`,path:`/alerts`,getParentRoute:()=>FE}),YE=RE.update({id:`/explore`,path:`/explore`,getParentRoute:()=>FE}),XE=zE.update({id:`/logs`,path:`/logs`,getParentRoute:()=>FE}),ZE=BE.update({id:`/settings`,path:`/settings`,getParentRoute:()=>FE}),QE=VE.update({id:`/traces`,path:`/traces`,getParentRoute:()=>FE}),$E=HE.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>FE}),eD=UE.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>FE}),tD=WE.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>FE}),nD={IndexRoute:qE,AlertsRoute:JE,ExploreRoute:YE,LogsRoute:XE,SettingsRoute:ZE,TracesRoute:QE,ChatThreadIdRoute:eD,DashboardsDashboardIdRoute:GE.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>FE}),SettingsIngestRoute:KE.update({id:`/settings_/ingest`,path:`/settings/ingest`,getParentRoute:()=>FE}),ChatIndexRoute:$E,DashboardsIndexRoute:tD},rD=Jn({routeTree:FE._addFileChildren(nD)._addFileTypes(),parseSearch:kt,stringifySearch:Mt,defaultPreload:`intent`,scrollRestoration:!0});(0,Ji.createRoot)(document.getElementById(`root`)).render((0,A.jsx)(k.StrictMode,{children:(0,A.jsx)(xr,{theme:Tt,defaultColorScheme:`auto`,cssVariablesResolver:St,children:(0,A.jsx)(Zn,{router:rD})})}));export{Og as $,$C as A,Ag as B,wT as C,cT as D,sT as E,_g as F,G,Mg as H,hg as I,Eg as J,Sg as K,W as L,Rh as M,lg as N,oT as O,Ig as P,H as Q,wg as R,vT as S,lT as T,o_ as U,Uh as V,K as W,d_ as X,Vg as Y,Pg as Z,KT as _,RE as a,up as at,PT as b,_E as c,Bi as ct,yE as d,bg as et,sE as f,ZT as g,pE as h,zE as i,mp as it,zh as j,Ww as k,fE as l,Ei as lt,hE as m,WE as n,Sh as nt,gE as o,lp as ot,dE as p,ug as q,VE as r,gh as rt,uE as s,Xc as st,GE as t,qh as tt,vE as u,cr as ut,kT as v,bT as w,OT as x,MT as y,pg as z}; \ No newline at end of file +`)};function SS(e,t){return ta(t)&&CS(`[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.`),ea(t)}var CS=e=>{typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(e)},wS=(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(Ss(r=>{switch(r.type){case j.TEXT_MESSAGE_START:{let e=r;return[{type:bS.TextMessageStart,messageId:e.messageId,role:e.role}]}case j.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:bS.TextMessageContent,messageId:e.messageId,content:e.delta}]}case j.TEXT_MESSAGE_END:{let e=r;return[{type:bS.TextMessageEnd,messageId:e.messageId}]}case j.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:bS.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case j.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return CS(`[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(Ls(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:bS.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...f?[{type:bS.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case j.TOOL_CALL_END:{let e=r;return[{type:bS.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case j.TOOL_CALL_RESULT:{let e=r,t=d[e.toolCallId];return(t===void 0||t===``)&&CS(`[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:bS.ActionExecutionResult,actionExecutionId:e.toolCallId,result:SS(e.toolCallId,e.content),actionName:t||`unknown`}]}case j.RAW:return f||(f=!0,CS(`[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 j.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:bS.MetaEvent,name:e.name,value:e.value}]}case j.STATE_SNAPSHOT:return p(r.snapshot),[{type:bS.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case j.STATE_DELTA:{let c=r,l;try{l=Ia.applyPatch(i,c.delta,!0,!1).newDocument}catch(e){let t=e instanceof Error?e.message:String(e);return CS(`[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:bS.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]}case j.MESSAGES_SNAPSHOT:return c=r.messages,[{type:bS.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case j.RUN_STARTED:return[];case j.RUN_FINISHED:{if(c&&(i.messages=c),Object.keys(i).length===0)return[];let r=null;if(c)try{r=TS(c)}catch(e){return[{type:bS.RunError,message:e.message}]}return[{type:bS.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...r?{messages:r}:{}}),active:!1}]}case j.RUN_ERROR:{let e=r;return[{type:bS.RunError,message:e.message,code:e.code}]}case j.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:bS.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case j.STEP_FINISHED:return u=[],l=null,[{type:bS.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function TS(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=xS(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:SS(n.toolCallId,n.content),actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var ES=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,DS=e=>e===`tool`?`toolCallId`:`messageId`,OS=(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}'`}.`)},kS=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},AS=(e,t)=>{let n=kS(e,t);return t.rawEvent===void 0?n:{...n,rawEvent:t.rawEvent}},jS=e=>new Set(Object.keys(e.shape)),MS=jS(__),NS=jS(x_),PS=jS(iv),FS=(e,t)=>{let n;for(let r of Object.keys(e))t.has(r)||((n??={})[r]=e[r]);return n},IS=e=>{typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][transform] ${e} Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)},LS=(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&&IS(`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}},RS=e=>t=>{let n=Qx(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:j.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:j.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:j.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&&ES(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 ${DS(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(Ss(e=>{switch(e.type){case j.TEXT_MESSAGE_START:case j.TEXT_MESSAGE_CONTENT:case j.TEXT_MESSAGE_END:case j.TOOL_CALL_START:case j.TOOL_CALL_ARGS:case j.TOOL_CALL_END:case j.TOOL_CALL_RESULT:case j.STATE_SNAPSHOT:case j.STATE_DELTA:case j.CUSTOM:case j.STEP_STARTED:case j.STEP_FINISHED:case j.REASONING_START:case j.REASONING_MESSAGE_START:case j.REASONING_MESSAGE_CONTENT:case j.REASONING_MESSAGE_END:case j.REASONING_END:return[...i(e.subagentRunId??void 0),e];case j.RUN_STARTED:case j.RUN_FINISHED:case j.RUN_ERROR:case j.MESSAGES_SNAPSHOT:return[...a(),e];case j.RAW:case j.ACTIVITY_SNAPSHOT:case j.ACTIVITY_DELTA:case j.REASONING_ENCRYPTED_VALUE:case j.SUBAGENT_STARTED:return[e];case j.SUBAGENT_FINISHED:case j.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case j.TEXT_MESSAGE_CHUNK:{let t=e,a=FS(e,MS),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))OS(`text message`,c.fields.messageId,`role`,t.role,c.fields.role),OS(`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=kS({type:j.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=AS({...a,type:j.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:j.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 LS(l,a,u,`TEXT_MESSAGE_CHUNK`),l}case j.TOOL_CALL_CHUNK:{let t=e,a=FS(e,NS),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))OS(`tool call`,c.fields.toolCallId,`toolCallName`,t.toolCallName,c.fields.toolCallName),OS(`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=kS({type:j.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=AS({...a,type:j.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:j.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 LS(l,a,u,`TOOL_CALL_CHUNK`),l}case j.REASONING_MESSAGE_CHUNK:{let t=e,a=FS(e,PS),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=kS({type:j.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=AS({...a,type:j.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:j.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 LS(l,a,u,`REASONING_MESSAGE_CHUNK`),l}}return e.type,[e]}),Ms(()=>{a()}))},zS=1e6;function BS(e){if(e===void 0)return zS;if(e===1/0||Number.isSafeInteger(e)&&e>0)return e;throw new M(`Invalid enforcement entry budget ${String(e)}: expected a positive integer, or Infinity to disable it.`)}var VS=class extends M{constructor(e,t){super(`Enforcement limit exceeded at '${t||`(root)`}': the payload has more than ${e} entries to validate. If it is legitimate, raise or disable the limit (maxEnforcedEntries on the agent, or maxEntries in the enforcement options).`),this.name=`AGUIEnforcementLimitError`,this.limit=e,this.path=t}},HS=Symbol(`agui.strip.drop`);function US(e,t,n){if(e.used+=t,e.used>e.max)throw new VS(e.max,n)}function WS(e){let t=e;for(;;){if(t instanceof Bg||t instanceof Wg||t instanceof Kg||t instanceof r_||t instanceof Qg){t=t.unwrap();continue}if(t instanceof e_){t=t.def.in;continue}if(t instanceof a_){t=t.def.getter();continue}return t}}function GS(e){let t=e.def;return typeof t?.discriminator==`string`?t.discriminator:void 0}function KS(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 qS(e){let t=WS(e);return t instanceof Lg?KS(t):void 0}function JS(e,t,n,r,i){let a=WS(t);if(a instanceof Tg){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t=a.shape,o=e,s={},c=a.meta()?.specOpen===!0,l=Object.keys(o);US(i,l.length,n);for(let e of l){let a=Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;if(a===void 0){if(c){s[e]=o[e];continue}r.push(`${n}/${e}`);continue}let l=r.length,u=JS(o[e],a,`${n}/${e}`,r,i);if(u===HS){if(r.length=l,a.safeParse(void 0).success){r.push(`${n}/${e}`);continue}return HS}s[e]=u}return s}if(a instanceof Cg){if(!Array.isArray(e))return e;US(i,e.length,n);let t=a.element,o=[];return e.forEach((e,a)=>{let s=r.length,c=JS(e,t,`${n}/${a}`,r,i);if(c===HS){r.length=s,r.push(`${n}/${a}`);return}o.push(c)}),o}if(a instanceof Ng){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t=a.def.valueType,o=e,s={},c=Object.keys(o);US(i,c.length,n);for(let e of c){let a=r.length,c=JS(o[e],t,`${n}/${e}`,r,i);if(c===HS){r.length=a,r.push(`${n}/${e}`);continue}s[e]=c}return s}if(a instanceof Dg){let t=a.options,o=GS(a);if(o!==void 0){if(typeof e!=`object`||!e||Array.isArray(e))return e;let a=e[o];for(let s of t){let t=WS(s);if(!(t instanceof Tg))continue;let c=t.shape;if(qS(c[o])===a)return JS(e,s,n,r,i)}return HS}let s=t.filter(e=>WS(e)instanceof Tg),c=typeof e==`object`&&!!e&&!Array.isArray(e);if(s.length>1&&c)return e;for(let a of t){let t=WS(a);if(t instanceof Cg&&Array.isArray(e)||t instanceof Tg&&c)return JS(e,a,n,r,i)}return e}return e}function YS(e,t,n){let r=[],i=JS(e,t,``,r,{used:0,max:BS(n?.maxEntries)});if(i===HS)throw Error(`Internal error: the stripper found the whole value unrecognisable, which the schemas are not supposed to allow — schema/stripper mismatch.`);return{value:i,stripped:r}}var XS=new Set(Object.values(j));function ZS(e){return XS.has(e.type)}var QS=new Map(uv.options.map(e=>{let t=e.shape;return[String(KS(t.type)),e]})),$S=()=>typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS;function eC(e){$S()||console.warn(`[ag-ui][enforce] ${e}`)}var tC=(e,t)=>{let n=BS(t?.maxEntries);return t=>{let r=Qx(e);return t.pipe(Ss(e=>{if(!ZS(e)){eC(`Dropping unrecognised event '${String(e.type)}': no middleware translated it and the protocol does not describe it.`);let t={type:e.type};return r?.event(`ENFORCE`,`Unrecognised event dropped:`,t,t),zo}let t=QS.get(e.type);if(t===void 0)throw Error(`No validator for recognised event type '${String(e.type)}'`);let{value:i,stripped:a}=YS(e,t,{maxEntries:n});for(let t of a)eC(`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 _s(t.parse(i))}))}};function nC(e,t){let n=BS(t?.maxEntries),{value:r,stripped:i}=YS(Zi(e,`RunAgentInput`),W_,{maxEntries:n});for(let e of i)eC(`Removed unrecognised material at '${e}' from the outgoing input.`);return W_.parse(r)}var rC=class{runNext(e,t){return t.run(e).pipe(RS(!1))}runNextWithState(e,t){let n=$(e.messages||[]),r=$(e.state===void 0?{}:e.state),i=new Ro;return lS(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(Os(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:$(n),state:$(r)})))}},iC=class extends rC{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function aC(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function oC(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function sC(e){let t=aC(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 cC(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 lC(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.flatMap(e=>{if(oC(e)){let n=sC(e);return n.type!==`binary`&&t.some(t=>cC(t,n,e.filename))?[]:[n]}return[e]});return{...e,content:n}}var uC=`THINKING_START`,dC=`THINKING_END`,fC=`THINKING_TEXT_MESSAGE_START`,pC=`THINKING_TEXT_MESSAGE_CONTENT`,mC=`THINKING_TEXT_MESSAGE_END`;function hC(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var gC={event:[`rawEvent`,`subagentRunId`],[j.RUN_STARTED]:[`parentRunId`,`input`],[j.RUN_FINISHED]:[`result`,`outcome`],[j.RUN_ERROR]:[`usage`],[j.SUBAGENT_FINISHED]:[`result`],[j.TOOL_CALL_START]:[`parentMessageId`],[j.TOOL_CALL_CHUNK]:[`parentMessageId`],[j.TOOL_CALL_RESULT]:[`role`],"RUN_FINISHED.outcome":[`pendingToolCallIds`],"RUN_FINISHED.usage[]":[`provider`,`reasoningTokens`,`cachedInputTokens`,`cacheWriteInputTokens`],RunAgentInput:[`forwardedProps`],Tool:[`parameters`],ResumeEntry:[`payload`],"input content":[`metadata`]},_C=new Map(Object.entries(gC).filter(([e])=>Object.values(j).includes(e))),vC=e=>uS(e,`an absent field`);function yC(e,t,n,r){if(!hC(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 bC(e,t,n){if(!hC(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 xC(e,t){return bC(e,`content`,e=>{if(!hC(e))return e;switch(e.type){case`image`:case`audio`:case`video`:case`document`:return yC(e,gC[`input content`],`${e.type} input content`,t);default:return e}})}function SC(e,t=vC){let n=yC(e,gC.RunAgentInput,`RunAgentInput`,t);return n=bC(n,`tools`,e=>yC(e,gC.Tool,`Tool`,t)),n=bC(n,`resume`,e=>yC(e,gC.ResumeEntry,`ResumeEntry`,t)),bC(n,`messages`,e=>xC(e,t))}var CC=class extends rC{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),uS(e,`an absent field`))}}warn(e,t){uS(e,t)}mintedContinuationId(e,t){if(t!==null)return t;let n=Gx();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(lC),t.run(e).pipe(bs(e=>this.transformEvent(e)))}transformEvent(e){let t=this.noticeNullOncePerRun;e.type===j.RUN_STARTED&&this.nullsNoticedThisRun.clear(),e=yC(e,gC.event,void 0,t);let n=_C.get(e.type);switch(n&&(e=yC(e,n,e.type,t)),e.type){case uC:{this.currentReasoningId=Gx();let{title:t,...n}=e;return this.warn(uC,j.REASONING_START),t!==void 0&&this.warnAside(`Dropping ${uC}.title ${JSON.stringify(t)}: ${j.REASONING_START} has no title field, so the span's label cannot be carried and nothing downstream can recover it.`),{...n,type:j.REASONING_START,messageId:this.currentReasoningId}}case fC:return this.currentMessageId=Gx(),this.warn(fC,j.REASONING_MESSAGE_START),{...e,type:j.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`reasoning`};case pC:{let{delta:t,...n}=e;return this.warn(pC,j.REASONING_MESSAGE_CONTENT),{...n,type:j.REASONING_MESSAGE_CONTENT,messageId:this.mintedContinuationId(pC,this.currentMessageId),delta:t}}case mC:{let t=this.mintedContinuationId(mC,this.currentMessageId);return this.currentMessageId=null,this.warn(mC,j.REASONING_MESSAGE_END),{...e,type:j.REASONING_MESSAGE_END,messageId:t}}case dC:{let t=this.mintedContinuationId(dC,this.currentReasoningId);return this.currentReasoningId=null,this.warn(dC,j.REASONING_END),{...e,type:j.REASONING_END,messageId:t}}case j.RUN_FINISHED:{let n=e,r=yC(n.outcome,gC[`RUN_FINISHED.outcome`],`RUN_FINISHED.outcome`,t);return bC(r===n.outcome?n:{...n,outcome:r},`usage`,e=>yC(e,gC[`RUN_FINISHED.usage[]`],`RUN_FINISHED.usage[]`,t))}case j.MESSAGES_SNAPSHOT:{let t=e;return Array.isArray(t.messages)?{...t,messages:t.messages.map(e=>this.upgradeInboundMessage(e))}:e}case j.RUN_STARTED:{let n=SC(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=xC(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`),lC(e))}},wC=()=>e=>Ts(()=>{let t=new CC;return e.pipe(bs(e=>t.transformEvent(e)))});function TC(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}function EC(){return typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS}function DC(e){EC()||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 OC(e){EC()||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 kC(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 OC(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&&DC(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 AC=class extends rC{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(kC)};return this.runNext(i,t)}},jC=`THINKING_START`,MC=`THINKING_END`,NC=`THINKING_TEXT_MESSAGE_START`,PC=`THINKING_TEXT_MESSAGE_CONTENT`,FC=`THINKING_TEXT_MESSAGE_END`,IC=class extends rC{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(bs(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case jC:{this.currentReasoningId=Gx();let{title:t,...n}=e;return this.warnAboutTransformation(jC,j.REASONING_START),{...n,type:j.REASONING_START,messageId:this.currentReasoningId}}case NC:return this.currentMessageId=Gx(),this.warnAboutTransformation(NC,j.REASONING_MESSAGE_START),{...e,type:j.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`reasoning`};case PC:{let{delta:t,...n}=e;return this.warnAboutTransformation(PC,j.REASONING_MESSAGE_CONTENT),{...n,type:j.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Gx(),delta:t}}case FC:{let t=this.currentMessageId??Gx();return this.warnAboutTransformation(FC,j.REASONING_MESSAGE_END),{...e,type:j.REASONING_MESSAGE_END,messageId:t}}case MC:{let t=this.currentReasoningId??Gx();return this.warnAboutTransformation(MC,j.REASONING_END),{...e,type:j.REASONING_END,messageId:t}}default:return e}}},LC=`SUBAGENT_STARTED`,RC=`SUBAGENT_FINISHED`,zC=`SUBAGENT_ERROR`;function BC(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function VC(e){return e.map(e=>BC(e))}var HC=class extends rC{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=>BC(e))};return this.runNext(n,t).pipe(Fs(e=>{let t=e.type;(t===LC||t===RC||t===zC)&&this.warnDroppedLifecycleEvent(t)}),Es(e=>{let t=e.type;return t!==LC&&t!==RC&&t!==zC}),bs(e=>{let t=BC(e);if(t.type===j.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:VC(e.messages)}}if(t.type===j.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>BC(e))}}}if(t.type===j.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:VC(e.input.messages)}}}return t}))}},UC=`1.0.4`,WC=!1,GC=new WeakSet,KC=(e,t)=>/^\d+\.\d+$/.test(e)?Vx(e,t)>0?`newer`:`not-newer`:`uninterpretable`,qC=e=>{let t=e.protocolVersion;if(t!==void 0&&t!==`1.0`)switch(KC(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}},JC=class e{resolvePeerCeiling(t){if(this.resolvingPeerCeiling)return UC;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 UC;let a=t===`maxProtocolVersion`?n:r;if(!a)return UC;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&&!WC&&(WC=!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=Zx(e),this._debugLogger=eS(this._debug)}get threadId(){return this._threadId??=qi()}set threadId(e){this._threadId=e}get maxEnforcedEntries(){return this._maxEnforcedEntries}set maxEnforcedEntries(e){this._maxEnforcedEntries=BS(e)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?eS(Zx(!0)):void 0:e}resolvedCeilingDuringConstruction(){let e=this.maxProtocolVersion;if(typeof e!=`string`||!Hx(e))throw new M(`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,maxEnforcedEntries:o}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.resolvingPeerCeiling=!1,this.agentId=e,this.description=t??``,this._threadId=n,this.messages=$(r??[]),this.state=$(i??{}),this._debug=Zx(a),this._debugLogger=eS(this._debug),this._maxEnforcedEntries=BS(o);let s=this.resolvedCeilingDuringConstruction();Vx(s,`0.0.39`)<=0&&this.middlewares.unshift(new AC),Vx(s,`0.0.45`)<=0&&this.middlewares.unshift(new IC),Vx(s,`0.0.57`)<=0&&this.middlewares.unshift(new HC)}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 iC(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??qi();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})=>qC(e),onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];GC.add(n),await this.onInitialize(n,a),this.activeRunDetach$=new Fo;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await ys(wo(()=>[...this.middlewares,new CC].reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),tC(this.debugLogger,{maxEntries:this.maxEnforcedEntries}),RS(this.debugLogger),dS(this.debugLogger),e=>e.pipe(Ps(this.activeRunDetach$)),e=>this.applyBeforeSourceError(n,e,a),Ds(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))),Ms(()=>{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}))(_s(null)));let s=$(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new Qi}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??qi();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunStartedEvent:({event:e})=>qC(e),onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new Fo;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await ys(wo(()=>Ts(()=>this.connect(n)),e=>tC(this.debugLogger,{maxEntries:this.maxEnforcedEntries})(wC()(e)),RS(this.debugLogger),dS(this.debugLogger),e=>e.pipe(Ps(this.activeRunDetach$)),e=>this.applyBeforeSourceError(n,e,a),Ds(e=>(this.isRunning=!1,e instanceof Qi?zo:this.onError(n,e,a))),Ms(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(_s(null)),{defaultValue:void 0});let s=$(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 Ts(()=>{let r,i=t.pipe(Ds(e=>(r={error:e},zo)));return this.processApplyEvents(e,this.apply(e,i,n),n).pipe(As(Ts(()=>{let e=r;return e?F(()=>e.error):zo})))})}apply(e,t,n){return lS(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(Fs(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=$(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=aS(t.filter(e=>e.role!==`activity`));return{threadId:this.threadId,runId:e?.runId||qi(),...Vx(this.maxProtocolVersion,UC)>=0&&{protocolVersion:`1.0`},tools:$(e?.tools??[]),context:$(e?.context??[]),forwardedProps:$(e?.forwardedProps??{}),state:$(this.state),messages:n,...e?.resume===void 0?{}:{resume:$(e.resume)}}}async onInitialize(e,t){if(GC.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 M(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let t of this.pendingInterrupts)if(TC(t)&&(e.resume??[]).find(e=>e.interruptId===t.id)?.status!==`cancelled`)throw new M(`Interrupt ${t.id} expired at ${t.expiresAt} and can no longer be answered. Cancel it to continue the thread.`)}let n=await Xx(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=aS(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 gs(Xx(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(bs(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 Xx(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=$(this.messages),e.state=$(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e._maxEnforcedEntries=this._maxEnforcedEntries,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=$(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=$(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=$(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??qi();let t=this.prepareRunAgentInput(e);return[...this.middlewares,new CC].reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t).pipe(tC(this.debugLogger,{maxEntries:this.maxEnforcedEntries}),RS(this.debugLogger),dS(this.debugLogger),wS(this.threadId,t.runId,this.agentId),e=>e.pipe(bs(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function YC(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 XC=class extends JC{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(YC(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=$(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return yS(pS(()=>this.fetch(this.url,this.requestInit(nC(e,{maxEntries:this.maxEnforcedEntries})))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=$(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}},ZC=class extends pn{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:$t(t,n.data),hasPreviousPage:dn(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},QC=class extends mn{#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||$C(),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=tn({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),gn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function $C(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ew=class extends rn{#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 QC({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=tw(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=tw(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=tw(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=tw(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){gn.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=>an(t,e))}findAll(e={}){return this.getAll().filter(t=>an(e,t))}notify(e){gn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return gn.batch(()=>Promise.all(e.map(e=>e.continue().catch(_n))))}};function tw(e){return e.options.scope?.id}var nw=class extends rn{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??on(r,t),a=this.get(i);return a||(a=new sn({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(){gn.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=>Qt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Qt(e,t)):t}notify(e){gn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){gn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){gn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},rw=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new nw,this.#t=e.mutationCache||new ew,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=nn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=cn.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(en(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=fn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return gn.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;gn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return gn.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=gn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(_n).catch(_n)}invalidateQueries(e,t={}){return gn.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=gn.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(_n)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(_n)}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(en(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(en(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_n).catch(_n)}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(_n).catch(_n)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return cn.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(ln(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{yn(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ln(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{yn(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||=on(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===Xt&&(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()}};function iw(e,t){return un(e,ZC,t)}var aw=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M225.29,165.93C216.61,151,212,129.57,212,104a84,84,0,0,0-168,0c0,25.58-4.59,47-13.27,61.93A20.08,20.08,0,0,0,30.66,186,19.77,19.77,0,0,0,48,196H84.18a44,44,0,0,0,87.64,0H208a19.77,19.77,0,0,0,17.31-10A20.08,20.08,0,0,0,225.29,165.93ZM128,212a20,20,0,0,1-19.6-16h39.2A20,20,0,0,1,128,212ZM54.66,172C63.51,154,68,131.14,68,104a60,60,0,0,1,120,0c0,27.13,4.48,50,13.33,68Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M208,192H48a8,8,0,0,1-6.88-12C47.71,168.6,56,139.81,56,104a72,72,0,0,1,144,0c0,35.82,8.3,64.6,14.9,76A8,8,0,0,1,208,192Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M221.8,175.94C216.25,166.38,208,139.33,208,104a80,80,0,1,0-160,0c0,35.34-8.26,62.38-13.81,71.94A16,16,0,0,0,48,200H88.81a40,40,0,0,0,78.38,0H208a16,16,0,0,0,13.8-24.06ZM128,216a24,24,0,0,1-22.62-16h45.24A24,24,0,0,1,128,216ZM48,184c7.7-13.24,16-43.92,16-80a64,64,0,1,1,128,0c0,36.05,8.28,66.73,16,80Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M221.8,175.94C216.25,166.38,208,139.33,208,104a80,80,0,1,0-160,0c0,35.34-8.26,62.38-13.81,71.94A16,16,0,0,0,48,200H88.81a40,40,0,0,0,78.38,0H208a16,16,0,0,0,13.8-24.06ZM128,216a24,24,0,0,1-22.62-16h45.24A24,24,0,0,1,128,216Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220.07,176.94C214.41,167.2,206,139.73,206,104a78,78,0,1,0-156,0c0,35.74-8.42,63.2-14.08,72.94A14,14,0,0,0,48,198H90.48a38,38,0,0,0,75,0H208a14,14,0,0,0,12.06-21.06ZM128,218a26,26,0,0,1-25.29-20h50.58A26,26,0,0,1,128,218Zm81.71-33a1.9,1.9,0,0,1-1.7,1H48a1.9,1.9,0,0,1-1.7-1,2,2,0,0,1,0-2C53.87,170,62,139.69,62,104a66,66,0,1,1,132,0c0,35.68,8.14,65.95,15.71,79A2,2,0,0,1,209.71,185Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M221.8,175.94C216.25,166.38,208,139.33,208,104a80,80,0,1,0-160,0c0,35.34-8.26,62.38-13.81,71.94A16,16,0,0,0,48,200H88.81a40,40,0,0,0,78.38,0H208a16,16,0,0,0,13.8-24.06ZM128,216a24,24,0,0,1-22.62-16h45.24A24,24,0,0,1,128,216ZM48,184c7.7-13.24,16-43.92,16-80a64,64,0,1,1,128,0c0,36.05,8.28,66.73,16,80Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M218.35,178C212.58,168,204,140.13,204,104a76,76,0,1,0-152,0c0,36.13-8.59,64-14.36,73.95A12,12,0,0,0,48,196H92.23a36,36,0,0,0,71.54,0H208A12,12,0,0,0,218.35,178ZM128,220a28,28,0,0,1-27.71-24h55.42A28,28,0,0,1,128,220Zm83.45-34a3.91,3.91,0,0,1-3.44,2H48a3.91,3.91,0,0,1-3.44-2,4,4,0,0,1,0-4C52,169.17,60,139.32,60,104a68,68,0,1,1,136,0c0,35.31,8,65.17,15.44,78A4,4,0,0,1,211.45,186Z`}))]]),ow=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),sw=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,20A108,108,0,0,0,31.85,177.23L21,209.66A20,20,0,0,0,46.34,235l32.43-10.81A108,108,0,1,0,128,20Zm0,192a84,84,0,0,1-42.06-11.27,12,12,0,0,0-6-1.62,12.1,12.1,0,0,0-3.8.62l-29.79,9.93,9.93-29.79a12,12,0,0,0-1-9.81A84,84,0,1,1,128,212Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.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`}),k.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M232,128A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,26A102,102,0,0,0,38.35,176.69L26.73,211.56a14,14,0,0,0,17.71,17.71l34.87-11.62A102,102,0,1,0,128,26Zm0,192a90,90,0,0,1-45.06-12.08,6.09,6.09,0,0,0-3-.81,6.2,6.2,0,0,0-1.9.31L40.65,217.88a2,2,0,0,1-2.53-2.53L50.58,178a6,6,0,0,0-.5-4.91A90,90,0,1,1,128,218Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,28A100,100,0,0,0,40.53,176.5l-11.9,35.69a12,12,0,0,0,15.18,15.18l35.69-11.9A100,100,0,1,0,128,28Zm0,192a92,92,0,0,1-46.07-12.35,4.05,4.05,0,0,0-2-.54,3.93,3.93,0,0,0-1.27.21L41.28,219.78a4,4,0,0,1-5.06-5.06l12.46-37.38a4,4,0,0,0-.33-3.27A92,92,0,1,1,128,220Z`}))]]),cw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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,212ZM163.27,77l-56,24a12,12,0,0,0-6.3,6.3l-24,56A12,12,0,0,0,92.73,179l56-24a12,12,0,0,0,6.3-6.3l24-56A12,12,0,0,0,163.27,77Zm-28.41,57.89-24,10.29,10.29-24,24-10.29Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,32a96,96,0,1,0,96,96A96,96,0,0,0,128,32Zm16,112L80,176l32-64,64-32Z`,opacity:`0.2`}),k.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,216ZM172.42,72.84l-64,32a8.05,8.05,0,0,0-3.58,3.58l-32,64A8,8,0,0,0,80,184a8.1,8.1,0,0,0,3.58-.84l64-32a8.05,8.05,0,0,0,3.58-3.58l32-64a8,8,0,0,0-10.74-10.74ZM138,138,97.89,158.11,118,118l40.15-20.07Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm51.58,57.79-32,64a4.08,4.08,0,0,1-1.79,1.79l-64,32a4,4,0,0,1-5.37-5.37l32-64a4.08,4.08,0,0,1,1.79-1.79l64-32A4,4,0,0,1,179.58,81.79Z`}))],[`light`,k.createElement(k.Fragment,null,k.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,218ZM173.32,74.63l-64,32a6,6,0,0,0-2.69,2.69l-32,64A6,6,0,0,0,80,182a6.06,6.06,0,0,0,2.68-.63l64-32a6,6,0,0,0,2.69-2.69l32-64a6,6,0,0,0-8.05-8.05Zm-33.79,64.9L93.42,162.58l23-46.11,46.11-23Z`}))],[`regular`,k.createElement(k.Fragment,null,k.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,216ZM172.42,72.84l-64,32a8.05,8.05,0,0,0-3.58,3.58l-32,64A8,8,0,0,0,80,184a8.1,8.1,0,0,0,3.58-.84l64-32a8.05,8.05,0,0,0,3.58-3.58l32-64a8,8,0,0,0-10.74-10.74ZM138,138,97.89,158.11,118,118l40.15-20.07Z`}))],[`thin`,k.createElement(k.Fragment,null,k.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,220ZM174.21,76.42l-64,32a4.08,4.08,0,0,0-1.79,1.79l-32,64A4,4,0,0,0,80,180a4.05,4.05,0,0,0,1.79-.42l64-32a4.08,4.08,0,0,0,1.79-1.79l32-64a4,4,0,0,0-5.37-5.37ZM141,141l-52.08,26L115,115l52.08-26Z`}))]]),lw=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,76a52,52,0,1,0,52,52A52.06,52.06,0,0,0,128,76Zm0,80a28,28,0,1,1,28-28A28,28,0,0,1,128,156Zm92-27.21v-1.58l14-17.51a12,12,0,0,0,2.23-10.59A111.75,111.75,0,0,0,225,71.89,12,12,0,0,0,215.89,66L193.61,63.5l-1.11-1.11L190,40.1A12,12,0,0,0,184.11,31a111.67,111.67,0,0,0-27.23-11.27A12,12,0,0,0,146.3,22L128.79,36h-1.58L109.7,22a12,12,0,0,0-10.59-2.23A111.75,111.75,0,0,0,71.89,31.05,12,12,0,0,0,66,40.11L63.5,62.39,62.39,63.5,40.1,66A12,12,0,0,0,31,71.89,111.67,111.67,0,0,0,19.77,99.12,12,12,0,0,0,22,109.7l14,17.51v1.58L22,146.3a12,12,0,0,0-2.23,10.59,111.75,111.75,0,0,0,11.29,27.22A12,12,0,0,0,40.11,190l22.28,2.48,1.11,1.11L66,215.9A12,12,0,0,0,71.89,225a111.67,111.67,0,0,0,27.23,11.27A12,12,0,0,0,109.7,234l17.51-14h1.58l17.51,14a12,12,0,0,0,10.59,2.23A111.75,111.75,0,0,0,184.11,225a12,12,0,0,0,5.91-9.06l2.48-22.28,1.11-1.11L215.9,190a12,12,0,0,0,9.06-5.91,111.67,111.67,0,0,0,11.27-27.23A12,12,0,0,0,234,146.3Zm-24.12-4.89a70.1,70.1,0,0,1,0,8.2,12,12,0,0,0,2.61,8.22l12.84,16.05A86.47,86.47,0,0,1,207,166.86l-20.43,2.27a12,12,0,0,0-7.65,4,69,69,0,0,1-5.8,5.8,12,12,0,0,0-4,7.65L166.86,207a86.47,86.47,0,0,1-10.49,4.35l-16.05-12.85a12,12,0,0,0-7.5-2.62c-.24,0-.48,0-.72,0a70.1,70.1,0,0,1-8.2,0,12.06,12.06,0,0,0-8.22,2.6L99.63,211.33A86.47,86.47,0,0,1,89.14,207l-2.27-20.43a12,12,0,0,0-4-7.65,69,69,0,0,1-5.8-5.8,12,12,0,0,0-7.65-4L49,166.86a86.47,86.47,0,0,1-4.35-10.49l12.84-16.05a12,12,0,0,0,2.61-8.22,70.1,70.1,0,0,1,0-8.2,12,12,0,0,0-2.61-8.22L44.67,99.63A86.47,86.47,0,0,1,49,89.14l20.43-2.27a12,12,0,0,0,7.65-4,69,69,0,0,1,5.8-5.8,12,12,0,0,0,4-7.65L89.14,49a86.47,86.47,0,0,1,10.49-4.35l16.05,12.85a12.06,12.06,0,0,0,8.22,2.6,70.1,70.1,0,0,1,8.2,0,12,12,0,0,0,8.22-2.6l16.05-12.85A86.47,86.47,0,0,1,166.86,49l2.27,20.43a12,12,0,0,0,4,7.65,69,69,0,0,1,5.8,5.8,12,12,0,0,0,7.65,4L207,89.14a86.47,86.47,0,0,1,4.35,10.49l-12.84,16.05A12,12,0,0,0,195.88,123.9Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M207.86,123.18l16.78-21a99.14,99.14,0,0,0-10.07-24.29l-26.7-3a81,81,0,0,0-6.81-6.81l-3-26.71a99.43,99.43,0,0,0-24.3-10l-21,16.77a81.59,81.59,0,0,0-9.64,0l-21-16.78A99.14,99.14,0,0,0,77.91,41.43l-3,26.7a81,81,0,0,0-6.81,6.81l-26.71,3a99.43,99.43,0,0,0-10,24.3l16.77,21a81.59,81.59,0,0,0,0,9.64l-16.78,21a99.14,99.14,0,0,0,10.07,24.29l26.7,3a81,81,0,0,0,6.81,6.81l3,26.71a99.43,99.43,0,0,0,24.3,10l21-16.77a81.59,81.59,0,0,0,9.64,0l21,16.78a99.14,99.14,0,0,0,24.29-10.07l3-26.7a81,81,0,0,0,6.81-6.81l26.71-3a99.43,99.43,0,0,0,10-24.3l-16.77-21A81.59,81.59,0,0,0,207.86,123.18ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Zm88-29.84q.06-2.16,0-4.32l14.92-18.64a8,8,0,0,0,1.48-7.06,107.6,107.6,0,0,0-10.88-26.25,8,8,0,0,0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186,40.54a8,8,0,0,0-3.94-6,107.29,107.29,0,0,0-26.25-10.86,8,8,0,0,0-7.06,1.48L130.16,40Q128,40,125.84,40L107.2,25.11a8,8,0,0,0-7.06-1.48A107.6,107.6,0,0,0,73.89,34.51a8,8,0,0,0-3.93,6L67.32,64.27q-1.56,1.49-3,3L40.54,70a8,8,0,0,0-6,3.94,107.71,107.71,0,0,0-10.87,26.25,8,8,0,0,0,1.49,7.06L40,125.84Q40,128,40,130.16L25.11,148.8a8,8,0,0,0-1.48,7.06,107.6,107.6,0,0,0,10.88,26.25,8,8,0,0,0,6,3.93l23.72,2.64q1.49,1.56,3,3L70,215.46a8,8,0,0,0,3.94,6,107.71,107.71,0,0,0,26.25,10.87,8,8,0,0,0,7.06-1.49L125.84,216q2.16.06,4.32,0l18.64,14.92a8,8,0,0,0,7.06,1.48,107.21,107.21,0,0,0,26.25-10.88,8,8,0,0,0,3.93-6l2.64-23.72q1.56-1.48,3-3L215.46,186a8,8,0,0,0,6-3.94,107.71,107.71,0,0,0,10.87-26.25,8,8,0,0,0-1.49-7.06Zm-16.1-6.5a73.93,73.93,0,0,1,0,8.68,8,8,0,0,0,1.74,5.48l14.19,17.73a91.57,91.57,0,0,1-6.23,15L187,173.11a8,8,0,0,0-5.1,2.64,74.11,74.11,0,0,1-6.14,6.14,8,8,0,0,0-2.64,5.1l-2.51,22.58a91.32,91.32,0,0,1-15,6.23l-17.74-14.19a8,8,0,0,0-5-1.75h-.48a73.93,73.93,0,0,1-8.68,0,8.06,8.06,0,0,0-5.48,1.74L100.45,215.8a91.57,91.57,0,0,1-15-6.23L82.89,187a8,8,0,0,0-2.64-5.1,74.11,74.11,0,0,1-6.14-6.14,8,8,0,0,0-5.1-2.64L46.43,170.6a91.32,91.32,0,0,1-6.23-15l14.19-17.74a8,8,0,0,0,1.74-5.48,73.93,73.93,0,0,1,0-8.68,8,8,0,0,0-1.74-5.48L40.2,100.45a91.57,91.57,0,0,1,6.23-15L69,82.89a8,8,0,0,0,5.1-2.64,74.11,74.11,0,0,1,6.14-6.14A8,8,0,0,0,82.89,69L85.4,46.43a91.32,91.32,0,0,1,15-6.23l17.74,14.19a8,8,0,0,0,5.48,1.74,73.93,73.93,0,0,1,8.68,0,8.06,8.06,0,0,0,5.48-1.74L155.55,40.2a91.57,91.57,0,0,1,15,6.23L173.11,69a8,8,0,0,0,2.64,5.1,74.11,74.11,0,0,1,6.14,6.14,8,8,0,0,0,5.1,2.64l22.58,2.51a91.32,91.32,0,0,1,6.23,15l-14.19,17.74A8,8,0,0,0,199.87,123.66Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,130.16q.06-2.16,0-4.32l14.92-18.64a8,8,0,0,0,1.48-7.06,107.6,107.6,0,0,0-10.88-26.25,8,8,0,0,0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186,40.54a8,8,0,0,0-3.94-6,107.29,107.29,0,0,0-26.25-10.86,8,8,0,0,0-7.06,1.48L130.16,40Q128,40,125.84,40L107.2,25.11a8,8,0,0,0-7.06-1.48A107.6,107.6,0,0,0,73.89,34.51a8,8,0,0,0-3.93,6L67.32,64.27q-1.56,1.49-3,3L40.54,70a8,8,0,0,0-6,3.94,107.71,107.71,0,0,0-10.87,26.25,8,8,0,0,0,1.49,7.06L40,125.84Q40,128,40,130.16L25.11,148.8a8,8,0,0,0-1.48,7.06,107.6,107.6,0,0,0,10.88,26.25,8,8,0,0,0,6,3.93l23.72,2.64q1.49,1.56,3,3L70,215.46a8,8,0,0,0,3.94,6,107.71,107.71,0,0,0,26.25,10.87,8,8,0,0,0,7.06-1.49L125.84,216q2.16.06,4.32,0l18.64,14.92a8,8,0,0,0,7.06,1.48,107.21,107.21,0,0,0,26.25-10.88,8,8,0,0,0,3.93-6l2.64-23.72q1.56-1.48,3-3L215.46,186a8,8,0,0,0,6-3.94,107.71,107.71,0,0,0,10.87-26.25,8,8,0,0,0-1.49-7.06ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,82a46,46,0,1,0,46,46A46.06,46.06,0,0,0,128,82Zm0,80a34,34,0,1,1,34-34A34,34,0,0,1,128,162ZM214,130.84c.06-1.89.06-3.79,0-5.68L229.33,106a6,6,0,0,0,1.11-5.29A105.34,105.34,0,0,0,219.76,74.9a6,6,0,0,0-4.53-3l-24.45-2.71q-1.93-2.07-4-4l-2.72-24.46a6,6,0,0,0-3-4.53,105.65,105.65,0,0,0-25.77-10.66A6,6,0,0,0,150,26.68l-19.2,15.37c-1.89-.06-3.79-.06-5.68,0L106,26.67a6,6,0,0,0-5.29-1.11A105.34,105.34,0,0,0,74.9,36.24a6,6,0,0,0-3,4.53L69.23,65.22q-2.07,1.94-4,4L40.76,72a6,6,0,0,0-4.53,3,105.65,105.65,0,0,0-10.66,25.77A6,6,0,0,0,26.68,106l15.37,19.2c-.06,1.89-.06,3.79,0,5.68L26.67,150.05a6,6,0,0,0-1.11,5.29A105.34,105.34,0,0,0,36.24,181.1a6,6,0,0,0,4.53,3l24.45,2.71q1.94,2.07,4,4L72,215.24a6,6,0,0,0,3,4.53,105.65,105.65,0,0,0,25.77,10.66,6,6,0,0,0,5.29-1.11L125.16,214c1.89.06,3.79.06,5.68,0l19.21,15.38a6,6,0,0,0,3.75,1.31,6.2,6.2,0,0,0,1.54-.2,105.34,105.34,0,0,0,25.76-10.68,6,6,0,0,0,3-4.53l2.71-24.45q2.07-1.93,4-4l24.46-2.72a6,6,0,0,0,4.53-3,105.49,105.49,0,0,0,10.66-25.77,6,6,0,0,0-1.11-5.29Zm-3.1,41.63-23.64,2.63a6,6,0,0,0-3.82,2,75.14,75.14,0,0,1-6.31,6.31,6,6,0,0,0-2,3.82l-2.63,23.63A94.28,94.28,0,0,1,155.14,218l-18.57-14.86a6,6,0,0,0-3.75-1.31h-.36a78.07,78.07,0,0,1-8.92,0,6,6,0,0,0-4.11,1.3L100.87,218a94.13,94.13,0,0,1-17.34-7.17L80.9,187.21a6,6,0,0,0-2-3.82,75.14,75.14,0,0,1-6.31-6.31,6,6,0,0,0-3.82-2l-23.63-2.63A94.28,94.28,0,0,1,38,155.14l14.86-18.57a6,6,0,0,0,1.3-4.11,78.07,78.07,0,0,1,0-8.92,6,6,0,0,0-1.3-4.11L38,100.87a94.13,94.13,0,0,1,7.17-17.34L68.79,80.9a6,6,0,0,0,3.82-2,75.14,75.14,0,0,1,6.31-6.31,6,6,0,0,0,2-3.82l2.63-23.63A94.28,94.28,0,0,1,100.86,38l18.57,14.86a6,6,0,0,0,4.11,1.3,78.07,78.07,0,0,1,8.92,0,6,6,0,0,0,4.11-1.3L155.13,38a94.13,94.13,0,0,1,17.34,7.17l2.63,23.64a6,6,0,0,0,2,3.82,75.14,75.14,0,0,1,6.31,6.31,6,6,0,0,0,3.82,2l23.63,2.63A94.28,94.28,0,0,1,218,100.86l-14.86,18.57a6,6,0,0,0-1.3,4.11,78.07,78.07,0,0,1,0,8.92,6,6,0,0,0,1.3,4.11L218,155.13A94.13,94.13,0,0,1,210.85,172.47Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Zm88-29.84q.06-2.16,0-4.32l14.92-18.64a8,8,0,0,0,1.48-7.06,107.21,107.21,0,0,0-10.88-26.25,8,8,0,0,0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186,40.54a8,8,0,0,0-3.94-6,107.71,107.71,0,0,0-26.25-10.87,8,8,0,0,0-7.06,1.49L130.16,40Q128,40,125.84,40L107.2,25.11a8,8,0,0,0-7.06-1.48A107.6,107.6,0,0,0,73.89,34.51a8,8,0,0,0-3.93,6L67.32,64.27q-1.56,1.49-3,3L40.54,70a8,8,0,0,0-6,3.94,107.71,107.71,0,0,0-10.87,26.25,8,8,0,0,0,1.49,7.06L40,125.84Q40,128,40,130.16L25.11,148.8a8,8,0,0,0-1.48,7.06,107.21,107.21,0,0,0,10.88,26.25,8,8,0,0,0,6,3.93l23.72,2.64q1.49,1.56,3,3L70,215.46a8,8,0,0,0,3.94,6,107.71,107.71,0,0,0,26.25,10.87,8,8,0,0,0,7.06-1.49L125.84,216q2.16.06,4.32,0l18.64,14.92a8,8,0,0,0,7.06,1.48,107.21,107.21,0,0,0,26.25-10.88,8,8,0,0,0,3.93-6l2.64-23.72q1.56-1.48,3-3L215.46,186a8,8,0,0,0,6-3.94,107.71,107.71,0,0,0,10.87-26.25,8,8,0,0,0-1.49-7.06Zm-16.1-6.5a73.93,73.93,0,0,1,0,8.68,8,8,0,0,0,1.74,5.48l14.19,17.73a91.57,91.57,0,0,1-6.23,15L187,173.11a8,8,0,0,0-5.1,2.64,74.11,74.11,0,0,1-6.14,6.14,8,8,0,0,0-2.64,5.1l-2.51,22.58a91.32,91.32,0,0,1-15,6.23l-17.74-14.19a8,8,0,0,0-5-1.75h-.48a73.93,73.93,0,0,1-8.68,0,8,8,0,0,0-5.48,1.74L100.45,215.8a91.57,91.57,0,0,1-15-6.23L82.89,187a8,8,0,0,0-2.64-5.1,74.11,74.11,0,0,1-6.14-6.14,8,8,0,0,0-5.1-2.64L46.43,170.6a91.32,91.32,0,0,1-6.23-15l14.19-17.74a8,8,0,0,0,1.74-5.48,73.93,73.93,0,0,1,0-8.68,8,8,0,0,0-1.74-5.48L40.2,100.45a91.57,91.57,0,0,1,6.23-15L69,82.89a8,8,0,0,0,5.1-2.64,74.11,74.11,0,0,1,6.14-6.14A8,8,0,0,0,82.89,69L85.4,46.43a91.32,91.32,0,0,1,15-6.23l17.74,14.19a8,8,0,0,0,5.48,1.74,73.93,73.93,0,0,1,8.68,0,8,8,0,0,0,5.48-1.74L155.55,40.2a91.57,91.57,0,0,1,15,6.23L173.11,69a8,8,0,0,0,2.64,5.1,74.11,74.11,0,0,1,6.14,6.14,8,8,0,0,0,5.1,2.64l22.58,2.51a91.32,91.32,0,0,1,6.23,15l-14.19,17.74A8,8,0,0,0,199.87,123.66Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,80a36,36,0,1,1,36-36A36,36,0,0,1,128,164Zm83.93-32.49q.13-3.51,0-7l15.83-19.79a4,4,0,0,0,.75-3.53A103.64,103.64,0,0,0,218,75.9a4,4,0,0,0-3-2l-25.19-2.8c-1.58-1.71-3.24-3.37-4.95-4.95L182.07,41a4,4,0,0,0-2-3A104,104,0,0,0,154.82,27.5a4,4,0,0,0-3.53.74L131.51,44.07q-3.51-.14-7,0L104.7,28.24a4,4,0,0,0-3.53-.75A103.64,103.64,0,0,0,75.9,38a4,4,0,0,0-2,3l-2.8,25.19c-1.71,1.58-3.37,3.24-4.95,4.95L41,73.93a4,4,0,0,0-3,2A104,104,0,0,0,27.5,101.18a4,4,0,0,0,.74,3.53l15.83,19.78q-.14,3.51,0,7L28.24,151.3a4,4,0,0,0-.75,3.53A103.64,103.64,0,0,0,38,180.1a4,4,0,0,0,3,2l25.19,2.8c1.58,1.71,3.24,3.37,4.95,4.95l2.8,25.2a4,4,0,0,0,2,3,104,104,0,0,0,25.28,10.46,4,4,0,0,0,3.53-.74l19.78-15.83q3.51.13,7,0l19.79,15.83a4,4,0,0,0,2.5.88,4,4,0,0,0,1-.13A103.64,103.64,0,0,0,180.1,218a4,4,0,0,0,2-3l2.8-25.19c1.71-1.58,3.37-3.24,4.95-4.95l25.2-2.8a4,4,0,0,0,3-2,104,104,0,0,0,10.46-25.28,4,4,0,0,0-.74-3.53Zm.17,42.83-24.67,2.74a4,4,0,0,0-2.55,1.32,76.2,76.2,0,0,1-6.48,6.48,4,4,0,0,0-1.32,2.55l-2.74,24.66a95.45,95.45,0,0,1-19.64,8.15l-19.38-15.51a4,4,0,0,0-2.5-.87h-.24a73.67,73.67,0,0,1-9.16,0,4,4,0,0,0-2.74.87l-19.37,15.5a95.33,95.33,0,0,1-19.65-8.13l-2.74-24.67a4,4,0,0,0-1.32-2.55,76.2,76.2,0,0,1-6.48-6.48,4,4,0,0,0-2.55-1.32l-24.66-2.74a95.45,95.45,0,0,1-8.15-19.64l15.51-19.38a4,4,0,0,0,.87-2.74,77.76,77.76,0,0,1,0-9.16,4,4,0,0,0-.87-2.74l-15.5-19.37A95.33,95.33,0,0,1,43.9,81.66l24.67-2.74a4,4,0,0,0,2.55-1.32,76.2,76.2,0,0,1,6.48-6.48,4,4,0,0,0,1.32-2.55l2.74-24.66a95.45,95.45,0,0,1,19.64-8.15l19.38,15.51a4,4,0,0,0,2.74.87,73.67,73.67,0,0,1,9.16,0,4,4,0,0,0,2.74-.87l19.37-15.5a95.33,95.33,0,0,1,19.65,8.13l2.74,24.67a4,4,0,0,0,1.32,2.55,76.2,76.2,0,0,1,6.48,6.48,4,4,0,0,0,2.55,1.32l24.66,2.74a95.45,95.45,0,0,1,8.15,19.64l-15.51,19.38a4,4,0,0,0-.87,2.74,77.76,77.76,0,0,1,0,9.16,4,4,0,0,0,.87,2.74l15.5,19.37A95.33,95.33,0,0,1,212.1,174.34Z`}))]]),uw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,144a32,32,0,1,1-32-32A32,32,0,0,1,216,144Z`,opacity:`0.2`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),dw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),fw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),pw=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M200,164a36.07,36.07,0,0,0-33.94,24H72a28,28,0,0,1,0-56h96a44,44,0,0,0,0-88H72a12,12,0,0,0,0,24h96a20,20,0,0,1,0,40H72a52,52,0,0,0,0,104h94.06A36,36,0,1,0,200,164Zm0,48a12,12,0,1,1,12-12A12,12,0,0,1,200,212Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,200a24,24,0,1,1-24-24A24,24,0,0,1,224,200Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M200,168a32.06,32.06,0,0,0-31,24H72a32,32,0,0,1,0-64h96a40,40,0,0,0,0-80H72a8,8,0,0,0,0,16h96a24,24,0,0,1,0,48H72a48,48,0,0,0,0,96h97a32,32,0,1,0,31-40Zm0,48a16,16,0,1,1,16-16A16,16,0,0,1,200,216Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,200a28,28,0,0,1-54.83,8H72a48,48,0,0,1,0-96h96a24,24,0,0,0,0-48H72a8,8,0,0,1,0-16h96a40,40,0,0,1,0,80H72a32,32,0,0,0,0,64H173.17A28,28,0,0,1,228,200Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M200,170a30.05,30.05,0,0,0-29.4,24H72a34,34,0,0,1,0-68h96a38,38,0,0,0,0-76H72a6,6,0,0,0,0,12h96a26,26,0,0,1,0,52H72a46,46,0,0,0,0,92h98.6A30,30,0,1,0,200,170Zm0,48a18,18,0,1,1,18-18A18,18,0,0,1,200,218Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M200,168a32.06,32.06,0,0,0-31,24H72a32,32,0,0,1,0-64h96a40,40,0,0,0,0-80H72a8,8,0,0,0,0,16h96a24,24,0,0,1,0,48H72a48,48,0,0,0,0,96h97a32,32,0,1,0,31-40Zm0,48a16,16,0,1,1,16-16A16,16,0,0,1,200,216Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M200,172a28,28,0,0,0-27.71,24H72a36,36,0,0,1,0-72h96a36,36,0,0,0,0-72H72a4,4,0,0,0,0,8h96a28,28,0,0,1,0,56H72a44,44,0,0,0,0,88H172.29A28,28,0,1,0,200,172Zm0,48a20,20,0,1,1,20-20A20,20,0,0,1,200,220Z`}))]]),mw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),hw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),gw=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M144,180a16,16,0,1,1-16-16A16,16,0,0,1,144,180Zm92-52A108,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,128ZM128,64c-24.26,0-44,17.94-44,40v4a12,12,0,0,0,24,0v-4c0-8.82,9-16,20-16s20,7.18,20,16-9,16-20,16a12,12,0,0,0-12,12v8a12,12,0,0,0,23.73,2.56C158.31,137.88,172,122.37,172,104,172,81.94,152.26,64,128,64Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,168a12,12,0,1,1,12-12A12,12,0,0,1,128,192Zm8-48.72V144a8,8,0,0,1-16,0v-8a8,8,0,0,1,8-8c13.23,0,24-9,24-20s-10.77-20-24-20-24,9-24,20v4a8,8,0,0,1-16,0v-4c0-19.85,17.94-36,40-36s40,16.15,40,36C168,125.38,154.24,139.93,136,143.28Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M138,180a10,10,0,1,1-10-10A10,10,0,0,1,138,180ZM128,74c-21,0-38,15.25-38,34v4a6,6,0,0,0,12,0v-4c0-12.13,11.66-22,26-22s26,9.87,26,22-11.66,22-26,22a6,6,0,0,0-6,6v8a6,6,0,0,0,12,0v-2.42c18.11-2.58,32-16.66,32-33.58C166,89.25,149,74,128,74Zm102,54A102,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`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M136,180a8,8,0,1,1-8-8A8,8,0,0,1,136,180ZM128,76c-19.85,0-36,14.36-36,32v4a4,4,0,0,0,8,0v-4c0-13.23,12.56-24,28-24s28,10.77,28,24-12.56,24-28,24a4,4,0,0,0-4,4v8a4,4,0,0,0,8,0v-4.2c18-1.77,32-15.36,32-31.8C164,90.36,147.85,76,128,76Zm100,52A100,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`}))]]),_w=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,36H40A20,20,0,0,0,20,56V200a20,20,0,0,0,20,20H216a20,20,0,0,0,20-20V56A20,20,0,0,0,216,36ZM44,60H76V196H44ZM212,196H100V60H212Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M88,48V208H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,160H88V56H216V200Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,42H40A14,14,0,0,0,26,56V200a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A14,14,0,0,0,216,42ZM38,200V56a2,2,0,0,1,2-2H82V202H40A2,2,0,0,1,38,200Zm180,0a2,2,0,0,1-2,2H94V54H216a2,2,0,0,1,2,2Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,44H40A12,12,0,0,0,28,56V200a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A12,12,0,0,0,216,44ZM36,200V56a4,4,0,0,1,4-4H84V204H40A4,4,0,0,1,36,200Zm184,0a4,4,0,0,1-4,4H92V52H216a4,4,0,0,1,4,4Z`}))]]),vw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),yw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),bw=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M100,36H56A20,20,0,0,0,36,56v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V56A20,20,0,0,0,100,36ZM96,96H60V60H96ZM200,36H156a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,60H160V60h36Zm-96,40H56a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V156A20,20,0,0,0,100,136Zm-4,60H60V160H96Zm104-60H156a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20h44a20,20,0,0,0,20-20V156A20,20,0,0,0,200,136Zm-4,60H160V160h36Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M112,56v48a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8h48A8,8,0,0,1,112,56Zm88-8H152a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V56A8,8,0,0,0,200,48Zm-96,96H56a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V152A8,8,0,0,0,104,144Zm96,0H152a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h48a8,8,0,0,0,8-8V152A8,8,0,0,0,200,144Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M200,136H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48v48ZM104,40H56A16,16,0,0,0,40,56v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,104,40Zm0,64H56V56h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,64H152V56h48v48Zm-96,32H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm0,64H56V152h48v48Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M120,56v48a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40h48A16,16,0,0,1,120,56Zm80-16H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm-96,96H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm96,0H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M104,42H56A14,14,0,0,0,42,56v48a14,14,0,0,0,14,14h48a14,14,0,0,0,14-14V56A14,14,0,0,0,104,42Zm2,62a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2h48a2,2,0,0,1,2,2Zm94-62H152a14,14,0,0,0-14,14v48a14,14,0,0,0,14,14h48a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,62a2,2,0,0,1-2,2H152a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2h48a2,2,0,0,1,2,2Zm-98,34H56a14,14,0,0,0-14,14v48a14,14,0,0,0,14,14h48a14,14,0,0,0,14-14V152A14,14,0,0,0,104,138Zm2,62a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V152a2,2,0,0,1,2-2h48a2,2,0,0,1,2,2Zm94-62H152a14,14,0,0,0-14,14v48a14,14,0,0,0,14,14h48a14,14,0,0,0,14-14V152A14,14,0,0,0,200,138Zm2,62a2,2,0,0,1-2,2H152a2,2,0,0,1-2-2V152a2,2,0,0,1,2-2h48a2,2,0,0,1,2,2Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M104,40H56A16,16,0,0,0,40,56v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,104,40Zm0,64H56V56h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,64H152V56h48v48Zm-96,32H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm0,64H56V152h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48v48Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M104,44H56A12,12,0,0,0,44,56v48a12,12,0,0,0,12,12h48a12,12,0,0,0,12-12V56A12,12,0,0,0,104,44Zm4,60a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4Zm92-60H152a12,12,0,0,0-12,12v48a12,12,0,0,0,12,12h48a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,60a4,4,0,0,1-4,4H152a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4ZM104,140H56a12,12,0,0,0-12,12v48a12,12,0,0,0,12,12h48a12,12,0,0,0,12-12V152A12,12,0,0,0,104,140Zm4,60a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V152a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4Zm92-60H152a12,12,0,0,0-12,12v48a12,12,0,0,0,12,12h48a12,12,0,0,0,12-12V152A12,12,0,0,0,200,140Zm4,60a4,4,0,0,1-4,4H152a4,4,0,0,1-4-4V152a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4Z`}))]]),xw=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M243,96a20.33,20.33,0,0,0-17.74-14l-56.59-4.57L146.83,24.62a20.36,20.36,0,0,0-37.66,0L87.35,77.44,30.76,82A20.45,20.45,0,0,0,19.1,117.88l43.18,37.24-13.2,55.7A20.37,20.37,0,0,0,79.57,233L128,203.19,176.43,233a20.39,20.39,0,0,0,30.49-22.15l-13.2-55.7,43.18-37.24A20.43,20.43,0,0,0,243,96ZM172.53,141.7a12,12,0,0,0-3.84,11.86L181.58,208l-47.29-29.08a12,12,0,0,0-12.58,0L74.42,208l12.89-54.4a12,12,0,0,0-3.84-11.86L41.2,105.24l55.4-4.47a12,12,0,0,0,10.13-7.38L128,41.89l21.27,51.5a12,12,0,0,0,10.13,7.38l55.4,4.47Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M229.06,108.79l-48.7,42,14.88,62.79a8.4,8.4,0,0,1-12.52,9.17L128,189.09,73.28,222.74a8.4,8.4,0,0,1-12.52-9.17l14.88-62.79-48.7-42A8.46,8.46,0,0,1,31.73,94L95.64,88.8l24.62-59.6a8.36,8.36,0,0,1,15.48,0l24.62,59.6L224.27,94A8.46,8.46,0,0,1,229.06,108.79Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M234.29,114.85l-45,38.83L203,211.75a16.4,16.4,0,0,1-24.5,17.82L128,198.49,77.47,229.57A16.4,16.4,0,0,1,53,211.75l13.76-58.07-45-38.83A16.46,16.46,0,0,1,31.08,86l59-4.76,22.76-55.08a16.36,16.36,0,0,1,30.27,0l22.75,55.08,59,4.76a16.46,16.46,0,0,1,9.37,28.86Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M237.28,97.87A14.18,14.18,0,0,0,224.76,88l-60.25-4.87-23.22-56.2a14.37,14.37,0,0,0-26.58,0L91.49,83.11,31.24,88a14.18,14.18,0,0,0-12.52,9.89A14.43,14.43,0,0,0,23,113.32L69,152.93l-14,59.25a14.4,14.4,0,0,0,5.59,15,14.1,14.1,0,0,0,15.91.6L128,196.12l51.58,31.71a14.1,14.1,0,0,0,15.91-.6,14.4,14.4,0,0,0,5.59-15l-14-59.25L233,113.32A14.43,14.43,0,0,0,237.28,97.87Zm-12.14,6.37-48.69,42a6,6,0,0,0-1.92,5.92l14.88,62.79a2.35,2.35,0,0,1-.95,2.57,2.24,2.24,0,0,1-2.6.1L131.14,184a6,6,0,0,0-6.28,0L70.14,217.61a2.24,2.24,0,0,1-2.6-.1,2.35,2.35,0,0,1-1-2.57l14.88-62.79a6,6,0,0,0-1.92-5.92l-48.69-42a2.37,2.37,0,0,1-.73-2.65,2.28,2.28,0,0,1,2.07-1.65l63.92-5.16a6,6,0,0,0,5.06-3.69l24.63-59.6a2.35,2.35,0,0,1,4.38,0l24.63,59.6a6,6,0,0,0,5.06,3.69l63.92,5.16a2.28,2.28,0,0,1,2.07,1.65A2.37,2.37,0,0,1,225.14,104.24Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M235.36,98.49A12.21,12.21,0,0,0,224.59,90l-61.47-5L139.44,27.67a12.37,12.37,0,0,0-22.88,0L92.88,85,31.41,90a12.45,12.45,0,0,0-7.07,21.84l46.85,40.41L56.87,212.64a12.35,12.35,0,0,0,18.51,13.49L128,193.77l52.62,32.36a12.12,12.12,0,0,0,13.69-.51,12.28,12.28,0,0,0,4.82-13l-14.32-60.42,46.85-40.41A12.29,12.29,0,0,0,235.36,98.49Zm-8.93,7.26-48.68,42a4,4,0,0,0-1.28,3.95l14.87,62.79a4.37,4.37,0,0,1-1.72,4.65,4.24,4.24,0,0,1-4.81.18L130.1,185.67a4,4,0,0,0-4.2,0L71.19,219.32a4.24,4.24,0,0,1-4.81-.18,4.37,4.37,0,0,1-1.72-4.65L79.53,151.7a4,4,0,0,0-1.28-3.95l-48.68-42A4.37,4.37,0,0,1,28.25,101a4.31,4.31,0,0,1,3.81-3L96,92.79a4,4,0,0,0,3.38-2.46L124,30.73a4.35,4.35,0,0,1,8.08,0l24.62,59.6A4,4,0,0,0,160,92.79l63.9,5.15a4.31,4.31,0,0,1,3.81,3A4.37,4.37,0,0,1,226.43,105.75Z`}))]]),Sw=new Map([[`bold`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`,k.createElement(k.Fragment,null,k.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`}))]]),Cw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:aw}));Cw.displayName=`BellIcon`;var ww=Cw,Tw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:ow}));Tw.displayName=`BookOpenIcon`;var Ew=Tw,Dw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:sw}));Dw.displayName=`ChatCircleIcon`;var Ow=Dw,kw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:cw}));kw.displayName=`CompassIcon`;var Aw=kw,jw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:lw}));jw.displayName=`GearIcon`;var Mw=jw,Nw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:uw}));Nw.displayName=`ListMagnifyingGlassIcon`;var Pw=Nw,Fw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:dw}));Fw.displayName=`MagnifyingGlassIcon`;var Iw=Fw,Lw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:fw}));Lw.displayName=`MoonIcon`;var Rw=Lw,zw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:pw}));zw.displayName=`PathIcon`;var Bw=zw,Vw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:mw}));Vw.displayName=`PlugsConnectedIcon`;var Hw=Vw,Uw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:hw}));Uw.displayName=`PlusIcon`;var Ww=Uw,Gw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:gw}));Gw.displayName=`QuestionIcon`;var Kw=Gw,qw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:_w}));qw.displayName=`SidebarSimpleIcon`;var Jw=qw,Yw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:vw}));Yw.displayName=`SignOutIcon`;var Xw=Yw,Zw=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:yw}));Zw.displayName=`SparkleIcon`;var Qw=Zw,$w=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:bw}));$w.displayName=`SquaresFourIcon`;var eT=$w,tT=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:xw}));tT.displayName=`StarIcon`;var nT=tT,rT=k.forwardRef((e,t)=>k.createElement(qe,{ref:t,...e,weights:Sw}));rT.displayName=`SunIcon`;var iT=rT,aT=[`agent-threads`];async function oT(e){let t=await Wt(e);if(!t.ok)throw Error(`Request failed (${t.status})`);return t.json()}var sT=new Set([`create_dashboard`,`edit_dashboard`,`replace_dashboard`,`restore_dashboard_version`]);function cT(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function lT(e){if(typeof e==`string`)try{let t=JSON.parse(e);if(cT(t))return t}catch{}}var uT=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),dT=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0;function fT(e){return cT(e)&&typeof e.id==`string`&&[`ok`,`empty`,`error`,`invalid`,`not_run`,`partial`,`stale`].includes(String(e.status))&&(e.rows===void 0||dT(e.rows))&&(e.elapsed_ms===void 0||dT(e.elapsed_ms))&&(e.diagnosis===void 0||typeof e.diagnosis==`string`)&&(e.error===void 0||typeof e.error==`string`)}function pT(e){if(!cT(e)||!Number.isInteger(e.base_version)||Number(e.base_version)<0||!Number.isInteger(e.version)||Number(e.version)<1||!Array.isArray(e.changes)||typeof e.layout_changed!=`boolean`||e.dashboard_fields!==void 0&&!uT(e.dashboard_fields)||!e.changes.every(e=>cT(e)&&typeof e.panel_id==`string`&&typeof e.title==`string`&&[`added`,`changed`,`removed`].includes(String(e.kind))&&(e.fields===void 0||uT(e.fields)&&!e.fields.includes(`grid`))&&(e.position_changed===void 0||typeof e.position_changed==`boolean`)))return!1;let t=e.save_check;return cT(t)&&typeof t.checked==`boolean`&&dT(t.elapsed_ms)&&Array.isArray(t.panels)&&t.panels.every(e=>fT(e)&&Number.isInteger(e.rows)&&Number(e.rows)>=0)&&new Set(t.panels.map(e=>e.id)).size===t.panels.length&&(t.reason===void 0||typeof t.reason==`string`)&&(!t.checked||t.panels.every(e=>e.status!==`not_run`))}function mT(e,t,n){let r=-1;n.forEach((n,i)=>{n.role===`tool`&&n.toolCallId===e&&n.content===t&&(r=i)});let i=r<0?n.length:r,a=-1;if(n.slice(0,i).forEach((e,t)=>{e.role===`user`&&(a=t)}),a<0)return null;let o=n.slice(a+1,i).flatMap(e=>e.role===`assistant`?e.toolCalls??[]:[]).filter(t=>t.id===e),s=o.length===1?o[0].function.name:void 0;if(!s||!sT.has(s))return null;let c=lT(t),l=c?.dashboard,u=c?.receipt;return!c||c.error||c.isError||!cT(l)||typeof l.id!=`string`||!l.id||typeof l.name!=`string`||!l.name||!pT(u)||l.version!==u.version||r>=0&&n[r].error?null:{id:l.id,name:l.name,version:u.version,label:s===`create_dashboard`?`Created`:s===`restore_dashboard_version`?`Restored`:`Updated`,receipt:u}}var hT={viz:`chart type`,sql:`SQL`,content:`text`,x_unit:`x-axis unit`,options:`display options`,drill:`drill-down`,click:`click action`,time:`time range`,annotations:`markers`,better:`better direction`,reduce:`summary`,min:`minimum`,max:`maximum`},gT=e=>Object.hasOwn(hT,e)?hT[e]:e.replaceAll(`_`,` `),_T=e=>e.kind===`added`?`+ ${e.title}`:e.kind===`removed`?`− ${e.title}`:`~ ${e.title}${e.fields?.length?`: `+e.fields.map(gT).join(`, `):``}${e.position_changed?` · moved`:``}`;function vT(e){return[...e.changes.map(_T),...e.layout_changed?[`Layout adjusted`]:[],...e.dashboard_fields?.map(e=>`Dashboard: ${gT(e)}`)??[]]}function yT(e,t,n){return e.filter(e=>n.has(e.panel_id)&&!t.some(t=>t.panel_id===e.panel_id&&t.path===e.path))}var bT={schema:`Telemetry`,context:`Context`,draft:`Draft`,validation:`Validation`,preview:`Preview`,save:`Save`},xT=new Set([`get_insights`,`query_telemetry`,`get_overview`,`get_service_topology`,`get_service_dependencies`,`get_service_performance`,`inspect_trace`,`search_logs`]),ST=(e,t)=>Array.isArray(e)?e.flatMap(e=>cT(e)&&typeof e.path==`string`&&typeof e.message==`string`?[{panel_id:t,path:e.path,message:e.message}]:[]):[],CT=e=>{let t=lT(e)?.error;return cT(t)?t.code:void 0},wT=e=>e.role===`tool`&&CT(e.content)===`interrupted`,TT=e=>![`invalid`,`not_run`].includes(e.status);function ET(e,t){let n=e.findIndex(e=>e.id===t&&e.role===`user`);if(n<0)return null;let r=e.findIndex((e,t)=>t>n&&e.role===`user`),i=e.slice(n+1,r<0?void 0:r),a=new Set(i.flatMap(e=>e.role===`tool`&&CT(e.content)===`answer_only`?[e.toolCallId]:[])),o=i.flatMap((e,t)=>e.role===`assistant`?(e.toolCalls??[]).map(e=>({call:e,index:t})):[]).filter(({call:e})=>!a.has(e.id));if(!o.some(({call:e})=>sT.has(e.function.name)||e.function.name===`preview_panels`))return null;let s={schema:{state:`unobserved`},context:{state:`unobserved`},draft:{state:`unobserved`},validation:{state:`unobserved`},preview:{state:`unobserved`},save:{state:`unobserved`}},c={turn_id:t,stages:s,panel_titles:{},panels:[],problems:[],corrections:[],save_attempts:[],explanations:[],context_counts:{deploys:0,anomalies:0}},l=new Map,u=new Map;for(let{call:e}of o)l.set(e.id,(l.get(e.id)??0)+1);i.forEach((e,t)=>{if(e.role===`tool`){let n=u.get(e.toolCallId)??[];n.push({index:t,message:e}),u.set(e.toolCallId,n)}});let d=new Map,f=new Map,p=[],m,h=!1,g=!1,_=(e,t)=>{for(let n of yT(y.get(e)??[],t,new Set([e])))p.some(e=>e.panel_id===n.panel_id&&e.path===n.path)||p.push(n);y.set(e,t)},v=new Map,y=new Map,b=new Set,x=!1,ee=!1;for(let{call:t,index:n}of o){if(l.get(t.id)!==1)continue;let r=t.function.name,i=lT(t.function.arguments),a=(u.get(t.id)??[]).filter(e=>e.index>n),o=a.length===1||sT.has(r)&&a.length>1&&a.slice(0,-1).every(e=>wT(e.message))?a.at(-1).message:void 0,S=o&&lT(o.content),C=!!S&&o?.role===`tool`&&!o.error&&!S.error&&!S.isError,te=o?C?`complete`:`failed`:`incomplete`;if(r===`get_telemetry_schema`&&(s.schema={state:te}),xT.has(r)){let e=o?.role===`tool`&&!o.error&&!S?.error&&!S?.isError&&typeof o.content==`string`&&o.content.length>0;if(s.context={state:o?e?`complete`:`failed`:`incomplete`},C)for(let[e,t]of[[`deploys`,[`deploys`,`deployments`]],[`anomalies`,[`anomalies`]]])for(let n of t)Array.isArray(S[n])&&(c.context_counts[e]+=S[n].length)}if(r===`preview_panels`||r===`create_dashboard`||r===`replace_dashboard`){let e=r===`preview_panels`?i?.panels:cT(i?.dashboard)?i.dashboard.panels:void 0;if(Array.isArray(e)){c.panel_count=e.length,s.draft={state:`complete`};for(let t of e)cT(t)&&typeof t.id==`string`&&typeof t.title==`string`&&t.title.trim()&&f.set(t.id,t.title)}}if(r===`preview_panels`){x=!0;let e=Array.isArray(i?.panels)?i.panels.flatMap(e=>cT(e)&&typeof e.id==`string`?[e.id]:[]):[];for(let t of e)v.set(t,{id:t,status:`not_run`});let t=C&&Array.isArray(S.panels)&&S.panels.every(fT)?S.panels:void 0,n=typeof S?.elapsed_ms==`number`&&S.elapsed_ms>=0?S.elapsed_ms:void 0;if(s.validation={state:t?t.some(e=>e.status===`invalid`||e.status===`not_run`)||ST(S?.problems,`dashboard`).length?`failed`:`complete`:te===`complete`?`failed`:te},s.preview={state:t?t.every(TT)?`complete`:`incomplete`:te===`complete`?`failed`:te,elapsed_ms:n},!t||e.length===0||t.length!==e.length||new Set(t.map(e=>e.id)).size!==e.length||t.some(t=>!e.includes(t.id))){ee=e.length===0;for(let t of e)o&&b.add(t);continue}ee=!1;for(let t of e)b.delete(t);for(let e of t){let t=ST(e.problems,e.id);if(e.status!==`not_run`)_(e.id,t);else{let n=y.get(e.id)??[];y.set(e.id,[...n,...t.filter(e=>!n.some(t=>t.path===e.path))])}v.set(e.id,e)}c.problems=[...y.values()].flat().concat(ST(S?.problems,`dashboard`))}if(sT.has(r)){let n=o&&mT(t.id,o.content,e),r=!!o&&wT(o),i=!r&&o?.role===`tool`&&(!!o.error||!!S?.error||!!S?.isError);if(g=!!i,h=!!o&&!n&&!i&&!r,s.save={state:n?`complete`:r?`interrupted`:i?`failed`:`incomplete`},n)for(let e of c.save_attempts)e.state===`failed`&&(e.state=`retried`);if(c.save_attempts.push({call_id:t.id,state:s.save.state}),n){m?.id!==n.id&&(m=n,d.clear());for(let e of n.receipt.changes){e.title.trim()&&f.set(e.panel_id,e.title);let t=d.get(e.panel_id);if(t?.kind===`added`&&e.kind===`removed`){d.delete(e.panel_id);continue}if(t?.kind===`added`){d.set(e.panel_id,{panel_id:e.panel_id,title:e.title,kind:`added`});continue}if(e.kind===`removed`){d.set(e.panel_id,e);continue}t&&e.kind===`changed`?d.set(e.panel_id,{...e,fields:[...new Set([...t.fields??[],...e.fields??[]])].sort(),position_changed:t.position_changed||e.position_changed}):d.set(e.panel_id,t?.kind===`removed`&&e.kind===`added`?{...e,kind:`changed`}:e)}let e=S?.dashboard,t=cT(e)?e.spec:void 0;if(cT(t)&&Array.isArray(t.panels))for(let e of t.panels)cT(e)&&typeof e.id==`string`&&typeof e.title==`string`&&e.title.trim()&&f.set(e.id,e.title);let r=c.saved?.id===n.id?c.saved.receipt:void 0;c.saved={...n,label:m.label,receipt:{...n.receipt,base_version:m.receipt.base_version,changes:[...d.values()],layout_changed:m.receipt.base_version!==0&&(n.receipt.layout_changed||!!r?.layout_changed),dashboard_fields:m.receipt.base_version===0?void 0:[...new Set([...r?.dashboard_fields??[],...n.receipt.dashboard_fields??[]])].sort()}},c.panel_count=n.receipt.save_check.panels.length,s.draft={state:`complete`};let i=new Set(n.receipt.save_check.panels.map(e=>e.id));for(let e of n.receipt.save_check.panels)e.status===`invalid`?_(e.id,ST(e.problems,e.id)):TT(e)&&(_(e.id,[]),b.delete(e.id));p=p.filter(e=>i.has(e.panel_id)),c.problems=[...y.values()].flat().filter(e=>i.has(e.panel_id))}}}if(h)return null;c.panel_titles=Object.fromEntries(f),c.corrections=p.map(e=>({...e,title:f.get(e.panel_id)??e.panel_id}));let S=c.saved?new Set(c.saved.receipt.save_check.panels.map(e=>e.id)):void 0;if(c.panels=[...v.values()].filter(e=>!S||S.has(e.id)),x){let e=ee||[...b].some(e=>!S||S.has(e)),t=c.panels.some(e=>e.status===`not_run`),n=c.problems.length>0;s.validation.state=e||n?`failed`:t?`incomplete`:`complete`,s.preview.state=e?`failed`:t||n||c.panels.some(e=>e.status===`invalid`)?`incomplete`:`complete`}let C=c.saved?.receipt.save_check;C&&!C.checked&&c.explanations.push(`Save check incomplete: ${C.reason||`Panels were not checked`}`);for(let e of C?.panels??c.panels)e.status!==`ok`&&c.explanations.push(`${f.get(e.id)??e.id}: ${e.status}${e.error||e.diagnosis?` — ${e.error||e.diagnosis}`:``}`);for(let e of c.problems)c.explanations.push(`${f.get(e.panel_id)??e.panel_id}: ${e.message}`);let te=Object.entries(s).filter(([,e])=>e.state===`incomplete`||e.state===`failed`).map(([e,t])=>`${bT[e]}: ${t.state}`);return te.length&&c.explanations.push(te.join(` · `)),s.save.state===`interrupted`&&c.explanations.push(`Save interrupted · outcome unknown`),g&&c.explanations.push(c.saved?`A later change failed; v${c.saved.version} remains saved`:`Save failed · dashboard was not saved`),c}var DT=(0,k.createContext)(null);function OT(){let e=(0,k.useContext)(DT);if(!e)throw Error(`Pitot app context is unavailable`);return e}var kT=`Build me a dashboard for my services, showing request volume, latency, and errors. Ask me which services to monitor first.`,AT={query_telemetry:{activity:`Querying telemetry…`,title:`Telemetry panels`},get_overview:{activity:`Checking system health…`,title:`System health`},get_service_topology:{activity:`Mapping service dependencies…`,title:`Service map`},get_service_dependencies:{activity:`Tracing service dependencies…`,title:`Service dependencies`},list_panel_exemplars:{activity:`Finding example traces…`,title:`Example traces`},resolve_panel_variables:{activity:`Reading filter choices…`,title:`Filter choices`},query_panel_fragment:{activity:`Refreshing panels…`,title:`Panel refresh`},get_service_performance:{activity:`Reading performance signals…`,title:`Performance`},inspect_trace:{activity:`Inspecting a trace…`,title:`Trace lookup`},search_logs:{activity:`Searching logs…`,title:`Logs`},get_insights:{activity:`Reviewing detected anomalies…`,title:`Detected anomalies`},get_telemetry_schema:{activity:`Reading what telemetry exists…`,title:`Telemetry discovery`},preview_panels:{activity:`Checking dashboard panels…`,title:`Panel check`},list_dashboards:{activity:`Looking through your dashboards…`,title:`Dashboards`},get_dashboard:{activity:`Opening your dashboard…`,title:`Dashboard`},create_dashboard:{activity:`Building your dashboard…`,title:`Dashboard save`},edit_dashboard:{activity:`Updating your dashboard…`,title:`Dashboard save`},replace_dashboard:{activity:`Redesigning your dashboard…`,title:`Dashboard save`},list_dashboard_versions:{activity:`Reading your dashboard history…`,title:`Dashboard history`},restore_dashboard_version:{activity:`Restoring your dashboard…`,title:`Dashboard`}};function jT(e){return AT[e]?.activity??`Working on it…`}function MT(e){return AT[e]?.title??`Analysis step`}function NT(e){switch(e){case`provider_unavailable`:return`Pitot could not reach the model provider. Please try again.`;case`step_limit`:return`Pitot reached its step limit before finishing. Try a narrower question.`;case`time_limit`:return`Pitot reached its 5-minute time limit. Try a smaller request.`;default:return`Pitot could not complete this analysis. Please try again.`}}function PT(e){let t=(0,k.useRef)(new Map);return(0,k.useMemo)(()=>{let n=new Map,r=new Set,i=e.flatMap((e,t)=>e.role===`user`?[t]:[]);i.forEach((a,o)=>{let s=i[o+1]??e.length,c=e[a],l=e[s-1];r.add(c.id);let u=t.current.get(c.id),d=u&&u.last===l&&u.length===s-a?u.receipt:ET(e.slice(a,s),c.id);oe.msecs?(e.seq=UT(n),e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function HT(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??=UT(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 UT(e){return(e[6]&127)<<24|e[7]<<16|e[8]<<8|e[9]}function WT(){return BT()}function GT(){let{setColorScheme:e}=ar(),t=cr(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`,[r,i]=(0,k.useState)(!1);return(0,A.jsx)(Bi,{label:`Switch to ${n} theme`,opened:r,children:(0,A.jsx)(Ne,{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,A.jsx)(iT,{size:17,weight:`bold`}):(0,A.jsx)(Rw,{size:17,weight:`bold`})})})}function KT(){let e=(0,k.useRef)(null);return(0,k.useRef)({remember(t){e.current=t instanceof HTMLElement?t:null},restore(t){let n=e.current;requestAnimationFrame(()=>(n?.isConnected?n:t)?.focus())}}).current}var qT=`pitot:shortcuts`,JT=0,YT=new Set,XT=()=>{for(let e of YT)e()};function ZT(e){(0,k.useEffect)(()=>(window.addEventListener(qT,e),JT+=1,XT(),()=>{window.removeEventListener(qT,e),--JT,XT()}),[e])}function QT(){return(0,k.useSyncExternalStore)(e=>(YT.add(e),()=>YT.delete(e)),()=>JT>0,()=>!1)}function $T(){let e=QT(),t=(0,k.useRef)(null);return(0,A.jsxs)(Ot,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,A.jsx)(Ot.Target,{children:(0,A.jsx)(Bi,{label:`Help`,children:(0,A.jsx)(Ne,{ref:t,variant:`subtle`,color:`gray`,"aria-label":`Help`,children:(0,A.jsx)(Kw,{size:18,weight:`bold`})})})}),(0,A.jsxs)(Ot.Dropdown,{children:[(0,A.jsx)(Ot.Item,{component:`a`,href:Gt.home,target:`_blank`,rel:`noopener noreferrer`,leftSection:(0,A.jsx)(Ew,{size:15}),children:`Documentation`}),e&&(0,A.jsx)(Ot.Item,{leftSection:(0,A.jsx)(Et,{size:15}),rightSection:(0,A.jsx)(Ei,{size:`xs`,children:`?`}),onClick:()=>{t.current?.focus(),window.dispatchEvent(new Event(qT))},children:`Keyboard shortcuts`})]})]})}var eE=new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}),tE=new Intl.NumberFormat(`en`,{maximumFractionDigits:2});function nE(e){return Math.abs(e)<1e-4?e.toExponential(2).replace(/\.?(0+)(?=e)/,``):String(Number(e.toPrecision(3)))}function rE(e,t=tE){return e!==0&&Math.abs(e)<1?nE(e):t.format(e)}function iE(e,t){let n=t===`s`?e*1e3:t===`ns`?e/1e6:e;return e!==0&&n===0?`${nE(e)} ${t}`:n!==0&&Math.abs(n)<1?`${nE(n)} ms`:Ut(n)}var aE=[`B`,`KiB`,`MiB`,`GiB`,`TiB`];function oE(e){let t=e,n=0;for(;Math.abs(t)>=1024&&n=1e4?eE:tE);default:return rE(t,Math.abs(t)>=1e4?eE:tE)}}var cE={ms:1,s:1e3,ns:1e-6},lE=[[36e5,`h`],[6e4,`m`],[1e3,`s`],[1,`ms`]];function uE(e,t){let n=e===void 0?void 0:cE[e];if(e===`bytes`&&t&&t.interval>0){let e=Math.max(Math.abs(t.min),Math.abs(t.max)),n=[4,3,2,1].find(n=>e>=1024**n&&Math.abs(t.interval/1024**n*100-Math.round(t.interval/1024**n*100))<1e-6)??0;return e=>Number.isFinite(e)?`${rE(e/1024**n)} ${aE[n]}`:`—`}if(e===`percent`&&t&&t.interval>0){let e=[0,1,2,3,4].find(e=>{let n=t.interval*10**e;return Math.round(n)!==0&&Math.abs(n-Math.round(n))<1e-6*Math.abs(n)});if(e!==void 0){let t=new Intl.NumberFormat(`en`,{minimumFractionDigits:e,maximumFractionDigits:e});return e=>Number.isFinite(e)?`${t.format(e)}%`:`—`}}if(n!==void 0&&t&&t.interval>0){let e=Math.max(Math.abs(t.min),Math.abs(t.max))*n,r=t.interval*n,[i,a]=lE.find(([t])=>e>=t&&Math.abs(r/t*100-Math.round(r/t*100))<1e-6)??[1,`ms`];return e=>Number.isFinite(e)?`${rE(e*n/i)} ${a}`:`—`}return t=>(!e||e===`count`)&&Math.abs(t)>=1e3?rE(t,eE):e===`ms`||e===`s`||e===`ns`?sE(e,t).replace(/(\.\d*?)0+([a-z]*)$/,`$1$2`).replace(/\.([a-z]*)$/,`$1`):sE(e,t)}function dE(e){return e!==void 0&&e!==`count`&&/[^\d\s]$/.test(uE(e)(1).trim())}function fE(e,t,n){return uE(e,n)(t??NaN).replace(/(?<=\d)(ms|ns|s|m|h)\b/g,` $1`)}function pE(e){return Math.max(3,Math.min(10,Math.round(e/70)))-1}function mE(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(t===`bytes`){let t=Math.min(4,Math.max(0,Math.floor(Math.log(e)/Math.log(1024)))),n=r(Math.max(e/1024**t,+(t===0)));return(n>=1e3&&t<4?1024:n)*1024**t}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 hE(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=pE(r),a=mE(Math.max(t-e,2**-52)/i,n);for(let r=0;r<64&&Math.ceil(t/a)-Math.floor(e/a)>i;r++)a=mE(a*1.01,n);return{min:Math.floor(e/a)*a,max:Math.ceil(t/a)*a,interval:a,splitNumber:i,pitot_unit:n}}function gE(e,t){if(e.type!==`value`&&e.type!==`log`)return e;if(e.type!==`value`||typeof e.min!=`number`||typeof e.max!=`number`)return{...e,splitNumber:pE(t)};let n=typeof e.pitot_unit==`string`?e.pitot_unit:void 0,r=hE(e.min,e.max,n,t);return{...e,...r,...n&&(n in cE||n===`bytes`||n===`percent`)?{axisLabel:{...e.axisLabel,formatter:uE(n,r)}}:{}}}function _E(e,t,n){let r=e=>sE(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 vE(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 yE(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(`:`)}`}var bE=[{path:`/explore`,label:`Explore`,Icon:Aw},{path:`/logs`,label:`Logs`,Icon:Pw},{path:`/traces`,label:`Traces`,Icon:Bw},{path:`/alerts`,label:`Alerts`,Icon:ww},{path:`/settings`,label:`Settings`,Icon:Mw}];async function xE(e,t){let n=new URLSearchParams({page_size:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await Wt(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function SE({collapsed:e=!1,agentAvailable:t,activeThreadID:n,activeDashboardID:r,activePath:i,autoFocusSearch:a=!1,onNewChat:o,onSelectThread:s,onDeletedThread:l,onSelectDashboard:d,onCreateDashboard:f,onNewDashboard:p,onNavigate:h,onInvestigateService:g,ref:_}){let v=Zt(),[y,b]=(0,k.useState)(``),[x]=er(y.trim(),250),[ee,S]=(0,k.useState)(null),[C,w]=(0,k.useState)(null),[ne,re]=(0,k.useState)(``),[ie,ae]=(0,k.useState)(``),[oe,se]=(0,k.useState)(!1),ce=(0,k.useRef)(null);(0,k.useImperativeHandle)(_,()=>({focusSearch:()=>ce.current?.focus()}),[]),(0,k.useEffect)(()=>{a&&requestAnimationFrame(()=>ce.current?.focus())},[a]);let le=iw({queryKey:[...aT,x],queryFn:({pageParam:e})=>xE(x,e),initialPageParam:``,getNextPageParam:e=>e.next_cursor??void 0,enabled:t}),ue=hn({queryKey:Pt,queryFn:It,refetchInterval:3e4,staleTime:Nt}),de=(0,k.useMemo)(()=>le.data?.pages.flatMap(e=>e.items)??[],[le.data]),pe=(0,k.useMemo)(()=>OE(de),[de]),T=hn({queryKey:[`telemetry-schema`,`1h`],queryFn:()=>oT(`/api/telemetry/schema?window=1h`),enabled:t&&!!x&&!!g,staleTime:6e4}),me=(0,k.useMemo)(()=>{if(!x)return[];let e=x.toLowerCase();return(T.data?.services??[]).map(e=>e.value).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[T.data,x]),he=(0,k.useMemo)(()=>{let e=ue.data??[],t=x.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[ue.data,x]);function ge(e){ae(``),re(e.title),S(e)}async function _e(){if(ee&&ne.trim()){se(!0),ae(``);try{let e=await Wt(`/api/agent/threads/${encodeURIComponent(ee.id)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:ne.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await v.invalidateQueries({queryKey:aT}),S(null)}catch(e){ae(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{se(!1)}}}async function ve(){if(C){se(!0),ae(``);try{let e=await Wt(`/api/agent/threads/${encodeURIComponent(C.id)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=C.id;w(null),await v.invalidateQueries({queryKey:aT}),await v.invalidateQueries({queryKey:Pt}),l(t)}catch(e){ae(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{se(!1)}}}return e?(0,A.jsxs)(te,{gap:4,component:`nav`,"aria-label":`Navigation`,children:[t&&(0,A.jsx)(Ne,{variant:`subtle`,color:`gray`,size:46,"aria-label":`New chat`,title:`New chat`,onClick:o,children:(0,A.jsx)(Ww,{size:18})}),t&&(0,A.jsxs)(Ot,{position:`right-start`,withinPortal:!0,shadow:`md`,children:[(0,A.jsx)(Ot.Target,{children:(0,A.jsx)(Ne,{variant:`subtle`,color:`gray`,size:46,"aria-label":`Chats`,title:`Chats`,className:`rail-row`,"data-active":!!n||void 0,children:(0,A.jsx)(Ow,{size:18})})}),(0,A.jsxs)(Ot.Dropdown,{maw:280,children:[(0,A.jsx)(Ot.Label,{children:`Recent chats`}),le.isPending?(0,A.jsx)(Ot.Item,{disabled:!0,children:`Loading chats…`}):le.isError?(0,A.jsx)(Ot.Item,{onClick:()=>void le.refetch(),children:`Chats could not be loaded. Retry`}):de.length===0&&(0,A.jsx)(Ot.Item,{disabled:!0,children:`No chats yet`}),de.slice(0,10).map(e=>(0,A.jsx)(Ot.Item,{"aria-current":e.id===n?`page`:void 0,fw:e.id===n?600:void 0,onClick:()=>s(e.id),children:(0,A.jsx)(D,{size:`sm`,truncate:!0,children:e.title||`Untitled chat`})},e.id))]})]}),bE.map(({path:e,label:t,Icon:n})=>(0,A.jsx)(Ne,{component:`a`,href:e,title:t,"aria-label":t,"aria-current":i===e||i?.startsWith(`${e}/`)?`page`:void 0,className:`rail-row`,"data-active":i===e||i?.startsWith(`${e}/`)||void 0,variant:`subtle`,color:`gray`,size:46,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),h(e))},children:(0,A.jsx)(n,{size:18})},e)),(0,A.jsxs)(Ot,{position:`right-start`,withinPortal:!0,shadow:`md`,children:[(0,A.jsx)(Ot.Target,{children:(0,A.jsx)(Ne,{variant:`subtle`,color:`gray`,size:46,"aria-label":`Dashboards`,title:`Dashboards`,className:`rail-row`,"data-active":!!r||void 0,children:(0,A.jsx)(eT,{size:18})})}),(0,A.jsxs)(Ot.Dropdown,{maw:280,children:[(0,A.jsx)(Ot.Label,{children:`Dashboards`}),ue.isPending&&(0,A.jsx)(Ot.Item,{disabled:!0,children:`Loading dashboards…`}),ue.isError&&(0,A.jsx)(Ot.Item,{onClick:()=>void ue.refetch(),children:`Dashboards could not be loaded. Retry`}),(ue.data??[]).map(e=>(0,A.jsx)(Ot.Item,{"aria-current":e.id===r?`page`:void 0,fw:e.id===r?600:void 0,onClick:()=>d(e.id),children:(0,A.jsx)(D,{size:`sm`,truncate:!0,children:e.name})},e.id)),ue.data?.length?(0,A.jsx)(Ot.Divider,{}):null,(0,A.jsx)(Ot.Item,{leftSection:(0,A.jsx)(Ww,{size:14}),onClick:p,children:`New dashboard`})]})]})]}):(0,A.jsxs)(te,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[t&&(0,A.jsx)(we,{leftSection:(0,A.jsx)(Ww,{size:16,weight:`bold`}),onClick:o,children:`New chat`}),(0,A.jsx)(O,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,A.jsxs)(te,{gap:`lg`,pb:`sm`,children:[t&&(0,A.jsxs)(te,{gap:4,children:[(0,A.jsx)(CE,{children:`Chats`}),le.isLoading&&(0,A.jsx)(fe,{state:`loading`,rows:3}),le.isError&&(0,A.jsx)(fe,{state:`error`,error:{message:`Chats could not be loaded.`,onRetry:()=>void le.refetch()}}),!le.isLoading&&!le.isError&&de.length===0&&(0,A.jsx)(D,{size:`xs`,c:`dimmed`,px:`sm`,children:x?`No matching chats. Try another name.`:`No chats yet. Start one above.`}),pe.map(e=>(0,A.jsxs)(te,{gap:2,children:[pe.length>1&&(0,A.jsx)(D,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,A.jsx)(wE,{thread:e,active:(i?i.startsWith(`/chat/`):!r)&&e.id===n,onSelect:()=>s(e.id),onRename:()=>ge(e),onDelete:()=>{ae(``),w(e)}},e.id))]},e.label)),le.hasNextPage&&(0,A.jsx)(we,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:le.isFetchingNextPage,onClick:()=>void le.fetchNextPage(),children:`See all`})]}),t&&x&&g&&T.isLoading&&(0,A.jsx)(fe,{state:`loading`,rows:3}),t&&x&&g&&(T.isSuccess||T.isError)&&(0,A.jsxs)(te,{gap:4,children:[(0,A.jsx)(CE,{children:`Services`}),T.isError&&(0,A.jsx)(D,{c:`dimmed`,size:`sm`,px:`sm`,children:`Services could not be searched`}),T.isSuccess&&me.length===0&&(0,A.jsx)(fe,{state:`empty`,variant:`inline`,empty:{title:`No matching services`,description:`Try a different service name.`,action:(0,A.jsx)(we,{variant:`subtle`,size:`compact-xs`,onClick:()=>b(``),children:`Clear search`})}}),me.map(e=>(0,A.jsx)(Ve,{className:`rail-row`,p:`sm`,onClick:()=>g(e),children:(0,A.jsx)(D,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,A.jsx)(te,{gap:0,children:bE.map(({path:e,label:t,Icon:n})=>{let r=i===e;return(0,A.jsx)(Ve,{component:`a`,href:e,className:`rail-row`,"data-active":r||void 0,"aria-current":r?`page`:void 0,p:`sm`,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),h(e))},children:(0,A.jsxs)(m,{gap:`xs`,wrap:`nowrap`,children:[(0,A.jsx)(n,{size:16}),(0,A.jsx)(D,{size:`sm`,fw:r?600:500,children:t})]})},e)})}),(0,A.jsxs)(te,{gap:4,children:[(0,A.jsx)(CE,{children:`Dashboards`}),ue.isLoading&&(0,A.jsx)(fe,{state:`loading`,rows:3}),ue.isError&&(0,A.jsx)(Le,{tone:`danger`,children:`Dashboards could not be loaded.`}),!ue.isLoading&&!ue.isError&&x&&he.length===0&&(0,A.jsx)(fe,{state:`empty`,variant:`inline`,empty:{title:`No matching dashboards`,description:`Try a different dashboard name.`,action:(0,A.jsx)(we,{variant:`subtle`,size:`compact-xs`,onClick:()=>b(``),children:`Clear search`})}}),he.map(e=>{let n=(!i||i.startsWith(`/dashboards`))&&e.id===r;return(0,A.jsxs)(te,{gap:0,children:[(0,A.jsx)(Ve,{component:`a`,href:`/dashboards/${encodeURIComponent(e.id)}`,className:`rail-row`,"data-active":n||void 0,"aria-current":n?`page`:void 0,p:`sm`,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),d(e.id))},children:(0,A.jsxs)(m,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,A.jsxs)(m,{gap:`xs`,wrap:`nowrap`,style:{minWidth:0,flex:1},children:[(0,A.jsx)(eT,{size:16,style:{flexShrink:0}}),(0,A.jsx)(D,{size:`sm`,fw:n?600:500,truncate:!0,title:e.name,children:e.name})]}),e.is_default&&(0,A.jsx)(Bi,{label:`Default`,children:(0,A.jsx)(c,{size:16,variant:`light`,color:`gray`,role:`img`,"aria-label":`Default`,style:{flexShrink:0},children:(0,A.jsx)(nT,{size:12,weight:`fill`,"aria-hidden":`true`})})})]})}),t&&e.origin&&(0,A.jsx)(Ve,{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(),s(e.origin.thread_id))},children:(0,A.jsxs)(D,{size:`xs`,c:`dimmed`,lineClamp:2,title:`Built from: ${e.origin.request_excerpt}`,children:[`Built from: `,e.origin.request_excerpt]})})]},e.id)}),(0,A.jsx)(we,{variant:`subtle`,color:`gray`,size:`sm`,px:`sm`,justify:`flex-start`,leftSection:(0,A.jsx)(Ww,{size:14}),onClick:p,children:`New dashboard`}),t&&(0,A.jsx)(we,{variant:`subtle`,color:`gray`,size:`sm`,px:`sm`,justify:`flex-start`,leftSection:(0,A.jsx)(Qw,{size:14,weight:`fill`}),onClick:f,children:`Create with AI`})]})]})}),(0,A.jsx)(Ge,{ref:ce,value:y,onChange:e=>b(e.currentTarget.value),leftSection:(0,A.jsx)(Iw,{size:15}),rightSection:(0,A.jsx)(Ei,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,A.jsx)(u,{opened:ee!==null,onClose:()=>!oe&&S(null),title:`Rename chat`,centered:!0,children:(0,A.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),_e()},children:(0,A.jsxs)(te,{children:[(0,A.jsx)(Ge,{label:`Name`,value:ne,onChange:e=>re(e.currentTarget.value),maxLength:120,autoFocus:!0}),ie&&(0,A.jsx)(Le,{tone:`danger`,children:ie}),(0,A.jsxs)(m,{justify:`flex-end`,children:[(0,A.jsx)(we,{variant:`default`,onClick:()=>S(null),disabled:oe,children:`Cancel`}),(0,A.jsx)(we,{type:`submit`,loading:oe,disabled:!ne.trim(),children:`Save`})]})]})})}),(0,A.jsxs)(He,{opened:C!==null,onClose:()=>w(null),title:`Delete chat?`,confirmLabel:`Delete chat`,tone:`danger`,pending:oe?`confirm`:null,error:ie||void 0,onConfirm:()=>void ve(),children:[`This permanently removes `,(0,A.jsx)(D,{span:!0,ff:`monospace`,children:C?.title}),` and its saved messages.`]})]})}function CE({children:e}){return(0,A.jsx)(D,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function wE({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,A.jsx)(w,{"data-active":t||void 0,className:`rail-row`,children:(0,A.jsxs)(m,{gap:2,wrap:`nowrap`,children:[(0,A.jsx)(Ve,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,A.jsxs)(te,{gap:0,pl:24,style:{position:`relative`},children:[(0,A.jsx)(Ow,{size:16,style:{position:`absolute`,left:0,top:2}}),(0,A.jsx)(D,{size:`sm`,fw:t?600:500,truncate:!0,title:e.title,children:e.title}),(0,A.jsx)(D,{c:`dimmed`,size:`xs`,ff:`monospace`,children:kE(e.updated_at)})]})}),(0,A.jsxs)(Ot,{position:`bottom-end`,withinPortal:!0,children:[(0,A.jsx)(Ot.Target,{children:(0,A.jsx)(Ne,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,A.jsx)(jt,{size:18,weight:`bold`})})}),(0,A.jsxs)(Ot.Dropdown,{children:[(0,A.jsx)(Ot.Item,{leftSection:(0,A.jsx)(Ct,{size:15}),onClick:r,children:`Rename`}),(0,A.jsx)(Ot.Item,{color:`bad`,leftSection:(0,A.jsx)(ht,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function TE(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function EE(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var DE=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function OE(e){let t=EE(new Date),n=new Map;for(let r of e){let e=Math.floor((t-EE(TE(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 DE.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function kE(e){return yE(TE(e).valueOf())}var AE=(0,k.lazy)(()=>st(()=>import(`./new-dashboard-D58ui2mw.js`).then(e=>({default:e.NewDashboard})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])));function jE({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=OT(),s=$e(),c=Qn({select:e=>e.location.pathname}),{dashboardId:l}=ut({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=tr(!1),[p,h]=(0,k.useState)(!1),[g,_]=(0,k.useState)(!1),[v,y]=(0,k.useState)(``),[b,x]=(0,k.useState)(!1),ee=(0,k.useRef)(null),S=(0,k.useRef)(null),C=KT(),te=he(`(max-width: 62em)`),ne=he(`(max-width: 48em)`),re=(0,k.useRef)(te),ie=()=>{te?(_(!0),f.open()):(h(!1),requestAnimationFrame(()=>ee.current?.focusSearch()))};re.current=te,(0,k.useEffect)(()=>{f.close()},[c]),(0,k.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),re.current?(_(!0),f.open()):(h(!1),requestAnimationFrame(()=>ee.current?.focusSearch())))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let ae={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,activePath:c,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{}}),onCreateDashboard:()=>o(kT),onNewDashboard:()=>{C.remember(re.current?S.current:document.activeElement),f.close(),x(!0)},onNavigate:e=>void s({to:e}),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)},oe=()=>{x(!1),C.restore()};return(0,A.jsxs)(li,{header:{height:56},navbar:{width:p?56:248,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,A.jsx)(`a`,{className:`skip-link`,href:`#main`,children:`Skip to content`}),(0,A.jsx)(li.Header,{children:(0,A.jsxs)(m,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,A.jsxs)(m,{gap:`sm`,wrap:`nowrap`,children:[(0,A.jsx)(Ci,{ref:S,hiddenFrom:`md`,opened:d,"aria-expanded":d,onClick:()=>{_(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,A.jsx)(Ne,{visibleFrom:`md`,variant:`subtle`,color:`gray`,"aria-label":p?`Expand navigation`:`Collapse navigation`,"aria-expanded":!p,onClick:()=>h(e=>!e),children:(0,A.jsx)(Jw,{size:18})}),(0,A.jsx)(Be,{size:`small`})]}),ne?(0,A.jsx)(Ne,{variant:`default`,size:`lg`,"aria-label":`Search`,onClick:ie,children:(0,A.jsx)(Iw,{size:16})}):(0,A.jsx)(we,{variant:`default`,color:`gray`,leftSection:(0,A.jsx)(Iw,{size:16}),onClick:ie,children:`Search · ⌘K`}),(0,A.jsx)(w,{id:`shell-time-range`,visibleFrom:`sm`}),(0,A.jsxs)(m,{gap:`xs`,wrap:`nowrap`,children:[(0,A.jsx)($T,{}),(0,A.jsx)(GT,{}),(0,A.jsx)(ME,{onError:y})]})]})}),(0,A.jsx)(li.Navbar,{p:p?4:`sm`,children:(0,A.jsx)(SE,{ref:ee,...ae,collapsed:p})}),(0,A.jsx)(gt,{opened:d,onClose:f.close,returnFocus:!b,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,A.jsx)(Be,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,A.jsx)(SE,{...ae,autoFocusSearch:d&&g})}),(0,A.jsxs)(li.Main,{id:`main`,tabIndex:-1,children:[v&&(0,A.jsx)(Le,{tone:`danger`,onDismiss:()=>y(``),children:v}),e]}),b&&(0,A.jsx)(k.Suspense,{fallback:null,children:(0,A.jsx)(AE,{onClose:oe,onCreated:e=>{x(!1),s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{}})}})})]})}function ME({onError:e}){let t=$e(),n=Jt(),r=(n.display_name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,A.jsxs)(Ot,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,A.jsx)(Ot.Target,{children:(0,A.jsx)(Ne,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`${r} account menu`,children:(0,A.jsx)(bi,{size:26,radius:`xl`,color:`gray`,children:r})})}),(0,A.jsxs)(Ot.Dropdown,{children:[(0,A.jsx)(Ot.Label,{children:n.email||`Signed in`}),(0,A.jsx)(Ot.Item,{leftSection:(0,A.jsx)(Hw,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,A.jsx)(Ot.Divider,{}),(0,A.jsx)(Ot.Item,{leftSection:(0,A.jsx)(Xw,{size:15}),onClick:()=>void qt().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function NE(){let{agent_available:e}=Kt(),t=$e(),n=Zt(),{threadId:r}=ut({strict:!1}),[i,a]=(0,k.useState)(WT),o=(0,k.useRef)(new Set),s=r??i,[c,l]=(0,k.useState)([]),[u,d]=(0,k.useState)({}),[f,p]=(0,k.useState)(``),[m,h]=(0,k.useState)(!1),[g,_]=(0,k.useState)(!1),[v,y]=(0,k.useState)(``),[b,x]=(0,k.useState)(!1),ee=(0,k.useRef)(!1),[S,C]=(0,k.useState)(``),[te,w]=(0,k.useState)(``),[ne,re]=(0,k.useState)(0),ie=(0,k.useRef)(null),ae=(0,k.useRef)({}),oe=(0,k.useRef)(null),se=(0,k.useRef)(new Map),ce=(0,k.useMemo)(()=>new XC({url:`/api/agent/runs`,threadId:s,fetch:(e,t)=>Wt(e,t)}),[s]),le=!e||f===s;function ue(){se.current.clear(),y(``)}function de(e){return ee.current||e instanceof Error&&e.name===`AbortError`}(0,k.useEffect)(()=>{let t=!0;if(l([]),ae.current={},d({}),p(``),h(!1),_(!1),ee.current=!1,x(!1),ue(),w(``),!e){p(s);return}!r||o.current.has(s)?(ce.setMessages([]),p(s)):Wt(`/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}ce.setMessages(e.messages??[]),l(e.messages??[]),p(s)}}).catch(()=>{t&&(ie.current=null,w(`This chat could not be restored. Start a new chat or try again.`))});let i=ce.subscribe({onMessagesChanged:({messages:e})=>l([...e]),onRunInitialized:()=>{ee.current=!1,x(!1),_(!0),w(``)},onTextMessageContentEvent:({event:e})=>{e.delta&&y(``)},onToolCallStartEvent:({event:e})=>{se.current.set(e.toolCallId,jT(e.toolCallName)),y(jT(e.toolCallName))},onToolCallResultEvent:({event:e,messages:t})=>{se.current.delete(e.toolCallId),y([...se.current.values()].at(-1)??`Analyzing your system`);let r=mT(e.toolCallId,e.content,t);r&&(n.invalidateQueries({queryKey:Pt}),n.invalidateQueries({queryKey:[`dashboard`,r.id]}),n.invalidateQueries({queryKey:[`dashboard-versions`,r.id]}))},onRunErrorEvent:({event:e})=>{e.code===`abort`||ee.current?(w(``),x(!0)):(console.warn(`Agent run error`,e.code),w(NT(e.code))),_(!1),ue()},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),ue(),o.current.delete(s),n.invalidateQueries({queryKey:aT})},onRunFailed:e=>{de(e.error)?(w(``),x(!0)):(console.error(`Agent run failed`,e),w(NT())),_(!1),ue(),o.current.delete(s),n.invalidateQueries({queryKey:aT})}});return()=>{t=!1,i.unsubscribe(),ce.abortRun()}},[ce,e,n,ne,s]),(0,k.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(()=>oe.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>oe.current?.focus()))),e.key===`Escape`&&n===oe.current&&(C(``),oe.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function fe(){_(!0),w(``);try{let{context:e=[],...t}=ae.current;await ce.runAgent({context:e,forwardedProps:t})}catch(e){de(e)?(w(``),x(!0)):(console.error(`Agent run failed`,e),w(NT())),_(!1),ue(),o.current.delete(s)}}async function pe(n,i){let a=n.trim();if(!e||!a||g||!le||m)return;ae.current={...i},r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let c={id:WT(),role:`user`,content:a};ce.addMessage(c),l([...ce.messages]),d(e=>({...e,[c.id]:Date.now()})),C(``),await fe()}(0,k.useEffect)(()=>{let e=ie.current;le&&r&&e&&(ie.current=null,pe(e.text,e.options))},[le,r,s]);function T(e){e.preventDefault(),pe(S)}function me(){ee.current=!0,w(``),x(!0),ce.abortRun(),_(!1),ue(),o.current.delete(s)}function he(){!g&&ce.messages.some(e=>e.role===`user`)&&fe()}function ge(n,r){if(!e)return;let i=WT();o.current.add(i),ie.current=n?{text:n,options:{...r}}:null,t({to:`/chat/$threadId`,params:{threadId:i}})}function _e(){ce.abortRun(),ie.current=null,ae.current={},a(WT()),t({to:`/chat`})}function ve(e){ie.current=null,ae.current={},t({to:`/chat/$threadId`,params:{threadId:e}})}function ye(){re(e=>e+1)}return(0,A.jsx)(DT.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:le,running:g,activity:v,stopped:b,input:S,setInput:C,error:te,inputRef:oe,send:pe,submit:T,stop:me,retry:he,reloadThread:ye,openChat:ge,newThread:_e,selectThread:ve},children:(0,A.jsx)(jE,{children:(0,A.jsx)(Hn,{})})})}function PE(){let e=(0,k.useMemo)(()=>new rw,[]);return(0,A.jsx)(vn,{client:e,children:(0,A.jsx)(Yt,{children:(0,A.jsx)(NE,{})})})}var FE=ft({component:PE,notFoundComponent:()=>(0,A.jsx)(et,{to:`/`,replace:!0})}),IE=dt(`/`)({component:pt(()=>st(()=>import(`./routes-D2AdaqvY.js`),__vite__mapDeps([21,1,7])),`component`)}),LE=dt(`/alerts`)({component:pt(()=>st(()=>import(`./alerts-CYKuszTJ.js`),__vite__mapDeps([22,1,2,7,3,4,5,6,17,13,14,23,8,24,18,16,20])),`component`)}),RE=dt(`/explore`)({component:pt(()=>st(()=>import(`./explore-D4KpDh3K.js`),__vite__mapDeps([25,1,7,18,3,2,4,5,6,9,10,11,12,13,14,8,15,16,17,19])),`component`),validateSearch:e=>bn(xn(e))}),zE=dt(`/logs`)({component:pt(()=>st(()=>import(`./logs-DQVfH3k6.js`),__vite__mapDeps([26,1,7,18,3,2,4,5,6,27,10,11,12,13,14,8,15,16,17,19])),`component`),validateSearch:e=>bn(xn(e))}),BE=dt(`/settings`)({component:pt(()=>st(()=>import(`./settings-_0QC4d6a.js`),__vite__mapDeps([28,29,1,2,12,6,7,8,24,16])),`component`)}),VE=dt(`/traces`)({component:pt(()=>st(()=>import(`./traces-DQY6WBcG.js`),__vite__mapDeps([30,1,7,18,3,2,4,5,6,27,10,11,12,13,14,8,15,16,17,19])),`component`),validateSearch:e=>bn(xn(e))}),HE=dt(`/chat/`)({component:pt(()=>st(()=>import(`./chat.index-D5uvUdcn.js`),__vite__mapDeps([31,32,1,2,33,13,5,23,15,34])),`component`)}),UE=dt(`/chat/$threadId`)({component:pt(()=>st(()=>import(`./chat._threadId-D5uvUdcn.js`),__vite__mapDeps([35,32,1,2,33,13,5,23,15,34])),`component`)}),WE=dt(`/dashboards/`)({component:pt(()=>st(()=>import(`./dashboards.index-N7UkPeK5.js`),__vite__mapDeps([36,1,7,3,2,4,5,6,37,33,11,10,12,13,14,8,15,16,24,34])),`component`),validateSearch:e=>Ft(At(e))}),GE=dt(`/dashboards/$dashboardId`)({component:pt(()=>st(()=>import(`./dashboards._dashboardId-C_KLDd8s.js`),__vite__mapDeps([38,1,7,3,2,4,5,6,37,33,11,10,12,13,14,8,15,16,24,34])),`component`),validateSearch:e=>Ft(At(e))}),KE=dt(`/settings_/ingest`)({component:pt(()=>st(()=>import(`./settings_.ingest-7LDcHtKJ.js`),__vite__mapDeps([39,29,1,2,12,6,7,8,24,16])),`component`)}),qE=IE.update({id:`/`,path:`/`,getParentRoute:()=>FE}),JE=LE.update({id:`/alerts`,path:`/alerts`,getParentRoute:()=>FE}),YE=RE.update({id:`/explore`,path:`/explore`,getParentRoute:()=>FE}),XE=zE.update({id:`/logs`,path:`/logs`,getParentRoute:()=>FE}),ZE=BE.update({id:`/settings`,path:`/settings`,getParentRoute:()=>FE}),QE=VE.update({id:`/traces`,path:`/traces`,getParentRoute:()=>FE}),$E=HE.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>FE}),eD=UE.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>FE}),tD=WE.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>FE}),nD={IndexRoute:qE,AlertsRoute:JE,ExploreRoute:YE,LogsRoute:XE,SettingsRoute:ZE,TracesRoute:QE,ChatThreadIdRoute:eD,DashboardsDashboardIdRoute:GE.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>FE}),SettingsIngestRoute:KE.update({id:`/settings_/ingest`,path:`/settings/ingest`,getParentRoute:()=>FE}),ChatIndexRoute:$E,DashboardsIndexRoute:tD},rD=Jn({routeTree:FE._addFileChildren(nD)._addFileTypes(),parseSearch:kt,stringifySearch:Mt,defaultPreload:`intent`,scrollRestoration:!0});(0,Ji.createRoot)(document.getElementById(`root`)).render((0,A.jsx)(k.StrictMode,{children:(0,A.jsx)(xr,{theme:Tt,defaultColorScheme:`auto`,cssVariablesResolver:St,children:(0,A.jsx)(Zn,{router:rD})})}));export{Og as $,$C as A,Ag as B,wT as C,cT as D,sT as E,_g as F,G,Mg as H,hg as I,Eg as J,Sg as K,W as L,Rh as M,lg as N,oT as O,Ig as P,H as Q,wg as R,vT as S,lT as T,o_ as U,Uh as V,K as W,d_ as X,Vg as Y,Pg as Z,KT as _,RE as a,up as at,PT as b,_E as c,Bi as ct,yE as d,bg as et,sE as f,ZT as g,pE as h,zE as i,mp as it,zh as j,Ww as k,fE as l,Ei as lt,hE as m,WE as n,Sh as nt,gE as o,lp as ot,dE as p,ug as q,VE as r,gh as rt,uE as s,Xc as st,GE as t,qh as tt,vE as u,cr as ut,kT as v,bT as w,OT as x,MT as y,pg as z}; \ No newline at end of file diff --git a/internal/ui/dist/assets/lazyRouteComponent-DfXsrbdH.js b/internal/ui/dist/assets/lazyRouteComponent-DiWTNBZT.js similarity index 98% rename from internal/ui/dist/assets/lazyRouteComponent-DfXsrbdH.js rename to internal/ui/dist/assets/lazyRouteComponent-DiWTNBZT.js index 42c0840ce..a5b60a7ba 100644 --- a/internal/ui/dist/assets/lazyRouteComponent-DfXsrbdH.js +++ b/internal/ui/dist/assets/lazyRouteComponent-DiWTNBZT.js @@ -1 +1 @@ -import{i as e,r as t,s as n,t as r}from"./useRouter-ByJ6_rwb.js";import{n as i,r as a}from"./useNavigate-B1zgPEUp.js";import{_ as o,f as s,h as c,i as l,l as u,m as d,n as f,p,r as m,u as h,v as g}from"./preload-helper-DJZNfKNH.js";import{h as _}from"./theme-B_iWg-Ot.js";var v=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e,this._branch=void 0;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=h:this.parentRoute||c();let r=n?h:t?.path;r&&r!==`/`&&(r=p(r));let i=t?.id||r,a=n?h:s((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:s(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=d(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>u({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},y=class extends v{constructor(e){super(e)}},b=n(e(),1),x={};function S(e,t){let n=b.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=g(n.current,i):i}}function C(e){let t=r(),n=b.useContext(e.from?m:l),i=e.from??n,a=t.stores.getMatchStore(i),o=S(e,t),s=_(a,e=>e?o(e):x);if(s!==x)return s;(e.shouldThrow??!0)&&c()}function w(e){return C({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function T(e){let{select:t,...n}=e;return C({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function E(e){return C({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function D(e){return C({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function O(e){return C({...e,select:t=>e.select?e.select(t.context):t.context})}var k=t(),A=class extends v{constructor(e){super(e),this.useMatch=e=>C({...e,from:this.id}),this.useRouteContext=e=>O({...e,from:this.id}),this.useSearch=e=>D({...e,from:this.id}),this.useParams=e=>E({...e,from:this.id}),this.useLoaderDeps=e=>T({...e,from:this.id}),this.useLoaderData=e=>w({...e,from:this.id}),this.useNavigate=()=>i({from:this.fullPath}),this.Link=b.forwardRef((e,t)=>(0,k.jsx)(f,{ref:t,from:this.fullPath,...e}))}};function j(e){return new A(e)}var M=class extends y{constructor(e){super(e),this.useMatch=e=>C({...e,from:this.id}),this.useRouteContext=e=>O({...e,from:this.id}),this.useSearch=e=>D({...e,from:this.id}),this.useParams=e=>E({...e,from:this.id}),this.useLoaderDeps=e=>T({...e,from:this.id}),this.useLoaderData=e=>w({...e,from:this.id}),this.useNavigate=()=>i({from:this.fullPath}),this.Link=b.forwardRef((e,t)=>(0,k.jsx)(f,{ref:t,from:this.fullPath,...e}))}};function N(e){return new M(e)}function P(e){return e=>{let t=j(e);return t.isRoot=!1,t}}function F(e,t){let n,r,i,s=()=>(n||=(i=void 0,e().then(e=>{n=void 0,c.preload=void 0,r=e[t??`default`]}).catch(e=>{n=void 0,i=e})),n),c=function(e){if(i){if(o(i)&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${i.message}`;if(!sessionStorage.getItem(e))throw sessionStorage.setItem(e,`1`),window.location.reload(),new Promise(()=>{})}throw i}if(!r){if(a)a(s());else throw s()}return b.createElement(r,e)};return c.preload=s,c}export{S as a,E as i,P as n,N as r,F as t}; \ No newline at end of file +import{i as e,r as t,s as n,t as r}from"./useRouter-ByJ6_rwb.js";import{n as i,r as a}from"./useNavigate-B1zgPEUp.js";import{_ as o,f as s,h as c,i as l,l as u,m as d,n as f,p,r as m,u as h,v as g}from"./preload-helper-DJZNfKNH.js";import{h as _}from"./theme-DXTVNXHm.js";var v=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e,this._branch=void 0;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=h:this.parentRoute||c();let r=n?h:t?.path;r&&r!==`/`&&(r=p(r));let i=t?.id||r,a=n?h:s((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:s(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=d(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>u({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},y=class extends v{constructor(e){super(e)}},b=n(e(),1),x={};function S(e,t){let n=b.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=g(n.current,i):i}}function C(e){let t=r(),n=b.useContext(e.from?m:l),i=e.from??n,a=t.stores.getMatchStore(i),o=S(e,t),s=_(a,e=>e?o(e):x);if(s!==x)return s;(e.shouldThrow??!0)&&c()}function w(e){return C({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function T(e){let{select:t,...n}=e;return C({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function E(e){return C({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function D(e){return C({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function O(e){return C({...e,select:t=>e.select?e.select(t.context):t.context})}var k=t(),A=class extends v{constructor(e){super(e),this.useMatch=e=>C({...e,from:this.id}),this.useRouteContext=e=>O({...e,from:this.id}),this.useSearch=e=>D({...e,from:this.id}),this.useParams=e=>E({...e,from:this.id}),this.useLoaderDeps=e=>T({...e,from:this.id}),this.useLoaderData=e=>w({...e,from:this.id}),this.useNavigate=()=>i({from:this.fullPath}),this.Link=b.forwardRef((e,t)=>(0,k.jsx)(f,{ref:t,from:this.fullPath,...e}))}};function j(e){return new A(e)}var M=class extends y{constructor(e){super(e),this.useMatch=e=>C({...e,from:this.id}),this.useRouteContext=e=>O({...e,from:this.id}),this.useSearch=e=>D({...e,from:this.id}),this.useParams=e=>E({...e,from:this.id}),this.useLoaderDeps=e=>T({...e,from:this.id}),this.useLoaderData=e=>w({...e,from:this.id}),this.useNavigate=()=>i({from:this.fullPath}),this.Link=b.forwardRef((e,t)=>(0,k.jsx)(f,{ref:t,from:this.fullPath,...e}))}};function N(e){return new M(e)}function P(e){return e=>{let t=j(e);return t.isRoot=!1,t}}function F(e,t){let n,r,i,s=()=>(n||=(i=void 0,e().then(e=>{n=void 0,c.preload=void 0,r=e[t??`default`]}).catch(e=>{n=void 0,i=e})),n),c=function(e){if(i){if(o(i)&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${i.message}`;if(!sessionStorage.getItem(e))throw sessionStorage.setItem(e,`1`),window.location.reload(),new Promise(()=>{})}throw i}if(!r){if(a)a(s());else throw s()}return b.createElement(r,e)};return c.preload=s,c}export{S as a,E as i,P as n,N as r,F as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/lib-8mi5olAL.js b/internal/ui/dist/assets/lib-BLIvzI-_.js similarity index 99% rename from internal/ui/dist/assets/lib-8mi5olAL.js rename to internal/ui/dist/assets/lib-BLIvzI-_.js index 4e5553819..b6e6d42f0 100644 --- a/internal/ui/dist/assets/lib-8mi5olAL.js +++ b/internal/ui/dist/assets/lib-BLIvzI-_.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{x as a}from"./brand-CCQ0JT0F.js";var o=i(t(),1),s=new Map([[`bold`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`}))]]),c=o.forwardRef((e,t)=>o.createElement(a,{ref:t,...e,weights:s}));c.displayName=`CaretDownIcon`;var l=c;function u(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var d=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,f=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,p={};function m(e,t){return((t||p).jsx?f:d).test(e)}var h=/[ \t\n\f\r]/g;function g(e){return typeof e==`object`?e.type===`text`&&_(e.value):_(e)}function _(e){return e.replace(h,``)===``}var v=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};v.prototype.normal={},v.prototype.property={},v.prototype.space=void 0;function y(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new v(n,r,t)}function b(e){return e.toLowerCase()}var x=class{constructor(e,t){this.attribute=t,this.property=e}};x.prototype.attribute=``,x.prototype.booleanish=!1,x.prototype.boolean=!1,x.prototype.commaOrSpaceSeparated=!1,x.prototype.commaSeparated=!1,x.prototype.defined=!1,x.prototype.mustUseProperty=!1,x.prototype.number=!1,x.prototype.overloadedBoolean=!1,x.prototype.property=``,x.prototype.spaceSeparated=!1,x.prototype.space=void 0;var S=n({boolean:()=>w,booleanish:()=>T,commaOrSpaceSeparated:()=>A,commaSeparated:()=>k,number:()=>D,overloadedBoolean:()=>E,spaceSeparated:()=>O}),C=0,w=j(),T=j(),E=j(),D=j(),O=j(),k=j(),A=j();function j(){return 2**++C}var M=Object.keys(S),N=class extends x{constructor(e,t,n,r){let i=-1;if(super(e,t),ee(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&ue.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(le,pe);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!le.test(e)){let n=e.replace(ce,fe);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=N}return new i(r,t)}function fe(e){return`-`+e.toLowerCase()}function pe(e){return e.charAt(1).toUpperCase()}var me=y([F,ne,ie,ae,oe],`html`),he=y([F,re,ie,ae,oe],`svg`);function ge(e){return e.join(` `).trim()}var _e=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{x as a}from"./brand-D6fP-cLS.js";var o=i(t(),1),s=new Map([[`bold`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`,o.createElement(o.Fragment,null,o.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`}))]]),c=o.forwardRef((e,t)=>o.createElement(a,{ref:t,...e,weights:s}));c.displayName=`CaretDownIcon`;var l=c;function u(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var d=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,f=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,p={};function m(e,t){return((t||p).jsx?f:d).test(e)}var h=/[ \t\n\f\r]/g;function g(e){return typeof e==`object`?e.type===`text`&&_(e.value):_(e)}function _(e){return e.replace(h,``)===``}var v=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};v.prototype.normal={},v.prototype.property={},v.prototype.space=void 0;function y(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new v(n,r,t)}function b(e){return e.toLowerCase()}var x=class{constructor(e,t){this.attribute=t,this.property=e}};x.prototype.attribute=``,x.prototype.booleanish=!1,x.prototype.boolean=!1,x.prototype.commaOrSpaceSeparated=!1,x.prototype.commaSeparated=!1,x.prototype.defined=!1,x.prototype.mustUseProperty=!1,x.prototype.number=!1,x.prototype.overloadedBoolean=!1,x.prototype.property=``,x.prototype.spaceSeparated=!1,x.prototype.space=void 0;var S=n({boolean:()=>w,booleanish:()=>T,commaOrSpaceSeparated:()=>A,commaSeparated:()=>k,number:()=>D,overloadedBoolean:()=>E,spaceSeparated:()=>O}),C=0,w=j(),T=j(),E=j(),D=j(),O=j(),k=j(),A=j();function j(){return 2**++C}var M=Object.keys(S),N=class extends x{constructor(e,t,n,r){let i=-1;if(super(e,t),ee(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&ue.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(le,pe);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!le.test(e)){let n=e.replace(ce,fe);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=N}return new i(r,t)}function fe(e){return`-`+e.toLowerCase()}function pe(e){return e.charAt(1).toUpperCase()}var me=y([F,ne,ie,ae,oe],`html`),he=y([F,re,ie,ae,oe],`svg`);function ge(e){return e.join(` `).trim()}var _e=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})),ve=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(_e());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}})),ye=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))}})),be=e(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(ve()),r=ye();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})),xe=Ce(`end`),Se=Ce(`start`);function Ce(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 we(e){let t=Se(e),n=xe(e);if(t&&n)return{start:t,end:n}}function Te(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?De(e.position):`start`in e||`end`in e?De(e):`line`in e||`column`in e?Ee(e):``}function Ee(e){return Oe(e&&e.line)+`:`+Oe(e&&e.column)}function De(e){return Ee(e&&e.start)+`-`+Ee(e&&e.end)}function Oe(e){return e&&typeof e==`number`?e:1}var L=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=Te(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}};L.prototype.file=``,L.prototype.name=``,L.prototype.reason=``,L.prototype.message=``,L.prototype.stack=``,L.prototype.column=void 0,L.prototype.line=void 0,L.prototype.ancestors=void 0,L.prototype.cause=void 0,L.prototype.fatal=void 0,L.prototype.place=void 0,L.prototype.ruleId=void 0,L.prototype.source=void 0;var ke=i(be(),1),Ae={}.hasOwnProperty,je=new Map,Me=/[A-Z]/g,Ne=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Pe=new Set([`td`,`th`]),Fe=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Ie(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=qe(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=Ke(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`?he:me,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Le(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Le(e,t,n){if(t.type===`element`)return Re(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return ze(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Ve(e,t,n);if(t.type===`mdxjsEsm`)return Be(e,t);if(t.type===`root`)return He(e,t,n);if(t.type===`text`)return Ue(e,t)}function Re(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=he,e.schema=i),e.ancestors.push(t);let a=$e(e,t.tagName,!1),o=Je(e,t),s=Xe(e,t);return Ne.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!g(e)})),We(e,o,a,t),Ge(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ze(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)}et(e,t.position)}function Be(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);et(e,t.position)}function Ve(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=he,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:$e(e,t.name,!0),o=Ye(e,t),s=Xe(e,t);return We(e,o,a,t),Ge(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function He(e,t,n){let r={};return Ge(r,Xe(e,t)),e.create(t,e.Fragment,r,n)}function Ue(e,t){return t.value}function We(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ge(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Ke(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 qe(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Se(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 Je(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Ae.call(t.properties,i)){let a=Ze(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Pe.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 Ye(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 et(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 et(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Xe(e,t){let n=[],r=-1,i=e.passKeys?new Map:je;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?(R(e,e.length,0,t),e):t}var ft={}.hasOwnProperty;function pt(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 B(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var V=q(/[A-Za-z]/),H=q(/[\dA-Za-z]/),_t=q(/[#-'*+\--9=?A-Z^-~]/);function vt(e){return e!==null&&(e<32||e===127)}var yt=q(/\d/),bt=q(/[\dA-Fa-f]/),xt=q(/[!-/:-@[-`{-~]/);function U(e){return e!==null&&e<-2}function W(e){return e!==null&&(e<0||e===32)}function G(e){return e===-2||e===-1||e===32}var St=q(/\p{P}|\p{S}/u),K=q(/\s/);function q(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Ct(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 J(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return G(r)?(e.enter(n),s(r)):t(r)}function s(r){return G(r)&&a++0&&G(t)?(e.enter(r),c(t)):l(t)}function c(t){return G(t)&&o=i?t(e):n(e)}}var Tt={tokenize:Et};function Et(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`),J(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 U(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Dt=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){Ot(this,e,t,n,!1)}addBefore(e,t,n){Ot(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 Ot(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 kt={tokenize:jt},At={tokenize:Mt};function jt(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 Mt(e,t,n){return J(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Nt(e){if(e===null||W(e)||K(e))return 1;if(St(e))return 2}function Pt(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};Rt(o,-a),Rt(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=z(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=z(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=z(r,Pt(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=z(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=z(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),R(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n0&&G(t)?J(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||U(t)?e.check(Zt,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||U(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`),G(t)?J(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`),G(t)?J(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||U(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var tn={name:`codeIndented`,tokenize:rn},nn={partial:!0,tokenize:an};function rn(e,t,n){return r;function r(t){return e.enter(`codeIndented`),wt(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):U(t)?e.attempt(nn,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||U(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function an(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):U(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):wt(e,t,a,`linePrefix`,4,4)(o)}function a(e){return U(e)?i(e):n(e)}}var on={name:`codeText`,previous:cn,resolve:sn,tokenize:ln};function sn(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&&dn(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),dn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),dn(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 yn(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||vt(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||U(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||W(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):U(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||U(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!G(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function xn(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):U(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),J(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||U(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 Sn(e,t){let n;return r;function r(i){return U(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):G(i)?J(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Cn={name:`definition`,tokenize:Tn},wn={partial:!0,tokenize:En};function Tn(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return bn.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=B(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 W(t)?Sn(e,l)(t):l(t)}function l(t){return yn(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(wn,d,d)(t)}function d(t){return G(t)?J(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||U(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function En(e,t,n){return r;function r(t){return W(t)?Sn(e,i)(t):n(t)}function i(t){return xn(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return G(t)?J(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||U(e)?t(e):n(e)}}var Dn={name:`hardBreakEscape`,tokenize:On};function On(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return U(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var kn={name:`headingAtx`,resolve:An,tokenize:jn};function An(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`};R(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function jn(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||W(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||U(n)?(e.exit(`atxHeading`),t(n)):G(n)?J(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||W(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Mn=`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(`.`),Nn=[`pre`,`script`,`style`,`textarea`],Pn={concrete:!0,name:`htmlFlow`,resolveTo:In,tokenize:Ln},Fn={partial:!0,tokenize:Rn};function In(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 Ln(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:F):V(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):V(a)?(e.consume(a),i=4,r.interrupt?t:F):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:F):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 V(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||W(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Nn.includes(l)?(i=1,r.interrupt?t(s):O(s)):Mn.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||H(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 G(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||V(t)?(e.consume(t),b):G(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||H(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):G(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):G(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||U(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||W(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||G(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||U(t)?O(t):G(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),I):t===63&&i===3?(e.consume(t),F):t===93&&i===5?(e.consume(t),P):U(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Fn,te,k)(t)):t===null||U(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Zt,A,te)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||U(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),F):O(t)}function N(t){return t===47?(e.consume(t),o=``,ee):O(t)}function ee(t){if(t===62){let n=o.toLowerCase();return Nn.includes(n)?(e.consume(t),I):O(t)}return V(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ee):O(t)}function P(t){return t===93?(e.consume(t),F):O(t)}function F(t){return t===62?(e.consume(t),I):t===45&&i===2?(e.consume(t),F):O(t)}function I(t){return t===null||U(t)?(e.exit(`htmlFlowData`),te(t)):(e.consume(t),I)}function te(n){return e.exit(`htmlFlow`),t(n)}}function Rn(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Vt,t,n)}}var zn={name:`htmlText`,tokenize:Bn};function Bn(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):V(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):V(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):U(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(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):U(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):U(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):U(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return V(t)?(e.consume(t),S):n(t)}function S(t){return t===45||H(t)?(e.consume(t),S):C(t)}function C(t){return U(t)?(o=C,N(t)):G(t)?(e.consume(t),C):M(t)}function w(t){return t===45||H(t)?(e.consume(t),w):t===47||t===62||W(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||V(t)?(e.consume(t),E):U(t)?(o=T,N(t)):G(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||H(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):U(t)?(o=D,N(t)):G(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):U(t)?(o=O,N(t)):G(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):U(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||W(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||W(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ee}function ee(t){return G(t)?J(e,P,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):P(t)}function P(t){return e.enter(`htmlTextData`),o(t)}}var Vn={name:`labelEnd`,resolveAll:Gn,resolveTo:Kn,tokenize:qn},Hn={tokenize:Jn},Un={tokenize:Yn},Wn={tokenize:Xn};function Gn(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(B(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(Hn,u,o?u:d)(t):t===91?e.attempt(Un,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Wn,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function Jn(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 W(t)?Sn(e,a)(t):a(t)}function a(t){return t===41?u(t):yn(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return W(t)?Sn(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?xn(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return W(t)?Sn(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 Yn(e,t,n){let r=this;return i;function i(t){return bn.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(B(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Xn(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 Zn={name:`labelStartImage`,resolveAll:Vn.resolveAll,tokenize:Qn};function Qn(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 $n={name:`labelStartLink`,resolveAll:Vn.resolveAll,tokenize:er};function er(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 tr={name:`lineEnding`,tokenize:nr};function nr(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),J(e,t,`linePrefix`)}}var rr={name:`thematicBreak`,tokenize:ir};function ir(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||U(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),G(t)?J(e,s,`whitespace`)(t):s(t))}}var Y={continuation:{tokenize:cr},exit:ur,name:`list`,tokenize:sr},ar={partial:!0,tokenize:dr},or={partial:!0,tokenize:lr};function sr(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:yt(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(rr,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 yt(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(Vt,r.interrupt?n:u,e.attempt(ar,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return G(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 cr(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Vt,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,J(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!G(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(or,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,J(e,e.attempt(Y,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function lr(e,t,n){let r=this;return J(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 ur(e){e.exit(this.containerState.type)}function dr(e,t,n){let r=this;return J(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!G(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var fr={name:`setextUnderline`,resolveTo:pr,tokenize:mr};function pr(e,t){let n=new Dt,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 mr(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`),G(t)?J(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||U(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var hr={tokenize:gr};function gr(e){let t=this,n=e.attempt(Vt,r,e.attempt(this.parser.constructs.flowInitial,i,J(e,e.attempt(this.parser.constructs.flow,i,e.attempt(mn,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 _r={resolveAll:xr()},vr=br(`string`),yr=br(`text`);function br(e){return{resolveAll:xr(e===`text`?Sr: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(;++ijr,contentInitial:()=>Tr,disable:()=>Mr,document:()=>wr,flow:()=>Dr,flowInitial:()=>Er,insideSpan:()=>Ar,string:()=>Or,text:()=>kr}),wr={42:Y,43:Y,45:Y,48:Y,49:Y,50:Y,51:Y,52:Y,53:Y,54:Y,55:Y,56:Y,57:Y,62:Ut},Tr={91:Cn},Er={[-2]:tn,[-1]:tn,32:tn},Dr={35:kn,42:rr,45:[fr,rr],60:Pn,61:fr,95:rr,96:$t,126:$t},Or={38:Yt,92:qt},kr={[-5]:tr,[-4]:tr,[-3]:tr,33:Zn,38:Yt,42:Ft,60:[zt,zn],91:$n,92:[Dn,qt],93:Vn,95:Ft,96:on},Ar={null:[Ft,_r]},jr={null:[42,95]},Mr={null:[]};function Nr(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=z(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Pt(a,l.events,l),l.events):[]}function f(e,t){return Fr(p(e),t)}function p(e){return Pr(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 Fr(e,t){let n=-1,r=[],i;for(;++n0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||Jr).call(a,void 0,e[0])}for(r.position={start:X(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:X(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++dF(e))}:typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?{value:e,label:`${e}`}:e}function I(e){return e?e.map(e=>F(e)):[]}function ee(e){return e.reduce((e,t)=>`group`in t?{...e,...ee(t.items)}:(e[`${t.value}`]=t,e),{})}var L={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`},te={error:null},R=f((e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":C(t,`combobox-chevron-size`),"--combobox-chevron-color":n?w(n,e):void 0}})),z=r(e=>{let t=a(`ComboboxChevron`,te,e),{size:n,error:r,style:i,className:s,classNames:c,styles:l,unstyled:d,vars:f,attributes:p,mod:m,...h}=t,g=o({name:`ComboboxChevron`,classes:L,props:t,style:i,className:s,classNames:c,styles:l,unstyled:d,vars:f,varsResolver:R,attributes:p,rootSelector:`chevron`});return(0,j.jsx)(u,{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,j.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`})})});z.classes=L,z.varsResolver=R,z.displayName=`@mantine/core/ComboboxChevron`;var[B,V]=_(`Combobox component was not found in tree`);function H({onMouseDown:e,onClick:t,onClear:n,...r}){return(0,j.jsx)(c.ClearButton,{tabIndex:-1,"aria-hidden":!0,...r,onMouseDown:t=>{t.preventDefault(),e?.(t)},onClick:e=>{n(),t?.(e)}})}H.displayName=`@mantine/core/ComboboxClearButton`;var U=r(e=>{let{classNames:t,styles:n,className:r,style:i,hidden:o,...s}=a(`ComboboxDropdown`,null,e),c=V();return(0,j.jsx)(E.Dropdown,{...s,role:`presentation`,"data-hidden":o||void 0,"data-floating-height":c.floatingHeight||void 0,...c.getStyles(`dropdown`,{className:r,style:i,classNames:t,styles:n})})});U.classes=L,U.displayName=`@mantine/core/ComboboxDropdown`;var ne={refProp:`ref`},W=r(e=>{let{children:t,refProp:n,ref:r}=a(`ComboboxDropdownTarget`,ne,e);if(V(),!p(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,j.jsx)(E.Target,{ref:r,refProp:n,children:t})});W.displayName=`@mantine/core/ComboboxDropdownTarget`;var G=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,...s}=a(`ComboboxEmpty`,null,e),c=V();return(0,j.jsx)(u,{...c.getStyles(`empty`,{className:n,classNames:t,styles:i,style:r}),...s})});G.classes=L,G.displayName=`@mantine/core/ComboboxEmpty`;function K({onKeyDown:e,onClick:t,withKeyboardNavigation:n,withAriaAttributes:r,withExpandedAttribute:i,targetType:a,autoComplete:o}){let s=V(),[c,l]=(0,A.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 re={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},ie=r(e=>{let{children:t,refProp:n,withKeyboardNavigation:r,withAriaAttributes:i,withExpandedAttribute:o,targetType:s,autoComplete:c,ref:u,...d}=a(`ComboboxEventsTarget`,re,e),f=l(t);if(!f)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 p=V(),m=K({targetType:s,withAriaAttributes:i,withKeyboardNavigation:r,withExpandedAttribute:o,onKeyDown:f.props.onKeyDown,onClick:f.props.onClick,autoComplete:c});return(0,A.cloneElement)(f,{...m,...d,[n]:x(u,p.store.targetRef,O(f))})});ie.displayName=`@mantine/core/ComboboxEventsTarget`;var q=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,...s}=a(`ComboboxFooter`,null,e),c=V();return(0,j.jsx)(u,{...c.getStyles(`footer`,{className:n,classNames:t,style:r,styles:i}),...s,onMouseDown:e=>{e.preventDefault()}})});q.classes=L,q.displayName=`@mantine/core/ComboboxFooter`;var J=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,children:s,label:c,id:l,...d}=a(`ComboboxGroup`,null,e),f=V(),p=v(l),m=c!=null&&c!==!1&&c!==``;return(0,j.jsxs)(u,{role:`group`,"aria-labelledby":m?p:void 0,...f.getStyles(`group`,{className:n,classNames:t,style:r,styles:i}),...d,children:[m&&(0,j.jsx)(`div`,{id:p,...f.getStyles(`groupLabel`,{classNames:t,styles:i}),children:c}),s]})});J.classes=L,J.displayName=`@mantine/core/ComboboxGroup`;var Y=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,...s}=a(`ComboboxHeader`,null,e),c=V();return(0,j.jsx)(u,{...c.getStyles(`header`,{className:n,classNames:t,style:r,styles:i}),...s,onMouseDown:e=>{e.preventDefault()}})});Y.classes=L,Y.displayName=`@mantine/core/ComboboxHeader`;function ae({value:e,valuesDivider:t=`,`,...n}){return(0,j.jsx)(`input`,{type:`hidden`,value:Array.isArray(e)?e.join(t):e?`${e}`:``,...n})}ae.displayName=`@mantine/core/ComboboxHiddenInput`;var X=r(e=>{let t=a(`ComboboxOption`,null,e),{classNames:n,className:r,style:i,styles:o,vars:s,onClick:c,id:l,active:d,onMouseDown:f,onMouseOver:p,disabled:m,selected:h,mod:g,..._}=t,v=V(),y=(0,A.useId)(),b=l||y;return(0,j.jsx)(u,{...v.getStyles(`option`,{className:r,classNames:n,styles:o,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)}})});X.classes=L,X.displayName=`@mantine/core/ComboboxOption`;var oe=r(e=>{let{classNames:t,className:n,style:r,styles:i,id:o,onMouseDown:s,labelledBy:c,...l}=a(`ComboboxOptions`,null,e),d=V(),f=v(o);return(0,A.useEffect)(()=>{d.store.setListId(f)},[f]),(0,j.jsx)(u,{...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)}})});oe.classes=L,oe.displayName=`@mantine/core/ComboboxOptions`;var se={withAriaAttributes:!0,withKeyboardNavigation:!0},ce=r(e=>{let{classNames:t,styles:n,unstyled:r,vars:i,withAriaAttributes:o,onKeyDown:s,onClick:l,withKeyboardNavigation:u,size:d,ref:f,...p}=a(`ComboboxSearch`,se,e),m=V(),h=m.getStyles(`search`),g=K({targetType:`input`,withAriaAttributes:o,withKeyboardNavigation:u,withExpandedAttribute:!1,onKeyDown:s,onClick:l,autoComplete:`off`});return(0,j.jsx)(c,{ref:x(f,m.store.searchRef),classNames:[{input:h.className},t],styles:[{input:h.style},n],size:d||m.size,...g,...p,__staticSelector:`Combobox`})});ce.classes=L,ce.displayName=`@mantine/core/ComboboxSearch`;var le={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},ue=r(e=>{let{children:t,refProp:n,withKeyboardNavigation:r,withAriaAttributes:i,withExpandedAttribute:o,targetType:s,autoComplete:c,ref:u,...d}=a(`ComboboxTarget`,le,e),f=l(t);if(!f)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 p=V(),m=K({targetType:s,withAriaAttributes:i,withKeyboardNavigation:r,withExpandedAttribute:o,onKeyDown:f.props.onKeyDown,onClick:f.props.onClick,autoComplete:c}),h=(0,A.cloneElement)(f,{...m,...d});return(0,j.jsx)(E.Target,{refProp:n,ref:x(u,p.store.targetRef),children:h})});ue.displayName=`@mantine/core/ComboboxTarget`;function de(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 fe(e,t,n){for(let n=e+1;n{s||(c(!0),i?.(e))},[c,i,s]),v=(0,A.useCallback)((e=`unknown`)=>{s&&(c(!1),r?.(e))},[c,r,s]),y=(0,A.useCallback)((e=`unknown`)=>{s?v(e):_(e)},[v,_,s]),b=(0,A.useCallback)(()=>{let e=P(f.current);M(`#${l.current} [data-combobox-selected]`,e)?.removeAttribute(`data-combobox-selected`)},[]),x=(0,A.useCallback)(e=>{let t=P(f.current),n=M(`#${l.current}`,t),r=n?N(`[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`)?(b(),r[i].setAttribute(`data-combobox-selected`,`true`),r[i].scrollIntoView({block:`nearest`,behavior:o}),r[i].id):null},[o,b]),S=(0,A.useCallback)(()=>{let e=P(f.current),t=M(`#${l.current} [data-combobox-active]`,e);if(t){let n=N(`#${l.current} [data-combobox-option]`,e).findIndex(e=>e===t);return x(n)}return x(0)},[x]),C=(0,A.useCallback)(()=>{let e=P(f.current),t=N(`#${l.current} [data-combobox-option]`,e);return x(fe(u.current,t,a))},[x,a]),w=(0,A.useCallback)(()=>{let e=P(f.current),t=N(`#${l.current} [data-combobox-option]`,e);return x(de(u.current,t,a))},[x,a]),T=(0,A.useCallback)(()=>{let e=P(f.current),t=N(`#${l.current} [data-combobox-option]`,e);return x(pe(t))},[x]),E=(0,A.useCallback)((e=`selected`,t)=>{if(typeof e==`number`){u.current=e;let n=P(f.current),r=N(`#${l.current} [data-combobox-option]`,n);t?.scrollIntoView&&r[e]?.scrollIntoView({block:`nearest`,behavior:o});return}h.current=window.setTimeout(()=>{let n=P(f.current),r=N(`#${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)},[]),D=(0,A.useCallback)(()=>{u.current=-1,b()},[b]),O=(0,A.useCallback)(()=>{let e=P(f.current);(N(`#${l.current} [data-combobox-option]`,e)?.[u.current])?.click()},[]),k=(0,A.useCallback)(e=>{l.current=e},[]),j=(0,A.useCallback)(()=>{p.current=window.setTimeout(()=>d.current?.focus(),0)},[]),F=(0,A.useCallback)(()=>{m.current=window.setTimeout(()=>f.current?.focus(),0)},[]),I=(0,A.useCallback)(()=>u.current,[]);return(0,A.useEffect)(()=>()=>{window.clearTimeout(p.current),window.clearTimeout(m.current),window.clearTimeout(h.current)},[]),{dropdownOpened:s,openDropdown:_,closeDropdown:v,toggleDropdown:y,selectedOptionIndex:u.current,getSelectedOptionIndex:I,selectOption:x,selectFirstOption:T,selectActiveOption:S,selectNextOption:C,selectPreviousOption:w,resetSelectedOption:D,updateSelectedOptionIndex:E,listId:l.current,setListId:k,clickSelectedOption:O,searchRef:d,focusSearchInput:j,targetRef:f,focusTarget:F}}var he={keepMounted:!0,keepMountedMode:`display-none`,withinPortal:!0,resetSelectionOnOptionHover:!1,width:`target`,transitionProps:{transition:`fade`,duration:0},size:`sm`},ge=f((e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":T(t),"--combobox-option-padding":C(t,`combobox-option-padding`)},dropdown:{"--combobox-padding":n===void 0?void 0:m(n),"--combobox-option-fz":T(t),"--combobox-option-padding":C(t,`combobox-option-padding`)}})),Z=e=>{let t=a(`Combobox`,he,e),{classNames:n,styles:r,unstyled:i,children:s,store:c,vars:l,onOptionSubmit:u,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=me(),C=c||S,w=o({name:h||`Combobox`,classes:L,props:t,classNames:n,styles:r,unstyled:i,attributes:_,vars:l,varsResolver:ge}),T=()=>{d?.(),C.closeDropdown()};return(0,j.jsx)(B,{value:{getStyles:w,store:C,onOptionSubmit:u,size:f,resetSelectionOnOptionHover:m,readOnly:g,floatingHeight:v},children:(0,j.jsx)(E,{opened:C.dropdownOpened,...b,middlewares:x,onChange:e=>!e&&T(),withRoles:!1,unstyled:i,children:s})})};Z.extend=e=>e,Z.classes=L,Z.varsResolver=ge,Z.displayName=`@mantine/core/Combobox`,Z.Target=ue,Z.Dropdown=U,Z.Options=oe,Z.Option=X,Z.Search=ce,Z.Empty=G,Z.Chevron=z,Z.Footer=q,Z.Header=Y,Z.EventsTarget=ie,Z.DropdownTarget=W,Z.Group=J,Z.ClearButton=H,Z.HiddenInput=ae;function _e({children:e,role:t}){let n=(0,A.use)(i);return n?(0,j.jsx)(`div`,{role:t,"aria-labelledby":n.labelId,"aria-describedby":n.describedBy,children:e}):(0,j.jsx)(j.Fragment,{children:e})}var ve={root:`m_5f75b09e`,body:`m_5f6e695e`,labelWrapper:`m_d3ea56bb`,label:`m_8ee546b8`,description:`m_328f68c0`,error:`m_8e8a99cc`},ye=ve;function be({__staticSelector:e,__stylesApiProps:t,className:n,classNames:r,styles:i,unstyled:a,children:s,label:l,description:d,id:f,disabled:p,error:m,size:h,labelPosition:g=`left`,bodyElement:_=`div`,labelElement:v=`label`,variant:y,style:b,vars:x,mod:S,attributes:w,...E}){let D=o({name:e,props:t,className:n,style:b,classes:ve,classNames:r,styles:i,unstyled:a,attributes:w}),O=d?`${f}-description`:void 0,k=m&&typeof m!=`boolean`?`${f}-error`:void 0;return(0,j.jsx)(u,{...D(`root`),__vars:{"--label-fz":T(h),"--label-lh":C(h,`label-lh`)},mod:[{"label-position":g},S],variant:y,size:h,...E,children:(0,j.jsxs)(u,{component:_,htmlFor:_===`label`?f:void 0,...D(`body`),children:[s,(0,j.jsxs)(`div`,{...D(`labelWrapper`),"data-disabled":p||void 0,children:[l&&(0,j.jsx)(u,{component:v,htmlFor:v===`label`?f:void 0,...D(`label`),"data-disabled":p||void 0,children:l}),d&&(0,j.jsx)(c.Description,{id:O,size:h,__inheritStyles:!1,...D(`description`),children:d}),m&&typeof m!=`boolean`&&(0,j.jsx)(c.Error,{id:k,size:h,__inheritStyles:!1,...D(`error`),children:m})]})]})})}be.displayName=`@mantine/core/InlineInput`;function Q(e){return`group`in e}function xe({options:e,search:t,limit:n}){let r=t.trim().toLowerCase(),i=[];for(let a=0;a0)return!1;return!0}function Ce(e,t=new Set){if(Array.isArray(e))for(let n of e)if(Q(n))Ce(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 we(e,t){return Array.isArray(e)?e.includes(t):e===t}function Te({data:e,withCheckIcon:t,withAlignedLabels:n,value:r,checkIconPosition:i,unstyled:a,renderOption:o}){if(!Q(e)){let s=we(r,e.value),c=t&&(s?(0,j.jsx)(D,{className:L.optionsDropdownCheckIcon}):n?(0,j.jsx)(`div`,{className:L.optionsDropdownCheckPlaceholder}):null),l=(0,j.jsxs)(j.Fragment,{children:[i===`left`&&c,(0,j.jsx)(`span`,{children:e.label}),i===`right`&&c]});return(0,j.jsx)(Z.Option,{value:e.value,disabled:e.disabled,className:d({[L.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,j.jsx)(Te,{data:e,value:r,unstyled:a,withCheckIcon:t,withAlignedLabels:n,checkIconPosition:i,renderOption:o},`${e.value}`));return(0,j.jsx)(Z.Group,{label:e.group,children:s})}function Ee({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=V();Ce(e);let x=typeof i==`string`?(r||xe)({options:e,search:l?i:``,limit:a??1/0}):e,C=Se(x),w=x.map((e,t)=>(0,j.jsx)(Te,{data:e,withCheckIcon:u,withAlignedLabels:d,value:f,checkIconPosition:p,unstyled:h,renderOption:_},Q(e)?`group-${typeof e.group==`string`?e.group:t}`:`${e.value}`));return(0,j.jsx)(Z.Dropdown,{hidden:t||n&&C,"data-composed":!0,children:(0,j.jsxs)(Z.Options,{labelledBy:g,"aria-label":y,children:[c?(0,j.jsx)(S.Autosize,{mah:(s??b.floatingHeight)===`viewport`?`var(--combobox-floating-options-max-height)`:o??220,type:`scroll`,scrollbarSize:`var(--combobox-padding)`,offsetScrollbars:`y`,...v,children:w}):w,C&&m&&(0,j.jsx)(Z.Empty,{children:m})]})})}function De({id:e,label:t,labelProps:n,inputWrapperOrder:r}){if(t&&(!r||r.includes(`label`)))return n?.id||`${e}-label`}var Oe=(0,A.createContext)(null),ke={hiddenInputValuesSeparator:`,`},Ae=s((e=>{let{value:t,defaultValue:n,onChange:r,size:i,wrapperProps:o,children:s,readOnly:l,name:u,hiddenInputValuesSeparator:d,hiddenInputProps:f,maxSelectedValues:p,disabled:m,...h}=a(`SwitchGroup`,ke,e),[_,v]=g({value:t,defaultValue:n,finalValue:[],onChange:r}),y=e=>{let t=e.currentTarget.value;if(l)return;let n=_.includes(t);!n&&p&&_.length>=p||v(n?_.filter(e=>e!==t):[..._,t])},b=e=>{if(m)return!0;if(!p)return!1;let t=_.includes(e),n=_.length>=p;return!t&&n},x=_.join(d);return(0,j.jsx)(Oe,{value:{value:_,onChange:y,size:i,isDisabled:b},children:(0,j.jsxs)(c.Wrapper,{size:i,...o,...h,labelElement:`div`,__staticSelector:`SwitchGroup`,children:[(0,j.jsx)(_e,{role:`group`,children:s}),(0,j.jsx)(`input`,{type:`hidden`,name:u,value:x,...f})]})})}));Ae.classes=c.Wrapper.classes,Ae.displayName=`@mantine/core/SwitchGroup`;var je={root:`m_5f93f3bb`,input:`m_926b4011`,track:`m_9307d992`,thumb:`m_93039a1d`,trackLabel:`m_8277e082`},Me={labelPosition:`right`,withThumbIndicator:!0},Ne=f((e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:h(t),"--switch-height":C(r,`switch-height`),"--switch-width":C(r,`switch-width`),"--switch-thumb-size":C(r,`switch-thumb-size`),"--switch-label-font-size":C(r,`switch-label-font-size`),"--switch-track-label-padding":C(r,`switch-track-label-padding`),"--switch-color":n?w(n,e):void 0}})),$=r(e=>{let t=a(`Switch`,Me,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,color:d,label:f,offLabel:p,onLabel:m,id:h,size:_,radius:y,wrapperProps:x,thumbIcon:S,checked:C,defaultChecked:w,onChange:T,labelPosition:E,description:D,error:O,disabled:k,variant:M,rootRef:N,mod:P,withThumbIndicator:F,attributes:I,...ee}=t,L=(0,A.use)(Oe),te=_||L?.size,R=o({name:`Switch`,props:t,classes:je,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:I,vars:l,varsResolver:Ne}),{styleProps:z,rest:B}=b(ee),V=v(h),H=[D?`${V}-description`:void 0,O&&typeof O!=`boolean`?`${V}-error`:void 0,B[`aria-describedby`]].filter(Boolean).join(` `)||void 0,U={checked:L?.value.includes(B.value)??C,onChange:e=>{L?.onChange(e),T?.(e)}},ne=k||L?.isDisabled?.(B.value),[W,G]=g({value:U.checked??C,defaultValue:w,finalValue:!1});return(0,j.jsxs)(be,{...R(`root`),__staticSelector:`Switch`,__stylesApiProps:t,id:V,size:te,labelPosition:E,label:f,description:D,error:O,disabled:ne,bodyElement:`label`,labelElement:`span`,classNames:n,styles:s,unstyled:c,"data-checked":U.checked,variant:M,ref:N,mod:P,attributes:I,inert:B.inert,...z,...x,children:[(0,j.jsx)(`input`,{...B,...U,disabled:ne,checked:W,"data-checked":U.checked,onChange:e=>{U.onChange?.(e),G(e.currentTarget.checked)},id:V,type:`checkbox`,role:`switch`,inert:B.inert,"aria-describedby":H,...R(`input`)}),(0,j.jsxs)(u,{"aria-hidden":`true`,component:`span`,mod:{error:O,"label-position":E,"without-labels":!m&&!p},...R(`track`),children:[(0,j.jsx)(u,{component:`span`,mod:{"reduce-motion":!0,"with-thumb-indicator":F&&!S},...R(`thumb`),children:S}),(0,j.jsx)(`span`,{...R(`trackLabel`),children:W?m:p})]})]})});$.classes={...je,...ye},$.varsResolver=Ne,$.displayName=`@mantine/core/Switch`,$.Group=Ae;function Pe({time:e,updatedAt:t}){let[n,r]=(0,A.useState)(Date.now);(0,A.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(e)},[]);let i=e?.from&&e.to?`${k(e.from)} – ${k(e.to)}`:e?`Last ${e.range??`1h`}`:`Refresh every 30s`;return(0,j.jsxs)(y,{ff:`monospace`,size:`xs`,c:`dimmed`,children:[i,` · `,t?`Updated ${Math.max(0,Math.floor((n-t)/1e3))}s ago`:`Waiting for data`]})}export{Q as a,ee as c,Ee as i,I as l,$ as n,Z as o,De as r,me as s,Pe as t,P as u}; \ No newline at end of file +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{Dt as r,F as i,Ft as a,Nt as o,Ot as s,P as c,Qt as l,Tt as u,Xt as d,Zt as f,_n as p,bn as m,dn as h,en as g,gn as _,in as v,j as y,jt as b,nn as x,nt as S,pn as C,qt as w,un as T}from"./brand-D6fP-cLS.js";import{M as E,j as D}from"./search-D_K9J6yO.js";import{l as O,n as k}from"./format-BZjbsxwM.js";var A=n(e(),1),j=t();function M(e,t=document){let n=t.querySelector(e);if(n)return n;let r=t.querySelectorAll(`*`);for(let t=0;tF(e))}:typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?{value:e,label:`${e}`}:e}function I(e){return e?e.map(e=>F(e)):[]}function ee(e){return e.reduce((e,t)=>`group`in t?{...e,...ee(t.items)}:(e[`${t.value}`]=t,e),{})}var L={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`},te={error:null},R=f((e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":C(t,`combobox-chevron-size`),"--combobox-chevron-color":n?w(n,e):void 0}})),z=r(e=>{let t=a(`ComboboxChevron`,te,e),{size:n,error:r,style:i,className:s,classNames:c,styles:l,unstyled:d,vars:f,attributes:p,mod:m,...h}=t,g=o({name:`ComboboxChevron`,classes:L,props:t,style:i,className:s,classNames:c,styles:l,unstyled:d,vars:f,varsResolver:R,attributes:p,rootSelector:`chevron`});return(0,j.jsx)(u,{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,j.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`})})});z.classes=L,z.varsResolver=R,z.displayName=`@mantine/core/ComboboxChevron`;var[B,V]=_(`Combobox component was not found in tree`);function H({onMouseDown:e,onClick:t,onClear:n,...r}){return(0,j.jsx)(c.ClearButton,{tabIndex:-1,"aria-hidden":!0,...r,onMouseDown:t=>{t.preventDefault(),e?.(t)},onClick:e=>{n(),t?.(e)}})}H.displayName=`@mantine/core/ComboboxClearButton`;var U=r(e=>{let{classNames:t,styles:n,className:r,style:i,hidden:o,...s}=a(`ComboboxDropdown`,null,e),c=V();return(0,j.jsx)(E.Dropdown,{...s,role:`presentation`,"data-hidden":o||void 0,"data-floating-height":c.floatingHeight||void 0,...c.getStyles(`dropdown`,{className:r,style:i,classNames:t,styles:n})})});U.classes=L,U.displayName=`@mantine/core/ComboboxDropdown`;var ne={refProp:`ref`},W=r(e=>{let{children:t,refProp:n,ref:r}=a(`ComboboxDropdownTarget`,ne,e);if(V(),!p(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,j.jsx)(E.Target,{ref:r,refProp:n,children:t})});W.displayName=`@mantine/core/ComboboxDropdownTarget`;var G=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,...s}=a(`ComboboxEmpty`,null,e),c=V();return(0,j.jsx)(u,{...c.getStyles(`empty`,{className:n,classNames:t,styles:i,style:r}),...s})});G.classes=L,G.displayName=`@mantine/core/ComboboxEmpty`;function K({onKeyDown:e,onClick:t,withKeyboardNavigation:n,withAriaAttributes:r,withExpandedAttribute:i,targetType:a,autoComplete:o}){let s=V(),[c,l]=(0,A.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 re={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},ie=r(e=>{let{children:t,refProp:n,withKeyboardNavigation:r,withAriaAttributes:i,withExpandedAttribute:o,targetType:s,autoComplete:c,ref:u,...d}=a(`ComboboxEventsTarget`,re,e),f=l(t);if(!f)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 p=V(),m=K({targetType:s,withAriaAttributes:i,withKeyboardNavigation:r,withExpandedAttribute:o,onKeyDown:f.props.onKeyDown,onClick:f.props.onClick,autoComplete:c});return(0,A.cloneElement)(f,{...m,...d,[n]:x(u,p.store.targetRef,O(f))})});ie.displayName=`@mantine/core/ComboboxEventsTarget`;var q=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,...s}=a(`ComboboxFooter`,null,e),c=V();return(0,j.jsx)(u,{...c.getStyles(`footer`,{className:n,classNames:t,style:r,styles:i}),...s,onMouseDown:e=>{e.preventDefault()}})});q.classes=L,q.displayName=`@mantine/core/ComboboxFooter`;var J=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,children:s,label:c,id:l,...d}=a(`ComboboxGroup`,null,e),f=V(),p=v(l),m=c!=null&&c!==!1&&c!==``;return(0,j.jsxs)(u,{role:`group`,"aria-labelledby":m?p:void 0,...f.getStyles(`group`,{className:n,classNames:t,style:r,styles:i}),...d,children:[m&&(0,j.jsx)(`div`,{id:p,...f.getStyles(`groupLabel`,{classNames:t,styles:i}),children:c}),s]})});J.classes=L,J.displayName=`@mantine/core/ComboboxGroup`;var Y=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,...s}=a(`ComboboxHeader`,null,e),c=V();return(0,j.jsx)(u,{...c.getStyles(`header`,{className:n,classNames:t,style:r,styles:i}),...s,onMouseDown:e=>{e.preventDefault()}})});Y.classes=L,Y.displayName=`@mantine/core/ComboboxHeader`;function ae({value:e,valuesDivider:t=`,`,...n}){return(0,j.jsx)(`input`,{type:`hidden`,value:Array.isArray(e)?e.join(t):e?`${e}`:``,...n})}ae.displayName=`@mantine/core/ComboboxHiddenInput`;var X=r(e=>{let t=a(`ComboboxOption`,null,e),{classNames:n,className:r,style:i,styles:o,vars:s,onClick:c,id:l,active:d,onMouseDown:f,onMouseOver:p,disabled:m,selected:h,mod:g,..._}=t,v=V(),y=(0,A.useId)(),b=l||y;return(0,j.jsx)(u,{...v.getStyles(`option`,{className:r,classNames:n,styles:o,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)}})});X.classes=L,X.displayName=`@mantine/core/ComboboxOption`;var oe=r(e=>{let{classNames:t,className:n,style:r,styles:i,id:o,onMouseDown:s,labelledBy:c,...l}=a(`ComboboxOptions`,null,e),d=V(),f=v(o);return(0,A.useEffect)(()=>{d.store.setListId(f)},[f]),(0,j.jsx)(u,{...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)}})});oe.classes=L,oe.displayName=`@mantine/core/ComboboxOptions`;var se={withAriaAttributes:!0,withKeyboardNavigation:!0},ce=r(e=>{let{classNames:t,styles:n,unstyled:r,vars:i,withAriaAttributes:o,onKeyDown:s,onClick:l,withKeyboardNavigation:u,size:d,ref:f,...p}=a(`ComboboxSearch`,se,e),m=V(),h=m.getStyles(`search`),g=K({targetType:`input`,withAriaAttributes:o,withKeyboardNavigation:u,withExpandedAttribute:!1,onKeyDown:s,onClick:l,autoComplete:`off`});return(0,j.jsx)(c,{ref:x(f,m.store.searchRef),classNames:[{input:h.className},t],styles:[{input:h.style},n],size:d||m.size,...g,...p,__staticSelector:`Combobox`})});ce.classes=L,ce.displayName=`@mantine/core/ComboboxSearch`;var le={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},ue=r(e=>{let{children:t,refProp:n,withKeyboardNavigation:r,withAriaAttributes:i,withExpandedAttribute:o,targetType:s,autoComplete:c,ref:u,...d}=a(`ComboboxTarget`,le,e),f=l(t);if(!f)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 p=V(),m=K({targetType:s,withAriaAttributes:i,withKeyboardNavigation:r,withExpandedAttribute:o,onKeyDown:f.props.onKeyDown,onClick:f.props.onClick,autoComplete:c}),h=(0,A.cloneElement)(f,{...m,...d});return(0,j.jsx)(E.Target,{refProp:n,ref:x(u,p.store.targetRef),children:h})});ue.displayName=`@mantine/core/ComboboxTarget`;function de(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 fe(e,t,n){for(let n=e+1;n{s||(c(!0),i?.(e))},[c,i,s]),v=(0,A.useCallback)((e=`unknown`)=>{s&&(c(!1),r?.(e))},[c,r,s]),y=(0,A.useCallback)((e=`unknown`)=>{s?v(e):_(e)},[v,_,s]),b=(0,A.useCallback)(()=>{let e=P(f.current);M(`#${l.current} [data-combobox-selected]`,e)?.removeAttribute(`data-combobox-selected`)},[]),x=(0,A.useCallback)(e=>{let t=P(f.current),n=M(`#${l.current}`,t),r=n?N(`[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`)?(b(),r[i].setAttribute(`data-combobox-selected`,`true`),r[i].scrollIntoView({block:`nearest`,behavior:o}),r[i].id):null},[o,b]),S=(0,A.useCallback)(()=>{let e=P(f.current),t=M(`#${l.current} [data-combobox-active]`,e);if(t){let n=N(`#${l.current} [data-combobox-option]`,e).findIndex(e=>e===t);return x(n)}return x(0)},[x]),C=(0,A.useCallback)(()=>{let e=P(f.current),t=N(`#${l.current} [data-combobox-option]`,e);return x(fe(u.current,t,a))},[x,a]),w=(0,A.useCallback)(()=>{let e=P(f.current),t=N(`#${l.current} [data-combobox-option]`,e);return x(de(u.current,t,a))},[x,a]),T=(0,A.useCallback)(()=>{let e=P(f.current),t=N(`#${l.current} [data-combobox-option]`,e);return x(pe(t))},[x]),E=(0,A.useCallback)((e=`selected`,t)=>{if(typeof e==`number`){u.current=e;let n=P(f.current),r=N(`#${l.current} [data-combobox-option]`,n);t?.scrollIntoView&&r[e]?.scrollIntoView({block:`nearest`,behavior:o});return}h.current=window.setTimeout(()=>{let n=P(f.current),r=N(`#${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)},[]),D=(0,A.useCallback)(()=>{u.current=-1,b()},[b]),O=(0,A.useCallback)(()=>{let e=P(f.current);(N(`#${l.current} [data-combobox-option]`,e)?.[u.current])?.click()},[]),k=(0,A.useCallback)(e=>{l.current=e},[]),j=(0,A.useCallback)(()=>{p.current=window.setTimeout(()=>d.current?.focus(),0)},[]),F=(0,A.useCallback)(()=>{m.current=window.setTimeout(()=>f.current?.focus(),0)},[]),I=(0,A.useCallback)(()=>u.current,[]);return(0,A.useEffect)(()=>()=>{window.clearTimeout(p.current),window.clearTimeout(m.current),window.clearTimeout(h.current)},[]),{dropdownOpened:s,openDropdown:_,closeDropdown:v,toggleDropdown:y,selectedOptionIndex:u.current,getSelectedOptionIndex:I,selectOption:x,selectFirstOption:T,selectActiveOption:S,selectNextOption:C,selectPreviousOption:w,resetSelectedOption:D,updateSelectedOptionIndex:E,listId:l.current,setListId:k,clickSelectedOption:O,searchRef:d,focusSearchInput:j,targetRef:f,focusTarget:F}}var he={keepMounted:!0,keepMountedMode:`display-none`,withinPortal:!0,resetSelectionOnOptionHover:!1,width:`target`,transitionProps:{transition:`fade`,duration:0},size:`sm`},ge=f((e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":T(t),"--combobox-option-padding":C(t,`combobox-option-padding`)},dropdown:{"--combobox-padding":n===void 0?void 0:m(n),"--combobox-option-fz":T(t),"--combobox-option-padding":C(t,`combobox-option-padding`)}})),Z=e=>{let t=a(`Combobox`,he,e),{classNames:n,styles:r,unstyled:i,children:s,store:c,vars:l,onOptionSubmit:u,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=me(),C=c||S,w=o({name:h||`Combobox`,classes:L,props:t,classNames:n,styles:r,unstyled:i,attributes:_,vars:l,varsResolver:ge}),T=()=>{d?.(),C.closeDropdown()};return(0,j.jsx)(B,{value:{getStyles:w,store:C,onOptionSubmit:u,size:f,resetSelectionOnOptionHover:m,readOnly:g,floatingHeight:v},children:(0,j.jsx)(E,{opened:C.dropdownOpened,...b,middlewares:x,onChange:e=>!e&&T(),withRoles:!1,unstyled:i,children:s})})};Z.extend=e=>e,Z.classes=L,Z.varsResolver=ge,Z.displayName=`@mantine/core/Combobox`,Z.Target=ue,Z.Dropdown=U,Z.Options=oe,Z.Option=X,Z.Search=ce,Z.Empty=G,Z.Chevron=z,Z.Footer=q,Z.Header=Y,Z.EventsTarget=ie,Z.DropdownTarget=W,Z.Group=J,Z.ClearButton=H,Z.HiddenInput=ae;function _e({children:e,role:t}){let n=(0,A.use)(i);return n?(0,j.jsx)(`div`,{role:t,"aria-labelledby":n.labelId,"aria-describedby":n.describedBy,children:e}):(0,j.jsx)(j.Fragment,{children:e})}var ve={root:`m_5f75b09e`,body:`m_5f6e695e`,labelWrapper:`m_d3ea56bb`,label:`m_8ee546b8`,description:`m_328f68c0`,error:`m_8e8a99cc`},ye=ve;function be({__staticSelector:e,__stylesApiProps:t,className:n,classNames:r,styles:i,unstyled:a,children:s,label:l,description:d,id:f,disabled:p,error:m,size:h,labelPosition:g=`left`,bodyElement:_=`div`,labelElement:v=`label`,variant:y,style:b,vars:x,mod:S,attributes:w,...E}){let D=o({name:e,props:t,className:n,style:b,classes:ve,classNames:r,styles:i,unstyled:a,attributes:w}),O=d?`${f}-description`:void 0,k=m&&typeof m!=`boolean`?`${f}-error`:void 0;return(0,j.jsx)(u,{...D(`root`),__vars:{"--label-fz":T(h),"--label-lh":C(h,`label-lh`)},mod:[{"label-position":g},S],variant:y,size:h,...E,children:(0,j.jsxs)(u,{component:_,htmlFor:_===`label`?f:void 0,...D(`body`),children:[s,(0,j.jsxs)(`div`,{...D(`labelWrapper`),"data-disabled":p||void 0,children:[l&&(0,j.jsx)(u,{component:v,htmlFor:v===`label`?f:void 0,...D(`label`),"data-disabled":p||void 0,children:l}),d&&(0,j.jsx)(c.Description,{id:O,size:h,__inheritStyles:!1,...D(`description`),children:d}),m&&typeof m!=`boolean`&&(0,j.jsx)(c.Error,{id:k,size:h,__inheritStyles:!1,...D(`error`),children:m})]})]})})}be.displayName=`@mantine/core/InlineInput`;function Q(e){return`group`in e}function xe({options:e,search:t,limit:n}){let r=t.trim().toLowerCase(),i=[];for(let a=0;a0)return!1;return!0}function Ce(e,t=new Set){if(Array.isArray(e))for(let n of e)if(Q(n))Ce(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 we(e,t){return Array.isArray(e)?e.includes(t):e===t}function Te({data:e,withCheckIcon:t,withAlignedLabels:n,value:r,checkIconPosition:i,unstyled:a,renderOption:o}){if(!Q(e)){let s=we(r,e.value),c=t&&(s?(0,j.jsx)(D,{className:L.optionsDropdownCheckIcon}):n?(0,j.jsx)(`div`,{className:L.optionsDropdownCheckPlaceholder}):null),l=(0,j.jsxs)(j.Fragment,{children:[i===`left`&&c,(0,j.jsx)(`span`,{children:e.label}),i===`right`&&c]});return(0,j.jsx)(Z.Option,{value:e.value,disabled:e.disabled,className:d({[L.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,j.jsx)(Te,{data:e,value:r,unstyled:a,withCheckIcon:t,withAlignedLabels:n,checkIconPosition:i,renderOption:o},`${e.value}`));return(0,j.jsx)(Z.Group,{label:e.group,children:s})}function Ee({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=V();Ce(e);let x=typeof i==`string`?(r||xe)({options:e,search:l?i:``,limit:a??1/0}):e,C=Se(x),w=x.map((e,t)=>(0,j.jsx)(Te,{data:e,withCheckIcon:u,withAlignedLabels:d,value:f,checkIconPosition:p,unstyled:h,renderOption:_},Q(e)?`group-${typeof e.group==`string`?e.group:t}`:`${e.value}`));return(0,j.jsx)(Z.Dropdown,{hidden:t||n&&C,"data-composed":!0,children:(0,j.jsxs)(Z.Options,{labelledBy:g,"aria-label":y,children:[c?(0,j.jsx)(S.Autosize,{mah:(s??b.floatingHeight)===`viewport`?`var(--combobox-floating-options-max-height)`:o??220,type:`scroll`,scrollbarSize:`var(--combobox-padding)`,offsetScrollbars:`y`,...v,children:w}):w,C&&m&&(0,j.jsx)(Z.Empty,{children:m})]})})}function De({id:e,label:t,labelProps:n,inputWrapperOrder:r}){if(t&&(!r||r.includes(`label`)))return n?.id||`${e}-label`}var Oe=(0,A.createContext)(null),ke={hiddenInputValuesSeparator:`,`},Ae=s((e=>{let{value:t,defaultValue:n,onChange:r,size:i,wrapperProps:o,children:s,readOnly:l,name:u,hiddenInputValuesSeparator:d,hiddenInputProps:f,maxSelectedValues:p,disabled:m,...h}=a(`SwitchGroup`,ke,e),[_,v]=g({value:t,defaultValue:n,finalValue:[],onChange:r}),y=e=>{let t=e.currentTarget.value;if(l)return;let n=_.includes(t);!n&&p&&_.length>=p||v(n?_.filter(e=>e!==t):[..._,t])},b=e=>{if(m)return!0;if(!p)return!1;let t=_.includes(e),n=_.length>=p;return!t&&n},x=_.join(d);return(0,j.jsx)(Oe,{value:{value:_,onChange:y,size:i,isDisabled:b},children:(0,j.jsxs)(c.Wrapper,{size:i,...o,...h,labelElement:`div`,__staticSelector:`SwitchGroup`,children:[(0,j.jsx)(_e,{role:`group`,children:s}),(0,j.jsx)(`input`,{type:`hidden`,name:u,value:x,...f})]})})}));Ae.classes=c.Wrapper.classes,Ae.displayName=`@mantine/core/SwitchGroup`;var je={root:`m_5f93f3bb`,input:`m_926b4011`,track:`m_9307d992`,thumb:`m_93039a1d`,trackLabel:`m_8277e082`},Me={labelPosition:`right`,withThumbIndicator:!0},Ne=f((e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:h(t),"--switch-height":C(r,`switch-height`),"--switch-width":C(r,`switch-width`),"--switch-thumb-size":C(r,`switch-thumb-size`),"--switch-label-font-size":C(r,`switch-label-font-size`),"--switch-track-label-padding":C(r,`switch-track-label-padding`),"--switch-color":n?w(n,e):void 0}})),$=r(e=>{let t=a(`Switch`,Me,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,color:d,label:f,offLabel:p,onLabel:m,id:h,size:_,radius:y,wrapperProps:x,thumbIcon:S,checked:C,defaultChecked:w,onChange:T,labelPosition:E,description:D,error:O,disabled:k,variant:M,rootRef:N,mod:P,withThumbIndicator:F,attributes:I,...ee}=t,L=(0,A.use)(Oe),te=_||L?.size,R=o({name:`Switch`,props:t,classes:je,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:I,vars:l,varsResolver:Ne}),{styleProps:z,rest:B}=b(ee),V=v(h),H=[D?`${V}-description`:void 0,O&&typeof O!=`boolean`?`${V}-error`:void 0,B[`aria-describedby`]].filter(Boolean).join(` `)||void 0,U={checked:L?.value.includes(B.value)??C,onChange:e=>{L?.onChange(e),T?.(e)}},ne=k||L?.isDisabled?.(B.value),[W,G]=g({value:U.checked??C,defaultValue:w,finalValue:!1});return(0,j.jsxs)(be,{...R(`root`),__staticSelector:`Switch`,__stylesApiProps:t,id:V,size:te,labelPosition:E,label:f,description:D,error:O,disabled:ne,bodyElement:`label`,labelElement:`span`,classNames:n,styles:s,unstyled:c,"data-checked":U.checked,variant:M,ref:N,mod:P,attributes:I,inert:B.inert,...z,...x,children:[(0,j.jsx)(`input`,{...B,...U,disabled:ne,checked:W,"data-checked":U.checked,onChange:e=>{U.onChange?.(e),G(e.currentTarget.checked)},id:V,type:`checkbox`,role:`switch`,inert:B.inert,"aria-describedby":H,...R(`input`)}),(0,j.jsxs)(u,{"aria-hidden":`true`,component:`span`,mod:{error:O,"label-position":E,"without-labels":!m&&!p},...R(`track`),children:[(0,j.jsx)(u,{component:`span`,mod:{"reduce-motion":!0,"with-thumb-indicator":F&&!S},...R(`thumb`),children:S}),(0,j.jsx)(`span`,{...R(`trackLabel`),children:W?m:p})]})]})});$.classes={...je,...ye},$.varsResolver=Ne,$.displayName=`@mantine/core/Switch`,$.Group=Ae;function Pe({time:e,updatedAt:t}){let[n,r]=(0,A.useState)(Date.now);(0,A.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(e)},[]);let i=e?.from&&e.to?`${k(e.from)} – ${k(e.to)}`:e?`Last ${e.range??`1h`}`:`Refresh every 30s`;return(0,j.jsxs)(y,{ff:`monospace`,size:`xs`,c:`dimmed`,children:[i,` · `,t?`Updated ${Math.max(0,Math.floor((n-t)/1e3))}s ago`:`Waiting for data`]})}export{Q as a,ee as c,Ee as i,I as l,$ as n,Z as o,De as r,me as s,Pe as t,P as u}; \ No newline at end of file diff --git a/internal/ui/dist/assets/loading-skeleton-DEzWruJF.js b/internal/ui/dist/assets/loading-skeleton-D1hXpfUI.js similarity index 98% rename from internal/ui/dist/assets/loading-skeleton-DEzWruJF.js rename to internal/ui/dist/assets/loading-skeleton-D1hXpfUI.js index bc549e390..21eca1626 100644 --- a/internal/ui/dist/assets/loading-skeleton-DEzWruJF.js +++ b/internal/ui/dist/assets/loading-skeleton-D1hXpfUI.js @@ -1 +1 @@ -import{r as e}from"./useRouter-ByJ6_rwb.js";import{$ as t,E as n,G as r,T as i,Tt as a,l as o}from"./brand-CCQ0JT0F.js";var s=e(),c={stat:`stat`,gauge:`gauge`,timeseries:`chart`,bar:`chart`,table:`table`,text:`text`,heatmap:`heatmap`,histogram:`chart`,scatter:`chart`,state_timeline:`chart`,logs:`table`,log_patterns:`table`,traces:`table`,service_map:`graph`,health:`health`};function l({viz:e,shape:l,columns:u=4,rows:d=5}){let f=e===void 0?l:c[e];return(0,s.jsx)(a,{"data-skeleton-shape":f,style:{minWidth:0,width:`100%`,minHeight:0,flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:f===`chart`?(0,s.jsxs)(i,{gap:`xs`,style:{flex:1,minHeight:0},children:[(0,s.jsx)(n,{"data-skeleton-chart":!0,radius:`sm`,style:{flex:1,minHeight:0}}),(0,s.jsx)(a,{"data-skeleton-axis":!0,style:{borderBottom:`1px solid var(--mantine-color-default-border)`,marginInline:8}}),(0,s.jsxs)(r,{justify:`space-between`,children:[(0,s.jsx)(n,{height:8,width:`16%`}),(0,s.jsx)(n,{height:8,width:`16%`}),(0,s.jsx)(n,{height:8,width:`16%`})]})]}):f===`stat`?(0,s.jsxs)(i,{gap:`md`,justify:`center`,mih:120,children:[(0,s.jsx)(n,{height:48,width:`52%`}),(0,s.jsx)(n,{height:12,width:`34%`})]}):f===`gauge`?(0,s.jsxs)(i,{gap:`lg`,justify:`center`,mih:140,children:[(0,s.jsx)(n,{height:40,width:`40%`}),(0,s.jsx)(n,{height:16,radius:`xl`}),(0,s.jsxs)(r,{justify:`space-between`,children:[(0,s.jsx)(n,{height:10,width:`18%`}),(0,s.jsx)(n,{height:10,width:`18%`})]})]}):f===`heatmap`?(0,s.jsx)(a,{style:{display:`grid`,gridTemplateColumns:`repeat(8, 1fr)`,gap:4},children:Array.from({length:40},(e,t)=>(0,s.jsx)(n,{height:24,radius:2},t))}):f===`text`?(0,s.jsx)(i,{gap:`sm`,children:[95,100,88,96,62].map((e,t)=>(0,s.jsx)(n,{height:12,width:`${e}%`},t))}):f===`table`?(0,s.jsx)(i,{gap:0,children:Array.from({length:d+1},(e,t)=>(0,s.jsx)(a,{"data-skeleton-row":t===0?`header`:`body`,style:{display:`grid`,gridTemplateColumns:`repeat(${u}, minmax(0, 1fr))`,gap:16,paddingBlock:12,borderBottom:`1px solid var(--mantine-color-default-border)`},children:Array.from({length:u},(e,r)=>(0,s.jsx)(n,{height:t===0?10:14,width:r===u-1?`60%`:`85%`},r))},t))}):f===`key_value`?(0,s.jsxs)(a,{children:[(0,s.jsx)(n,{height:12,width:`24%`,mb:4}),(0,s.jsx)(o,{items:Array.from({length:d},(e,t)=>({label:(0,s.jsx)(n,{"data-skeleton-label":t,height:21,width:`75%`}),value:(0,s.jsx)(n,{"data-skeleton-value":t,height:21,width:`85%`})}))})]}):f===`health`?(0,s.jsx)(a,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(120px, 1fr))`,gap:8},children:Array.from({length:6},(e,r)=>(0,s.jsx)(t,{withBorder:!0,p:`sm`,"data-skeleton-tile":!0,children:(0,s.jsxs)(i,{gap:`xs`,children:[(0,s.jsx)(n,{height:12,width:`65%`}),(0,s.jsx)(n,{height:24,width:`45%`}),(0,s.jsx)(n,{height:10,width:`85%`})]})},r))}):f===`graph`?(0,s.jsxs)(a,{style:{position:`relative`,flex:1,minHeight:80},children:[(0,s.jsx)(`svg`,{"aria-hidden":`true`,width:`100%`,height:`100%`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,style:{position:`absolute`,inset:0},children:(0,s.jsx)(`path`,{"data-skeleton-edges":!0,d:`M20 50 L50 20 L80 50 L50 80 Z M20 50 H80`,fill:`none`,stroke:`var(--mantine-color-default-border)`,vectorEffect:`non-scaling-stroke`})}),[[20,50],[50,20],[80,50],[50,80]].map(([e,t],r)=>(0,s.jsx)(n,{"data-skeleton-node":!0,width:`22%`,height:32,style:{position:`absolute`,left:`${e}%`,top:`${t}%`,transform:`translate(-50%, -50%)`}},r))]}):f===`settings`?(0,s.jsx)(i,{gap:`xl`,children:Array.from({length:3},(e,r)=>(0,s.jsxs)(i,{gap:`md`,"data-skeleton-section":!0,children:[(0,s.jsx)(n,{height:20,width:`25%`}),(0,s.jsx)(n,{height:12,width:`55%`}),(0,s.jsx)(t,{withBorder:!0,radius:`lg`,p:`lg`,children:(0,s.jsx)(n,{height:96,radius:`sm`})})]},r))}):(0,s.jsx)(i,{gap:`md`,children:Array.from({length:d},(e,t)=>(0,s.jsxs)(r,{wrap:`nowrap`,justify:`space-between`,children:[(0,s.jsxs)(i,{gap:8,style:{flex:1},children:[(0,s.jsx)(n,{height:12,width:`45%`}),(0,s.jsx)(n,{height:10,width:`70%`})]}),(0,s.jsx)(n,{height:36,width:96})]},t))})})}export{l as t}; \ No newline at end of file +import{r as e}from"./useRouter-ByJ6_rwb.js";import{$ as t,E as n,G as r,T as i,Tt as a,l as o}from"./brand-D6fP-cLS.js";var s=e(),c={stat:`stat`,gauge:`gauge`,timeseries:`chart`,bar:`chart`,table:`table`,text:`text`,heatmap:`heatmap`,histogram:`chart`,scatter:`chart`,state_timeline:`chart`,logs:`table`,log_patterns:`table`,traces:`table`,service_map:`graph`,health:`health`};function l({viz:e,shape:l,columns:u=4,rows:d=5}){let f=e===void 0?l:c[e];return(0,s.jsx)(a,{"data-skeleton-shape":f,style:{minWidth:0,width:`100%`,minHeight:0,flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:f===`chart`?(0,s.jsxs)(i,{gap:`xs`,style:{flex:1,minHeight:0},children:[(0,s.jsx)(n,{"data-skeleton-chart":!0,radius:`sm`,style:{flex:1,minHeight:0}}),(0,s.jsx)(a,{"data-skeleton-axis":!0,style:{borderBottom:`1px solid var(--mantine-color-default-border)`,marginInline:8}}),(0,s.jsxs)(r,{justify:`space-between`,children:[(0,s.jsx)(n,{height:8,width:`16%`}),(0,s.jsx)(n,{height:8,width:`16%`}),(0,s.jsx)(n,{height:8,width:`16%`})]})]}):f===`stat`?(0,s.jsxs)(i,{gap:`md`,justify:`center`,mih:120,children:[(0,s.jsx)(n,{height:48,width:`52%`}),(0,s.jsx)(n,{height:12,width:`34%`})]}):f===`gauge`?(0,s.jsxs)(i,{gap:`lg`,justify:`center`,mih:140,children:[(0,s.jsx)(n,{height:40,width:`40%`}),(0,s.jsx)(n,{height:16,radius:`xl`}),(0,s.jsxs)(r,{justify:`space-between`,children:[(0,s.jsx)(n,{height:10,width:`18%`}),(0,s.jsx)(n,{height:10,width:`18%`})]})]}):f===`heatmap`?(0,s.jsx)(a,{style:{display:`grid`,gridTemplateColumns:`repeat(8, 1fr)`,gap:4},children:Array.from({length:40},(e,t)=>(0,s.jsx)(n,{height:24,radius:2},t))}):f===`text`?(0,s.jsx)(i,{gap:`sm`,children:[95,100,88,96,62].map((e,t)=>(0,s.jsx)(n,{height:12,width:`${e}%`},t))}):f===`table`?(0,s.jsx)(i,{gap:0,children:Array.from({length:d+1},(e,t)=>(0,s.jsx)(a,{"data-skeleton-row":t===0?`header`:`body`,style:{display:`grid`,gridTemplateColumns:`repeat(${u}, minmax(0, 1fr))`,gap:16,paddingBlock:12,borderBottom:`1px solid var(--mantine-color-default-border)`},children:Array.from({length:u},(e,r)=>(0,s.jsx)(n,{height:t===0?10:14,width:r===u-1?`60%`:`85%`},r))},t))}):f===`key_value`?(0,s.jsxs)(a,{children:[(0,s.jsx)(n,{height:12,width:`24%`,mb:4}),(0,s.jsx)(o,{items:Array.from({length:d},(e,t)=>({label:(0,s.jsx)(n,{"data-skeleton-label":t,height:21,width:`75%`}),value:(0,s.jsx)(n,{"data-skeleton-value":t,height:21,width:`85%`})}))})]}):f===`health`?(0,s.jsx)(a,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(120px, 1fr))`,gap:8},children:Array.from({length:6},(e,r)=>(0,s.jsx)(t,{withBorder:!0,p:`sm`,"data-skeleton-tile":!0,children:(0,s.jsxs)(i,{gap:`xs`,children:[(0,s.jsx)(n,{height:12,width:`65%`}),(0,s.jsx)(n,{height:24,width:`45%`}),(0,s.jsx)(n,{height:10,width:`85%`})]})},r))}):f===`graph`?(0,s.jsxs)(a,{style:{position:`relative`,flex:1,minHeight:80},children:[(0,s.jsx)(`svg`,{"aria-hidden":`true`,width:`100%`,height:`100%`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,style:{position:`absolute`,inset:0},children:(0,s.jsx)(`path`,{"data-skeleton-edges":!0,d:`M20 50 L50 20 L80 50 L50 80 Z M20 50 H80`,fill:`none`,stroke:`var(--mantine-color-default-border)`,vectorEffect:`non-scaling-stroke`})}),[[20,50],[50,20],[80,50],[50,80]].map(([e,t],r)=>(0,s.jsx)(n,{"data-skeleton-node":!0,width:`22%`,height:32,style:{position:`absolute`,left:`${e}%`,top:`${t}%`,transform:`translate(-50%, -50%)`}},r))]}):f===`settings`?(0,s.jsx)(i,{gap:`xl`,children:Array.from({length:3},(e,r)=>(0,s.jsxs)(i,{gap:`md`,"data-skeleton-section":!0,children:[(0,s.jsx)(n,{height:20,width:`25%`}),(0,s.jsx)(n,{height:12,width:`55%`}),(0,s.jsx)(t,{withBorder:!0,radius:`lg`,p:`lg`,children:(0,s.jsx)(n,{height:96,radius:`sm`})})]},r))}):(0,s.jsx)(i,{gap:`md`,children:Array.from({length:d},(e,t)=>(0,s.jsxs)(r,{wrap:`nowrap`,justify:`space-between`,children:[(0,s.jsxs)(i,{gap:8,style:{flex:1},children:[(0,s.jsx)(n,{height:12,width:`45%`}),(0,s.jsx)(n,{height:10,width:`70%`})]}),(0,s.jsx)(n,{height:36,width:96})]},t))})})}export{l as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/logs-BlzRGSJn.js b/internal/ui/dist/assets/logs-DQVfH3k6.js similarity index 59% rename from internal/ui/dist/assets/logs-BlzRGSJn.js rename to internal/ui/dist/assets/logs-DQVfH3k6.js index 274076864..887a18b85 100644 --- a/internal/ui/dist/assets/logs-BlzRGSJn.js +++ b/internal/ui/dist/assets/logs-DQVfH3k6.js @@ -1 +1 @@ -import{r as e}from"./useRouter-ByJ6_rwb.js";import{n as t}from"./useNavigate-B1zgPEUp.js";import{i as n,r}from"./search-Bj_SOIkw.js";import{i}from"./index-C5SsAUtw.js";import{n as a,t as o}from"./search-page-Cs7GeQyA.js";var s=e();function c(){let e=r(i.useSearch()),c=t();return(0,s.jsx)(o,{preset:a,search:e,onSearch:(e,t)=>void c({to:`/logs`,search:n(e),replace:t}),onSaved:e=>void c({to:`/dashboards/$dashboardId`,params:{dashboardId:e}})},`logs`)}export{c 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{i as n,r}from"./search-CDra9nG2.js";import{i}from"./index-C1Pd14SU.js";import{n as a,t as o}from"./search-page-uYBxylji.js";var s=e();function c(){let e=r(i.useSearch()),c=t();return(0,s.jsx)(o,{preset:a,search:e,onSearch:(e,t)=>void c({to:`/logs`,search:n(e),replace:t}),onSaved:e=>void c({to:`/dashboards/$dashboardId`,params:{dashboardId:e}})},`logs`)}export{c as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/mcp-app-frame-D0JRq0Ru.js b/internal/ui/dist/assets/mcp-app-frame-C1fa0h58.js similarity index 97% rename from internal/ui/dist/assets/mcp-app-frame-D0JRq0Ru.js rename to internal/ui/dist/assets/mcp-app-frame-C1fa0h58.js index c3ae2c9b8..caf9711a9 100644 --- a/internal/ui/dist/assets/mcp-app-frame-D0JRq0Ru.js +++ b/internal/ui/dist/assets/mcp-app-frame-C1fa0h58.js @@ -1,4 +1,4 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{Tt as r,Y as i,a,k as o,s}from"./brand-CCQ0JT0F.js";import{a as c}from"./auth-K3NK-QpB.js";import{n as l}from"./chat-Bv0H8gs5.js";import{$ as u,B as d,F as f,G as p,H as m,I as h,J as g,K as _,L as v,M as y,N as b,P as x,Q as S,R as C,U as w,V as T,W as E,X as ee,Y as D,Z as O,at as te,et as k,it as ne,j as re,nt as ie,ot as ae,q as A,rt as oe,st as se,tt as ce,ut as le,z as j}from"./index-C5SsAUtw.js";var ue={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`},de;de||={};function fe(e){return ae(y,e)}function pe(e){return te(re,e)}function me(e){return ne(b,e)}function M(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function N(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 he(e){let t=M(M(M(e)?.ui)?.csp),n=N(t?.connectDomains,[`http`,`https`,`ws`,`wss`]),r=N(t?.resourceDomains,[`http`,`https`]),i=N(t?.frameDomains,[`http`,`https`]),a=N(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 P=Object.create,F=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,_e=Object.getOwnPropertyNames,ve=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty,I=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),be=(e,t)=>{let n={};for(var r in e)F(n,r,{get:e[r],enumerable:!0});return t&&F(n,Symbol.toStringTag,{value:`Module`}),n},xe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=_e(t),a=0,o=i.length,s;at[e]).bind(null,s),enumerable:!(r=ge(t,s))||r.enumerable});return e},Se=(e,t,n)=>(n=e==null?{}:P(ve(e)),xe(t||!e||!e.__esModule?F(n,`default`,{value:e,enumerable:!0}):n,e)),Ce=new Set([`https://json-schema.org/draft/2020-12/schema`,`http://json-schema.org/draft/2020-12/schema`]),we=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]),Te=new Set([`https://json-schema.org/draft-07/schema`,`http://json-schema.org/draft-07/schema`]),Ee=new Set([`https://json-schema.org/draft-06/schema`,`http://json-schema.org/draft-06/schema`]);function De(e){return typeof e==`string`&&we.has(e.replace(/#$/,``))}function Oe(e,t){if(!(`$schema`in e)||typeof e.$schema!=`string`)return`2020-12`;let n=e.$schema.replace(/#$/,``);if(Ce.has(n))return`2020-12`;if(we.has(n))return`2019-09`;if(Te.has(n)||Ee.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 ke=`2025-11-25`,Ae=[ke,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],je=`io.modelcontextprotocol/related-task`,Me=`io.modelcontextprotocol/protocolVersion`,Ne=`io.modelcontextprotocol/clientInfo`,Pe=`io.modelcontextprotocol/serverInfo`,Fe=`io.modelcontextprotocol/clientCapabilities`,Ie=`io.modelcontextprotocol/subscriptionId`,Le=`io.modelcontextprotocol/logLevel`,Re=w(()=>u([S(),A(),j(),f(),O(S(),Re),C(Re)])),L=O(S(),Re),ze=C(Re),Be=u([S(),A().int()]),Ve=S(),He=g({ttl:A().optional()}),Ue=g({taskId:S()}),We=p({progressToken:Be.optional(),[je]:Ue.optional()}),R=g({_meta:We.optional()}),Ge=R.extend({task:He.optional()}),z=g({method:S(),params:R.loose().optional()}),B=g({_meta:We.optional()}),V=g({method:S(),params:B.loose().optional()}),Ke=p({get[Pe](){return at.optional().catch(void 0)}}),H=p({_meta:Ke.optional()}),qe=u([S(),A().int()]),Je=g({jsonrpc:E(`2.0`),id:qe,...z.shape}).strict(),Ye=g({jsonrpc:E(`2.0`),...V.shape}).strict(),Xe=g({jsonrpc:E(`2.0`),id:qe,result:H}).strict(),Ze=g({jsonrpc:E(`2.0`),id:qe.optional(),error:g({code:A().int(),message:S(),data:k().optional()})}).strict(),U=u([Je,Ye,Xe,Ze]),Qe=u([Xe,Ze]),$e=H.strict(),et=B.extend({requestId:qe.optional(),reason:S().optional()}),tt=V.extend({method:E(`notifications/cancelled`),params:et}),nt=g({src:S(),mimeType:S().optional(),sizes:C(S()).optional(),theme:x([`light`,`dark`]).optional()}),rt=g({icons:C(nt).optional()}),it=g({name:S(),title:S().optional()}),at=it.extend({...it.shape,...rt.shape,version:S(),websiteUrl:S().optional(),description:S().optional()}),ot=m(g({applyDefaults:j().optional()}),L),W=ee(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,m(g({form:ot.optional(),url:L.optional()}),L.optional())),st=p({list:L.optional(),cancel:L.optional(),requests:p({sampling:p({createMessage:L.optional()}).optional(),elicitation:p({create:L.optional()}).optional()}).optional()}),ct=p({list:L.optional(),cancel:L.optional(),requests:p({tools:p({call:L.optional()}).optional()}).optional()}),lt=g({experimental:O(S(),L).optional(),sampling:g({context:L.optional(),tools:L.optional()}).optional(),elicitation:W.optional(),roots:g({listChanged:j().optional()}).optional(),tasks:st.optional(),extensions:O(S(),L).optional()}),ut=R.extend({protocolVersion:S(),capabilities:lt,clientInfo:at}),dt=z.extend({method:E(`initialize`),params:ut}),ft=g({experimental:O(S(),L).optional(),logging:L.optional(),completions:L.optional(),prompts:g({listChanged:j().optional()}).optional(),resources:g({subscribe:j().optional(),listChanged:j().optional()}).optional(),tools:g({listChanged:j().optional()}).optional(),tasks:ct.optional(),extensions:O(S(),L).optional()}),pt=H.extend({protocolVersion:S(),capabilities:ft,serverInfo:at,instructions:S().optional()}),mt=V.extend({method:E(`notifications/initialized`),params:B.optional()}),ht=z.extend({method:E(`server/discover`),params:R.optional()}),gt=H.extend({supportedVersions:C(S()),capabilities:ft,instructions:S().optional()}),_t=z.extend({method:E(`ping`),params:R.optional()}),vt=g({progress:A(),total:D(A()),message:D(S())}),yt=g({...B.shape,...vt.shape,progressToken:Be}),bt=V.extend({method:E(`notifications/progress`),params:yt}),xt=R.extend({cursor:Ve.optional()}),St=z.extend({params:xt.optional()}),Ct=H.extend({nextCursor:Ve.optional()}),wt=g({uri:S(),mimeType:D(S()),_meta:O(S(),k()).optional()}),Tt=wt.extend({text:S()}),Et=S().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Dt=wt.extend({blob:Et}),Ot=x([`user`,`assistant`]),kt=g({audience:C(Ot).optional(),priority:A().min(0).max(1).optional(),lastModified:fe({offset:!0}).optional()}),At=g({...it.shape,...rt.shape,uri:S(),description:D(S()),mimeType:D(S()),size:D(A()),annotations:kt.optional(),_meta:D(p({}))}),jt=g({...it.shape,...rt.shape,uriTemplate:S(),description:D(S()),mimeType:D(S()),annotations:kt.optional(),_meta:D(p({}))}),Mt=St.extend({method:E(`resources/list`)}),Nt=Ct.extend({resources:C(At)}),Pt=St.extend({method:E(`resources/templates/list`)}),Ft=Ct.extend({resourceTemplates:C(jt)}),G=R.extend({uri:S()}),It=G,Lt=z.extend({method:E(`resources/read`),params:It}),Rt=H.extend({contents:C(u([Tt,Dt]))}),zt=V.extend({method:E(`notifications/resources/list_changed`),params:B.optional()}),Bt=G,Vt=z.extend({method:E(`resources/subscribe`),params:Bt}),Ht=G,Ut=z.extend({method:E(`resources/unsubscribe`),params:Ht}),Wt=g({toolsListChanged:j().optional(),promptsListChanged:j().optional(),resourcesListChanged:j().optional(),resourceSubscriptions:C(S()).optional()}),Gt=R.extend({notifications:Wt}),Kt=z.extend({method:E(`subscriptions/listen`),params:Gt}),qt=B.extend({notifications:Wt}),Jt=V.extend({method:E(`notifications/subscriptions/acknowledged`),params:qt}),Yt=Ke.extend({[Ie]:qe}),Xt=H.extend({_meta:Yt}),Zt=B.extend({uri:S()}),Qt=V.extend({method:E(`notifications/resources/updated`),params:Zt}),$t=g({name:S(),description:D(S()),required:D(j())}),en=g({...it.shape,...rt.shape,description:D(S()),arguments:D(C($t)),_meta:D(p({}))}),K=St.extend({method:E(`prompts/list`)}),tn=Ct.extend({prompts:C(en)}),nn=R.extend({name:S(),arguments:O(S(),S()).optional()}),rn=z.extend({method:E(`prompts/get`),params:nn}),an=g({type:E(`text`),text:S(),annotations:kt.optional(),_meta:O(S(),k()).optional()}),on=g({type:E(`image`),data:Et,mimeType:S(),annotations:kt.optional(),_meta:O(S(),k()).optional()}),sn=g({type:E(`audio`),data:Et,mimeType:S(),annotations:kt.optional(),_meta:O(S(),k()).optional()}),cn=g({type:E(`tool_use`),name:S(),id:S(),input:O(S(),k()),_meta:O(S(),k()).optional()}),ln=g({type:E(`resource`),resource:u([Tt,Dt]),annotations:kt.optional(),_meta:O(S(),k()).optional()}),un=At.extend({type:E(`resource_link`)}),dn=u([an,on,sn,un,ln]),fn=g({role:Ot,content:dn}),pn=H.extend({description:S().optional(),messages:C(fn)}),mn=V.extend({method:E(`notifications/prompts/list_changed`),params:B.optional()}),hn=g({title:S().optional(),readOnlyHint:j().optional(),destructiveHint:j().optional(),idempotentHint:j().optional(),openWorldHint:j().optional()}),gn=g({taskSupport:x([`required`,`optional`,`forbidden`]).optional()}),_n=g({...it.shape,...rt.shape,description:S().optional(),inputSchema:g({type:E(`object`),properties:O(S(),Re).optional(),required:C(S()).optional()}).catchall(k()),outputSchema:p({$schema:S().optional()}).optional(),annotations:hn.optional(),execution:gn.optional(),_meta:O(S(),k()).optional()}),vn=St.extend({method:E(`tools/list`)}),yn=Ct.extend({tools:C(_n)}),bn=H.extend({content:C(dn).default([]),structuredContent:k().optional(),isError:j().optional()}),xn=bn.or(H.extend({toolResult:k()})),Sn=Ge.extend({name:S(),arguments:O(S(),k()).optional()}),Cn=z.extend({method:E(`tools/call`),params:Sn}),wn=V.extend({method:E(`notifications/tools/list_changed`),params:B.optional()}),Tn=g({autoRefresh:j().default(!0),debounceMs:A().int().nonnegative().default(300)}),En=x([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),Dn=R.extend({level:En}),On=z.extend({method:E(`logging/setLevel`),params:Dn}),kn=B.extend({level:En,logger:S().optional(),data:k()}),An=V.extend({method:E(`notifications/message`),params:kn}),jn=g({name:S().optional()}),Mn=g({hints:C(jn).optional(),costPriority:A().min(0).max(1).optional(),speedPriority:A().min(0).max(1).optional(),intelligencePriority:A().min(0).max(1).optional()}),Nn=g({mode:x([`auto`,`required`,`none`]).optional()}),Pn=g({type:E(`tool_result`),toolUseId:S().describe(`The unique identifier for the corresponding tool call.`),content:C(dn),structuredContent:k().optional(),isError:j().optional(),_meta:O(S(),k()).optional()}),Fn=d(`type`,[an,on,sn]),In=d(`type`,[an,on,sn,cn,Pn]),Ln=g({role:Ot,content:u([In,C(In)]),_meta:O(S(),k()).optional()}),Rn=Ge.extend({messages:C(Ln),modelPreferences:Mn.optional(),systemPrompt:S().optional(),includeContext:x([`none`,`thisServer`,`allServers`]).optional(),temperature:A().optional(),maxTokens:A().int(),stopSequences:C(S()).optional(),metadata:L.optional(),tools:C(_n).optional(),toolChoice:Nn.optional()}),zn=z.extend({method:E(`sampling/createMessage`),params:Rn}),Bn=H.extend({model:S(),stopReason:D(x([`endTurn`,`stopSequence`,`maxTokens`]).or(S())),role:Ot,content:Fn}),Vn=H.extend({model:S(),stopReason:D(x([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(S())),role:Ot,content:u([In,C(In)])}),Hn=g({type:E(`boolean`),title:S().optional(),description:S().optional(),default:j().optional()}),Un=g({type:E(`string`),title:S().optional(),description:S().optional(),minLength:A().optional(),maxLength:A().optional(),format:x([`email`,`uri`,`date`,`date-time`]).optional(),default:S().optional()}),Wn=g({type:x([`number`,`integer`]),title:S().optional(),description:S().optional(),minimum:A().optional(),maximum:A().optional(),default:A().optional()}),Gn=g({type:E(`string`),title:S().optional(),description:S().optional(),enum:C(S()),default:S().optional()}),Kn=g({type:E(`string`),title:S().optional(),description:S().optional(),oneOf:C(g({const:S(),title:S()})),default:S().optional()}),qn=g({type:E(`string`),title:S().optional(),description:S().optional(),enum:C(S()),enumNames:C(S()).optional(),default:S().optional()}),Jn=u([Gn,Kn]),Yn=g({type:E(`array`),title:S().optional(),description:S().optional(),minItems:A().optional(),maxItems:A().optional(),items:g({type:E(`string`),enum:C(S())}),default:C(S()).optional()}),Xn=g({type:E(`array`),title:S().optional(),description:S().optional(),minItems:A().optional(),maxItems:A().optional(),items:g({anyOf:C(g({const:S(),title:S()}))}),default:C(S()).optional()}),Zn=u([Yn,Xn]),Qn=u([qn,Jn,Zn]),$n=u([Qn,Hn,Un,Wn]),er=Ge.extend({mode:E(`form`).optional(),message:S(),requestedSchema:g({type:E(`object`),properties:O(S(),$n),required:C(S()).optional()}).catchall(k())}),tr=Ge.extend({mode:E(`url`),message:S(),elicitationId:S(),url:S().url()}),nr=u([er,tr]),rr=z.extend({method:E(`elicitation/create`),params:nr}),ir=B.extend({elicitationId:S()}),ar=V.extend({method:E(`notifications/elicitation/complete`),params:ir}),or=H.extend({action:x([`accept`,`decline`,`cancel`]),content:ee(e=>e===null?void 0:e,O(S(),u([S(),A(),j(),C(S())])).optional())}),sr=g({type:E(`ref/resource`),uri:S()}),cr=g({type:E(`ref/prompt`),name:S()}),lr=R.extend({ref:u([cr,sr]),argument:g({name:S(),value:S()}),context:g({arguments:O(S(),S()).optional()}).optional()}),ur=z.extend({method:E(`completion/complete`),params:lr}),dr=H.extend({completion:p({values:C(S()).max(100),total:D(A().int()),hasMore:D(j())})}),fr=g({uri:S().startsWith(`file://`),name:S().optional(),_meta:O(S(),k()).optional()}),pr=z.extend({method:E(`roots/list`),params:R.optional()}),mr=H.extend({roots:C(fr)}),hr=V.extend({method:E(`notifications/roots/list_changed`),params:B.optional()}),gr=p({ttl:A().optional(),pollInterval:A().optional()}),_r=x([`working`,`input_required`,`completed`,`failed`,`cancelled`]),vr=g({taskId:S(),status:_r,ttl:u([A(),f()]),createdAt:S(),lastUpdatedAt:S(),pollInterval:D(A()),statusMessage:D(S())}),yr=H.extend({task:vr}),br=B.merge(vr),xr=V.extend({method:E(`notifications/tasks/status`),params:br}),Sr=z.extend({method:E(`tasks/get`),params:R.extend({taskId:S()})}),Cr=H.merge(vr),wr=z.extend({method:E(`tasks/result`),params:R.extend({taskId:S()})}),Tr=H.loose(),Er=St.extend({method:E(`tasks/list`)}),Dr=Ct.extend({tasks:C(vr)}),Or=z.extend({method:E(`tasks/cancel`),params:R.extend({taskId:S()})}),kr=H.merge(vr),Ar=u([_t,dt,ht,ur,On,rn,K,Mt,Pt,Lt,Vt,Ut,Kt,Cn,vn]),jr=u([tt,bt,mt,hr]),Mr=u([$e,Bn,Vn,or,mr]),Nr=u([_t,zn,rr,pr]),Pr=u([tt,bt,An,Qt,zt,wn,mn,Jt,ar]),Fr=u([$e,pt,gt,dr,pn,tn,Nt,Ft,Rt,bn,yn,Xt]),q=ce().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:ue.custom,message:`URL must be parseable`,fatal:!0}),se}).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`}),Ir=p({resource:S().url(),authorization_servers:C(q).optional(),jwks_uri:S().url().optional(),scopes_supported:C(S()).optional(),bearer_methods_supported:C(S()).optional(),resource_signing_alg_values_supported:C(S()).optional(),resource_name:S().optional(),resource_documentation:S().optional(),resource_policy_uri:S().url().optional(),resource_tos_uri:S().url().optional(),tls_client_certificate_bound_access_tokens:j().optional(),authorization_details_types_supported:C(S()).optional(),dpop_signing_alg_values_supported:C(S()).optional(),dpop_bound_access_tokens_required:j().optional()}),Lr=p({issuer:S(),authorization_endpoint:q,token_endpoint:q,registration_endpoint:q.optional(),scopes_supported:C(S()).optional(),response_types_supported:C(S()),response_modes_supported:C(S()).optional(),grant_types_supported:C(S()).optional(),token_endpoint_auth_methods_supported:C(S()).optional(),token_endpoint_auth_signing_alg_values_supported:C(S()).optional(),service_documentation:q.optional(),revocation_endpoint:q.optional(),revocation_endpoint_auth_methods_supported:C(S()).optional(),revocation_endpoint_auth_signing_alg_values_supported:C(S()).optional(),introspection_endpoint:S().optional(),introspection_endpoint_auth_methods_supported:C(S()).optional(),introspection_endpoint_auth_signing_alg_values_supported:C(S()).optional(),code_challenge_methods_supported:C(S()).optional(),client_id_metadata_document_supported:j().optional(),authorization_response_iss_parameter_supported:j().optional().catch(void 0),dpop_signing_alg_values_supported:C(S()).optional()}),Rr=p({issuer:S(),authorization_endpoint:q,token_endpoint:q,userinfo_endpoint:q.optional(),jwks_uri:q,registration_endpoint:q.optional(),scopes_supported:C(S()).optional(),response_types_supported:C(S()),response_modes_supported:C(S()).optional(),grant_types_supported:C(S()).optional(),acr_values_supported:C(S()).optional(),subject_types_supported:C(S()),id_token_signing_alg_values_supported:C(S()),id_token_encryption_alg_values_supported:C(S()).optional(),id_token_encryption_enc_values_supported:C(S()).optional(),userinfo_signing_alg_values_supported:C(S()).optional(),userinfo_encryption_alg_values_supported:C(S()).optional(),userinfo_encryption_enc_values_supported:C(S()).optional(),request_object_signing_alg_values_supported:C(S()).optional(),request_object_encryption_alg_values_supported:C(S()).optional(),request_object_encryption_enc_values_supported:C(S()).optional(),token_endpoint_auth_methods_supported:C(S()).optional(),token_endpoint_auth_signing_alg_values_supported:C(S()).optional(),display_values_supported:C(S()).optional(),claim_types_supported:C(S()).optional(),claims_supported:C(S()).optional(),service_documentation:S().optional(),claims_locales_supported:C(S()).optional(),ui_locales_supported:C(S()).optional(),claims_parameter_supported:j().optional(),request_parameter_supported:j().optional(),request_uri_parameter_supported:j().optional(),require_request_uri_registration:j().optional(),op_policy_uri:q.optional(),op_tos_uri:q.optional(),client_id_metadata_document_supported:j().optional(),authorization_response_iss_parameter_supported:j().optional().catch(void 0)}),zr=g({...Rr.shape,...Lr.pick({code_challenge_methods_supported:!0}).shape}),Br=g({access_token:S(),id_token:S().optional(),token_type:S(),expires_in:me().optional(),scope:S().optional(),refresh_token:S().optional(),issuer:S().optional().catch(void 0)}).strip(),Vr=g({issued_token_type:E(`urn:ietf:params:oauth:token-type:id-jag`),access_token:S(),token_type:S().optional(),expires_in:A().optional(),scope:S().optional()}).strip(),Hr=g({error:S(),error_description:S().optional(),error_uri:S().optional()}),Ur=q.optional().or(E(``).transform(()=>void 0)),Wr=g({redirect_uris:C(q),token_endpoint_auth_method:S().optional(),grant_types:C(S()).optional(),response_types:C(S()).optional(),application_type:S().optional(),client_name:S().optional(),client_uri:q.optional(),logo_uri:Ur,scope:S().optional(),contacts:C(S()).optional(),tos_uri:Ur,policy_uri:S().optional(),jwks_uri:q.optional(),jwks:v().optional(),software_id:S().optional(),software_version:S().optional(),software_statement:S().optional()}).strip(),Gr=g({client_id:S(),client_secret:S().optional(),client_id_issued_at:A().optional(),client_secret_expires_at:A().optional(),issuer:S().optional().catch(void 0)}).strip(),Kr=Wr.merge(Gr),qr=g({error:S(),error_description:S().optional()}).strip(),Jr=g({token:S(),token_type_hint:S().optional()}).strip(),Yr=Symbol.for(`mcp.sdk.errorBrands`);function Xr(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,Yr,{value:n,enumerable:!1,configurable:!0})}function Zr(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Yr)){let n=t[Yr];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var Qr=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}({}),$r=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return Zr(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 Zr(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Xr(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 Zr(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 Zr(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,Xr(this,new.target)}},ei=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 ti(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function ni(e){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t={...e};return delete t.issuer,t}function ri({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=ii}function si(e){return e.filter(e=>!oi(e))}function ci(e){return e.filter(e=>oi(e))}function li(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 ui=[`task`,`inputRequests`,`requestState`];function di(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||ui.some(t=>t in e)?e:{...e,content:[]}}function fi(){let e=w(()=>u([S(),A(),j(),f(),O(S(),e),C(e)])),t=O(S(),e),n=u([S(),A().int()]),r=S(),i=g({ttl:A().optional()}),a=g({taskId:S()}),o=p({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=g({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=g({method:S(),params:s.loose().optional()}),h=g({_meta:o.optional()}),_=g({method:S(),params:h.loose().optional()}),v=p({_meta:o.optional()}),y=u([S(),A().int()]),b=v.strict(),T=h.extend({requestId:y.optional(),reason:S().optional()}),te=_.extend({method:E(`notifications/cancelled`),params:T}),ne=g({src:S(),mimeType:S().optional(),sizes:C(S()).optional(),theme:x([`light`,`dark`]).optional()}),re=g({icons:C(ne).optional()}),ie=g({name:S(),title:S().optional()}),ae=ie.extend({...ie.shape,...re.shape,version:S(),websiteUrl:S().optional(),description:S().optional()}),oe=m(g({applyDefaults:j().optional()}),t),se=ee(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,m(g({form:oe.optional(),url:t.optional()}),t.optional())),ce=p({list:t.optional(),cancel:t.optional(),requests:p({sampling:p({createMessage:t.optional()}).optional(),elicitation:p({create:t.optional()}).optional()}).optional()}),le=p({list:t.optional(),cancel:t.optional(),requests:p({tools:p({call:t.optional()}).optional()}).optional()}),ue=g({experimental:O(S(),t).optional(),sampling:g({context:t.optional(),tools:t.optional()}).optional(),elicitation:se.optional(),roots:g({listChanged:j().optional()}).optional(),tasks:ce.optional(),extensions:O(S(),t).optional()}),de=s.extend({protocolVersion:S(),capabilities:ue,clientInfo:ae}),pe=l.extend({method:E(`initialize`),params:de}),me=g({experimental:O(S(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:g({listChanged:j().optional()}).optional(),resources:g({subscribe:j().optional(),listChanged:j().optional()}).optional(),tools:g({listChanged:j().optional()}).optional(),tasks:le.optional(),extensions:O(S(),t).optional()}),M=v.extend({protocolVersion:S(),capabilities:me,serverInfo:ae,instructions:S().optional()}),N=_.extend({method:E(`notifications/initialized`),params:h.optional()}),he=l.extend({method:E(`ping`),params:s.optional()}),P=g({progress:A(),total:D(A()),message:D(S())}),F=g({...h.shape,...P.shape,progressToken:n}),ge=_.extend({method:E(`notifications/progress`),params:F}),_e=s.extend({cursor:r.optional()}),ve=l.extend({params:_e.optional()}),ye=v.extend({nextCursor:r.optional()}),I=g({uri:S(),mimeType:D(S()),_meta:O(S(),k()).optional()}),be=I.extend({text:S()}),xe=S().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Se=I.extend({blob:xe}),Ce=x([`user`,`assistant`]),we=g({audience:C(Ce).optional(),priority:A().min(0).max(1).optional(),lastModified:fe({offset:!0}).optional()}),Te=g({...ie.shape,...re.shape,uri:S(),description:D(S()),mimeType:D(S()),size:D(A()),annotations:we.optional(),_meta:D(p({}))}),Ee=g({...ie.shape,...re.shape,uriTemplate:S(),description:D(S()),mimeType:D(S()),annotations:we.optional(),_meta:D(p({}))}),De=ve.extend({method:E(`resources/list`)}),Oe=ye.extend({resources:C(Te)}),ke=ve.extend({method:E(`resources/templates/list`)}),Ae=ye.extend({resourceTemplates:C(Ee)}),je=s.extend({uri:S()}),Me=je,Ne=l.extend({method:E(`resources/read`),params:Me}),Pe=v.extend({contents:C(u([be,Se]))}),Fe=_.extend({method:E(`notifications/resources/list_changed`),params:h.optional()}),Ie=je,Le=l.extend({method:E(`resources/subscribe`),params:Ie}),Re=je,L=l.extend({method:E(`resources/unsubscribe`),params:Re}),ze=h.extend({uri:S()}),Be=_.extend({method:E(`notifications/resources/updated`),params:ze}),Ve=g({name:S(),description:D(S()),required:D(j())}),He=g({...ie.shape,...re.shape,description:D(S()),arguments:D(C(Ve)),_meta:D(p({}))}),Ue=ve.extend({method:E(`prompts/list`)}),We=ye.extend({prompts:C(He)}),R=s.extend({name:S(),arguments:O(S(),S()).optional()}),Ge=l.extend({method:E(`prompts/get`),params:R}),z=g({type:E(`text`),text:S(),annotations:we.optional(),_meta:O(S(),k()).optional()}),B=g({type:E(`image`),data:xe,mimeType:S(),annotations:we.optional(),_meta:O(S(),k()).optional()}),V=g({type:E(`audio`),data:xe,mimeType:S(),annotations:we.optional(),_meta:O(S(),k()).optional()}),Ke=g({type:E(`tool_use`),name:S(),id:S(),input:O(S(),k()),_meta:O(S(),k()).optional()}),H=g({type:E(`resource`),resource:u([be,Se]),annotations:we.optional(),_meta:O(S(),k()).optional()}),qe=Te.extend({type:E(`resource_link`)}),Je=u([z,B,V,qe,H]),Ye=g({role:Ce,content:Je}),Xe=v.extend({description:S().optional(),messages:C(Ye)}),Ze=_.extend({method:E(`notifications/prompts/list_changed`),params:h.optional()}),U=g({title:S().optional(),readOnlyHint:j().optional(),destructiveHint:j().optional(),idempotentHint:j().optional(),openWorldHint:j().optional()}),Qe=g({taskSupport:x([`required`,`optional`,`forbidden`]).optional()}),$e=g({...ie.shape,...re.shape,description:S().optional(),inputSchema:g({type:E(`object`),properties:O(S(),e).optional(),required:C(S()).optional()}).catchall(k()),outputSchema:g({type:E(`object`),properties:O(S(),e).optional(),required:C(S()).optional()}).catchall(k()).optional(),annotations:U.optional(),execution:Qe.optional(),_meta:O(S(),k()).optional()}),et=ve.extend({method:E(`tools/list`)}),tt=ye.extend({tools:C($e)}),nt=v.extend({content:C(Je),structuredContent:O(S(),k()).optional(),isError:j().optional()}),rt=c.extend({name:S(),arguments:O(S(),k()).optional()}),it=l.extend({method:E(`tools/call`),params:rt}),at=_.extend({method:E(`notifications/tools/list_changed`),params:h.optional()}),ot=x([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),W=s.extend({level:ot}),st=l.extend({method:E(`logging/setLevel`),params:W}),ct=h.extend({level:ot,logger:S().optional(),data:k()}),lt=_.extend({method:E(`notifications/message`),params:ct}),ut=g({name:S().optional()}),dt=g({hints:C(ut).optional(),costPriority:A().min(0).max(1).optional(),speedPriority:A().min(0).max(1).optional(),intelligencePriority:A().min(0).max(1).optional()}),ft=g({mode:x([`auto`,`required`,`none`]).optional()}),pt=g({type:E(`tool_result`),toolUseId:S().describe(`The unique identifier for the corresponding tool call.`),content:C(Je),structuredContent:g({}).loose().optional(),isError:j().optional(),_meta:O(S(),k()).optional()}),mt=d(`type`,[z,B,V]),ht=d(`type`,[z,B,V,Ke,pt]),gt=g({role:Ce,content:u([ht,C(ht)]),_meta:O(S(),k()).optional()}),_t=c.extend({messages:C(gt),modelPreferences:dt.optional(),systemPrompt:S().optional(),includeContext:x([`none`,`thisServer`,`allServers`]).optional(),temperature:A().optional(),maxTokens:A().int(),stopSequences:C(S()).optional(),metadata:t.optional(),tools:C($e).optional(),toolChoice:ft.optional()}),vt=l.extend({method:E(`sampling/createMessage`),params:_t}),yt=v.extend({model:S(),stopReason:D(x([`endTurn`,`stopSequence`,`maxTokens`]).or(S())),role:Ce,content:mt}),bt=v.extend({model:S(),stopReason:D(x([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(S())),role:Ce,content:u([ht,C(ht)])}),xt=g({type:E(`boolean`),title:S().optional(),description:S().optional(),default:j().optional()}),St=g({type:E(`string`),title:S().optional(),description:S().optional(),minLength:A().optional(),maxLength:A().optional(),format:x([`email`,`uri`,`date`,`date-time`]).optional(),default:S().optional()}),Ct=g({type:x([`number`,`integer`]),title:S().optional(),description:S().optional(),minimum:A().optional(),maximum:A().optional(),default:A().optional()}),wt=g({type:E(`string`),title:S().optional(),description:S().optional(),enum:C(S()),default:S().optional()}),Tt=g({type:E(`string`),title:S().optional(),description:S().optional(),oneOf:C(g({const:S(),title:S()})),default:S().optional()}),Et=g({type:E(`string`),title:S().optional(),description:S().optional(),enum:C(S()),enumNames:C(S()).optional(),default:S().optional()}),Dt=u([wt,Tt]),Ot=g({type:E(`array`),title:S().optional(),description:S().optional(),minItems:A().optional(),maxItems:A().optional(),items:g({type:E(`string`),enum:C(S())}),default:C(S()).optional()}),kt=g({type:E(`array`),title:S().optional(),description:S().optional(),minItems:A().optional(),maxItems:A().optional(),items:g({anyOf:C(g({const:S(),title:S()}))}),default:C(S()).optional()}),At=u([Ot,kt]),jt=u([Et,Dt,At]),Mt=u([jt,xt,St,Ct]),Nt=c.extend({mode:E(`form`).optional(),message:S(),requestedSchema:g({type:E(`object`),properties:O(S(),Mt),required:C(S()).optional()}).catchall(k())}),Pt=c.extend({mode:E(`url`),message:S(),elicitationId:S(),url:S().url()}),Ft=u([Nt,Pt]),G=l.extend({method:E(`elicitation/create`),params:Ft}),It=h.extend({elicitationId:S()}),Lt=_.extend({method:E(`notifications/elicitation/complete`),params:It}),Rt=v.extend({action:x([`accept`,`decline`,`cancel`]),content:ee(e=>e===null?void 0:e,O(S(),u([S(),A(),j(),C(S())])).optional())}),zt=g({type:E(`ref/resource`),uri:S()}),Bt=g({type:E(`ref/prompt`),name:S()}),Vt=s.extend({ref:u([Bt,zt]),argument:g({name:S(),value:S()}),context:g({arguments:O(S(),S()).optional()}).optional()}),Ht=l.extend({method:E(`completion/complete`),params:Vt}),Ut=v.extend({completion:p({values:C(S()).max(100),total:D(A().int()),hasMore:D(j())})}),Wt=g({uri:S().startsWith(`file://`),name:S().optional(),_meta:O(S(),k()).optional()}),Gt=l.extend({method:E(`roots/list`),params:s.optional()}),Kt=v.extend({roots:C(Wt)}),qt=_.extend({method:E(`notifications/roots/list_changed`),params:h.optional()}),Jt=p({ttl:A().optional(),pollInterval:A().optional()}),Yt=x([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Xt=g({taskId:S(),status:Yt,ttl:u([A(),f()]),createdAt:S(),lastUpdatedAt:S(),pollInterval:D(A()),statusMessage:D(S())}),Zt=v.extend({task:Xt}),Qt=h.merge(Xt),$t=_.extend({method:E(`notifications/tasks/status`),params:Qt}),en=l.extend({method:E(`tasks/get`),params:s.extend({taskId:S()})}),K=v.merge(Xt),tn=l.extend({method:E(`tasks/result`),params:s.extend({taskId:S()})}),nn=v.loose(),rn=ve.extend({method:E(`tasks/list`)}),an=ye.extend({tasks:C(Xt)}),on=l.extend({method:E(`tasks/cancel`),params:s.extend({taskId:S()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:h,NotificationSchema:_,ResultSchema:v,RequestIdSchema:y,EmptyResultSchema:b,CancelledNotificationParamsSchema:T,CancelledNotificationSchema:te,IconSchema:ne,IconsSchema:re,BaseMetadataSchema:ie,ImplementationSchema:ae,ClientTasksCapabilitySchema:ce,ServerTasksCapabilitySchema:le,ClientCapabilitiesSchema:ue,InitializeRequestParamsSchema:de,InitializeRequestSchema:pe,ServerCapabilitiesSchema:me,InitializeResultSchema:M,InitializedNotificationSchema:N,PingRequestSchema:he,ProgressSchema:P,ProgressNotificationParamsSchema:F,ProgressNotificationSchema:ge,PaginatedRequestParamsSchema:_e,PaginatedRequestSchema:ve,PaginatedResultSchema:ye,ResourceContentsSchema:I,TextResourceContentsSchema:be,BlobResourceContentsSchema:Se,RoleSchema:Ce,AnnotationsSchema:we,ResourceSchema:Te,ResourceTemplateSchema:Ee,ListResourcesRequestSchema:De,ListResourcesResultSchema:Oe,ListResourceTemplatesRequestSchema:ke,ListResourceTemplatesResultSchema:Ae,ResourceRequestParamsSchema:je,ReadResourceRequestParamsSchema:Me,ReadResourceRequestSchema:Ne,ReadResourceResultSchema:Pe,ResourceListChangedNotificationSchema:Fe,SubscribeRequestParamsSchema:Ie,SubscribeRequestSchema:Le,UnsubscribeRequestParamsSchema:Re,UnsubscribeRequestSchema:L,ResourceUpdatedNotificationParamsSchema:ze,ResourceUpdatedNotificationSchema:Be,PromptArgumentSchema:Ve,PromptSchema:He,ListPromptsRequestSchema:Ue,ListPromptsResultSchema:We,GetPromptRequestParamsSchema:R,GetPromptRequestSchema:Ge,TextContentSchema:z,ImageContentSchema:B,AudioContentSchema:V,ToolUseContentSchema:Ke,EmbeddedResourceSchema:H,ResourceLinkSchema:qe,ContentBlockSchema:Je,PromptMessageSchema:Ye,GetPromptResultSchema:Xe,PromptListChangedNotificationSchema:Ze,ToolAnnotationsSchema:U,ToolExecutionSchema:Qe,ToolSchema:$e,ListToolsRequestSchema:et,ListToolsResultSchema:tt,CallToolResultSchema:nt,CallToolRequestParamsSchema:rt,CallToolRequestSchema:it,ToolListChangedNotificationSchema:at,LoggingLevelSchema:ot,SetLevelRequestParamsSchema:W,SetLevelRequestSchema:st,LoggingMessageNotificationParamsSchema:ct,LoggingMessageNotificationSchema:lt,ModelHintSchema:ut,ModelPreferencesSchema:dt,ToolChoiceSchema:ft,ToolResultContentSchema:pt,SamplingContentSchema:mt,SamplingMessageContentBlockSchema:ht,SamplingMessageSchema:gt,CreateMessageRequestParamsSchema:_t,CreateMessageRequestSchema:vt,CreateMessageResultSchema:yt,CreateMessageResultWithToolsSchema:bt,BooleanSchemaSchema:xt,StringSchemaSchema:St,NumberSchemaSchema:Ct,UntitledSingleSelectEnumSchemaSchema:wt,TitledSingleSelectEnumSchemaSchema:Tt,LegacyTitledEnumSchemaSchema:Et,SingleSelectEnumSchemaSchema:Dt,UntitledMultiSelectEnumSchemaSchema:Ot,TitledMultiSelectEnumSchemaSchema:kt,MultiSelectEnumSchemaSchema:At,EnumSchemaSchema:jt,PrimitiveSchemaDefinitionSchema:Mt,ElicitRequestFormParamsSchema:Nt,ElicitRequestURLParamsSchema:Pt,ElicitRequestParamsSchema:Ft,ElicitRequestSchema:G,ElicitationCompleteNotificationParamsSchema:It,ElicitationCompleteNotificationSchema:Lt,ElicitResultSchema:Rt,ResourceTemplateReferenceSchema:zt,PromptReferenceSchema:Bt,CompleteRequestParamsSchema:Vt,CompleteRequestSchema:Ht,CompleteResultSchema:Ut,RootSchema:Wt,ListRootsRequestSchema:Gt,ListRootsResultSchema:Kt,RootsListChangedNotificationSchema:qt,TaskCreationParamsSchema:Jt,TaskStatusSchema:Yt,TaskSchema:Xt,CreateTaskResultSchema:Zt,TaskStatusNotificationParamsSchema:Qt,TaskStatusNotificationSchema:$t,GetTaskRequestSchema:en,GetTaskResultSchema:K,GetTaskPayloadRequestSchema:tn,GetTaskPayloadResultSchema:nn,ListTasksRequestSchema:rn,ListTasksResultSchema:an,CancelTaskRequestSchema:on,CancelTaskResultSchema:v.merge(Xt),ClientRequestSchema:u([he,pe,Ht,st,Ge,Ue,De,ke,Ne,Le,L,it,et,en,tn,rn,on]),ClientNotificationSchema:u([te,ge,N,qt,$t]),ClientResultSchema:u([b,yt,bt,Rt,Kt,K,an,Zt]),ServerRequestSchema:u([he,vt,G,Gt,en,tn,rn,on]),ServerNotificationSchema:u([te,ge,lt,Be,Fe,at,Ze,$t,Lt]),ServerResultSchema:u([b,M,Ut,Xe,We,Oe,Ae,Pe,nt,tt,K,an,Zt]),CallToolResultWireSchema:k().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of ui)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(di).pipe(nt)}}var pi;function mi(){return pi??=fi()}function hi(e){return e.type!==`object`}var gi=new Set([`const`,`enum`,`default`,`examples`]),_i=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function vi(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function yi(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(vi(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=De(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&&vi(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]=gi.has(o)?s:_i.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 bi={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},xi={"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},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,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ci;function wi(){if(Ci)return Ci;let e=mi();return Ci={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}},Ci}function Ti(e){return Object.prototype.hasOwnProperty.call(bi,e)}function Ei(e){return Object.prototype.hasOwnProperty.call(xi,e)}function Di(e){return Object.prototype.hasOwnProperty.call(Si,e)}function Oi(e){return Di(e)?wi().resultSchemas[e]:void 0}function ki(e){return Ti(e)?wi().requestSchemas[e]:void 0}function Ai(e){return Ei(e)?wi().notificationSchemas[e]:void 0}Object.keys(bi),Object.keys(xi);function ji(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Mi(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 Ni={ok:!1,reason:`not-in-era`};function Pi(e){return ji(e)&&ji(e.outputSchema)&&hi(e.outputSchema)}function Fi(e){return e}var Ii={era:`2025-11-25`,hasRequestMethod:Ti,hasNotificationMethod:Ei,validateRequest:(e,t)=>Mi(ki(e),t),validateResult:(e,t)=>Mi(Oi(e),t),validateNotification:(e,t)=>Mi(Ai(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Ni,validateInputResponse:()=>Ni,samplingResultVariant:((e,t)=>{let n=mi();return Mi(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=li(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&hi(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(ji(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:Fi(e)}}return{kind:`complete`,result:Fi(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>Pi(e))?t:{...t,tools:n.map(e=>Pi(e)?{...e,outputSchema:yi(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function Li(){let e=w(()=>u([S(),A(),j(),f(),O(S(),e),C(e)])),t=O(S(),e),n=u([S(),A().int()]),r=S(),i=u([S(),A().int()]),a=x([`user`,`assistant`]),o=x([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=S().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=g({ttl:A().optional()}),l=g({taskId:S()}),d=p({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),h=g({_meta:d.optional()}),_=h.extend({task:c.optional()}),v=g({_meta:d.optional()}),y=g({method:S(),params:v.loose().optional()}),b=g({src:S(),mimeType:S().optional(),sizes:C(S()).optional(),theme:x([`light`,`dark`]).optional()}),T=g({icons:C(b).optional()}),te=g({name:S(),title:S().optional()}),ne=te.extend({...te.shape,...T.shape,version:S(),websiteUrl:S().optional(),description:S().optional()}),re=m(g({applyDefaults:j().optional()}),t),ie=ee(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,m(g({form:re.optional(),url:t.optional()}),t.optional())),ae=p({list:t.optional(),cancel:t.optional(),requests:p({sampling:p({createMessage:t.optional()}).optional(),elicitation:p({create:t.optional()}).optional()}).optional()}),oe=p({list:t.optional(),cancel:t.optional(),requests:p({tools:p({call:t.optional()}).optional()}).optional()}),se=g({experimental:O(S(),t).optional(),sampling:g({context:t.optional(),tools:t.optional()}).optional(),elicitation:ie.optional(),roots:g({listChanged:j().optional()}).optional(),tasks:ae.optional(),extensions:O(S(),t).optional()}),ce=g({experimental:O(S(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:g({listChanged:j().optional()}).optional(),resources:g({subscribe:j().optional(),listChanged:j().optional()}).optional(),tools:g({listChanged:j().optional()}).optional(),tasks:oe.optional(),extensions:O(S(),t).optional()}),le=g({progress:A(),total:D(A()),message:D(S())}),ue=g({...v.shape,...le.shape,progressToken:n}),de=y.extend({method:E(`notifications/progress`),params:ue}),pe=v.extend({level:o,logger:S().optional(),data:k()}),me=y.extend({method:E(`notifications/message`),params:pe}),M=g({uri:S(),mimeType:D(S()),_meta:O(S(),k()).optional()}),N=M.extend({text:S()}),he=M.extend({blob:s}),P=g({audience:C(a).optional(),priority:A().min(0).max(1).optional(),lastModified:fe({offset:!0}).optional()}),F=g({...te.shape,...T.shape,uri:S(),description:D(S()),mimeType:D(S()),size:D(A()),annotations:P.optional(),_meta:D(p({}))}),ge=g({...te.shape,...T.shape,uriTemplate:S(),description:D(S()),mimeType:D(S()),annotations:P.optional(),_meta:D(p({}))}),_e=y.extend({method:E(`notifications/resources/list_changed`),params:v.optional()}),ve=v.extend({uri:S()}),ye=y.extend({method:E(`notifications/resources/updated`),params:ve}),I=g({name:S(),description:D(S()),required:D(j())}),be=g({...te.shape,...T.shape,description:D(S()),arguments:D(C(I)),_meta:D(p({}))}),xe=y.extend({method:E(`notifications/prompts/list_changed`),params:v.optional()}),Se=g({type:E(`text`),text:S(),annotations:P.optional(),_meta:O(S(),k()).optional()}),Ce=g({type:E(`image`),data:s,mimeType:S(),annotations:P.optional(),_meta:O(S(),k()).optional()}),we=g({type:E(`audio`),data:s,mimeType:S(),annotations:P.optional(),_meta:O(S(),k()).optional()}),Te=g({type:E(`tool_use`),name:S(),id:S(),input:O(S(),k()),_meta:O(S(),k()).optional()}),Ee=g({type:E(`resource`),resource:u([N,he]),annotations:P.optional(),_meta:O(S(),k()).optional()}),De=F.extend({type:E(`resource_link`)}),Oe=u([Se,Ce,we,De,Ee]),ke=g({role:a,content:Oe}),Ae=g({title:S().optional(),readOnlyHint:j().optional(),destructiveHint:j().optional(),idempotentHint:j().optional(),openWorldHint:j().optional()}),je=y.extend({method:E(`notifications/tools/list_changed`),params:v.optional()}),Ie=g({name:S().optional()}),Re=g({hints:C(Ie).optional(),costPriority:A().min(0).max(1).optional(),speedPriority:A().min(0).max(1).optional(),intelligencePriority:A().min(0).max(1).optional()}),L=g({mode:x([`auto`,`required`,`none`]).optional()}),ze=g({type:E(`boolean`),title:S().optional(),description:S().optional(),default:j().optional()}),Be=g({type:E(`string`),title:S().optional(),description:S().optional(),minLength:A().optional(),maxLength:A().optional(),format:x([`email`,`uri`,`date`,`date-time`]).optional(),default:S().optional()}),Ve=g({type:x([`number`,`integer`]),title:S().optional(),description:S().optional(),minimum:A().optional(),maximum:A().optional(),default:A().optional()}),He=g({type:E(`string`),title:S().optional(),description:S().optional(),enum:C(S()),default:S().optional()}),Ue=g({type:E(`string`),title:S().optional(),description:S().optional(),oneOf:C(g({const:S(),title:S()})),default:S().optional()}),We=g({type:E(`string`),title:S().optional(),description:S().optional(),enum:C(S()),enumNames:C(S()).optional(),default:S().optional()}),R=u([He,Ue]),Ge=g({type:E(`array`),title:S().optional(),description:S().optional(),minItems:A().optional(),maxItems:A().optional(),items:g({type:E(`string`),enum:C(S())}),default:C(S()).optional()}),z=g({type:E(`array`),title:S().optional(),description:S().optional(),minItems:A().optional(),maxItems:A().optional(),items:g({anyOf:C(g({const:S(),title:S()}))}),default:C(S()).optional()}),B=u([Ge,z]),V=u([We,R,B]),Ke=u([V,ze,Be,Ve]),H=_.extend({mode:E(`form`).optional(),message:S(),requestedSchema:g({type:E(`object`),properties:O(S(),Ke),required:C(S()).optional()}).catchall(k())}),qe=g({type:E(`ref/resource`),uri:S()}),Je=g({type:E(`ref/prompt`),name:S()}),Ye=g({uri:S().startsWith(`file://`),name:S().optional(),_meta:O(S(),k()).optional()}),Xe=se.shape,Ze=g({experimental:Xe.experimental,sampling:Xe.sampling,elicitation:Xe.elicitation,roots:Xe.roots,extensions:Xe.extensions}),U=ce.shape,Qe=g({experimental:U.experimental,logging:U.logging,completions:U.completions,prompts:U.prompts,resources:U.resources,tools:U.tools,extensions:U.extensions}),$e=p({progressToken:n.optional(),[Me]:S(),[Ne]:ne.optional(),[Fe]:Ze,[Le]:o.optional()}),et=g({...te.shape,...T.shape,description:S().optional(),inputSchema:p({$schema:S().optional(),type:E(`object`)}),outputSchema:p({$schema:S().optional()}).optional(),annotations:Ae.optional(),_meta:O(S(),k()).optional()}),tt=g({type:E(`tool_result`),toolUseId:S(),content:C(Oe),structuredContent:k().optional(),isError:j().optional(),_meta:O(S(),k()).optional()}),nt=u([Se,Ce,we,Te,tt]),rt=g({role:a,content:u([nt,C(nt)]),_meta:O(S(),k()).optional()}),it=S(),at=p({[Pe]:ne.optional().catch(void 0)}),ot=at.optional();function W(e){return p({_meta:ot,resultType:it.default(`complete`),...e})}let st=W({}),ct=W({nextCursor:r.optional()}),lt=W({content:C(Oe),structuredContent:k().optional(),isError:j().optional()}),ut=W({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),tools:C(et),nextCursor:r.optional()}),dt=W({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),prompts:C(be),nextCursor:r.optional()}),ft=W({description:S().optional(),messages:C(ke)}),pt=W({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),resources:C(F),nextCursor:r.optional()}),mt=W({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),resourceTemplates:C(ge),nextCursor:r.optional()}),ht=W({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),contents:C(u([N,he]))}),gt=W({completion:g({values:C(S()).max(100),total:A().int().optional(),hasMore:j().optional()}).loose()}),_t=W({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`])}),vt=W({ttlMs:A().int().min(0).catch(0),cacheScope:x([`public`,`private`]).catch(`private`),supportedVersions:C(S()),capabilities:Qe,instructions:S().optional()}),yt=g({messages:C(rt),modelPreferences:Re.optional(),systemPrompt:S().optional(),includeContext:x([`none`,`thisServer`,`allServers`]).optional(),temperature:A().optional(),maxTokens:A().int(),stopSequences:C(S()).optional(),metadata:t.optional(),tools:C(et).optional(),toolChoice:L.optional()}),bt=g({method:E(`sampling/createMessage`),params:yt}),xt=g({method:E(`roots/list`),params:g({_meta:O(S(),k()).optional()}).optional()}),St=g({...rt.shape,model:S(),stopReason:S().optional()}),Ct=g({roots:C(Ye)}),wt=g({action:x([`accept`,`decline`,`cancel`]),content:O(S(),u([S(),A(),j(),C(S())])).optional()}),Tt=g({mode:E(`url`),message:S(),url:S().url()}),Et=u([H,Tt]),Dt=g({method:E(`elicitation/create`),params:Et}),Ot=u([bt,xt,Dt]),kt=u([St,Ct,wt]),At=O(S(),Ot),jt=O(S(),kt),Mt=W({inputRequests:At.optional(),requestState:S().optional()}),Nt={inputResponses:jt.optional(),requestState:S().optional()},Pt=g({_meta:$e,...Nt}),Ft=p({progressToken:n.optional()});function G(e,t){return g({method:E(e),params:g({_meta:$e,...t})})}function It(e,t){return g({method:E(e),params:g({_meta:Ft.optional(),...t}).optional()})}let Lt={name:S(),arguments:O(S(),k()).optional(),...Nt},Rt={cursor:r.optional()},zt=G(`tools/call`,Lt),Bt=G(`tools/list`,Rt),Vt=G(`prompts/list`,Rt),Ht=G(`prompts/get`,{name:S(),arguments:O(S(),S()).optional(),...Nt}),Ut=G(`resources/list`,Rt),Wt=G(`resources/templates/list`,Rt),Gt=G(`resources/read`,{uri:S(),...Nt}),Kt={ref:u([Je,qe]),argument:g({name:S(),value:S()}),context:g({arguments:O(S(),S()).optional()}).optional()},qt=G(`completion/complete`,Kt),Jt=G(`server/discover`,{}),Yt=g({toolsListChanged:j().optional(),promptsListChanged:j().optional(),resourcesListChanged:j().optional(),resourceSubscriptions:C(S()).optional()}),Xt={notifications:Yt},Zt=G(`subscriptions/listen`,Xt),Qt=at.extend({"io.modelcontextprotocol/subscriptionId":i}),$t=p({_meta:Qt,resultType:it.default(`complete`)}),en={"tools/call":It(`tools/call`,Lt),"tools/list":It(`tools/list`,Rt),"prompts/get":It(`prompts/get`,{name:S(),arguments:O(S(),S()).optional()}),"prompts/list":It(`prompts/list`,Rt),"resources/list":It(`resources/list`,Rt),"resources/templates/list":It(`resources/templates/list`,Rt),"resources/read":It(`resources/read`,{uri:S()}),"completion/complete":It(`completion/complete`,Kt),"server/discover":It(`server/discover`,{}),"subscriptions/listen":It(`subscriptions/listen`,Xt)};function K(e){return p({_meta:ot,...e})}let tn={"tools/call":K({content:C(Oe),structuredContent:k().optional(),isError:j().optional()}),"tools/list":K({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),tools:C(et),nextCursor:r.optional()}),"prompts/get":K({description:S().optional(),messages:C(ke)}),"prompts/list":K({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),prompts:C(be),nextCursor:r.optional()}),"resources/list":K({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),resources:C(F),nextCursor:r.optional()}),"resources/templates/list":K({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),resourceTemplates:C(ge),nextCursor:r.optional()}),"resources/read":K({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),contents:C(u([N,he]))}),"completion/complete":K({completion:g({values:C(S()).max(100),total:A().int().optional(),hasMore:j().optional()}).loose()}),"server/discover":K({ttlMs:A().int().min(0).catch(0),cacheScope:x([`public`,`private`]).catch(`private`),supportedVersions:C(S()),capabilities:Qe,instructions:S().optional()}),"subscriptions/listen":K({})},nn=p({"io.modelcontextprotocol/subscriptionId":i.optional()}),rn=g({method:E(`notifications/subscriptions/acknowledged`),params:g({_meta:nn.optional(),notifications:Yt})}),an=g({_meta:nn.optional(),requestId:i,reason:S().optional()}),on=g({method:E(`notifications/cancelled`),params:an}),sn={"notifications/cancelled":on,"notifications/progress":de,"notifications/message":me,"notifications/resources/updated":ye,"notifications/resources/list_changed":_e,"notifications/tools/list_changed":je,"notifications/prompts/list_changed":xe,"notifications/subscriptions/acknowledged":rn},cn=e=>g({jsonrpc:E(`2.0`),id:u([S(),A().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:d,BaseRequestParamsSchema:h,TaskAugmentedRequestParamsSchema:_,NotificationsParamsSchema:v,NotificationSchema:y,IconSchema:b,IconsSchema:T,BaseMetadataSchema:te,ImplementationSchema:ne,ClientTasksCapabilitySchema:ae,ServerTasksCapabilitySchema:oe,ClientCapabilitiesSchema:se,ServerCapabilitiesSchema:ce,ProgressSchema:le,ProgressNotificationParamsSchema:ue,ProgressNotificationSchema:de,LoggingMessageNotificationParamsSchema:pe,LoggingMessageNotificationSchema:me,ResourceContentsSchema:M,TextResourceContentsSchema:N,BlobResourceContentsSchema:he,AnnotationsSchema:P,ResourceSchema:F,ResourceTemplateSchema:ge,ResourceListChangedNotificationSchema:_e,ResourceUpdatedNotificationParamsSchema:ve,ResourceUpdatedNotificationSchema:ye,PromptArgumentSchema:I,PromptSchema:be,PromptListChangedNotificationSchema:xe,TextContentSchema:Se,ImageContentSchema:Ce,AudioContentSchema:we,ToolUseContentSchema:Te,EmbeddedResourceSchema:Ee,ResourceLinkSchema:De,ContentBlockSchema:Oe,PromptMessageSchema:ke,ToolAnnotationsSchema:Ae,ToolListChangedNotificationSchema:je,ModelHintSchema:Ie,ModelPreferencesSchema:Re,ToolChoiceSchema:L,BooleanSchemaSchema:ze,StringSchemaSchema:Be,NumberSchemaSchema:Ve,UntitledSingleSelectEnumSchemaSchema:He,TitledSingleSelectEnumSchemaSchema:Ue,LegacyTitledEnumSchemaSchema:We,SingleSelectEnumSchemaSchema:R,UntitledMultiSelectEnumSchemaSchema:Ge,TitledMultiSelectEnumSchemaSchema:z,MultiSelectEnumSchemaSchema:B,EnumSchemaSchema:V,PrimitiveSchemaDefinitionSchema:Ke,ElicitRequestFormParamsSchema:H,ResourceTemplateReferenceSchema:qe,PromptReferenceSchema:Je,RootSchema:Ye,ClientCapabilities2026Schema:Ze,ServerCapabilities2026Schema:Qe,RequestMetaEnvelopeSchema:$e,ToolSchema:et,ToolResultContentSchema:tt,SamplingMessageContentBlockSchema:nt,SamplingMessageSchema:rt,ResultTypeSchema:it,ResultMetaSchema:at,ResultSchema:st,PaginatedResultSchema:ct,CallToolResultSchema:lt,ListToolsResultSchema:ut,ListPromptsResultSchema:dt,GetPromptResultSchema:ft,ListResourcesResultSchema:pt,ListResourceTemplatesResultSchema:mt,ReadResourceResultSchema:ht,CompleteResultSchema:gt,CacheableResultSchema:_t,DiscoverResultSchema:vt,CreateMessageRequestParamsSchema:yt,CreateMessageRequestSchema:bt,ListRootsRequestSchema:xt,CreateMessageResultSchema:St,ListRootsResultSchema:Ct,ElicitResultSchema:wt,ElicitRequestURLParamsSchema:Tt,ElicitRequestParamsSchema:Et,ElicitRequestSchema:Dt,InputRequestSchema:Ot,InputResponseSchema:kt,InputRequestsSchema:At,InputResponsesSchema:jt,InputRequiredResultSchema:Mt,InputResponseRequestParamsSchema:Pt,CallToolRequestSchema:zt,ListToolsRequestSchema:Bt,ListPromptsRequestSchema:Vt,GetPromptRequestSchema:Ht,ListResourcesRequestSchema:Ut,ListResourceTemplatesRequestSchema:Wt,ReadResourceRequestSchema:Gt,CompleteRequestSchema:qt,DiscoverRequestSchema:Jt,SubscriptionFilterSchema:Yt,SubscriptionsListenRequestSchema:Zt,SubscriptionsListenResultMetaSchema:Qt,SubscriptionsListenResultSchema:$t,dispatchRequestSchemas:en,dispatchResultSchemas:tn,NotificationMetaSchema:nn,SubscriptionsAcknowledgedNotificationSchema:rn,CancelledNotificationParamsSchema:an,CancelledNotificationSchema:on,notificationSchemas2026:sn,JSONRPCResultResponseSchema:cn(st),CallToolResultResponseSchema:cn(u([lt,Mt])),ListToolsResultResponseSchema:cn(ut),ListPromptsResultResponseSchema:cn(dt),GetPromptResultResponseSchema:cn(u([ft,Mt])),ListResourcesResultResponseSchema:cn(pt),ListResourceTemplatesResultResponseSchema:cn(mt),ReadResourceResultResponseSchema:cn(u([ht,Mt])),CompleteResultResponseSchema:cn(gt),DiscoverResultResponseSchema:cn(vt),SubscriptionsListenResultResponseSchema:cn($t)}}var Ri;function zi(){return Ri??=Li()}var Bi=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function Vi(e){return Bi.includes(e)}var Hi=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function Ui(e){return e[Hi]}function Wi(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function Gi(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 Zr(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 Zr(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Xr(this,new.target)}static fromError(t,n,r){if(t===X.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new qi(e.elicitations,n)}if(t===X.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new Ji({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 Ki(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 Yi({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},Ki=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}},qi=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??[]}},Ji=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}},Yi=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}},Xi=0,Zi=`private`,Qi=[`tools/call`,`prompts/get`,`resources/read`];function $i(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||Qi.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 ea(e,t){let n=Ui(t);if(t.resultType!==`complete`||!Vi(e))return n===void 0?t:aa(t);let r=t,i=Wi(r.ttlMs)?r.ttlMs:ra(n),a=Gi(r.cacheScope)?r.cacheScope:ia(n),o={...r,ttlMs:i,cacheScope:a};return delete o[Hi],o}function ta(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function na(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[Pe]:t}}:!ta(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[Pe]:t}}}function ra(e){return e!==void 0&&Wi(e.ttlMs)?e.ttlMs:Xi}function ia(e){return e!==void 0&&Gi(e.cacheScope)?e.cacheScope:Zi}function aa(e){let t={...e};return delete t[Hi],t}var oa=[`elicitation/create`,`sampling/createMessage`,`roots/list`],sa;function ca(){if(sa)return sa;let e=zi();return sa={request:{"elicitation/create":g({method:E(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":g({method:E(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":g({method:E(`roots/list`),params:p({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},sa}function la(e){return oa.includes(e)}function ua(e){return la(e)?ca().request[e]:void 0}function da(e){return la(e)?ca().response[e]:void 0}var fa={"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},pa={"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 ma(e){return Object.prototype.hasOwnProperty.call(fa,e)}function ha(e){return Object.prototype.hasOwnProperty.call(pa,e)}function ga(e){return Object.prototype.hasOwnProperty.call(fa,e)}function _a(e){return ma(e)?zi().dispatchRequestSchemas[e]:void 0}function va(e){return ga(e)?zi().dispatchResultSchemas[e]:void 0}function ya(e){return ha(e)?zi().notificationSchemas2026[e]:void 0}Object.keys(fa),Object.keys(pa);function ba(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function xa(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 Sa={ok:!1,reason:`not-in-era`},Ca=[Me,Fe];function wa(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=>ba(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!ba(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(ba(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var Ta={era:`2026-07-28`,hasRequestMethod:ma,hasNotificationMethod:ha,hasInputRequestMethod:e=>ua(e)!==void 0,validateRequest:(e,t)=>xa(_a(e),t),validateResult:(e,t)=>xa(va(e),t),validateNotification:(e,t)=>xa(ya(e),t),validateInputRequest:(e,t)=>xa(ua(e),t),validateInputResponse:(e,t)=>xa(da(e),t),samplingResultVariant:()=>Sa,outboundEnvelope(e){return{[Me]:e.protocolVersion,[Ne]:e.clientInfo,[Fe]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Ca)n in e||t.push({key:n,problem:`missing`});let n=zi().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=>li(e),inputRequestSchema:ua,decodeResult(e,t){if(!ba(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=ba(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:zi().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=Da(),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 na(ea(e,$i(e,wa(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=zi().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(`; `)}`}},Ea;function Da(){if(Ea)return Ea;let e=zi();return Ea={"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},Ea}var Oa=`2026-07-28`;function ka(e){return e!==void 0&&oi(e)?Ta:Ii}function Aa(e){return e.revision===void 0?e.era===`modern`?Ta.era:Ii.era:ka(e.revision).era}function ja(e){return Pa.some(t=>t.hasRequestMethod(e))}function Ma(e){return Pa.some(t=>t.hasNotificationMethod(e))}function Na(e){return e===`tasks/get`||e===`tasks/cancel`}var Pa=[Ii,Ta],Fa=be({AnnotationsSchema:()=>kt,AudioContentSchema:()=>sn,BaseMetadataSchema:()=>it,BaseRequestParamsSchema:()=>R,BlobResourceContentsSchema:()=>Dt,BooleanSchemaSchema:()=>Hn,CallToolRequestParamsSchema:()=>Sn,CallToolRequestSchema:()=>Cn,CallToolResultSchema:()=>bn,CancelTaskRequestSchema:()=>Or,CancelTaskResultSchema:()=>kr,CancelledNotificationParamsSchema:()=>et,CancelledNotificationSchema:()=>tt,ClientCapabilitiesSchema:()=>lt,ClientNotificationSchema:()=>jr,ClientRequestSchema:()=>Ar,ClientResultSchema:()=>Mr,ClientTasksCapabilitySchema:()=>st,CompatibilityCallToolResultSchema:()=>xn,CompleteRequestParamsSchema:()=>lr,CompleteRequestSchema:()=>ur,CompleteResultSchema:()=>dr,ContentBlockSchema:()=>dn,CreateMessageRequestParamsSchema:()=>Rn,CreateMessageRequestSchema:()=>zn,CreateMessageResultSchema:()=>Bn,CreateMessageResultWithToolsSchema:()=>Vn,CreateTaskResultSchema:()=>yr,CursorSchema:()=>Ve,DiscoverRequestSchema:()=>ht,DiscoverResultSchema:()=>gt,ElicitRequestFormParamsSchema:()=>er,ElicitRequestParamsSchema:()=>nr,ElicitRequestSchema:()=>rr,ElicitRequestURLParamsSchema:()=>tr,ElicitResultSchema:()=>or,ElicitationCompleteNotificationParamsSchema:()=>ir,ElicitationCompleteNotificationSchema:()=>ar,EmbeddedResourceSchema:()=>ln,EmptyResultSchema:()=>$e,EnumSchemaSchema:()=>Qn,GetPromptRequestParamsSchema:()=>nn,GetPromptRequestSchema:()=>rn,GetPromptResultSchema:()=>pn,GetTaskPayloadRequestSchema:()=>wr,GetTaskPayloadResultSchema:()=>Tr,GetTaskRequestSchema:()=>Sr,GetTaskResultSchema:()=>Cr,IconSchema:()=>nt,IconsSchema:()=>rt,ImageContentSchema:()=>on,ImplementationSchema:()=>at,InitializeRequestParamsSchema:()=>ut,InitializeRequestSchema:()=>dt,InitializeResultSchema:()=>pt,InitializedNotificationSchema:()=>mt,JSONArraySchema:()=>ze,JSONObjectSchema:()=>L,JSONRPCErrorResponseSchema:()=>Ze,JSONRPCMessageSchema:()=>U,JSONRPCNotificationSchema:()=>Ye,JSONRPCRequestSchema:()=>Je,JSONRPCResponseSchema:()=>Qe,JSONRPCResultResponseSchema:()=>Xe,JSONValueSchema:()=>Re,LegacyTitledEnumSchemaSchema:()=>qn,ListChangedOptionsBaseSchema:()=>Tn,ListPromptsRequestSchema:()=>K,ListPromptsResultSchema:()=>tn,ListResourceTemplatesRequestSchema:()=>Pt,ListResourceTemplatesResultSchema:()=>Ft,ListResourcesRequestSchema:()=>Mt,ListResourcesResultSchema:()=>Nt,ListRootsRequestSchema:()=>pr,ListRootsResultSchema:()=>mr,ListTasksRequestSchema:()=>Er,ListTasksResultSchema:()=>Dr,ListToolsRequestSchema:()=>vn,ListToolsResultSchema:()=>yn,LoggingLevelSchema:()=>En,LoggingMessageNotificationParamsSchema:()=>kn,LoggingMessageNotificationSchema:()=>An,ModelHintSchema:()=>jn,ModelPreferencesSchema:()=>Mn,MultiSelectEnumSchemaSchema:()=>Zn,NotificationSchema:()=>V,NotificationsParamsSchema:()=>B,NumberSchemaSchema:()=>Wn,PaginatedRequestParamsSchema:()=>xt,PaginatedRequestSchema:()=>St,PaginatedResultSchema:()=>Ct,PingRequestSchema:()=>_t,PrimitiveSchemaDefinitionSchema:()=>$n,ProgressNotificationParamsSchema:()=>yt,ProgressNotificationSchema:()=>bt,ProgressSchema:()=>vt,ProgressTokenSchema:()=>Be,PromptArgumentSchema:()=>$t,PromptListChangedNotificationSchema:()=>mn,PromptMessageSchema:()=>fn,PromptReferenceSchema:()=>cr,PromptSchema:()=>en,ReadResourceRequestParamsSchema:()=>It,ReadResourceRequestSchema:()=>Lt,ReadResourceResultSchema:()=>Rt,RelatedTaskMetadataSchema:()=>Ue,RequestIdSchema:()=>qe,RequestMetaSchema:()=>We,RequestSchema:()=>z,ResourceContentsSchema:()=>wt,ResourceLinkSchema:()=>un,ResourceListChangedNotificationSchema:()=>zt,ResourceRequestParamsSchema:()=>G,ResourceSchema:()=>At,ResourceTemplateReferenceSchema:()=>sr,ResourceTemplateSchema:()=>jt,ResourceUpdatedNotificationParamsSchema:()=>Zt,ResourceUpdatedNotificationSchema:()=>Qt,ResultMetaObjectSchema:()=>Ke,ResultSchema:()=>H,RoleSchema:()=>Ot,RootSchema:()=>fr,RootsListChangedNotificationSchema:()=>hr,SamplingContentSchema:()=>Fn,SamplingMessageContentBlockSchema:()=>In,SamplingMessageSchema:()=>Ln,ServerCapabilitiesSchema:()=>ft,ServerNotificationSchema:()=>Pr,ServerRequestSchema:()=>Nr,ServerResultSchema:()=>Fr,ServerTasksCapabilitySchema:()=>ct,SetLevelRequestParamsSchema:()=>Dn,SetLevelRequestSchema:()=>On,SingleSelectEnumSchemaSchema:()=>Jn,StringSchemaSchema:()=>Un,SubscribeRequestParamsSchema:()=>Bt,SubscribeRequestSchema:()=>Vt,SubscriptionFilterSchema:()=>Wt,SubscriptionsAcknowledgedNotificationParamsSchema:()=>qt,SubscriptionsAcknowledgedNotificationSchema:()=>Jt,SubscriptionsListenRequestParamsSchema:()=>Gt,SubscriptionsListenRequestSchema:()=>Kt,SubscriptionsListenResultMetaSchema:()=>Yt,SubscriptionsListenResultSchema:()=>Xt,TaskAugmentedRequestParamsSchema:()=>Ge,TaskCreationParamsSchema:()=>gr,TaskMetadataSchema:()=>He,TaskSchema:()=>vr,TaskStatusNotificationParamsSchema:()=>br,TaskStatusNotificationSchema:()=>xr,TaskStatusSchema:()=>_r,TextContentSchema:()=>an,TextResourceContentsSchema:()=>Tt,TitledMultiSelectEnumSchemaSchema:()=>Xn,TitledSingleSelectEnumSchemaSchema:()=>Kn,ToolAnnotationsSchema:()=>hn,ToolChoiceSchema:()=>Nn,ToolExecutionSchema:()=>gn,ToolListChangedNotificationSchema:()=>wn,ToolResultContentSchema:()=>Pn,ToolSchema:()=>_n,ToolUseContentSchema:()=>cn,UnsubscribeRequestParamsSchema:()=>Ht,UnsubscribeRequestSchema:()=>Ut,UntitledMultiSelectEnumSchemaSchema:()=>Yn,UntitledSingleSelectEnumSchemaSchema:()=>Gn}),Ia=e=>Je.safeParse(e).success,La=e=>Ye.safeParse(e).success,Ra=e=>Xe.safeParse(e).success,za=e=>Ze.safeParse(e).success,Ba=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.resultType===`input_required`,Va=e=>dt.safeParse(e).success,Ha=e=>mt.safeParse(e).success,Ua=`Mcp-Param-`,Wa=`x-mcp-header`,Ga=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Ka=new Set([`string`,`integer`,`boolean`,`number`]);function qa(e){let t=[],n=new Map,r=(e,i,a)=>{if(typeof e!=`object`||!e)return;let o=e;if(Wa in o){if(!a||i.length===0)return`${Xa(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[Wa];if(typeof e!=`string`||e.length===0)return`${Xa(i)}: x-mcp-header MUST be a non-empty string`;if(!Ga.test(e))return`${Xa(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||!Ka.has(r))return`${Xa(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 Ja){let t=o[e];if(t===void 0)continue;let n=Array.isArray(t)?t:typeof t==`object`&&t&&Ya.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 Ja=[`items`,`prefixItems`,`contains`,`additionalProperties`,`unevaluatedProperties`,`unevaluatedItems`,`propertyNames`,`patternProperties`,`dependentSchemas`,`oneOf`,`anyOf`,`allOf`,`not`,`if`,`then`,`else`,`$defs`,`definitions`],Ya=new Set([`patternProperties`,`dependentSchemas`,`$defs`,`definitions`]);function Xa(e){return e.length===0?``:e.join(`.`)}var Za=`=?base64?`,Qa=`?=`;function $a(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 eo(e){if(e.length===0||e.startsWith(Za)&&e.endsWith(Qa)||e!==e.trim())return!0;for(let t=0;t=32&&n<=126))return!0}return!1}function to(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCodePoint(e);return btoa(n)}function no(e){return eo(e)?`${Za}${to(e)}${Qa}`:e}function ro(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[e]}return n}function io(e,t){let n={};for(let r of e){let e=ro(t,r.path);if(e==null)continue;let i=$a(e);i!==void 0&&(n[`${Ua}${r.headerName}`]=no(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 ao={"tools/call":`name`,"prompts/get":`name`,"resources/read":`uri`,"tasks/get":`taskId`,"tasks/update":`taskId`,"tasks/cancel":`taskId`};function oo(e,t){let n=Object.hasOwn(ao,e)?ao[e]:void 0;if(n===void 0)return;let r=so(t)?t[n]:void 0;return{field:n,value:typeof r==`string`?r:void 0}}function so(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function co(e,t){return ie(e,t)}function lo(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function uo(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 fo=!1,po=`draft-2020-12`;function mo(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:po});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().`);fo||(fo=!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=oe(e,{target:po,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&&ho(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 ho(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`||ho(e)))}return!1}function go(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function _o(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>go(e)).join(`, `)}:{success:!0,data:n.value}}function vo(e){let t=oe(e,{target:po,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var yo=/\\\.\\d\{(\d+)\}/;function bo(e){let t=yo.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=>fe({local:e,offset:t,precision:n}))))}function xo(e,t){let n;switch(e){case`email`:n=[T()];break;case`uri`:n=[ce()];break;case`date`:n=[pe()];break;case`date-time`:n=bo(t)}return new Set(n.map(e=>vo(e)).filter(e=>e!==void 0))}function So(e,t,n){return n!==`zod`||xo(e,t).has(t)}function Co(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function wo(e){try{return mo(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 To=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function Eo(e){return To.has(e)||e.startsWith(`x-`)}var Do=new Set([`$schema`,...Object.keys(er.shape.requestedSchema.shape)]),Oo={string:lo([Un,Gn,Kn,qn]),number:lo([Wn]),integer:lo([Wn]),boolean:lo([Hn]),array:lo([Yn,Xn])},ko=new Set(Un.shape.format.unwrap().options);function Ao(e,t,n,r){if(!Co(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Oo,e.type)?Oo[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||Eo(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?ko.has(e.format)?(typeof s!=`string`||!So(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function jo(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&Co(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,Ao(n,`properties.${e}`,t,r)])):Do.has(i)?n[i]=a:Eo(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 Mo(e,t){if(!Co(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!co($n,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function No(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>No(e,t[r],`${n}[${r}]`)):!Co(e)||!Co(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?No(r,t[e],i):Eo(e)?[]:[i]})}function Po(e){if(!uo(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=jo(wo(e.requestedSchema),t),r=co(er.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): ${Mo(n,r.error.message)}`);let i=No(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 Fo(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(Fo,{elicit(e){try{return{method:`elicitation/create`,params:Po(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 Io=!0,Lo=10,Ro=250;function zo(e){return{autoFulfill:e?.autoFulfill??Io,maxRounds:e?.maxRounds??Lo}}function Bo(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 Vo(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function Ho(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 Uo(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 Wo(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,Vo(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=Uo(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 Ho(Ro,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(Bo(r,u,c.requestState),d);if(Ba(f)){c={inputRequests:f.inputRequests??{},...f.requestState!==void 0&&{requestState:f.requestState}};continue}return f}}var Go=`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(`.`),Ko={IdJagTokenExchangeResponseSchema:Vr,OAuthClientInformationFullSchema:Kr,OAuthClientInformationSchema:Gr,OAuthClientMetadataSchema:Wr,OAuthClientRegistrationErrorSchema:qr,OAuthErrorResponseSchema:Hr,OAuthMetadataSchema:Lr,OAuthProtectedResourceMetadataSchema:Ir,OAuthTokenRevocationRequestSchema:Jr,OAuthTokensSchema:Br,OpenIdProviderDiscoveryMetadataSchema:zr,OpenIdProviderMetadataSchema:Rr},qo={},Jo={};function Yo(e,t){let n=e.slice(0,-6);qo[n]=t,Jo[n]=e=>t.safeParse(e).success}for(let e of Go)Yo(e,Fa[e]);for(let[e,t]of Object.entries(Ko))Yo(e,t);Object.freeze(qo);var Xo=Object.freeze(Jo);function Zo(e){switch(e){case`initialize`:case`notifications/initialized`:return ka(void 0);case`server/discover`:return ka(Oa);default:return}}var Qo=[Me,Ne,Fe,Le],$o=[`inputResponses`,`requestState`];function es(e,t){let n=e.params;if(!as(n))return{message:e,lifted:{}};let r=n._meta,i=as(r)?Qo.filter(e=>e in r):[],a=t===`request`?$o.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&as(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 ts(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 ns(e){return()=>e}var rs=ns(void 0),is=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??Ae,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),Ra(e)||za(e)?this._onresponse(e):Ia(e)?this._onrequest(e,t):La(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}=es(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=Aa(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(Ma(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}=es(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=Aa(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(ja(n.method)&&!i.hasRequestMethod(n.method)&&!(Na(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:cs(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?rs:ns(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),uo(t))return u(e,t,n);let i=ts(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),Ra(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(uo(t))return Na(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=ts(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 ka(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Zo(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(ja(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(ms(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;_o(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(Ma(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(!ja(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 _o(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(!Ma(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 _o(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 as(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function os(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]=as(a)&&as(i)?{...a,...i}:i}return n}function ss(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function cs(e){let t={},n=[];if(!ss(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!ss(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function ls(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 us(e,t,n,r,i){return{sessionId:i,mcpReq:{id:e,method:t,_meta:n?._meta,requestState:ns(void 0),signal:r,send:(()=>ls(`send`)),notify:()=>ls(`notify`)}}}async function ds(e,t,n,r,i){if(!ss(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=ss(r.params)?r.params:void 0;return await o({jsonrpc:`2.0`,id:n,method:a,...s!==void 0&&{params:s}},e.buildContext(us(n,a,s,i,e.sessionId)))}function fs(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 ps(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)=>ds(e,i,t,n,r),retry:(e,t)=>r.retry(e,fs(o,t))};return Wo({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 ms(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var hs=Se(I((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 gs(e){if(e)try{return hs.parse(e).type}catch{let t=(e.split(`;`,1)[0]??``).trim().toLowerCase();return t===``||e.slice(t.length).includes(`,`)?void 0:t}}function _s(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function vs(e=fetch,t){return t?async(n,r)=>e(n,{...t,...r,headers:r?.headers?{..._s(t.headers),..._s(r.headers)}:t.headers}):e}var ys=new Set([301,302,303,307,308]),bs=5;function xs(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 Ss(e,t){let n=ys.has(t.status)?t.headers?.get(`location`):void 0;if(n)try{return new URL(n,e)}catch{return}}var Cs=new WeakSet;function ws(e){let t=(t,n)=>e(t,n);return Cs.add(t),t}function Ts(e){return Cs.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=Ss(i,a);if(!o||t===bs)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||!xs(s,o))return a;await a.text?.().catch(()=>{}),i=o}}}function Es(e,t){if(t.type===`opaqueredirect`)return`Redirect not followed: this runtime does not expose where it points`;let n=Ss(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 Ds(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:Ps(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(Ms[i])continue;let a=`${r}/${Os(i)}`,o=e[i];if(Array.isArray(o)){if(As[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,Vs=/^(?:(?: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,Hs=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Us=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ws=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Gs=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Ks=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))},qs=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Js=/^((([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,Ys=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 Xs(e){return e.test.bind(e)}var Zs={date:$s,time:ec.bind(void 0,!1),"date-time":nc,duration:Ys,uri:ac,"uri-reference":Xs(zs),"uri-template":Xs(Bs),url:Xs(Vs),email:Ks,hostname:Xs(Rs),ipv4:Xs(qs),ipv6:Xs(Js),regex:sc,uuid:Xs(Hs),"json-pointer":Xs(Us),"json-pointer-uri-fragment":Xs(Ws),"relative-json-pointer":Xs(Gs)};function Qs(e){return e%4==0&&(e%100!=0||e%400==0)}function $s(e){let t=e.match(Fs);if(!t)return!1;let n=+t[1],r=+t[2],i=+t[3];return r>=1&&r<=12&&i>=1&&i<=(r==2&&Qs(n)?29:Is[r])}function ec(e,t){let n=t.match(Ls);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 tc=/t|\s/i;function nc(e){let t=e.split(tc);return t.length==2&&$s(t[0])&&ec(!0,t[1])}var rc=/\/|:/,ic=/^(?:[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 ac(e){return rc.test(e)&&ic.test(e)}var oc=/[^\\]\\Z/;function sc(e){if(oc.test(e))return!1;try{return new RegExp(e,`u`),!0}catch{return!1}}function cc(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 he(e){let t=M(M(M(e)?.ui)?.csp),n=N(t?.connectDomains,[`http`,`https`,`ws`,`wss`]),r=N(t?.resourceDomains,[`http`,`https`]),i=N(t?.frameDomains,[`http`,`https`]),a=N(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 P=Object.create,F=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,_e=Object.getOwnPropertyNames,ve=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty,I=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),be=(e,t)=>{let n={};for(var r in e)F(n,r,{get:e[r],enumerable:!0});return t&&F(n,Symbol.toStringTag,{value:`Module`}),n},xe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=_e(t),a=0,o=i.length,s;at[e]).bind(null,s),enumerable:!(r=ge(t,s))||r.enumerable});return e},Se=(e,t,n)=>(n=e==null?{}:P(ve(e)),xe(t||!e||!e.__esModule?F(n,`default`,{value:e,enumerable:!0}):n,e)),Ce=new Set([`https://json-schema.org/draft/2020-12/schema`,`http://json-schema.org/draft/2020-12/schema`]),we=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]),Te=new Set([`https://json-schema.org/draft-07/schema`,`http://json-schema.org/draft-07/schema`]),Ee=new Set([`https://json-schema.org/draft-06/schema`,`http://json-schema.org/draft-06/schema`]);function De(e){return typeof e==`string`&&we.has(e.replace(/#$/,``))}function Oe(e,t){if(!(`$schema`in e)||typeof e.$schema!=`string`)return`2020-12`;let n=e.$schema.replace(/#$/,``);if(Ce.has(n))return`2020-12`;if(we.has(n))return`2019-09`;if(Te.has(n)||Ee.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 ke=`2025-11-25`,Ae=[ke,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],je=`io.modelcontextprotocol/related-task`,Me=`io.modelcontextprotocol/protocolVersion`,Ne=`io.modelcontextprotocol/clientInfo`,Pe=`io.modelcontextprotocol/serverInfo`,Fe=`io.modelcontextprotocol/clientCapabilities`,Ie=`io.modelcontextprotocol/subscriptionId`,Le=`io.modelcontextprotocol/logLevel`,Re=w(()=>u([S(),A(),j(),f(),O(S(),Re),C(Re)])),L=O(S(),Re),ze=C(Re),Be=u([S(),A().int()]),Ve=S(),He=g({ttl:A().optional()}),Ue=g({taskId:S()}),We=p({progressToken:Be.optional(),[je]:Ue.optional()}),R=g({_meta:We.optional()}),Ge=R.extend({task:He.optional()}),z=g({method:S(),params:R.loose().optional()}),B=g({_meta:We.optional()}),V=g({method:S(),params:B.loose().optional()}),Ke=p({get[Pe](){return at.optional().catch(void 0)}}),H=p({_meta:Ke.optional()}),qe=u([S(),A().int()]),Je=g({jsonrpc:E(`2.0`),id:qe,...z.shape}).strict(),Ye=g({jsonrpc:E(`2.0`),...V.shape}).strict(),Xe=g({jsonrpc:E(`2.0`),id:qe,result:H}).strict(),Ze=g({jsonrpc:E(`2.0`),id:qe.optional(),error:g({code:A().int(),message:S(),data:k().optional()})}).strict(),U=u([Je,Ye,Xe,Ze]),Qe=u([Xe,Ze]),$e=H.strict(),et=B.extend({requestId:qe.optional(),reason:S().optional()}),tt=V.extend({method:E(`notifications/cancelled`),params:et}),nt=g({src:S(),mimeType:S().optional(),sizes:C(S()).optional(),theme:x([`light`,`dark`]).optional()}),rt=g({icons:C(nt).optional()}),it=g({name:S(),title:S().optional()}),at=it.extend({...it.shape,...rt.shape,version:S(),websiteUrl:S().optional(),description:S().optional()}),ot=m(g({applyDefaults:j().optional()}),L),W=ee(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,m(g({form:ot.optional(),url:L.optional()}),L.optional())),st=p({list:L.optional(),cancel:L.optional(),requests:p({sampling:p({createMessage:L.optional()}).optional(),elicitation:p({create:L.optional()}).optional()}).optional()}),ct=p({list:L.optional(),cancel:L.optional(),requests:p({tools:p({call:L.optional()}).optional()}).optional()}),lt=g({experimental:O(S(),L).optional(),sampling:g({context:L.optional(),tools:L.optional()}).optional(),elicitation:W.optional(),roots:g({listChanged:j().optional()}).optional(),tasks:st.optional(),extensions:O(S(),L).optional()}),ut=R.extend({protocolVersion:S(),capabilities:lt,clientInfo:at}),dt=z.extend({method:E(`initialize`),params:ut}),ft=g({experimental:O(S(),L).optional(),logging:L.optional(),completions:L.optional(),prompts:g({listChanged:j().optional()}).optional(),resources:g({subscribe:j().optional(),listChanged:j().optional()}).optional(),tools:g({listChanged:j().optional()}).optional(),tasks:ct.optional(),extensions:O(S(),L).optional()}),pt=H.extend({protocolVersion:S(),capabilities:ft,serverInfo:at,instructions:S().optional()}),mt=V.extend({method:E(`notifications/initialized`),params:B.optional()}),ht=z.extend({method:E(`server/discover`),params:R.optional()}),gt=H.extend({supportedVersions:C(S()),capabilities:ft,instructions:S().optional()}),_t=z.extend({method:E(`ping`),params:R.optional()}),vt=g({progress:A(),total:D(A()),message:D(S())}),yt=g({...B.shape,...vt.shape,progressToken:Be}),bt=V.extend({method:E(`notifications/progress`),params:yt}),xt=R.extend({cursor:Ve.optional()}),St=z.extend({params:xt.optional()}),Ct=H.extend({nextCursor:Ve.optional()}),wt=g({uri:S(),mimeType:D(S()),_meta:O(S(),k()).optional()}),Tt=wt.extend({text:S()}),Et=S().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Dt=wt.extend({blob:Et}),Ot=x([`user`,`assistant`]),kt=g({audience:C(Ot).optional(),priority:A().min(0).max(1).optional(),lastModified:fe({offset:!0}).optional()}),At=g({...it.shape,...rt.shape,uri:S(),description:D(S()),mimeType:D(S()),size:D(A()),annotations:kt.optional(),_meta:D(p({}))}),jt=g({...it.shape,...rt.shape,uriTemplate:S(),description:D(S()),mimeType:D(S()),annotations:kt.optional(),_meta:D(p({}))}),Mt=St.extend({method:E(`resources/list`)}),Nt=Ct.extend({resources:C(At)}),Pt=St.extend({method:E(`resources/templates/list`)}),Ft=Ct.extend({resourceTemplates:C(jt)}),G=R.extend({uri:S()}),It=G,Lt=z.extend({method:E(`resources/read`),params:It}),Rt=H.extend({contents:C(u([Tt,Dt]))}),zt=V.extend({method:E(`notifications/resources/list_changed`),params:B.optional()}),Bt=G,Vt=z.extend({method:E(`resources/subscribe`),params:Bt}),Ht=G,Ut=z.extend({method:E(`resources/unsubscribe`),params:Ht}),Wt=g({toolsListChanged:j().optional(),promptsListChanged:j().optional(),resourcesListChanged:j().optional(),resourceSubscriptions:C(S()).optional()}),Gt=R.extend({notifications:Wt}),Kt=z.extend({method:E(`subscriptions/listen`),params:Gt}),qt=B.extend({notifications:Wt}),Jt=V.extend({method:E(`notifications/subscriptions/acknowledged`),params:qt}),Yt=Ke.extend({[Ie]:qe}),Xt=H.extend({_meta:Yt}),Zt=B.extend({uri:S()}),Qt=V.extend({method:E(`notifications/resources/updated`),params:Zt}),$t=g({name:S(),description:D(S()),required:D(j())}),en=g({...it.shape,...rt.shape,description:D(S()),arguments:D(C($t)),_meta:D(p({}))}),K=St.extend({method:E(`prompts/list`)}),tn=Ct.extend({prompts:C(en)}),nn=R.extend({name:S(),arguments:O(S(),S()).optional()}),rn=z.extend({method:E(`prompts/get`),params:nn}),an=g({type:E(`text`),text:S(),annotations:kt.optional(),_meta:O(S(),k()).optional()}),on=g({type:E(`image`),data:Et,mimeType:S(),annotations:kt.optional(),_meta:O(S(),k()).optional()}),sn=g({type:E(`audio`),data:Et,mimeType:S(),annotations:kt.optional(),_meta:O(S(),k()).optional()}),cn=g({type:E(`tool_use`),name:S(),id:S(),input:O(S(),k()),_meta:O(S(),k()).optional()}),ln=g({type:E(`resource`),resource:u([Tt,Dt]),annotations:kt.optional(),_meta:O(S(),k()).optional()}),un=At.extend({type:E(`resource_link`)}),dn=u([an,on,sn,un,ln]),fn=g({role:Ot,content:dn}),pn=H.extend({description:S().optional(),messages:C(fn)}),mn=V.extend({method:E(`notifications/prompts/list_changed`),params:B.optional()}),hn=g({title:S().optional(),readOnlyHint:j().optional(),destructiveHint:j().optional(),idempotentHint:j().optional(),openWorldHint:j().optional()}),gn=g({taskSupport:x([`required`,`optional`,`forbidden`]).optional()}),_n=g({...it.shape,...rt.shape,description:S().optional(),inputSchema:g({type:E(`object`),properties:O(S(),Re).optional(),required:C(S()).optional()}).catchall(k()),outputSchema:p({$schema:S().optional()}).optional(),annotations:hn.optional(),execution:gn.optional(),_meta:O(S(),k()).optional()}),vn=St.extend({method:E(`tools/list`)}),yn=Ct.extend({tools:C(_n)}),bn=H.extend({content:C(dn).default([]),structuredContent:k().optional(),isError:j().optional()}),xn=bn.or(H.extend({toolResult:k()})),Sn=Ge.extend({name:S(),arguments:O(S(),k()).optional()}),Cn=z.extend({method:E(`tools/call`),params:Sn}),wn=V.extend({method:E(`notifications/tools/list_changed`),params:B.optional()}),Tn=g({autoRefresh:j().default(!0),debounceMs:A().int().nonnegative().default(300)}),En=x([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),Dn=R.extend({level:En}),On=z.extend({method:E(`logging/setLevel`),params:Dn}),kn=B.extend({level:En,logger:S().optional(),data:k()}),An=V.extend({method:E(`notifications/message`),params:kn}),jn=g({name:S().optional()}),Mn=g({hints:C(jn).optional(),costPriority:A().min(0).max(1).optional(),speedPriority:A().min(0).max(1).optional(),intelligencePriority:A().min(0).max(1).optional()}),Nn=g({mode:x([`auto`,`required`,`none`]).optional()}),Pn=g({type:E(`tool_result`),toolUseId:S().describe(`The unique identifier for the corresponding tool call.`),content:C(dn),structuredContent:k().optional(),isError:j().optional(),_meta:O(S(),k()).optional()}),Fn=d(`type`,[an,on,sn]),In=d(`type`,[an,on,sn,cn,Pn]),Ln=g({role:Ot,content:u([In,C(In)]),_meta:O(S(),k()).optional()}),Rn=Ge.extend({messages:C(Ln),modelPreferences:Mn.optional(),systemPrompt:S().optional(),includeContext:x([`none`,`thisServer`,`allServers`]).optional(),temperature:A().optional(),maxTokens:A().int(),stopSequences:C(S()).optional(),metadata:L.optional(),tools:C(_n).optional(),toolChoice:Nn.optional()}),zn=z.extend({method:E(`sampling/createMessage`),params:Rn}),Bn=H.extend({model:S(),stopReason:D(x([`endTurn`,`stopSequence`,`maxTokens`]).or(S())),role:Ot,content:Fn}),Vn=H.extend({model:S(),stopReason:D(x([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(S())),role:Ot,content:u([In,C(In)])}),Hn=g({type:E(`boolean`),title:S().optional(),description:S().optional(),default:j().optional()}),Un=g({type:E(`string`),title:S().optional(),description:S().optional(),minLength:A().optional(),maxLength:A().optional(),format:x([`email`,`uri`,`date`,`date-time`]).optional(),default:S().optional()}),Wn=g({type:x([`number`,`integer`]),title:S().optional(),description:S().optional(),minimum:A().optional(),maximum:A().optional(),default:A().optional()}),Gn=g({type:E(`string`),title:S().optional(),description:S().optional(),enum:C(S()),default:S().optional()}),Kn=g({type:E(`string`),title:S().optional(),description:S().optional(),oneOf:C(g({const:S(),title:S()})),default:S().optional()}),qn=g({type:E(`string`),title:S().optional(),description:S().optional(),enum:C(S()),enumNames:C(S()).optional(),default:S().optional()}),Jn=u([Gn,Kn]),Yn=g({type:E(`array`),title:S().optional(),description:S().optional(),minItems:A().optional(),maxItems:A().optional(),items:g({type:E(`string`),enum:C(S())}),default:C(S()).optional()}),Xn=g({type:E(`array`),title:S().optional(),description:S().optional(),minItems:A().optional(),maxItems:A().optional(),items:g({anyOf:C(g({const:S(),title:S()}))}),default:C(S()).optional()}),Zn=u([Yn,Xn]),Qn=u([qn,Jn,Zn]),$n=u([Qn,Hn,Un,Wn]),er=Ge.extend({mode:E(`form`).optional(),message:S(),requestedSchema:g({type:E(`object`),properties:O(S(),$n),required:C(S()).optional()}).catchall(k())}),tr=Ge.extend({mode:E(`url`),message:S(),elicitationId:S(),url:S().url()}),nr=u([er,tr]),rr=z.extend({method:E(`elicitation/create`),params:nr}),ir=B.extend({elicitationId:S()}),ar=V.extend({method:E(`notifications/elicitation/complete`),params:ir}),or=H.extend({action:x([`accept`,`decline`,`cancel`]),content:ee(e=>e===null?void 0:e,O(S(),u([S(),A(),j(),C(S())])).optional())}),sr=g({type:E(`ref/resource`),uri:S()}),cr=g({type:E(`ref/prompt`),name:S()}),lr=R.extend({ref:u([cr,sr]),argument:g({name:S(),value:S()}),context:g({arguments:O(S(),S()).optional()}).optional()}),ur=z.extend({method:E(`completion/complete`),params:lr}),dr=H.extend({completion:p({values:C(S()).max(100),total:D(A().int()),hasMore:D(j())})}),fr=g({uri:S().startsWith(`file://`),name:S().optional(),_meta:O(S(),k()).optional()}),pr=z.extend({method:E(`roots/list`),params:R.optional()}),mr=H.extend({roots:C(fr)}),hr=V.extend({method:E(`notifications/roots/list_changed`),params:B.optional()}),gr=p({ttl:A().optional(),pollInterval:A().optional()}),_r=x([`working`,`input_required`,`completed`,`failed`,`cancelled`]),vr=g({taskId:S(),status:_r,ttl:u([A(),f()]),createdAt:S(),lastUpdatedAt:S(),pollInterval:D(A()),statusMessage:D(S())}),yr=H.extend({task:vr}),br=B.merge(vr),xr=V.extend({method:E(`notifications/tasks/status`),params:br}),Sr=z.extend({method:E(`tasks/get`),params:R.extend({taskId:S()})}),Cr=H.merge(vr),wr=z.extend({method:E(`tasks/result`),params:R.extend({taskId:S()})}),Tr=H.loose(),Er=St.extend({method:E(`tasks/list`)}),Dr=Ct.extend({tasks:C(vr)}),Or=z.extend({method:E(`tasks/cancel`),params:R.extend({taskId:S()})}),kr=H.merge(vr),Ar=u([_t,dt,ht,ur,On,rn,K,Mt,Pt,Lt,Vt,Ut,Kt,Cn,vn]),jr=u([tt,bt,mt,hr]),Mr=u([$e,Bn,Vn,or,mr]),Nr=u([_t,zn,rr,pr]),Pr=u([tt,bt,An,Qt,zt,wn,mn,Jt,ar]),Fr=u([$e,pt,gt,dr,pn,tn,Nt,Ft,Rt,bn,yn,Xt]),q=ce().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:ue.custom,message:`URL must be parseable`,fatal:!0}),se}).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`}),Ir=p({resource:S().url(),authorization_servers:C(q).optional(),jwks_uri:S().url().optional(),scopes_supported:C(S()).optional(),bearer_methods_supported:C(S()).optional(),resource_signing_alg_values_supported:C(S()).optional(),resource_name:S().optional(),resource_documentation:S().optional(),resource_policy_uri:S().url().optional(),resource_tos_uri:S().url().optional(),tls_client_certificate_bound_access_tokens:j().optional(),authorization_details_types_supported:C(S()).optional(),dpop_signing_alg_values_supported:C(S()).optional(),dpop_bound_access_tokens_required:j().optional()}),Lr=p({issuer:S(),authorization_endpoint:q,token_endpoint:q,registration_endpoint:q.optional(),scopes_supported:C(S()).optional(),response_types_supported:C(S()),response_modes_supported:C(S()).optional(),grant_types_supported:C(S()).optional(),token_endpoint_auth_methods_supported:C(S()).optional(),token_endpoint_auth_signing_alg_values_supported:C(S()).optional(),service_documentation:q.optional(),revocation_endpoint:q.optional(),revocation_endpoint_auth_methods_supported:C(S()).optional(),revocation_endpoint_auth_signing_alg_values_supported:C(S()).optional(),introspection_endpoint:S().optional(),introspection_endpoint_auth_methods_supported:C(S()).optional(),introspection_endpoint_auth_signing_alg_values_supported:C(S()).optional(),code_challenge_methods_supported:C(S()).optional(),client_id_metadata_document_supported:j().optional(),authorization_response_iss_parameter_supported:j().optional().catch(void 0),dpop_signing_alg_values_supported:C(S()).optional()}),Rr=p({issuer:S(),authorization_endpoint:q,token_endpoint:q,userinfo_endpoint:q.optional(),jwks_uri:q,registration_endpoint:q.optional(),scopes_supported:C(S()).optional(),response_types_supported:C(S()),response_modes_supported:C(S()).optional(),grant_types_supported:C(S()).optional(),acr_values_supported:C(S()).optional(),subject_types_supported:C(S()),id_token_signing_alg_values_supported:C(S()),id_token_encryption_alg_values_supported:C(S()).optional(),id_token_encryption_enc_values_supported:C(S()).optional(),userinfo_signing_alg_values_supported:C(S()).optional(),userinfo_encryption_alg_values_supported:C(S()).optional(),userinfo_encryption_enc_values_supported:C(S()).optional(),request_object_signing_alg_values_supported:C(S()).optional(),request_object_encryption_alg_values_supported:C(S()).optional(),request_object_encryption_enc_values_supported:C(S()).optional(),token_endpoint_auth_methods_supported:C(S()).optional(),token_endpoint_auth_signing_alg_values_supported:C(S()).optional(),display_values_supported:C(S()).optional(),claim_types_supported:C(S()).optional(),claims_supported:C(S()).optional(),service_documentation:S().optional(),claims_locales_supported:C(S()).optional(),ui_locales_supported:C(S()).optional(),claims_parameter_supported:j().optional(),request_parameter_supported:j().optional(),request_uri_parameter_supported:j().optional(),require_request_uri_registration:j().optional(),op_policy_uri:q.optional(),op_tos_uri:q.optional(),client_id_metadata_document_supported:j().optional(),authorization_response_iss_parameter_supported:j().optional().catch(void 0)}),zr=g({...Rr.shape,...Lr.pick({code_challenge_methods_supported:!0}).shape}),Br=g({access_token:S(),id_token:S().optional(),token_type:S(),expires_in:me().optional(),scope:S().optional(),refresh_token:S().optional(),issuer:S().optional().catch(void 0)}).strip(),Vr=g({issued_token_type:E(`urn:ietf:params:oauth:token-type:id-jag`),access_token:S(),token_type:S().optional(),expires_in:A().optional(),scope:S().optional()}).strip(),Hr=g({error:S(),error_description:S().optional(),error_uri:S().optional()}),Ur=q.optional().or(E(``).transform(()=>void 0)),Wr=g({redirect_uris:C(q),token_endpoint_auth_method:S().optional(),grant_types:C(S()).optional(),response_types:C(S()).optional(),application_type:S().optional(),client_name:S().optional(),client_uri:q.optional(),logo_uri:Ur,scope:S().optional(),contacts:C(S()).optional(),tos_uri:Ur,policy_uri:S().optional(),jwks_uri:q.optional(),jwks:v().optional(),software_id:S().optional(),software_version:S().optional(),software_statement:S().optional()}).strip(),Gr=g({client_id:S(),client_secret:S().optional(),client_id_issued_at:A().optional(),client_secret_expires_at:A().optional(),issuer:S().optional().catch(void 0)}).strip(),Kr=Wr.merge(Gr),qr=g({error:S(),error_description:S().optional()}).strip(),Jr=g({token:S(),token_type_hint:S().optional()}).strip(),Yr=Symbol.for(`mcp.sdk.errorBrands`);function Xr(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,Yr,{value:n,enumerable:!1,configurable:!0})}function Zr(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Yr)){let n=t[Yr];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var Qr=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}({}),$r=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return Zr(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 Zr(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Xr(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 Zr(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 Zr(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,Xr(this,new.target)}},ei=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 ti(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function ni(e){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t={...e};return delete t.issuer,t}function ri({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=ii}function si(e){return e.filter(e=>!oi(e))}function ci(e){return e.filter(e=>oi(e))}function li(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 ui=[`task`,`inputRequests`,`requestState`];function di(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||ui.some(t=>t in e)?e:{...e,content:[]}}function fi(){let e=w(()=>u([S(),A(),j(),f(),O(S(),e),C(e)])),t=O(S(),e),n=u([S(),A().int()]),r=S(),i=g({ttl:A().optional()}),a=g({taskId:S()}),o=p({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=g({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=g({method:S(),params:s.loose().optional()}),h=g({_meta:o.optional()}),_=g({method:S(),params:h.loose().optional()}),v=p({_meta:o.optional()}),y=u([S(),A().int()]),b=v.strict(),T=h.extend({requestId:y.optional(),reason:S().optional()}),te=_.extend({method:E(`notifications/cancelled`),params:T}),ne=g({src:S(),mimeType:S().optional(),sizes:C(S()).optional(),theme:x([`light`,`dark`]).optional()}),re=g({icons:C(ne).optional()}),ie=g({name:S(),title:S().optional()}),ae=ie.extend({...ie.shape,...re.shape,version:S(),websiteUrl:S().optional(),description:S().optional()}),oe=m(g({applyDefaults:j().optional()}),t),se=ee(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,m(g({form:oe.optional(),url:t.optional()}),t.optional())),ce=p({list:t.optional(),cancel:t.optional(),requests:p({sampling:p({createMessage:t.optional()}).optional(),elicitation:p({create:t.optional()}).optional()}).optional()}),le=p({list:t.optional(),cancel:t.optional(),requests:p({tools:p({call:t.optional()}).optional()}).optional()}),ue=g({experimental:O(S(),t).optional(),sampling:g({context:t.optional(),tools:t.optional()}).optional(),elicitation:se.optional(),roots:g({listChanged:j().optional()}).optional(),tasks:ce.optional(),extensions:O(S(),t).optional()}),de=s.extend({protocolVersion:S(),capabilities:ue,clientInfo:ae}),pe=l.extend({method:E(`initialize`),params:de}),me=g({experimental:O(S(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:g({listChanged:j().optional()}).optional(),resources:g({subscribe:j().optional(),listChanged:j().optional()}).optional(),tools:g({listChanged:j().optional()}).optional(),tasks:le.optional(),extensions:O(S(),t).optional()}),M=v.extend({protocolVersion:S(),capabilities:me,serverInfo:ae,instructions:S().optional()}),N=_.extend({method:E(`notifications/initialized`),params:h.optional()}),he=l.extend({method:E(`ping`),params:s.optional()}),P=g({progress:A(),total:D(A()),message:D(S())}),F=g({...h.shape,...P.shape,progressToken:n}),ge=_.extend({method:E(`notifications/progress`),params:F}),_e=s.extend({cursor:r.optional()}),ve=l.extend({params:_e.optional()}),ye=v.extend({nextCursor:r.optional()}),I=g({uri:S(),mimeType:D(S()),_meta:O(S(),k()).optional()}),be=I.extend({text:S()}),xe=S().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Se=I.extend({blob:xe}),Ce=x([`user`,`assistant`]),we=g({audience:C(Ce).optional(),priority:A().min(0).max(1).optional(),lastModified:fe({offset:!0}).optional()}),Te=g({...ie.shape,...re.shape,uri:S(),description:D(S()),mimeType:D(S()),size:D(A()),annotations:we.optional(),_meta:D(p({}))}),Ee=g({...ie.shape,...re.shape,uriTemplate:S(),description:D(S()),mimeType:D(S()),annotations:we.optional(),_meta:D(p({}))}),De=ve.extend({method:E(`resources/list`)}),Oe=ye.extend({resources:C(Te)}),ke=ve.extend({method:E(`resources/templates/list`)}),Ae=ye.extend({resourceTemplates:C(Ee)}),je=s.extend({uri:S()}),Me=je,Ne=l.extend({method:E(`resources/read`),params:Me}),Pe=v.extend({contents:C(u([be,Se]))}),Fe=_.extend({method:E(`notifications/resources/list_changed`),params:h.optional()}),Ie=je,Le=l.extend({method:E(`resources/subscribe`),params:Ie}),Re=je,L=l.extend({method:E(`resources/unsubscribe`),params:Re}),ze=h.extend({uri:S()}),Be=_.extend({method:E(`notifications/resources/updated`),params:ze}),Ve=g({name:S(),description:D(S()),required:D(j())}),He=g({...ie.shape,...re.shape,description:D(S()),arguments:D(C(Ve)),_meta:D(p({}))}),Ue=ve.extend({method:E(`prompts/list`)}),We=ye.extend({prompts:C(He)}),R=s.extend({name:S(),arguments:O(S(),S()).optional()}),Ge=l.extend({method:E(`prompts/get`),params:R}),z=g({type:E(`text`),text:S(),annotations:we.optional(),_meta:O(S(),k()).optional()}),B=g({type:E(`image`),data:xe,mimeType:S(),annotations:we.optional(),_meta:O(S(),k()).optional()}),V=g({type:E(`audio`),data:xe,mimeType:S(),annotations:we.optional(),_meta:O(S(),k()).optional()}),Ke=g({type:E(`tool_use`),name:S(),id:S(),input:O(S(),k()),_meta:O(S(),k()).optional()}),H=g({type:E(`resource`),resource:u([be,Se]),annotations:we.optional(),_meta:O(S(),k()).optional()}),qe=Te.extend({type:E(`resource_link`)}),Je=u([z,B,V,qe,H]),Ye=g({role:Ce,content:Je}),Xe=v.extend({description:S().optional(),messages:C(Ye)}),Ze=_.extend({method:E(`notifications/prompts/list_changed`),params:h.optional()}),U=g({title:S().optional(),readOnlyHint:j().optional(),destructiveHint:j().optional(),idempotentHint:j().optional(),openWorldHint:j().optional()}),Qe=g({taskSupport:x([`required`,`optional`,`forbidden`]).optional()}),$e=g({...ie.shape,...re.shape,description:S().optional(),inputSchema:g({type:E(`object`),properties:O(S(),e).optional(),required:C(S()).optional()}).catchall(k()),outputSchema:g({type:E(`object`),properties:O(S(),e).optional(),required:C(S()).optional()}).catchall(k()).optional(),annotations:U.optional(),execution:Qe.optional(),_meta:O(S(),k()).optional()}),et=ve.extend({method:E(`tools/list`)}),tt=ye.extend({tools:C($e)}),nt=v.extend({content:C(Je),structuredContent:O(S(),k()).optional(),isError:j().optional()}),rt=c.extend({name:S(),arguments:O(S(),k()).optional()}),it=l.extend({method:E(`tools/call`),params:rt}),at=_.extend({method:E(`notifications/tools/list_changed`),params:h.optional()}),ot=x([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),W=s.extend({level:ot}),st=l.extend({method:E(`logging/setLevel`),params:W}),ct=h.extend({level:ot,logger:S().optional(),data:k()}),lt=_.extend({method:E(`notifications/message`),params:ct}),ut=g({name:S().optional()}),dt=g({hints:C(ut).optional(),costPriority:A().min(0).max(1).optional(),speedPriority:A().min(0).max(1).optional(),intelligencePriority:A().min(0).max(1).optional()}),ft=g({mode:x([`auto`,`required`,`none`]).optional()}),pt=g({type:E(`tool_result`),toolUseId:S().describe(`The unique identifier for the corresponding tool call.`),content:C(Je),structuredContent:g({}).loose().optional(),isError:j().optional(),_meta:O(S(),k()).optional()}),mt=d(`type`,[z,B,V]),ht=d(`type`,[z,B,V,Ke,pt]),gt=g({role:Ce,content:u([ht,C(ht)]),_meta:O(S(),k()).optional()}),_t=c.extend({messages:C(gt),modelPreferences:dt.optional(),systemPrompt:S().optional(),includeContext:x([`none`,`thisServer`,`allServers`]).optional(),temperature:A().optional(),maxTokens:A().int(),stopSequences:C(S()).optional(),metadata:t.optional(),tools:C($e).optional(),toolChoice:ft.optional()}),vt=l.extend({method:E(`sampling/createMessage`),params:_t}),yt=v.extend({model:S(),stopReason:D(x([`endTurn`,`stopSequence`,`maxTokens`]).or(S())),role:Ce,content:mt}),bt=v.extend({model:S(),stopReason:D(x([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(S())),role:Ce,content:u([ht,C(ht)])}),xt=g({type:E(`boolean`),title:S().optional(),description:S().optional(),default:j().optional()}),St=g({type:E(`string`),title:S().optional(),description:S().optional(),minLength:A().optional(),maxLength:A().optional(),format:x([`email`,`uri`,`date`,`date-time`]).optional(),default:S().optional()}),Ct=g({type:x([`number`,`integer`]),title:S().optional(),description:S().optional(),minimum:A().optional(),maximum:A().optional(),default:A().optional()}),wt=g({type:E(`string`),title:S().optional(),description:S().optional(),enum:C(S()),default:S().optional()}),Tt=g({type:E(`string`),title:S().optional(),description:S().optional(),oneOf:C(g({const:S(),title:S()})),default:S().optional()}),Et=g({type:E(`string`),title:S().optional(),description:S().optional(),enum:C(S()),enumNames:C(S()).optional(),default:S().optional()}),Dt=u([wt,Tt]),Ot=g({type:E(`array`),title:S().optional(),description:S().optional(),minItems:A().optional(),maxItems:A().optional(),items:g({type:E(`string`),enum:C(S())}),default:C(S()).optional()}),kt=g({type:E(`array`),title:S().optional(),description:S().optional(),minItems:A().optional(),maxItems:A().optional(),items:g({anyOf:C(g({const:S(),title:S()}))}),default:C(S()).optional()}),At=u([Ot,kt]),jt=u([Et,Dt,At]),Mt=u([jt,xt,St,Ct]),Nt=c.extend({mode:E(`form`).optional(),message:S(),requestedSchema:g({type:E(`object`),properties:O(S(),Mt),required:C(S()).optional()}).catchall(k())}),Pt=c.extend({mode:E(`url`),message:S(),elicitationId:S(),url:S().url()}),Ft=u([Nt,Pt]),G=l.extend({method:E(`elicitation/create`),params:Ft}),It=h.extend({elicitationId:S()}),Lt=_.extend({method:E(`notifications/elicitation/complete`),params:It}),Rt=v.extend({action:x([`accept`,`decline`,`cancel`]),content:ee(e=>e===null?void 0:e,O(S(),u([S(),A(),j(),C(S())])).optional())}),zt=g({type:E(`ref/resource`),uri:S()}),Bt=g({type:E(`ref/prompt`),name:S()}),Vt=s.extend({ref:u([Bt,zt]),argument:g({name:S(),value:S()}),context:g({arguments:O(S(),S()).optional()}).optional()}),Ht=l.extend({method:E(`completion/complete`),params:Vt}),Ut=v.extend({completion:p({values:C(S()).max(100),total:D(A().int()),hasMore:D(j())})}),Wt=g({uri:S().startsWith(`file://`),name:S().optional(),_meta:O(S(),k()).optional()}),Gt=l.extend({method:E(`roots/list`),params:s.optional()}),Kt=v.extend({roots:C(Wt)}),qt=_.extend({method:E(`notifications/roots/list_changed`),params:h.optional()}),Jt=p({ttl:A().optional(),pollInterval:A().optional()}),Yt=x([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Xt=g({taskId:S(),status:Yt,ttl:u([A(),f()]),createdAt:S(),lastUpdatedAt:S(),pollInterval:D(A()),statusMessage:D(S())}),Zt=v.extend({task:Xt}),Qt=h.merge(Xt),$t=_.extend({method:E(`notifications/tasks/status`),params:Qt}),en=l.extend({method:E(`tasks/get`),params:s.extend({taskId:S()})}),K=v.merge(Xt),tn=l.extend({method:E(`tasks/result`),params:s.extend({taskId:S()})}),nn=v.loose(),rn=ve.extend({method:E(`tasks/list`)}),an=ye.extend({tasks:C(Xt)}),on=l.extend({method:E(`tasks/cancel`),params:s.extend({taskId:S()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:h,NotificationSchema:_,ResultSchema:v,RequestIdSchema:y,EmptyResultSchema:b,CancelledNotificationParamsSchema:T,CancelledNotificationSchema:te,IconSchema:ne,IconsSchema:re,BaseMetadataSchema:ie,ImplementationSchema:ae,ClientTasksCapabilitySchema:ce,ServerTasksCapabilitySchema:le,ClientCapabilitiesSchema:ue,InitializeRequestParamsSchema:de,InitializeRequestSchema:pe,ServerCapabilitiesSchema:me,InitializeResultSchema:M,InitializedNotificationSchema:N,PingRequestSchema:he,ProgressSchema:P,ProgressNotificationParamsSchema:F,ProgressNotificationSchema:ge,PaginatedRequestParamsSchema:_e,PaginatedRequestSchema:ve,PaginatedResultSchema:ye,ResourceContentsSchema:I,TextResourceContentsSchema:be,BlobResourceContentsSchema:Se,RoleSchema:Ce,AnnotationsSchema:we,ResourceSchema:Te,ResourceTemplateSchema:Ee,ListResourcesRequestSchema:De,ListResourcesResultSchema:Oe,ListResourceTemplatesRequestSchema:ke,ListResourceTemplatesResultSchema:Ae,ResourceRequestParamsSchema:je,ReadResourceRequestParamsSchema:Me,ReadResourceRequestSchema:Ne,ReadResourceResultSchema:Pe,ResourceListChangedNotificationSchema:Fe,SubscribeRequestParamsSchema:Ie,SubscribeRequestSchema:Le,UnsubscribeRequestParamsSchema:Re,UnsubscribeRequestSchema:L,ResourceUpdatedNotificationParamsSchema:ze,ResourceUpdatedNotificationSchema:Be,PromptArgumentSchema:Ve,PromptSchema:He,ListPromptsRequestSchema:Ue,ListPromptsResultSchema:We,GetPromptRequestParamsSchema:R,GetPromptRequestSchema:Ge,TextContentSchema:z,ImageContentSchema:B,AudioContentSchema:V,ToolUseContentSchema:Ke,EmbeddedResourceSchema:H,ResourceLinkSchema:qe,ContentBlockSchema:Je,PromptMessageSchema:Ye,GetPromptResultSchema:Xe,PromptListChangedNotificationSchema:Ze,ToolAnnotationsSchema:U,ToolExecutionSchema:Qe,ToolSchema:$e,ListToolsRequestSchema:et,ListToolsResultSchema:tt,CallToolResultSchema:nt,CallToolRequestParamsSchema:rt,CallToolRequestSchema:it,ToolListChangedNotificationSchema:at,LoggingLevelSchema:ot,SetLevelRequestParamsSchema:W,SetLevelRequestSchema:st,LoggingMessageNotificationParamsSchema:ct,LoggingMessageNotificationSchema:lt,ModelHintSchema:ut,ModelPreferencesSchema:dt,ToolChoiceSchema:ft,ToolResultContentSchema:pt,SamplingContentSchema:mt,SamplingMessageContentBlockSchema:ht,SamplingMessageSchema:gt,CreateMessageRequestParamsSchema:_t,CreateMessageRequestSchema:vt,CreateMessageResultSchema:yt,CreateMessageResultWithToolsSchema:bt,BooleanSchemaSchema:xt,StringSchemaSchema:St,NumberSchemaSchema:Ct,UntitledSingleSelectEnumSchemaSchema:wt,TitledSingleSelectEnumSchemaSchema:Tt,LegacyTitledEnumSchemaSchema:Et,SingleSelectEnumSchemaSchema:Dt,UntitledMultiSelectEnumSchemaSchema:Ot,TitledMultiSelectEnumSchemaSchema:kt,MultiSelectEnumSchemaSchema:At,EnumSchemaSchema:jt,PrimitiveSchemaDefinitionSchema:Mt,ElicitRequestFormParamsSchema:Nt,ElicitRequestURLParamsSchema:Pt,ElicitRequestParamsSchema:Ft,ElicitRequestSchema:G,ElicitationCompleteNotificationParamsSchema:It,ElicitationCompleteNotificationSchema:Lt,ElicitResultSchema:Rt,ResourceTemplateReferenceSchema:zt,PromptReferenceSchema:Bt,CompleteRequestParamsSchema:Vt,CompleteRequestSchema:Ht,CompleteResultSchema:Ut,RootSchema:Wt,ListRootsRequestSchema:Gt,ListRootsResultSchema:Kt,RootsListChangedNotificationSchema:qt,TaskCreationParamsSchema:Jt,TaskStatusSchema:Yt,TaskSchema:Xt,CreateTaskResultSchema:Zt,TaskStatusNotificationParamsSchema:Qt,TaskStatusNotificationSchema:$t,GetTaskRequestSchema:en,GetTaskResultSchema:K,GetTaskPayloadRequestSchema:tn,GetTaskPayloadResultSchema:nn,ListTasksRequestSchema:rn,ListTasksResultSchema:an,CancelTaskRequestSchema:on,CancelTaskResultSchema:v.merge(Xt),ClientRequestSchema:u([he,pe,Ht,st,Ge,Ue,De,ke,Ne,Le,L,it,et,en,tn,rn,on]),ClientNotificationSchema:u([te,ge,N,qt,$t]),ClientResultSchema:u([b,yt,bt,Rt,Kt,K,an,Zt]),ServerRequestSchema:u([he,vt,G,Gt,en,tn,rn,on]),ServerNotificationSchema:u([te,ge,lt,Be,Fe,at,Ze,$t,Lt]),ServerResultSchema:u([b,M,Ut,Xe,We,Oe,Ae,Pe,nt,tt,K,an,Zt]),CallToolResultWireSchema:k().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of ui)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(di).pipe(nt)}}var pi;function mi(){return pi??=fi()}function hi(e){return e.type!==`object`}var gi=new Set([`const`,`enum`,`default`,`examples`]),_i=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function vi(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function yi(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(vi(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=De(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&&vi(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]=gi.has(o)?s:_i.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 bi={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},xi={"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},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,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ci;function wi(){if(Ci)return Ci;let e=mi();return Ci={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}},Ci}function Ti(e){return Object.prototype.hasOwnProperty.call(bi,e)}function Ei(e){return Object.prototype.hasOwnProperty.call(xi,e)}function Di(e){return Object.prototype.hasOwnProperty.call(Si,e)}function Oi(e){return Di(e)?wi().resultSchemas[e]:void 0}function ki(e){return Ti(e)?wi().requestSchemas[e]:void 0}function Ai(e){return Ei(e)?wi().notificationSchemas[e]:void 0}Object.keys(bi),Object.keys(xi);function ji(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Mi(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 Ni={ok:!1,reason:`not-in-era`};function Pi(e){return ji(e)&&ji(e.outputSchema)&&hi(e.outputSchema)}function Fi(e){return e}var Ii={era:`2025-11-25`,hasRequestMethod:Ti,hasNotificationMethod:Ei,validateRequest:(e,t)=>Mi(ki(e),t),validateResult:(e,t)=>Mi(Oi(e),t),validateNotification:(e,t)=>Mi(Ai(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Ni,validateInputResponse:()=>Ni,samplingResultVariant:((e,t)=>{let n=mi();return Mi(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=li(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&hi(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(ji(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:Fi(e)}}return{kind:`complete`,result:Fi(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>Pi(e))?t:{...t,tools:n.map(e=>Pi(e)?{...e,outputSchema:yi(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function Li(){let e=w(()=>u([S(),A(),j(),f(),O(S(),e),C(e)])),t=O(S(),e),n=u([S(),A().int()]),r=S(),i=u([S(),A().int()]),a=x([`user`,`assistant`]),o=x([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=S().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=g({ttl:A().optional()}),l=g({taskId:S()}),d=p({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),h=g({_meta:d.optional()}),_=h.extend({task:c.optional()}),v=g({_meta:d.optional()}),y=g({method:S(),params:v.loose().optional()}),b=g({src:S(),mimeType:S().optional(),sizes:C(S()).optional(),theme:x([`light`,`dark`]).optional()}),T=g({icons:C(b).optional()}),te=g({name:S(),title:S().optional()}),ne=te.extend({...te.shape,...T.shape,version:S(),websiteUrl:S().optional(),description:S().optional()}),re=m(g({applyDefaults:j().optional()}),t),ie=ee(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,m(g({form:re.optional(),url:t.optional()}),t.optional())),ae=p({list:t.optional(),cancel:t.optional(),requests:p({sampling:p({createMessage:t.optional()}).optional(),elicitation:p({create:t.optional()}).optional()}).optional()}),oe=p({list:t.optional(),cancel:t.optional(),requests:p({tools:p({call:t.optional()}).optional()}).optional()}),se=g({experimental:O(S(),t).optional(),sampling:g({context:t.optional(),tools:t.optional()}).optional(),elicitation:ie.optional(),roots:g({listChanged:j().optional()}).optional(),tasks:ae.optional(),extensions:O(S(),t).optional()}),ce=g({experimental:O(S(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:g({listChanged:j().optional()}).optional(),resources:g({subscribe:j().optional(),listChanged:j().optional()}).optional(),tools:g({listChanged:j().optional()}).optional(),tasks:oe.optional(),extensions:O(S(),t).optional()}),le=g({progress:A(),total:D(A()),message:D(S())}),ue=g({...v.shape,...le.shape,progressToken:n}),de=y.extend({method:E(`notifications/progress`),params:ue}),pe=v.extend({level:o,logger:S().optional(),data:k()}),me=y.extend({method:E(`notifications/message`),params:pe}),M=g({uri:S(),mimeType:D(S()),_meta:O(S(),k()).optional()}),N=M.extend({text:S()}),he=M.extend({blob:s}),P=g({audience:C(a).optional(),priority:A().min(0).max(1).optional(),lastModified:fe({offset:!0}).optional()}),F=g({...te.shape,...T.shape,uri:S(),description:D(S()),mimeType:D(S()),size:D(A()),annotations:P.optional(),_meta:D(p({}))}),ge=g({...te.shape,...T.shape,uriTemplate:S(),description:D(S()),mimeType:D(S()),annotations:P.optional(),_meta:D(p({}))}),_e=y.extend({method:E(`notifications/resources/list_changed`),params:v.optional()}),ve=v.extend({uri:S()}),ye=y.extend({method:E(`notifications/resources/updated`),params:ve}),I=g({name:S(),description:D(S()),required:D(j())}),be=g({...te.shape,...T.shape,description:D(S()),arguments:D(C(I)),_meta:D(p({}))}),xe=y.extend({method:E(`notifications/prompts/list_changed`),params:v.optional()}),Se=g({type:E(`text`),text:S(),annotations:P.optional(),_meta:O(S(),k()).optional()}),Ce=g({type:E(`image`),data:s,mimeType:S(),annotations:P.optional(),_meta:O(S(),k()).optional()}),we=g({type:E(`audio`),data:s,mimeType:S(),annotations:P.optional(),_meta:O(S(),k()).optional()}),Te=g({type:E(`tool_use`),name:S(),id:S(),input:O(S(),k()),_meta:O(S(),k()).optional()}),Ee=g({type:E(`resource`),resource:u([N,he]),annotations:P.optional(),_meta:O(S(),k()).optional()}),De=F.extend({type:E(`resource_link`)}),Oe=u([Se,Ce,we,De,Ee]),ke=g({role:a,content:Oe}),Ae=g({title:S().optional(),readOnlyHint:j().optional(),destructiveHint:j().optional(),idempotentHint:j().optional(),openWorldHint:j().optional()}),je=y.extend({method:E(`notifications/tools/list_changed`),params:v.optional()}),Ie=g({name:S().optional()}),Re=g({hints:C(Ie).optional(),costPriority:A().min(0).max(1).optional(),speedPriority:A().min(0).max(1).optional(),intelligencePriority:A().min(0).max(1).optional()}),L=g({mode:x([`auto`,`required`,`none`]).optional()}),ze=g({type:E(`boolean`),title:S().optional(),description:S().optional(),default:j().optional()}),Be=g({type:E(`string`),title:S().optional(),description:S().optional(),minLength:A().optional(),maxLength:A().optional(),format:x([`email`,`uri`,`date`,`date-time`]).optional(),default:S().optional()}),Ve=g({type:x([`number`,`integer`]),title:S().optional(),description:S().optional(),minimum:A().optional(),maximum:A().optional(),default:A().optional()}),He=g({type:E(`string`),title:S().optional(),description:S().optional(),enum:C(S()),default:S().optional()}),Ue=g({type:E(`string`),title:S().optional(),description:S().optional(),oneOf:C(g({const:S(),title:S()})),default:S().optional()}),We=g({type:E(`string`),title:S().optional(),description:S().optional(),enum:C(S()),enumNames:C(S()).optional(),default:S().optional()}),R=u([He,Ue]),Ge=g({type:E(`array`),title:S().optional(),description:S().optional(),minItems:A().optional(),maxItems:A().optional(),items:g({type:E(`string`),enum:C(S())}),default:C(S()).optional()}),z=g({type:E(`array`),title:S().optional(),description:S().optional(),minItems:A().optional(),maxItems:A().optional(),items:g({anyOf:C(g({const:S(),title:S()}))}),default:C(S()).optional()}),B=u([Ge,z]),V=u([We,R,B]),Ke=u([V,ze,Be,Ve]),H=_.extend({mode:E(`form`).optional(),message:S(),requestedSchema:g({type:E(`object`),properties:O(S(),Ke),required:C(S()).optional()}).catchall(k())}),qe=g({type:E(`ref/resource`),uri:S()}),Je=g({type:E(`ref/prompt`),name:S()}),Ye=g({uri:S().startsWith(`file://`),name:S().optional(),_meta:O(S(),k()).optional()}),Xe=se.shape,Ze=g({experimental:Xe.experimental,sampling:Xe.sampling,elicitation:Xe.elicitation,roots:Xe.roots,extensions:Xe.extensions}),U=ce.shape,Qe=g({experimental:U.experimental,logging:U.logging,completions:U.completions,prompts:U.prompts,resources:U.resources,tools:U.tools,extensions:U.extensions}),$e=p({progressToken:n.optional(),[Me]:S(),[Ne]:ne.optional(),[Fe]:Ze,[Le]:o.optional()}),et=g({...te.shape,...T.shape,description:S().optional(),inputSchema:p({$schema:S().optional(),type:E(`object`)}),outputSchema:p({$schema:S().optional()}).optional(),annotations:Ae.optional(),_meta:O(S(),k()).optional()}),tt=g({type:E(`tool_result`),toolUseId:S(),content:C(Oe),structuredContent:k().optional(),isError:j().optional(),_meta:O(S(),k()).optional()}),nt=u([Se,Ce,we,Te,tt]),rt=g({role:a,content:u([nt,C(nt)]),_meta:O(S(),k()).optional()}),it=S(),at=p({[Pe]:ne.optional().catch(void 0)}),ot=at.optional();function W(e){return p({_meta:ot,resultType:it.default(`complete`),...e})}let st=W({}),ct=W({nextCursor:r.optional()}),lt=W({content:C(Oe),structuredContent:k().optional(),isError:j().optional()}),ut=W({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),tools:C(et),nextCursor:r.optional()}),dt=W({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),prompts:C(be),nextCursor:r.optional()}),ft=W({description:S().optional(),messages:C(ke)}),pt=W({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),resources:C(F),nextCursor:r.optional()}),mt=W({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),resourceTemplates:C(ge),nextCursor:r.optional()}),ht=W({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),contents:C(u([N,he]))}),gt=W({completion:g({values:C(S()).max(100),total:A().int().optional(),hasMore:j().optional()}).loose()}),_t=W({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`])}),vt=W({ttlMs:A().int().min(0).catch(0),cacheScope:x([`public`,`private`]).catch(`private`),supportedVersions:C(S()),capabilities:Qe,instructions:S().optional()}),yt=g({messages:C(rt),modelPreferences:Re.optional(),systemPrompt:S().optional(),includeContext:x([`none`,`thisServer`,`allServers`]).optional(),temperature:A().optional(),maxTokens:A().int(),stopSequences:C(S()).optional(),metadata:t.optional(),tools:C(et).optional(),toolChoice:L.optional()}),bt=g({method:E(`sampling/createMessage`),params:yt}),xt=g({method:E(`roots/list`),params:g({_meta:O(S(),k()).optional()}).optional()}),St=g({...rt.shape,model:S(),stopReason:S().optional()}),Ct=g({roots:C(Ye)}),wt=g({action:x([`accept`,`decline`,`cancel`]),content:O(S(),u([S(),A(),j(),C(S())])).optional()}),Tt=g({mode:E(`url`),message:S(),url:S().url()}),Et=u([H,Tt]),Dt=g({method:E(`elicitation/create`),params:Et}),Ot=u([bt,xt,Dt]),kt=u([St,Ct,wt]),At=O(S(),Ot),jt=O(S(),kt),Mt=W({inputRequests:At.optional(),requestState:S().optional()}),Nt={inputResponses:jt.optional(),requestState:S().optional()},Pt=g({_meta:$e,...Nt}),Ft=p({progressToken:n.optional()});function G(e,t){return g({method:E(e),params:g({_meta:$e,...t})})}function It(e,t){return g({method:E(e),params:g({_meta:Ft.optional(),...t}).optional()})}let Lt={name:S(),arguments:O(S(),k()).optional(),...Nt},Rt={cursor:r.optional()},zt=G(`tools/call`,Lt),Bt=G(`tools/list`,Rt),Vt=G(`prompts/list`,Rt),Ht=G(`prompts/get`,{name:S(),arguments:O(S(),S()).optional(),...Nt}),Ut=G(`resources/list`,Rt),Wt=G(`resources/templates/list`,Rt),Gt=G(`resources/read`,{uri:S(),...Nt}),Kt={ref:u([Je,qe]),argument:g({name:S(),value:S()}),context:g({arguments:O(S(),S()).optional()}).optional()},qt=G(`completion/complete`,Kt),Jt=G(`server/discover`,{}),Yt=g({toolsListChanged:j().optional(),promptsListChanged:j().optional(),resourcesListChanged:j().optional(),resourceSubscriptions:C(S()).optional()}),Xt={notifications:Yt},Zt=G(`subscriptions/listen`,Xt),Qt=at.extend({"io.modelcontextprotocol/subscriptionId":i}),$t=p({_meta:Qt,resultType:it.default(`complete`)}),en={"tools/call":It(`tools/call`,Lt),"tools/list":It(`tools/list`,Rt),"prompts/get":It(`prompts/get`,{name:S(),arguments:O(S(),S()).optional()}),"prompts/list":It(`prompts/list`,Rt),"resources/list":It(`resources/list`,Rt),"resources/templates/list":It(`resources/templates/list`,Rt),"resources/read":It(`resources/read`,{uri:S()}),"completion/complete":It(`completion/complete`,Kt),"server/discover":It(`server/discover`,{}),"subscriptions/listen":It(`subscriptions/listen`,Xt)};function K(e){return p({_meta:ot,...e})}let tn={"tools/call":K({content:C(Oe),structuredContent:k().optional(),isError:j().optional()}),"tools/list":K({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),tools:C(et),nextCursor:r.optional()}),"prompts/get":K({description:S().optional(),messages:C(ke)}),"prompts/list":K({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),prompts:C(be),nextCursor:r.optional()}),"resources/list":K({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),resources:C(F),nextCursor:r.optional()}),"resources/templates/list":K({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),resourceTemplates:C(ge),nextCursor:r.optional()}),"resources/read":K({ttlMs:A().int().min(0),cacheScope:x([`public`,`private`]),contents:C(u([N,he]))}),"completion/complete":K({completion:g({values:C(S()).max(100),total:A().int().optional(),hasMore:j().optional()}).loose()}),"server/discover":K({ttlMs:A().int().min(0).catch(0),cacheScope:x([`public`,`private`]).catch(`private`),supportedVersions:C(S()),capabilities:Qe,instructions:S().optional()}),"subscriptions/listen":K({})},nn=p({"io.modelcontextprotocol/subscriptionId":i.optional()}),rn=g({method:E(`notifications/subscriptions/acknowledged`),params:g({_meta:nn.optional(),notifications:Yt})}),an=g({_meta:nn.optional(),requestId:i,reason:S().optional()}),on=g({method:E(`notifications/cancelled`),params:an}),sn={"notifications/cancelled":on,"notifications/progress":de,"notifications/message":me,"notifications/resources/updated":ye,"notifications/resources/list_changed":_e,"notifications/tools/list_changed":je,"notifications/prompts/list_changed":xe,"notifications/subscriptions/acknowledged":rn},cn=e=>g({jsonrpc:E(`2.0`),id:u([S(),A().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:d,BaseRequestParamsSchema:h,TaskAugmentedRequestParamsSchema:_,NotificationsParamsSchema:v,NotificationSchema:y,IconSchema:b,IconsSchema:T,BaseMetadataSchema:te,ImplementationSchema:ne,ClientTasksCapabilitySchema:ae,ServerTasksCapabilitySchema:oe,ClientCapabilitiesSchema:se,ServerCapabilitiesSchema:ce,ProgressSchema:le,ProgressNotificationParamsSchema:ue,ProgressNotificationSchema:de,LoggingMessageNotificationParamsSchema:pe,LoggingMessageNotificationSchema:me,ResourceContentsSchema:M,TextResourceContentsSchema:N,BlobResourceContentsSchema:he,AnnotationsSchema:P,ResourceSchema:F,ResourceTemplateSchema:ge,ResourceListChangedNotificationSchema:_e,ResourceUpdatedNotificationParamsSchema:ve,ResourceUpdatedNotificationSchema:ye,PromptArgumentSchema:I,PromptSchema:be,PromptListChangedNotificationSchema:xe,TextContentSchema:Se,ImageContentSchema:Ce,AudioContentSchema:we,ToolUseContentSchema:Te,EmbeddedResourceSchema:Ee,ResourceLinkSchema:De,ContentBlockSchema:Oe,PromptMessageSchema:ke,ToolAnnotationsSchema:Ae,ToolListChangedNotificationSchema:je,ModelHintSchema:Ie,ModelPreferencesSchema:Re,ToolChoiceSchema:L,BooleanSchemaSchema:ze,StringSchemaSchema:Be,NumberSchemaSchema:Ve,UntitledSingleSelectEnumSchemaSchema:He,TitledSingleSelectEnumSchemaSchema:Ue,LegacyTitledEnumSchemaSchema:We,SingleSelectEnumSchemaSchema:R,UntitledMultiSelectEnumSchemaSchema:Ge,TitledMultiSelectEnumSchemaSchema:z,MultiSelectEnumSchemaSchema:B,EnumSchemaSchema:V,PrimitiveSchemaDefinitionSchema:Ke,ElicitRequestFormParamsSchema:H,ResourceTemplateReferenceSchema:qe,PromptReferenceSchema:Je,RootSchema:Ye,ClientCapabilities2026Schema:Ze,ServerCapabilities2026Schema:Qe,RequestMetaEnvelopeSchema:$e,ToolSchema:et,ToolResultContentSchema:tt,SamplingMessageContentBlockSchema:nt,SamplingMessageSchema:rt,ResultTypeSchema:it,ResultMetaSchema:at,ResultSchema:st,PaginatedResultSchema:ct,CallToolResultSchema:lt,ListToolsResultSchema:ut,ListPromptsResultSchema:dt,GetPromptResultSchema:ft,ListResourcesResultSchema:pt,ListResourceTemplatesResultSchema:mt,ReadResourceResultSchema:ht,CompleteResultSchema:gt,CacheableResultSchema:_t,DiscoverResultSchema:vt,CreateMessageRequestParamsSchema:yt,CreateMessageRequestSchema:bt,ListRootsRequestSchema:xt,CreateMessageResultSchema:St,ListRootsResultSchema:Ct,ElicitResultSchema:wt,ElicitRequestURLParamsSchema:Tt,ElicitRequestParamsSchema:Et,ElicitRequestSchema:Dt,InputRequestSchema:Ot,InputResponseSchema:kt,InputRequestsSchema:At,InputResponsesSchema:jt,InputRequiredResultSchema:Mt,InputResponseRequestParamsSchema:Pt,CallToolRequestSchema:zt,ListToolsRequestSchema:Bt,ListPromptsRequestSchema:Vt,GetPromptRequestSchema:Ht,ListResourcesRequestSchema:Ut,ListResourceTemplatesRequestSchema:Wt,ReadResourceRequestSchema:Gt,CompleteRequestSchema:qt,DiscoverRequestSchema:Jt,SubscriptionFilterSchema:Yt,SubscriptionsListenRequestSchema:Zt,SubscriptionsListenResultMetaSchema:Qt,SubscriptionsListenResultSchema:$t,dispatchRequestSchemas:en,dispatchResultSchemas:tn,NotificationMetaSchema:nn,SubscriptionsAcknowledgedNotificationSchema:rn,CancelledNotificationParamsSchema:an,CancelledNotificationSchema:on,notificationSchemas2026:sn,JSONRPCResultResponseSchema:cn(st),CallToolResultResponseSchema:cn(u([lt,Mt])),ListToolsResultResponseSchema:cn(ut),ListPromptsResultResponseSchema:cn(dt),GetPromptResultResponseSchema:cn(u([ft,Mt])),ListResourcesResultResponseSchema:cn(pt),ListResourceTemplatesResultResponseSchema:cn(mt),ReadResourceResultResponseSchema:cn(u([ht,Mt])),CompleteResultResponseSchema:cn(gt),DiscoverResultResponseSchema:cn(vt),SubscriptionsListenResultResponseSchema:cn($t)}}var Ri;function zi(){return Ri??=Li()}var Bi=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function Vi(e){return Bi.includes(e)}var Hi=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function Ui(e){return e[Hi]}function Wi(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function Gi(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 Zr(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 Zr(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Xr(this,new.target)}static fromError(t,n,r){if(t===X.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new qi(e.elicitations,n)}if(t===X.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new Ji({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 Ki(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 Yi({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},Ki=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}},qi=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??[]}},Ji=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}},Yi=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}},Xi=0,Zi=`private`,Qi=[`tools/call`,`prompts/get`,`resources/read`];function $i(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||Qi.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 ea(e,t){let n=Ui(t);if(t.resultType!==`complete`||!Vi(e))return n===void 0?t:aa(t);let r=t,i=Wi(r.ttlMs)?r.ttlMs:ra(n),a=Gi(r.cacheScope)?r.cacheScope:ia(n),o={...r,ttlMs:i,cacheScope:a};return delete o[Hi],o}function ta(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function na(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[Pe]:t}}:!ta(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[Pe]:t}}}function ra(e){return e!==void 0&&Wi(e.ttlMs)?e.ttlMs:Xi}function ia(e){return e!==void 0&&Gi(e.cacheScope)?e.cacheScope:Zi}function aa(e){let t={...e};return delete t[Hi],t}var oa=[`elicitation/create`,`sampling/createMessage`,`roots/list`],sa;function ca(){if(sa)return sa;let e=zi();return sa={request:{"elicitation/create":g({method:E(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":g({method:E(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":g({method:E(`roots/list`),params:p({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},sa}function la(e){return oa.includes(e)}function ua(e){return la(e)?ca().request[e]:void 0}function da(e){return la(e)?ca().response[e]:void 0}var fa={"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},pa={"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 ma(e){return Object.prototype.hasOwnProperty.call(fa,e)}function ha(e){return Object.prototype.hasOwnProperty.call(pa,e)}function ga(e){return Object.prototype.hasOwnProperty.call(fa,e)}function _a(e){return ma(e)?zi().dispatchRequestSchemas[e]:void 0}function va(e){return ga(e)?zi().dispatchResultSchemas[e]:void 0}function ya(e){return ha(e)?zi().notificationSchemas2026[e]:void 0}Object.keys(fa),Object.keys(pa);function ba(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function xa(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 Sa={ok:!1,reason:`not-in-era`},Ca=[Me,Fe];function wa(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=>ba(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!ba(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(ba(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var Ta={era:`2026-07-28`,hasRequestMethod:ma,hasNotificationMethod:ha,hasInputRequestMethod:e=>ua(e)!==void 0,validateRequest:(e,t)=>xa(_a(e),t),validateResult:(e,t)=>xa(va(e),t),validateNotification:(e,t)=>xa(ya(e),t),validateInputRequest:(e,t)=>xa(ua(e),t),validateInputResponse:(e,t)=>xa(da(e),t),samplingResultVariant:()=>Sa,outboundEnvelope(e){return{[Me]:e.protocolVersion,[Ne]:e.clientInfo,[Fe]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Ca)n in e||t.push({key:n,problem:`missing`});let n=zi().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=>li(e),inputRequestSchema:ua,decodeResult(e,t){if(!ba(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=ba(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:zi().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=Da(),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 na(ea(e,$i(e,wa(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=zi().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(`; `)}`}},Ea;function Da(){if(Ea)return Ea;let e=zi();return Ea={"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},Ea}var Oa=`2026-07-28`;function ka(e){return e!==void 0&&oi(e)?Ta:Ii}function Aa(e){return e.revision===void 0?e.era===`modern`?Ta.era:Ii.era:ka(e.revision).era}function ja(e){return Pa.some(t=>t.hasRequestMethod(e))}function Ma(e){return Pa.some(t=>t.hasNotificationMethod(e))}function Na(e){return e===`tasks/get`||e===`tasks/cancel`}var Pa=[Ii,Ta],Fa=be({AnnotationsSchema:()=>kt,AudioContentSchema:()=>sn,BaseMetadataSchema:()=>it,BaseRequestParamsSchema:()=>R,BlobResourceContentsSchema:()=>Dt,BooleanSchemaSchema:()=>Hn,CallToolRequestParamsSchema:()=>Sn,CallToolRequestSchema:()=>Cn,CallToolResultSchema:()=>bn,CancelTaskRequestSchema:()=>Or,CancelTaskResultSchema:()=>kr,CancelledNotificationParamsSchema:()=>et,CancelledNotificationSchema:()=>tt,ClientCapabilitiesSchema:()=>lt,ClientNotificationSchema:()=>jr,ClientRequestSchema:()=>Ar,ClientResultSchema:()=>Mr,ClientTasksCapabilitySchema:()=>st,CompatibilityCallToolResultSchema:()=>xn,CompleteRequestParamsSchema:()=>lr,CompleteRequestSchema:()=>ur,CompleteResultSchema:()=>dr,ContentBlockSchema:()=>dn,CreateMessageRequestParamsSchema:()=>Rn,CreateMessageRequestSchema:()=>zn,CreateMessageResultSchema:()=>Bn,CreateMessageResultWithToolsSchema:()=>Vn,CreateTaskResultSchema:()=>yr,CursorSchema:()=>Ve,DiscoverRequestSchema:()=>ht,DiscoverResultSchema:()=>gt,ElicitRequestFormParamsSchema:()=>er,ElicitRequestParamsSchema:()=>nr,ElicitRequestSchema:()=>rr,ElicitRequestURLParamsSchema:()=>tr,ElicitResultSchema:()=>or,ElicitationCompleteNotificationParamsSchema:()=>ir,ElicitationCompleteNotificationSchema:()=>ar,EmbeddedResourceSchema:()=>ln,EmptyResultSchema:()=>$e,EnumSchemaSchema:()=>Qn,GetPromptRequestParamsSchema:()=>nn,GetPromptRequestSchema:()=>rn,GetPromptResultSchema:()=>pn,GetTaskPayloadRequestSchema:()=>wr,GetTaskPayloadResultSchema:()=>Tr,GetTaskRequestSchema:()=>Sr,GetTaskResultSchema:()=>Cr,IconSchema:()=>nt,IconsSchema:()=>rt,ImageContentSchema:()=>on,ImplementationSchema:()=>at,InitializeRequestParamsSchema:()=>ut,InitializeRequestSchema:()=>dt,InitializeResultSchema:()=>pt,InitializedNotificationSchema:()=>mt,JSONArraySchema:()=>ze,JSONObjectSchema:()=>L,JSONRPCErrorResponseSchema:()=>Ze,JSONRPCMessageSchema:()=>U,JSONRPCNotificationSchema:()=>Ye,JSONRPCRequestSchema:()=>Je,JSONRPCResponseSchema:()=>Qe,JSONRPCResultResponseSchema:()=>Xe,JSONValueSchema:()=>Re,LegacyTitledEnumSchemaSchema:()=>qn,ListChangedOptionsBaseSchema:()=>Tn,ListPromptsRequestSchema:()=>K,ListPromptsResultSchema:()=>tn,ListResourceTemplatesRequestSchema:()=>Pt,ListResourceTemplatesResultSchema:()=>Ft,ListResourcesRequestSchema:()=>Mt,ListResourcesResultSchema:()=>Nt,ListRootsRequestSchema:()=>pr,ListRootsResultSchema:()=>mr,ListTasksRequestSchema:()=>Er,ListTasksResultSchema:()=>Dr,ListToolsRequestSchema:()=>vn,ListToolsResultSchema:()=>yn,LoggingLevelSchema:()=>En,LoggingMessageNotificationParamsSchema:()=>kn,LoggingMessageNotificationSchema:()=>An,ModelHintSchema:()=>jn,ModelPreferencesSchema:()=>Mn,MultiSelectEnumSchemaSchema:()=>Zn,NotificationSchema:()=>V,NotificationsParamsSchema:()=>B,NumberSchemaSchema:()=>Wn,PaginatedRequestParamsSchema:()=>xt,PaginatedRequestSchema:()=>St,PaginatedResultSchema:()=>Ct,PingRequestSchema:()=>_t,PrimitiveSchemaDefinitionSchema:()=>$n,ProgressNotificationParamsSchema:()=>yt,ProgressNotificationSchema:()=>bt,ProgressSchema:()=>vt,ProgressTokenSchema:()=>Be,PromptArgumentSchema:()=>$t,PromptListChangedNotificationSchema:()=>mn,PromptMessageSchema:()=>fn,PromptReferenceSchema:()=>cr,PromptSchema:()=>en,ReadResourceRequestParamsSchema:()=>It,ReadResourceRequestSchema:()=>Lt,ReadResourceResultSchema:()=>Rt,RelatedTaskMetadataSchema:()=>Ue,RequestIdSchema:()=>qe,RequestMetaSchema:()=>We,RequestSchema:()=>z,ResourceContentsSchema:()=>wt,ResourceLinkSchema:()=>un,ResourceListChangedNotificationSchema:()=>zt,ResourceRequestParamsSchema:()=>G,ResourceSchema:()=>At,ResourceTemplateReferenceSchema:()=>sr,ResourceTemplateSchema:()=>jt,ResourceUpdatedNotificationParamsSchema:()=>Zt,ResourceUpdatedNotificationSchema:()=>Qt,ResultMetaObjectSchema:()=>Ke,ResultSchema:()=>H,RoleSchema:()=>Ot,RootSchema:()=>fr,RootsListChangedNotificationSchema:()=>hr,SamplingContentSchema:()=>Fn,SamplingMessageContentBlockSchema:()=>In,SamplingMessageSchema:()=>Ln,ServerCapabilitiesSchema:()=>ft,ServerNotificationSchema:()=>Pr,ServerRequestSchema:()=>Nr,ServerResultSchema:()=>Fr,ServerTasksCapabilitySchema:()=>ct,SetLevelRequestParamsSchema:()=>Dn,SetLevelRequestSchema:()=>On,SingleSelectEnumSchemaSchema:()=>Jn,StringSchemaSchema:()=>Un,SubscribeRequestParamsSchema:()=>Bt,SubscribeRequestSchema:()=>Vt,SubscriptionFilterSchema:()=>Wt,SubscriptionsAcknowledgedNotificationParamsSchema:()=>qt,SubscriptionsAcknowledgedNotificationSchema:()=>Jt,SubscriptionsListenRequestParamsSchema:()=>Gt,SubscriptionsListenRequestSchema:()=>Kt,SubscriptionsListenResultMetaSchema:()=>Yt,SubscriptionsListenResultSchema:()=>Xt,TaskAugmentedRequestParamsSchema:()=>Ge,TaskCreationParamsSchema:()=>gr,TaskMetadataSchema:()=>He,TaskSchema:()=>vr,TaskStatusNotificationParamsSchema:()=>br,TaskStatusNotificationSchema:()=>xr,TaskStatusSchema:()=>_r,TextContentSchema:()=>an,TextResourceContentsSchema:()=>Tt,TitledMultiSelectEnumSchemaSchema:()=>Xn,TitledSingleSelectEnumSchemaSchema:()=>Kn,ToolAnnotationsSchema:()=>hn,ToolChoiceSchema:()=>Nn,ToolExecutionSchema:()=>gn,ToolListChangedNotificationSchema:()=>wn,ToolResultContentSchema:()=>Pn,ToolSchema:()=>_n,ToolUseContentSchema:()=>cn,UnsubscribeRequestParamsSchema:()=>Ht,UnsubscribeRequestSchema:()=>Ut,UntitledMultiSelectEnumSchemaSchema:()=>Yn,UntitledSingleSelectEnumSchemaSchema:()=>Gn}),Ia=e=>Je.safeParse(e).success,La=e=>Ye.safeParse(e).success,Ra=e=>Xe.safeParse(e).success,za=e=>Ze.safeParse(e).success,Ba=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.resultType===`input_required`,Va=e=>dt.safeParse(e).success,Ha=e=>mt.safeParse(e).success,Ua=`Mcp-Param-`,Wa=`x-mcp-header`,Ga=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Ka=new Set([`string`,`integer`,`boolean`,`number`]);function qa(e){let t=[],n=new Map,r=(e,i,a)=>{if(typeof e!=`object`||!e)return;let o=e;if(Wa in o){if(!a||i.length===0)return`${Xa(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[Wa];if(typeof e!=`string`||e.length===0)return`${Xa(i)}: x-mcp-header MUST be a non-empty string`;if(!Ga.test(e))return`${Xa(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||!Ka.has(r))return`${Xa(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 Ja){let t=o[e];if(t===void 0)continue;let n=Array.isArray(t)?t:typeof t==`object`&&t&&Ya.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 Ja=[`items`,`prefixItems`,`contains`,`additionalProperties`,`unevaluatedProperties`,`unevaluatedItems`,`propertyNames`,`patternProperties`,`dependentSchemas`,`oneOf`,`anyOf`,`allOf`,`not`,`if`,`then`,`else`,`$defs`,`definitions`],Ya=new Set([`patternProperties`,`dependentSchemas`,`$defs`,`definitions`]);function Xa(e){return e.length===0?``:e.join(`.`)}var Za=`=?base64?`,Qa=`?=`;function $a(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 eo(e){if(e.length===0||e.startsWith(Za)&&e.endsWith(Qa)||e!==e.trim())return!0;for(let t=0;t=32&&n<=126))return!0}return!1}function to(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCodePoint(e);return btoa(n)}function no(e){return eo(e)?`${Za}${to(e)}${Qa}`:e}function ro(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[e]}return n}function io(e,t){let n={};for(let r of e){let e=ro(t,r.path);if(e==null)continue;let i=$a(e);i!==void 0&&(n[`${Ua}${r.headerName}`]=no(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 ao={"tools/call":`name`,"prompts/get":`name`,"resources/read":`uri`,"tasks/get":`taskId`,"tasks/update":`taskId`,"tasks/cancel":`taskId`};function oo(e,t){let n=Object.hasOwn(ao,e)?ao[e]:void 0;if(n===void 0)return;let r=so(t)?t[n]:void 0;return{field:n,value:typeof r==`string`?r:void 0}}function so(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function co(e,t){return ie(e,t)}function lo(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function uo(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 fo=!1,po=`draft-2020-12`;function mo(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:po});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().`);fo||(fo=!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=oe(e,{target:po,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&&ho(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 ho(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`||ho(e)))}return!1}function go(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function _o(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>go(e)).join(`, `)}:{success:!0,data:n.value}}function vo(e){let t=oe(e,{target:po,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var yo=/\\\.\\d\{(\d+)\}/;function bo(e){let t=yo.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=>fe({local:e,offset:t,precision:n}))))}function xo(e,t){let n;switch(e){case`email`:n=[T()];break;case`uri`:n=[ce()];break;case`date`:n=[pe()];break;case`date-time`:n=bo(t)}return new Set(n.map(e=>vo(e)).filter(e=>e!==void 0))}function So(e,t,n){return n!==`zod`||xo(e,t).has(t)}function Co(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function wo(e){try{return mo(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 To=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function Eo(e){return To.has(e)||e.startsWith(`x-`)}var Do=new Set([`$schema`,...Object.keys(er.shape.requestedSchema.shape)]),Oo={string:lo([Un,Gn,Kn,qn]),number:lo([Wn]),integer:lo([Wn]),boolean:lo([Hn]),array:lo([Yn,Xn])},ko=new Set(Un.shape.format.unwrap().options);function Ao(e,t,n,r){if(!Co(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Oo,e.type)?Oo[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||Eo(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?ko.has(e.format)?(typeof s!=`string`||!So(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function jo(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&Co(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,Ao(n,`properties.${e}`,t,r)])):Do.has(i)?n[i]=a:Eo(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 Mo(e,t){if(!Co(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!co($n,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function No(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>No(e,t[r],`${n}[${r}]`)):!Co(e)||!Co(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?No(r,t[e],i):Eo(e)?[]:[i]})}function Po(e){if(!uo(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=jo(wo(e.requestedSchema),t),r=co(er.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): ${Mo(n,r.error.message)}`);let i=No(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 Fo(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(Fo,{elicit(e){try{return{method:`elicitation/create`,params:Po(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 Io=!0,Lo=10,Ro=250;function zo(e){return{autoFulfill:e?.autoFulfill??Io,maxRounds:e?.maxRounds??Lo}}function Bo(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 Vo(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function Ho(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 Uo(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 Wo(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,Vo(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=Uo(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 Ho(Ro,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(Bo(r,u,c.requestState),d);if(Ba(f)){c={inputRequests:f.inputRequests??{},...f.requestState!==void 0&&{requestState:f.requestState}};continue}return f}}var Go=`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(`.`),Ko={IdJagTokenExchangeResponseSchema:Vr,OAuthClientInformationFullSchema:Kr,OAuthClientInformationSchema:Gr,OAuthClientMetadataSchema:Wr,OAuthClientRegistrationErrorSchema:qr,OAuthErrorResponseSchema:Hr,OAuthMetadataSchema:Lr,OAuthProtectedResourceMetadataSchema:Ir,OAuthTokenRevocationRequestSchema:Jr,OAuthTokensSchema:Br,OpenIdProviderDiscoveryMetadataSchema:zr,OpenIdProviderMetadataSchema:Rr},qo={},Jo={};function Yo(e,t){let n=e.slice(0,-6);qo[n]=t,Jo[n]=e=>t.safeParse(e).success}for(let e of Go)Yo(e,Fa[e]);for(let[e,t]of Object.entries(Ko))Yo(e,t);Object.freeze(qo);var Xo=Object.freeze(Jo);function Zo(e){switch(e){case`initialize`:case`notifications/initialized`:return ka(void 0);case`server/discover`:return ka(Oa);default:return}}var Qo=[Me,Ne,Fe,Le],$o=[`inputResponses`,`requestState`];function es(e,t){let n=e.params;if(!as(n))return{message:e,lifted:{}};let r=n._meta,i=as(r)?Qo.filter(e=>e in r):[],a=t===`request`?$o.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&as(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 ts(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 ns(e){return()=>e}var rs=ns(void 0),is=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??Ae,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),Ra(e)||za(e)?this._onresponse(e):Ia(e)?this._onrequest(e,t):La(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}=es(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=Aa(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(Ma(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}=es(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=Aa(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(ja(n.method)&&!i.hasRequestMethod(n.method)&&!(Na(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:cs(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?rs:ns(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),uo(t))return u(e,t,n);let i=ts(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),Ra(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(uo(t))return Na(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=ts(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 ka(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Zo(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(ja(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(ms(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;_o(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(Ma(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(!ja(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 _o(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(!Ma(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 _o(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 as(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function os(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]=as(a)&&as(i)?{...a,...i}:i}return n}function ss(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function cs(e){let t={},n=[];if(!ss(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!ss(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function ls(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 us(e,t,n,r,i){return{sessionId:i,mcpReq:{id:e,method:t,_meta:n?._meta,requestState:ns(void 0),signal:r,send:(()=>ls(`send`)),notify:()=>ls(`notify`)}}}async function ds(e,t,n,r,i){if(!ss(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=ss(r.params)?r.params:void 0;return await o({jsonrpc:`2.0`,id:n,method:a,...s!==void 0&&{params:s}},e.buildContext(us(n,a,s,i,e.sessionId)))}function fs(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 ps(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)=>ds(e,i,t,n,r),retry:(e,t)=>r.retry(e,fs(o,t))};return Wo({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 ms(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var hs=Se(I((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 gs(e){if(e)try{return hs.parse(e).type}catch{let t=(e.split(`;`,1)[0]??``).trim().toLowerCase();return t===``||e.slice(t.length).includes(`,`)?void 0:t}}function _s(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function vs(e=fetch,t){return t?async(n,r)=>e(n,{...t,...r,headers:r?.headers?{..._s(t.headers),..._s(r.headers)}:t.headers}):e}var ys=new Set([301,302,303,307,308]),bs=5;function xs(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 Ss(e,t){let n=ys.has(t.status)?t.headers?.get(`location`):void 0;if(n)try{return new URL(n,e)}catch{return}}var Cs=new WeakSet;function ws(e){let t=(t,n)=>e(t,n);return Cs.add(t),t}function Ts(e){return Cs.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=Ss(i,a);if(!o||t===bs)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||!xs(s,o))return a;await a.text?.().catch(()=>{}),i=o}}}function Es(e,t){if(t.type===`opaqueredirect`)return`Redirect not followed: this runtime does not expose where it points`;let n=Ss(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 Ds(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:Ps(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(Ms[i])continue;let a=`${r}/${Os(i)}`,o=e[i];if(Array.isArray(o)){if(As[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,Vs=/^(?:(?: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,Hs=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Us=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ws=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Gs=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Ks=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))},qs=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Js=/^((([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,Ys=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 Xs(e){return e.test.bind(e)}var Zs={date:$s,time:ec.bind(void 0,!1),"date-time":nc,duration:Ys,uri:ac,"uri-reference":Xs(zs),"uri-template":Xs(Bs),url:Xs(Vs),email:Ks,hostname:Xs(Rs),ipv4:Xs(qs),ipv6:Xs(Js),regex:sc,uuid:Xs(Hs),"json-pointer":Xs(Us),"json-pointer-uri-fragment":Xs(Ws),"relative-json-pointer":Xs(Gs)};function Qs(e){return e%4==0&&(e%100!=0||e%400==0)}function $s(e){let t=e.match(Fs);if(!t)return!1;let n=+t[1],r=+t[2],i=+t[3];return r>=1&&r<=12&&i>=1&&i<=(r==2&&Qs(n)?29:Is[r])}function ec(e,t){let n=t.match(Ls);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 tc=/t|\s/i;function nc(e){let t=e.split(tc);return t.length==2&&$s(t[0])&&ec(!0,t[1])}var rc=/\/|:/,ic=/^(?:[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 ac(e){return rc.test(e)&&ic.test(e)}var oc=/[^\\]\\Z/;function sc(e){if(oc.test(e))return!1;try{return new RegExp(e,`u`),!0}catch{return!1}}function cc(e){let t=0,n=e.length,r=0,i;for(;r=55296&&i<=56319&&rDs(e,t))||I.push({instanceLocation:o,keyword:`enum`,keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`}):g.some(t=>e===t)||I.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&&I.push({instanceLocation:o,keyword:`not`,keywordLocation:t,error:`Instance matched "not" schema.`})}let be=[];if(y!==void 0){let t=`${s}/anyOf`,l=I.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 I.push(...d.errors),d.valid&&be.push(u),d.valid}).length;u===1?I.length=l:I.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,...be),S!==void 0){let t=`${s}/if`;if(Q(e,S,n,r,i,a,o,t,c).valid){if(C!==void 0){let l=Q(e,C,n,r,i,a,o,`${s}/then`,c);l.valid||I.push({instanceLocation:o,keyword:`if`,keywordLocation:t,error:`Instance does not match "then" schema.`},...l.errors)}}else if(w!==void 0){let l=Q(e,w,n,r,i,a,o,`${s}/else`,c);l.valid||I.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||I.push({instanceLocation:o,keyword:`required`,keywordLocation:`${s}/required`,error:`Instance does not have required property "${t}".`});let t=Object.keys(e);if(te!==void 0&&t.lengthk&&I.push({instanceLocation:o,keyword:`maxProperties`,keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${k} properties.`}),ne!==void 0){let t=`${s}/propertyNames`;for(let s in e){let e=`${o}/${Os(s)}`,c=Q(s,ne,n,r,i,a,e,t);c.valid||I.push({instanceLocation:o,keyword:`propertyNames`,keywordLocation:t,error:`Property name "${s}" does not match schema.`},...c.errors)}}if(re!==void 0){let t=`${s}/dependantRequired`;for(let n in re)if(n in e){let r=re[n];for(let i of r)i in e||I.push({instanceLocation:o,keyword:`dependentRequired`,keywordLocation:t,error:`Instance has "${n}" but does not have "${i}".`})}}if(ie!==void 0)for(let t in ie){let l=`${s}/dependentSchemas`;if(t in e){let s=Q(e,ie[t],n,r,i,a,o,`${l}/${Os(t)}`,c);s.valid||I.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||I.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}/${Os(s)}`);l.valid||I.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(E!==void 0){let t=`${s}/properties`;for(let s in E){if(!(s in e))continue;let d=`${o}/${Os(s)}`,f=Q(e[s],E[s],n,r,i,a,d,`${t}/${Os(s)}`);if(f.valid)c[s]=l[s]=!0;else if(u=i,I.push({instanceLocation:o,keyword:`properties`,keywordLocation:t,error:`Property "${s}" does not match schema.`},...f.errors),u)break}}if(!u&&ee!==void 0){let t=`${s}/patternProperties`;for(let s in ee){let d=new RegExp(s,`u`),f=ee[s];for(let p in e){if(!d.test(p))continue;let m=`${o}/${Os(p)}`,h=Q(e[p],f,n,r,i,a,m,`${t}/${Os(s)}`);h.valid?c[p]=l[p]=!0:(u=i,I.push({instanceLocation:o,keyword:`patternProperties`,keywordLocation:t,error:`Property "${p}" matches pattern "${s}" but does not match associated schema.`},...h.errors))}}}if(!u&&D!==void 0){let t=`${s}/additionalProperties`;for(let s in e){if(l[s])continue;let d=`${o}/${Os(s)}`,f=Q(e[s],D,n,r,i,a,d,t);f.valid?c[s]=!0:(u=i,I.push({instanceLocation:o,keyword:`additionalProperties`,keywordLocation:t,error:`Property "${s}" does not match additional properties schema.`},...f.errors))}}else if(!u&&O!==void 0){let t=`${s}/unevaluatedProperties`;for(let s in e)if(!c[s]){let l=`${o}/${Os(s)}`,u=Q(e[s],O,n,r,i,a,l,t);u.valid?c[s]=!0:I.push({instanceLocation:o,keyword:`unevaluatedProperties`,keywordLocation:t,error:`Property "${s}" does not match unevaluated properties schema.`},...u.errors)}}}else if(u===`array`){fe!==void 0&&e.length>fe&&I.push({instanceLocation:o,keyword:`maxItems`,keywordLocation:`${s}/maxItems`,error:`Array has too many items (${e.length} > ${fe}).`}),de!==void 0&&e.length=(j||0)&&(I.length=u),j===void 0&&ue===void 0&&d===0?I.splice(u,0,{instanceLocation:o,keyword:`contains`,keywordLocation:l,error:`Array does not contain item matching schema.`}):j!==void 0&&due&&I.push({instanceLocation:o,keyword:`maxContains`,keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${ue} items matching schema. ${d} items were found.`})}}if(!u&&ce!==void 0){let u=`${s}/unevaluatedItems`;for(;l=M||e>M)&&I.push({instanceLocation:o,keyword:`maximum`,keywordLocation:`${s}/maximum`,error:`${e} is greater than ${he?`or equal to `:``} ${M}.`})):(me!==void 0&&eM&&I.push({instanceLocation:o,keyword:`maximum`,keywordLocation:`${s}/maximum`,error:`${e} is greater than ${M}.`}),N!==void 0&&e<=N&&I.push({instanceLocation:o,keyword:`exclusiveMinimum`,keywordLocation:`${s}/exclusiveMinimum`,error:`${e} is less than ${N}.`}),he!==void 0&&e>=he&&I.push({instanceLocation:o,keyword:`exclusiveMaximum`,keywordLocation:`${s}/exclusiveMaximum`,error:`${e} is greater than or equal to ${he}.`})),P!==void 0){let t=e%P;Math.abs(0-t)>=1.1920929e-7&&Math.abs(P-t)>=1.1920929e-7&&I.push({instanceLocation:o,keyword:`multipleOf`,keywordLocation:`${s}/multipleOf`,error:`${e} is not a multiple of ${P}.`})}}else if(u===`string`){let t=F===void 0&&ge===void 0?0:cc(e);F!==void 0&&tge&&I.push({instanceLocation:o,keyword:`maxLength`,keywordLocation:`${s}/maxLength`,error:`String is too long (${t} > ${ge}).`}),_e!==void 0&&!new RegExp(_e,`u`).test(e)&&I.push({instanceLocation:o,keyword:`pattern`,keywordLocation:`${s}/pattern`,error:`String does not match pattern.`}),T!==void 0&&Zs[T]&&!Zs[T](e)&&I.push({instanceLocation:o,keyword:`format`,keywordLocation:`${s}/format`,error:`String does not match format "${T}".`})}return{valid:I.length===0,errors:I}}var lc=class{schema;draft;shortCircuit;lookup;constructor(e,t=`2019-09`,n=!0){this.schema=e,this.draft=t,this.shortCircuit=n,this.lookup=Ps(e)}validate(e){return Q(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){t&&(e={...e,$id:t}),Ps(e,this.lookup)}},uc=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}_draftFor(e){let t=Oe(e,`pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.`);return t===`draft-7`?`7`:t}getValidator(e){let t=new lc(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(`; `)}}}},dc=globalThis.crypto;async function fc(e){return(await dc).getRandomValues(new Uint8Array(e))}async function pc(e){let t=``;for(;t.length128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await mc(e);return{code_verifier:t,code_challenge:await hc(t)}}var _c=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}},vc=10,yc=13,bc=32;function xc(e){}function Sc(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=xc,onError:n=xc,onRetry:r=xc,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 _c(`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(` @@ -54,4 +54,4 @@ Boolean requesting whether a visible border and background is provided by the ho - omitted: host decides border`)});var Qu=g({method:E(`ui/request-display-mode`),params:g({mode:Nu.describe(`The display mode being requested.`)})}),$u=g({mode:Nu.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough(),ed=u([E(`model`),E(`app`)]).describe(`Tool visibility scope - who can access the tool.`);g({resourceUri:S().optional(),visibility:C(ed).optional().describe(`Who can access this tool. Default: ["model", "app"] - "model": Tool visible to and callable by the agent - "app": Tool callable by the app from this server only`),csp:_().optional(),permissions:_().optional()}),g({mimeTypes:C(S()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});var td=g({method:E(`ui/download-file`),params:g({contents:C(u([ln,un])).describe(`Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.`)})}),nd=g({method:E(`ui/message`),params:g({role:E(`user`).describe(`Message role, currently only "user" is supported.`),content:C(dn).describe(`Message content blocks (text, image, etc.).`)})});g({method:E(`ui/notifications/sandbox-resource-ready`),params:g({html:S().describe(`HTML content to load into the inner iframe.`),sandbox:S().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:Vu.optional().describe(`CSP configuration from resource metadata.`),permissions:Hu.optional().describe(`Sandbox permissions from resource metadata.`)})}),g({method:E(`ui/notifications/tool-result`),params:bn.describe(`Standard MCP tool execution result.`)});var rd=g({toolInfo:g({id:qe.optional().describe(`JSON-RPC id of the tools/call request.`),tool:_n.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:Mu.optional().describe(`Current color theme preference.`),styles:Gu.optional().describe(`Style configuration for theming the app.`),displayMode:Nu.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:C(Nu).optional().describe(`Display modes the host supports.`),containerDimensions:u([g({height:A().describe(`Fixed container height in pixels.`)}),g({maxHeight:u([A(),h()]).optional().describe(`Maximum container height in pixels.`)})]).and(u([g({width:A().describe(`Fixed container width in pixels.`)}),g({maxWidth:u([A(),h()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other -container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:S().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:S().optional().describe(`User's timezone in IANA format.`),userAgent:S().optional().describe(`Host application identifier.`),platform:u([E(`web`),E(`desktop`),E(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:g({touch:j().optional().describe(`Whether the device supports touch input.`),hover:j().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:g({top:A().describe(`Top safe area inset in pixels.`),right:A().describe(`Right safe area inset in pixels.`),bottom:A().describe(`Bottom safe area inset in pixels.`),left:A().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();g({method:E(`ui/notifications/host-context-changed`),params:rd.describe(`Partial context update containing only changed fields.`)});var id=g({method:E(`ui/update-model-context`),params:g({content:C(dn).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:O(S(),k().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),ad=g({method:E(`ui/initialize`),params:g({appInfo:at.describe(`App identification (name and version).`),appCapabilities:Xu.describe(`Features and capabilities this app provides.`),protocolVersion:S().describe(`Protocol version this app supports.`)})}),od=g({protocolVersion:S().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:at.describe(`Host application identification and version.`),hostCapabilities:Yu.describe(`Features and capabilities provided by the host.`),hostContext:rd.describe(`Rich context about the host environment.`)}).passthrough(),sd=class{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=e=>{if(t&&e.source!==this.eventSource){console.debug(`Ignoring message from unknown source`,e);return}let n=U.safeParse(e.data);n.success?(console.debug(`Parsed message`,n.data),this.onmessage?.(n.data)):e.data?.jsonrpc===`2.0`?(console.error(`Failed to parse message`,n.error.message,e),this.onerror?.(Error(`Invalid JSON-RPC message received: `+n.error.message))):console.debug(`Ignoring non-JSON-RPC message`,n.error.message,e)}}async start(){window.addEventListener(`message`,this.messageListener)}async send(e,t){e.method!==`ui/notifications/tool-input-partial`&&console.debug(`Sending message`,e),this.eventTarget.postMessage(e,`*`)}async close(){window.removeEventListener(`message`,this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},cd=[ju],ld=class extends is{_client;_hostInfo;_hostCapabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_registeredEvents=new Set;_events=new Eu;_methods=new Du;setRequestHandler=(...e)=>{let[t,...n]=ku(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=ku(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};removeRequestHandler=e=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=e=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_wrapHandler(e,t){let n=super._wrapHandler(e,t);return e===`ui/initialize`||e===`ping`?n:async(t,r)=>(this._initializedReceived||console.warn(`[ext-apps] AppBridge received '${e}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`),n(t,r))}eventSchemas={sizechange:Uu,sandboxready:Bu,initialized:Zu,requestteardown:Ju,loggingmessage:An};setEventHandler(e,t){this._ensureEventSlot(e),this._events.setHandler(e,t)}getEventHandler(e){return this._events.getHandler(e)}addEventListener(e,t){this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);let n=t=>{e===`initialized`&&(this._initializedReceived=!0),this._events.dispatch(e,t)};e===`loggingmessage`?this.setNotificationHandler(`notifications/message`,e=>{n(e.params)}):this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},e=>n(e)),this._registeredEvents.add(e)}warnIfRequestHandlerReplaced(e,t,n){t&&n&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t,n,r){super(r),this._client=e,this._hostInfo=t,this._hostCapabilities=n,this._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),this._ensureEventSlot(`initialized`),this._hostContext=r?.hostContext||{},this.replaceRequestHandler(`ui/initialize`,{params:ad.shape.params,result:od},e=>this._onAppsInitialize(e)),this.replaceRequestHandler(`ping`,(e,t)=>(this.onping?.(e.params,t),{})),this.replaceRequestHandler(`ui/request-display-mode`,{params:Qu.shape.params,result:$u},()=>({mode:this._hostContext.displayMode??`inline`}))}buildContext(e){return e}assertCapabilityForMethod(e){}assertRequestHandlerCapability(e){}assertNotificationCapability(e){}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;get onsizechange(){return this.getEventHandler(`sizechange`)}set onsizechange(e){this.setEventHandler(`sizechange`,e)}get onsandboxready(){return this.getEventHandler(`sandboxready`)}set onsandboxready(e){this.setEventHandler(`sandboxready`,e)}get oninitialized(){return this.getEventHandler(`initialized`)}set oninitialized(e){this.setEventHandler(`initialized`,e)}_onmessage;get onmessage(){return this._onmessage}set onmessage(e){this.warnIfRequestHandlerReplaced(`onmessage`,this._onmessage,e),this._onmessage=e,this.replaceRequestHandler(`ui/message`,{params:nd.shape.params,result:zu},async(e,t)=>{if(!this._onmessage)throw Error(`No onmessage handler set`);return this._onmessage(e,t)})}_onopenlink;get onopenlink(){return this._onopenlink}set onopenlink(e){this.warnIfRequestHandlerReplaced(`onopenlink`,this._onopenlink,e),this._onopenlink=e,this.replaceRequestHandler(`ui/open-link`,{params:Iu.shape.params,result:Lu},async(e,t)=>{if(!this._onopenlink)throw Error(`No onopenlink handler set`);return this._onopenlink(e,t)})}_ondownloadfile;get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(e){this.warnIfRequestHandlerReplaced(`ondownloadfile`,this._ondownloadfile,e),this._ondownloadfile=e,this.replaceRequestHandler(`ui/download-file`,{params:td.shape.params,result:Ru},async(e,t)=>{if(!this._ondownloadfile)throw Error(`No ondownloadfile handler set`);return this._ondownloadfile(e,t)})}get onrequestteardown(){return this.getEventHandler(`requestteardown`)}set onrequestteardown(e){this.setEventHandler(`requestteardown`,e)}_onrequestdisplaymode;get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(e){this.warnIfRequestHandlerReplaced(`onrequestdisplaymode`,this._onrequestdisplaymode,e),this._onrequestdisplaymode=e,this.replaceRequestHandler(`ui/request-display-mode`,{params:Qu.shape.params,result:$u},async(e,t)=>{if(!this._onrequestdisplaymode)throw Error(`No onrequestdisplaymode handler set`);return this._onrequestdisplaymode(e,t)})}get onloggingmessage(){return this.getEventHandler(`loggingmessage`)}set onloggingmessage(e){this.setEventHandler(`loggingmessage`,e)}_onupdatemodelcontext;get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(e){this.warnIfRequestHandlerReplaced(`onupdatemodelcontext`,this._onupdatemodelcontext,e),this._onupdatemodelcontext=e,this.replaceRequestHandler(`ui/update-model-context`,{params:id.shape.params,result:$e},async(e,t)=>{if(!this._onupdatemodelcontext)throw Error(`No onupdatemodelcontext handler set`);return this._onupdatemodelcontext(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(`tools/call`,async(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_oncreatesamplingmessage;get oncreatesamplingmessage(){return this._oncreatesamplingmessage}set oncreatesamplingmessage(e){this.warnIfRequestHandlerReplaced(`oncreatesamplingmessage`,this._oncreatesamplingmessage,e),this._oncreatesamplingmessage=e,this.replaceRequestHandler(`sampling/createMessage`,async(e,t)=>{if(!this._oncreatesamplingmessage)throw Error(`No oncreatesamplingmessage handler set`);return this._oncreatesamplingmessage(e.params,t)})}sendToolListChanged(e={}){return this.notification({method:`notifications/tools/list_changed`,params:e})}_onlistresources;get onlistresources(){return this._onlistresources}set onlistresources(e){this.warnIfRequestHandlerReplaced(`onlistresources`,this._onlistresources,e),this._onlistresources=e,this.replaceRequestHandler(`resources/list`,async(e,t)=>{if(!this._onlistresources)throw Error(`No onlistresources handler set`);return this._onlistresources(e.params,t)})}_onlistresourcetemplates;get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(e){this.warnIfRequestHandlerReplaced(`onlistresourcetemplates`,this._onlistresourcetemplates,e),this._onlistresourcetemplates=e,this.replaceRequestHandler(`resources/templates/list`,async(e,t)=>{if(!this._onlistresourcetemplates)throw Error(`No onlistresourcetemplates handler set`);return this._onlistresourcetemplates(e.params,t)})}_onreadresource;get onreadresource(){return this._onreadresource}set onreadresource(e){this.warnIfRequestHandlerReplaced(`onreadresource`,this._onreadresource,e),this._onreadresource=e,this.replaceRequestHandler(`resources/read`,async(e,t)=>{if(!this._onreadresource)throw Error(`No onreadresource handler set`);return this._onreadresource(e.params,t)})}sendResourceListChanged(e={}){return this.notification({method:`notifications/resources/list_changed`,params:e})}_onlistprompts;get onlistprompts(){return this._onlistprompts}set onlistprompts(e){this.warnIfRequestHandlerReplaced(`onlistprompts`,this._onlistprompts,e),this._onlistprompts=e,this.replaceRequestHandler(`prompts/list`,async(e,t)=>{if(!this._onlistprompts)throw Error(`No onlistprompts handler set`);return this._onlistprompts(e.params,t)})}sendPromptListChanged(e={}){return this.notification({method:`notifications/prompts/list_changed`,params:e})}getCapabilities(){return this._hostCapabilities}async _onAppsInitialize(e){let t=e.protocolVersion;return this._appInfo!==void 0&&console.warn(`[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values.`),this._appCapabilities=e.appCapabilities,this._appInfo=e.appInfo,{protocolVersion:cd.includes(t)?t:ju,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(e){let t={},n=!1;for(let r of Object.keys(e)){let i=this._hostContext[r],a=e[r];ud(i,a)||(t[r]=a,n=!0)}n&&(this._hostContext=e,this.sendHostContextChange(t))}sendHostContextChange(e){return this.notification({method:`ui/notifications/host-context-changed`,params:e})}sendToolInput(e){return this.notification({method:`ui/notifications/tool-input`,params:e})}sendToolInputPartial(e){return this.notification({method:`ui/notifications/tool-input-partial`,params:e})}sendToolResult(e){return this.notification({method:`ui/notifications/tool-result`,params:e})}sendToolCancelled(e){return this.notification({method:`ui/notifications/tool-cancelled`,params:e})}sendSandboxResourceReady(e){return this.notification({method:`ui/notifications/sandbox-resource-ready`,params:e})}teardownResource(e,t){return this.request({method:`ui/resource-teardown`,params:e},Ku,t)}sendResourceTeardown=this.teardownResource;callTool(e,t){return this.request({method:`tools/call`,params:e},t)}listTools(e,t){return this.request({method:`tools/list`,params:e},t)}async connect(e){if(this.transport)throw Error(`AppBridge is already connected. Call close() before connecting again.`);if(this._initializedReceived=!1,this._client){let e=this._client.getServerCapabilities();if(!e)throw Error(`Client server capabilities not available`);e.tools&&(this.oncalltool=async(e,t)=>this._client.request({method:`tools/call`,params:e},{signal:t.mcpReq.signal}),e.tools.listChanged&&this._client.setNotificationHandler(`notifications/tools/list_changed`,e=>this.sendToolListChanged(e.params))),e.resources&&(this.onlistresources=async(e,t)=>this._client.request({method:`resources/list`,params:e},{signal:t.mcpReq.signal}),this.onlistresourcetemplates=async(e,t)=>this._client.request({method:`resources/templates/list`,params:e},{signal:t.mcpReq.signal}),this.onreadresource=async(e,t)=>this._client.request({method:`resources/read`,params:e},{signal:t.mcpReq.signal}),e.resources.listChanged&&this._client.setNotificationHandler(`notifications/resources/list_changed`,e=>this.sendResourceListChanged(e.params))),e.prompts&&(this.onlistprompts=async(e,t)=>this._client.request({method:`prompts/list`,params:e},{signal:t.mcpReq.signal}),e.prompts.listChanged&&this._client.setNotificationHandler(`notifications/prompts/list_changed`,e=>this.sendPromptListChanged(e.params)))}return super.connect(e)}};function ud(e,t){return JSON.stringify(e)===JSON.stringify(t)}var $=n(e(),1),dd=t(),fd=`text/html;profile=mcp-app`,pd=`io.modelcontextprotocol/ui`,md=3,hd=5,gd=2e3,_d=[`inline`,`fullscreen`],vd=class extends Error{},yd=null,bd=null;async function xd(){let e=new Tu(new URL(`/api/mcp`,location.origin),{fetch:(e,t)=>c(e,t)}),t=new gu({name:`fanout-browser`,version:`0.2.0`},{supportedProtocolVersions:[`2026-07-28`],versionNegotiation:{mode:{pin:`2026-07-28`}},capabilities:{extensions:{[pd]:{mimeTypes:[fd]}}}});try{await t.connect(e);let n={client:t,tools:t.listTools(),references:0,closed:!1,closeListeners:new Set};return n.tools.catch(()=>void 0),t.onclose=()=>Cd(n,!1),t.onerror=()=>Cd(n,!0),n}catch(t){throw await e.close().catch(()=>void 0),t}}async function Sd(){for(let e=0;e{bd===e&&!t.closed&&(yd=t)}).catch(()=>{bd===e&&(bd=null)})}let e=bd;if(!e)continue;let t=await e;if(t.closed){bd===e&&(bd=null);continue}return t.closeTimer&&=(clearTimeout(t.closeTimer),void 0),t.references+=1,t}throw Error(`MCP connection closed during setup`)}function Cd(e,t){if(!e.closed){e.closed=!0,e.closeTimer&&clearTimeout(e.closeTimer),e.closeTimer=void 0,yd===e&&(yd=null),bd=null;for(let t of[...e.closeListeners])t();t&&e.client.close().catch(()=>void 0)}}function wd(e){e.references=Math.max(0,e.references-1),!(e.closed||e.references||e.closeTimer)&&(e.closeTimer=setTimeout(()=>{e.closeTimer=void 0,!(e.references||yd!==e)&&(e.closed=!0,yd=null,bd=null,e.client.close().catch(()=>void 0))},0))}function Td(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}var Ed=new Map;async function Dd(e,t){let n=Ed.get(t);if(n&&n.expires>Date.now())return n.pending;let r={pending:Promise.resolve({text:``}),expires:1/0};return r.pending=e.readResource({uri:t}).then(e=>{let n=e.contents[0];if(e.contents.length!==1||!n||!(`text`in n)||!n.text)throw new vd(`MCP App resource has no HTML content`);if(n.uri!==t)throw new vd(`MCP App resource URI does not match the requested URI`);if(n.mimeType!==fd)throw new vd(`MCP App resource has an unsupported MIME type`);let i=Td(e)?.ttlMs;return r.expires=Date.now()+(typeof i==`number`&&i>0?i:3e5),{text:n.text,_meta:n._meta}}).catch(e=>{throw Ed.get(t)===r&&Ed.delete(t),e}),Ed.set(t,r),r.pending}function Od(e,t){let n=``;return/]*)?>/i.test(e)?e.replace(/]*)?>/i,e=>`${e}${n}`):/]*)?>/i.test(e)?e.replace(/]*)?>/i,e=>`${e}${n}`):`${n}${e}`}function kd({content:e}){let t=l(e);return t?(0,dd.jsx)(Ad,{content:t}):(0,dd.jsx)(r,{m:`md`,children:(0,dd.jsx)(s,{tone:`danger`,children:`This view could not be loaded. Please try again.`})})}function Ad({content:e}){let t=(0,$.useRef)(null),n=(0,$.useRef)(null),s=(0,$.useRef)(null),c=(0,$.useRef)(null),[l,u]=(0,$.useState)(``),[d,f]=(0,$.useState)(`inline`),p=(0,$.useRef)(null),m=(0,$.useRef)(d);m.current=d;let h=e=>{f(e),c.current?.setHostContext({theme:w.current,displayMode:e,availableDisplayModes:_d}),e===`inline`&&document.activeElement!==t.current&&t.current?.focus()};(0,$.useEffect)(()=>{if(d!==`fullscreen`)return;p.current?.focus();let e=document.body.style.overflow;document.body.style.overflow=`hidden`;let n=e=>{e.key===`Escape`&&(e.preventDefault(),h(`inline`))},r=e=>{t.current?.parentElement?.contains(e.target)||p.current?.focus()};return window.addEventListener(`keydown`,n),document.addEventListener(`focusin`,r),()=>{document.body.style.overflow=e,window.removeEventListener(`keydown`,n),document.removeEventListener(`focusin`,r)}},[d]);let[g,_]=(0,$.useState)(240),[v,y]=(0,$.useState)(``),[b,x]=(0,$.useState)(0),S=(0,$.useRef)(0),C=le(`light`),w=(0,$.useRef)(C);w.current=C,(0,$.useEffect)(()=>{c.current?.setHostContext({theme:C,displayMode:m.current,availableDisplayModes:_d})},[C]),(0,$.useEffect)(()=>{S.current=0},[e.resource_uri]),(0,$.useEffect)(()=>{let t=!1,r;f(`inline`),u(``),y(``);let i=()=>{let e=S.current+1;if(e>hd)return;S.current=e;let t=e===1?0:Math.min(750*2**(e-2),6e3);t===0?x(e=>e+1):r=setTimeout(()=>x(e=>e+1),t)},a=()=>i();async function o(){try{let r=await Sd();if(t){wd(r);return}s.current=r,r.closeListeners.add(a),n.current=r.client;let i=await Dd(r.client,e.resource_uri);await r.tools,t||(S.current=0,u(Od(i.text,i._meta)))}catch(e){console.error(`MCP app resource load failed`,e),t||(y(`This view could not be loaded. Please try again.`),S.current>0&&!(e instanceof vd)&&i())}}return o(),()=>{t=!0,r&&clearTimeout(r);let e=c.current?.teardownResource({}).catch(()=>void 0)??Promise.resolve(),i=s.current;i&&(i.closeListeners.delete(a),e.finally(()=>wd(i))),c.current=null,n.current=null,s.current=null}},[e.resource_uri,b]);async function T(){let r=t.current,i=n.current;if(r?.contentWindow&&l&&i&&!c.current)try{let t=new ld(null,{name:`Fanout`,version:`0.2.0`},{serverTools:{},logging:{}},{hostContext:{theme:w.current,displayMode:`inline`,availableDisplayModes:_d}}),n=s.current;if(!n)throw Error(`MCP connection unavailable`);t.oncalltool=async(e,t)=>{let r=Td(Td((await n.tools).tools.find(t=>t.name===e.name)?._meta)?.ui)?.visibility;if(!Array.isArray(r)||!r.includes(`app`)||/^(?:create|edit|replace|restore|delete)_/.test(e.name))throw Error(`This tool is unavailable in the app`);return i.callTool(e,{signal:t.mcpReq.signal})},t.onrequestdisplaymode=async({mode:e})=>e!==`inline`&&e!==`fullscreen`?{mode:m.current}:(h(e),{mode:e}),c.current=t,t.onsizechange=({height:e})=>{e&&_(Math.min(gd,Math.max(240,Math.round(e))))},t.onmessage=async()=>({isError:!0}),t.oninitialized=async()=>{await t.sendToolInput({arguments:e.tool_input??{}}),await t.sendToolResult({content:[{type:`text`,text:JSON.stringify(e.tool_result??{})}],structuredContent:e.tool_result,isError:e.is_error})},await t.connect(new sd(r.contentWindow,r.contentWindow))}catch(e){console.error(`MCP app bridge connect failed`,e),y(`This view could not be loaded. Please try again.`)}}return v?(0,dd.jsx)(r,{m:`md`,children:(0,dd.jsx)(a,{state:`error`,error:{message:v}})}):l?(0,dd.jsx)(i,{active:d===`fullscreen`,children:(0,dd.jsxs)(r,{"data-app-fullscreen":d===`fullscreen`?``:void 0,role:d===`fullscreen`?`dialog`:void 0,"aria-modal":d===`fullscreen`||void 0,"aria-label":d===`fullscreen`?`Fanout analysis view`:void 0,bg:`var(--mantine-color-body)`,style:d===`fullscreen`?{position:`fixed`,inset:0,zIndex:1e3,display:`flex`,flexDirection:`column`}:void 0,children:[d===`fullscreen`&&(0,dd.jsx)(r,{p:`xs`,ta:`right`,children:(0,dd.jsx)(o,{ref:p,"data-autofocus":!0,size:`compact-sm`,variant:`default`,"aria-label":`Close analysis view`,onClick:()=>h(`inline`),children:`Close`})}),(0,dd.jsx)(r,{component:`iframe`,tabIndex:0,ref:t,title:`Fanout analysis view`,sandbox:`allow-scripts`,scrolling:`auto`,srcDoc:l,w:`100%`,bd:0,bg:`var(--mantine-color-body)`,style:{display:`block`,height:d===`fullscreen`?`100%`:g,...d===`fullscreen`?{flex:`1 1 0`,minHeight:0}:{}},onLoad:()=>void T()})]})}):(0,dd.jsx)(a,{state:`loading`,loadingLabel:`Preparing view…`})}export{kd as default}; \ No newline at end of file +container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:S().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:S().optional().describe(`User's timezone in IANA format.`),userAgent:S().optional().describe(`Host application identifier.`),platform:u([E(`web`),E(`desktop`),E(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:g({touch:j().optional().describe(`Whether the device supports touch input.`),hover:j().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:g({top:A().describe(`Top safe area inset in pixels.`),right:A().describe(`Right safe area inset in pixels.`),bottom:A().describe(`Bottom safe area inset in pixels.`),left:A().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();g({method:E(`ui/notifications/host-context-changed`),params:rd.describe(`Partial context update containing only changed fields.`)});var id=g({method:E(`ui/update-model-context`),params:g({content:C(dn).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:O(S(),k().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),ad=g({method:E(`ui/initialize`),params:g({appInfo:at.describe(`App identification (name and version).`),appCapabilities:Xu.describe(`Features and capabilities this app provides.`),protocolVersion:S().describe(`Protocol version this app supports.`)})}),od=g({protocolVersion:S().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:at.describe(`Host application identification and version.`),hostCapabilities:Yu.describe(`Features and capabilities provided by the host.`),hostContext:rd.describe(`Rich context about the host environment.`)}).passthrough(),sd=class{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=e=>{if(t&&e.source!==this.eventSource){console.debug(`Ignoring message from unknown source`,e);return}let n=U.safeParse(e.data);n.success?(console.debug(`Parsed message`,n.data),this.onmessage?.(n.data)):e.data?.jsonrpc===`2.0`?(console.error(`Failed to parse message`,n.error.message,e),this.onerror?.(Error(`Invalid JSON-RPC message received: `+n.error.message))):console.debug(`Ignoring non-JSON-RPC message`,n.error.message,e)}}async start(){window.addEventListener(`message`,this.messageListener)}async send(e,t){e.method!==`ui/notifications/tool-input-partial`&&console.debug(`Sending message`,e),this.eventTarget.postMessage(e,`*`)}async close(){window.removeEventListener(`message`,this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},cd=[ju],ld=class extends is{_client;_hostInfo;_hostCapabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_registeredEvents=new Set;_events=new Eu;_methods=new Du;setRequestHandler=(...e)=>{let[t,...n]=ku(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=ku(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};removeRequestHandler=e=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=e=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_wrapHandler(e,t){let n=super._wrapHandler(e,t);return e===`ui/initialize`||e===`ping`?n:async(t,r)=>(this._initializedReceived||console.warn(`[ext-apps] AppBridge received '${e}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`),n(t,r))}eventSchemas={sizechange:Uu,sandboxready:Bu,initialized:Zu,requestteardown:Ju,loggingmessage:An};setEventHandler(e,t){this._ensureEventSlot(e),this._events.setHandler(e,t)}getEventHandler(e){return this._events.getHandler(e)}addEventListener(e,t){this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);let n=t=>{e===`initialized`&&(this._initializedReceived=!0),this._events.dispatch(e,t)};e===`loggingmessage`?this.setNotificationHandler(`notifications/message`,e=>{n(e.params)}):this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},e=>n(e)),this._registeredEvents.add(e)}warnIfRequestHandlerReplaced(e,t,n){t&&n&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t,n,r){super(r),this._client=e,this._hostInfo=t,this._hostCapabilities=n,this._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),this._ensureEventSlot(`initialized`),this._hostContext=r?.hostContext||{},this.replaceRequestHandler(`ui/initialize`,{params:ad.shape.params,result:od},e=>this._onAppsInitialize(e)),this.replaceRequestHandler(`ping`,(e,t)=>(this.onping?.(e.params,t),{})),this.replaceRequestHandler(`ui/request-display-mode`,{params:Qu.shape.params,result:$u},()=>({mode:this._hostContext.displayMode??`inline`}))}buildContext(e){return e}assertCapabilityForMethod(e){}assertRequestHandlerCapability(e){}assertNotificationCapability(e){}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;get onsizechange(){return this.getEventHandler(`sizechange`)}set onsizechange(e){this.setEventHandler(`sizechange`,e)}get onsandboxready(){return this.getEventHandler(`sandboxready`)}set onsandboxready(e){this.setEventHandler(`sandboxready`,e)}get oninitialized(){return this.getEventHandler(`initialized`)}set oninitialized(e){this.setEventHandler(`initialized`,e)}_onmessage;get onmessage(){return this._onmessage}set onmessage(e){this.warnIfRequestHandlerReplaced(`onmessage`,this._onmessage,e),this._onmessage=e,this.replaceRequestHandler(`ui/message`,{params:nd.shape.params,result:zu},async(e,t)=>{if(!this._onmessage)throw Error(`No onmessage handler set`);return this._onmessage(e,t)})}_onopenlink;get onopenlink(){return this._onopenlink}set onopenlink(e){this.warnIfRequestHandlerReplaced(`onopenlink`,this._onopenlink,e),this._onopenlink=e,this.replaceRequestHandler(`ui/open-link`,{params:Iu.shape.params,result:Lu},async(e,t)=>{if(!this._onopenlink)throw Error(`No onopenlink handler set`);return this._onopenlink(e,t)})}_ondownloadfile;get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(e){this.warnIfRequestHandlerReplaced(`ondownloadfile`,this._ondownloadfile,e),this._ondownloadfile=e,this.replaceRequestHandler(`ui/download-file`,{params:td.shape.params,result:Ru},async(e,t)=>{if(!this._ondownloadfile)throw Error(`No ondownloadfile handler set`);return this._ondownloadfile(e,t)})}get onrequestteardown(){return this.getEventHandler(`requestteardown`)}set onrequestteardown(e){this.setEventHandler(`requestteardown`,e)}_onrequestdisplaymode;get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(e){this.warnIfRequestHandlerReplaced(`onrequestdisplaymode`,this._onrequestdisplaymode,e),this._onrequestdisplaymode=e,this.replaceRequestHandler(`ui/request-display-mode`,{params:Qu.shape.params,result:$u},async(e,t)=>{if(!this._onrequestdisplaymode)throw Error(`No onrequestdisplaymode handler set`);return this._onrequestdisplaymode(e,t)})}get onloggingmessage(){return this.getEventHandler(`loggingmessage`)}set onloggingmessage(e){this.setEventHandler(`loggingmessage`,e)}_onupdatemodelcontext;get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(e){this.warnIfRequestHandlerReplaced(`onupdatemodelcontext`,this._onupdatemodelcontext,e),this._onupdatemodelcontext=e,this.replaceRequestHandler(`ui/update-model-context`,{params:id.shape.params,result:$e},async(e,t)=>{if(!this._onupdatemodelcontext)throw Error(`No onupdatemodelcontext handler set`);return this._onupdatemodelcontext(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(`tools/call`,async(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_oncreatesamplingmessage;get oncreatesamplingmessage(){return this._oncreatesamplingmessage}set oncreatesamplingmessage(e){this.warnIfRequestHandlerReplaced(`oncreatesamplingmessage`,this._oncreatesamplingmessage,e),this._oncreatesamplingmessage=e,this.replaceRequestHandler(`sampling/createMessage`,async(e,t)=>{if(!this._oncreatesamplingmessage)throw Error(`No oncreatesamplingmessage handler set`);return this._oncreatesamplingmessage(e.params,t)})}sendToolListChanged(e={}){return this.notification({method:`notifications/tools/list_changed`,params:e})}_onlistresources;get onlistresources(){return this._onlistresources}set onlistresources(e){this.warnIfRequestHandlerReplaced(`onlistresources`,this._onlistresources,e),this._onlistresources=e,this.replaceRequestHandler(`resources/list`,async(e,t)=>{if(!this._onlistresources)throw Error(`No onlistresources handler set`);return this._onlistresources(e.params,t)})}_onlistresourcetemplates;get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(e){this.warnIfRequestHandlerReplaced(`onlistresourcetemplates`,this._onlistresourcetemplates,e),this._onlistresourcetemplates=e,this.replaceRequestHandler(`resources/templates/list`,async(e,t)=>{if(!this._onlistresourcetemplates)throw Error(`No onlistresourcetemplates handler set`);return this._onlistresourcetemplates(e.params,t)})}_onreadresource;get onreadresource(){return this._onreadresource}set onreadresource(e){this.warnIfRequestHandlerReplaced(`onreadresource`,this._onreadresource,e),this._onreadresource=e,this.replaceRequestHandler(`resources/read`,async(e,t)=>{if(!this._onreadresource)throw Error(`No onreadresource handler set`);return this._onreadresource(e.params,t)})}sendResourceListChanged(e={}){return this.notification({method:`notifications/resources/list_changed`,params:e})}_onlistprompts;get onlistprompts(){return this._onlistprompts}set onlistprompts(e){this.warnIfRequestHandlerReplaced(`onlistprompts`,this._onlistprompts,e),this._onlistprompts=e,this.replaceRequestHandler(`prompts/list`,async(e,t)=>{if(!this._onlistprompts)throw Error(`No onlistprompts handler set`);return this._onlistprompts(e.params,t)})}sendPromptListChanged(e={}){return this.notification({method:`notifications/prompts/list_changed`,params:e})}getCapabilities(){return this._hostCapabilities}async _onAppsInitialize(e){let t=e.protocolVersion;return this._appInfo!==void 0&&console.warn(`[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values.`),this._appCapabilities=e.appCapabilities,this._appInfo=e.appInfo,{protocolVersion:cd.includes(t)?t:ju,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(e){let t={},n=!1;for(let r of Object.keys(e)){let i=this._hostContext[r],a=e[r];ud(i,a)||(t[r]=a,n=!0)}n&&(this._hostContext=e,this.sendHostContextChange(t))}sendHostContextChange(e){return this.notification({method:`ui/notifications/host-context-changed`,params:e})}sendToolInput(e){return this.notification({method:`ui/notifications/tool-input`,params:e})}sendToolInputPartial(e){return this.notification({method:`ui/notifications/tool-input-partial`,params:e})}sendToolResult(e){return this.notification({method:`ui/notifications/tool-result`,params:e})}sendToolCancelled(e){return this.notification({method:`ui/notifications/tool-cancelled`,params:e})}sendSandboxResourceReady(e){return this.notification({method:`ui/notifications/sandbox-resource-ready`,params:e})}teardownResource(e,t){return this.request({method:`ui/resource-teardown`,params:e},Ku,t)}sendResourceTeardown=this.teardownResource;callTool(e,t){return this.request({method:`tools/call`,params:e},t)}listTools(e,t){return this.request({method:`tools/list`,params:e},t)}async connect(e){if(this.transport)throw Error(`AppBridge is already connected. Call close() before connecting again.`);if(this._initializedReceived=!1,this._client){let e=this._client.getServerCapabilities();if(!e)throw Error(`Client server capabilities not available`);e.tools&&(this.oncalltool=async(e,t)=>this._client.request({method:`tools/call`,params:e},{signal:t.mcpReq.signal}),e.tools.listChanged&&this._client.setNotificationHandler(`notifications/tools/list_changed`,e=>this.sendToolListChanged(e.params))),e.resources&&(this.onlistresources=async(e,t)=>this._client.request({method:`resources/list`,params:e},{signal:t.mcpReq.signal}),this.onlistresourcetemplates=async(e,t)=>this._client.request({method:`resources/templates/list`,params:e},{signal:t.mcpReq.signal}),this.onreadresource=async(e,t)=>this._client.request({method:`resources/read`,params:e},{signal:t.mcpReq.signal}),e.resources.listChanged&&this._client.setNotificationHandler(`notifications/resources/list_changed`,e=>this.sendResourceListChanged(e.params))),e.prompts&&(this.onlistprompts=async(e,t)=>this._client.request({method:`prompts/list`,params:e},{signal:t.mcpReq.signal}),e.prompts.listChanged&&this._client.setNotificationHandler(`notifications/prompts/list_changed`,e=>this.sendPromptListChanged(e.params)))}return super.connect(e)}};function ud(e,t){return JSON.stringify(e)===JSON.stringify(t)}var $=n(e(),1),dd=t(),fd=`text/html;profile=mcp-app`,pd=`io.modelcontextprotocol/ui`,md=3,hd=5,gd=2e3,_d=[`inline`,`fullscreen`],vd=class extends Error{},yd=null,bd=null;async function xd(){let e=new Tu(new URL(`/api/mcp`,location.origin),{fetch:(e,t)=>c(e,t)}),t=new gu({name:`pitot-browser`,version:`0.2.0`},{supportedProtocolVersions:[`2026-07-28`],versionNegotiation:{mode:{pin:`2026-07-28`}},capabilities:{extensions:{[pd]:{mimeTypes:[fd]}}}});try{await t.connect(e);let n={client:t,tools:t.listTools(),references:0,closed:!1,closeListeners:new Set};return n.tools.catch(()=>void 0),t.onclose=()=>Cd(n,!1),t.onerror=()=>Cd(n,!0),n}catch(t){throw await e.close().catch(()=>void 0),t}}async function Sd(){for(let e=0;e{bd===e&&!t.closed&&(yd=t)}).catch(()=>{bd===e&&(bd=null)})}let e=bd;if(!e)continue;let t=await e;if(t.closed){bd===e&&(bd=null);continue}return t.closeTimer&&=(clearTimeout(t.closeTimer),void 0),t.references+=1,t}throw Error(`MCP connection closed during setup`)}function Cd(e,t){if(!e.closed){e.closed=!0,e.closeTimer&&clearTimeout(e.closeTimer),e.closeTimer=void 0,yd===e&&(yd=null),bd=null;for(let t of[...e.closeListeners])t();t&&e.client.close().catch(()=>void 0)}}function wd(e){e.references=Math.max(0,e.references-1),!(e.closed||e.references||e.closeTimer)&&(e.closeTimer=setTimeout(()=>{e.closeTimer=void 0,!(e.references||yd!==e)&&(e.closed=!0,yd=null,bd=null,e.client.close().catch(()=>void 0))},0))}function Td(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}var Ed=new Map;async function Dd(e,t){let n=Ed.get(t);if(n&&n.expires>Date.now())return n.pending;let r={pending:Promise.resolve({text:``}),expires:1/0};return r.pending=e.readResource({uri:t}).then(e=>{let n=e.contents[0];if(e.contents.length!==1||!n||!(`text`in n)||!n.text)throw new vd(`MCP App resource has no HTML content`);if(n.uri!==t)throw new vd(`MCP App resource URI does not match the requested URI`);if(n.mimeType!==fd)throw new vd(`MCP App resource has an unsupported MIME type`);let i=Td(e)?.ttlMs;return r.expires=Date.now()+(typeof i==`number`&&i>0?i:3e5),{text:n.text,_meta:n._meta}}).catch(e=>{throw Ed.get(t)===r&&Ed.delete(t),e}),Ed.set(t,r),r.pending}function Od(e,t){let n=``;return/]*)?>/i.test(e)?e.replace(/]*)?>/i,e=>`${e}${n}`):/]*)?>/i.test(e)?e.replace(/]*)?>/i,e=>`${e}${n}`):`${n}${e}`}function kd({content:e}){let t=l(e);return t?(0,dd.jsx)(Ad,{content:t}):(0,dd.jsx)(r,{m:`md`,children:(0,dd.jsx)(s,{tone:`danger`,children:`This view could not be loaded. Please try again.`})})}function Ad({content:e}){let t=(0,$.useRef)(null),n=(0,$.useRef)(null),s=(0,$.useRef)(null),c=(0,$.useRef)(null),[l,u]=(0,$.useState)(``),[d,f]=(0,$.useState)(`inline`),p=(0,$.useRef)(null),m=(0,$.useRef)(d);m.current=d;let h=e=>{f(e),c.current?.setHostContext({theme:w.current,displayMode:e,availableDisplayModes:_d}),e===`inline`&&document.activeElement!==t.current&&t.current?.focus()};(0,$.useEffect)(()=>{if(d!==`fullscreen`)return;p.current?.focus();let e=document.body.style.overflow;document.body.style.overflow=`hidden`;let n=e=>{e.key===`Escape`&&(e.preventDefault(),h(`inline`))},r=e=>{t.current?.parentElement?.contains(e.target)||p.current?.focus()};return window.addEventListener(`keydown`,n),document.addEventListener(`focusin`,r),()=>{document.body.style.overflow=e,window.removeEventListener(`keydown`,n),document.removeEventListener(`focusin`,r)}},[d]);let[g,_]=(0,$.useState)(240),[v,y]=(0,$.useState)(``),[b,x]=(0,$.useState)(0),S=(0,$.useRef)(0),C=le(`light`),w=(0,$.useRef)(C);w.current=C,(0,$.useEffect)(()=>{c.current?.setHostContext({theme:C,displayMode:m.current,availableDisplayModes:_d})},[C]),(0,$.useEffect)(()=>{S.current=0},[e.resource_uri]),(0,$.useEffect)(()=>{let t=!1,r;f(`inline`),u(``),y(``);let i=()=>{let e=S.current+1;if(e>hd)return;S.current=e;let t=e===1?0:Math.min(750*2**(e-2),6e3);t===0?x(e=>e+1):r=setTimeout(()=>x(e=>e+1),t)},a=()=>i();async function o(){try{let r=await Sd();if(t){wd(r);return}s.current=r,r.closeListeners.add(a),n.current=r.client;let i=await Dd(r.client,e.resource_uri);await r.tools,t||(S.current=0,u(Od(i.text,i._meta)))}catch(e){console.error(`MCP app resource load failed`,e),t||(y(`This view could not be loaded. Please try again.`),S.current>0&&!(e instanceof vd)&&i())}}return o(),()=>{t=!0,r&&clearTimeout(r);let e=c.current?.teardownResource({}).catch(()=>void 0)??Promise.resolve(),i=s.current;i&&(i.closeListeners.delete(a),e.finally(()=>wd(i))),c.current=null,n.current=null,s.current=null}},[e.resource_uri,b]);async function T(){let r=t.current,i=n.current;if(r?.contentWindow&&l&&i&&!c.current)try{let t=new ld(null,{name:`Pitot`,version:`0.2.0`},{serverTools:{},logging:{}},{hostContext:{theme:w.current,displayMode:`inline`,availableDisplayModes:_d}}),n=s.current;if(!n)throw Error(`MCP connection unavailable`);t.oncalltool=async(e,t)=>{let r=Td(Td((await n.tools).tools.find(t=>t.name===e.name)?._meta)?.ui)?.visibility;if(!Array.isArray(r)||!r.includes(`app`)||/^(?:create|edit|replace|restore|delete)_/.test(e.name))throw Error(`This tool is unavailable in the app`);return i.callTool(e,{signal:t.mcpReq.signal})},t.onrequestdisplaymode=async({mode:e})=>e!==`inline`&&e!==`fullscreen`?{mode:m.current}:(h(e),{mode:e}),c.current=t,t.onsizechange=({height:e})=>{e&&_(Math.min(gd,Math.max(240,Math.round(e))))},t.onmessage=async()=>({isError:!0}),t.oninitialized=async()=>{await t.sendToolInput({arguments:e.tool_input??{}}),await t.sendToolResult({content:[{type:`text`,text:JSON.stringify(e.tool_result??{})}],structuredContent:e.tool_result,isError:e.is_error})},await t.connect(new sd(r.contentWindow,r.contentWindow))}catch(e){console.error(`MCP app bridge connect failed`,e),y(`This view could not be loaded. Please try again.`)}}return v?(0,dd.jsx)(r,{m:`md`,children:(0,dd.jsx)(a,{state:`error`,error:{message:v}})}):l?(0,dd.jsx)(i,{active:d===`fullscreen`,children:(0,dd.jsxs)(r,{"data-app-fullscreen":d===`fullscreen`?``:void 0,role:d===`fullscreen`?`dialog`:void 0,"aria-modal":d===`fullscreen`||void 0,"aria-label":d===`fullscreen`?`Pitot analysis view`:void 0,bg:`var(--mantine-color-body)`,style:d===`fullscreen`?{position:`fixed`,inset:0,zIndex:1e3,display:`flex`,flexDirection:`column`}:void 0,children:[d===`fullscreen`&&(0,dd.jsx)(r,{p:`xs`,ta:`right`,children:(0,dd.jsx)(o,{ref:p,"data-autofocus":!0,size:`compact-sm`,variant:`default`,"aria-label":`Close analysis view`,onClick:()=>h(`inline`),children:`Close`})}),(0,dd.jsx)(r,{component:`iframe`,tabIndex:0,ref:t,title:`Pitot analysis view`,sandbox:`allow-scripts`,scrolling:`auto`,srcDoc:l,w:`100%`,bd:0,bg:`var(--mantine-color-body)`,style:{display:`block`,height:d===`fullscreen`?`100%`:g,...d===`fullscreen`?{flex:`1 1 0`,minHeight:0}:{}},onLoad:()=>void T()})]})}):(0,dd.jsx)(a,{state:`loading`,loadingLabel:`Preparing view…`})}export{kd as default}; \ No newline at end of file diff --git a/internal/ui/dist/assets/new-dashboard-xnHgERfr.js b/internal/ui/dist/assets/new-dashboard-D58ui2mw.js similarity index 81% rename from internal/ui/dist/assets/new-dashboard-xnHgERfr.js rename to internal/ui/dist/assets/new-dashboard-D58ui2mw.js index f0c5bc24e..2d4ddf577 100644 --- a/internal/ui/dist/assets/new-dashboard-xnHgERfr.js +++ b/internal/ui/dist/assets/new-dashboard-D58ui2mw.js @@ -1 +1 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{D as r,T as i,w as a}from"./brand-CCQ0JT0F.js";import{f as o,p as s}from"./search-DBgztReF.js";import{s as c}from"./auth-K3NK-QpB.js";import{T as l}from"./useQuery-BLTYSIvG.js";import{t as u}from"./page-DI98kZbw.js";import{t as d}from"./discard-BmoNOAJh.js";var f=n(e(),1),p=t();function m({onClose:e,onCreated:t}){let n=l(),[m,h]=(0,f.useState)(``),[g,_]=(0,f.useState)({q:``,tab:`query`,range:`1h`}),[v,y]=(0,f.useState)(!1),b=m.trim(),x=d(b!==``||v,e,`this dashboard`);return(0,p.jsxs)(r,{opened:!0,onClose:x.request,closeOnEscape:!1,title:`New dashboard`,size:`min(1280px, 100vw - 32px)`,onKeyDown:x.onKeyDown,children:[x.prompt,(0,p.jsxs)(i,{gap:0,children:[(0,p.jsx)(a,{label:`Dashboard name`,px:`lg`,value:m,onChange:e=>h(e.currentTarget.value),"data-autofocus":!0,required:!0}),(0,p.jsx)(u,{search:g,onSearch:_,context:{spec:{version:1,name:b||`New dashboard`,time:{range:g.range},panels:[]},vars:{},onDirtyChange:y,cancel:x.request,save:{label:`Create dashboard`,run:async e=>{if(!b)throw Error(`Name the dashboard first.`);let r=g.from&&g.to?{from:g.from,to:g.to}:{range:g.range};try{let i=await o({version:1,name:b,time:r,panels:[{...e,id:`panel`}]});n.invalidateQueries({queryKey:s}),t(i.id)}catch(e){throw e instanceof c&&e.problems.length>0?Error(e.problems.map(e=>e.message).join(` `)):e}}}}})]})]})}export{m as NewDashboard}; \ No newline at end of file +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{D as r,T as i,w as a}from"./brand-D6fP-cLS.js";import{f as o,p as s}from"./search-D_K9J6yO.js";import{s as c}from"./auth-DWqIkMZS.js";import{T as l}from"./useQuery-BLTYSIvG.js";import{t as u}from"./page-1Rod7OFH.js";import{t as d}from"./discard-NZfxCIcK.js";var f=n(e(),1),p=t();function m({onClose:e,onCreated:t}){let n=l(),[m,h]=(0,f.useState)(``),[g,_]=(0,f.useState)({q:``,tab:`query`,range:`1h`}),[v,y]=(0,f.useState)(!1),b=m.trim(),x=d(b!==``||v,e,`this dashboard`);return(0,p.jsxs)(r,{opened:!0,onClose:x.request,closeOnEscape:!1,title:`New dashboard`,size:`min(1280px, 100vw - 32px)`,onKeyDown:x.onKeyDown,children:[x.prompt,(0,p.jsxs)(i,{gap:0,children:[(0,p.jsx)(a,{label:`Dashboard name`,px:`lg`,value:m,onChange:e=>h(e.currentTarget.value),"data-autofocus":!0,required:!0}),(0,p.jsx)(u,{search:g,onSearch:_,context:{spec:{version:1,name:b||`New dashboard`,time:{range:g.range},panels:[]},vars:{},onDirtyChange:y,cancel:x.request,save:{label:`Create dashboard`,run:async e=>{if(!b)throw Error(`Name the dashboard first.`);let r=g.from&&g.to?{from:g.from,to:g.to}:{range:g.range};try{let i=await o({version:1,name:b,time:r,panels:[{...e,id:`panel`}]});n.invalidateQueries({queryKey:s}),t(i.id)}catch(e){throw e instanceof c&&e.problems.length>0?Error(e.problems.map(e=>e.message).join(` `)):e}}}}})]})]})}export{m as NewDashboard}; \ No newline at end of file diff --git a/internal/ui/dist/assets/page-DI98kZbw.js b/internal/ui/dist/assets/page-1Rod7OFH.js similarity index 99% rename from internal/ui/dist/assets/page-DI98kZbw.js rename to internal/ui/dist/assets/page-1Rod7OFH.js index f2c2444fd..8652b2450 100644 --- a/internal/ui/dist/assets/page-DI98kZbw.js +++ b/internal/ui/dist/assets/page-1Rod7OFH.js @@ -1,2 +1,2 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{A as r,G as i,T as a,Tt as o,g as s,j as c,k as l,q as u,s as d,w as f,y as p}from"./brand-CCQ0JT0F.js";import{a as m,c as ee,g as te,h,m as g,r as _,t as v,u as y}from"./toolbar-DV2TSB0G.js";import{d as ne,g as b,w as re}from"./search-DBgztReF.js";import{t as ie}from"./NumberInput-B7uemOf3.js";import{t as x}from"./live-data-meta-CbLSAtC3.js";import{s as ae}from"./auth-K3NK-QpB.js";import{t as oe}from"./useQuery-BLTYSIvG.js";import{i as se,r as ce,t as le}from"./search-Bj_SOIkw.js";import{ct as ue,k as de}from"./index-C5SsAUtw.js";import{A as fe,B as S,C as pe,D as me,E as C,F as w,H as he,I as T,L as ge,M as E,N as _e,O as D,P as ve,R as ye,S as be,T as O,U as xe,V as k,W as Se,_ as Ce,a as we,b as A,c as Te,d as Ee,f as De,g as Oe,h as ke,i as Ae,j as je,k as Me,l as j,m as M,n as Ne,o as Pe,p as N,s as Fe,t as Ie,u as Le,v as Re,w as ze,x as Be,y as Ve,z as He}from"./save-dialog-EDUaI5f8.js";var P=n(e(),1),F=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new Ue(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[e-4]==0&&this.buffer[e-1]>-1){if(t==n)return;if(this.buffer[e-2]>=t){this.buffer[e-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.reducePos=this.pos=n+e.length;this.pushState(t,n),this.buffer.push(r,n,i,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new We(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;rt&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216)){if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}},Ue=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},We=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}},Ge=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function I(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var Ke=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},qe=new Ke,Je=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=qe,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;in.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t=this.chunk2Pos&&nt.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.next=this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?-1:this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=qe,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},L=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;z(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};L.prototype.contextual=L.prototype.fallback=L.prototype.extend=!1;var R=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?I(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(z(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};R.prototype.contextual=L.prototype.fallback=L.prototype.extend=!1;var Ye=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function z(e,t,n,r,i,a){let o=0,s=1<0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||Xe(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function B(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function Xe(e,t,n,r){let i=B(n,r,t);return i<0||B(n,r,e)t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}var Qe=class{constructor(e,t){this.fragments=e,this.minRepeat=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Ze(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Ze(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(i instanceof w){let n=a>this.lastRepeatPos&&i.type.id>=this.minRepeat;if(a==e||n){let t=a+i.length,r;if(a>=this.safeFrom&&t<=this.safeTo&&(!(r=i.prop(je.lookAhead))||t+r=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+i.length}}},$e=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new Ke)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;rl.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new Ke,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Ke,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;te.bufferLength*4?new Qe(n,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;at)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&tt(r);if(e)return V&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw V&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return V&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e500&&i.buffer.length>500){if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e-1&&n.length&&(!i||(n.prop(je.contextHash)||0)==a))return e.useNode(n,o,t),n;if(n.children.length==0||n.positions[0]>0)break;let s=n.children[0];if(s instanceof w&&(!r||s.type.id>=this.parser.minRepeatTerm))n=s;else break}return null}advanceStack(e,t,n){let r=e.pos,{parser:i}=this,a=V?this.stackID(e)+` -> `:``;if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.reducePos0)return e.reduce(o),V&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let s=this.tokens.getActions(e);for(let o=0;or?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return W(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),V&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(V&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)V&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))V&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),V&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),W(o,n)):(!r||r.scoree.topRules[t][1]),r=[];for(let e=0;e=0)i(r,e,t[n++]);else{let a=t[n+-r];for(let o=-r;o>0;o--)i(t[n++],e,a);n++}}}this.nodeSet=new E(t.map((t,i)=>_e.define({name:i>=this.minRepeatTerm?void 0:t,id:i,props:r[i],top:n.indexOf(i)>-1,error:i==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(i)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Me;let a=I(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;etypeof e==`number`?new L(a,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new U(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=K(this.data,n+2);else break}r=t(K(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=K(this.data,n+2);else break}if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(t){let n=Object.assign(Object.create(e.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let e=this.topRules[t.top];if(!e)throw RangeError(`Invalid top rule name ${t.top}`);n.top=e}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(e=>{let n=t.tokenizers.find(t=>t.from==e);return n?n.to:e})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((e,r)=>{let i=t.specializers.find(t=>t.from==e.external);if(!i)return e;let a=Object.assign(Object.assign({},e),{external:i.to});return n.specializers[r]=q(a),a})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;ee)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.scoree.external(n,r)<<1|t}return e.get}var nt=36,rt=1,it=2,J=3,Y=4,at=5,X=6,ot=7,st=8,ct=9,lt=10,ut=11,Z=12,dt=13,ft=14,pt=15,mt=16,ht=17,gt=18,_t=19,vt=20,yt=21,bt=22,xt=23,St=24;function Ct(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}function wt(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function Q(e,t,n){for(let r=!1;;){if(e.next<0)return;if(e.next==t&&!r){e.advance();return}r=n&&!r&&e.next==92,e.advance()}}function Tt(e,t){scan:for(;;){if(e.next<0)return;if(e.next==36){e.advance();for(let n=0;n)`.charCodeAt(n);for(;;){if(e.next<0)return;if(e.next==r&&e.peek(1)==39){e.advance(2);return}e.advance()}}function Dt(e,t){for(;e.next==95||Ct(e.next);)t!=null&&(t+=String.fromCharCode(e.next)),e.advance();return t}function Ot(e){if(e.next==39||e.next==34||e.next==96){let t=e.next;e.advance(),Q(e,t,!1)}else Dt(e)}function kt(e,t){for(;e.next==48||e.next==49;)e.advance();t&&e.next==t&&e.advance()}function At(e,t){for(;;){if(e.next==46){if(t)break;t=!0}else if(e.next<48||e.next>57)break;e.advance()}if(e.next==69||e.next==101)for(e.advance(),(e.next==43||e.next==45)&&e.advance();e.next>=48&&e.next<=57;)e.advance()}function jt(e){for(;!(e.next<0||e.next==10);)e.advance()}function Mt(e,t){for(let n=0;nt%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new Ue(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[e-4]==0&&this.buffer[e-1]>-1){if(t==n)return;if(this.buffer[e-2]>=t){this.buffer[e-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.reducePos=this.pos=n+e.length;this.pushState(t,n),this.buffer.push(r,n,i,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new We(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;rt&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216)){if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}},Ue=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},We=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}},Ge=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function I(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var Ke=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},qe=new Ke,Je=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=qe,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;in.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t=this.chunk2Pos&&nt.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.next=this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?-1:this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=qe,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},L=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;z(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};L.prototype.contextual=L.prototype.fallback=L.prototype.extend=!1;var R=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?I(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(z(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};R.prototype.contextual=L.prototype.fallback=L.prototype.extend=!1;var Ye=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function z(e,t,n,r,i,a){let o=0,s=1<0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||Xe(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function B(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function Xe(e,t,n,r){let i=B(n,r,t);return i<0||B(n,r,e)t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}var Qe=class{constructor(e,t){this.fragments=e,this.minRepeat=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Ze(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Ze(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(i instanceof w){let n=a>this.lastRepeatPos&&i.type.id>=this.minRepeat;if(a==e||n){let t=a+i.length,r;if(a>=this.safeFrom&&t<=this.safeTo&&(!(r=i.prop(je.lookAhead))||t+r=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+i.length}}},$e=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new Ke)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;rl.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new Ke,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Ke,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;te.bufferLength*4?new Qe(n,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;at)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&tt(r);if(e)return V&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw V&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return V&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e500&&i.buffer.length>500){if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e-1&&n.length&&(!i||(n.prop(je.contextHash)||0)==a))return e.useNode(n,o,t),n;if(n.children.length==0||n.positions[0]>0)break;let s=n.children[0];if(s instanceof w&&(!r||s.type.id>=this.parser.minRepeatTerm))n=s;else break}return null}advanceStack(e,t,n){let r=e.pos,{parser:i}=this,a=V?this.stackID(e)+` -> `:``;if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.reducePos0)return e.reduce(o),V&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let s=this.tokens.getActions(e);for(let o=0;or?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return W(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),V&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(V&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)V&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))V&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),V&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),W(o,n)):(!r||r.scoree.topRules[t][1]),r=[];for(let e=0;e=0)i(r,e,t[n++]);else{let a=t[n+-r];for(let o=-r;o>0;o--)i(t[n++],e,a);n++}}}this.nodeSet=new E(t.map((t,i)=>_e.define({name:i>=this.minRepeatTerm?void 0:t,id:i,props:r[i],top:n.indexOf(i)>-1,error:i==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(i)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Me;let a=I(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;etypeof e==`number`?new L(a,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new U(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=K(this.data,n+2);else break}r=t(K(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=K(this.data,n+2);else break}if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(t){let n=Object.assign(Object.create(e.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let e=this.topRules[t.top];if(!e)throw RangeError(`Invalid top rule name ${t.top}`);n.top=e}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(e=>{let n=t.tokenizers.find(t=>t.from==e);return n?n.to:e})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((e,r)=>{let i=t.specializers.find(t=>t.from==e.external);if(!i)return e;let a=Object.assign(Object.assign({},e),{external:i.to});return n.specializers[r]=q(a),a})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;ee)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.scoree.external(n,r)<<1|t}return e.get}var nt=36,rt=1,it=2,J=3,Y=4,at=5,X=6,ot=7,st=8,ct=9,lt=10,ut=11,Z=12,dt=13,ft=14,pt=15,mt=16,ht=17,gt=18,_t=19,vt=20,yt=21,bt=22,xt=23,St=24;function Ct(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}function wt(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function Q(e,t,n){for(let r=!1;;){if(e.next<0)return;if(e.next==t&&!r){e.advance();return}r=n&&!r&&e.next==92,e.advance()}}function Tt(e,t){scan:for(;;){if(e.next<0)return;if(e.next==36){e.advance();for(let n=0;n)`.charCodeAt(n);for(;;){if(e.next<0)return;if(e.next==r&&e.peek(1)==39){e.advance(2);return}e.advance()}}function Dt(e,t){for(;e.next==95||Ct(e.next);)t!=null&&(t+=String.fromCharCode(e.next)),e.advance();return t}function Ot(e){if(e.next==39||e.next==34||e.next==96){let t=e.next;e.advance(),Q(e,t,!1)}else Dt(e)}function kt(e,t){for(;e.next==48||e.next==49;)e.advance();t&&e.next==t&&e.advance()}function At(e,t){for(;;){if(e.next==46){if(t)break;t=!0}else if(e.next<48||e.next>57)break;e.advance()}if(e.next==69||e.next==101)for(e.advance(),(e.next==43||e.next==45)&&e.advance();e.next>=48&&e.next<=57;)e.advance()}function jt(e){for(;!(e.next<0||e.next==10);)e.advance()}function Mt(e,t){for(let n=0;n!=&|~^/`,specialVar:`?`,identifierQuotes:`"`,caseInsensitiveIdentifiers:!1,words:Pt(It,Ft)};function Rt(e,t,n,r){let i={};for(let t in Lt)i[t]=(e.hasOwnProperty(t)?e:Lt)[t];return t&&(i.words=Pt(t,n||``,r)),i}function zt(e){return new Ye(t=>{let{next:n}=t;if(t.advance(),Mt(n,Nt)){for(;Mt(t.next,Nt);)t.advance();t.acceptToken(nt)}else if(n==36&&e.doubleDollarQuotedStrings){let e=Dt(t,``);t.next==36&&(t.advance(),Tt(t,e),t.acceptToken(J))}else if(n==39||n==34&&e.doubleQuotedStrings)Q(t,n,e.backslashEscapes),t.acceptToken(J);else if(n==35&&e.hashComments||n==47&&t.next==47&&e.slashComments)jt(t),t.acceptToken(rt);else if(n==45&&t.next==45&&(!e.spaceAfterDashes||t.peek(1)==32))jt(t),t.acceptToken(rt);else if(n==47&&t.next==42){t.advance();for(let e=1;;){let n=t.next;if(t.next<0)break;if(t.advance(),n==42&&t.next==47){if(e--,t.advance(),!e)break}else n==47&&t.next==42&&(e++,t.advance())}t.acceptToken(it)}else if((n==101||n==69)&&t.next==39)t.advance(),Q(t,39,!0),t.acceptToken(J);else if((n==110||n==78)&&t.next==39&&e.charSetCasts)t.advance(),Q(t,39,e.backslashEscapes),t.acceptToken(J);else if(n==95&&e.charSetCasts)for(let n=0;;n++){if(t.next==39&&n>1){t.advance(),Q(t,39,e.backslashEscapes),t.acceptToken(J);break}if(!Ct(t.next))break;t.advance()}else if(e.plsqlQuotingMechanism&&(n==113||n==81)&&t.next==39&&t.peek(1)>0&&!Mt(t.peek(1),Nt)){let e=t.peek(1);t.advance(2),Et(t,e),t.acceptToken(J)}else if(Mt(n,e.identifierQuotes))Q(t,n==91?93:n,!1),t.acceptToken(_t);else if(n==40)t.acceptToken(ot);else if(n==41)t.acceptToken(st);else if(n==123)t.acceptToken(ct);else if(n==125)t.acceptToken(lt);else if(n==91)t.acceptToken(ut);else if(n==93)t.acceptToken(Z);else if(n==59)t.acceptToken(dt);else if(e.unquotedBitLiterals&&n==48&&t.next==98)t.advance(),kt(t),t.acceptToken(bt);else if((n==98||n==66)&&(t.next==39||t.next==34)){let n=t.next;t.advance(),e.treatBitsAsBytes?(Q(t,n,e.backslashEscapes),t.acceptToken(xt)):(kt(t,n),t.acceptToken(bt))}else if(n==48&&(t.next==120||t.next==88)||(n==120||n==88)&&t.next==39){let e=t.next==39;for(t.advance();wt(t.next);)t.advance();e&&t.next==39&&t.advance(),t.acceptToken(Y)}else if(n==46&&t.next>=48&&t.next<=57)At(t,!0),t.acceptToken(Y);else if(n==46)t.acceptToken(ft);else if(n>=48&&n<=57)At(t,!1),t.acceptToken(Y);else if(Mt(n,e.operatorChars)){for(;Mt(t.next,e.operatorChars);)t.advance();t.acceptToken(pt)}else if(Mt(n,e.specialVar))t.next==n&&t.advance(),Ot(t),t.acceptToken(ht);else if(n==58||n==44)t.acceptToken(mt);else if(Ct(n)){let r=Dt(t,String.fromCharCode(n));t.acceptToken(t.next==46||t.peek(-r.length-1)==46?gt:e.words[r.toLowerCase()]??gt)}})}var Bt=zt(Lt),Vt=et.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:`⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement`,maxTerm:38,nodeProps:[[`isolate`,-4,1,2,3,19,``]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:`RORO`,tokenizers:[0,Bt],topRules:{Script:[0,25]},tokenPrec:0});function Ht(e){let t=e.cursor().moveTo(e.from,-1);for(;/Comment/.test(t.name);)t.moveTo(t.from,-1);return t.node}function Ut(e,t){let n=e.sliceString(t.from,t.to),r=/^([`'"\[])(.*)([`'"\]])$/.exec(n);return r?r[2]:n}function Wt(e){return e&&(e.name==`Identifier`||e.name==`QuotedIdentifier`)}function Gt(e,t){if(t.name==`CompositeIdentifier`){let n=[];for(let r=t.firstChild;r;r=r.nextSibling)Wt(r)&&n.push(Ut(e,r));return n}return[Ut(e,t)]}function Kt(e,t){for(let n=[];;){if(!t||t.name!=`.`)return n;let r=Ht(t);if(!Wt(r))return n;n.unshift(Ut(e,r)),t=Ht(r)}}function qt(e,t){let n=C(e).resolveInner(t,-1),r=Yt(e.doc,n);return n.name==`Identifier`||n.name==`QuotedIdentifier`||n.name==`Keyword`?{from:n.from,quoted:n.name==`QuotedIdentifier`?e.doc.sliceString(n.from,n.from+1):null,parents:Kt(e.doc,Ht(n)),aliases:r}:n.name==`.`?{from:t,quoted:null,parents:Kt(e.doc,n),aliases:r}:{from:t,quoted:null,parents:[],empty:!0,aliases:r}}var Jt=new Set(`where group having order union intersect except all distinct limit offset fetch for`.split(` `));function Yt(e,t){let n;for(let e=t;!n;e=e.parent){if(!e)return null;e.name==`Statement`&&(n=e)}let r=null;for(let t=n.firstChild,i=!1,a=null;t;t=t.nextSibling){let n=t.name==`Keyword`?e.sliceString(t.from,t.to).toLowerCase():null,o=null;if(!i)i=n==`from`;else if(n==`as`&&a&&Wt(t.nextSibling))o=Ut(e,t.nextSibling);else if(n&&Jt.has(n))break;else a&&Wt(t)&&(o=Ut(e,t));o&&(r||=Object.create(null),r[o]=Gt(e,a)),a=/Identifier$/.test(t.name)?t:null}return r}function Xt(e,t,n){return n.map(n=>({...n,label:n.label[0]==e?n.label:e+n.label+t,apply:void 0}))}var Zt=/^\w*$/,Qt=/^[`'"\[]?\w*[`'"\]]?$/;function $t(e){return e.self&&typeof e.self.label==`string`}var en=class e{constructor(e,t){this.idQuote=e,this.idCaseInsensitive=t,this.list=[],this.children=void 0}child(t){let n=this.children||=Object.create(null);return n[t]||(t&&!this.list.some(e=>e.label==t)&&this.list.push(tn(t,`type`,this.idQuote,this.idCaseInsensitive)),n[t]=new e(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let t=this.list.findIndex(t=>t.label==e.label);t>-1?this.list[t]=e:this.list.push(e)}addCompletions(e){for(let t of e)this.addCompletion(typeof t==`string`?tn(t,`property`,this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):$t(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let t of Object.keys(e)){let n=e[t],r=null,i=t.replace(/\\?\./g,e=>e==`.`?`\0`:e).split(`\0`),a=this;$t(n)&&(r=n.self,n=n.children);for(let e=0;e{let{parents:t,from:n,quoted:i,empty:a,aliases:c}=qt(e.state,e.pos);if(a&&!e.explicit)return null;c&&t.length==1&&(t=c[t[0]]||t);let l=o;for(let e of t){for(;!l.children||!l.children[e];)if(l==o&&s)l=s;else if(l==s&&r)l=l.child(r);else return null;let t=l.maybeChild(e);if(!t)return null;l=t}let u=l.list;if(l==o&&c&&(u=u.concat(Object.keys(c).map(e=>({label:e,type:`constant`})))),i){let t=i[0],r=nn(t);return{from:n,to:e.state.sliceDoc(e.pos,e.pos+1)==r?e.pos+1:void 0,options:Xt(t,r,u),validFor:Qt}}return{from:n,options:u,validFor:Zt}}}function an(e){return e==yt?`type`:e==vt?`keyword`:`variable`}function on(e,t,n){let r=Object.keys(e).map(r=>n(t?r.toUpperCase():r,an(e[r])));return M([`QuotedIdentifier`,`String`,`LineComment`,`BlockComment`,`.`],De(r))}var sn=Vt.configure({props:[pe.add({Statement:Be()}),be.add({Statement(e,t){return{from:Math.min(e.from+100,t.doc.lineAt(e.from).to),to:e.to}},BlockComment(e){return{from:e.from+2,to:e.to-2}}}),me({Keyword:D.keyword,Type:D.typeName,Builtin:D.standard(D.name),Bits:D.number,Bytes:D.string,Bool:D.bool,Null:D.null,Number:D.number,String:D.string,Identifier:D.name,QuotedIdentifier:D.special(D.string),SpecialVar:D.special(D.name),LineComment:D.lineComment,BlockComment:D.blockComment,Operator:D.operator,"Semi Punctuation":D.punctuation,"( )":D.paren,"{ }":D.brace,"[ ]":D.squareBracket})]}),cn=class e{constructor(e,t,n){this.dialect=e,this.language=t,this.spec=n}get extension(){return this.language.extension}configureLanguage(t,n){return new e(this.dialect,this.language.configure(t,n),this.spec)}static define(t){let n=Rt(t,t.keywords,t.types,t.builtin),r=Re.define({name:`sql`,parser:sn.configure({tokenizers:[{from:Bt,to:zt(n)}]}),languageData:{commentTokens:{line:`--`,block:{open:`/*`,close:`*/`}},closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,"`"]}}});return new e(n,r,t)}};function ln(e,t){return{label:e,type:t,boost:-1}}function un(e,t=!1,n){return on(e.dialect.words,t,n||ln)}function dn(e){return e.schema?rn(e.schema,e.tables,e.schemas,e.defaultTable,e.defaultSchema,e.dialect||mn):()=>null}function fn(e){return e.schema?(e.dialect||mn).language.data.of({autocomplete:dn(e)}):[]}function pn(e={}){let t=e.dialect||mn;return new Ve(t.language,[fn(e),t.language.data.of({autocomplete:un(t,e.upperCaseKeywords,e.keywordCompletion)})])}var mn=cn.define({}),hn=cn.define({charSetCasts:!0,doubleDollarQuotedStrings:!0,operatorChars:"+-*/<>=~!@#%^&|`?",specialVar:``,keywords:It+`abort abs absent access according ada admin aggregate alias also always analyse analyze array_agg array_max_cardinality asensitive assert assignment asymmetric atomic attach attribute attributes avg backward base64 begin_frame begin_partition bernoulli bit_length blocked bom cache called cardinality catalog_name ceil ceiling chain char_length character_length character_set_catalog character_set_name character_set_schema characteristics characters checkpoint class class_origin cluster coalesce cobol collation_catalog collation_name collation_schema collect column_name columns command_function command_function_code comment comments committed concurrently condition_number configuration conflict connection_name constant constraint_catalog constraint_name constraint_schema contains content control conversion convert copy corr cost covar_pop covar_samp csv cume_dist current_catalog current_row current_schema cursor_name database datalink datatype datetime_interval_code datetime_interval_precision db debug defaults defined definer degree delimiter delimiters dense_rank depends derived detach detail dictionary disable discard dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue document dump dynamic_function dynamic_function_code element elsif empty enable encoding encrypted end_frame end_partition endexec enforced enum errcode error event every exclude excluding exclusive exp explain expression extension extract family file filter final first_value flag floor following force foreach fortran forward frame_row freeze fs functions fusion generated granted greatest groups handler header hex hierarchy hint id ignore ilike immediately immutable implementation implicit import include including increment indent index indexes info inherit inherits inline insensitive instance instantiable instead integrity intersection invoker isnull key_member key_type label lag last_value lead leakproof least length library like_regex link listen ln load location lock locked log logged lower mapping matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text min minvalue mod mode more move multiset mumps name namespace nfc nfd nfkc nfkd nil normalize normalized nothing notice notify notnull nowait nth_value ntile nullable nullif nulls number occurrences_regex octet_length octets off offset oids operator options ordering others over overlay overriding owned owner parallel parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partition pascal passing passthrough password percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding prepared print_strict_params procedural procedures program publication query quote raise range rank reassign recheck recovery refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex rename repeatable replace replica requiring reset respect restart restore result_oid returned_cardinality returned_length returned_octet_length returned_sqlstate returning reverse routine_catalog routine_name routine_schema routines row_count row_number rowtype rule scale schema_name schemas scope scope_catalog scope_name scope_schema security selective self sensitive sequence sequences serializable server server_name setof share show simple skip slice snapshot source specific_name sqlcode sqlerror sqrt stable stacked standalone statement statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time table_name tables tablesample tablespace temp template ties token top_level_count transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex trigger_catalog trigger_name trigger_schema trim trim_array truncate trusted type types uescape unbounded uncommitted unencrypted unlink unlisten unlogged unnamed untyped upper uri use_column use_variable user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema vacuum valid validate validator value_of var_pop var_samp varbinary variable_conflict variadic verbose version versioning views volatile warning whitespace width_bucket window within wrapper xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate yes`,types:Ft+`bigint int8 bigserial serial8 varbit bool box bytea cidr circle precision float8 inet int4 json jsonb line lseg macaddr macaddr8 money numeric pg_lsn point polygon float4 int2 smallserial serial2 serial serial4 text timetz timestamptz tsquery tsvector txid_snapshot uuid xml`}),gn=`accessible algorithm analyze asensitive authors auto_increment autocommit avg avg_row_length binlog btree cache catalog_name chain change changed checkpoint checksum class_origin client_statistics coalesce code collations columns comment committed completion concurrent consistent contains contributors convert database databases day_hour day_microsecond day_minute day_second delay_key_write delayed delimiter des_key_file dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile enable enclosed ends engine engines enum errors escaped even event events every explain extended fast field fields flush force found_rows fulltext grants handler hash high_priority hosts hour_microsecond hour_minute hour_second ignore ignore_server_ids import index index_statistics infile innodb insensitive insert_method install invoker iterate keys kill linear lines list load lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modify mutex mysql_errno no_write_to_binlog offline offset one online optimize optionally outfile pack_keys parser partition partitions password phase plugin plugins prev processlist profile profiles purge query quick range read_write rebuild recover regexp relaylog remove rename reorganize repair repeatable replace require resume rlike row_format rtree schedule schema_name schemas second_microsecond security sensitive separator serializable server share show slave slow snapshot soname spatial sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result ssl starting starts std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace terminated triggers truncate uncommitted uninstall unlock upgrade use use_frm user_resources user_statistics utc_date utc_time utc_timestamp variables views warnings xa xor year_month zerofill`;Ft+``,It+``+gn,It+``+gn,It+``,Ft+``,It+``,Ft+``,Ft+``,It+``,Ft+``;var _n=cn.define({...hn.spec,keywords:`${hn.spec.keywords} qualify exclude replace pivot unpivot summarize asof positional semi anti union by name columns sample using key`,types:`${hn.spec.types} variant timestamp_ns timestamptz_ns hugeint uhugeint ubigint uinteger`,builtin:`${hn.spec.builtin??``} time_bucket epoch_ns epoch_ms make_timestamp_ns try_cast count_if arg_max arg_min any_value quantile_cont quantile_disc approx_quantile histogram first last list list_extract list_value list_distinct list_sort unnest struct_pack struct_extract map map_keys map_extract map_extract_value json_extract json_extract_string json_keys json_type to_json regexp_matches regexp_full_match regexp_replace regexp_extract starts_with contains greatest least isfinite isinf isnan date_diff date_sub`,specialVar:`$?`}),vn=De([{label:`$__window`,type:`function`,detail:`Time filter`,info:`Use $__window(time_column) to apply the dashboard time range.`},{label:`$__bucket`,type:`function`,detail:`Time bucket`,info:`Use $__bucket(time_column) to group by the panel interval.`}]);function yn(e){return Object.fromEntries(Object.entries({...e.signals,...e.sql_relations}).map(([e,t])=>[e,t.columns.map(e=>({label:e.name,type:`property`,detail:e.sql_type??e.type,info:e.description}))]))}function bn(e,t){let n=e.line(Math.max(1,Math.min(e.lines,t.line+1)));return n.from+Math.max(0,Math.min(n.length,t.character))}function xn(e,t){return t.map(t=>{let n=t.range?bn(e,t.range.start):0;return{from:n,to:t.range?Math.max(n,bn(e,t.range.end)):e.length,severity:`error`,message:t.message+(t.hint?` (${t.hint})`:``)}})}var $=t(),Sn=[];function Cn(e){let{value:t,schema:n,problems:r=Sn,label:i=`Panel SQL`,describedBy:a,disabled:o=!1}=e,s=(0,P.useRef)(null),c=(0,P.useRef)(null),l=(0,P.useRef)(e);l.current=e;let u=(0,P.useRef)({language:new k,editable:new k,attributes:new k});return(0,P.useEffect)(()=>{let{language:e,editable:t,attributes:n}=u.current,r=new T({parent:s.current,state:he.create({doc:l.current.value,extensions:[S(),Oe(),ge(),ye(),A(),ze(),j,O(Te),T.lineWrapping,e.of(pn({dialect:_n})),_n.language.data.of({autocomplete:vn}),t.of([]),n.of([]),xe.highest(He.of([{key:`Mod-Enter`,run:()=>(l.current.disabled||l.current.onRun(),!0),stopPropagation:!0},{key:`Escape`,run:()=>(r.contentDOM.blur(),l.current.onEscape(),!0),stopPropagation:!0}])),Ee(),He.of([...N.filter(e=>e.key!==`Escape`),...ke,...Ce]),T.updateListener.of(e=>{e.docChanged&&l.current.onChange(e.state.doc.toString())})]})});return c.current=r,()=>{c.current=null,r.destroy()}},[]),(0,P.useEffect)(()=>{let e=c.current;e.state.doc.toString()!==t&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:t}})},[t]),(0,P.useEffect)(()=>{c.current.dispatch({effects:u.current.language.reconfigure(pn({dialect:_n,schema:n?yn(n):void 0}))})},[n]),(0,P.useEffect)(()=>{c.current.dispatch({effects:u.current.editable.reconfigure([he.readOnly.of(o),T.editable.of(!o)])})},[o]),(0,P.useEffect)(()=>{c.current.dispatch({effects:u.current.attributes.reconfigure(T.contentAttributes.of({role:`textbox`,"aria-label":i,"aria-multiline":`true`,"aria-describedby":a??``,"aria-invalid":r.length?`true`:`false`,spellcheck:`false`}))})},[i,a,r.length]),(0,P.useEffect)(()=>{let e=c.current;e.dispatch(Le(e.state,xn(e.state.doc,r)))},[t,r]),(0,$.jsx)(`div`,{ref:s,"data-sql-editor":!0})}var wn=[`=`,`!=`,`>`,`>=`,`<`,`<=`],Tn=String.raw`[a-z_][a-z0-9_]*|(?:attributes|resource)\['(?:[^']|'')+'\]`,En=String.raw`'(?:[^']|'')*'|-?\d+(?:\.\d+)?|\$[a-z][a-z0-9_]*`,Dn=new RegExp(String.raw`^(${Tn})\s*(!=|>=|<=|=|>|<)\s*(${En})$`),On=/^-?\d+(?:\.\d+)?$/,kn=/^\$[a-z][a-z0-9_]*$/;function An(e){let t=Dn.exec(e.trim());if(!t)return;let[,n,r,i]=t,a=i.startsWith(`'`);return{field:n,op:r,value:a?i.slice(1,-1).replaceAll(`''`,`'`):i,quoted:a}}function jn(e,t=[]){let n=e.value.trim();if(kn.test(n)&&t.includes(n.slice(1)))return`${e.field} ${e.op} ${n}`;let r=e.quoted||!On.test(n)?`'${e.value.replaceAll(`'`,`''`)}'`:e.value.trim();return`${e.field} ${e.op} ${r}`}var Mn={h:36e5,m:6e4,s:1e3,ms:1,us:.001},Nn=/^(\d+(?:\.\d+)?)\s*(h|m|s|ms|us)$/i,Pn=e=>Number(e.toPrecision(12));function Fn(e){let t=e.trim();if(On.test(t))return Number(t);let n=Nn.exec(t);return n?Pn(Number(n[1])*Mn[n[2].toLowerCase()]):void 0}function In(e){for(let[t,n]of Object.entries(Mn))if(e>=n&&Pn(Pn(e/n)*n)===e)return`${Pn(e/n)}${t}`;return`${e}ms`}var Ln=[`spans`,`logs`,`metrics`],Rn=new Set([`count`,`rate`,`error_rate`,`share`]),zn=new Set([`quantile`]),Bn=new RegExp(String.raw`^([a-z_][a-z0-9_]*)\((|${Tn})\)$`);function Vn(e,t){let n=Bn.exec(e.trim());if(n&&!zn.has(n[1])&&t.includes(n[1])&&Rn.has(n[1])===(n[2]===``))return{fn:n[1],field:n[2]}}var Hn=e=>`${e.fn}(${Rn.has(e.fn)?``:e.field})`,Un=`duration_ms`,Wn=/^\$[a-z][a-z0-9_]*$/;function Gn(e,t){if(e===Un){let e=Fn(t);return e===void 0?void 0:String(e)}return/^-?\d+(?:\.\d+)?$/.test(t)?t:void 0}function Kn(e){let t=new Set,n=new Set,r=new Set([`count`]);for(let i of e.measures??[]){let e=Bn.exec(i.trim());e&&(r.add(e[1]),e[2]&&(e[1]===`count_distinct`?n:t).add(e[2]))}for(let r of e.where??[]){let e=An(r);e&&(e.quoted?n:t).add(e.field)}for(let t of e.by??[])n.add(t);n.add(`service`);let i=e=>({name:e,type:t.has(e)?`number`:`string`});return{signals:{[e.from]:{columns:[...new Set([...t,...n])].map(i)}},sql_relations:{},measures:[...r],buckets:[`auto`,...e.bucket&&e.bucket!==`auto`?[e.bucket]:[]]}}function qn(e,t){let n=e.signals[t],r=(n?.columns??[]).filter(e=>e.type!==`map`&&e.type!==`time`),i=(n?.attributes??[]).map(e=>({name:`${e.scope===`resource`?`resource`:`attributes`}['${e.key.replaceAll(`'`,`''`)}']`,type:e.type}));return[...r,...i]}function Jn({text:e,onRemove:t}){return(0,$.jsx)(r,{variant:`light`,color:`gray`,size:`lg`,tt:`none`,rightSection:(0,$.jsx)(u,{size:`xs`,variant:`subtle`,color:`gray`,"aria-label":`Remove ${e}`,onClick:t,children:(0,$.jsx)(p,{size:10})}),children:(0,$.jsx)(`code`,{children:e})})}function Yn({query:e,schema:t,variables:n=[],labels:r={},onChange:o,onInvalid:s}){let d=qn(t,e.from),m=new Set(d.map(e=>e.name)),ee=new Set(d.filter(e=>e.type===`number`||e.type===`int`||e.type===`float`).map(e=>e.name)),te=d.map(e=>e.name),g=t.measures??[],_=e.where??[],v=e.measures??[],y=e.by??[],ne=t.buckets??[],[b,re]=(0,P.useState)(),x=e=>{re(e),s?.(e!==void 0&&e.condition.value.trim()!==``)},ae=(0,P.useRef)(s);ae.current=s,(0,P.useEffect)(()=>()=>ae.current?.(!1),[]);let[oe,se]=(0,P.useState)(),ce=b!==void 0&&b.condition.value.trim()!==``,le=e=>r[e]??e,[ue,fe]=(0,P.useState)(),S=t=>{fe(void 0),o({...e,...t})},pe=n=>{let r=new Set(qn(t,n).map(e=>e.name)),i=e=>r.has(e)||e.startsWith(`attributes[`)||e.startsWith(`resource[`),a={where:_.filter(e=>{let t=An(e);return!t||i(t.field)}),measures:v.filter(e=>{let t=Vn(e,g);return!t||!t.field||i(t.field)}),by:y.filter(i)},s=[...v.filter(e=>!a.measures.includes(e)),..._.filter(e=>!a.where.includes(e)),...y.filter(e=>!a.by.includes(e))];a.measures.length===0&&v.length>0&&(a.measures=[`count()`]),x(void 0),fe(s.length>0?`Removed what ${n} does not have: ${s.map(le).join(`, `)}.`:void 0),o({...e,from:n,...a})},me=(e,t,n)=>e.map((e,r)=>r===t?n:e),C=(e,t)=>e.filter((e,n)=>n!==t),w=e=>m.has(e)?te:[e,...te];return(0,$.jsxs)(a,{gap:`sm`,"data-builder":!0,children:[(0,$.jsx)(h,{label:`Source`,w:200,allowDeselect:!1,value:e.from,data:[...Ln],onChange:t=>t&&t!==e.from&&pe(t)}),ue&&(0,$.jsx)(c,{size:`xs`,c:`dimmed`,role:`status`,"data-builder-removed":!0,children:ue}),(0,$.jsxs)(a,{gap:6,children:[(0,$.jsx)(c,{size:`sm`,fw:500,children:`Measures`}),v.map((e,n)=>{let r=Vn(e,g);return r?(0,$.jsxs)(i,{gap:`xs`,wrap:`nowrap`,children:[(0,$.jsx)(h,{"aria-label":`Measure ${n+1} function`,w:160,allowDeselect:!1,searchable:!0,value:r.fn,data:(t.measures??[]).filter(e=>!zn.has(e)),onChange:e=>e&&S({measures:me(v,n,Hn({fn:e,field:Rn.has(e)?``:r.field||(ee.values().next().value??``)}))})}),!Rn.has(r.fn)&&(0,$.jsx)(h,{"aria-label":`Measure ${n+1} field`,w:260,searchable:!0,value:r.field||null,data:Xn(r.fn,te,ee,w(r.field)),onChange:e=>e&&S({measures:me(v,n,Hn({...r,field:e}))})}),(0,$.jsx)(u,{variant:`subtle`,color:`gray`,"aria-label":`Remove measure ${n+1}`,onClick:()=>S({measures:C(v,n)}),children:(0,$.jsx)(p,{size:14})})]},n):(0,$.jsx)(i,{children:(0,$.jsx)(Jn,{text:le(e),onRemove:()=>S({measures:C(v,n)})})},n)}),(0,$.jsx)(i,{children:(0,$.jsx)(l,{size:`compact-sm`,variant:`subtle`,leftSection:(0,$.jsx)(de,{size:12}),onClick:()=>S({measures:[...v,`count()`]}),children:`Add measure`})})]}),(0,$.jsxs)(a,{gap:6,children:[(0,$.jsx)(c,{size:`sm`,fw:500,children:`Filters`}),(b?[..._.slice(0,b.at),b.condition,..._.slice(b.at)]:_).map((e,r)=>{let a=b?.at===r,o=b&&r>b.at?r-1:r,s=()=>{b&&o{let t={...c,...e};m.has(t.field)&&(t.quoted=!ee.has(t.field));let r=t.value.trim(),i=Wn.test(r)&&n.includes(r.slice(1)),s=ee.has(t.field)&&!i?Gn(t.field,r):r;if(!s){x({at:o,condition:t}),a||S({where:C(_,o)});return}a&&x(void 0);let l=jn({...t,value:s},n);S({where:a?[..._.slice(0,o),l,..._.slice(o)]:me(_,o,l)})},d=a&&ce?c.field===Un?`Enter a duration such as 100ms or 1.5s`:`Enter a number`:void 0,te=oe?.row===r?oe.text:c.field===Un&&!c.quoted&&Fn(c.value)!==void 0&&!a?In(Number(c.value)):c.value;return(0,$.jsxs)(i,{gap:`xs`,wrap:`nowrap`,align:`flex-start`,children:[(0,$.jsx)(h,{"aria-label":`Filter ${r+1} field`,w:260,searchable:!0,allowDeselect:!1,value:c.field,data:w(c.field),onChange:e=>e&&l({field:e})}),(0,$.jsx)(h,{"aria-label":`Filter ${r+1} operator`,w:90,style:{flexShrink:0},allowDeselect:!1,value:c.op,data:[...wn],onChange:e=>e&&l({op:e})}),c.field===`service`&&t.services?.length?(0,$.jsx)(h,{"aria-label":`Filter ${r+1} value`,w:220,searchable:!0,value:c.value||null,data:[...n.map(e=>`$${e}`),...t.services.map(e=>e.value)],onChange:e=>l({value:e??``})}):(0,$.jsx)(f,{"aria-label":`Filter ${r+1} value`,w:220,placeholder:a?`Value`:void 0,value:te,error:d,onBlur:()=>se(void 0),onChange:e=>{let t=e.currentTarget.value;se({row:r,text:t}),l({value:t})}}),(0,$.jsx)(u,{variant:`subtle`,color:`gray`,"aria-label":`Remove filter ${r+1}`,onClick:()=>a?x(void 0):s(),children:(0,$.jsx)(p,{size:14})})]},r)}),(0,$.jsx)(i,{children:(0,$.jsx)(l,{size:`compact-sm`,variant:`subtle`,leftSection:(0,$.jsx)(de,{size:12}),disabled:b!==void 0,onClick:()=>x({at:_.length,condition:{field:`service`,op:`=`,value:``,quoted:!0}}),children:`Add filter`})})]}),(0,$.jsxs)(i,{gap:`md`,align:`flex-end`,children:[(0,$.jsxs)(a,{gap:6,children:[(0,$.jsx)(c,{size:`sm`,fw:500,children:`Group by`}),(0,$.jsxs)(i,{gap:`xs`,children:[y.map((e,t)=>(0,$.jsx)(Jn,{text:e,onRemove:()=>S({by:C(y,t)})},e)),(0,$.jsx)(h,{"aria-label":`Add group by field`,placeholder:`Add field`,w:220,searchable:!0,value:null,data:te.filter(e=>!y.includes(e)),onChange:e=>e&&S({by:[...y,e]})})]})]}),(0,$.jsx)(h,{label:`Every`,w:170,clearable:!0,placeholder:`No time buckets`,value:e.bucket??null,data:e.bucket&&!ne.includes(e.bucket)?[...ne,e.bucket]:ne,onChange:e=>S({bucket:e??void 0})}),(0,$.jsx)(ie,{label:`Limit`,w:120,min:1,max:1e3,value:e.limit??``,onChange:e=>S({limit:typeof e==`number`?e:void 0})})]})]})}function Xn(e,t,n,r){let i=e===`count_distinct`?t:t.filter(e=>n.has(e));return[...new Set([...r.filter(e=>!t.includes(e)),...i])]}var Zn=`explore`,Qn=420,$n={stat:`Stat`,gauge:`Gauge`,timeseries:`Time series`,bar:`Bar`,table:`Table`,text:`Text`,heatmap:`Heatmap`,histogram:`Histogram`,scatter:`Scatter`,state_timeline:`State timeline`,logs:`Logs`,log_patterns:`Log patterns`,traces:`Traces`,service_map:`Service map`,health:`Health`},er={min_max:`a minimum and maximum`,thresholds:`thresholds`},tr=e=>e===`sql`?`sql`:`query`,nr={from:`spans`,measures:[`count()`],by:[`service`]};function rr(e,t){if(e.from===`logs`)return`logs`;if(e.from===`spans`&&t!==`health`&&t!==`service_map`)return`traces`}function ir(e,t){let n=(e,t)=>(e??[]).flatMap((e,n)=>n0||e.result.frame?.totals!==void 0)}function or({search:e,onSearch:t,onSaved:n,context:r}){let u=r?.spec.variables,f=r?.panel,p=e=>e.requires.every(e=>e===`min_max`?f?.min!==void 0&&f?.max!==void 0:(f?.thresholds?.length??0)>0),h=e=>r?.compose?r.compose(e):e,ie=r?.vars??{},[de,fe]=(0,P.useState)(),[S,pe]=(0,P.useState)(),[me,C]=(0,P.useState)(!1),[w,he]=(0,P.useState)(),[T,ge]=(0,P.useState)(e.q),[E,_e]=(0,P.useState)(e.sql??``),D=(0,P.useRef)({text:e.q,sql:e.sql??``}),ve=T!==D.current.text||E!==D.current.sql,ye=r?.onDirtyChange;(0,P.useEffect)(()=>{ye?.(ve)},[ve,ye]);let be=(0,P.useRef)(null),[O,xe]=(0,P.useState)(),[k,Ce]=(0,P.useState)(r?.initial?.query),[A,Te]=(0,P.useState)(r?.initial?.formatted),[Ee,De]=(0,P.useState)([]),[Oe,ke]=(0,P.useState)(()=>r?.initial?ir(r.initial.query,r.initial.formatted):{}),[je,Me]=(0,P.useState)(!1),j=(0,P.useRef)({}),[M,N]=(0,P.useState)([]),[Le,Re]=(0,P.useState)([]),[ze,Be]=(0,P.useState)(),[Ve,He]=(0,P.useState)(0),[F,Ue]=(0,P.useState)(),[We,Ge]=(0,P.useState)(),[I,Ke]=(0,P.useState)(!1),qe=(0,P.useRef)(void 0),Je=(0,P.useRef)(null),L=(0,P.useId)(),R=le(e),Ye=R.from&&R.to?void 0:R.range,z=(0,P.useRef)(e);z.current=e;let B=(0,P.useRef)({q:e.q,sql:e.sql??``,viz:e.viz}),Xe=e=>{let n=z.current;B.current={q:e.q,sql:e.sql??``,viz:e.viz},t(e,e.q===n.q&&e.sql===n.sql&&(n.viz===void 0||e.viz===n.viz))},V=e=>`${e.range}|${e.from??``}|${e.to??``}`,H=V(e),Ze=(0,P.useRef)(void 0),Qe=e=>{let n=V(ce(se(e)));n!==H&&(Ze.current=n),t(e)},$e=(0,P.useRef)(void 0),U=(0,P.useRef)({text:T,sql:E});U.current={text:T,sql:E};let W=oe({queryKey:[`telemetry-schema`],queryFn:({signal:e})=>b(e),staleTime:6e4,retry:!1,enabled:e.tab!==`query`});(0,P.useEffect)(()=>()=>{qe.current?.abort(),j.current.abort?.abort(),clearTimeout(j.current.timer),$e.current=void 0},[]);let G=async(e,t,n,i)=>{if(!t.trim())return;qe.current?.abort();let a=new AbortController;qe.current=a,Ke(!0),Be(void 0),N([]),Re([]),Ge(void 0);try{let o,s;if(e===`query`&&i)xe(void 0),o=h({id:Zn,title:Ne(t),viz:n??`table`,query:i,drill:rr(i,n??`table`)}),s=t,Xe({...z.current,q:t,viz:o.viz});else if(e===`query`){let e=await Pe({text:t,variables:u,window:Ye},a.signal);if(a.signal.aborted)return;xe({...e,text:t}),U.current.text===t&&Re(e.notices),z.current.tab===`builder`&&Ce(e.query);let r=n&&e.viz.compatible.some(e=>e.viz===n&&p(e))?n:e.viz.compatible.find(p)?.viz??`table`;o=h({id:Zn,title:Ne(e.canonical),viz:r,query:e.query,drill:rr(e.query,r)}),s=e.canonical,Xe({...z.current,q:t,viz:r,...t===z.current.q?{}:{drill:void 0}})}else o=h({id:Zn,title:`SQL`,viz:f?.viz??`table`,sql:t}),Xe({...z.current,sql:t});let c={version:1,name:r?.spec.name??`Explore`,time:R,variables:u,panels:[o]},l=Je.current?.clientWidth||960,d=await re({dashboard:c,panels:[Zn],time:R,vars:ie,widths:{[Zn]:l}},a.signal);if(a.signal.aborted)return;let m=d.find(e=>e.id===Zn);if(!m)throw Error(`The query returned no result.`);if(m.status===`invalid`){Ge({kind:e,source:t,window:H}),U.current[e===`query`?`text`:`sql`]===t&&N(m.problems??[]);return}fe(Date.now()),Ue({kind:e,source:t,window:H,panel:o,result:_(m,[Zn]),canonical:s}),e===`sql`&&m.status===`error`&&!m.retryable&&U.current.sql===t&&N([{path:`sql`,message:m.error??`Query failed`}])}catch(n){if(a.signal.aborted)return;Ge({kind:e,source:t,window:H}),n instanceof ae&&n.problems.length>0?U.current[e===`query`?`text`:`sql`]===t&&N(n.problems):Be(n instanceof Error?n.message:`Request failed`)}finally{qe.current===a&&Ke(!1)}},et=(0,P.useRef)({kind:tr(e.tab),viz:F?.panel.viz??e.viz,direct:void 0});et.current={kind:tr(e.tab),viz:F?.panel.viz??e.viz,direct:A?.editable===!1?k:void 0};let K=(0,P.useRef)(()=>void 0),tt=()=>{clearTimeout(j.current.timer),j.current.timer=void 0,j.current.abort?.abort()},q=async(e,t=!0)=>{tt();let n=new AbortController;j.current.abort=n;try{let r=await we({query:e},n.signal);return n.signal.aborted?void 0:(Te(r),De([]),ke(t=>({...t,...ir(e,r)})),t&&(Re(r.notices),N([]),ge(r.text)),r)}catch(e){if(n.signal.aborted)return;De(e instanceof ae&&e.problems.length>0?e.problems:[{path:`query`,message:e instanceof Error?e.message:`The query could not be printed`}]);return}},nt=e=>{Ce(e),clearTimeout(j.current.timer),j.current.timer=setTimeout(()=>{j.current.timer=void 0,q(e)},250)},rt=async t=>{if(!k)return;let n=await q(k);n&&z.current.tab===`builder`&&G(`query`,n.text,t??F?.panel.viz??e.viz,n.editable?void 0:k)},it=async n=>{if(n!==`builder`){e.tab===`builder`&&k&&j.current.timer&&q(k),t({...e,tab:n});return}let r=()=>{z.current.tab!==n&&t({...z.current,tab:n})};if(A?.editable===!1&&k){r();return}if(O&&O.text===T){Ce(O.query),r(),q(O.query,!1);return}if(!T.trim()){Ce(nr),r(),q(nr,!1);return}try{let e=await Pe({text:T,variables:u,window:Ye});xe({...e,text:T}),Ce(e.query),r(),q(e.query,!1)}catch(e){e instanceof ae&&e.problems.length>0?N(e.problems):Be(e instanceof Error?e.message:`Request failed`)}};K.current=()=>{let{kind:e,viz:t,direct:n}=et.current;z.current.tab===`builder`&&k?rt(t):G(e,U.current[e===`query`?`text`:`sql`],t,n)},(0,P.useEffect)(()=>{let t={q:e.q,sql:e.sql??``,viz:e.viz},n=t.q===B.current.q&&t.sql===B.current.sql&&t.viz===B.current.viz,r=$e.current===void 0,i=$e.current!==H,a=Ze.current===H;if($e.current=H,Ze.current=void 0,n&&(r||i&&a)){K.current();return}if(n&&!i)return;B.current=t,tt(),Te(void 0),N([]),ge(t.q),_e(t.sql);let o=tr(e.tab);G(o,o===`query`?t.q:t.sql,t.viz)},[e.q,e.sql,e.viz,H]),(0,P.useEffect)(()=>{e.tab===`builder`&&it(`builder`)},[]);let J=tr(e.tab),Y=J===`query`?T:E,at=Ve>0&&!T.trim(),X=A?.editable===!1,ot=F!==void 0&&(F.kind!==J||F.source!==Y||F.window!==H),st=O?.viz.compatible??[],ct=r?.panel!==void 0,lt=f!==void 0&&!ve&&(e.viz??f.viz)===f.viz,ut=!ot&&!I&&ar(F,ct),Z=ut||lt,dt=We===void 0?!ot&&F?.result.status===`error`:We.kind===J&&We.source===Y&&We.window===H,ft=I?`Wait for the run to finish`:dt?`The last run failed; saving needs a run that works`:ot?`Run the query as it is now first`:ct?`Run the query first`:`Run a query that returns rows first`,pt=(0,P.useId)(),mt=F!==void 0&&(F.panel.drill!==void 0||F.panel.viz===`service_map`||(F.result.frame?.columns.some(e=>e.name===`trace_id`)??!1));return(0,$.jsxs)(a,{gap:`md`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,maw:1600,mx:`auto`,"data-explore":!0,children:[!r&&(0,$.jsx)(s,{title:`Explore`,description:`Ask a question of your telemetry.`,meta:(0,$.jsx)(x,{time:R,updatedAt:F?de:null})}),(0,$.jsx)(v,{inHeader:!r,time:R,onRange:t=>Qe({...e,range:t,from:void 0,to:void 0}),onAbsolute:(t,n)=>Qe({...e,from:t,to:n})}),(0,$.jsxs)(g,{value:e.tab,onChange:e=>void it(e===`sql`||e===`builder`?e:`query`),keepMounted:!1,children:[(0,$.jsxs)(g.List,{children:[(0,$.jsx)(g.Tab,{value:`query`,children:`Query`}),(0,$.jsx)(g.Tab,{value:`builder`,children:`Builder`}),(0,$.jsx)(g.Tab,{value:`sql`,children:`SQL`})]}),(0,$.jsx)(g.Panel,{value:`query`,pt:`sm`,children:(0,$.jsxs)(a,{gap:`xs`,children:[(0,$.jsxs)(c,{id:L,size:`xs`,c:`dimmed`,children:[`Press Enter to run. For example `,(0,$.jsx)(`code`,{children:`spans | p95(duration) by service every 5m`}),`.`]}),X&&(0,$.jsxs)(c,{size:`xs`,c:`dimmed`,"data-fanql-readonly":!0,children:[`This query is edited in the Builder: `,A?.reason??`it is too large for the text editor`,`.`]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Fe,{value:T,readOnly:X,placeholder:`spans | count() by service`,onChange:(e,t)=>{tt(),ge(e),N(t?.problems??[]),Re(t?.notices??[]),Te(void 0)},onRun:()=>{T.trim()||He(e=>e+1),G(`query`,T,e.viz,X?k:void 0)},problems:M,notices:Le,describedBy:L,complete:(e,t,n)=>Ae({text:e,cursor:t,...R.from&&R.to?{from:R.from,to:R.to}:{window:R.range}},n)}),(0,$.jsx)(c,{size:`xs`,c:`dimmed`,mt:at?4:0,"aria-live":`polite`,"data-fanql-empty":!0,children:at&&(0,$.jsxs)(`span`,{children:[`Type a query to run, for example `,(0,$.jsx)(`code`,{children:`spans | count() by service`}),`.`]},Ve)})]})]})}),(0,$.jsx)(g.Panel,{value:`builder`,pt:`sm`,children:(0,$.jsxs)(a,{gap:`xs`,children:[!k&&(M.length>0||ze)?(0,$.jsx)(o,{"data-builder-blocked":!0,children:(0,$.jsxs)(d,{tone:`danger`,title:`This query cannot open in the Builder`,children:[M.length>0?(0,$.jsx)(a,{gap:2,mb:`xs`,children:M.map((e,t)=>(0,$.jsxs)(c,{size:`sm`,children:[e.message,e.hint?` (${e.hint})`:``]},t))}):(0,$.jsx)(c,{size:`sm`,mb:`xs`,children:ze}),(0,$.jsx)(l,{size:`compact-sm`,variant:`default`,onClick:()=>void it(`query`),children:`Fix it in the Query tab`})]})}):(0,$.jsxs)($.Fragment,{children:[W.error&&(0,$.jsxs)(d,{tone:`warning`,title:`Fields could not be loaded`,children:[k?`Only the fields this query uses are offered until the field list loads. `:``,W.error.message,(0,$.jsx)(l,{size:`compact-xs`,variant:`default`,ml:`xs`,loading:W.isFetching,onClick:()=>void W.refetch(),children:`Retry`})]}),k&&(W.data??W.error)?(0,$.jsx)(Yn,{query:k,schema:W.data??Kn(k),variables:(u??[]).map(e=>e.name),labels:Oe,onChange:nt,onInvalid:Me}):!W.error&&(0,$.jsx)(c,{size:`sm`,c:`dimmed`,children:`Loading fields…`})]}),Ee.length>0&&(0,$.jsx)(a,{gap:2,role:`alert`,"data-builder-problems":!0,children:Ee.map((e,t)=>(0,$.jsxs)(c,{size:`sm`,c:`bad`,children:[e.message,e.hint?` (${e.hint})`:``]},t))}),A&&Ee.length===0&&(0,$.jsxs)(c,{size:`xs`,c:`dimmed`,"data-builder-text":!0,children:[`As FanQL: `,(0,$.jsx)(`code`,{children:A.text})]})]})}),(0,$.jsxs)(g.Panel,{value:`sql`,pt:`sm`,children:[!E.trim()&&(0,$.jsxs)(c,{size:`xs`,c:`dimmed`,mb:`xs`,"data-sql-hint":!0,children:[T.trim()?`SQL runs on its own; the FanQL query is not converted. `:``,`Write one SELECT over spans, logs or metrics that filters time with `,(0,$.jsx)(`code`,{children:`$__window(time_column)`}),`, for example `,(0,$.jsx)(`code`,{children:`SELECT service, count(*) AS spans FROM spans WHERE $__window(start_time) GROUP BY service`}),`.`]}),(0,$.jsx)(Cn,{value:E,onChange:e=>{_e(e),N([])},onRun:()=>void G(`sql`,E),onEscape:()=>be.current?.focus(),schema:W.data,problems:e.tab===`sql`?M:[],label:r?`Panel SQL`:`Explore SQL`}),e.tab===`sql`&&M.length>0&&(0,$.jsx)(d,{tone:`danger`,title:`The SQL has problems`,children:(0,$.jsx)(`ul`,{children:M.map((e,t)=>(0,$.jsxs)(`li`,{className:`sql-problem`,children:[e.message,e.hint?` (${e.hint})`:``]},t))})})]})]}),(0,$.jsxs)(i,{justify:`space-between`,children:[(0,$.jsxs)(i,{gap:`xs`,children:[(0,$.jsx)(l,{ref:be,loading:I,disabled:e.tab===`builder`?!k||Ee.length>0||je:!Y.trim(),onClick:()=>void(e.tab===`builder`?rt(e.viz):G(J,Y,e.viz,X?k:void 0)),children:`Run`}),J===`query`&&st.length>0&&(0,$.jsx)(te,{size:`xs`,"aria-label":`Visualization`,value:F?.panel.viz??e.viz??``,onChange:t=>void(e.tab===`builder`?rt(t):G(`query`,T,t,X?k:void 0)),data:st.map(e=>({value:e.viz,disabled:!p(e),label:p(e)?$n[e.viz]:(0,$.jsx)(ue,{label:`Needs ${e.requires.map(e=>er[e]).join(` and `)}; set them after saving`,children:(0,$.jsx)(`span`,{children:$n[e.viz]})})}))}),J===`query`&&!ot&&!X&&O?.viz.edits.map(e=>(0,$.jsx)(ue,{label:(0,$.jsxs)($.Fragment,{children:[`Rewrites the query as `,(0,$.jsx)(`code`,{children:e.text})]}),multiline:!0,maw:420,children:(0,$.jsxs)(l,{size:`compact-sm`,variant:`subtle`,onClick:()=>{ge(e.text),G(`query`,e.text,e.viz)},children:[$n[e.viz],`…`]})},e.viz))]}),(0,$.jsxs)(i,{gap:`xs`,children:[r?.cancel&&(0,$.jsx)(l,{variant:`default`,disabled:me,onClick:r.cancel,children:`Cancel`}),(0,$.jsx)(ue,{label:ft,disabled:Z,events:{hover:!0,focus:!0,touch:!0},children:r?(0,$.jsx)(l,{"data-disabled":!Z||void 0,"aria-disabled":!Z,"aria-describedby":Z?void 0:pt,loading:me,onClick:()=>{let e=ut?F?.panel:f;e&&Z&&(C(!0),pe(void 0),r.save.run(e).catch(e=>pe(e instanceof Error?e.message:`Save failed`)).finally(()=>C(!1)))},children:r.save.label}):(0,$.jsx)(l,{variant:`default`,"data-disabled":!Z||void 0,"aria-disabled":!Z,"aria-describedby":Z?void 0:pt,onClick:()=>F&&Z&&he(F.panel),children:`Save to dashboard`})}),!Z&&(0,$.jsx)(`span`,{id:pt,hidden:!0,children:ft})]})]}),ze&&(0,$.jsx)(d,{tone:`danger`,title:`The query could not run`,children:ze}),S&&(0,$.jsx)(d,{tone:`danger`,title:`Not saved`,children:S}),(0,$.jsx)(o,{ref:Je,children:F?(0,$.jsxs)(a,{gap:`xs`,children:[(0,$.jsx)(c,{size:`sm`,fw:600,role:`status`,children:I?`Running the query…`:F.kind===J?F.source===Y?F.window===H?F.canonical?(0,$.jsxs)($.Fragment,{children:[`Ran as `,(0,$.jsx)(`code`,{children:F.canonical})]}):`Result`:`Result of the last run · time range has changed`:`Result of the last run · query has changed`:`Result of the last ${F.kind===`sql`?`SQL`:`FanQL`} run`}),(0,$.jsx)(o,{h:Qn,children:(0,$.jsx)(m,{panel:F.panel,title:F.panel.title,result:F.result,loading:I,height:Qn,group:`explore`,editing:!1,agentAvailable:!1,range:R.range,onRetry:()=>void G(F.kind,F.source,F.panel.viz,X?k:void 0),traceLinks:`button`,onPoint:mt?n=>{let r=ee(F.panel,F.result,n,ie);r&&t({...e,drill:JSON.stringify(r.target)})}:void 0})})]}):I?(0,$.jsx)(c,{c:`dimmed`,size:`sm`,role:`status`,"data-explore-running":!0,children:`Running the query…`}):(0,$.jsx)(c,{c:`dimmed`,size:`sm`,"data-explore-empty":!0,children:e.tab===`builder`?`Build a query above and press Run.`:e.tab===`sql`?`Write a query above and press Run.`:`Type a query above and press Enter.`})}),F&&(0,$.jsx)(y,{client:Se,spec:{version:1,name:r?.spec.name??`Explore`,time:R,variables:u,panels:[F.panel]},time:R,vars:ie,target:ne(e.drill),onChange:n=>t({...e,drill:n?JSON.stringify(n):void 0})}),w&&n&&(0,$.jsx)(Ie,{panel:w,time:R,onClose:()=>he(void 0),onSaved:n})]})}export{or as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/page-DZ5HGDWI.js b/internal/ui/dist/assets/page-BABqeqdg.js similarity index 98% rename from internal/ui/dist/assets/page-DZ5HGDWI.js rename to internal/ui/dist/assets/page-BABqeqdg.js index 16dca137a..537585c60 100644 --- a/internal/ui/dist/assets/page-DZ5HGDWI.js +++ b/internal/ui/dist/assets/page-BABqeqdg.js @@ -1,6 +1,6 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/panel-editor-DZGJDQzo.js","assets/useRouter-ByJ6_rwb.js","assets/brand-CCQ0JT0F.js","assets/search-DBgztReF.js","assets/noop-mXPS5vjY.js","assets/format-fsvZ_y78.js","assets/auth-K3NK-QpB.js","assets/useNavigate-B1zgPEUp.js","assets/useQuery-BLTYSIvG.js","assets/save-dialog-EDUaI5f8.js","assets/toolbar-DV2TSB0G.js","assets/theme-B_iWg-Ot.js","assets/CopyButton-Btk7J2NS.js","assets/Table-Bid0E8qM.js","assets/live-data-meta-CbLSAtC3.js","assets/lib-8mi5olAL.js","assets/index-C5SsAUtw.js","assets/preload-helper-DJZNfKNH.js","assets/lazyRouteComponent-DfXsrbdH.js","assets/search-Bj_SOIkw.js","assets/index-CzwgFH1g.css","assets/loading-skeleton-DEzWruJF.js","assets/page-DI98kZbw.js","assets/NumberInput-B7uemOf3.js","assets/discard-BmoNOAJh.js","assets/new-dashboard-xnHgERfr.js"])))=>i.map(i=>d[i]); -import{a as e,i as t,r as n,s as r}from"./useRouter-ByJ6_rwb.js";import{$ as i,Cn as a,Ct as o,D as s,Dt as c,E as l,F as u,Ft as d,G as f,K as p,M as m,N as h,Nt as g,O as _,Ot as v,Pt as y,S as b,T as x,Tt as S,Xt as C,Zt as w,a as T,bn as E,dn as D,en as ee,et as O,f as k,g as A,gn as j,in as M,j as N,jt as P,k as F,nn as I,nt as L,pn as R,q as te,r as ne,s as re,tt as ie,w as z}from"./brand-CCQ0JT0F.js";import{t as ae}from"./preload-helper-DJZNfKNH.js";import{c as oe}from"./theme-B_iWg-Ot.js";import{_ as se,a as ce,c as B,h as le,i as V,l as ue,n as de,o as fe,r as H,s as U,u as pe,v as W,y as G}from"./toolbar-DV2TSB0G.js";import{C as K,D as q,N as J,O as me,S as he,T as Y,_ as ge,b as _e,d as ve,f as ye,h as be,n as xe,p as Se,v as Ce,w as we,x as Te,y as Ee}from"./search-DBgztReF.js";import{n as De}from"./format-fsvZ_y78.js";import{a as Oe,c as ke,i as Ae,l as je,n as Me,o as Ne,r as Pe,s as Fe,t as Ie}from"./live-data-meta-CbLSAtC3.js";import{c as Le,r as Re,s as ze}from"./auth-K3NK-QpB.js";import{T as Be,t as Ve}from"./useQuery-BLTYSIvG.js";import{t as He}from"./useMutation-rZS3GfBb.js";import{S as Ue,ct as We,g as Ge,lt as Ke,x as qe}from"./index-C5SsAUtw.js";import{t as Je}from"./loading-skeleton-DEzWruJF.js";import{t as Ye}from"./dashboard-change-chips-DMsA4yET.js";var[Xe,Ze]=j(`Accordion component was not found in the tree`),[Qe,$e]=j(`Accordion.Item component was not found in the tree`),et={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`},X=n(),tt=c(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,chevron:o,icon:s,onClick:c,onKeyDown:l,children:u,disabled:f,mod:p,...m}=d(`AccordionControl`,null,e),{value:h}=$e(),g=Ze(),_=g.isItemActive(h),v=typeof g.order==`number`,y=`h${g.order}`,b=(0,X.jsxs)(ie,{...g.getStyles(`control`,{className:n,classNames:t,style:r,styles:i,variant:g.variant}),unstyled:g.unstyled,mod:[`accordion-control`,{active:_,"chevron-position":g.chevronPosition,disabled:f},p],onClick:e=>{c?.(e),g.onChange(h)},type:`button`,disabled:f,"aria-expanded":_,"aria-controls":g.getRegionId(h),id:g.getControlId(h),onKeyDown:J({siblingSelector:`[data-accordion-control]`,parentSelector:`[data-accordion]`,activateOnFocus:!1,loop:g.loop,orientation:`vertical`,onKeyDown:l}),...m,children:[(0,X.jsx)(S,{component:`span`,mod:{rotate:!g.disableChevronRotation&&_,position:g.chevronPosition},...g.getStyles(`chevron`,{classNames:t,styles:i}),children:o||g.chevron}),(0,X.jsx)(`span`,{...g.getStyles(`label`,{classNames:t,styles:i}),children:u}),s&&(0,X.jsx)(S,{component:`span`,mod:{"chevron-position":g.chevronPosition},...g.getStyles(`icon`,{classNames:t,styles:i}),children:s})]});return v?(0,X.jsx)(y,{...g.getStyles(`itemTitle`,{classNames:t,styles:i}),children:b}):b});tt.displayName=`@mantine/core/AccordionControl`,tt.classes=et;var nt=c(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,value:o,mod:s,...c}=d(`AccordionItem`,null,e),l=Ze();return(0,X.jsx)(Qe,{value:{value:o},children:(0,X.jsx)(S,{mod:[{active:l.isItemActive(o)},s],...l.getStyles(`item`,{className:n,classNames:t,styles:i,style:r,variant:l.variant}),...c})})});nt.displayName=`@mantine/core/AccordionItem`,nt.classes=et;var rt=c(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:s,keepMounted:c,keepMountedMode:l,...u}=d(`AccordionPanel`,null,e),{value:f}=$e(),p=Ze();return(0,X.jsx)(o,{...p.getStyles(`panel`,{className:n,classNames:t,style:r,styles:i}),expanded:p.isItemActive(f),transitionDuration:p.transitionDuration??200,role:`region`,id:p.getRegionId(f),"aria-labelledby":p.getControlId(f),keepMounted:c??p.keepMounted,keepMountedMode:l??p.keepMountedMode,...u,children:(0,X.jsx)(`div`,{...p.getStyles(`content`,{classNames:t,styles:i}),children:s})})});rt.displayName=`@mantine/core/AccordionPanel`,rt.classes=et;var it={multiple:!1,loop:!0,disableChevronRotation:!1,disableCollapse:!1,chevronPosition:`right`,variant:`default`,chevronSize:`auto`,chevronIconSize:16,keepMountedMode:`activity`},at=w((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:E(n),"--accordion-radius":r===void 0?void 0:D(r)}})),ot=v(e=>{let t=d(`Accordion`,it,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,children:c,multiple:l,value:u,defaultValue:f,onChange:p,id:h,loop:_,transitionDuration:v,disableChevronRotation:y,disableCollapse:b,chevronPosition:x,chevronSize:C,order:w,chevron:T,variant:E,radius:D,chevronIconSize:O,attributes:k,keepMounted:A,keepMountedMode:j,...N}=t,P=M(h),[F,I]=ee({value:u,defaultValue:f,finalValue:l?[]:null,onChange:p}),L=e=>Array.isArray(F)?F.includes(e):e===F,R=e=>{if(!Array.isArray(F)&&b&&e===F)return;let t=Array.isArray(F)?F.includes(e)?F.filter(t=>t!==e):[...F,e]:e===F?null:e;I(t)},te=g({name:`Accordion`,classes:et,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:k,vars:s,varsResolver:at});return(0,X.jsx)(Xe,{value:{isItemActive:L,onChange:R,getControlId:G(`${P}-control`,`Accordion.Item component was rendered with invalid value or without value`),getRegionId:G(`${P}-panel`,`Accordion.Item component was rendered with invalid value or without value`),chevron:T===null?null:T||(0,X.jsx)(m,{size:O}),transitionDuration:v,disableChevronRotation:y,chevronPosition:x,order:w,loop:_,getStyles:te,variant:E,unstyled:o,keepMounted:A,keepMountedMode:j},children:(0,X.jsx)(S,{...te(`root`),id:P,...N,variant:E,"data-accordion":!0,children:c})})});ot.classes=et,ot.varsResolver=at,ot.displayName=`@mantine/core/Accordion`,ot.Item=nt,ot.Panel=rt,ot.Control=tt,ot.Chevron=m;function st(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},lt=(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,lt(o.current,e.expectedValue)&&e.container?.querySelector(`[data-mantine-pill-index="${e.index}"]`)?.focus())});let s=(0,Z.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=st(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=st(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){ct(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())}}}var Q=(0,Z.createContext)(null),dt={root:`m_7cda1cd6`,"root--default":`m_44da308b`,"root--contrast":`m_e3a01f8`,label:`m_1e0e6180`,remove:`m_ae386778`,group:`m_1dcfd90b`},ft=(0,Z.createContext)(null),pt=w((e,{gap:t},{size:n})=>({group:{"--pg-gap":t===void 0?R(n,`pg-gap`):R(t)}})),mt=c(e=>{let t=d(`PillGroup`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,size:c,disabled:l,attributes:u,...f}=t,p=(0,Z.use)(Q)?.size||c||void 0,m=g({name:`PillGroup`,classes:dt,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:u,vars:s,varsResolver:pt,stylesCtx:{size:p},rootSelector:`group`});return(0,X.jsx)(ft,{value:{size:p,disabled:l},children:(0,X.jsx)(S,{size:p,...m(`group`),...f})})});mt.classes=dt,mt.varsResolver=pt,mt.displayName=`@mantine/core/PillGroup`;var ht={variant:`default`},gt=w((e,{radius:t},{size:n})=>({root:{"--pill-fz":R(n,`pill-fz`),"--pill-height":R(n,`pill-height`),"--pill-radius":t===void 0?void 0:D(t)}})),_t=c(e=>{let t=d(`Pill`,ht,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,variant:c,children:l,withRemoveButton:u,onRemove:f,removeButtonProps:m,radius:h,size:_,disabled:v,mod:y,attributes:b,...x}=t,C=(0,Z.use)(ft),w=(0,Z.use)(Q),T=_||C?.size||void 0,E=w?.variant===`filled`?`contrast`:c||`default`,D=g({name:`Pill`,classes:dt,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:b,vars:s,varsResolver:gt,stylesCtx:{size:T}});return(0,X.jsxs)(S,{component:`span`,variant:E,size:T,...D(`root`,{variant:E}),mod:[{"with-remove":u&&!v,disabled:v||C?.disabled},y],...x,children:[(0,X.jsx)(`span`,{...D(`label`),children:l}),u&&(0,X.jsx)(p,{variant:`transparent`,radius:h,tabIndex:-1,"aria-hidden":!0,unstyled:o,...m,...D(`remove`,{className:m?.className,style:m?.style}),onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),m?.onMouseDown?.(e)},onClick:e=>{e.stopPropagation(),f?.(),m?.onClick?.(e)}})]})});_t.classes=dt,_t.varsResolver=gt,_t.displayName=`@mantine/core/Pill`,_t.Group=mt;var vt={field:`m_45c4369d`},yt={type:`visible`},bt=c(e=>{let t=d(`PillsInputField`,yt,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,type:c,disabled:l,id:f,pointer:p,mod:m,attributes:h,ref:_,...v}=t,y=(0,Z.use)(Q),b=(0,Z.use)(u),x=g({name:`PillsInputField`,classes:vt,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:h,rootSelector:`field`}),C=l||y?.disabled;return(0,X.jsx)(S,{component:`input`,ref:I(_,y?.fieldRef),"data-type":c,disabled:C,mod:[{disabled:C,pointer:p},m],...x(`field`),...v,id:b?.inputId||f,"aria-invalid":y?.hasError,"aria-describedby":b?.describedBy,type:`text`,onMouseDown:e=>!p&&e.stopPropagation()})});bt.classes=vt,bt.displayName=`@mantine/core/PillsInputField`;var xt={size:`sm`},St=c(e=>{let{children:t,onMouseDown:n,onClick:r,size:i,disabled:a,__staticSelector:o,error:s,variant:c,...l}=d([`Input`,`InputWrapper`,`PillsInput`],xt,e),u=(0,Z.useRef)(null);return(0,X.jsx)(Q,{value:{fieldRef:u,size:i,disabled:a,hasError:!!s,variant:c},children:(0,X.jsx)(h,{size:i,error:s,variant:c,component:`div`,"data-no-overflow":!0,onMouseDown:e=>{e.preventDefault(),n?.(e),u.current?.focus()},onClick:e=>{e.preventDefault(),e.currentTarget.closest(`fieldset`)?.disabled||(u.current?.focus(),r?.(e))},...l,multiline:!0,disabled:a,__staticSelector:o||`PillsInput`,withAria:!1,children:t})})});St.displayName=`@mantine/core/PillsInput`,St.classes=h.classes,St.Field=bt;function Ct(e){return typeof e==`string`?e.trim().toLowerCase():e}function wt({data:e,value:t}){let n=t.map(Ct);return e.reduce((e,t)=>(Oe(t)?e.push({group:t.group,items:t.items.filter(e=>n.indexOf(Ct(e.value))===-1)}):n.indexOf(Ct(t.value))===-1&&e.push(t),e),[])}var Tt={xs:41,sm:50,md:60,lg:72,xl:89},Et={maxValues:1/0,withCheckIcon:!0,checkIconPosition:`left`,hiddenInputValuesDivider:`,`,clearSearchOnChange:!0,openOnFocus:!0,size:`sm`},Dt=v(e=>{let t=d([`Input`,`InputWrapper`,`MultiSelect`],Et,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,size:c,value:l,defaultValue:u,onChange:f,onKeyDown:p,variant:m,data:h,dropdownOpened:_,defaultDropdownOpened:v,onDropdownOpen:b,onDropdownClose:x,selectFirstOptionOnChange:S,selectFirstOptionOnDropdownOpen:C,onOptionSubmit:w,comboboxProps:T,filter:E,limit:D,withScrollArea:O,maxDropdownHeight:k,floatingHeight:A,searchValue:j,defaultSearchValue:N,onSearchChange:F,readOnly:I,disabled:L,onFocus:R,onBlur:te,radius:ne,rightSection:re,rightSectionWidth:ie,rightSectionPointerEvents:z,rightSectionProps:ae,leftSection:oe,leftSectionWidth:ce,leftSectionPointerEvents:B,leftSectionProps:le,inputContainer:V,inputWrapperOrder:ue,withAsterisk:de,labelProps:fe,descriptionProps:H,errorProps:U,successProps:pe,wrapperProps:G,description:K,label:q,error:J,success:me,maxValues:he,searchable:Y,nothingFoundMessage:ge,withCheckIcon:_e,withAlignedLabels:ve,checkIconPosition:ye,hidePickedOptions:be,withErrorStyles:xe,withSuccessStyles:Se,name:Ce,form:we,id:Te,clearable:Ee,clearSectionMode:De,clearButtonProps:Oe,hiddenInputProps:Me,placeholder:Ie,hiddenInputValuesDivider:Le,required:Re,mod:ze,renderOption:Be,renderPill:Ve,onRemove:He,onClear:Ue,onMaxValues:We,scrollAreaProps:Ge,chevronColor:Ke,attributes:qe,clearSearchOnChange:Je,openOnFocus:Ye,loading:Xe,loadingPosition:Ze,withPillsReorder:Qe,...$e}=t,et=M(Te),tt=Pe({id:et,label:q,labelProps:fe,inputWrapperOrder:ue}),nt=je(h),rt=ke(nt),it=(0,Z.useRef)({}),at=Fe({opened:_,defaultOpened:v,onDropdownOpen:()=>{b?.(),C&&at.selectFirstOption()},onDropdownClose:()=>{x?.(),at.resetSelectedOption()}}),{styleProps:ot,rest:{type:st,autoComplete:ct,...lt}}=P($e),[Q,dt]=ee({value:l,defaultValue:u,finalValue:[],onChange:f}),{getPillProps:ft,getListProps:pt,handleInputKeyDown:mt}=ut({value:Q,onChange:dt,enabled:Qe&&!L&&!I}),[ht,gt]=ee({value:j,defaultValue:N,finalValue:``,onChange:F}),vt=e=>{gt(e),at.resetSelectedOption()},yt=g({name:`MultiSelect`,classes:{},props:t,classNames:n,styles:a,unstyled:o,attributes:qe}),{resolvedClassNames:bt,resolvedStyles:xt}=y({props:t,styles:a,classNames:n}),Ct=e=>{p?.(e),!e.defaultPrevented&&(e.key===` `&&!Y&&(e.preventDefault(),at.toggleDropdown()),e.key===`Backspace`&&ht.length===0&&Q.length>0&&!I&&(He?.(Q[Q.length-1]),dt(Q.slice(0,Q.length-1))),mt(e))},Dt=Q.map((e,t)=>{let n=rt[`${e}`]||it.current[`${e}`],r=ft(t);return Ve?(0,X.jsx)(Z.Fragment,{children:Ve({option:n,value:e,onRemove:()=>{dt(Q.filter(t=>e!==t)),He?.(e)},disabled:L,reorderProps:r})},`${e}-${t}`):(0,X.jsx)(_t,{withRemoveButton:!I&&!rt[`${e}`]?.disabled,onRemove:()=>{dt(Q.filter(t=>e!==t)),He?.(e)},unstyled:o,disabled:L,...yt(`pill`),...r,children:n?.label||e},`${e}-${t}`)});(0,Z.useEffect)(()=>{S&&at.selectFirstOption()},[S,ht]),(0,Z.useEffect)(()=>{Q.forEach(e=>{`${e}`in rt&&(it.current[`${e}`]=rt[`${e}`])})},[rt,Q]);let Ot=(0,X.jsx)(Ne.ClearButton,{...Oe,onClear:()=>{Ue?.(),dt([]),vt(``)}}),kt=wt({data:nt,value:Q}),At=Ee&&Q.length>0&&!L&&!I,jt=At?{paddingInlineEnd:Tt[c]??Tt.sm}:void 0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Ne,{store:at,classNames:bt,styles:xt,unstyled:o,size:c,readOnly:I,__staticSelector:`MultiSelect`,attributes:qe,floatingHeight:A,onOptionSubmit:e=>{w?.(e),Je&&vt(``),at.updateSelectedOptionIndex(`selected`),Q.includes(rt[`${e}`].value)?(dt(Q.filter(t=>t!==rt[`${e}`].value)),He?.(rt[`${e}`].value)):Q.lengthY?at.openDropdown():at.toggleDropdown(),"data-expanded":at.dropdownOpened||void 0,id:et,required:Re,mod:ze,attributes:qe,children:(0,X.jsxs)(_t.Group,{attributes:qe,disabled:L,unstyled:o,...yt(`pillsList`,{style:jt}),...pt(),children:[Dt,(0,X.jsx)(Ne.EventsTarget,{autoComplete:ct,withExpandedAttribute:!0,children:(0,X.jsx)(St.Field,{...lt,id:et,placeholder:Ie,type:!Y&&!Ie?`hidden`:`visible`,...yt(`inputField`),unstyled:o,onFocus:e=>{R?.(e),Ye&&Y&&at.openDropdown()},onBlur:e=>{te?.(e),at.closeDropdown(),vt(``)},onKeyDown:Ct,value:ht,onChange:e=>{if(W(e)){if(!I){let t=se(rt,e.currentTarget.value);t&&!Q.includes(t.value)&&Q.lengthe*40+(e-1)*12,jt={s:3,m:6,l:10},Mt={stat:4},Nt=e=>Math.max(Mt[e.viz]??0,jt[e.height??(e.viz===`service_map`?`l`:e.viz===`stat`?`s`:`m`)]);function Pt(){return(0,X.jsxs)(x,{gap:`md`,"data-dashboard-skeleton":!0,children:[(0,X.jsxs)(x,{gap:`sm`,"data-dashboard-header-skeleton":!0,children:[(0,X.jsxs)(f,{justify:`space-between`,children:[(0,X.jsx)(l,{height:28,width:`32%`}),(0,X.jsx)(l,{height:28,width:28})]}),(0,X.jsx)(l,{height:12,width:`52%`}),(0,X.jsxs)(f,{justify:`space-between`,children:[(0,X.jsx)(l,{height:32,width:180}),(0,X.jsx)(l,{height:32,width:120})]})]}),(0,X.jsx)(S,{style:{containerType:`inline-size`},children:(0,X.jsx)(S,{className:`dashboard-loading-grid`,style:{display:`grid`,gridTemplateColumns:`repeat(12, minmax(0, 1fr))`,gap:12},children:[`stat`,`stat`,`stat`,`timeseries`,`table`].map((e,t)=>(0,X.jsxs)(i,{withBorder:!0,p:`md`,className:`dashboard-loading-panel`,"data-skeleton-columns":e===`stat`?4:6,style:{display:`flex`,flexDirection:`column`,minHeight:At(e===`stat`?4:6)},children:[(0,X.jsx)(l,{height:14,width:`44%`,mb:`xl`}),(0,X.jsx)(Je,{viz:e,rows:4})]},t))})})]})}function Ft(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function It(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function Lt(e,t,n,r,i,a,o){let{margin:s,containerPadding:c,rowHeight:l}=e,u=Ft(e),d,f,p,m;if(o?(d=Math.round(o.width),f=Math.round(o.height)):(d=It(r,u,s[0]),f=It(i,l,s[1])),a?(p=Math.round(a.top),m=Math.round(a.left)):o?(p=Math.round(o.top),m=Math.round(o.left)):(p=Math.round((l+s[1])*n+c[1]),m=Math.round((u+s[0])*t+c[0])),!a&&!o){if(Number.isFinite(r)){let e=Math.round((u+s[0])*(t+r)+c[0])-m-d;e!==s[0]&&(d+=e-s[0])}if(Number.isFinite(i)){let e=Math.round((l+s[1])*(n+i)+c[1])-p-f;e!==s[1]&&(f+=e-s[1])}}return{top:p,left:m,width:d,height:f}}function Rt(e,t,n,r,i){let{margin:a,containerPadding:o,cols:s,rowHeight:c,maxRows:l}=e,u=Ft(e),d=Math.round((n-o[0])/(u+a[0])),f=Math.round((t-o[1])/(c+a[1]));return d=Vt(d,0,s-r),f=Vt(f,0,l-i),{x:d,y:f}}function zt(e,t,n){let{margin:r,containerPadding:i,rowHeight:a}=e,o=Ft(e);return{x:Math.round((n-i[0])/(o+r[0])),y:Math.round((t-i[1])/(a+r[1]))}}function Bt(e,t,n){let{margin:r,rowHeight:i}=e,a=Ft(e);return{w:Math.max(1,Math.round((t+r[0])/(a+r[0]))),h:Math.max(1,Math.round((n+r[1])/(i+r[1])))}}function Vt(e,t,n){return Math.max(Math.min(e,n),t)}function Ht(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function Ut(e,t){for(let n=0;nHt(e,t))}function Gt(e,t){return t===`horizontal`?qt(e):t===`vertical`||t===`wrap`?Kt(e):[...e]}function Kt(e){return[...e].sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y)}function qt(e){return[...e].sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x)}function Jt(e){let t=0;for(let n=0;nt&&(t=e)}}return t}function Yt(e,t){for(let n=0;ne.static===!0)}function Zt(e){return{i:e.i,x:e.x,y:e.y,w:e.w,h:e.h,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,constraints:e.constraints,isBounded:e.isBounded}}function Qt(e){let t=Array(e.length);for(let n=0;nt.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),i.y===1/0&&(i.y=Jt(n)),!i.static)n.push(i);else for(;Ut(n,i);)i.y++}}return e}function nn(e,t,n,r,i,a,o,s,c){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return[...e];let l=t.x,u=t.y;typeof n==`number`&&(t.x=n),typeof r==`number`&&(t.y=r),t.moved=!0;let d=Gt(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(d=d.reverse());let f=Wt(d,t),p=f.length>0;if(p&&c)return Qt(e);if(p&&a)return t.x=l,t.y=u,t.moved=!1,e;let m=[...e];for(let e=0;et.y,d=l!==void 0&&t.x+t.w>l.x;if(!l)return nn(e,n,o?a.x:void 0,s?a.y:void 0,r,c,i);if(u&&s)return nn(e,n,void 0,n.y+1,r,c,i);if(u&&i===null){let r=n.y;return t.y=r,n.y=r+t.h,[...e]}if(d&&o)return nn(e,t,n.x,void 0,r,c,i)}let l=o?n.x+1:void 0,u=s?n.y+1:void 0;return l===void 0&&u===void 0?[...e]:nn(e,n,l,u,r,c,i)}function an(e,t,n){return Math.max(t,Math.min(n,e))}var on=[{name:`gridBounds`,constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:an(t,0,Math.max(0,r-e.w)),y:an(n,0,Math.max(0,i-e.h))}},constrainSize(e,t,n,r,{cols:i,maxRows:a}){let o=r===`w`||r===`nw`||r===`sw`?e.x+e.w:i-e.x,s=r===`n`||r===`nw`||r===`ne`?e.y+e.h:a-e.y;return{w:an(t,1,Math.max(1,o)),h:an(n,1,Math.max(1,s))}}},{name:`minMaxSize`,constrainSize(e,t,n){return{w:an(t,e.minW??1,e.maxW??1/0),h:an(n,e.minH??1,e.maxH??1/0)}}}];function sn(e,t,n,r,i){let a={x:n,y:r};for(let n of e)n.constrainPosition&&(a=n.constrainPosition(t,a.x,a.y,i));if(t.constraints)for(let e of t.constraints)e.constrainPosition&&(a=e.constrainPosition(t,a.x,a.y,i));return a}function cn(e,t,n,r,i,a){let o={w:n,h:r};for(let n of e)n.constrainSize&&(o=n.constrainSize(t,o.w,o.h,i,a));if(t.constraints)for(let e of t.constraints)e.constrainSize&&(o=e.constrainSize(t,o.w,o.h,i,a));return o}function ln({top:e,left:t,width:n,height:r}){let i=`translate(${t}px,${e}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${n}px`,height:`${r}px`,position:`absolute`}}function un({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:`absolute`}}function dn(e){return e*100+`%`}function fn(e,t,n,r){return e+n>r?t:n}function pn(e,t,n){return e<0?t:n}function mn(e){return Math.max(0,e)}function hn(e){return Math.max(0,e)}var gn=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:pn(o,e.height,i),top:hn(o)}},_n=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:fn(e.left,e.width,o,n),left:mn(i)}},vn=(e,t,n)=>{let{top:r,height:i,width:a}=t,o=e.left+e.width-a;return o<0?{height:i,width:e.left+e.width,top:hn(r),left:0}:{height:i,width:a,top:hn(r),left:o}},yn=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:pn(r,e.height,a),top:hn(r)}},bn={n:gn,ne:(e,t,n)=>gn(e,_n(e,t,n)),e:_n,se:(e,t,n)=>yn(e,_n(e,t,n)),s:yn,sw:(e,t,n)=>yn(e,vn(e,t)),w:vn,nw:(e,t,n)=>gn(e,vn(e,t))};function xn(e,t,n,r){let i=bn[e];return i?i(t,{...t,...n},r):n}var Sn={type:`transform`,scale:1,calcStyle(e){return ln(e)}},Cn={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},wn={enabled:!0,bounded:!1,threshold:3},Tn={enabled:!0,handles:[`se`]},En={enabled:!1,defaultItem:{w:1,h:1},touchEnabled:!0,touchDragSource:`[data-rgl-draggable]`};function Dn(e,t,n,r,i){let a=r===`x`?`w`:`h`;t[r]+=1;let o=e.findIndex(e=>e.i===t.i),s=i??Xt(e).length>0;for(let i=o+1;it.y+t.h)break;Ht(t,o)&&Dn(e,o,n+t[a],r,s)}}t[r]=n}function On(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0),t.y=Math.min(r,t.y);t.y>0&&!Ut(e,t);)t.y--;let i;for(;(i=Ut(e,t))!==void 0;)Dn(n,t,i.y+i.h,`y`);return t.y=Math.max(t.y,0),t}function kn(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!Ut(e,t);)t.x--;let i;for(;(i=Ut(e,t))!==void 0;)if(Dn(r,t,i.x+i.w,`x`),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!Ut(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var An={type:`vertical`,allowOverlap:!1,compact(e,t){let n=Xt(e),r=Jt(n),i=Kt(e),a=Array(e.length);for(let t=0;te[t]-e[n])}function Rn(e,t){let n=Ln(e),r=n[0];if(r===void 0)throw Error(`No breakpoints defined`);for(let i=1;ie[a]&&(r=a)}return r}function zn(e,t){let n=t[e];if(n===void 0)throw Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function Bn(e,t,n,r,i,a){let o=e[n];if(o)return Qt(o);let s=e[r],c=Ln(t),l=c.slice(c.indexOf(n));for(let t=0;t{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n[`fast-equals`]={}))})(e,(function(e){function t(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function n(e){return function(t,n,r,i){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r,i);var a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);var s=e(t,n,r,i);return i.delete(t),i.delete(n),s}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function i(e){return e.constructor===Object||e.constructor==null}function a(e){return typeof e.then==`function`}function o(e,t){return e===t||e!==e&&t!==t}var s=Object.prototype.toString;function c(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,c=e.areObjectsEqual,l=e.areRegExpsEqual,u=e.areSetsEqual,d=e.createIsNestedEqual,f=d(p);function p(e,d,p){if(e===d)return!0;if(!e||!d||typeof e!=`object`||typeof d!=`object`)return e!==e&&d!==d;if(i(e)&&i(d))return c(e,d,f,p);var m=Array.isArray(e),h=Array.isArray(d);if(m||h)return m===h&&t(e,d,f,p);var g=s.call(e);return g===s.call(d)?g===`[object Date]`?n(e,d,f,p):g===`[object RegExp]`?l(e,d,f,p):g===`[object Map]`?r(e,d,f,p):g===`[object Set]`?u(e,d,f,p):g===`[object Object]`||g===`[object Arguments]`?a(e)||a(d)?!1:c(e,d,f,p):g===`[object Boolean]`||g===`[object Number]`||g===`[object String]`?o(e.valueOf(),d.valueOf()):!1:!1}return p}function l(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-->0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var u=n(l);function d(e,t){return o(e.valueOf(),t.valueOf())}function f(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={},o=0;return e.forEach(function(s,c){if(i){var l=!1,u=0;t.forEach(function(i,d){!l&&!a[u]&&(l=n(c,d,o,u,e,t,r)&&n(s,i,c,d,e,t,r))&&(a[u]=!0),u++}),o++,i=l}}),i}var p=n(f),m=`_owner`,h=Object.prototype.hasOwnProperty;function g(e,t,n,r){var i=Object.keys(e),a=i.length;if(Object.keys(t).length!==a)return!1;for(var o;a-->0;){if(o=i[a],o===m){var s=!!e.$$typeof,c=!!t.$$typeof;if((s||c)&&s!==c)return!1}if(!h.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var _=n(g);function v(e,t){return e.source===t.source&&e.flags===t.flags}function y(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={};return e.forEach(function(o,s){if(i){var c=!1,l=0;t.forEach(function(i,u){!c&&!a[l]&&(c=n(o,i,s,u,e,t,r))&&(a[l]=!0),l++}),i=c}}),i}var b=n(y),x=Object.freeze({areArraysEqual:l,areDatesEqual:d,areMapsEqual:f,areObjectsEqual:g,areRegExpsEqual:v,areSetsEqual:y,createIsNestedEqual:t}),S=Object.freeze({areArraysEqual:u,areDatesEqual:d,areMapsEqual:p,areObjectsEqual:_,areRegExpsEqual:v,areSetsEqual:b,createIsNestedEqual:t}),C=c(x);function w(e,t){return C(e,t,void 0)}var T=c(r(x,{createIsNestedEqual:function(){return o}}));function E(e,t){return T(e,t,void 0)}var D=c(S);function ee(e,t){return D(e,t,new WeakMap)}var O=c(r(S,{createIsNestedEqual:function(){return o}}));function k(e,t){return O(e,t,new WeakMap)}function A(e){return c(r(x,e(x)))}function j(e){var t=c(r(S,e(S)));return(function(e,n,r){return r===void 0&&(r=new WeakMap),t(e,n,r)})}e.circularDeepEqual=ee,e.circularShallowEqual=k,e.createCustomCircularEqual=j,e.createCustomEqual=A,e.deepEqual=w,e.sameValueZeroEqual=o,e.shallowEqual=E,Object.defineProperty(e,"__esModule",{value:!0})}))})),Un=e(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Wn=e(((e,t)=>{var n=Un();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),Gn=e(((e,t)=>{t.exports=Wn()()})),$=r(Gn(),1);function Kn(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&&Kn(e.changedTouches,e=>t===e.identifier)}function gr(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function _r(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function vr(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??_r();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;} +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/panel-editor-BVRFoShZ.js","assets/useRouter-ByJ6_rwb.js","assets/brand-D6fP-cLS.js","assets/search-D_K9J6yO.js","assets/noop-mXPS5vjY.js","assets/format-BZjbsxwM.js","assets/auth-DWqIkMZS.js","assets/useNavigate-B1zgPEUp.js","assets/useQuery-BLTYSIvG.js","assets/save-dialog-Chbkq2Xp.js","assets/toolbar-DV46cPGs.js","assets/theme-DXTVNXHm.js","assets/CopyButton-BIdC6qm1.js","assets/Table-D4ZwUno3.js","assets/live-data-meta-CUyw2snU.js","assets/lib-BLIvzI-_.js","assets/index-C1Pd14SU.js","assets/preload-helper-DJZNfKNH.js","assets/lazyRouteComponent-DiWTNBZT.js","assets/search-CDra9nG2.js","assets/index-CzwgFH1g.css","assets/loading-skeleton-D1hXpfUI.js","assets/page-1Rod7OFH.js","assets/NumberInput-CixyOph4.js","assets/discard-NZfxCIcK.js","assets/new-dashboard-D58ui2mw.js"])))=>i.map(i=>d[i]); +import{a as e,i as t,r as n,s as r}from"./useRouter-ByJ6_rwb.js";import{$ as i,Cn as a,Ct as o,D as s,Dt as c,E as l,F as u,Ft as d,G as f,K as p,M as m,N as h,Nt as g,O as _,Ot as v,Pt as y,S as b,T as x,Tt as S,Xt as C,Zt as w,a as T,bn as E,dn as D,en as ee,et as O,f as k,g as A,gn as j,in as M,j as N,jt as P,k as F,nn as I,nt as L,pn as R,q as te,r as ne,s as re,tt as ie,w as z}from"./brand-D6fP-cLS.js";import{t as ae}from"./preload-helper-DJZNfKNH.js";import{c as oe}from"./theme-DXTVNXHm.js";import{_ as se,a as ce,c as B,h as le,i as V,l as ue,n as de,o as fe,r as H,s as U,u as pe,v as W,y as G}from"./toolbar-DV46cPGs.js";import{C as K,D as q,N as J,O as me,S as he,T as Y,_ as ge,b as _e,d as ve,f as ye,h as be,n as xe,p as Se,v as Ce,w as we,x as Te,y as Ee}from"./search-D_K9J6yO.js";import{n as De}from"./format-BZjbsxwM.js";import{a as Oe,c as ke,i as Ae,l as je,n as Me,o as Ne,r as Pe,s as Fe,t as Ie}from"./live-data-meta-CUyw2snU.js";import{c as Le,r as Re,s as ze}from"./auth-DWqIkMZS.js";import{T as Be,t as Ve}from"./useQuery-BLTYSIvG.js";import{t as He}from"./useMutation-B1CTivyp.js";import{S as Ue,ct as We,g as Ge,lt as Ke,x as qe}from"./index-C1Pd14SU.js";import{t as Je}from"./loading-skeleton-D1hXpfUI.js";import{t as Ye}from"./dashboard-change-chips-BJ-GZE9U.js";var[Xe,Ze]=j(`Accordion component was not found in the tree`),[Qe,$e]=j(`Accordion.Item component was not found in the tree`),et={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`},X=n(),tt=c(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,chevron:o,icon:s,onClick:c,onKeyDown:l,children:u,disabled:f,mod:p,...m}=d(`AccordionControl`,null,e),{value:h}=$e(),g=Ze(),_=g.isItemActive(h),v=typeof g.order==`number`,y=`h${g.order}`,b=(0,X.jsxs)(ie,{...g.getStyles(`control`,{className:n,classNames:t,style:r,styles:i,variant:g.variant}),unstyled:g.unstyled,mod:[`accordion-control`,{active:_,"chevron-position":g.chevronPosition,disabled:f},p],onClick:e=>{c?.(e),g.onChange(h)},type:`button`,disabled:f,"aria-expanded":_,"aria-controls":g.getRegionId(h),id:g.getControlId(h),onKeyDown:J({siblingSelector:`[data-accordion-control]`,parentSelector:`[data-accordion]`,activateOnFocus:!1,loop:g.loop,orientation:`vertical`,onKeyDown:l}),...m,children:[(0,X.jsx)(S,{component:`span`,mod:{rotate:!g.disableChevronRotation&&_,position:g.chevronPosition},...g.getStyles(`chevron`,{classNames:t,styles:i}),children:o||g.chevron}),(0,X.jsx)(`span`,{...g.getStyles(`label`,{classNames:t,styles:i}),children:u}),s&&(0,X.jsx)(S,{component:`span`,mod:{"chevron-position":g.chevronPosition},...g.getStyles(`icon`,{classNames:t,styles:i}),children:s})]});return v?(0,X.jsx)(y,{...g.getStyles(`itemTitle`,{classNames:t,styles:i}),children:b}):b});tt.displayName=`@mantine/core/AccordionControl`,tt.classes=et;var nt=c(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,value:o,mod:s,...c}=d(`AccordionItem`,null,e),l=Ze();return(0,X.jsx)(Qe,{value:{value:o},children:(0,X.jsx)(S,{mod:[{active:l.isItemActive(o)},s],...l.getStyles(`item`,{className:n,classNames:t,styles:i,style:r,variant:l.variant}),...c})})});nt.displayName=`@mantine/core/AccordionItem`,nt.classes=et;var rt=c(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:s,keepMounted:c,keepMountedMode:l,...u}=d(`AccordionPanel`,null,e),{value:f}=$e(),p=Ze();return(0,X.jsx)(o,{...p.getStyles(`panel`,{className:n,classNames:t,style:r,styles:i}),expanded:p.isItemActive(f),transitionDuration:p.transitionDuration??200,role:`region`,id:p.getRegionId(f),"aria-labelledby":p.getControlId(f),keepMounted:c??p.keepMounted,keepMountedMode:l??p.keepMountedMode,...u,children:(0,X.jsx)(`div`,{...p.getStyles(`content`,{classNames:t,styles:i}),children:s})})});rt.displayName=`@mantine/core/AccordionPanel`,rt.classes=et;var it={multiple:!1,loop:!0,disableChevronRotation:!1,disableCollapse:!1,chevronPosition:`right`,variant:`default`,chevronSize:`auto`,chevronIconSize:16,keepMountedMode:`activity`},at=w((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:E(n),"--accordion-radius":r===void 0?void 0:D(r)}})),ot=v(e=>{let t=d(`Accordion`,it,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,children:c,multiple:l,value:u,defaultValue:f,onChange:p,id:h,loop:_,transitionDuration:v,disableChevronRotation:y,disableCollapse:b,chevronPosition:x,chevronSize:C,order:w,chevron:T,variant:E,radius:D,chevronIconSize:O,attributes:k,keepMounted:A,keepMountedMode:j,...N}=t,P=M(h),[F,I]=ee({value:u,defaultValue:f,finalValue:l?[]:null,onChange:p}),L=e=>Array.isArray(F)?F.includes(e):e===F,R=e=>{if(!Array.isArray(F)&&b&&e===F)return;let t=Array.isArray(F)?F.includes(e)?F.filter(t=>t!==e):[...F,e]:e===F?null:e;I(t)},te=g({name:`Accordion`,classes:et,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:k,vars:s,varsResolver:at});return(0,X.jsx)(Xe,{value:{isItemActive:L,onChange:R,getControlId:G(`${P}-control`,`Accordion.Item component was rendered with invalid value or without value`),getRegionId:G(`${P}-panel`,`Accordion.Item component was rendered with invalid value or without value`),chevron:T===null?null:T||(0,X.jsx)(m,{size:O}),transitionDuration:v,disableChevronRotation:y,chevronPosition:x,order:w,loop:_,getStyles:te,variant:E,unstyled:o,keepMounted:A,keepMountedMode:j},children:(0,X.jsx)(S,{...te(`root`),id:P,...N,variant:E,"data-accordion":!0,children:c})})});ot.classes=et,ot.varsResolver=at,ot.displayName=`@mantine/core/Accordion`,ot.Item=nt,ot.Panel=rt,ot.Control=tt,ot.Chevron=m;function st(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},lt=(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,lt(o.current,e.expectedValue)&&e.container?.querySelector(`[data-mantine-pill-index="${e.index}"]`)?.focus())});let s=(0,Z.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=st(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=st(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){ct(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())}}}var Q=(0,Z.createContext)(null),dt={root:`m_7cda1cd6`,"root--default":`m_44da308b`,"root--contrast":`m_e3a01f8`,label:`m_1e0e6180`,remove:`m_ae386778`,group:`m_1dcfd90b`},ft=(0,Z.createContext)(null),pt=w((e,{gap:t},{size:n})=>({group:{"--pg-gap":t===void 0?R(n,`pg-gap`):R(t)}})),mt=c(e=>{let t=d(`PillGroup`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,size:c,disabled:l,attributes:u,...f}=t,p=(0,Z.use)(Q)?.size||c||void 0,m=g({name:`PillGroup`,classes:dt,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:u,vars:s,varsResolver:pt,stylesCtx:{size:p},rootSelector:`group`});return(0,X.jsx)(ft,{value:{size:p,disabled:l},children:(0,X.jsx)(S,{size:p,...m(`group`),...f})})});mt.classes=dt,mt.varsResolver=pt,mt.displayName=`@mantine/core/PillGroup`;var ht={variant:`default`},gt=w((e,{radius:t},{size:n})=>({root:{"--pill-fz":R(n,`pill-fz`),"--pill-height":R(n,`pill-height`),"--pill-radius":t===void 0?void 0:D(t)}})),_t=c(e=>{let t=d(`Pill`,ht,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,variant:c,children:l,withRemoveButton:u,onRemove:f,removeButtonProps:m,radius:h,size:_,disabled:v,mod:y,attributes:b,...x}=t,C=(0,Z.use)(ft),w=(0,Z.use)(Q),T=_||C?.size||void 0,E=w?.variant===`filled`?`contrast`:c||`default`,D=g({name:`Pill`,classes:dt,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:b,vars:s,varsResolver:gt,stylesCtx:{size:T}});return(0,X.jsxs)(S,{component:`span`,variant:E,size:T,...D(`root`,{variant:E}),mod:[{"with-remove":u&&!v,disabled:v||C?.disabled},y],...x,children:[(0,X.jsx)(`span`,{...D(`label`),children:l}),u&&(0,X.jsx)(p,{variant:`transparent`,radius:h,tabIndex:-1,"aria-hidden":!0,unstyled:o,...m,...D(`remove`,{className:m?.className,style:m?.style}),onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),m?.onMouseDown?.(e)},onClick:e=>{e.stopPropagation(),f?.(),m?.onClick?.(e)}})]})});_t.classes=dt,_t.varsResolver=gt,_t.displayName=`@mantine/core/Pill`,_t.Group=mt;var vt={field:`m_45c4369d`},yt={type:`visible`},bt=c(e=>{let t=d(`PillsInputField`,yt,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,type:c,disabled:l,id:f,pointer:p,mod:m,attributes:h,ref:_,...v}=t,y=(0,Z.use)(Q),b=(0,Z.use)(u),x=g({name:`PillsInputField`,classes:vt,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:h,rootSelector:`field`}),C=l||y?.disabled;return(0,X.jsx)(S,{component:`input`,ref:I(_,y?.fieldRef),"data-type":c,disabled:C,mod:[{disabled:C,pointer:p},m],...x(`field`),...v,id:b?.inputId||f,"aria-invalid":y?.hasError,"aria-describedby":b?.describedBy,type:`text`,onMouseDown:e=>!p&&e.stopPropagation()})});bt.classes=vt,bt.displayName=`@mantine/core/PillsInputField`;var xt={size:`sm`},St=c(e=>{let{children:t,onMouseDown:n,onClick:r,size:i,disabled:a,__staticSelector:o,error:s,variant:c,...l}=d([`Input`,`InputWrapper`,`PillsInput`],xt,e),u=(0,Z.useRef)(null);return(0,X.jsx)(Q,{value:{fieldRef:u,size:i,disabled:a,hasError:!!s,variant:c},children:(0,X.jsx)(h,{size:i,error:s,variant:c,component:`div`,"data-no-overflow":!0,onMouseDown:e=>{e.preventDefault(),n?.(e),u.current?.focus()},onClick:e=>{e.preventDefault(),e.currentTarget.closest(`fieldset`)?.disabled||(u.current?.focus(),r?.(e))},...l,multiline:!0,disabled:a,__staticSelector:o||`PillsInput`,withAria:!1,children:t})})});St.displayName=`@mantine/core/PillsInput`,St.classes=h.classes,St.Field=bt;function Ct(e){return typeof e==`string`?e.trim().toLowerCase():e}function wt({data:e,value:t}){let n=t.map(Ct);return e.reduce((e,t)=>(Oe(t)?e.push({group:t.group,items:t.items.filter(e=>n.indexOf(Ct(e.value))===-1)}):n.indexOf(Ct(t.value))===-1&&e.push(t),e),[])}var Tt={xs:41,sm:50,md:60,lg:72,xl:89},Et={maxValues:1/0,withCheckIcon:!0,checkIconPosition:`left`,hiddenInputValuesDivider:`,`,clearSearchOnChange:!0,openOnFocus:!0,size:`sm`},Dt=v(e=>{let t=d([`Input`,`InputWrapper`,`MultiSelect`],Et,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,size:c,value:l,defaultValue:u,onChange:f,onKeyDown:p,variant:m,data:h,dropdownOpened:_,defaultDropdownOpened:v,onDropdownOpen:b,onDropdownClose:x,selectFirstOptionOnChange:S,selectFirstOptionOnDropdownOpen:C,onOptionSubmit:w,comboboxProps:T,filter:E,limit:D,withScrollArea:O,maxDropdownHeight:k,floatingHeight:A,searchValue:j,defaultSearchValue:N,onSearchChange:F,readOnly:I,disabled:L,onFocus:R,onBlur:te,radius:ne,rightSection:re,rightSectionWidth:ie,rightSectionPointerEvents:z,rightSectionProps:ae,leftSection:oe,leftSectionWidth:ce,leftSectionPointerEvents:B,leftSectionProps:le,inputContainer:V,inputWrapperOrder:ue,withAsterisk:de,labelProps:fe,descriptionProps:H,errorProps:U,successProps:pe,wrapperProps:G,description:K,label:q,error:J,success:me,maxValues:he,searchable:Y,nothingFoundMessage:ge,withCheckIcon:_e,withAlignedLabels:ve,checkIconPosition:ye,hidePickedOptions:be,withErrorStyles:xe,withSuccessStyles:Se,name:Ce,form:we,id:Te,clearable:Ee,clearSectionMode:De,clearButtonProps:Oe,hiddenInputProps:Me,placeholder:Ie,hiddenInputValuesDivider:Le,required:Re,mod:ze,renderOption:Be,renderPill:Ve,onRemove:He,onClear:Ue,onMaxValues:We,scrollAreaProps:Ge,chevronColor:Ke,attributes:qe,clearSearchOnChange:Je,openOnFocus:Ye,loading:Xe,loadingPosition:Ze,withPillsReorder:Qe,...$e}=t,et=M(Te),tt=Pe({id:et,label:q,labelProps:fe,inputWrapperOrder:ue}),nt=je(h),rt=ke(nt),it=(0,Z.useRef)({}),at=Fe({opened:_,defaultOpened:v,onDropdownOpen:()=>{b?.(),C&&at.selectFirstOption()},onDropdownClose:()=>{x?.(),at.resetSelectedOption()}}),{styleProps:ot,rest:{type:st,autoComplete:ct,...lt}}=P($e),[Q,dt]=ee({value:l,defaultValue:u,finalValue:[],onChange:f}),{getPillProps:ft,getListProps:pt,handleInputKeyDown:mt}=ut({value:Q,onChange:dt,enabled:Qe&&!L&&!I}),[ht,gt]=ee({value:j,defaultValue:N,finalValue:``,onChange:F}),vt=e=>{gt(e),at.resetSelectedOption()},yt=g({name:`MultiSelect`,classes:{},props:t,classNames:n,styles:a,unstyled:o,attributes:qe}),{resolvedClassNames:bt,resolvedStyles:xt}=y({props:t,styles:a,classNames:n}),Ct=e=>{p?.(e),!e.defaultPrevented&&(e.key===` `&&!Y&&(e.preventDefault(),at.toggleDropdown()),e.key===`Backspace`&&ht.length===0&&Q.length>0&&!I&&(He?.(Q[Q.length-1]),dt(Q.slice(0,Q.length-1))),mt(e))},Dt=Q.map((e,t)=>{let n=rt[`${e}`]||it.current[`${e}`],r=ft(t);return Ve?(0,X.jsx)(Z.Fragment,{children:Ve({option:n,value:e,onRemove:()=>{dt(Q.filter(t=>e!==t)),He?.(e)},disabled:L,reorderProps:r})},`${e}-${t}`):(0,X.jsx)(_t,{withRemoveButton:!I&&!rt[`${e}`]?.disabled,onRemove:()=>{dt(Q.filter(t=>e!==t)),He?.(e)},unstyled:o,disabled:L,...yt(`pill`),...r,children:n?.label||e},`${e}-${t}`)});(0,Z.useEffect)(()=>{S&&at.selectFirstOption()},[S,ht]),(0,Z.useEffect)(()=>{Q.forEach(e=>{`${e}`in rt&&(it.current[`${e}`]=rt[`${e}`])})},[rt,Q]);let Ot=(0,X.jsx)(Ne.ClearButton,{...Oe,onClear:()=>{Ue?.(),dt([]),vt(``)}}),kt=wt({data:nt,value:Q}),At=Ee&&Q.length>0&&!L&&!I,jt=At?{paddingInlineEnd:Tt[c]??Tt.sm}:void 0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Ne,{store:at,classNames:bt,styles:xt,unstyled:o,size:c,readOnly:I,__staticSelector:`MultiSelect`,attributes:qe,floatingHeight:A,onOptionSubmit:e=>{w?.(e),Je&&vt(``),at.updateSelectedOptionIndex(`selected`),Q.includes(rt[`${e}`].value)?(dt(Q.filter(t=>t!==rt[`${e}`].value)),He?.(rt[`${e}`].value)):Q.lengthY?at.openDropdown():at.toggleDropdown(),"data-expanded":at.dropdownOpened||void 0,id:et,required:Re,mod:ze,attributes:qe,children:(0,X.jsxs)(_t.Group,{attributes:qe,disabled:L,unstyled:o,...yt(`pillsList`,{style:jt}),...pt(),children:[Dt,(0,X.jsx)(Ne.EventsTarget,{autoComplete:ct,withExpandedAttribute:!0,children:(0,X.jsx)(St.Field,{...lt,id:et,placeholder:Ie,type:!Y&&!Ie?`hidden`:`visible`,...yt(`inputField`),unstyled:o,onFocus:e=>{R?.(e),Ye&&Y&&at.openDropdown()},onBlur:e=>{te?.(e),at.closeDropdown(),vt(``)},onKeyDown:Ct,value:ht,onChange:e=>{if(W(e)){if(!I){let t=se(rt,e.currentTarget.value);t&&!Q.includes(t.value)&&Q.lengthe*40+(e-1)*12,jt={s:3,m:6,l:10},Mt={stat:4},Nt=e=>Math.max(Mt[e.viz]??0,jt[e.height??(e.viz===`service_map`?`l`:e.viz===`stat`?`s`:`m`)]);function Pt(){return(0,X.jsxs)(x,{gap:`md`,"data-dashboard-skeleton":!0,children:[(0,X.jsxs)(x,{gap:`sm`,"data-dashboard-header-skeleton":!0,children:[(0,X.jsxs)(f,{justify:`space-between`,children:[(0,X.jsx)(l,{height:28,width:`32%`}),(0,X.jsx)(l,{height:28,width:28})]}),(0,X.jsx)(l,{height:12,width:`52%`}),(0,X.jsxs)(f,{justify:`space-between`,children:[(0,X.jsx)(l,{height:32,width:180}),(0,X.jsx)(l,{height:32,width:120})]})]}),(0,X.jsx)(S,{style:{containerType:`inline-size`},children:(0,X.jsx)(S,{className:`dashboard-loading-grid`,style:{display:`grid`,gridTemplateColumns:`repeat(12, minmax(0, 1fr))`,gap:12},children:[`stat`,`stat`,`stat`,`timeseries`,`table`].map((e,t)=>(0,X.jsxs)(i,{withBorder:!0,p:`md`,className:`dashboard-loading-panel`,"data-skeleton-columns":e===`stat`?4:6,style:{display:`flex`,flexDirection:`column`,minHeight:At(e===`stat`?4:6)},children:[(0,X.jsx)(l,{height:14,width:`44%`,mb:`xl`}),(0,X.jsx)(Je,{viz:e,rows:4})]},t))})})]})}function Ft(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function It(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function Lt(e,t,n,r,i,a,o){let{margin:s,containerPadding:c,rowHeight:l}=e,u=Ft(e),d,f,p,m;if(o?(d=Math.round(o.width),f=Math.round(o.height)):(d=It(r,u,s[0]),f=It(i,l,s[1])),a?(p=Math.round(a.top),m=Math.round(a.left)):o?(p=Math.round(o.top),m=Math.round(o.left)):(p=Math.round((l+s[1])*n+c[1]),m=Math.round((u+s[0])*t+c[0])),!a&&!o){if(Number.isFinite(r)){let e=Math.round((u+s[0])*(t+r)+c[0])-m-d;e!==s[0]&&(d+=e-s[0])}if(Number.isFinite(i)){let e=Math.round((l+s[1])*(n+i)+c[1])-p-f;e!==s[1]&&(f+=e-s[1])}}return{top:p,left:m,width:d,height:f}}function Rt(e,t,n,r,i){let{margin:a,containerPadding:o,cols:s,rowHeight:c,maxRows:l}=e,u=Ft(e),d=Math.round((n-o[0])/(u+a[0])),f=Math.round((t-o[1])/(c+a[1]));return d=Vt(d,0,s-r),f=Vt(f,0,l-i),{x:d,y:f}}function zt(e,t,n){let{margin:r,containerPadding:i,rowHeight:a}=e,o=Ft(e);return{x:Math.round((n-i[0])/(o+r[0])),y:Math.round((t-i[1])/(a+r[1]))}}function Bt(e,t,n){let{margin:r,rowHeight:i}=e,a=Ft(e);return{w:Math.max(1,Math.round((t+r[0])/(a+r[0]))),h:Math.max(1,Math.round((n+r[1])/(i+r[1])))}}function Vt(e,t,n){return Math.max(Math.min(e,n),t)}function Ht(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function Ut(e,t){for(let n=0;nHt(e,t))}function Gt(e,t){return t===`horizontal`?qt(e):t===`vertical`||t===`wrap`?Kt(e):[...e]}function Kt(e){return[...e].sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y)}function qt(e){return[...e].sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x)}function Jt(e){let t=0;for(let n=0;nt&&(t=e)}}return t}function Yt(e,t){for(let n=0;ne.static===!0)}function Zt(e){return{i:e.i,x:e.x,y:e.y,w:e.w,h:e.h,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,constraints:e.constraints,isBounded:e.isBounded}}function Qt(e){let t=Array(e.length);for(let n=0;nt.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),i.y===1/0&&(i.y=Jt(n)),!i.static)n.push(i);else for(;Ut(n,i);)i.y++}}return e}function nn(e,t,n,r,i,a,o,s,c){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return[...e];let l=t.x,u=t.y;typeof n==`number`&&(t.x=n),typeof r==`number`&&(t.y=r),t.moved=!0;let d=Gt(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(d=d.reverse());let f=Wt(d,t),p=f.length>0;if(p&&c)return Qt(e);if(p&&a)return t.x=l,t.y=u,t.moved=!1,e;let m=[...e];for(let e=0;et.y,d=l!==void 0&&t.x+t.w>l.x;if(!l)return nn(e,n,o?a.x:void 0,s?a.y:void 0,r,c,i);if(u&&s)return nn(e,n,void 0,n.y+1,r,c,i);if(u&&i===null){let r=n.y;return t.y=r,n.y=r+t.h,[...e]}if(d&&o)return nn(e,t,n.x,void 0,r,c,i)}let l=o?n.x+1:void 0,u=s?n.y+1:void 0;return l===void 0&&u===void 0?[...e]:nn(e,n,l,u,r,c,i)}function an(e,t,n){return Math.max(t,Math.min(n,e))}var on=[{name:`gridBounds`,constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:an(t,0,Math.max(0,r-e.w)),y:an(n,0,Math.max(0,i-e.h))}},constrainSize(e,t,n,r,{cols:i,maxRows:a}){let o=r===`w`||r===`nw`||r===`sw`?e.x+e.w:i-e.x,s=r===`n`||r===`nw`||r===`ne`?e.y+e.h:a-e.y;return{w:an(t,1,Math.max(1,o)),h:an(n,1,Math.max(1,s))}}},{name:`minMaxSize`,constrainSize(e,t,n){return{w:an(t,e.minW??1,e.maxW??1/0),h:an(n,e.minH??1,e.maxH??1/0)}}}];function sn(e,t,n,r,i){let a={x:n,y:r};for(let n of e)n.constrainPosition&&(a=n.constrainPosition(t,a.x,a.y,i));if(t.constraints)for(let e of t.constraints)e.constrainPosition&&(a=e.constrainPosition(t,a.x,a.y,i));return a}function cn(e,t,n,r,i,a){let o={w:n,h:r};for(let n of e)n.constrainSize&&(o=n.constrainSize(t,o.w,o.h,i,a));if(t.constraints)for(let e of t.constraints)e.constrainSize&&(o=e.constrainSize(t,o.w,o.h,i,a));return o}function ln({top:e,left:t,width:n,height:r}){let i=`translate(${t}px,${e}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${n}px`,height:`${r}px`,position:`absolute`}}function un({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:`absolute`}}function dn(e){return e*100+`%`}function fn(e,t,n,r){return e+n>r?t:n}function pn(e,t,n){return e<0?t:n}function mn(e){return Math.max(0,e)}function hn(e){return Math.max(0,e)}var gn=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:pn(o,e.height,i),top:hn(o)}},_n=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:fn(e.left,e.width,o,n),left:mn(i)}},vn=(e,t,n)=>{let{top:r,height:i,width:a}=t,o=e.left+e.width-a;return o<0?{height:i,width:e.left+e.width,top:hn(r),left:0}:{height:i,width:a,top:hn(r),left:o}},yn=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:pn(r,e.height,a),top:hn(r)}},bn={n:gn,ne:(e,t,n)=>gn(e,_n(e,t,n)),e:_n,se:(e,t,n)=>yn(e,_n(e,t,n)),s:yn,sw:(e,t,n)=>yn(e,vn(e,t)),w:vn,nw:(e,t,n)=>gn(e,vn(e,t))};function xn(e,t,n,r){let i=bn[e];return i?i(t,{...t,...n},r):n}var Sn={type:`transform`,scale:1,calcStyle(e){return ln(e)}},Cn={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},wn={enabled:!0,bounded:!1,threshold:3},Tn={enabled:!0,handles:[`se`]},En={enabled:!1,defaultItem:{w:1,h:1},touchEnabled:!0,touchDragSource:`[data-rgl-draggable]`};function Dn(e,t,n,r,i){let a=r===`x`?`w`:`h`;t[r]+=1;let o=e.findIndex(e=>e.i===t.i),s=i??Xt(e).length>0;for(let i=o+1;it.y+t.h)break;Ht(t,o)&&Dn(e,o,n+t[a],r,s)}}t[r]=n}function On(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0),t.y=Math.min(r,t.y);t.y>0&&!Ut(e,t);)t.y--;let i;for(;(i=Ut(e,t))!==void 0;)Dn(n,t,i.y+i.h,`y`);return t.y=Math.max(t.y,0),t}function kn(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!Ut(e,t);)t.x--;let i;for(;(i=Ut(e,t))!==void 0;)if(Dn(r,t,i.x+i.w,`x`),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!Ut(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var An={type:`vertical`,allowOverlap:!1,compact(e,t){let n=Xt(e),r=Jt(n),i=Kt(e),a=Array(e.length);for(let t=0;te[t]-e[n])}function Rn(e,t){let n=Ln(e),r=n[0];if(r===void 0)throw Error(`No breakpoints defined`);for(let i=1;ie[a]&&(r=a)}return r}function zn(e,t){let n=t[e];if(n===void 0)throw Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function Bn(e,t,n,r,i,a){let o=e[n];if(o)return Qt(o);let s=e[r],c=Ln(t),l=c.slice(c.indexOf(n));for(let t=0;t{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n[`fast-equals`]={}))})(e,(function(e){function t(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function n(e){return function(t,n,r,i){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r,i);var a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);var s=e(t,n,r,i);return i.delete(t),i.delete(n),s}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function i(e){return e.constructor===Object||e.constructor==null}function a(e){return typeof e.then==`function`}function o(e,t){return e===t||e!==e&&t!==t}var s=Object.prototype.toString;function c(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,c=e.areObjectsEqual,l=e.areRegExpsEqual,u=e.areSetsEqual,d=e.createIsNestedEqual,f=d(p);function p(e,d,p){if(e===d)return!0;if(!e||!d||typeof e!=`object`||typeof d!=`object`)return e!==e&&d!==d;if(i(e)&&i(d))return c(e,d,f,p);var m=Array.isArray(e),h=Array.isArray(d);if(m||h)return m===h&&t(e,d,f,p);var g=s.call(e);return g===s.call(d)?g===`[object Date]`?n(e,d,f,p):g===`[object RegExp]`?l(e,d,f,p):g===`[object Map]`?r(e,d,f,p):g===`[object Set]`?u(e,d,f,p):g===`[object Object]`||g===`[object Arguments]`?a(e)||a(d)?!1:c(e,d,f,p):g===`[object Boolean]`||g===`[object Number]`||g===`[object String]`?o(e.valueOf(),d.valueOf()):!1:!1}return p}function l(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-->0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var u=n(l);function d(e,t){return o(e.valueOf(),t.valueOf())}function f(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={},o=0;return e.forEach(function(s,c){if(i){var l=!1,u=0;t.forEach(function(i,d){!l&&!a[u]&&(l=n(c,d,o,u,e,t,r)&&n(s,i,c,d,e,t,r))&&(a[u]=!0),u++}),o++,i=l}}),i}var p=n(f),m=`_owner`,h=Object.prototype.hasOwnProperty;function g(e,t,n,r){var i=Object.keys(e),a=i.length;if(Object.keys(t).length!==a)return!1;for(var o;a-->0;){if(o=i[a],o===m){var s=!!e.$$typeof,c=!!t.$$typeof;if((s||c)&&s!==c)return!1}if(!h.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var _=n(g);function v(e,t){return e.source===t.source&&e.flags===t.flags}function y(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var a={};return e.forEach(function(o,s){if(i){var c=!1,l=0;t.forEach(function(i,u){!c&&!a[l]&&(c=n(o,i,s,u,e,t,r))&&(a[l]=!0),l++}),i=c}}),i}var b=n(y),x=Object.freeze({areArraysEqual:l,areDatesEqual:d,areMapsEqual:f,areObjectsEqual:g,areRegExpsEqual:v,areSetsEqual:y,createIsNestedEqual:t}),S=Object.freeze({areArraysEqual:u,areDatesEqual:d,areMapsEqual:p,areObjectsEqual:_,areRegExpsEqual:v,areSetsEqual:b,createIsNestedEqual:t}),C=c(x);function w(e,t){return C(e,t,void 0)}var T=c(r(x,{createIsNestedEqual:function(){return o}}));function E(e,t){return T(e,t,void 0)}var D=c(S);function ee(e,t){return D(e,t,new WeakMap)}var O=c(r(S,{createIsNestedEqual:function(){return o}}));function k(e,t){return O(e,t,new WeakMap)}function A(e){return c(r(x,e(x)))}function j(e){var t=c(r(S,e(S)));return(function(e,n,r){return r===void 0&&(r=new WeakMap),t(e,n,r)})}e.circularDeepEqual=ee,e.circularShallowEqual=k,e.createCustomCircularEqual=j,e.createCustomEqual=A,e.deepEqual=w,e.sameValueZeroEqual=o,e.shallowEqual=E,Object.defineProperty(e,"__esModule",{value:!0})}))})),Un=e(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Wn=e(((e,t)=>{var n=Un();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),Gn=e(((e,t)=>{t.exports=Wn()()})),$=r(Gn(),1);function Kn(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&&Kn(e.changedTouches,e=>t===e.identifier)}function gr(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function _r(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function vr(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??_r();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&&xr(e.body,`react-draggable-transparent-selection`)}function yr(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{br(e)}):br(e)}function br(e){if(e)try{e.body&&Sr(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 xr(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function Sr(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function Cr(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:Ar(r);let i=jr(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+Yn(s.paddingLeft)+Yn(o.marginLeft),top:-i.offsetTop+Yn(s.paddingTop)+Yn(o.marginTop),right:ur(a)-cr(i)-i.offsetLeft+Yn(s.paddingRight)-Yn(o.marginRight),bottom:lr(a)-sr(i)-i.offsetTop+Yn(s.paddingBottom)-Yn(o.marginBottom)}}return Jn(r.right)&&(t=Math.min(t,r.right)),Jn(r.bottom)&&(n=Math.min(n,r.bottom)),Jn(r.left)&&(t=Math.max(t,r.left)),Jn(r.top)&&(n=Math.max(n,r.top)),[t,n]}function wr(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function Tr(e){return e.props.axis===`both`||e.props.axis===`x`}function Er(e){return e.props.axis===`both`||e.props.axis===`y`}function Dr(e,t,n){let r=typeof t==`number`?hr(e,t):null;if(typeof t==`number`&&!r)return null;let i=jr(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return dr(r||e,a,n.props.scale)}function Or(e,t,n){let r=!Jn(e.lastX),i=jr(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 kr(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 Ar(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function jr(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var Mr=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},Nr={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},Pr=Nr.mouse,Fr=class extends Z.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&&!ir(e.target,this.props.handle,t)||this.props.cancel&&ir(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=gr(e);this.touchIdentifier=r;let i=Dr(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=Or(this,a,o);Mr(`DraggableCore: handleDragStart: %j`,s),Mr(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&vr(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,ar(n,Pr.move,this.handleDrag),ar(n,Pr.stop,this.handleDragStop))},this.handleDrag=e=>{let t=Dr(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]=wr(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=Or(this,n,r);if(Mr(`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=Dr(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]=wr(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=Or(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&yr(a.ownerDocument),Mr(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(Mr(`DraggableCore: Removing handlers`),or(a.ownerDocument,Pr.move,this.handleDrag),or(a.ownerDocument,Pr.stop,this.handleDragStop))},this.onMouseDown=e=>(Pr=Nr.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(Pr=Nr.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(Pr=Nr.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(Pr=Nr.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&ar(e,Nr.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;or(t,Nr.mouse.move,this.handleDrag),or(t,Nr.touch.move,this.handleDrag),or(t,Nr.mouse.stop,this.handleDragStop),or(t,Nr.touch.stop,this.handleDragStop),or(e,Nr.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&yr(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=Ot.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(Mr(`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 Z.cloneElement(Z.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Fr.displayName=`DraggableCore`,Fr.propTypes={allowAnyClick:$.default.bool,allowMobileScroll:$.default.bool,children:$.default.node.isRequired,disabled:$.default.bool,enableUserSelectHack:$.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:$.default.arrayOf($.default.number),handle:$.default.string,cancel:$.default.string,nodeRef:$.default.object,nonce:$.default.string,onStart:$.default.func,onDrag:$.default.func,onStop:$.default.func,onMouseDown:$.default.func,scale:$.default.number,className:Xn,style:Xn,transform:Xn},Fr.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var Ir=class extends Z.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(Mr(`Draggable: onDragStart: %j`,t),this.props.onStart(e,kr(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;Mr(`Draggable: onDrag: %j`,t);let n=kr(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]=Cr(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,kr(this,t))===!1)return!1;Mr(`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)?(Mr(`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=Ot.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:Tr(this)&&p?this.state.x:m.x,y:Er(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=pr(h,c):d=fr(h,c);let g=Z.Children.only(n),_=C(g.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return Z.createElement(Fr,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},Z.cloneElement(g,{className:_,style:{...g.props.style,...d},transform:f}))}};Ir.displayName=`Draggable`,Ir.propTypes={...Fr.propTypes,axis:$.default.oneOf([`both`,`x`,`y`,`none`]),bounds:$.default.oneOfType([$.default.shape({left:$.default.number,right:$.default.number,top:$.default.number,bottom:$.default.number}),$.default.string,$.default.oneOf([!1])]),defaultClassName:$.default.string,defaultClassNameDragging:$.default.string,defaultClassNameDragged:$.default.string,defaultPosition:$.default.shape({x:$.default.number,y:$.default.number}),positionOffset:$.default.shape({x:$.default.oneOfType([$.default.number,$.default.string]),y:$.default.oneOfType([$.default.number,$.default.string])}),position:$.default.shape({x:$.default.number,y:$.default.number}),className:Xn,style:Xn,transform:Xn},Ir.defaultProps={...Fr.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1};var Lr=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,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let a of s(t))!l.call(e,a)&&a!==n&&i(e,a,{get:()=>t[a],enumerable:!(r=o(t,a))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:r(c(e)),d(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),p=e=>d(i({},`__esModule`,{value:!0}),e),m={};u(m,{DraggableCore:()=>Y,default:()=>ge}),n.exports=p(m);var h=f(t()),g=f(Gn()),_=f(a()),v=Lr();function y(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&&y(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&&ce(e.body,`react-draggable-transparent-selection`)}function oe(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{se(e)}):se(e)}function se(e){if(e)try{e.body&&B(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 ce(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function B(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:pe(r);let i=W(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:I(a)-P(i)-i.offsetLeft+S(s.paddingRight)-S(o.marginRight),bottom:F(a)-N(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 V(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function ue(e){return e.props.axis===`both`||e.props.axis===`x`}function de(e){return e.props.axis===`both`||e.props.axis===`y`}function fe(e,t,n){let r=typeof t==`number`?re(e,t):null;if(typeof t==`number`&&!r)return null;let i=W(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return L(r||e,a,n.props.scale)}function H(e,t,n){let r=!x(e.lastX),i=W(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 U(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 pe(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function W(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var G=f(t()),K=f(Gn()),q=f(a()),J=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},me={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},he=me.mouse,Y=class extends G.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&&!A(e.target,this.props.handle,t)||this.props.cancel&&A(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=ie(e);this.touchIdentifier=r;let i=fe(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=H(this,a,o);J(`DraggableCore: handleDragStart: %j`,s),J(`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,j(n,he.move,this.handleDrag),j(n,he.stop,this.handleDragStop))},this.handleDrag=e=>{let t=fe(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]=V(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=H(this,n,r);if(J(`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=fe(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]=V(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=H(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&oe(a.ownerDocument),J(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(J(`DraggableCore: Removing handlers`),M(a.ownerDocument,he.move,this.handleDrag),M(a.ownerDocument,he.stop,this.handleDragStop))},this.onMouseDown=e=>(he=me.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(he=me.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(he=me.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(he=me.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&j(e,me.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;M(t,me.mouse.move,this.handleDrag),M(t,me.touch.move,this.handleDrag),M(t,me.mouse.stop,this.handleDragStop),M(t,me.touch.stop,this.handleDragStop),M(e,me.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&oe(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=q.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(J(`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 G.cloneElement(G.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Y.displayName=`DraggableCore`,Y.propTypes={allowAnyClick:K.default.bool,allowMobileScroll:K.default.bool,children:K.default.node.isRequired,disabled:K.default.bool,enableUserSelectHack:K.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:K.default.arrayOf(K.default.number),handle:K.default.string,cancel:K.default.string,nodeRef:K.default.object,nonce:K.default.string,onStart:K.default.func,onDrag:K.default.func,onStop:K.default.func,onMouseDown:K.default.func,scale:K.default.number,className:C,style:C,transform:C},Y.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var ge=class extends h.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(J(`Draggable: onDragStart: %j`,t),this.props.onStart(e,U(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;J(`Draggable: onDrag: %j`,t);let n=U(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,U(this,t))===!1)return!1;J(`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)?(J(`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=_.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,g={x:ue(this)&&p?this.state.x:m.x,y:de(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=te(g,c):d=R(g,c);let _=h.Children.only(n),y=(0,v.clsx)(_.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return h.createElement(Y,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},h.cloneElement(_,{className:y,style:{..._.props.style,...d},transform:f}))}};ge.displayName=`Draggable`,ge.propTypes={...Y.propTypes,axis:g.default.oneOf([`both`,`x`,`y`,`none`]),bounds:g.default.oneOfType([g.default.shape({left:g.default.number,right:g.default.number,top:g.default.number,bottom:g.default.number}),g.default.string,g.default.oneOf([!1])]),defaultClassName:g.default.string,defaultClassNameDragging:g.default.string,defaultClassNameDragged:g.default.string,defaultPosition:g.default.shape({x:g.default.number,y:g.default.number}),positionOffset:g.default.shape({x:g.default.oneOfType([g.default.number,g.default.string]),y:g.default.oneOfType([g.default.number,g.default.string])}),position:g.default.shape({x:g.default.number,y:g.default.number}),className:C,style:C,transform:C},ge.defaultProps={...Y.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:Y})})),zr=e(((e,t)=>{var n=Rr(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),Br=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(Gn());zr();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)}}})),Hr=e((e=>{e.__esModule=!0,e.default=void 0;var n=s(t()),r=zr(),i=Br(),a=Vr(),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}})),Ur=e((e=>{e.__esModule=!0,e.default=void 0;var n=c(t()),r=s(Gn()),i=s(Hr()),a=Vr(),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})})),Wr=e(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=Hr().default,t.exports.ResizableBox=Ur().default}))(),Gr=Hn(),Kr=50,qr=12;function Jr(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 Yr(e){let t=Jr(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=-qr:i>s.bottom-Kr&&l+c0?h=-qr:r>s.right-Kr&&d+p({cols:n,containerPadding:a,containerWidth:r,margin:i,maxRows:s,rowHeight:o}),[n,a,r,i,s,o]),K=(0,Z.useMemo)(()=>({cols:n,maxRows:s,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,s,r,o,i]),q=(0,Z.useCallback)(e=>({...K,containerHeight:e??K.containerHeight,layout:ue.current}),[K]),J=(0,Z.useMemo)(()=>F??{i:j,x:w,y:T,w:E,h:D,minW:ee,maxW:O,minH:k,maxH:A},[F,j,w,T,E,D,ee,O,k,A]),me=(0,Z.useCallback)(e=>{if(g?.calcStyle)return g.calcStyle(e);if(p)return ln(e);let t=un(e);return m?{...t,left:dn(e.left/r),width:dn(e.width/r)}:t},[g,p,m,r]),he=(0,Z.useCallback)((e,{node:t})=>{if(!L)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(B.current=l,W.current||=Yr(t instanceof HTMLElement?t:null),_>0){let t=e;U.current={x:t.clientX,y:t.clientY},H.current=!0,pe.current=!1,ae(!0);return}ae(!0);let u=zt(G,l.top,l.left),{x:d,y:f}=sn(P,J,u.x,u.y,q());L(j,d,f,{e,node:t,newPosition:l})},[L,h,G,g,_,P,J,q,j]),Y=(0,Z.useCallback)((e,{node:t,deltaX:n,deltaY:a})=>{if(!R||!z)return;let s=e;if(H.current&&!pe.current){let n=s.clientX-U.current.x,r=s.clientY-U.current.y;if(Math.hypot(n,r)<_)return;if(pe.current=!0,H.current=!1,L){let n=zt(G,B.current.top,B.current.left),{x:r,y:i}=sn(P,J,n.x,n.y,q());L(j,r,i,{e,node:t,newPosition:B.current})}}W.current?.feed(s.clientX,s.clientY);let c=B.current.top+a,l=B.current.left+n;if(u){let{offsetParent:e}=t;if(e){let t=e.clientHeight-It(D,o,i[1]);c=Vt(c,0,t);let n=Ft(G),a=r-It(E,n,i[0]);l=Vt(l,0,a)}}let d={top:c,left:l};B.current=d;let f=zt(G,c,l),{x:p,y:m}=sn(P,J,f.x,f.y,q());R(j,p,m,{e,node:t,newPosition:d})},[R,L,z,_,u,D,o,i,G,r,E,j,P,J,q]),ge=(0,Z.useCallback)((e,{node:t})=>{if(!te||!z)return;W.current?.stop(),W.current=null;let n=H.current;if(H.current=!1,pe.current=!1,U.current={x:0,y:0},n){ae(!1),B.current={left:0,top:0};return}let{left:r,top:i}=B.current,a={top:i,left:r};ae(!1),B.current={left:0,top:0};let o=zt(G,i,r),{x:s,y:c}=sn(P,J,o.x,o.y,q());te(j,s,c,{e,node:t,newPosition:a})},[te,z,G,P,J,q,j]);de.current=he,fe.current=Y;let _e=(0,Z.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?xn(i,a,n,r):{...n,top:a.top,left:a.left},le.current=c;let l=t?.offsetParent?.clientHeight??0,u=Bt(G,c.width,c.height),{w:d,h:f}=cn(P,J,u.w,u.h,i,q(l));s(j,d,f,{e:e.nativeEvent??e,node:t,size:c,handle:i})},[ne,re,ie,r,G,j,P,J,q]),ve=(0,Z.useCallback)((e,t)=>{se(!0);let n=Lt(G,w,T,E,D),r={...t,handle:t.handle};_e(e,r,n,`onResizeStart`)},[_e,G,w,T,E,D]),ye=(0,Z.useCallback)((e,t)=>{let n=Lt(G,w,T,E,D),r={...t,handle:t.handle};_e(e,r,n,`onResize`)},[_e,G,w,T,E,D]),be=(0,Z.useCallback)((e,t)=>{se(!1),le.current={top:0,left:0,width:0,height:0};let n=Lt(G,w,T,E,D),r={...t,handle:t.handle};_e(e,r,n,`onResizeStop`)},[_e,G,w,T,E,D]);(0,Z.useEffect)(()=>{if(!v)return;let e=ce.current;if(!e)return;let t=V.current||{left:0,top:0},n=z&&(v.left!==t.left||v.top!==t.top);if(!z){let t={node:e,deltaX:v.left,deltaY:v.top,lastX:0,lastY:0,x:v.left,y:v.top};de.current?.(v.e,t)}else if(n){let t={node:e,deltaX:v.left-B.current.left,deltaY:v.top-B.current.top,lastX:B.current.left,lastY:B.current.top,x:v.left,y:v.top};fe.current?.(v.e,t)}V.current=v},[v,z,j]);let xe=Lt(G,w,T,E,D,z?B.current:null,oe?le.current:null),Se=Z.Children.only(t),Ce=Ft(G),we=[It(ee,Ce,i[0]),It(k,o,i[1])],Te=[It(O,Ce,i[0]),It(A,o,i[1])],Ee=Se.props,De=Ee.className,Oe=Ee.style,ke=Z.cloneElement(Se,{ref:ce,className:C(`react-grid-item`,De,y,{static:f,resizing:oe,"react-draggable":c,"react-draggable-dragging":z,dropping:!!v,cssTransforms:p}),style:{...b,...Oe,...me(xe)}}),Ae=N;return ke=(0,X.jsx)(Wr.Resizable,{draggableOpts:{disabled:!l},className:l?void 0:`react-resizable-hide`,width:xe.width,height:xe.height,minConstraints:we,maxConstraints:Te,onResizeStart:ve,onResize:ye,onResizeStop:be,transformScale:h,resizeHandles:M,handle:Ae,children:ke}),ke=(0,X.jsx)(Fr,{disabled:!c,onStart:he,onDrag:Y,onStop:ge,handle:x,cancel:`.react-resizable-handle`+(S?`,`+S:``),scale:h,allowMobileScroll:d,nodeRef:ce,children:ke}),ke}var Zr=Z.memo(Xr,(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);Zr.displayName=`GridItem`;function Qr(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},_=Ft(g),v=It(i.w,_,u[0]),y=It(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:Rt(g,D,E,i.w,i.h)}}var $r=()=>{},ei=`react-grid-layout`,ti=!1;try{ti=/firefox/i.test(navigator.userAgent)}catch{}function ni(e,t){let n=Z.Children.toArray(e),r=Z.Children.toArray(t);if(n.length!==r.length)return!1;for(let e=0;e{if(!Z.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(Zt(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:Jt(i),w:1,h:1})}});let o=tn(i,{cols:n});return r.compact(o,n)}function ii(e){let{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:a,dropConfig:o,positionStrategy:s=Sn,compactor:c,constraints:l=on,layout:u=[],droppingItem:d,autoSize:f=!0,className:p=``,style:m={},innerRef:h,onLayoutChange:g=$r,onDragStart:_=$r,onDrag:v=$r,onDragStop:y=$r,onResizeStart:b=$r,onResize:x=$r,onResizeStop:S=$r,onDrop:w=$r,onDropDragOver:T=$r}=e,E=(0,Z.useMemo)(()=>({...Cn,...r}),[r]),D=(0,Z.useMemo)(()=>({...wn,...i}),[i]),ee=(0,Z.useMemo)(()=>({...Tn,...a}),[a]),O=(0,Z.useMemo)(()=>({...En,...o}),[o]),{cols:k,rowHeight:A,maxRows:j,margin:M,containerPadding:N}=E,{enabled:P,bounded:F,handle:I,cancel:L,threshold:R,allowMobileScroll:te}=D,{enabled:ne,handles:re,handleComponent:ie}=ee,{enabled:z,defaultItem:ae,onDragOver:oe,touchEnabled:se=!0,touchDragSource:ce=`[data-rgl-draggable]`}=O,B=c??In(`vertical`),le=B.type,V=B.allowOverlap,ue=B.preventCollision??!1,de=(0,Z.useMemo)(()=>d??{i:`__dropping-elem__`,...ae},[d,ae]),fe=s.type===`transform`,H=s.scale,U=N??M,[pe,W]=(0,Z.useState)(!1),[G,K]=(0,Z.useState)(()=>ri(u,t,k,B)),[q,J]=(0,Z.useState)(null),[me,he]=(0,Z.useState)(!1),[Y,ge]=(0,Z.useState)(null),[_e,ve]=(0,Z.useState)(),ye=(0,Z.useRef)(void 0);ye.current=_e;let be=(0,Z.useRef)(null),xe=(0,Z.useRef)(null),Se=(0,Z.useRef)(null),Ce=(0,Z.useRef)(0),we=(0,Z.useRef)(G),Te=(0,Z.useRef)(u),Ee=(0,Z.useRef)(t),De=(0,Z.useRef)(le),Oe=(0,Z.useRef)(null),ke=(0,Z.useRef)(!1),Ae=(0,Z.useRef)(null),je=(0,Z.useRef)(null);je.current=Y;let Me=(0,Z.useRef)(w);(0,Z.useLayoutEffect)(()=>{Me.current=w});let Ne=(0,Z.useRef)(G);Ne.current=G,(0,Z.useEffect)(()=>{W(!0),(0,Gr.deepEqual)(G,u)||g(G)},[]),(0,Z.useEffect)(()=>{if(q||Y)return;let e=!(0,Gr.deepEqual)(u,Te.current),n=!ni(t,Ee.current),r=le!==De.current;if(e||n||r){let n=ri(e?u:G,t,k,B);(0,Gr.deepEqual)(n,G)||K(n)}Te.current=u,Ee.current=t,De.current=le},[u,t,k,le,B,q,Y,G]),(0,Z.useEffect)(()=>{if(!q&&!Y&&!(0,Gr.deepEqual)(G,we.current)){we.current=G;let e=G.filter(e=>e.i!==de.i);g(e)}},[G,q,Y,g,de.i]);let Pe=(0,Z.useMemo)(()=>{if(!f)return;let e=Jt(G),t=U[1];return e*A+(e-1)*M[1]+t*2+`px`},[f,G,A,M,U]),Fe=(0,Z.useCallback)((e,t,n,r)=>{let i=Ne.current,a=Yt(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};be.current=Zt(a),Se.current=i,J(o),_(i,a,a,null,r.e,r.node)},[_]),Ie=(0,Z.useCallback)((e,t,n,r)=>{let i=Ne.current,a=be.current,o=Yt(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=nn(i,o,t,n,!0,ue,le,k,V);v(c,a,o,s,r.e,r.node),K(B.compact(c,k)),J(s)},[ue,le,k,V,B,v]),Le=(0,Z.useCallback)((e,t,n,r)=>{if(!be.current)return;let i=Ne.current,a=be.current,o=Yt(i,e);if(!o)return;let s=nn(i,o,t,n,!0,ue,le,k,V),c=B.compact(s,k);y(c,a,o,null,r.e,r.node);let l=Se.current;be.current=null,Se.current=null,J(null),K(c),l&&!(0,Gr.deepEqual)(l,c)&&g(c)},[ue,le,k,V,B,y,g]),Re=(0,Z.useCallback)((e,t,n,r)=>{let i=Ne.current,a=Yt(i,e);a&&(xe.current=Zt(a),Se.current=i,he(!0),b(i,a,a,null,r.e,r.node))},[b]),ze=(0,Z.useCallback)((e,t,n,r)=>{let i=Ne.current,a=xe.current,{handle:o}=r,s=!1,c,l,[u,d]=en(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),ue&&!V&&Wt(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=nn(u,d,c,l,!0,ue,le,k,V));let p={w:d.w,h:d.h,x:d.x,y:d.y,i:e,static:!0};x(f,a,d,p,r.e,r.node);let m=B.compact(f,k);if(o===`n`||o===`nw`||o===`ne`){let t=m.find(t=>t.i===e);t&&(t.y=d.y)}K(m),J(p)},[ue,le,k,V,B,x]),Be=(0,Z.useCallback)((e,t,n,r)=>{let i=Ne.current,a=xe.current,o=Yt(i,e),s=B.compact(i,k);S(s,a,o??null,null,r.e,r.node);let c=Se.current;xe.current=null,Se.current=null,J(null),he(!1),K(s),c&&!(0,Gr.deepEqual)(c,s)&&g(s)},[k,B,S,g]),Ve=(0,Z.useCallback)((e,t,n,r)=>{if(r)ye.current&&(ye.current.left!==t.left||ye.current.top!==t.top)&&(ve(t),K(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{ge((0,X.jsx)(`div`,{},e.i)),ve(t);let r=Ne.current.filter(t=>t.i!==e.i);K([...r,{...e,x:n.x,y:n.y,static:!1,isDraggable:!0}])}},[]),He=(0,Z.useCallback)((e,t,r)=>{let i=Oe.current;if(!i)return;let{newDroppingPosition:a,calculatedXY:o}=Qr({clientX:e,clientY:t,gridElement:i,droppingItem:de,event:r,transformScale:H,cols:k,margin:M,maxRows:j,rowHeight:A,width:n,containerPadding:U});Ve(de,a,o,!!je.current)},[de,H,k,M,j,A,n,U,Ve]),Ue=(0,Z.useCallback)(()=>{let e=Ne.current;if(!e.some(e=>e.i===de.i)){ge(null),J(null),ve(void 0);return}let t=B.compact(e.filter(e=>e.i!==de.i),k);K(t),ge(null),J(null),ve(void 0)},[de.i,k,B]),We=(0,Z.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),ti&&!e.nativeEvent.target?.classList.contains(ei))return!1;let t=oe?oe(e.nativeEvent):T(e);if(t===!1)return Y&&Ue(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...de,...a},{newDroppingPosition:s,calculatedXY:c}=Qr({clientX:e.clientX,clientY:e.clientY,gridElement:e.currentTarget,droppingItem:o,event:e.nativeEvent,dragOffsetX:r,dragOffsetY:i,transformScale:H,cols:k,margin:M,maxRows:j,rowHeight:A,width:n,containerPadding:U});Ve(o,s,c,!!Y)},[Y,de,oe,T,Ue,Ve,H,k,M,j,A,n,U]),Ge=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Ce.current--,Ce.current<0&&(Ce.current=0),Ce.current===0&&Ue()},[Ue]),Ke=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Ce.current++},[]),qe=(0,Z.useCallback)(e=>{let t=Ne.current,n=t.find(e=>e.i===de.i);Ue(),Me.current(t,n,e)},[de.i,Ue]),Je=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Ce.current=0,qe(e.nativeEvent)},[qe]);(0,Z.useEffect)(()=>{if(!z||!se)return;let e=Oe.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(ce)!==null,r=e=>{let t=e.changedTouches;if(!t||t.length===0)return;let n=Ae.current;if(n===null)return t[0];for(let e=0;e{if(!n(e.target)||Ae.current!==null)return;e.preventDefault();let t=e.changedTouches?.[0];t&&(Ae.current=t.identifier,ke.current=!0)},a=e=>{if(!ke.current)return;e.preventDefault();let n=r(e);if(n){if(!t(n.clientX,n.clientY)){je.current&&Ue();return}He(n.clientX,n.clientY,e)}},o=e=>{if(!ke.current)return;e.preventDefault();let n=r(e);if(ke.current=!1,Ae.current=null,n){if(!t(n.clientX,n.clientY)){Ue();return}qe(e)}},s=()=>{ke.current&&(ke.current=!1,Ae.current=null,Ue())},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,se,ce,He,Ue,qe,de.i]);let Ye=(0,Z.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=Yt(G,String(e.key));if(!r)return null;let i=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&P,a=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&ne,o=r.resizeHandles||[...re],c=i&&F&&r.isBounded!==!1,u=ie;return(0,X.jsx)(Zr,{containerWidth:n,cols:k,margin:M,containerPadding:U,maxRows:j,rowHeight:A,cancel:L,handle:I,onDragStart:Fe,onDrag:Ie,onDragStop:Le,onResizeStart:Re,onResize:ze,onResizeStop:Be,isDraggable:i,isResizable:a,isBounded:c,allowMobileScroll:te,useCSSTransforms:fe&&pe,usePercentages:!pe,transformScale:H,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?_e:void 0,resizeHandles:o,resizeHandle:u,constraints:l,layoutItem:r,layout:G,children:e},r.i)},[G,n,k,M,U,j,A,L,I,Fe,Ie,Le,Re,ze,Be,P,ne,F,fe,pe,H,s,R,_e,re,ie,l]),Xe=()=>q?(0,X.jsx)(Zr,{w:q.w,h:q.h,x:q.x,y:q.y,i:q.i,className:`react-grid-placeholder ${me?`placeholder-resizing`:``}`,containerWidth:n,cols:k,margin:M,containerPadding:U,maxRows:j,rowHeight:A,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:fe,transformScale:H,constraints:l,layout:G,children:(0,X.jsx)(`div`,{})}):null,Ze=(0,Z.useCallback)(e=>{Oe.current=e,typeof h==`function`?h(e):h&&`current`in h&&(h.current=e)},[h]),Qe=C(ei,p),$e={height:Pe,...m};return(0,X.jsxs)(`div`,{ref:Ze,className:Qe,style:$e,onDrop:z?Je:void 0,onDragLeave:z?Ge:void 0,onDragEnter:z?Ke:void 0,onDragOver:z?We:void 0,children:[Z.Children.map(t,e=>Z.isValidElement(e)?Ye(e):null),z&&Y&&Ye(Y,!0),Xe()]})}var ai={lg:1200,md:996,sm:768,xs:480,xxs:0},oi={lg:12,md:10,sm:6,xs:4,xxs:2},si=()=>{};function ci(e,t,n,r,i=!1){let a=[];Z.Children.forEach(t,t=>{if(!Z.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:Jt(a),w:1,h:1})});let o=tn(a,{cols:n});return r.compact(o,n)}function li(e){let{children:t,width:n,breakpoint:r,breakpoints:i=ai,cols:a=oi,layouts:o={},rowHeight:s=150,maxRows:c=1/0,margin:l=[10,10],containerPadding:u=null,compactor:d,onBreakpointChange:f=si,onLayoutChange:p=si,onWidthChange:m=si,...h}=e,g=d??In(`vertical`),_=g.type,v=g.allowOverlap,y=(0,Z.useMemo)(()=>r??Rn(i,n),[]),b=(0,Z.useMemo)(()=>zn(y,a),[y,a]),x=(0,Z.useMemo)(()=>Bn(o,i,y,y,b,_),[]),[S,C]=(0,Z.useState)(y),[w,T]=(0,Z.useState)(b),[E,D]=(0,Z.useState)(x),[ee,O]=(0,Z.useState)(o),k=(0,Z.useRef)(n),A=(0,Z.useRef)(r),j=(0,Z.useRef)(i),M=(0,Z.useRef)(a),N=(0,Z.useRef)(o),P=(0,Z.useRef)(_),F=(0,Z.useRef)(ee);(0,Z.useEffect)(()=>{F.current=ee},[ee]);let I=(0,Z.useMemo)(()=>(0,Gr.deepEqual)(o,N.current)?null:Bn(o,i,S,S,w,g),[o,i,S,w,g]),L=I??E;(0,Z.useEffect)(()=>{I!==null&&(D(I),O(o),F.current=o,N.current=o)},[I,o]),(0,Z.useEffect)(()=>{if(_!==P.current){let e=g.compact(Qt(L),w),t={...F.current,[S]:e};D(e),O(t),F.current=t,p(e,t),P.current=_}},[_,g,L,w,v,S,p]),(0,Z.useEffect)(()=>{let e=n!==k.current,o=r!==A.current,s=!(0,Gr.deepEqual)(i,j.current),c=!(0,Gr.deepEqual)(a,M.current);if(e||o||s||c){let e=r??Rn(i,n),o=zn(e,a),d=S;if(d!==e||s||c){let n={...F.current};n[d]||(n[d]=Qt(E));let r=Bn(n,i,e,d,o,g),a=!n[e];r=ci(r,t,o,g,a),n[e]=r,C(e),T(o),D(r),O(n),F.current=n,f(e,o),p(r,n)}let h=Vn(l,e),_=u?Vn(u,e):null;m(n,h,o,_),k.current=n,A.current=r,j.current=i,M.current=a}},[n,r,i,a,S,w,E,t,g,_,v,l,u,f,p,m]);let R=(0,Z.useCallback)(e=>{let t={...F.current,[S]:e};D(e),O(t),F.current=t,p(e,t)},[S,p]),te=(0,Z.useMemo)(()=>Vn(l,S),[l,S]),ne=(0,Z.useMemo)(()=>u===null?null:Vn(u,S),[u,S]),re=(0,Z.useMemo)(()=>({cols:w,rowHeight:s,maxRows:c,margin:te,containerPadding:ne}),[w,s,c,te,ne]);return(0,X.jsx)(ii,{...h,width:n,gridConfig:re,compactor:g,onLayoutChange:R,layout:L,children:t})}var ui=Z.forwardRef(function(e,t){let{innerRef:n,...r}=e,i=n??t;return(0,X.jsx)(li,{...r,innerRef:i})});ui.displayName=`ResponsiveGridLayout`;function di(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 kt}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?kt:r?.[0]?.value??``}var fi=(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 pi(e,t,n){let r={};for(let i of e??[]){let e=di(i,t,n?.[i.name]);(i.kind!==`query`||e!==``)&&(r[i.name]=e)}return r}function mi(e){return`Explain the panel “${e.title}”`}function hi(e){return`Fix the panel “${e.title}”`}function gi(e){return[{description:`Observed panel diagnostics`,value:JSON.stringify(e)}]}var _i=(0,Z.lazy)(()=>ae(()=>import(`./panel-editor-DZGJDQzo.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]))),vi=0;function yi(e){let t;do t=`p_${Date.now().toString(36)}_${(++vi).toString(36)}_${Math.random().toString(36).slice(2,10)}`;while(e.some(e=>e.id===t));return t}function bi({dashboardId:e,version:t,spec:n,vars:r,results:i,fetching:a,annotations:o,fetchingIds:c=[],staleAt:l=new Map,time:u=n.time,onEditExit:d,editing:p,view:m,agentAvailable:h,canManage:g=!1,onOpenChat:_,onVariable:v,onRetry:y,onPoint:b,onZoom:x,onZoomReset:C,onWiden:w,zoomed:E,onView:D,onVisible:ee,onRangePending:O,shortcutScope:k,onShortcuts:A,overlayOpen:j,returnViewFocus:M}){let P=Be(),[I,L]=(0,Z.useState)(),[R,te]=(0,Z.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??Nt(e)})));(0,Z.useEffect)(()=>{te(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??Nt(e)})))},[n]);let[ne,ie]=(0,Z.useState)(()=>window.innerHeight),[z,ae]=(0,Z.useState)();(0,Z.useEffect)(()=>{let e=()=>ie(window.innerHeight);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let oe=(0,Z.useRef)(null),se=(0,Z.useRef)(new Map),B=(0,Z.useRef)(null),le=(0,Z.useRef)(null),V=()=>{let e=I?.panel?.id;L(void 0),requestAnimationFrame(()=>(le.current?.isConnected?le.current:se.current.get(e??``))?.focus())},de=(0,Z.useRef)(m);m&&(de.current=m);let[H,U]=(0,Z.useState)(0),pe=H>0,W=p&&(H>=1100?`lg`:H>=800?`md`:`sm`)==`lg`;(0,Z.useLayoutEffect)(()=>{if(!oe.current)return;U(Math.max(0,Math.round(oe.current.getBoundingClientRect().width)));let e=new ResizeObserver(([e])=>{e&&U(Math.max(0,Math.round(e.contentRect.width)))});return e.observe(oe.current),()=>e.disconnect()},[]);let G=(0,Z.useRef)(ee);G.current=ee,(0,Z.useEffect)(()=>{if(!pe||!oe.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))}m&&n.panels.some(e=>e.id===m)&&e.add(m),G.current([...e])},{rootMargin:`200px`});return oe.current.querySelectorAll(`.react-grid-item[data-panel]`).forEach(e=>t.observe(e)),()=>t.disconnect()},[n,m,pe]);let K=(0,Z.useMemo)(()=>n.panels.some(e=>{let t=R.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)}),[R,n]),q=e=>({...n,panels:e.map(e=>{let t=R.find(t=>t.i===e.id);return t?{...e,grid:{x:t.x,y:t.y,w:t.w,h:t.h}}:e})}),J=He({mutationFn:()=>Y(e,q(n.panels),t,`Edited layout`),onSuccess:t=>{P.setQueryData([`dashboard`,e],t)}}),me=He({mutationFn:r=>K?Y(e,q(n.panels.filter(e=>e.id!==r)),t,`Removed a panel and saved layout`):Te(e,[{op:`remove_panel`,id:r}],t,`Removed a panel`),onSuccess:t=>{P.setQueryData([`dashboard`,e],t)}}),he=He({mutationFn:r=>{let i={...r,id:yi(n.panels),title:`${Array.from(r.title).slice(0,73).join(``)} (copy)`,grid:void 0};if(K){let a=[...n.panels];return a.splice(a.findIndex(e=>e.id===r.id)+1,0,i),Y(e,q(a),t,`Duplicated a panel and saved layout`)}return Te(e,[{op:`add_panel`,after:r.id,panel:i}],t,`Duplicated a panel`)},onSuccess:t=>{P.setQueryData([`dashboard`,e],t)}});(0,Z.useEffect)(()=>{p||(J.reset(),me.reset(),he.reset())},[p]);let ge=()=>{J.reset(),me.reset(),he.reset(),d?.(),P.invalidateQueries({queryKey:[`dashboard`,e]})},_e=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()),ae(`Link copied`)}catch{ae(`Copy this URL: ${t.toString()}`)}},ve=`dashboard-${e}`,ye=n=>({dashboard_id:e,version:t,panel_id:n.id,title:fi(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:l.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:u}}),be=(s,d,f=!1)=>(0,X.jsx)(ce,{panel:s,title:fi(s.title,r),result:i.get(s.id),loading:a&&c.includes(s.id),height:d,group:ve,editing:W&&!f,agentAvailable:h,suspended:!f&&s.id===m,menuRef:f?B:e=>{e?se.current.set(s.id,e):se.current.delete(s.id)},compare:u.compare===`previous_period`,range:s.time?.range??u.range,annotations:o,vars:r,onVariable:v,...ue(s,i.get(s.id),v,b?e=>b(s,e):void 0),onRangePending:e=>O?.(s.id,e),onZoom:x,zoomed:E,onZoomReset:C,onWiden:w,onRetry:y?()=>y(s.id):void 0,onView:()=>D(s.id),onCopyLink:()=>{_e(s.id)},onEdit:g&&e&&(s.query||typeof s.sql==`string`)?()=>{le.current=f?B.current:se.current.get(s.id)??null,L({panel:s,spec:n,version:t})}:void 0,onExplain:h&&e?()=>_(mi(ye(s)),{answer_only:!0,context:gi(ye(s))}):void 0,onFix:h&&e&&g?()=>_(hi(ye(s)),{context:gi(ye(s))}):void 0,staleAt:l.get(s.id),onDuplicate:W&&!f?()=>he.mutate(s):void 0,onRemove:W&&!f?()=>me.mutate(s.id):void 0}),xe=n.panels.find(e=>e.id===m),Se=p?J.error??me.error??he.error:null,Ce=Se instanceof ze&&Se.code===`dashboard_version_conflict`,we=e=>{W&&te(e.map(({i:e,x:t,y:n,w:r,h:i})=>({i:e,x:t,y:n,w:r,h:i})))};return(0,X.jsxs)(`div`,{ref:oe,style:{minWidth:0},children:[p&&(0,X.jsxs)(f,{justify:`space-between`,mb:`sm`,p:`xs`,style:{border:`1px dashed var(--mantine-color-default-border)`,borderRadius:8},children:[(0,X.jsx)(N,{size:`sm`,c:`dimmed`,children:W?`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,X.jsxs)(f,{gap:`xs`,children:[g&&e&&(0,X.jsx)(F,{size:`compact-sm`,variant:`default`,onClick:e=>{le.current=e.currentTarget,L({spec:n,version:t})},children:`Add panel`}),(0,X.jsx)(F,{size:`compact-sm`,disabled:!K||!W,loading:J.isPending,onClick:()=>J.mutate(),children:`Save layout`})]})]}),Ce&&(0,X.jsx)(S,{mb:`sm`,children:(0,X.jsxs)(re,{tone:`warning`,children:[`Someone saved this dashboard since you opened it. Load the latest version, then redo your change. `,(0,X.jsx)(F,{size:`compact-sm`,onClick:ge,children:`Load latest`})]})}),Se&&!Ce&&(0,X.jsx)(S,{mb:`sm`,children:(0,X.jsx)(re,{tone:`danger`,children:Se.message})}),z&&(0,X.jsx)(S,{mb:`sm`,children:(0,X.jsx)(re,{tone:`info`,children:z})}),!pe&&(0,X.jsx)(`div`,{"data-grid-placeholder":!0,style:{height:At(Math.max(1,...R.map(e=>e.y+e.h)))}}),pe&&(0,X.jsx)(ui,{width:H,className:`dashboard-grid${W?` dashboard-grid-editing`:``}`,layouts:{lg:R,md:R,sm:R.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:An,dragConfig:{enabled:W,handle:`.panel-drag`,cancel:`button`},resizeConfig:{enabled:W},onDragStop:we,onResizeStop:we,children:n.panels.map(e=>{let t=R.find(t=>t.i===e.id);return(0,X.jsx)(`div`,{"data-panel":e.id,children:be(e,At(t?.h??6))},e.id)})}),(0,X.jsx)(fe,{shortcutScope:k,onShortcuts:A,escapeEnabled:!j&&!I,opened:!!m,onClose:()=>D(void 0),title:xe?fi(xe.title,r):`Missing panel`,returnFocusTo:()=>M?.(de.current)??se.current.get(de.current??``)??se.current.values().next().value,children:xe?(0,X.jsx)(`div`,{style:{height:`calc(100vh - 120px)`},children:be(xe,Math.max(40,ne-140),!0)}):(0,X.jsx)(S,{children:(0,X.jsx)(re,{tone:`warning`,children:`This panel is missing from the dashboard. The shared link may be out of date.`})})}),I&&e&&(0,X.jsx)(Z.Suspense,{fallback:(0,X.jsx)(s,{opened:!0,onClose:V,title:`Loading the panel editor`,children:(0,X.jsx)(T,{state:`loading`,loadingLabel:`Loading the panel editor`,rows:3})}),children:(0,X.jsx)(_i,{dashboardId:e,version:I.version,spec:q(I.spec.panels),layoutChanged:W&&K,panel:I.panel,time:u,vars:r,onClose:V})})]})}function xi({spec:e,onClose:t,onCreated:n}){let r=Be(),[i,a]=(0,Z.useState)(`${e.name} copy`),[o,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(),d=async()=>{c(!0),u(void 0);try{let t=await ye({...e,name:i.trim()});r.invalidateQueries({queryKey:Se}),n(t.id)}catch(e){u(e instanceof Error?e.message:`Duplicate failed`)}finally{c(!1)}};return(0,X.jsx)(s,{opened:!0,onClose:()=>{o||t()},title:`Duplicate dashboard`,children:(0,X.jsxs)(x,{gap:`md`,children:[(0,X.jsx)(z,{label:`New dashboard name`,value:i,onChange:e=>a(e.currentTarget.value),"data-autofocus":!0}),l&&(0,X.jsx)(S,{children:(0,X.jsx)(re,{tone:`danger`,children:l})}),(0,X.jsxs)(f,{justify:`flex-end`,gap:`xs`,children:[(0,X.jsx)(F,{variant:`default`,disabled:o,onClick:t,children:`Cancel`}),(0,X.jsx)(F,{loading:o,disabled:!i.trim()||i.trim()===e.name,onClick:()=>void d(),children:`Duplicate`})]})]})})}var Si=(e,t)=>!(t instanceof ze&&t.status<500)&&e<2,Ci=(e,t)=>!(t instanceof ze&&t.code===`timeout`)&&Si(e,t),wi=e=>({panels:e.panels.map(({grid:e,...t})=>t),variables:e.variables,time:e.time,annotations:e.annotations});function Ti(e,t,n,r,i){return[`panels`,JSON.stringify([e,wi(t),n,r,i])]}function Ei(e,t,n,r){return[`variables`,e,wi(t),n,r]}var Di=2;async function Oi(e,t,n,r=[],i=!1){let a=r.filter(t=>e.panels?.includes(t)),o=e.panels?.filter(e=>!a.includes(e)),s=a.length&&!o?.length?[]:await we(a.length?{...e,panels:o}:e,t,n,i);for(let r=0;re.reason===`busy`))break}let c=new Set(e.dashboard.panels.filter(e=>[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz)).map(e=>e.id)),l=s.filter(e=>c.has(e.id)&&e.from_ms!==void 0&&e.to_ms!==void 0&&e.from_mse.from_ms)),d=Math.max(...l.map(e=>e.to_ms));try{let e=await he({from:new Date(u).toISOString(),to:new Date(d).toISOString()},t);return{results:s,annotations:e}}catch(e){if(t?.aborted)throw e;return{results:s,annotation_error:e instanceof Error?e.message:`Annotations unavailable`}}}var ki={off:!1,"10s":1e4,"30s":3e4,"1m":6e4,"5m":3e5},Ai=0;function ji(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 Mi({dashboardId:e,spec:t,time:n,vars:r,compare:i,widths:a,visible:o,refresh:s,enabled:c=!0}){let l=(0,Z.useMemo)(()=>Object.fromEntries(Object.entries(a).map(([e,t])=>[e,Math.max(100,Math.round(t/100)*100)])),[a]),u=Ti(e,t,n,r,i),d=u[1],f=o.filter(e=>t.panels.some(t=>t.id===e)),p=(0,Z.useRef)([]),m=(0,Z.useRef)(new Set),h=(0,Z.useRef)(void 0),g=(0,Z.useRef)(null),_=(0,Z.useRef)(!1),v=(0,Z.useRef)(!1),y=(0,Z.useRef)(null),b=(0,Z.useRef)({key:d,ids:new Set}),[x,S]=(0,Z.useState)({key:d}),[C,w]=(0,Z.useState)({key:d,results:new Map,updated:new Map,stale:new Set,receivedAt:0}),T=f.length===0&&C.key===d&&C.receivedAt>0,E=c&&t.panels.some(e=>e.viz!==`text`),D=Ve({queryKey:u,queryFn:({signal:e})=>{if(T&&g.current?.key!==d)return p.current=[],Promise.resolve({results:[],hasTimePanels:!1,batch:++Ai});let a=g.current?.key===d?g.current.ids:f;p.current=(a.length?[...a]:t.panels.map(e=>e.id)).sort(),b.current.key!==d&&(b.current={key:d,ids:new Set});for(let e of p.current)b.current.ids.add(e);let o=[...p.current],s=v.current;v.current=!1;let c=m.current=new Set,u=t=>{if(e.aborted)return;c.add(t.id);let n=Date.now(),r=++Ai;w(e=>Ni(e,d,[H(t,o)],n,r))},_=C.key===d?o.filter(e=>C.results.get(e)?.reason===`busy`):[];return Oi({dashboard:t,panels:o,time:n,vars:r,widths:l,compare:i},e,u,_,s).then(e=>{let n=new Set(e.results.map(e=>e.id)),r=o.filter(e=>!n.has(e)&&!_.includes(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:++Ai,results:[...e.results.map(e=>H(e,o)),...r],hasTimePanels:t.panels.some(e=>o.includes(e.id)&&[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz))}}).catch(n=>{throw e.aborted||(h.current={key:d,ids:o.filter(e=>!c.has(e)&&t.panels.find(t=>t.id===e)?.viz!==`text`),error:n instanceof Error?n.message:String(n),retryable:!(n instanceof ze)||n.status===408||n.status===429||n.status>=500}),n})},retry:Ci,enabled:E,refetchInterval:T?!1:ki[s]??3e4,staleTime:5e3,placeholderData:e=>e}),ee=D.error&&h.current?.key===d?h.current:void 0,O=(0,Z.useMemo)(()=>Ni(C,d,D.isPlaceholderData?void 0:D.data?.results,D.dataUpdatedAt,D.data?.batch,ee),[C,d,D.data,D.dataUpdatedAt,D.isPlaceholderData,D.error,D.errorUpdatedAt]),k=O.results,A=D.isPlaceholderData?void 0:D.data?.hasTimePanels?D.data:x.key===d?x:void 0;(0,Z.useEffect)(()=>{!D.isPlaceholderData&&D.data?.hasTimePanels&&S({key:d,annotations:D.data.annotations,annotation_error:D.data.annotation_error})},[d,D.data,D.isPlaceholderData]),(0,Z.useEffect)(()=>{D.isPlaceholderData||w(e=>Ni(e,d,D.data?.results,D.dataUpdatedAt,D.data?.batch,ee))},[d,D.data,D.dataUpdatedAt,D.isPlaceholderData,D.error,D.errorUpdatedAt]);let j=new Map([...O.stale].flatMap(e=>{let t=O.updated.get(e);return t?[[e,t]]:[]})),M=(D.data?.results??[]).find(e=>e.status===`error`&&e.reason!==`busy`&&O.stale.has(e.id)),N=(D.data?.results??[]).flatMap(e=>e.reason===`busy`&&O.stale.has(e.id)?[O.updated.get(e.id)??0]:[]),P=Math.max(0,...[...O.updated].filter(([e])=>{let t=O.results.get(e);return t?.reason!==`busy`||t.frame!==void 0}).map(([,e])=>e));(0,Z.useEffect)(()=>{if(b.current.key===d)for(let e of b.current.ids)k.get(e)?.reason===`busy`&&!f.includes(e)&&b.current.ids.delete(e)},[o,d,k]),(0,Z.useEffect)(()=>{if(!E||D.isFetching||_.current||y.current?.key===d||g.current?.key===d)return;let e=b.current.key===d?b.current.ids:new Set,n=[...new Set(f.filter(n=>(!k.has(n)||k.get(n)?.reason===`busy`)&&!e.has(n)&&t.panels.find(e=>e.id===n)?.viz!==`text`))].sort();if(!n.length)return;let r={key:d,ids:n};g.current=r,D.refetch({cancelRefetch:!1}).finally(()=>{g.current===r&&(g.current=null)})},[o,E,d,D.isFetching,D.error,D.refetch,k,t.panels]),(0,Z.useEffect)(()=>{!D.isFetching&&y.current?.key!==d&&_.current&&(_.current=!1,g.current=null,E&&!T&&(v.current=!0,D.refetch({cancelRefetch:!1})))},[D.isFetching,d,E,T,D.refetch]);let F=e=>{let t={key:d,ids:e};g.current=t,D.refetch({cancelRefetch:!1}).finally(()=>{g.current===t&&(g.current=null)})};return(0,Z.useEffect)(()=>{if(D.isFetching||!y.current)return;let e=y.current;if(y.current=null,e.key!==d||!E)return;let n=[...e.ids].filter(e=>t.panels.some(t=>t.id===e&&t.viz!==`text`)&&k.get(e)?.request_error).sort();n.length&&F(n)},[D.isFetching,d,E,k,t.panels]),{retry:e=>{if(E&&t.panels.some(t=>t.id===e&&t.viz!==`text`)&&k.get(e)?.request_error){if(D.isFetching){y.current?.key!==d&&(y.current={key:d,ids:new Set}),y.current.ids.add(e);return}F([e])}},results:k,staleAt:j,annotations:A?.annotations,annotationError:A?.annotation_error,fetchingIds:D.isFetching?p.current.filter(e=>!m.current.has(e)):[],fetching:D.isFetching,error:D.error??(M?Error(M.error??`Panel refresh failed`):null),updatedAt:P||null,skippedAt:N.length?Math.min(...N):null,refetch:()=>{if(E&&!T){if(D.isFetching){g.current?.key===d&&(_.current=!0);return}v.current=!0,D.refetch({cancelRefetch:!1})}}}}function Ni(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},s=n&&i!==void 0&&(o.receivedBatch===void 0||i>o.receivedBatch);for(let e of s?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,reason:e.reason,request_error:e.request_error})):(o.results.set(e.id,e),o.updated.set(e.id,r),o.stale.delete(e.id));s&&(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,reason:void 0,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 Pi(e,t){return e.queryKey[0]===`variables`&&e.queryKey[1]===t}function Fi(e,t,n,r,i,a=!1){let o=!!t.variables?.some(e=>e.kind===`query`),s=Ve({queryKey:Ei(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 Ii(e){return t=>ji(t,e)||Pi(t,`dashboard-${e}`)}function Li({id:e,currentVersion:t,currentSpec:n,opened:r,onClose:i,onRestored:a}){let o=Be(),[s,c]=(0,Z.useState)(),[l,u]=(0,Z.useState)(),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(r),h=(0,Z.useRef)(0),g=(0,Z.useRef)(r);g.current=r;let _=(0,Z.useRef)(!1),v=(0,Z.useRef)(!1),y=(0,Z.useRef)(a);y.current=a,(0,Z.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]);let b=He({mutationFn:({version:t})=>me(e,t),retry:!1,onSuccess:(t,{version:n,generation:r})=>{o.cancelQueries({queryKey:[`dashboard`,e],exact:!0}),o.cancelQueries({predicate:Ii(e)}),o.cancelQueries({queryKey:[`exemplars`]}),o.cancelQueries({queryKey:[`drill-trace`]}),o.setQueryData([`dashboard`,e],t),o.invalidateQueries({predicate:Ii(e),refetchType:`none`}),v.current&&(g.current&&r===h.current&&u({text:`Restored v${n} as v${t.version}`}),y.current(t)),o.invalidateQueries({queryKey:Se}),o.invalidateQueries({queryKey:[`dashboard-versions`,e]},{cancelRefetch:!1}),o.invalidateQueries({queryKey:[`exemplars`],refetchType:`none`}),o.invalidateQueries({queryKey:[`drill-trace`],refetchType:`none`})},onError:t=>{t instanceof ze&&t.code===`dashboard_version_not_found`&&o.invalidateQueries({queryKey:[`dashboard-versions`,e]})},onSettled:()=>{_.current=!1,v.current&&f(!1)}}),x=()=>{h.current++,b.reset(),u(void 0)};(0,Z.useEffect)(()=>{if(r){m(!0);return}h.current++,b.reset(),u(void 0),o.cancelQueries({queryKey:[`dashboard-versions`,e]}),o.cancelQueries({queryKey:[`dashboard-version`,e]})},[r,e,o,b.reset]);let S=(0,Z.useRef)(t);return(0,Z.useEffect)(()=>{S.current!==t&&(S.current=t,o.invalidateQueries({queryKey:[`dashboard-versions`,e]},{cancelRefetch:!1}))},[t,e,o]),(0,X.jsx)(oe,{opened:r,onClose:()=>{x(),i()},onExitTransitionEnd:()=>m(!1),title:`Version history`,position:`right`,size:`xl`,children:(r||p)&&(0,X.jsx)(Ri,{id:e,opened:r,currentVersion:t,currentSpec:n,selected:s,onSelect:e=>{x(),c(e)},pending:d,error:b.error,failedVersion:b.variables?.version,success:l,onRestore:e=>{_.current||(_.current=!0,f(!0),u(void 0),b.mutate({version:e,generation:h.current}))}})})}function Ri({id:e,opened:t,currentVersion:n,currentSpec:r,selected:a,onSelect:o,pending:s,error:c,failedVersion:l,success:u,onRestore:d}){let p=Ve({queryKey:[`dashboard-versions`,e],queryFn:({signal:t})=>_e(e,t),enabled:t,retry:!1}),m=a??p.data?.[0]?.version,h=Ve({queryKey:[`dashboard-version`,e,m],queryFn:({signal:t})=>Ce(e,m,t),enabled:t&&m!==void 0,retry:!1}),g=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{u&&g.current?.focus()},[u]),(0,X.jsxs)(x,{gap:`md`,"data-version-history":!0,children:[(0,X.jsx)(N,{size:`sm`,c:`dimmed`,children:`Inspect saved specs and changes. Restoring adds a new version.`}),u&&(0,X.jsx)(S,{ref:g,tabIndex:-1,role:`note`,children:(0,X.jsx)(re,{live:!1,tone:`success`,children:u.text})}),c&&l===m&&(0,X.jsx)(Hi,{error:c,version:m}),(0,X.jsxs)(S,{mih:160,children:[p.isPending&&(0,X.jsx)(T,{state:`loading`,loadingLabel:`Loading history…`,rows:3}),p.error&&(0,X.jsx)(S,{children:(0,X.jsxs)(re,{tone:`danger`,title:`History unavailable`,children:[p.error.message,(0,X.jsx)(F,{mt:`xs`,variant:`default`,size:`xs`,onClick:()=>void p.refetch(),children:`Retry history`})]})}),p.data?.length===0&&(0,X.jsx)(T,{state:`empty`,empty:{title:`No versions available.`,description:`Version history appears after a dashboard is saved.`,action:(0,X.jsx)(F,{variant:`default`,onClick:()=>void p.refetch(),children:`Retry history`})}}),!!p.data?.length&&(0,X.jsx)(L,{h:200,type:`auto`,children:(0,X.jsx)(x,{gap:`xs`,pr:`sm`,role:`list`,"aria-label":`Saved versions`,children:p.data.map(e=>(0,X.jsxs)(i,{role:`listitem`,withBorder:!0,p:`xs`,radius:`sm`,style:{borderColor:m===e.version?`var(--mantine-color-accent-filled)`:void 0},children:[(0,X.jsxs)(f,{justify:`space-between`,gap:`xs`,children:[(0,X.jsxs)(F,{color:`accent`,variant:m===e.version?`light`:`subtle`,size:`compact-sm`,"aria-pressed":m===e.version,onClick:()=>o(e.version),children:[`Version `,e.version]}),e.version===n&&(0,X.jsx)(k,{tone:`neutral`,children:`Current`}),(0,X.jsx)(Bi,{at:e.created_at})]}),(0,X.jsxs)(N,{size:`xs`,c:`dimmed`,mt:4,children:[zi(e),` · `,e.message||`No edit message`]})]},e.version))})})]}),(0,X.jsx)(O,{role:`status`,"aria-live":`polite`,children:m===void 0?`Select a version.`:h.isFetching?`Loading version ${m}…`:h.error?`Version ${m} unavailable.`:`Version ${m} ready.`}),(0,X.jsxs)(S,{mih:280,"aria-busy":h.isFetching,children:[m!==void 0&&h.isPending&&(0,X.jsx)(T,{state:`loading`,loadingLabel:`Loading version…`,rows:3}),h.error&&(0,X.jsx)(S,{children:(0,X.jsxs)(re,{tone:`danger`,title:h.error instanceof ze&&h.error.code===`dashboard_version_not_found`?`This version is no longer available`:`Version unavailable`,children:[h.error.message,(0,X.jsx)(F,{mt:`xs`,variant:`default`,size:`xs`,onClick:()=>void h.refetch(),children:`Retry version`})]})}),h.data&&!h.error&&(0,X.jsx)(Vi,{record:h.data,currentVersion:n,current:JSON.stringify(h.data.dashboard.spec)===JSON.stringify(r),pending:s,onRestore:()=>d(h.data.dashboard.version)})]})]})}function zi(e){return e.author_kind===`agent`?`Agent`:e.author_kind===`user`?`You`:`System`}function Bi({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,X.jsx)(N,{component:`time`,dateTime:e,title:De(e),size:`xs`,c:`dimmed`,children:new Intl.RelativeTimeFormat(void 0,{numeric:`auto`}).format(Math.round(t/n),r)})}function Vi({record:e,currentVersion:t,current:n,pending:r,onRestore:i}){let{dashboard:a}=e,o=Ue(e);return(0,X.jsxs)(x,{gap:`sm`,"data-history-version":a.version,children:[(0,X.jsxs)(f,{justify:`space-between`,align:`flex-start`,children:[(0,X.jsxs)(S,{miw:0,children:[(0,X.jsxs)(b,{order:2,fz:`lg`,children:[a.name,` · v`,a.version]}),(0,X.jsxs)(N,{size:`sm`,c:`dimmed`,children:[zi(e),` · `,e.message||`No edit message`]}),(0,X.jsx)(Bi,{at:e.created_at})]}),a.version===t?(0,X.jsx)(F,{size:`sm`,variant:`default`,disabled:!0,children:`Current version`}):n?(0,X.jsx)(F,{size:`sm`,variant:`default`,disabled:!0,children:`Same as current`}):(0,X.jsxs)(F,{size:`sm`,disabled:r,loading:r,onClick:i,children:[`Restore version `,a.version]})]}),a.description&&(0,X.jsx)(N,{size:`sm`,children:a.description}),e.changes_available?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ye,{labels:o}),!o.length&&!e.layout_changed&&(0,X.jsx)(T,{state:`empty`,empty:{title:`No authored changes.`}})]}):(0,X.jsx)(S,{children:(0,X.jsx)(re,{tone:`warning`,title:`Changes unavailable`,children:`The preceding version is no longer retained. This saved spec is still available.`})}),(0,X.jsxs)(N,{size:`sm`,c:`dimmed`,children:[`Read-only · `,a.spec.panels.length,` panels. Historical data is not queried.`]}),(0,X.jsxs)(ot,{variant:`contained`,children:[(0,X.jsxs)(ot.Item,{value:`spec`,children:[(0,X.jsx)(ot.Control,{children:`Spec`}),(0,X.jsx)(ot.Panel,{children:(0,X.jsx)(Le,{block:!0,tabIndex:0,style:{maxHeight:320,overflow:`auto`},children:JSON.stringify(a.spec,null,2)})})]}),(0,X.jsxs)(ot.Item,{value:`data`,children:[(0,X.jsx)(ot.Control,{children:`Data`}),(0,X.jsx)(ot.Panel,{children:(0,X.jsx)(x,{gap:`xs`,children:a.spec.panels.map(e=>(0,X.jsxs)(S,{children:[(0,X.jsxs)(N,{size:`sm`,fw:500,children:[e.title,` · `,e.viz]}),(0,X.jsx)(Le,{block:!0,tabIndex:0,children:e.content??e.sql??JSON.stringify(e.query??{},null,2)})]},e.id))})})]})]})]})}function Hi({error:e,version:t}){let n=e instanceof ze?e.code:void 0,r=!(e instanceof ze)||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.`:n===`already_current`?`The dashboard already has this version's contents, so there is nothing to restore.`:[`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,X.jsx)(S,{children:(0,X.jsxs)(re,{tone:`danger`,title:`Restore of version ${t} failed`,children:[(0,X.jsx)(N,{size:`sm`,children:e.message}),e instanceof ze&&e.problems.length>0&&(0,X.jsx)(`ul`,{children:e.problems.map((e,t)=>(0,X.jsxs)(`li`,{children:[e.path,`: `,e.message,e.hint?` (${e.hint})`:``]},t))}),(0,X.jsx)(N,{size:`sm`,mt:`xs`,children:r})]})})}function Ui(e,t){let n=JSON.stringify([e.range,e.from,e.to]),r=(0,Z.useRef)({search:e,onSearch:t,scope:n}),i=(0,Z.useRef)(``),a=(0,Z.useRef)(void 0),[o,s]=(0,Z.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,Z.useCallback)(()=>{i.current=``,a.current=void 0,s(!1)},[]),l=(0,Z.useCallback)(()=>{if(!a.current)return;let e=a.current;c(),r.current.onSearch({...r.current.search,...e},!1)},[c]);return{zoom:(0,Z.useCallback)((e,t)=>{let n=U(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 Wi({variables:e,vars:t,options:n,onChange:r}){return e.length===0?null:(0,X.jsx)(f,{gap:`sm`,wrap:`wrap`,role:`group`,"aria-label":`Dashboard variables`,children:e.map(e=>{let i=di(e,t,n[e.name]),a=[...e.include_all?[{value:kt,label:`All`}]:[],...(n[e.name]??e.options?.map(e=>({value:e}))??[]).map(e=>({value:e.value,label:e.value}))],o=(0,X.jsxs)(N,{size:`sm`,c:`dimmed`,ff:`monospace`,children:[`$`,e.name]});return e.kind===`constant`?(0,X.jsx)(z,{label:o,size:`sm`,value:e.value,readOnly:!0,w:160},e.name):e.kind===`text`?(0,X.jsx)(z,{label:o,size:`sm`,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,X.jsx)(Dt,{label:o,size:`sm`,w:260,searchable:!0,clearable:!0,data:a.filter(e=>e.value!==kt),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?kt:[])},e.name):(0,X.jsx)(le,{label:o,size:`sm`,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 Gi(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 Ki(e,t,n={}){let r=(0,Z.useRef)({actions:t,options:n});r.current={actions:t,options:n},(0,Z.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=Gi(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 qi({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,X.jsx)(s,{opened:e,onClose:t,title:`Keyboard shortcuts`,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,children:(0,X.jsxs)(x,{gap:`xs`,children:[(0,X.jsx)(Me,{label:`Single-key shortcuts`,checked:r,onChange:e=>i(e.currentTarget.checked)}),a.map(([e,t])=>(0,X.jsxs)(f,{gap:`sm`,children:[(0,X.jsx)(Ke,{children:e}),(0,X.jsx)(N,{size:`sm`,children:t})]},e)),!n&&(0,X.jsx)(N,{size:`sm`,children:`Focus a chart or a panel control before pressing f. Without a focused panel, f does nothing.`}),(0,X.jsx)(N,{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,X.jsx)(N,{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,X.jsxs)(N,{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,X.jsx)(N,{size:`sm`,children:`The global / shortcut focuses the chat composer.`})]})})}function Ji(e){let t=`fanout:single-key-shortcuts:`+e,n=()=>{try{return localStorage.getItem(t)!==`off`}catch{return!0}},[r,i]=(0,Z.useState)(n);return(0,Z.useEffect)(()=>{i(n())},[t]),(0,Z.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 Yi(e){let t=(0,Z.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,Z.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 Xi=(0,Z.lazy)(()=>ae(()=>import(`./new-dashboard-xnHgERfr.js`).then(e=>({default:e.NewDashboard})),__vite__mapDeps([25,1,2,3,4,5,6,7,8,22,10,11,12,13,14,15,16,17,18,19,20,21,23,9,24]))),Zi={exemplars:K,trace:ge,span:V},Qi={"5m":`15m`,"15m":`1h`,"1h":`3h`,"3h":`6h`,"6h":`12h`,"12h":`24h`,"24h":`2d`,"2d":`7d`,"7d":`30d`,"30d":`30d`};function $i({dashboardId:e,search:t,onSearch:n,onOpen:r}){let{agentAvailable:i,openChat:a}=qe(),[o,s]=(0,Z.useState)(!1),c=Ve({queryKey:Se,queryFn:Ee,staleTime:15e3});(0,Z.useEffect)(()=>{!e&&c.data?.length&&r((c.data.find(e=>e.is_default)??c.data[0]).id,!0)},[e,c.data]);let l=Ve({queryKey:[`dashboard`,e],queryFn:({signal:t})=>be(e,t),enabled:!!e,retry:(e,t)=>!(t instanceof ze&&t.code===`not_found`)&&e<2});return!e&&c.error?(0,X.jsxs)(x,{p:`lg`,children:[(0,X.jsx)(A,{title:`Dashboards`,description:`Monitor your services and investigate changes.`}),(0,X.jsx)(T,{state:`error`,error:{title:`Dashboards could not be loaded`,message:c.error.message,onRetry:()=>void c.refetch()}})]}):!e&&c.data?.length===0?(0,X.jsx)(_,{mih:`50vh`,children:(0,X.jsxs)(x,{align:`center`,gap:`xs`,children:[(0,X.jsx)(A,{title:`Dashboards`,description:`Create a dashboard to explore your services.`}),(0,X.jsx)(T,{state:`empty`,empty:{title:(0,X.jsx)(b,{order:2,fz:`lg`,children:`No dashboards yet`}),description:`Create a dashboard to see your telemetry.`,action:(0,X.jsx)(F,{size:`sm`,onClick:()=>s(!0),children:`New dashboard`})}}),(0,X.jsx)(f,{mt:`sm`,gap:`xs`,children:i&&(0,X.jsx)(F,{size:`sm`,variant:`default`,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`})}),o&&(0,X.jsx)(Z.Suspense,{fallback:null,children:(0,X.jsx)(Xi,{onClose:()=>s(!1),onCreated:e=>{s(!1),r(e)}})})]})}):!e||l.isLoading?(0,X.jsx)(S,{component:`section`,"aria-label":`Dashboard`,maw:1600,mx:`auto`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,children:(0,X.jsx)(T,{state:`loading`,loadingLabel:`Loading dashboard`,skeleton:(0,X.jsx)(Pt,{})})}):l.error instanceof ze&&l.error.code===`not_found`?(0,X.jsx)(_,{mih:`50vh`,children:(0,X.jsxs)(x,{align:`center`,gap:`xs`,children:[(0,X.jsx)(A,{title:`Dashboard`,description:`Monitor your services and investigate changes.`}),(0,X.jsx)(T,{state:`empty`,empty:{title:(0,X.jsx)(b,{order:2,fz:`lg`,children:`This dashboard isn't here`}),description:`The link may be out of date, or the dashboard may have been deleted.`,action:c.data?.length?(0,X.jsx)(F,{variant:`default`,size:`sm`,onClick:()=>r((c.data.find(e=>e.is_default)??c.data[0]).id,!0),children:`Open your default dashboard`}):void 0}})]})}):l.error||!l.data?(0,X.jsxs)(x,{p:`lg`,children:[(0,X.jsx)(A,{title:`Dashboard`,description:`Monitor your services and investigate changes.`}),(0,X.jsx)(T,{state:`error`,error:{message:`Your dashboard is unavailable.`,onRetry:()=>void l.refetch()}})]}):(0,X.jsx)(ea,{id:l.data.id,version:l.data.version,spec:l.data.spec,search:t,onSearch:n,onOpen:r,agentAvailable:i,openChat:a},l.data.id)}function ea({id:e,version:t,spec:n,search:r,onSearch:i,onOpen:a,agentAvailable:o,openChat:s}){let[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(!1);Ge((0,Z.useCallback)(()=>m(!0),[]));let h=(0,Z.useRef)(null),g=(0,Z.useId)(),_=Ji(Re().id),v=Yi(h),[y,b]=(0,Z.useState)(()=>new Set),C=(0,Z.useCallback)((e,t)=>b(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r}),[]),w=Be(),[E,D]=(0,Z.useState)(),{zoom:ee,reset:O,resetZoom:k,zoomed:j}=Ui(r,i),M=xe(n,r),[N,P]=(0,Z.useState)(M.refresh??`30s`),I=()=>{if(M.from&&M.to){let e=Date.parse(M.from),t=Date.parse(M.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:Qi[M.range??`1h`]??`1h`,from:void 0,to:void 0})},L=r.compare?r.compare===`1`:n.time.compare===`previous_period`,R=r.vars??{},ie=Fi(`dashboard-${e}`,n,M,R,q,Si),z=(0,Z.useMemo)(()=>pi(n.variables,R,ie.currentData),[n.variables,R,ie.currentData]),[ae,oe]=(0,Z.useState)(()=>window.innerWidth);(0,Z.useEffect)(()=>{let e=0,t=()=>{window.clearTimeout(e),e=window.setTimeout(()=>oe(window.innerWidth),300)};return window.addEventListener(`resize`,t),()=>{window.removeEventListener(`resize`,t),window.clearTimeout(e)}},[]);let se=(0,Z.useMemo)(()=>{let e=Math.max(320,Math.min(ae-64,1600));return Object.fromEntries(n.panels.map(t=>[t.id,e/12*(t.grid?.w??t.width??6)]))},[ae,n]),[ce,le]=(0,Z.useState)(()=>n.panels.map(e=>e.id)),V=Mi({dashboardId:e,version:t,spec:n,time:M,vars:z,compare:L,widths:se,visible:(0,Z.useMemo)(()=>ce.filter(e=>n.panels.some(t=>t.id===e)),[ce,n.panels]),refresh:y.size?`off`:N,enabled:ie.ready});(0,Z.useEffect)(()=>{E===t&&w.refetchQueries({predicate:Ii(e),type:`active`,stale:!0},{cancelRefetch:!1})},[E,t,e,w]);let ue=(0,Z.useMemo)(()=>V.annotations?{...V.annotations,deploys:n.annotations?.deploys===!1?[]:V.annotations.deploys,anomalies:n.annotations?.anomalies===!1?[]:V.annotations.anomalies}:void 0,[V.annotations,n.annotations?.deploys,n.annotations?.anomalies]),fe=ie.error??V.error,H=(e,t)=>{let n={...R};t===void 0?delete n[e]:n[e]=t,i({...r,vars:n},!0)},U=()=>i({...r,edit:r.edit===`1`?void 0:`1`}),W=e=>{e&&v.remember(e),i({...r,view:e},e===void 0)};return Ki(h,{r:()=>V.refetch(),e:U,h:()=>d(!0),"?":()=>m(!0),f:e=>{if(r.view){W();return}let t=e.closest(`[data-panel]`)?.dataset.panel;t&&n.panels.some(e=>e.id===t)&&W(t)}},{modalOpen:u||p||!!r.drill,fullscreenScope:r.view?g:void 0,enabled:_.enabled}),(0,X.jsxs)(S,{component:`section`,ref:h,"aria-label":`Dashboard`,maw:1600,mx:`auto`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,children:[(0,X.jsxs)(x,{gap:`sm`,mb:`md`,children:[(0,X.jsx)(A,{title:n.name,description:n.description||`Monitor your services and investigate changes.`,meta:(0,X.jsx)(Ie,{time:M,updatedAt:V.updatedAt}),actions:(0,X.jsx)(f,{gap:`xs`,children:(0,X.jsx)(We,{label:`Duplicate dashboard`,children:(0,X.jsx)(te,{variant:`subtle`,color:`gray`,"aria-label":`Duplicate dashboard`,onClick:()=>l(!0),children:(0,X.jsx)(ne,{size:16})})})})}),(0,X.jsx)(de,{selecting:y.size>0,time:M,refresh:N,compare:L,editing:r.edit===`1`,fetching:V.fetching,updatedAt:V.updatedAt,onRange:e=>{O(),i({...r,range:e,from:void 0,to:void 0})},onAbsolute:(e,t)=>{O(),i({...r,range:void 0,from:e,to:t})},onZoomOut:I,onRefresh:P,onRefreshNow:V.refetch,onCompare:e=>i({...r,compare:e?`1`:`0`},!0),onEdit:U,onHistory:()=>d(!0)}),(0,X.jsx)(Wi,{variables:n.variables??[],vars:R,options:ie.data??{},onChange:H}),Object.entries(R).filter(([,e])=>e!==`$__all`).length>0&&(0,X.jsx)(f,{gap:6,children:Object.entries(R).filter(([,e])=>e!==`$__all`).map(([e,t])=>(0,X.jsxs)(F,{color:`accent`,size:`compact-xs`,variant:`light`,"aria-label":`$${e} = ${Array.isArray(t)?t.join(`, `):t} ×: remove filter`,onClick:()=>H(e,void 0),children:[`$`,e,` = `,Array.isArray(t)?t.join(`, `):t,` ×`]},e))}),V.annotationError&&(0,X.jsx)(re,{tone:`warning`,title:`Annotations unavailable`,children:V.annotationError}),V.annotations?.truncated&&(0,X.jsx)(re,{tone:`warning`,children:`Annotation history is limited.`})]}),!fe&&V.skippedAt!==null&&(0,X.jsx)(S,{"data-refresh-skipped":!0,children:(0,X.jsxs)(re,{tone:`info`,children:[`The server was busy, so the latest refresh was skipped. Marked panels show data from `,new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`,second:`2-digit`}).format(V.skippedAt),`.`]})}),fe&&(0,X.jsxs)(re,{tone:`danger`,title:ie.error?`Variables could not be loaded`:`Panels could not be loaded`,children:[fe.message,fe instanceof ze&&(0,X.jsx)(`ul`,{children:fe.problems.map((e,t)=>(0,X.jsxs)(`li`,{children:[e.path,`: `,e.message,e.hint?` (${e.hint})`:``]},t))})]}),n.panels.length===0&&(0,X.jsx)(T,{state:`empty`,empty:{title:`No panels yet`,description:`Add a panel to see telemetry on this dashboard.`,action:(0,X.jsx)(F,{onClick:()=>i({...r,edit:`1`}),children:`Add panel`})}}),(0,X.jsx)(bi,{dashboardId:e,version:t,spec:n,vars:z,results:V.results,annotations:ue,fetching:V.fetching,fetchingIds:V.fetchingIds,staleAt:V.staleAt,time:{...M,compare:L?`previous_period`:void 0},onEditExit:()=>i({...r,edit:void 0}),editing:r.edit===`1`,view:r.view,canManage:!0,agentAvailable:o,onOpenChat:s,onRetry:V.retry,onVariable:H,onZoom:ee,zoomed:j,onZoomReset:k,onWiden:I,onView:W,onRangePending:C,shortcutScope:g,onShortcuts:()=>m(!0),overlayOpen:u||p||!!r.drill,returnViewFocus:v.restore,onVisible:le,onPoint:(e,t)=>{let n=B(e,V.results.get(e.id),t,R);n&&i({...r,vars:n.vars,drill:JSON.stringify(n.target)},!1)}}),(0,X.jsx)(pe,{client:Zi,spec:n,time:M,vars:z,target:ve(r.drill),onChange:e=>i({...r,drill:e?JSON.stringify(e):void 0},!1)}),c&&(0,X.jsx)(xi,{spec:n,onClose:()=>l(!1),onCreated:e=>{l(!1),a(e)}}),(0,X.jsx)(Li,{id:e,currentVersion:t,currentSpec:n,opened:u,onClose:()=>d(!1),onRestored:e=>{D(e.version);let t=new Set(e.spec.panels.map(e=>e.id)),n=ve(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,X.jsx)(qi,{opened:p,onClose:()=>m(!1),fullscreen:!!r.view,enabled:_.enabled,onEnabled:_.change})]})}export{kt as n,$i as t}; \ No newline at end of file +`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&ce(e.body,`react-draggable-transparent-selection`)}function oe(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{se(e)}):se(e)}function se(e){if(e)try{e.body&&B(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 ce(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function B(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:pe(r);let i=W(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:I(a)-P(i)-i.offsetLeft+S(s.paddingRight)-S(o.marginRight),bottom:F(a)-N(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 V(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function ue(e){return e.props.axis===`both`||e.props.axis===`x`}function de(e){return e.props.axis===`both`||e.props.axis===`y`}function fe(e,t,n){let r=typeof t==`number`?re(e,t):null;if(typeof t==`number`&&!r)return null;let i=W(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return L(r||e,a,n.props.scale)}function H(e,t,n){let r=!x(e.lastX),i=W(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 U(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 pe(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function W(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var G=f(t()),K=f(Gn()),q=f(a()),J=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},me={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},he=me.mouse,Y=class extends G.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&&!A(e.target,this.props.handle,t)||this.props.cancel&&A(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=ie(e);this.touchIdentifier=r;let i=fe(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=H(this,a,o);J(`DraggableCore: handleDragStart: %j`,s),J(`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,j(n,he.move,this.handleDrag),j(n,he.stop,this.handleDragStop))},this.handleDrag=e=>{let t=fe(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]=V(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=H(this,n,r);if(J(`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=fe(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]=V(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=H(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&oe(a.ownerDocument),J(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(J(`DraggableCore: Removing handlers`),M(a.ownerDocument,he.move,this.handleDrag),M(a.ownerDocument,he.stop,this.handleDragStop))},this.onMouseDown=e=>(he=me.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(he=me.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(he=me.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(he=me.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&j(e,me.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;M(t,me.mouse.move,this.handleDrag),M(t,me.touch.move,this.handleDrag),M(t,me.mouse.stop,this.handleDragStop),M(t,me.touch.stop,this.handleDragStop),M(e,me.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&oe(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=q.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(J(`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 G.cloneElement(G.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Y.displayName=`DraggableCore`,Y.propTypes={allowAnyClick:K.default.bool,allowMobileScroll:K.default.bool,children:K.default.node.isRequired,disabled:K.default.bool,enableUserSelectHack:K.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:K.default.arrayOf(K.default.number),handle:K.default.string,cancel:K.default.string,nodeRef:K.default.object,nonce:K.default.string,onStart:K.default.func,onDrag:K.default.func,onStop:K.default.func,onMouseDown:K.default.func,scale:K.default.number,className:C,style:C,transform:C},Y.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var ge=class extends h.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(J(`Draggable: onDragStart: %j`,t),this.props.onStart(e,U(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;J(`Draggable: onDrag: %j`,t);let n=U(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,U(this,t))===!1)return!1;J(`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)?(J(`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=_.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,g={x:ue(this)&&p?this.state.x:m.x,y:de(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=te(g,c):d=R(g,c);let _=h.Children.only(n),y=(0,v.clsx)(_.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return h.createElement(Y,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},h.cloneElement(_,{className:y,style:{..._.props.style,...d},transform:f}))}};ge.displayName=`Draggable`,ge.propTypes={...Y.propTypes,axis:g.default.oneOf([`both`,`x`,`y`,`none`]),bounds:g.default.oneOfType([g.default.shape({left:g.default.number,right:g.default.number,top:g.default.number,bottom:g.default.number}),g.default.string,g.default.oneOf([!1])]),defaultClassName:g.default.string,defaultClassNameDragging:g.default.string,defaultClassNameDragged:g.default.string,defaultPosition:g.default.shape({x:g.default.number,y:g.default.number}),positionOffset:g.default.shape({x:g.default.oneOfType([g.default.number,g.default.string]),y:g.default.oneOfType([g.default.number,g.default.string])}),position:g.default.shape({x:g.default.number,y:g.default.number}),className:C,style:C,transform:C},ge.defaultProps={...Y.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:Y})})),zr=e(((e,t)=>{var n=Rr(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),Br=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(Gn());zr();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)}}})),Hr=e((e=>{e.__esModule=!0,e.default=void 0;var n=s(t()),r=zr(),i=Br(),a=Vr(),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}})),Ur=e((e=>{e.__esModule=!0,e.default=void 0;var n=c(t()),r=s(Gn()),i=s(Hr()),a=Vr(),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})})),Wr=e(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=Hr().default,t.exports.ResizableBox=Ur().default}))(),Gr=Hn(),Kr=50,qr=12;function Jr(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 Yr(e){let t=Jr(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=-qr:i>s.bottom-Kr&&l+c0?h=-qr:r>s.right-Kr&&d+p({cols:n,containerPadding:a,containerWidth:r,margin:i,maxRows:s,rowHeight:o}),[n,a,r,i,s,o]),K=(0,Z.useMemo)(()=>({cols:n,maxRows:s,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,s,r,o,i]),q=(0,Z.useCallback)(e=>({...K,containerHeight:e??K.containerHeight,layout:ue.current}),[K]),J=(0,Z.useMemo)(()=>F??{i:j,x:w,y:T,w:E,h:D,minW:ee,maxW:O,minH:k,maxH:A},[F,j,w,T,E,D,ee,O,k,A]),me=(0,Z.useCallback)(e=>{if(g?.calcStyle)return g.calcStyle(e);if(p)return ln(e);let t=un(e);return m?{...t,left:dn(e.left/r),width:dn(e.width/r)}:t},[g,p,m,r]),he=(0,Z.useCallback)((e,{node:t})=>{if(!L)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(B.current=l,W.current||=Yr(t instanceof HTMLElement?t:null),_>0){let t=e;U.current={x:t.clientX,y:t.clientY},H.current=!0,pe.current=!1,ae(!0);return}ae(!0);let u=zt(G,l.top,l.left),{x:d,y:f}=sn(P,J,u.x,u.y,q());L(j,d,f,{e,node:t,newPosition:l})},[L,h,G,g,_,P,J,q,j]),Y=(0,Z.useCallback)((e,{node:t,deltaX:n,deltaY:a})=>{if(!R||!z)return;let s=e;if(H.current&&!pe.current){let n=s.clientX-U.current.x,r=s.clientY-U.current.y;if(Math.hypot(n,r)<_)return;if(pe.current=!0,H.current=!1,L){let n=zt(G,B.current.top,B.current.left),{x:r,y:i}=sn(P,J,n.x,n.y,q());L(j,r,i,{e,node:t,newPosition:B.current})}}W.current?.feed(s.clientX,s.clientY);let c=B.current.top+a,l=B.current.left+n;if(u){let{offsetParent:e}=t;if(e){let t=e.clientHeight-It(D,o,i[1]);c=Vt(c,0,t);let n=Ft(G),a=r-It(E,n,i[0]);l=Vt(l,0,a)}}let d={top:c,left:l};B.current=d;let f=zt(G,c,l),{x:p,y:m}=sn(P,J,f.x,f.y,q());R(j,p,m,{e,node:t,newPosition:d})},[R,L,z,_,u,D,o,i,G,r,E,j,P,J,q]),ge=(0,Z.useCallback)((e,{node:t})=>{if(!te||!z)return;W.current?.stop(),W.current=null;let n=H.current;if(H.current=!1,pe.current=!1,U.current={x:0,y:0},n){ae(!1),B.current={left:0,top:0};return}let{left:r,top:i}=B.current,a={top:i,left:r};ae(!1),B.current={left:0,top:0};let o=zt(G,i,r),{x:s,y:c}=sn(P,J,o.x,o.y,q());te(j,s,c,{e,node:t,newPosition:a})},[te,z,G,P,J,q,j]);de.current=he,fe.current=Y;let _e=(0,Z.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?xn(i,a,n,r):{...n,top:a.top,left:a.left},le.current=c;let l=t?.offsetParent?.clientHeight??0,u=Bt(G,c.width,c.height),{w:d,h:f}=cn(P,J,u.w,u.h,i,q(l));s(j,d,f,{e:e.nativeEvent??e,node:t,size:c,handle:i})},[ne,re,ie,r,G,j,P,J,q]),ve=(0,Z.useCallback)((e,t)=>{se(!0);let n=Lt(G,w,T,E,D),r={...t,handle:t.handle};_e(e,r,n,`onResizeStart`)},[_e,G,w,T,E,D]),ye=(0,Z.useCallback)((e,t)=>{let n=Lt(G,w,T,E,D),r={...t,handle:t.handle};_e(e,r,n,`onResize`)},[_e,G,w,T,E,D]),be=(0,Z.useCallback)((e,t)=>{se(!1),le.current={top:0,left:0,width:0,height:0};let n=Lt(G,w,T,E,D),r={...t,handle:t.handle};_e(e,r,n,`onResizeStop`)},[_e,G,w,T,E,D]);(0,Z.useEffect)(()=>{if(!v)return;let e=ce.current;if(!e)return;let t=V.current||{left:0,top:0},n=z&&(v.left!==t.left||v.top!==t.top);if(!z){let t={node:e,deltaX:v.left,deltaY:v.top,lastX:0,lastY:0,x:v.left,y:v.top};de.current?.(v.e,t)}else if(n){let t={node:e,deltaX:v.left-B.current.left,deltaY:v.top-B.current.top,lastX:B.current.left,lastY:B.current.top,x:v.left,y:v.top};fe.current?.(v.e,t)}V.current=v},[v,z,j]);let xe=Lt(G,w,T,E,D,z?B.current:null,oe?le.current:null),Se=Z.Children.only(t),Ce=Ft(G),we=[It(ee,Ce,i[0]),It(k,o,i[1])],Te=[It(O,Ce,i[0]),It(A,o,i[1])],Ee=Se.props,De=Ee.className,Oe=Ee.style,ke=Z.cloneElement(Se,{ref:ce,className:C(`react-grid-item`,De,y,{static:f,resizing:oe,"react-draggable":c,"react-draggable-dragging":z,dropping:!!v,cssTransforms:p}),style:{...b,...Oe,...me(xe)}}),Ae=N;return ke=(0,X.jsx)(Wr.Resizable,{draggableOpts:{disabled:!l},className:l?void 0:`react-resizable-hide`,width:xe.width,height:xe.height,minConstraints:we,maxConstraints:Te,onResizeStart:ve,onResize:ye,onResizeStop:be,transformScale:h,resizeHandles:M,handle:Ae,children:ke}),ke=(0,X.jsx)(Fr,{disabled:!c,onStart:he,onDrag:Y,onStop:ge,handle:x,cancel:`.react-resizable-handle`+(S?`,`+S:``),scale:h,allowMobileScroll:d,nodeRef:ce,children:ke}),ke}var Zr=Z.memo(Xr,(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);Zr.displayName=`GridItem`;function Qr(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},_=Ft(g),v=It(i.w,_,u[0]),y=It(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:Rt(g,D,E,i.w,i.h)}}var $r=()=>{},ei=`react-grid-layout`,ti=!1;try{ti=/firefox/i.test(navigator.userAgent)}catch{}function ni(e,t){let n=Z.Children.toArray(e),r=Z.Children.toArray(t);if(n.length!==r.length)return!1;for(let e=0;e{if(!Z.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(Zt(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:Jt(i),w:1,h:1})}});let o=tn(i,{cols:n});return r.compact(o,n)}function ii(e){let{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:a,dropConfig:o,positionStrategy:s=Sn,compactor:c,constraints:l=on,layout:u=[],droppingItem:d,autoSize:f=!0,className:p=``,style:m={},innerRef:h,onLayoutChange:g=$r,onDragStart:_=$r,onDrag:v=$r,onDragStop:y=$r,onResizeStart:b=$r,onResize:x=$r,onResizeStop:S=$r,onDrop:w=$r,onDropDragOver:T=$r}=e,E=(0,Z.useMemo)(()=>({...Cn,...r}),[r]),D=(0,Z.useMemo)(()=>({...wn,...i}),[i]),ee=(0,Z.useMemo)(()=>({...Tn,...a}),[a]),O=(0,Z.useMemo)(()=>({...En,...o}),[o]),{cols:k,rowHeight:A,maxRows:j,margin:M,containerPadding:N}=E,{enabled:P,bounded:F,handle:I,cancel:L,threshold:R,allowMobileScroll:te}=D,{enabled:ne,handles:re,handleComponent:ie}=ee,{enabled:z,defaultItem:ae,onDragOver:oe,touchEnabled:se=!0,touchDragSource:ce=`[data-rgl-draggable]`}=O,B=c??In(`vertical`),le=B.type,V=B.allowOverlap,ue=B.preventCollision??!1,de=(0,Z.useMemo)(()=>d??{i:`__dropping-elem__`,...ae},[d,ae]),fe=s.type===`transform`,H=s.scale,U=N??M,[pe,W]=(0,Z.useState)(!1),[G,K]=(0,Z.useState)(()=>ri(u,t,k,B)),[q,J]=(0,Z.useState)(null),[me,he]=(0,Z.useState)(!1),[Y,ge]=(0,Z.useState)(null),[_e,ve]=(0,Z.useState)(),ye=(0,Z.useRef)(void 0);ye.current=_e;let be=(0,Z.useRef)(null),xe=(0,Z.useRef)(null),Se=(0,Z.useRef)(null),Ce=(0,Z.useRef)(0),we=(0,Z.useRef)(G),Te=(0,Z.useRef)(u),Ee=(0,Z.useRef)(t),De=(0,Z.useRef)(le),Oe=(0,Z.useRef)(null),ke=(0,Z.useRef)(!1),Ae=(0,Z.useRef)(null),je=(0,Z.useRef)(null);je.current=Y;let Me=(0,Z.useRef)(w);(0,Z.useLayoutEffect)(()=>{Me.current=w});let Ne=(0,Z.useRef)(G);Ne.current=G,(0,Z.useEffect)(()=>{W(!0),(0,Gr.deepEqual)(G,u)||g(G)},[]),(0,Z.useEffect)(()=>{if(q||Y)return;let e=!(0,Gr.deepEqual)(u,Te.current),n=!ni(t,Ee.current),r=le!==De.current;if(e||n||r){let n=ri(e?u:G,t,k,B);(0,Gr.deepEqual)(n,G)||K(n)}Te.current=u,Ee.current=t,De.current=le},[u,t,k,le,B,q,Y,G]),(0,Z.useEffect)(()=>{if(!q&&!Y&&!(0,Gr.deepEqual)(G,we.current)){we.current=G;let e=G.filter(e=>e.i!==de.i);g(e)}},[G,q,Y,g,de.i]);let Pe=(0,Z.useMemo)(()=>{if(!f)return;let e=Jt(G),t=U[1];return e*A+(e-1)*M[1]+t*2+`px`},[f,G,A,M,U]),Fe=(0,Z.useCallback)((e,t,n,r)=>{let i=Ne.current,a=Yt(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};be.current=Zt(a),Se.current=i,J(o),_(i,a,a,null,r.e,r.node)},[_]),Ie=(0,Z.useCallback)((e,t,n,r)=>{let i=Ne.current,a=be.current,o=Yt(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=nn(i,o,t,n,!0,ue,le,k,V);v(c,a,o,s,r.e,r.node),K(B.compact(c,k)),J(s)},[ue,le,k,V,B,v]),Le=(0,Z.useCallback)((e,t,n,r)=>{if(!be.current)return;let i=Ne.current,a=be.current,o=Yt(i,e);if(!o)return;let s=nn(i,o,t,n,!0,ue,le,k,V),c=B.compact(s,k);y(c,a,o,null,r.e,r.node);let l=Se.current;be.current=null,Se.current=null,J(null),K(c),l&&!(0,Gr.deepEqual)(l,c)&&g(c)},[ue,le,k,V,B,y,g]),Re=(0,Z.useCallback)((e,t,n,r)=>{let i=Ne.current,a=Yt(i,e);a&&(xe.current=Zt(a),Se.current=i,he(!0),b(i,a,a,null,r.e,r.node))},[b]),ze=(0,Z.useCallback)((e,t,n,r)=>{let i=Ne.current,a=xe.current,{handle:o}=r,s=!1,c,l,[u,d]=en(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),ue&&!V&&Wt(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=nn(u,d,c,l,!0,ue,le,k,V));let p={w:d.w,h:d.h,x:d.x,y:d.y,i:e,static:!0};x(f,a,d,p,r.e,r.node);let m=B.compact(f,k);if(o===`n`||o===`nw`||o===`ne`){let t=m.find(t=>t.i===e);t&&(t.y=d.y)}K(m),J(p)},[ue,le,k,V,B,x]),Be=(0,Z.useCallback)((e,t,n,r)=>{let i=Ne.current,a=xe.current,o=Yt(i,e),s=B.compact(i,k);S(s,a,o??null,null,r.e,r.node);let c=Se.current;xe.current=null,Se.current=null,J(null),he(!1),K(s),c&&!(0,Gr.deepEqual)(c,s)&&g(s)},[k,B,S,g]),Ve=(0,Z.useCallback)((e,t,n,r)=>{if(r)ye.current&&(ye.current.left!==t.left||ye.current.top!==t.top)&&(ve(t),K(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{ge((0,X.jsx)(`div`,{},e.i)),ve(t);let r=Ne.current.filter(t=>t.i!==e.i);K([...r,{...e,x:n.x,y:n.y,static:!1,isDraggable:!0}])}},[]),He=(0,Z.useCallback)((e,t,r)=>{let i=Oe.current;if(!i)return;let{newDroppingPosition:a,calculatedXY:o}=Qr({clientX:e,clientY:t,gridElement:i,droppingItem:de,event:r,transformScale:H,cols:k,margin:M,maxRows:j,rowHeight:A,width:n,containerPadding:U});Ve(de,a,o,!!je.current)},[de,H,k,M,j,A,n,U,Ve]),Ue=(0,Z.useCallback)(()=>{let e=Ne.current;if(!e.some(e=>e.i===de.i)){ge(null),J(null),ve(void 0);return}let t=B.compact(e.filter(e=>e.i!==de.i),k);K(t),ge(null),J(null),ve(void 0)},[de.i,k,B]),We=(0,Z.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),ti&&!e.nativeEvent.target?.classList.contains(ei))return!1;let t=oe?oe(e.nativeEvent):T(e);if(t===!1)return Y&&Ue(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...de,...a},{newDroppingPosition:s,calculatedXY:c}=Qr({clientX:e.clientX,clientY:e.clientY,gridElement:e.currentTarget,droppingItem:o,event:e.nativeEvent,dragOffsetX:r,dragOffsetY:i,transformScale:H,cols:k,margin:M,maxRows:j,rowHeight:A,width:n,containerPadding:U});Ve(o,s,c,!!Y)},[Y,de,oe,T,Ue,Ve,H,k,M,j,A,n,U]),Ge=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Ce.current--,Ce.current<0&&(Ce.current=0),Ce.current===0&&Ue()},[Ue]),Ke=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Ce.current++},[]),qe=(0,Z.useCallback)(e=>{let t=Ne.current,n=t.find(e=>e.i===de.i);Ue(),Me.current(t,n,e)},[de.i,Ue]),Je=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Ce.current=0,qe(e.nativeEvent)},[qe]);(0,Z.useEffect)(()=>{if(!z||!se)return;let e=Oe.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(ce)!==null,r=e=>{let t=e.changedTouches;if(!t||t.length===0)return;let n=Ae.current;if(n===null)return t[0];for(let e=0;e{if(!n(e.target)||Ae.current!==null)return;e.preventDefault();let t=e.changedTouches?.[0];t&&(Ae.current=t.identifier,ke.current=!0)},a=e=>{if(!ke.current)return;e.preventDefault();let n=r(e);if(n){if(!t(n.clientX,n.clientY)){je.current&&Ue();return}He(n.clientX,n.clientY,e)}},o=e=>{if(!ke.current)return;e.preventDefault();let n=r(e);if(ke.current=!1,Ae.current=null,n){if(!t(n.clientX,n.clientY)){Ue();return}qe(e)}},s=()=>{ke.current&&(ke.current=!1,Ae.current=null,Ue())},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,se,ce,He,Ue,qe,de.i]);let Ye=(0,Z.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=Yt(G,String(e.key));if(!r)return null;let i=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&P,a=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&ne,o=r.resizeHandles||[...re],c=i&&F&&r.isBounded!==!1,u=ie;return(0,X.jsx)(Zr,{containerWidth:n,cols:k,margin:M,containerPadding:U,maxRows:j,rowHeight:A,cancel:L,handle:I,onDragStart:Fe,onDrag:Ie,onDragStop:Le,onResizeStart:Re,onResize:ze,onResizeStop:Be,isDraggable:i,isResizable:a,isBounded:c,allowMobileScroll:te,useCSSTransforms:fe&&pe,usePercentages:!pe,transformScale:H,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?_e:void 0,resizeHandles:o,resizeHandle:u,constraints:l,layoutItem:r,layout:G,children:e},r.i)},[G,n,k,M,U,j,A,L,I,Fe,Ie,Le,Re,ze,Be,P,ne,F,fe,pe,H,s,R,_e,re,ie,l]),Xe=()=>q?(0,X.jsx)(Zr,{w:q.w,h:q.h,x:q.x,y:q.y,i:q.i,className:`react-grid-placeholder ${me?`placeholder-resizing`:``}`,containerWidth:n,cols:k,margin:M,containerPadding:U,maxRows:j,rowHeight:A,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:fe,transformScale:H,constraints:l,layout:G,children:(0,X.jsx)(`div`,{})}):null,Ze=(0,Z.useCallback)(e=>{Oe.current=e,typeof h==`function`?h(e):h&&`current`in h&&(h.current=e)},[h]),Qe=C(ei,p),$e={height:Pe,...m};return(0,X.jsxs)(`div`,{ref:Ze,className:Qe,style:$e,onDrop:z?Je:void 0,onDragLeave:z?Ge:void 0,onDragEnter:z?Ke:void 0,onDragOver:z?We:void 0,children:[Z.Children.map(t,e=>Z.isValidElement(e)?Ye(e):null),z&&Y&&Ye(Y,!0),Xe()]})}var ai={lg:1200,md:996,sm:768,xs:480,xxs:0},oi={lg:12,md:10,sm:6,xs:4,xxs:2},si=()=>{};function ci(e,t,n,r,i=!1){let a=[];Z.Children.forEach(t,t=>{if(!Z.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:Jt(a),w:1,h:1})});let o=tn(a,{cols:n});return r.compact(o,n)}function li(e){let{children:t,width:n,breakpoint:r,breakpoints:i=ai,cols:a=oi,layouts:o={},rowHeight:s=150,maxRows:c=1/0,margin:l=[10,10],containerPadding:u=null,compactor:d,onBreakpointChange:f=si,onLayoutChange:p=si,onWidthChange:m=si,...h}=e,g=d??In(`vertical`),_=g.type,v=g.allowOverlap,y=(0,Z.useMemo)(()=>r??Rn(i,n),[]),b=(0,Z.useMemo)(()=>zn(y,a),[y,a]),x=(0,Z.useMemo)(()=>Bn(o,i,y,y,b,_),[]),[S,C]=(0,Z.useState)(y),[w,T]=(0,Z.useState)(b),[E,D]=(0,Z.useState)(x),[ee,O]=(0,Z.useState)(o),k=(0,Z.useRef)(n),A=(0,Z.useRef)(r),j=(0,Z.useRef)(i),M=(0,Z.useRef)(a),N=(0,Z.useRef)(o),P=(0,Z.useRef)(_),F=(0,Z.useRef)(ee);(0,Z.useEffect)(()=>{F.current=ee},[ee]);let I=(0,Z.useMemo)(()=>(0,Gr.deepEqual)(o,N.current)?null:Bn(o,i,S,S,w,g),[o,i,S,w,g]),L=I??E;(0,Z.useEffect)(()=>{I!==null&&(D(I),O(o),F.current=o,N.current=o)},[I,o]),(0,Z.useEffect)(()=>{if(_!==P.current){let e=g.compact(Qt(L),w),t={...F.current,[S]:e};D(e),O(t),F.current=t,p(e,t),P.current=_}},[_,g,L,w,v,S,p]),(0,Z.useEffect)(()=>{let e=n!==k.current,o=r!==A.current,s=!(0,Gr.deepEqual)(i,j.current),c=!(0,Gr.deepEqual)(a,M.current);if(e||o||s||c){let e=r??Rn(i,n),o=zn(e,a),d=S;if(d!==e||s||c){let n={...F.current};n[d]||(n[d]=Qt(E));let r=Bn(n,i,e,d,o,g),a=!n[e];r=ci(r,t,o,g,a),n[e]=r,C(e),T(o),D(r),O(n),F.current=n,f(e,o),p(r,n)}let h=Vn(l,e),_=u?Vn(u,e):null;m(n,h,o,_),k.current=n,A.current=r,j.current=i,M.current=a}},[n,r,i,a,S,w,E,t,g,_,v,l,u,f,p,m]);let R=(0,Z.useCallback)(e=>{let t={...F.current,[S]:e};D(e),O(t),F.current=t,p(e,t)},[S,p]),te=(0,Z.useMemo)(()=>Vn(l,S),[l,S]),ne=(0,Z.useMemo)(()=>u===null?null:Vn(u,S),[u,S]),re=(0,Z.useMemo)(()=>({cols:w,rowHeight:s,maxRows:c,margin:te,containerPadding:ne}),[w,s,c,te,ne]);return(0,X.jsx)(ii,{...h,width:n,gridConfig:re,compactor:g,onLayoutChange:R,layout:L,children:t})}var ui=Z.forwardRef(function(e,t){let{innerRef:n,...r}=e,i=n??t;return(0,X.jsx)(li,{...r,innerRef:i})});ui.displayName=`ResponsiveGridLayout`;function di(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 kt}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?kt:r?.[0]?.value??``}var fi=(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 pi(e,t,n){let r={};for(let i of e??[]){let e=di(i,t,n?.[i.name]);(i.kind!==`query`||e!==``)&&(r[i.name]=e)}return r}function mi(e){return`Explain the panel “${e.title}”`}function hi(e){return`Fix the panel “${e.title}”`}function gi(e){return[{description:`Observed panel diagnostics`,value:JSON.stringify(e)}]}var _i=(0,Z.lazy)(()=>ae(()=>import(`./panel-editor-BVRFoShZ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]))),vi=0;function yi(e){let t;do t=`p_${Date.now().toString(36)}_${(++vi).toString(36)}_${Math.random().toString(36).slice(2,10)}`;while(e.some(e=>e.id===t));return t}function bi({dashboardId:e,version:t,spec:n,vars:r,results:i,fetching:a,annotations:o,fetchingIds:c=[],staleAt:l=new Map,time:u=n.time,onEditExit:d,editing:p,view:m,agentAvailable:h,canManage:g=!1,onOpenChat:_,onVariable:v,onRetry:y,onPoint:b,onZoom:x,onZoomReset:C,onWiden:w,zoomed:E,onView:D,onVisible:ee,onRangePending:O,shortcutScope:k,onShortcuts:A,overlayOpen:j,returnViewFocus:M}){let P=Be(),[I,L]=(0,Z.useState)(),[R,te]=(0,Z.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??Nt(e)})));(0,Z.useEffect)(()=>{te(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??Nt(e)})))},[n]);let[ne,ie]=(0,Z.useState)(()=>window.innerHeight),[z,ae]=(0,Z.useState)();(0,Z.useEffect)(()=>{let e=()=>ie(window.innerHeight);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let oe=(0,Z.useRef)(null),se=(0,Z.useRef)(new Map),B=(0,Z.useRef)(null),le=(0,Z.useRef)(null),V=()=>{let e=I?.panel?.id;L(void 0),requestAnimationFrame(()=>(le.current?.isConnected?le.current:se.current.get(e??``))?.focus())},de=(0,Z.useRef)(m);m&&(de.current=m);let[H,U]=(0,Z.useState)(0),pe=H>0,W=p&&(H>=1100?`lg`:H>=800?`md`:`sm`)==`lg`;(0,Z.useLayoutEffect)(()=>{if(!oe.current)return;U(Math.max(0,Math.round(oe.current.getBoundingClientRect().width)));let e=new ResizeObserver(([e])=>{e&&U(Math.max(0,Math.round(e.contentRect.width)))});return e.observe(oe.current),()=>e.disconnect()},[]);let G=(0,Z.useRef)(ee);G.current=ee,(0,Z.useEffect)(()=>{if(!pe||!oe.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))}m&&n.panels.some(e=>e.id===m)&&e.add(m),G.current([...e])},{rootMargin:`200px`});return oe.current.querySelectorAll(`.react-grid-item[data-panel]`).forEach(e=>t.observe(e)),()=>t.disconnect()},[n,m,pe]);let K=(0,Z.useMemo)(()=>n.panels.some(e=>{let t=R.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)}),[R,n]),q=e=>({...n,panels:e.map(e=>{let t=R.find(t=>t.i===e.id);return t?{...e,grid:{x:t.x,y:t.y,w:t.w,h:t.h}}:e})}),J=He({mutationFn:()=>Y(e,q(n.panels),t,`Edited layout`),onSuccess:t=>{P.setQueryData([`dashboard`,e],t)}}),me=He({mutationFn:r=>K?Y(e,q(n.panels.filter(e=>e.id!==r)),t,`Removed a panel and saved layout`):Te(e,[{op:`remove_panel`,id:r}],t,`Removed a panel`),onSuccess:t=>{P.setQueryData([`dashboard`,e],t)}}),he=He({mutationFn:r=>{let i={...r,id:yi(n.panels),title:`${Array.from(r.title).slice(0,73).join(``)} (copy)`,grid:void 0};if(K){let a=[...n.panels];return a.splice(a.findIndex(e=>e.id===r.id)+1,0,i),Y(e,q(a),t,`Duplicated a panel and saved layout`)}return Te(e,[{op:`add_panel`,after:r.id,panel:i}],t,`Duplicated a panel`)},onSuccess:t=>{P.setQueryData([`dashboard`,e],t)}});(0,Z.useEffect)(()=>{p||(J.reset(),me.reset(),he.reset())},[p]);let ge=()=>{J.reset(),me.reset(),he.reset(),d?.(),P.invalidateQueries({queryKey:[`dashboard`,e]})},_e=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()),ae(`Link copied`)}catch{ae(`Copy this URL: ${t.toString()}`)}},ve=`dashboard-${e}`,ye=n=>({dashboard_id:e,version:t,panel_id:n.id,title:fi(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:l.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:u}}),be=(s,d,f=!1)=>(0,X.jsx)(ce,{panel:s,title:fi(s.title,r),result:i.get(s.id),loading:a&&c.includes(s.id),height:d,group:ve,editing:W&&!f,agentAvailable:h,suspended:!f&&s.id===m,menuRef:f?B:e=>{e?se.current.set(s.id,e):se.current.delete(s.id)},compare:u.compare===`previous_period`,range:s.time?.range??u.range,annotations:o,vars:r,onVariable:v,...ue(s,i.get(s.id),v,b?e=>b(s,e):void 0),onRangePending:e=>O?.(s.id,e),onZoom:x,zoomed:E,onZoomReset:C,onWiden:w,onRetry:y?()=>y(s.id):void 0,onView:()=>D(s.id),onCopyLink:()=>{_e(s.id)},onEdit:g&&e&&(s.query||typeof s.sql==`string`)?()=>{le.current=f?B.current:se.current.get(s.id)??null,L({panel:s,spec:n,version:t})}:void 0,onExplain:h&&e?()=>_(mi(ye(s)),{answer_only:!0,context:gi(ye(s))}):void 0,onFix:h&&e&&g?()=>_(hi(ye(s)),{context:gi(ye(s))}):void 0,staleAt:l.get(s.id),onDuplicate:W&&!f?()=>he.mutate(s):void 0,onRemove:W&&!f?()=>me.mutate(s.id):void 0}),xe=n.panels.find(e=>e.id===m),Se=p?J.error??me.error??he.error:null,Ce=Se instanceof ze&&Se.code===`dashboard_version_conflict`,we=e=>{W&&te(e.map(({i:e,x:t,y:n,w:r,h:i})=>({i:e,x:t,y:n,w:r,h:i})))};return(0,X.jsxs)(`div`,{ref:oe,style:{minWidth:0},children:[p&&(0,X.jsxs)(f,{justify:`space-between`,mb:`sm`,p:`xs`,style:{border:`1px dashed var(--mantine-color-default-border)`,borderRadius:8},children:[(0,X.jsx)(N,{size:`sm`,c:`dimmed`,children:W?`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,X.jsxs)(f,{gap:`xs`,children:[g&&e&&(0,X.jsx)(F,{size:`compact-sm`,variant:`default`,onClick:e=>{le.current=e.currentTarget,L({spec:n,version:t})},children:`Add panel`}),(0,X.jsx)(F,{size:`compact-sm`,disabled:!K||!W,loading:J.isPending,onClick:()=>J.mutate(),children:`Save layout`})]})]}),Ce&&(0,X.jsx)(S,{mb:`sm`,children:(0,X.jsxs)(re,{tone:`warning`,children:[`Someone saved this dashboard since you opened it. Load the latest version, then redo your change. `,(0,X.jsx)(F,{size:`compact-sm`,onClick:ge,children:`Load latest`})]})}),Se&&!Ce&&(0,X.jsx)(S,{mb:`sm`,children:(0,X.jsx)(re,{tone:`danger`,children:Se.message})}),z&&(0,X.jsx)(S,{mb:`sm`,children:(0,X.jsx)(re,{tone:`info`,children:z})}),!pe&&(0,X.jsx)(`div`,{"data-grid-placeholder":!0,style:{height:At(Math.max(1,...R.map(e=>e.y+e.h)))}}),pe&&(0,X.jsx)(ui,{width:H,className:`dashboard-grid${W?` dashboard-grid-editing`:``}`,layouts:{lg:R,md:R,sm:R.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:An,dragConfig:{enabled:W,handle:`.panel-drag`,cancel:`button`},resizeConfig:{enabled:W},onDragStop:we,onResizeStop:we,children:n.panels.map(e=>{let t=R.find(t=>t.i===e.id);return(0,X.jsx)(`div`,{"data-panel":e.id,children:be(e,At(t?.h??6))},e.id)})}),(0,X.jsx)(fe,{shortcutScope:k,onShortcuts:A,escapeEnabled:!j&&!I,opened:!!m,onClose:()=>D(void 0),title:xe?fi(xe.title,r):`Missing panel`,returnFocusTo:()=>M?.(de.current)??se.current.get(de.current??``)??se.current.values().next().value,children:xe?(0,X.jsx)(`div`,{style:{height:`calc(100vh - 120px)`},children:be(xe,Math.max(40,ne-140),!0)}):(0,X.jsx)(S,{children:(0,X.jsx)(re,{tone:`warning`,children:`This panel is missing from the dashboard. The shared link may be out of date.`})})}),I&&e&&(0,X.jsx)(Z.Suspense,{fallback:(0,X.jsx)(s,{opened:!0,onClose:V,title:`Loading the panel editor`,children:(0,X.jsx)(T,{state:`loading`,loadingLabel:`Loading the panel editor`,rows:3})}),children:(0,X.jsx)(_i,{dashboardId:e,version:I.version,spec:q(I.spec.panels),layoutChanged:W&&K,panel:I.panel,time:u,vars:r,onClose:V})})]})}function xi({spec:e,onClose:t,onCreated:n}){let r=Be(),[i,a]=(0,Z.useState)(`${e.name} copy`),[o,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(),d=async()=>{c(!0),u(void 0);try{let t=await ye({...e,name:i.trim()});r.invalidateQueries({queryKey:Se}),n(t.id)}catch(e){u(e instanceof Error?e.message:`Duplicate failed`)}finally{c(!1)}};return(0,X.jsx)(s,{opened:!0,onClose:()=>{o||t()},title:`Duplicate dashboard`,children:(0,X.jsxs)(x,{gap:`md`,children:[(0,X.jsx)(z,{label:`New dashboard name`,value:i,onChange:e=>a(e.currentTarget.value),"data-autofocus":!0}),l&&(0,X.jsx)(S,{children:(0,X.jsx)(re,{tone:`danger`,children:l})}),(0,X.jsxs)(f,{justify:`flex-end`,gap:`xs`,children:[(0,X.jsx)(F,{variant:`default`,disabled:o,onClick:t,children:`Cancel`}),(0,X.jsx)(F,{loading:o,disabled:!i.trim()||i.trim()===e.name,onClick:()=>void d(),children:`Duplicate`})]})]})})}var Si=(e,t)=>!(t instanceof ze&&t.status<500)&&e<2,Ci=(e,t)=>!(t instanceof ze&&t.code===`timeout`)&&Si(e,t),wi=e=>({panels:e.panels.map(({grid:e,...t})=>t),variables:e.variables,time:e.time,annotations:e.annotations});function Ti(e,t,n,r,i){return[`panels`,JSON.stringify([e,wi(t),n,r,i])]}function Ei(e,t,n,r){return[`variables`,e,wi(t),n,r]}var Di=2;async function Oi(e,t,n,r=[],i=!1){let a=r.filter(t=>e.panels?.includes(t)),o=e.panels?.filter(e=>!a.includes(e)),s=a.length&&!o?.length?[]:await we(a.length?{...e,panels:o}:e,t,n,i);for(let r=0;re.reason===`busy`))break}let c=new Set(e.dashboard.panels.filter(e=>[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz)).map(e=>e.id)),l=s.filter(e=>c.has(e.id)&&e.from_ms!==void 0&&e.to_ms!==void 0&&e.from_mse.from_ms)),d=Math.max(...l.map(e=>e.to_ms));try{let e=await he({from:new Date(u).toISOString(),to:new Date(d).toISOString()},t);return{results:s,annotations:e}}catch(e){if(t?.aborted)throw e;return{results:s,annotation_error:e instanceof Error?e.message:`Annotations unavailable`}}}var ki={off:!1,"10s":1e4,"30s":3e4,"1m":6e4,"5m":3e5},Ai=0;function ji(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 Mi({dashboardId:e,spec:t,time:n,vars:r,compare:i,widths:a,visible:o,refresh:s,enabled:c=!0}){let l=(0,Z.useMemo)(()=>Object.fromEntries(Object.entries(a).map(([e,t])=>[e,Math.max(100,Math.round(t/100)*100)])),[a]),u=Ti(e,t,n,r,i),d=u[1],f=o.filter(e=>t.panels.some(t=>t.id===e)),p=(0,Z.useRef)([]),m=(0,Z.useRef)(new Set),h=(0,Z.useRef)(void 0),g=(0,Z.useRef)(null),_=(0,Z.useRef)(!1),v=(0,Z.useRef)(!1),y=(0,Z.useRef)(null),b=(0,Z.useRef)({key:d,ids:new Set}),[x,S]=(0,Z.useState)({key:d}),[C,w]=(0,Z.useState)({key:d,results:new Map,updated:new Map,stale:new Set,receivedAt:0}),T=f.length===0&&C.key===d&&C.receivedAt>0,E=c&&t.panels.some(e=>e.viz!==`text`),D=Ve({queryKey:u,queryFn:({signal:e})=>{if(T&&g.current?.key!==d)return p.current=[],Promise.resolve({results:[],hasTimePanels:!1,batch:++Ai});let a=g.current?.key===d?g.current.ids:f;p.current=(a.length?[...a]:t.panels.map(e=>e.id)).sort(),b.current.key!==d&&(b.current={key:d,ids:new Set});for(let e of p.current)b.current.ids.add(e);let o=[...p.current],s=v.current;v.current=!1;let c=m.current=new Set,u=t=>{if(e.aborted)return;c.add(t.id);let n=Date.now(),r=++Ai;w(e=>Ni(e,d,[H(t,o)],n,r))},_=C.key===d?o.filter(e=>C.results.get(e)?.reason===`busy`):[];return Oi({dashboard:t,panels:o,time:n,vars:r,widths:l,compare:i},e,u,_,s).then(e=>{let n=new Set(e.results.map(e=>e.id)),r=o.filter(e=>!n.has(e)&&!_.includes(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:++Ai,results:[...e.results.map(e=>H(e,o)),...r],hasTimePanels:t.panels.some(e=>o.includes(e.id)&&[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz))}}).catch(n=>{throw e.aborted||(h.current={key:d,ids:o.filter(e=>!c.has(e)&&t.panels.find(t=>t.id===e)?.viz!==`text`),error:n instanceof Error?n.message:String(n),retryable:!(n instanceof ze)||n.status===408||n.status===429||n.status>=500}),n})},retry:Ci,enabled:E,refetchInterval:T?!1:ki[s]??3e4,staleTime:5e3,placeholderData:e=>e}),ee=D.error&&h.current?.key===d?h.current:void 0,O=(0,Z.useMemo)(()=>Ni(C,d,D.isPlaceholderData?void 0:D.data?.results,D.dataUpdatedAt,D.data?.batch,ee),[C,d,D.data,D.dataUpdatedAt,D.isPlaceholderData,D.error,D.errorUpdatedAt]),k=O.results,A=D.isPlaceholderData?void 0:D.data?.hasTimePanels?D.data:x.key===d?x:void 0;(0,Z.useEffect)(()=>{!D.isPlaceholderData&&D.data?.hasTimePanels&&S({key:d,annotations:D.data.annotations,annotation_error:D.data.annotation_error})},[d,D.data,D.isPlaceholderData]),(0,Z.useEffect)(()=>{D.isPlaceholderData||w(e=>Ni(e,d,D.data?.results,D.dataUpdatedAt,D.data?.batch,ee))},[d,D.data,D.dataUpdatedAt,D.isPlaceholderData,D.error,D.errorUpdatedAt]);let j=new Map([...O.stale].flatMap(e=>{let t=O.updated.get(e);return t?[[e,t]]:[]})),M=(D.data?.results??[]).find(e=>e.status===`error`&&e.reason!==`busy`&&O.stale.has(e.id)),N=(D.data?.results??[]).flatMap(e=>e.reason===`busy`&&O.stale.has(e.id)?[O.updated.get(e.id)??0]:[]),P=Math.max(0,...[...O.updated].filter(([e])=>{let t=O.results.get(e);return t?.reason!==`busy`||t.frame!==void 0}).map(([,e])=>e));(0,Z.useEffect)(()=>{if(b.current.key===d)for(let e of b.current.ids)k.get(e)?.reason===`busy`&&!f.includes(e)&&b.current.ids.delete(e)},[o,d,k]),(0,Z.useEffect)(()=>{if(!E||D.isFetching||_.current||y.current?.key===d||g.current?.key===d)return;let e=b.current.key===d?b.current.ids:new Set,n=[...new Set(f.filter(n=>(!k.has(n)||k.get(n)?.reason===`busy`)&&!e.has(n)&&t.panels.find(e=>e.id===n)?.viz!==`text`))].sort();if(!n.length)return;let r={key:d,ids:n};g.current=r,D.refetch({cancelRefetch:!1}).finally(()=>{g.current===r&&(g.current=null)})},[o,E,d,D.isFetching,D.error,D.refetch,k,t.panels]),(0,Z.useEffect)(()=>{!D.isFetching&&y.current?.key!==d&&_.current&&(_.current=!1,g.current=null,E&&!T&&(v.current=!0,D.refetch({cancelRefetch:!1})))},[D.isFetching,d,E,T,D.refetch]);let F=e=>{let t={key:d,ids:e};g.current=t,D.refetch({cancelRefetch:!1}).finally(()=>{g.current===t&&(g.current=null)})};return(0,Z.useEffect)(()=>{if(D.isFetching||!y.current)return;let e=y.current;if(y.current=null,e.key!==d||!E)return;let n=[...e.ids].filter(e=>t.panels.some(t=>t.id===e&&t.viz!==`text`)&&k.get(e)?.request_error).sort();n.length&&F(n)},[D.isFetching,d,E,k,t.panels]),{retry:e=>{if(E&&t.panels.some(t=>t.id===e&&t.viz!==`text`)&&k.get(e)?.request_error){if(D.isFetching){y.current?.key!==d&&(y.current={key:d,ids:new Set}),y.current.ids.add(e);return}F([e])}},results:k,staleAt:j,annotations:A?.annotations,annotationError:A?.annotation_error,fetchingIds:D.isFetching?p.current.filter(e=>!m.current.has(e)):[],fetching:D.isFetching,error:D.error??(M?Error(M.error??`Panel refresh failed`):null),updatedAt:P||null,skippedAt:N.length?Math.min(...N):null,refetch:()=>{if(E&&!T){if(D.isFetching){g.current?.key===d&&(_.current=!0);return}v.current=!0,D.refetch({cancelRefetch:!1})}}}}function Ni(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},s=n&&i!==void 0&&(o.receivedBatch===void 0||i>o.receivedBatch);for(let e of s?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,reason:e.reason,request_error:e.request_error})):(o.results.set(e.id,e),o.updated.set(e.id,r),o.stale.delete(e.id));s&&(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,reason:void 0,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 Pi(e,t){return e.queryKey[0]===`variables`&&e.queryKey[1]===t}function Fi(e,t,n,r,i,a=!1){let o=!!t.variables?.some(e=>e.kind===`query`),s=Ve({queryKey:Ei(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 Ii(e){return t=>ji(t,e)||Pi(t,`dashboard-${e}`)}function Li({id:e,currentVersion:t,currentSpec:n,opened:r,onClose:i,onRestored:a}){let o=Be(),[s,c]=(0,Z.useState)(),[l,u]=(0,Z.useState)(),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(r),h=(0,Z.useRef)(0),g=(0,Z.useRef)(r);g.current=r;let _=(0,Z.useRef)(!1),v=(0,Z.useRef)(!1),y=(0,Z.useRef)(a);y.current=a,(0,Z.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]);let b=He({mutationFn:({version:t})=>me(e,t),retry:!1,onSuccess:(t,{version:n,generation:r})=>{o.cancelQueries({queryKey:[`dashboard`,e],exact:!0}),o.cancelQueries({predicate:Ii(e)}),o.cancelQueries({queryKey:[`exemplars`]}),o.cancelQueries({queryKey:[`drill-trace`]}),o.setQueryData([`dashboard`,e],t),o.invalidateQueries({predicate:Ii(e),refetchType:`none`}),v.current&&(g.current&&r===h.current&&u({text:`Restored v${n} as v${t.version}`}),y.current(t)),o.invalidateQueries({queryKey:Se}),o.invalidateQueries({queryKey:[`dashboard-versions`,e]},{cancelRefetch:!1}),o.invalidateQueries({queryKey:[`exemplars`],refetchType:`none`}),o.invalidateQueries({queryKey:[`drill-trace`],refetchType:`none`})},onError:t=>{t instanceof ze&&t.code===`dashboard_version_not_found`&&o.invalidateQueries({queryKey:[`dashboard-versions`,e]})},onSettled:()=>{_.current=!1,v.current&&f(!1)}}),x=()=>{h.current++,b.reset(),u(void 0)};(0,Z.useEffect)(()=>{if(r){m(!0);return}h.current++,b.reset(),u(void 0),o.cancelQueries({queryKey:[`dashboard-versions`,e]}),o.cancelQueries({queryKey:[`dashboard-version`,e]})},[r,e,o,b.reset]);let S=(0,Z.useRef)(t);return(0,Z.useEffect)(()=>{S.current!==t&&(S.current=t,o.invalidateQueries({queryKey:[`dashboard-versions`,e]},{cancelRefetch:!1}))},[t,e,o]),(0,X.jsx)(oe,{opened:r,onClose:()=>{x(),i()},onExitTransitionEnd:()=>m(!1),title:`Version history`,position:`right`,size:`xl`,children:(r||p)&&(0,X.jsx)(Ri,{id:e,opened:r,currentVersion:t,currentSpec:n,selected:s,onSelect:e=>{x(),c(e)},pending:d,error:b.error,failedVersion:b.variables?.version,success:l,onRestore:e=>{_.current||(_.current=!0,f(!0),u(void 0),b.mutate({version:e,generation:h.current}))}})})}function Ri({id:e,opened:t,currentVersion:n,currentSpec:r,selected:a,onSelect:o,pending:s,error:c,failedVersion:l,success:u,onRestore:d}){let p=Ve({queryKey:[`dashboard-versions`,e],queryFn:({signal:t})=>_e(e,t),enabled:t,retry:!1}),m=a??p.data?.[0]?.version,h=Ve({queryKey:[`dashboard-version`,e,m],queryFn:({signal:t})=>Ce(e,m,t),enabled:t&&m!==void 0,retry:!1}),g=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{u&&g.current?.focus()},[u]),(0,X.jsxs)(x,{gap:`md`,"data-version-history":!0,children:[(0,X.jsx)(N,{size:`sm`,c:`dimmed`,children:`Inspect saved specs and changes. Restoring adds a new version.`}),u&&(0,X.jsx)(S,{ref:g,tabIndex:-1,role:`note`,children:(0,X.jsx)(re,{live:!1,tone:`success`,children:u.text})}),c&&l===m&&(0,X.jsx)(Hi,{error:c,version:m}),(0,X.jsxs)(S,{mih:160,children:[p.isPending&&(0,X.jsx)(T,{state:`loading`,loadingLabel:`Loading history…`,rows:3}),p.error&&(0,X.jsx)(S,{children:(0,X.jsxs)(re,{tone:`danger`,title:`History unavailable`,children:[p.error.message,(0,X.jsx)(F,{mt:`xs`,variant:`default`,size:`xs`,onClick:()=>void p.refetch(),children:`Retry history`})]})}),p.data?.length===0&&(0,X.jsx)(T,{state:`empty`,empty:{title:`No versions available.`,description:`Version history appears after a dashboard is saved.`,action:(0,X.jsx)(F,{variant:`default`,onClick:()=>void p.refetch(),children:`Retry history`})}}),!!p.data?.length&&(0,X.jsx)(L,{h:200,type:`auto`,children:(0,X.jsx)(x,{gap:`xs`,pr:`sm`,role:`list`,"aria-label":`Saved versions`,children:p.data.map(e=>(0,X.jsxs)(i,{role:`listitem`,withBorder:!0,p:`xs`,radius:`sm`,style:{borderColor:m===e.version?`var(--mantine-color-accent-filled)`:void 0},children:[(0,X.jsxs)(f,{justify:`space-between`,gap:`xs`,children:[(0,X.jsxs)(F,{color:`accent`,variant:m===e.version?`light`:`subtle`,size:`compact-sm`,"aria-pressed":m===e.version,onClick:()=>o(e.version),children:[`Version `,e.version]}),e.version===n&&(0,X.jsx)(k,{tone:`neutral`,children:`Current`}),(0,X.jsx)(Bi,{at:e.created_at})]}),(0,X.jsxs)(N,{size:`xs`,c:`dimmed`,mt:4,children:[zi(e),` · `,e.message||`No edit message`]})]},e.version))})})]}),(0,X.jsx)(O,{role:`status`,"aria-live":`polite`,children:m===void 0?`Select a version.`:h.isFetching?`Loading version ${m}…`:h.error?`Version ${m} unavailable.`:`Version ${m} ready.`}),(0,X.jsxs)(S,{mih:280,"aria-busy":h.isFetching,children:[m!==void 0&&h.isPending&&(0,X.jsx)(T,{state:`loading`,loadingLabel:`Loading version…`,rows:3}),h.error&&(0,X.jsx)(S,{children:(0,X.jsxs)(re,{tone:`danger`,title:h.error instanceof ze&&h.error.code===`dashboard_version_not_found`?`This version is no longer available`:`Version unavailable`,children:[h.error.message,(0,X.jsx)(F,{mt:`xs`,variant:`default`,size:`xs`,onClick:()=>void h.refetch(),children:`Retry version`})]})}),h.data&&!h.error&&(0,X.jsx)(Vi,{record:h.data,currentVersion:n,current:JSON.stringify(h.data.dashboard.spec)===JSON.stringify(r),pending:s,onRestore:()=>d(h.data.dashboard.version)})]})]})}function zi(e){return e.author_kind===`agent`?`Agent`:e.author_kind===`user`?`You`:`System`}function Bi({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,X.jsx)(N,{component:`time`,dateTime:e,title:De(e),size:`xs`,c:`dimmed`,children:new Intl.RelativeTimeFormat(void 0,{numeric:`auto`}).format(Math.round(t/n),r)})}function Vi({record:e,currentVersion:t,current:n,pending:r,onRestore:i}){let{dashboard:a}=e,o=Ue(e);return(0,X.jsxs)(x,{gap:`sm`,"data-history-version":a.version,children:[(0,X.jsxs)(f,{justify:`space-between`,align:`flex-start`,children:[(0,X.jsxs)(S,{miw:0,children:[(0,X.jsxs)(b,{order:2,fz:`lg`,children:[a.name,` · v`,a.version]}),(0,X.jsxs)(N,{size:`sm`,c:`dimmed`,children:[zi(e),` · `,e.message||`No edit message`]}),(0,X.jsx)(Bi,{at:e.created_at})]}),a.version===t?(0,X.jsx)(F,{size:`sm`,variant:`default`,disabled:!0,children:`Current version`}):n?(0,X.jsx)(F,{size:`sm`,variant:`default`,disabled:!0,children:`Same as current`}):(0,X.jsxs)(F,{size:`sm`,disabled:r,loading:r,onClick:i,children:[`Restore version `,a.version]})]}),a.description&&(0,X.jsx)(N,{size:`sm`,children:a.description}),e.changes_available?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ye,{labels:o}),!o.length&&!e.layout_changed&&(0,X.jsx)(T,{state:`empty`,empty:{title:`No authored changes.`}})]}):(0,X.jsx)(S,{children:(0,X.jsx)(re,{tone:`warning`,title:`Changes unavailable`,children:`The preceding version is no longer retained. This saved spec is still available.`})}),(0,X.jsxs)(N,{size:`sm`,c:`dimmed`,children:[`Read-only · `,a.spec.panels.length,` panels. Historical data is not queried.`]}),(0,X.jsxs)(ot,{variant:`contained`,children:[(0,X.jsxs)(ot.Item,{value:`spec`,children:[(0,X.jsx)(ot.Control,{children:`Spec`}),(0,X.jsx)(ot.Panel,{children:(0,X.jsx)(Le,{block:!0,tabIndex:0,style:{maxHeight:320,overflow:`auto`},children:JSON.stringify(a.spec,null,2)})})]}),(0,X.jsxs)(ot.Item,{value:`data`,children:[(0,X.jsx)(ot.Control,{children:`Data`}),(0,X.jsx)(ot.Panel,{children:(0,X.jsx)(x,{gap:`xs`,children:a.spec.panels.map(e=>(0,X.jsxs)(S,{children:[(0,X.jsxs)(N,{size:`sm`,fw:500,children:[e.title,` · `,e.viz]}),(0,X.jsx)(Le,{block:!0,tabIndex:0,children:e.content??e.sql??JSON.stringify(e.query??{},null,2)})]},e.id))})})]})]})]})}function Hi({error:e,version:t}){let n=e instanceof ze?e.code:void 0,r=!(e instanceof ze)||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.`:n===`already_current`?`The dashboard already has this version's contents, so there is nothing to restore.`:[`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,X.jsx)(S,{children:(0,X.jsxs)(re,{tone:`danger`,title:`Restore of version ${t} failed`,children:[(0,X.jsx)(N,{size:`sm`,children:e.message}),e instanceof ze&&e.problems.length>0&&(0,X.jsx)(`ul`,{children:e.problems.map((e,t)=>(0,X.jsxs)(`li`,{children:[e.path,`: `,e.message,e.hint?` (${e.hint})`:``]},t))}),(0,X.jsx)(N,{size:`sm`,mt:`xs`,children:r})]})})}function Ui(e,t){let n=JSON.stringify([e.range,e.from,e.to]),r=(0,Z.useRef)({search:e,onSearch:t,scope:n}),i=(0,Z.useRef)(``),a=(0,Z.useRef)(void 0),[o,s]=(0,Z.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,Z.useCallback)(()=>{i.current=``,a.current=void 0,s(!1)},[]),l=(0,Z.useCallback)(()=>{if(!a.current)return;let e=a.current;c(),r.current.onSearch({...r.current.search,...e},!1)},[c]);return{zoom:(0,Z.useCallback)((e,t)=>{let n=U(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 Wi({variables:e,vars:t,options:n,onChange:r}){return e.length===0?null:(0,X.jsx)(f,{gap:`sm`,wrap:`wrap`,role:`group`,"aria-label":`Dashboard variables`,children:e.map(e=>{let i=di(e,t,n[e.name]),a=[...e.include_all?[{value:kt,label:`All`}]:[],...(n[e.name]??e.options?.map(e=>({value:e}))??[]).map(e=>({value:e.value,label:e.value}))],o=(0,X.jsxs)(N,{size:`sm`,c:`dimmed`,ff:`monospace`,children:[`$`,e.name]});return e.kind===`constant`?(0,X.jsx)(z,{label:o,size:`sm`,value:e.value,readOnly:!0,w:160},e.name):e.kind===`text`?(0,X.jsx)(z,{label:o,size:`sm`,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,X.jsx)(Dt,{label:o,size:`sm`,w:260,searchable:!0,clearable:!0,data:a.filter(e=>e.value!==kt),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?kt:[])},e.name):(0,X.jsx)(le,{label:o,size:`sm`,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 Gi(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 Ki(e,t,n={}){let r=(0,Z.useRef)({actions:t,options:n});r.current={actions:t,options:n},(0,Z.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=Gi(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 qi({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,X.jsx)(s,{opened:e,onClose:t,title:`Keyboard shortcuts`,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,children:(0,X.jsxs)(x,{gap:`xs`,children:[(0,X.jsx)(Me,{label:`Single-key shortcuts`,checked:r,onChange:e=>i(e.currentTarget.checked)}),a.map(([e,t])=>(0,X.jsxs)(f,{gap:`sm`,children:[(0,X.jsx)(Ke,{children:e}),(0,X.jsx)(N,{size:`sm`,children:t})]},e)),!n&&(0,X.jsx)(N,{size:`sm`,children:`Focus a chart or a panel control before pressing f. Without a focused panel, f does nothing.`}),(0,X.jsx)(N,{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,X.jsx)(N,{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,X.jsxs)(N,{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,X.jsx)(N,{size:`sm`,children:`The global / shortcut focuses the chat composer.`})]})})}function Ji(e){let t=`fanout:single-key-shortcuts:`+e,n=()=>{try{return localStorage.getItem(t)!==`off`}catch{return!0}},[r,i]=(0,Z.useState)(n);return(0,Z.useEffect)(()=>{i(n())},[t]),(0,Z.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 Yi(e){let t=(0,Z.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,Z.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 Xi=(0,Z.lazy)(()=>ae(()=>import(`./new-dashboard-D58ui2mw.js`).then(e=>({default:e.NewDashboard})),__vite__mapDeps([25,1,2,3,4,5,6,7,8,22,10,11,12,13,14,15,16,17,18,19,20,21,23,9,24]))),Zi={exemplars:K,trace:ge,span:V},Qi={"5m":`15m`,"15m":`1h`,"1h":`3h`,"3h":`6h`,"6h":`12h`,"12h":`24h`,"24h":`2d`,"2d":`7d`,"7d":`30d`,"30d":`30d`};function $i({dashboardId:e,search:t,onSearch:n,onOpen:r}){let{agentAvailable:i,openChat:a}=qe(),[o,s]=(0,Z.useState)(!1),c=Ve({queryKey:Se,queryFn:Ee,staleTime:15e3});(0,Z.useEffect)(()=>{!e&&c.data?.length&&r((c.data.find(e=>e.is_default)??c.data[0]).id,!0)},[e,c.data]);let l=Ve({queryKey:[`dashboard`,e],queryFn:({signal:t})=>be(e,t),enabled:!!e,retry:(e,t)=>!(t instanceof ze&&t.code===`not_found`)&&e<2});return!e&&c.error?(0,X.jsxs)(x,{p:`lg`,children:[(0,X.jsx)(A,{title:`Dashboards`,description:`Monitor your services and investigate changes.`}),(0,X.jsx)(T,{state:`error`,error:{title:`Dashboards could not be loaded`,message:c.error.message,onRetry:()=>void c.refetch()}})]}):!e&&c.data?.length===0?(0,X.jsx)(_,{mih:`50vh`,children:(0,X.jsxs)(x,{align:`center`,gap:`xs`,children:[(0,X.jsx)(A,{title:`Dashboards`,description:`Create a dashboard to explore your services.`}),(0,X.jsx)(T,{state:`empty`,empty:{title:(0,X.jsx)(b,{order:2,fz:`lg`,children:`No dashboards yet`}),description:`Create a dashboard to see your telemetry.`,action:(0,X.jsx)(F,{size:`sm`,onClick:()=>s(!0),children:`New dashboard`})}}),(0,X.jsx)(f,{mt:`sm`,gap:`xs`,children:i&&(0,X.jsx)(F,{size:`sm`,variant:`default`,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`})}),o&&(0,X.jsx)(Z.Suspense,{fallback:null,children:(0,X.jsx)(Xi,{onClose:()=>s(!1),onCreated:e=>{s(!1),r(e)}})})]})}):!e||l.isLoading?(0,X.jsx)(S,{component:`section`,"aria-label":`Dashboard`,maw:1600,mx:`auto`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,children:(0,X.jsx)(T,{state:`loading`,loadingLabel:`Loading dashboard`,skeleton:(0,X.jsx)(Pt,{})})}):l.error instanceof ze&&l.error.code===`not_found`?(0,X.jsx)(_,{mih:`50vh`,children:(0,X.jsxs)(x,{align:`center`,gap:`xs`,children:[(0,X.jsx)(A,{title:`Dashboard`,description:`Monitor your services and investigate changes.`}),(0,X.jsx)(T,{state:`empty`,empty:{title:(0,X.jsx)(b,{order:2,fz:`lg`,children:`This dashboard isn't here`}),description:`The link may be out of date, or the dashboard may have been deleted.`,action:c.data?.length?(0,X.jsx)(F,{variant:`default`,size:`sm`,onClick:()=>r((c.data.find(e=>e.is_default)??c.data[0]).id,!0),children:`Open your default dashboard`}):void 0}})]})}):l.error||!l.data?(0,X.jsxs)(x,{p:`lg`,children:[(0,X.jsx)(A,{title:`Dashboard`,description:`Monitor your services and investigate changes.`}),(0,X.jsx)(T,{state:`error`,error:{message:`Your dashboard is unavailable.`,onRetry:()=>void l.refetch()}})]}):(0,X.jsx)(ea,{id:l.data.id,version:l.data.version,spec:l.data.spec,search:t,onSearch:n,onOpen:r,agentAvailable:i,openChat:a},l.data.id)}function ea({id:e,version:t,spec:n,search:r,onSearch:i,onOpen:a,agentAvailable:o,openChat:s}){let[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(!1);Ge((0,Z.useCallback)(()=>m(!0),[]));let h=(0,Z.useRef)(null),g=(0,Z.useId)(),_=Ji(Re().id),v=Yi(h),[y,b]=(0,Z.useState)(()=>new Set),C=(0,Z.useCallback)((e,t)=>b(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r}),[]),w=Be(),[E,D]=(0,Z.useState)(),{zoom:ee,reset:O,resetZoom:k,zoomed:j}=Ui(r,i),M=xe(n,r),[N,P]=(0,Z.useState)(M.refresh??`30s`),I=()=>{if(M.from&&M.to){let e=Date.parse(M.from),t=Date.parse(M.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:Qi[M.range??`1h`]??`1h`,from:void 0,to:void 0})},L=r.compare?r.compare===`1`:n.time.compare===`previous_period`,R=r.vars??{},ie=Fi(`dashboard-${e}`,n,M,R,q,Si),z=(0,Z.useMemo)(()=>pi(n.variables,R,ie.currentData),[n.variables,R,ie.currentData]),[ae,oe]=(0,Z.useState)(()=>window.innerWidth);(0,Z.useEffect)(()=>{let e=0,t=()=>{window.clearTimeout(e),e=window.setTimeout(()=>oe(window.innerWidth),300)};return window.addEventListener(`resize`,t),()=>{window.removeEventListener(`resize`,t),window.clearTimeout(e)}},[]);let se=(0,Z.useMemo)(()=>{let e=Math.max(320,Math.min(ae-64,1600));return Object.fromEntries(n.panels.map(t=>[t.id,e/12*(t.grid?.w??t.width??6)]))},[ae,n]),[ce,le]=(0,Z.useState)(()=>n.panels.map(e=>e.id)),V=Mi({dashboardId:e,version:t,spec:n,time:M,vars:z,compare:L,widths:se,visible:(0,Z.useMemo)(()=>ce.filter(e=>n.panels.some(t=>t.id===e)),[ce,n.panels]),refresh:y.size?`off`:N,enabled:ie.ready});(0,Z.useEffect)(()=>{E===t&&w.refetchQueries({predicate:Ii(e),type:`active`,stale:!0},{cancelRefetch:!1})},[E,t,e,w]);let ue=(0,Z.useMemo)(()=>V.annotations?{...V.annotations,deploys:n.annotations?.deploys===!1?[]:V.annotations.deploys,anomalies:n.annotations?.anomalies===!1?[]:V.annotations.anomalies}:void 0,[V.annotations,n.annotations?.deploys,n.annotations?.anomalies]),fe=ie.error??V.error,H=(e,t)=>{let n={...R};t===void 0?delete n[e]:n[e]=t,i({...r,vars:n},!0)},U=()=>i({...r,edit:r.edit===`1`?void 0:`1`}),W=e=>{e&&v.remember(e),i({...r,view:e},e===void 0)};return Ki(h,{r:()=>V.refetch(),e:U,h:()=>d(!0),"?":()=>m(!0),f:e=>{if(r.view){W();return}let t=e.closest(`[data-panel]`)?.dataset.panel;t&&n.panels.some(e=>e.id===t)&&W(t)}},{modalOpen:u||p||!!r.drill,fullscreenScope:r.view?g:void 0,enabled:_.enabled}),(0,X.jsxs)(S,{component:`section`,ref:h,"aria-label":`Dashboard`,maw:1600,mx:`auto`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,children:[(0,X.jsxs)(x,{gap:`sm`,mb:`md`,children:[(0,X.jsx)(A,{title:n.name,description:n.description||`Monitor your services and investigate changes.`,meta:(0,X.jsx)(Ie,{time:M,updatedAt:V.updatedAt}),actions:(0,X.jsx)(f,{gap:`xs`,children:(0,X.jsx)(We,{label:`Duplicate dashboard`,children:(0,X.jsx)(te,{variant:`subtle`,color:`gray`,"aria-label":`Duplicate dashboard`,onClick:()=>l(!0),children:(0,X.jsx)(ne,{size:16})})})})}),(0,X.jsx)(de,{selecting:y.size>0,time:M,refresh:N,compare:L,editing:r.edit===`1`,fetching:V.fetching,updatedAt:V.updatedAt,onRange:e=>{O(),i({...r,range:e,from:void 0,to:void 0})},onAbsolute:(e,t)=>{O(),i({...r,range:void 0,from:e,to:t})},onZoomOut:I,onRefresh:P,onRefreshNow:V.refetch,onCompare:e=>i({...r,compare:e?`1`:`0`},!0),onEdit:U,onHistory:()=>d(!0)}),(0,X.jsx)(Wi,{variables:n.variables??[],vars:R,options:ie.data??{},onChange:H}),Object.entries(R).filter(([,e])=>e!==`$__all`).length>0&&(0,X.jsx)(f,{gap:6,children:Object.entries(R).filter(([,e])=>e!==`$__all`).map(([e,t])=>(0,X.jsxs)(F,{color:`accent`,size:`compact-xs`,variant:`light`,"aria-label":`$${e} = ${Array.isArray(t)?t.join(`, `):t} ×: remove filter`,onClick:()=>H(e,void 0),children:[`$`,e,` = `,Array.isArray(t)?t.join(`, `):t,` ×`]},e))}),V.annotationError&&(0,X.jsx)(re,{tone:`warning`,title:`Annotations unavailable`,children:V.annotationError}),V.annotations?.truncated&&(0,X.jsx)(re,{tone:`warning`,children:`Annotation history is limited.`})]}),!fe&&V.skippedAt!==null&&(0,X.jsx)(S,{"data-refresh-skipped":!0,children:(0,X.jsxs)(re,{tone:`info`,children:[`The server was busy, so the latest refresh was skipped. Marked panels show data from `,new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`,second:`2-digit`}).format(V.skippedAt),`.`]})}),fe&&(0,X.jsxs)(re,{tone:`danger`,title:ie.error?`Variables could not be loaded`:`Panels could not be loaded`,children:[fe.message,fe instanceof ze&&(0,X.jsx)(`ul`,{children:fe.problems.map((e,t)=>(0,X.jsxs)(`li`,{children:[e.path,`: `,e.message,e.hint?` (${e.hint})`:``]},t))})]}),n.panels.length===0&&(0,X.jsx)(T,{state:`empty`,empty:{title:`No panels yet`,description:`Add a panel to see telemetry on this dashboard.`,action:(0,X.jsx)(F,{onClick:()=>i({...r,edit:`1`}),children:`Add panel`})}}),(0,X.jsx)(bi,{dashboardId:e,version:t,spec:n,vars:z,results:V.results,annotations:ue,fetching:V.fetching,fetchingIds:V.fetchingIds,staleAt:V.staleAt,time:{...M,compare:L?`previous_period`:void 0},onEditExit:()=>i({...r,edit:void 0}),editing:r.edit===`1`,view:r.view,canManage:!0,agentAvailable:o,onOpenChat:s,onRetry:V.retry,onVariable:H,onZoom:ee,zoomed:j,onZoomReset:k,onWiden:I,onView:W,onRangePending:C,shortcutScope:g,onShortcuts:()=>m(!0),overlayOpen:u||p||!!r.drill,returnViewFocus:v.restore,onVisible:le,onPoint:(e,t)=>{let n=B(e,V.results.get(e.id),t,R);n&&i({...r,vars:n.vars,drill:JSON.stringify(n.target)},!1)}}),(0,X.jsx)(pe,{client:Zi,spec:n,time:M,vars:z,target:ve(r.drill),onChange:e=>i({...r,drill:e?JSON.stringify(e):void 0},!1)}),c&&(0,X.jsx)(xi,{spec:n,onClose:()=>l(!1),onCreated:e=>{l(!1),a(e)}}),(0,X.jsx)(Li,{id:e,currentVersion:t,currentSpec:n,opened:u,onClose:()=>d(!1),onRestored:e=>{D(e.version);let t=new Set(e.spec.panels.map(e=>e.id)),n=ve(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,X.jsx)(qi,{opened:p,onClose:()=>m(!1),fullscreen:!!r.view,enabled:_.enabled,onEnabled:_.change})]})}export{kt as n,$i as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/panel-editor-DZGJDQzo.js b/internal/ui/dist/assets/panel-editor-BVRFoShZ.js similarity index 92% rename from internal/ui/dist/assets/panel-editor-DZGJDQzo.js rename to internal/ui/dist/assets/panel-editor-BVRFoShZ.js index 00f65fa50..65fea574b 100644 --- a/internal/ui/dist/assets/panel-editor-DZGJDQzo.js +++ b/internal/ui/dist/assets/panel-editor-BVRFoShZ.js @@ -1 +1 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{D as r,Tt as i,a,j as o,k as s,s as c,w as l}from"./brand-CCQ0JT0F.js";import{T as u,h as d,p as f,x as p}from"./search-DBgztReF.js";import"./page-DZ5HGDWI.js";import{s as m}from"./auth-K3NK-QpB.js";import{T as h,t as g}from"./useQuery-BLTYSIvG.js";import{a as _,r as v}from"./save-dialog-EDUaI5f8.js";import{t as y}from"./page-DI98kZbw.js";import{t as ee}from"./discard-BmoNOAJh.js";var b=n(e(),1),x=t();function S(e,t,n){let r=e.from&&e.to?{range:`1h`,from:e.from,to:e.to}:{range:t?.time?.range??e.range??`1h`};return t?.sql===void 0?!t||!n?{q:``,tab:`query`,...r}:{q:n.text,viz:t.viz,tab:n.editable?`query`:`builder`,...r}:{q:``,sql:t.sql,viz:t.viz,tab:`sql`,...r}}var C=(e,t)=>JSON.stringify(e??null)===JSON.stringify(t??null),w={gauge:`stat`,state_timeline:`timeseries`};function T(e,t){let{query:n,sql:r,viz:i,reduce:a,options:o,drill:s,click:c,unit:l,thresholds:u,better:d,min:f,max:p,...m}=e,h={...m,id:t.id,title:t.title,viz:t.viz,...t.sql===void 0?{query:t.query}:{sql:t.sql}},g=t.sql!==void 0||C(t.query?.measures,n?.measures),_=t.sql===void 0?g&&C(t.query?.by,n?.by):t.sql===r;g?Object.assign(h,{unit:l,thresholds:u,better:d,min:f,max:p}):h.viz in w&&(h.viz=w[h.viz]);let v=h.viz===i;return v&&a&&(h.reduce=a),v&&_&&o&&(h.options=o),s&&t.query&&t.query.from===n?.from&&(h.drill=s),c&&t.query&&C(t.query.by,n?.by)&&(h.click=c),h}function E(e,t){let n={};for(let r of new Set([...Object.keys(e),...Object.keys(t)])){if(r===`id`||r===`grid`)continue;let i=e[r],a=t[r];C(i,a)||(n[r]=a??null)}return n}var D=e=>e===void 0?`not set`:e===`$__all`?`All`:Array.isArray(e)?e.join(`, `):e;function O({dashboardId:e,version:t,spec:n,layoutChanged:C=!1,time:w,vars:O,panel:k,onClose:A}){let j=h(),[M,N]=(0,b.useState)(),{version:P,spec:F,panel:I}=M??{version:t,spec:n,panel:k},[L,R]=(0,b.useState)(),z=(0,b.useRef)(null);(0,b.useEffect)(()=>{L===`stale`&&z.current?.focus()},[L]);let B=g({queryKey:[`panel-editor-format`,e,k?.id,t],queryFn:({signal:e})=>_({query:k.query,viz:k.viz},e),enabled:!!k?.query,staleTime:1/0,retry:!1}),V=!k?.query||B.isSuccess,[H,U]=(0,b.useState)(),W=H??(V?S(w,k,B.data):void 0),[G,K]=(0,b.useState)(k?.title??``),[q,J]=(0,b.useState)(!1),Y=q||G.trim()!==(k?.title??``)||k!==void 0&&W?.viz!==void 0&&W.viz!==k.viz,X=ee(Y,A,`this panel`),Z=(0,b.useRef)(!1),Q=async()=>{R(`loading`);try{let t=await d(e);j.setQueryData([`dashboard`,e],t),Z.current=!0,N({version:t.version,spec:t.spec,panel:k&&t.spec.panels.find(e=>e.id===k.id)}),R(void 0)}catch(e){R(e instanceof Error?e.message:`The latest version could not be loaded.`)}},te=async t=>{let n=G.trim()||t.title,r=I?void 0:{...t,title:n,id:v(`panel`,F.panels.map(e=>e.id))},i=I?`Edited ${n}`:`Added ${n}`,a=C&&!Z.current;try{let o=a?await u(e,{...F,panels:r?[...F.panels,r]:F.panels.map(e=>e.id===I.id?{...t,id:e.id,title:n,grid:e.grid}:e)},P,`${i} and saved layout`):await p(e,[r?{op:`add_panel`,panel:r}:{op:`update_panel`,id:I.id,set:E(I,{...t,id:I.id,title:n})}],P,i);await j.cancelQueries({queryKey:[`dashboard`,e],exact:!0}),j.setQueryData([`dashboard`,e],o),j.invalidateQueries({queryKey:f}),j.invalidateQueries({queryKey:[`dashboard-versions`,e]}),A()}catch(e){if(e instanceof m&&e.code===`dashboard_version_conflict`){R(`stale`);return}throw e instanceof m&&e.problems.length>0?Error(e.problems.map(e=>e.message).join(` `)):e}},$=F.variables??[];return(0,x.jsxs)(r,{opened:!0,onClose:X.request,closeOnEscape:!1,title:k?`Edit panel · ${k.title}`:`Add panel`,size:`min(1280px, 100vw - 32px)`,onKeyDown:X.onKeyDown,children:[X.prompt,L&&(0,x.jsx)(i,{mb:`sm`,children:(0,x.jsxs)(c,{tone:L===`stale`||L===`loading`?`warning`:`danger`,title:`Someone saved this dashboard since you opened it`,children:[(0,x.jsx)(o,{size:`sm`,children:L===`stale`||L===`loading`?`Load the latest version, then save again. Your draft stays as it is.`:L}),(0,x.jsx)(s,{ref:z,mt:`sm`,size:`compact-sm`,loading:L===`loading`,onClick:()=>void Q(),children:`Load latest`})]})}),(0,x.jsx)(l,{label:`Panel title`,px:`lg`,value:G,onChange:e=>K(e.currentTarget.value),placeholder:k?void 0:`Named after the query`}),$.length>0&&(0,x.jsxs)(o,{size:`xs`,c:`dimmed`,px:`lg`,pt:`xs`,"data-editor-variables":!0,children:[`Runs with the dashboard's variables: `,$.map((e,t)=>(0,x.jsxs)(`span`,{children:[t>0&&` · `,(0,x.jsxs)(`code`,{children:[`$`,e.name]}),` = `,D(O[e.name])]},e.name))]}),B.error?(0,x.jsx)(i,{children:(0,x.jsx)(c,{tone:`danger`,title:`This panel's query could not be opened`,children:B.error.message})}):W?(0,x.jsx)(y,{search:W,onSearch:U,context:{spec:F,vars:O,panel:I,compose:I?e=>T(I,e):void 0,onDirtyChange:J,cancel:X.request,save:{label:k?`Save panel`:`Add panel`,run:te},initial:k?.query&&B.data&&!B.data.editable?{query:k.query,formatted:B.data}:void 0}}):(0,x.jsx)(a,{state:`loading`,loadingLabel:`Loading the panel's query`,rows:3})]})}export{O as default}; \ No newline at end of file +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{D as r,Tt as i,a,j as o,k as s,s as c,w as l}from"./brand-D6fP-cLS.js";import{T as u,h as d,p as f,x as p}from"./search-D_K9J6yO.js";import"./page-BABqeqdg.js";import{s as m}from"./auth-DWqIkMZS.js";import{T as h,t as g}from"./useQuery-BLTYSIvG.js";import{a as _,r as v}from"./save-dialog-Chbkq2Xp.js";import{t as y}from"./page-1Rod7OFH.js";import{t as ee}from"./discard-NZfxCIcK.js";var b=n(e(),1),x=t();function S(e,t,n){let r=e.from&&e.to?{range:`1h`,from:e.from,to:e.to}:{range:t?.time?.range??e.range??`1h`};return t?.sql===void 0?!t||!n?{q:``,tab:`query`,...r}:{q:n.text,viz:t.viz,tab:n.editable?`query`:`builder`,...r}:{q:``,sql:t.sql,viz:t.viz,tab:`sql`,...r}}var C=(e,t)=>JSON.stringify(e??null)===JSON.stringify(t??null),w={gauge:`stat`,state_timeline:`timeseries`};function T(e,t){let{query:n,sql:r,viz:i,reduce:a,options:o,drill:s,click:c,unit:l,thresholds:u,better:d,min:f,max:p,...m}=e,h={...m,id:t.id,title:t.title,viz:t.viz,...t.sql===void 0?{query:t.query}:{sql:t.sql}},g=t.sql!==void 0||C(t.query?.measures,n?.measures),_=t.sql===void 0?g&&C(t.query?.by,n?.by):t.sql===r;g?Object.assign(h,{unit:l,thresholds:u,better:d,min:f,max:p}):h.viz in w&&(h.viz=w[h.viz]);let v=h.viz===i;return v&&a&&(h.reduce=a),v&&_&&o&&(h.options=o),s&&t.query&&t.query.from===n?.from&&(h.drill=s),c&&t.query&&C(t.query.by,n?.by)&&(h.click=c),h}function E(e,t){let n={};for(let r of new Set([...Object.keys(e),...Object.keys(t)])){if(r===`id`||r===`grid`)continue;let i=e[r],a=t[r];C(i,a)||(n[r]=a??null)}return n}var D=e=>e===void 0?`not set`:e===`$__all`?`All`:Array.isArray(e)?e.join(`, `):e;function O({dashboardId:e,version:t,spec:n,layoutChanged:C=!1,time:w,vars:O,panel:k,onClose:A}){let j=h(),[M,N]=(0,b.useState)(),{version:P,spec:F,panel:I}=M??{version:t,spec:n,panel:k},[L,R]=(0,b.useState)(),z=(0,b.useRef)(null);(0,b.useEffect)(()=>{L===`stale`&&z.current?.focus()},[L]);let B=g({queryKey:[`panel-editor-format`,e,k?.id,t],queryFn:({signal:e})=>_({query:k.query,viz:k.viz},e),enabled:!!k?.query,staleTime:1/0,retry:!1}),V=!k?.query||B.isSuccess,[H,U]=(0,b.useState)(),W=H??(V?S(w,k,B.data):void 0),[G,K]=(0,b.useState)(k?.title??``),[q,J]=(0,b.useState)(!1),Y=q||G.trim()!==(k?.title??``)||k!==void 0&&W?.viz!==void 0&&W.viz!==k.viz,X=ee(Y,A,`this panel`),Z=(0,b.useRef)(!1),Q=async()=>{R(`loading`);try{let t=await d(e);j.setQueryData([`dashboard`,e],t),Z.current=!0,N({version:t.version,spec:t.spec,panel:k&&t.spec.panels.find(e=>e.id===k.id)}),R(void 0)}catch(e){R(e instanceof Error?e.message:`The latest version could not be loaded.`)}},te=async t=>{let n=G.trim()||t.title,r=I?void 0:{...t,title:n,id:v(`panel`,F.panels.map(e=>e.id))},i=I?`Edited ${n}`:`Added ${n}`,a=C&&!Z.current;try{let o=a?await u(e,{...F,panels:r?[...F.panels,r]:F.panels.map(e=>e.id===I.id?{...t,id:e.id,title:n,grid:e.grid}:e)},P,`${i} and saved layout`):await p(e,[r?{op:`add_panel`,panel:r}:{op:`update_panel`,id:I.id,set:E(I,{...t,id:I.id,title:n})}],P,i);await j.cancelQueries({queryKey:[`dashboard`,e],exact:!0}),j.setQueryData([`dashboard`,e],o),j.invalidateQueries({queryKey:f}),j.invalidateQueries({queryKey:[`dashboard-versions`,e]}),A()}catch(e){if(e instanceof m&&e.code===`dashboard_version_conflict`){R(`stale`);return}throw e instanceof m&&e.problems.length>0?Error(e.problems.map(e=>e.message).join(` `)):e}},$=F.variables??[];return(0,x.jsxs)(r,{opened:!0,onClose:X.request,closeOnEscape:!1,title:k?`Edit panel · ${k.title}`:`Add panel`,size:`min(1280px, 100vw - 32px)`,onKeyDown:X.onKeyDown,children:[X.prompt,L&&(0,x.jsx)(i,{mb:`sm`,children:(0,x.jsxs)(c,{tone:L===`stale`||L===`loading`?`warning`:`danger`,title:`Someone saved this dashboard since you opened it`,children:[(0,x.jsx)(o,{size:`sm`,children:L===`stale`||L===`loading`?`Load the latest version, then save again. Your draft stays as it is.`:L}),(0,x.jsx)(s,{ref:z,mt:`sm`,size:`compact-sm`,loading:L===`loading`,onClick:()=>void Q(),children:`Load latest`})]})}),(0,x.jsx)(l,{label:`Panel title`,px:`lg`,value:G,onChange:e=>K(e.currentTarget.value),placeholder:k?void 0:`Named after the query`}),$.length>0&&(0,x.jsxs)(o,{size:`xs`,c:`dimmed`,px:`lg`,pt:`xs`,"data-editor-variables":!0,children:[`Runs with the dashboard's variables: `,$.map((e,t)=>(0,x.jsxs)(`span`,{children:[t>0&&` · `,(0,x.jsxs)(`code`,{children:[`$`,e.name]}),` = `,D(O[e.name])]},e.name))]}),B.error?(0,x.jsx)(i,{children:(0,x.jsx)(c,{tone:`danger`,title:`This panel's query could not be opened`,children:B.error.message})}):W?(0,x.jsx)(y,{search:W,onSearch:U,context:{spec:F,vars:O,panel:I,compose:I?e=>T(I,e):void 0,onDirtyChange:J,cancel:X.request,save:{label:k?`Save panel`:`Add panel`,run:te},initial:k?.query&&B.data&&!B.data.editable?{query:k.query,formatted:B.data}:void 0}}):(0,x.jsx)(a,{state:`loading`,loadingLabel:`Loading the panel's query`,rows:3})]})}export{O as default}; \ No newline at end of file diff --git a/internal/ui/dist/assets/save-dialog-EDUaI5f8.js b/internal/ui/dist/assets/save-dialog-Chbkq2Xp.js similarity index 99% rename from internal/ui/dist/assets/save-dialog-EDUaI5f8.js rename to internal/ui/dist/assets/save-dialog-Chbkq2Xp.js index b0ae31e80..ca6c5a620 100644 --- a/internal/ui/dist/assets/save-dialog-EDUaI5f8.js +++ b/internal/ui/dist/assets/save-dialog-Chbkq2Xp.js @@ -1,4 +1,4 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{D as r,G as i,T as a,Tt as o,j as s,k as c,s as l,w as u}from"./brand-CCQ0JT0F.js";import{g as d,h as f,i as p,p as m}from"./toolbar-DV2TSB0G.js";import{C as h,E as g,_,f as v,h as y,p as ee,x as b,y as x}from"./search-DBgztReF.js";import{s as te}from"./auth-K3NK-QpB.js";import{T as ne,t as re}from"./useQuery-BLTYSIvG.js";var ie={exemplars:h,trace:_,span:p},S=n(e(),1),ae=[],oe=[];(()=>{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=oe[r])t=r+1;else return!0;if(t==n)return!1}}function ce(e){return e>=127462&&e<=127487}var le=8205;function ue(e,t,n=!0,r=!0){return(n?de:fe)(e,t,r)}function de(e,t,n){if(t==e.length)return t;t&&me(e.charCodeAt(t))&&he(e.charCodeAt(t-1))&&t--;let r=pe(e,t);for(t+=ge(r);t=0&&ce(pe(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function fe(e,t,n){for(;t>1;){let r=de(e,t-2,n);if(r=56320&&e<57344}function he(e){return e>=55296&&e<56320}function ge(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]=Ee(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),ve.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]=Ee(this,e,t);let n=[];return this.decompose(e,t,n,0),ve.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 Se(this),i=new Se(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 Se(this,e)}iterRange(e,t=this.length){return new Ce(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 we(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 _e(t):ve.from(_e.split(t,[]))}},_e=class e extends C{constructor(e,t=ye(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 Te(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(xe(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=be(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]=Ee(this,t,n);let i=be(this.text,be(r.text,xe(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):ve.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{D as r,G as i,T as a,Tt as o,j as s,k as c,s as l,w as u}from"./brand-D6fP-cLS.js";import{g as d,h as f,i as p,p as m}from"./toolbar-DV46cPGs.js";import{C as h,E as g,_,f as v,h as y,p as ee,x as b,y as x}from"./search-D_K9J6yO.js";import{s as te}from"./auth-DWqIkMZS.js";import{T as ne,t as re}from"./useQuery-BLTYSIvG.js";var ie={exemplars:h,trace:_,span:p},S=n(e(),1),ae=[],oe=[];(()=>{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=oe[r])t=r+1;else return!0;if(t==n)return!1}}function ce(e){return e>=127462&&e<=127487}var le=8205;function ue(e,t,n=!0,r=!0){return(n?de:fe)(e,t,r)}function de(e,t,n){if(t==e.length)return t;t&&me(e.charCodeAt(t))&&he(e.charCodeAt(t-1))&&t--;let r=pe(e,t);for(t+=ge(r);t=0&&ce(pe(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function fe(e,t,n){for(;t>1;){let r=de(e,t-2,n);if(r=56320&&e<57344}function he(e){return e>=55296&&e<56320}function ge(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]=Ee(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),ve.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]=Ee(this,e,t);let n=[];return this.decompose(e,t,n,0),ve.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 Se(this),i=new Se(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 Se(this,e)}iterRange(e,t=this.length){return new Ce(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 we(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 _e(t):ve.from(_e.split(t,[]))}},_e=class e extends C{constructor(e,t=ye(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 Te(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(xe(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=be(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]=Ee(this,t,n);let i=be(this.text,be(r.text,xe(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):ve.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=` `){[e,t]=Ee(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}},ve=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]=Ee(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]=Ee(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 _e(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 _e&&c&&(n=u[u.length-1])instanceof _e&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new _e(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 _e([``],0);function ye(e){let t=-1;for(let n of e)t+=n.length+1;return t}function be(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 _e?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 _e?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 _e){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 _e?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)}},Ce=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new Se(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!=``}},we=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()},Se.prototype[Symbol.iterator]=Ce.prototype[Symbol.iterator]=we.prototype[Symbol.iterator]=function(){return this});var Te=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 Ee(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function w(e,t,n=!0,r=!0){return ue(e,t,n,r)}function De(e){return e>=56320&&e<57344}function Oe(e){return e>=55296&&e<56320}function ke(e,t){let n=e.charCodeAt(t);if(!Oe(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return De(r)?(n-55296<<10)+(r-56320)+65536:n}function Ae(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function je(e){return e<65536?1:2}var Me=/\r\n?|\n/,T=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(T||={}),Ne=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!=T.Simple&&c>=e&&(n==T.TrackDel&&re||n==T.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)}},Pe=class e extends Ne{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 Ie(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return Le(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&&Fe(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||Me)):l:C.empty,d=u.length;if(e==s&&d==0)return;eo&&E(i,e-o,-1),E(i,s-e,d),Fe(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 Fe(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 Le(e,t,n,r=!1){let i=[],a=r?[]:null,o=new ze(e),s=new ze(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);E(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 ze=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)}},Be=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 D.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return D.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 D.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},D=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=>Be.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 Ve(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var He=0,O=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=He++,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:Ue),!!t.static,t.enables)}of(e){return new We([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new We(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new We(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function Ue(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var We=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=He++}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)||Ke(e,c)){let r=t(e);if(a?!Ge(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=at(o,c);if(this.dependencies.every(t=>t instanceof O?o.facet(t)===e.facet(t):t instanceof Ye?o.field(t,!1)==e.field(t,!1):!0)||(a?Ge(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 Ge(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(Je).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(Je),i=n.facet(Je),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,Je.of({field:this,create:e})]}get extension(){return this}},Xe={lowest:4,low:3,default:2,high:1,highest:0};function Ze(e){return t=>new $e(t,e)}var Qe={highest:Ze(Xe.highest),high:Ze(Xe.high),default:Ze(Xe.default),low:Ze(Xe.low),lowest:Ze(Xe.lowest)},$e=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},et=class e{of(e){return new tt(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},tt=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},nt=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 rt(t,n,o))e instanceof Ye?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,Ue(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=>qe(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function rt(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 tt&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof tt){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 $e)a(e.inner,e.prec);else if(e instanceof Ye)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof We)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,Xe.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,Xe.default),r.reduce((e,t)=>e.concat(t))}function it(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 at(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var ot=O.define(),st=O.define({combine:e=>e.some(e=>e),static:!0}),ct=O.define({combine:e=>e.length?e[0]:void 0,static:!0}),lt=O.define(),ut=O.define(),dt=O.define(),ft=O.define({combine:e=>e.length?e[0]:!1}),pt=class{constructor(e,t){this.type=e,this.value=t}static define(){return new mt}},mt=class{of(e){return new pt(this,e)}},ht=class{constructor(e){this.map=e}of(e){return new k(this,e)}},k=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 ht(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}};k.reconfigure=k.define(),k.appendConfig=k.define();var A=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&&Ve(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]==`.`))}};A.time=pt.define(),A.userEvent=pt.define(),A.addToHistory=pt.define(),A.remote=pt.define();function gt(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 A?i:Array.isArray(i)&&i.length==1&&i[0]instanceof A?i[0]:yt(t,Ct(i),!1)}return e}function xt(e){let t=e.startState,n=t.facet(dt),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=_t(r,vt(t,a,e.changes.newLength),!0))}return r==e?e:A.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var St=[];function Ct(e){return e==null?St:Array.isArray(e)?e:[e]}var wt=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(wt||={}),Tt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Et;try{Et=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function Dt(e){if(Et)return Et.test(e);for(let t=0;t`€`&&(n.toUpperCase()!=n.toLowerCase()||Tt.test(n)))return!0}return!1}function Ot(e){return t=>{if(!/\S/.test(t))return wt.Space;if(Dt(t))return wt.Word;for(let n=0;n-1)return wt.Word;return wt.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(k.reconfigure)?(n=null,r=e.value):e.is(k.appendConfig)&&(n=null,r=Ct(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=nt.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(st)?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:D.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=Ct(n.effects);for(let n=1;nn.spec.fromJSON(a,e)))}}return e.create({doc:t.doc,selection:D.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=nt.resolve(t.extensions||[],new Map),r=t.doc instanceof C?t.doc:C.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||Me)),i=t.selection?t.selection instanceof D?t.selection:D.single(t.selection.anchor,t.selection.head):D.single(0);return Ve(i,r.length),n.staticFacet(st)||(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/search-Bj_SOIkw.js b/internal/ui/dist/assets/search-CDra9nG2.js similarity index 95% rename from internal/ui/dist/assets/search-Bj_SOIkw.js rename to internal/ui/dist/assets/search-CDra9nG2.js index 2fba5a10f..7a8915fe0 100644 --- a/internal/ui/dist/assets/search-Bj_SOIkw.js +++ b/internal/ui/dist/assets/search-CDra9nG2.js @@ -1 +1 @@ -import{a as e,d as t,r as n}from"./search-DBgztReF.js";var r=[`stat`,`gauge`,`timeseries`,`bar`,`table`,`heatmap`,`histogram`,`scatter`,`state_timeline`,`logs`,`log_patterns`,`traces`,`service_map`,`health`],i=9999999,a=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`];function o(i){let o={q:``,range:`1h`,tab:`query`};if(i.v!==void 0&&String(i.v)!==`1`)return o;typeof i.q==`string`&&(o.q=i.q),typeof i.viz==`string`&&r.includes(i.viz)&&(o.viz=i.viz),typeof i.range==`string`&&e.includes(i.range)&&(o.range=i.range),n(i.from)&&n(i.to)&&Date.parse(i.from)0&&(o.picks=s);let c=t(i.drill);return c&&(o.drill=JSON.stringify(c)),typeof i.sort==`string`&&/^\+?[a-z_]{1,40}$/.test(i.sort)&&(o.sort=i.sort),o}function s(e){let t={v:`1`};e.q&&(t.q=e.q),e.viz&&(t.viz=e.viz),e.from&&e.to?(t.from=e.from,t.to=e.to):e.range!==`1h`&&(t.range=e.range),e.tab!==`query`&&(t.tab=e.tab),e.sql&&(t.sql=e.sql),e.sort&&(t.sort=e.sort),e.drill&&(t.drill=JSON.parse(e.drill));for(let[n,r]of Object.entries(e.picks??{}))r&&(t[n]=r);return t}function c(e){return e.from&&e.to?{from:e.from,to:e.to,refresh:`off`}:{range:e.range,refresh:`off`}}export{s as i,i as n,o as r,c as t}; \ No newline at end of file +import{a as e,d as t,r as n}from"./search-D_K9J6yO.js";var r=[`stat`,`gauge`,`timeseries`,`bar`,`table`,`heatmap`,`histogram`,`scatter`,`state_timeline`,`logs`,`log_patterns`,`traces`,`service_map`,`health`],i=9999999,a=[`trace`,`debug`,`info`,`warn`,`error`,`fatal`];function o(i){let o={q:``,range:`1h`,tab:`query`};if(i.v!==void 0&&String(i.v)!==`1`)return o;typeof i.q==`string`&&(o.q=i.q),typeof i.viz==`string`&&r.includes(i.viz)&&(o.viz=i.viz),typeof i.range==`string`&&e.includes(i.range)&&(o.range=i.range),n(i.from)&&n(i.to)&&Date.parse(i.from)0&&(o.picks=s);let c=t(i.drill);return c&&(o.drill=JSON.stringify(c)),typeof i.sort==`string`&&/^\+?[a-z_]{1,40}$/.test(i.sort)&&(o.sort=i.sort),o}function s(e){let t={v:`1`};e.q&&(t.q=e.q),e.viz&&(t.viz=e.viz),e.from&&e.to?(t.from=e.from,t.to=e.to):e.range!==`1h`&&(t.range=e.range),e.tab!==`query`&&(t.tab=e.tab),e.sql&&(t.sql=e.sql),e.sort&&(t.sort=e.sort),e.drill&&(t.drill=JSON.parse(e.drill));for(let[n,r]of Object.entries(e.picks??{}))r&&(t[n]=r);return t}function c(e){return e.from&&e.to?{from:e.from,to:e.to,refresh:`off`}:{range:e.range,refresh:`off`}}export{s as i,i as n,o as r,c as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/search-DBgztReF.js b/internal/ui/dist/assets/search-D_K9J6yO.js similarity index 99% rename from internal/ui/dist/assets/search-DBgztReF.js rename to internal/ui/dist/assets/search-D_K9J6yO.js index 04a35fdee..9220ff153 100644 --- a/internal/ui/dist/assets/search-DBgztReF.js +++ b/internal/ui/dist/assets/search-D_K9J6yO.js @@ -1,2 +1,2 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{Dt as r,Et as i,Ft as a,Ht as o,Jt as s,Lt as c,M as l,Nt as u,P as d,Pt as f,Q as p,Qt as m,Tt as h,X as g,Xt as _,Y as v,Z as y,Zt as b,_n as x,_t as S,an as C,bn as w,bt as T,dn as E,en as D,fn as O,ft as k,gn as A,gt as ee,hn as te,ht as j,in as ne,it as re,lt as M,mt as N,nn as P,on as ie,pt as ae,sn as oe,st as F,tt as I,ut as L,vt as se,wt as R,x as ce,yt as le}from"./brand-CCQ0JT0F.js";import{t as ue}from"./noop-mXPS5vjY.js";import{c as de,l as fe,o as pe,s as me}from"./format-fsvZ_y78.js";import{a as he,s as ge}from"./auth-K3NK-QpB.js";var z=n(e(),1);function B(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}var V=t();function _e(e,t,n){for(let n=e-1;n>=0;--n)if(!t[n].disabled)return n;if(n){for(let e=t.length-1;e>-1;--e)if(!t[e].disabled)return e}return e}function ve(e,t,n){for(let n=e+1;n{n?.(s);let c=Array.from(B(s.currentTarget,e)?.querySelectorAll(t)||[]).filter(t=>ye(s.currentTarget,t,e)),l=c.findIndex(e=>s.currentTarget===e),u=ve(l,c,r),d=_e(l,c,r),f=a===`rtl`?d:u,p=a===`rtl`?u:d;switch(s.key){case`ArrowRight`:o===`horizontal`&&(s.stopPropagation(),s.preventDefault(),c[f].focus(),i&&c[f].click());break;case`ArrowLeft`:o===`horizontal`&&(s.stopPropagation(),s.preventDefault(),c[p].focus(),i&&c[p].click());break;case`ArrowUp`:o===`vertical`&&(s.stopPropagation(),s.preventDefault(),c[d].focus(),i&&c[d].click());break;case`ArrowDown`:o===`vertical`&&(s.stopPropagation(),s.preventDefault(),c[u].focus(),i&&c[u].click());break;case`Home`:s.stopPropagation(),s.preventDefault(),c[ve(-1,c,!1)]?.focus();break;case`End`:s.stopPropagation(),s.preventDefault(),c[_e(c.length,c,!1)]?.focus()}}}function be(e,t={active:!0}){return typeof e!=`function`||!t.active?t.onKeyDown||ue:n=>{n.key===`Escape`&&(e(n),t.onTrigger?.())}}function U(e,t){return n=>{e?.(n),t?.(n)}}function xe(e,t,n){return n?Array.from(B(n,t)?.querySelectorAll(e)||[]).findIndex(e=>e===n):null}var Se=[`mousedown`,`touchstart`];function Ce(e,t,n,r=!0,i=!1){let a=(0,z.useRef)(null),o=t||Se,s=(0,z.useEffectEvent)(t=>{let{target:r}=t??{};if(!document.body.contains(r)&&r?.tagName!==`HTML`)return;let i=t.composedPath();Array.isArray(n)?n.every(e=>!!e&&!i.includes(e))&&e(t):a.current&&!i.includes(a.current)&&e(t)}),c=o.join(`,`);return(0,z.useEffect)(()=>{if(!r)return;let e=c.split(`,`);return e.forEach(e=>document.addEventListener(e,s,i)),()=>{e.forEach(e=>document.removeEventListener(e,s,i))}},[c,r,i]),a}var we=[`mouse`,`touch`],Te=10;function Ee(e,t={}){let{threshold:n=400,events:r=we,cancelOnMove:i=!1,onStart:a,onFinish:o,onCancel:s}=t,c=(0,z.useRef)(!1),l=(0,z.useRef)(!1),u=(0,z.useRef)(-1),d=(0,z.useRef)(null);(0,z.useEffect)(()=>()=>window.clearTimeout(u.current),[]);let f=r.join(`,`);return(0,z.useMemo)(()=>{if(typeof e!=`function`)return{};let t=i!==!1,f=i===!0?Te:i===!1?0:i,p=t=>{(ke(t)||Oe(t))&&(a&&a(t),d.current=De(t),l.current=!0,u.current=window.setTimeout(()=>{e(t),c.current=!0},n))},m=e=>{(ke(e)||Oe(e))&&(c.current?o&&o(e):l.current&&s&&s(e),c.current=!1,l.current=!1,d.current=null,u.current!==-1&&(window.clearTimeout(u.current),u.current=-1))},h=e=>{if(!t||!l.current||c.current)return;let n=De(e);if(!n||!d.current)return;let r=n.x-d.current.x,i=n.y-d.current.y;Math.sqrt(r*r+i*i)>f&&m(e)},g={};return r.includes(`mouse`)&&(g.onMouseDown=p,g.onMouseUp=m,g.onMouseLeave=m,t&&(g.onMouseMove=h)),r.includes(`touch`)&&(g.onTouchStart=p,g.onTouchEnd=m,g.onTouchCancel=m,t&&(g.onTouchMove=h)),g},[e,n,s,o,a,i,f])}function De(e){if(Oe(e)){let t=e.touches[0]??e.changedTouches[0];return t?{x:t.clientX,y:t.clientY}:null}return{x:e.clientX,y:e.clientY}}function Oe(e){return window.TouchEvent?e.nativeEvent instanceof TouchEvent:`touches`in e.nativeEvent}function ke(e){return e.nativeEvent instanceof MouseEvent}function W({open:e,close:t,openDelay:n,closeDelay:r}){let i=(0,z.useRef)(-1),a=(0,z.useRef)(-1),o=()=>{window.clearTimeout(i.current),window.clearTimeout(a.current)};return(0,z.useEffect)(()=>o,[]),{openDropdown:()=>{o(),n===0||n===void 0?e():i.current=window.setTimeout(e,n)},closeDropdown:()=>{o(),r===0||r===void 0?t():a.current=window.setTimeout(t,r)}}}var[Ae,G]=A(`Popover component was not found in the tree`);function je({childProps:e,disabled:t,opened:n,longPressDelay:r=500,setReference:i,open:a}){let o=(0,z.useRef)(!1),s=(0,z.useRef)(!1),c=(0,z.useRef)(null),l=(0,z.useRef)(t);l.current=t;let u=(e,t,n)=>{i({getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t,toJSON:()=>void 0}),contextElement:n}),a()},d=U(e.onMouseDown,e=>{t||e.button===2&&e.stopPropagation()}),f=U(e.onContextMenu,e=>{t||e.defaultPrevented||(e.preventDefault(),!s.current&&(u(e.clientX,e.clientY,e.currentTarget),o.current&&(s.current=!0)))}),p=Ee(e=>{if(l.current||s.current)return;let t=e,n=t.touches[0]??t.changedTouches[0];n&&(u(n.clientX,n.clientY,c.current),s.current=!0)},{threshold:r,events:[`touch`],cancelOnMove:!0,onStart:e=>{o.current=!0,s.current=!1,c.current=e.currentTarget},onFinish:e=>{o.current=!1,s.current=!1,l.current||e.preventDefault()},onCancel:()=>{o.current=!1,s.current=!1}});return{onContextMenu:f,onMouseDown:d,onTouchStart:U(e.onTouchStart,p.onTouchStart),onTouchEnd:U(e.onTouchEnd,p.onTouchEnd),onTouchCancel:U(e.onTouchCancel,p.onTouchCancel),onTouchMove:U(e.onTouchMove,p.onTouchMove),style:t?e.style:{...e.style,WebkitTouchCallout:`none`,WebkitUserSelect:`none`,userSelect:`none`},"data-expanded":n?!0:void 0}}function Me(e){let{children:t,disabled:n,longPressDelay:r}=a(`PopoverContextMenu`,null,e),i=m(t);if(!i)throw Error(`Popover.ContextMenu component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let o=G(),s=je({childProps:i.props,disabled:n||o.disabled,opened:o.opened,longPressDelay:r,setReference:o.reference,open:()=>{o.opened||o.onToggle()}});return(0,z.cloneElement)(i,s)}Me.displayName=`@mantine/core/PopoverContextMenu`;var Ne={dropdown:`m_38a85659`,arrow:`m_a31dc6c1`,overlay:`m_3d7bc908`},Pe=r(e=>{let t=a(`PopoverDropdown`,null,e),{className:n,style:r,vars:i,children:o,onKeyDownCapture:s,variant:c,classNames:l,styles:u,ref:d,...f}=t,p=G(),{dir:m}=R(),_=p.arrowPosition===`merge`&&p.withArrow?de({position:p.placement,dir:m}):void 0,b=C({opened:p.opened,shouldReturnFocus:p.returnFocus}),x=p.withRoles?{"aria-labelledby":p.getTargetId(),id:p.getDropdownId(),role:`dialog`,tabIndex:-1}:{},S=P(d,p.floating);return p.disabled?null:(0,V.jsx)(y,{...p.portalProps,withinPortal:p.withinPortal,children:(0,V.jsx)(g,{mounted:p.opened,...p.transitionProps,transition:p.transitionProps?.transition||`fade`,duration:p.transitionProps?.duration??150,keepMounted:p.keepMounted,keepMountedMode:p.keepMountedMode,exitDuration:typeof p.transitionProps?.exitDuration==`number`?p.transitionProps.exitDuration:p.transitionProps?.duration,children:e=>(0,V.jsx)(v,{active:p.trapFocus&&p.opened,innerRef:S,children:(0,V.jsxs)(h,{...x,...f,variant:c,onKeyDownCapture:be(()=>{p.onClose?.(),p.onDismiss?.()},{active:p.closeOnEscape,onTrigger:b,onKeyDown:s}),"data-position":p.placement,"data-fixed":p.floatingStrategy===`fixed`||void 0,...p.getStyles(`dropdown`,{className:n,props:t,classNames:l,styles:u,style:[{...e,..._,zIndex:p.zIndex,top:p.y??0,left:p.x??0,width:p.width===`target`?void 0:w(p.width),...p.referenceHidden?{display:`none`}:null},p.resolvedStyles?.dropdown,u?.dropdown,r]}),children:[o,(0,V.jsx)(me,{ref:p.arrowRef,arrowX:p.arrowX,arrowY:p.arrowY,visible:p.withArrow,position:p.placement,arrowSize:p.arrowSize,arrowRadius:p.arrowRadius,arrowOffset:p.arrowOffset,arrowPosition:p.arrowPosition,...p.getStyles(`arrow`,{props:t,classNames:l,styles:u})})]})})})})});Pe.classes=Ne,Pe.displayName=`@mantine/core/PopoverDropdown`;var Fe={refProp:`ref`,popupType:`dialog`},Ie=r(e=>{let{children:t,refProp:n,popupType:r,ref:i,...o}=a(`PopoverTarget`,Fe,e),s=m(t);if(!s)throw Error(`Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let c=o,l=G(),u=P(l.reference,fe(s),i),d=l.withRoles?{"aria-haspopup":r,"aria-expanded":l.opened,"aria-controls":l.opened?l.getDropdownId():void 0,id:l.getTargetId()}:{},f=s.props;return(0,z.cloneElement)(s,{...c,...d,...l.targetProps,className:_(l.targetProps.className,c.className,f.className),[n]:u,...l.controlled?null:{onClick:e=>{l.onToggle(),f.onClick?.(e)}}})});Ie.displayName=`@mantine/core/PopoverTarget`;function Le(e){if(e===void 0)return{shift:!0,flip:!0};let t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function Re(e,t,n,r){let i=Le(e.middlewares),a=[S(e.offset),N()];if(i.flip&&!n){let e=typeof i.flip==`boolean`?{}:i.flip,t=r?{fallbackStrategy:`initialPlacement`,...e}:e;a.push(ae(t))}if(i.shift){let t=typeof i.shift==`boolean`?{}:i.shift;a.push(se(n=>{let r=n.placement.startsWith(`top`)||n.placement.startsWith(`bottom`);return{limiter:ee(),padding:5,...e.width===`target`&&r?{mainAxis:!1}:null,...t}}))}return i.inline&&a.push(typeof i.inline==`boolean`?j():j(i.inline)),a.push(k({element:e.arrowRef,padding:e.arrowOffset})),(i.size||e.width===`target`)&&a.push(le({...typeof i.size==`boolean`?{}:i.size,apply({rects:n,availableWidth:r,availableHeight:a,...o}){let s=t().refs.floating.current?.style??{};i.size&&(typeof i.size==`object`&&i.size.apply?i.size.apply({rects:n,availableWidth:r,availableHeight:a,...o}):Object.assign(s,{maxWidth:`${r}px`,maxHeight:`${a}px`})),e.width===`target`&&Object.assign(s,{width:`${n.reference.width}px`})}})),a}function ze(e){let[t,n]=D({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=(0,z.useRef)(t),i=(0,z.useRef)(!1),[a,o]=(0,z.useState)(null),s=e.preventPositionChangeWhenVisible!==!1,c=(0,z.useRef)(t);t!==c.current&&(c.current=t,t&&a!==null&&o(null));let l=(0,z.useRef)(e.position);e.position!==l.current&&(l.current=e.position,i.current=!1,a!==null&&o(null));let u=(0,z.useCallback)(()=>o(null),[]),d=()=>{t&&!e.disabled&&n(!1)},f=()=>{e.disabled||n(!t)},p=F({open:t,strategy:e.strategy,placement:s?a??e.position:e.position,middleware:Re(e,()=>p,s&&a!==null,s),whileElementsMounted:e.keepMounted?void 0:T});(0,z.useEffect)(()=>{if(!e.keepMounted)return;let n=p.refs.reference.current,r=p.refs.floating.current;if(t&&n&&r)return T(n,r,p.update)},[e.keepMounted,t,p.update,p.elements.reference,p.elements.floating]),oe(()=>{if(!t){i.current=!1;return}if(!s||a!==null)return;let e=p.refs.floating.current;if(e&&e.offsetHeight!==0&&e.offsetWidth!==0){if(!i.current){i.current=!0,p.update();return}p.isPositioned&&o(p.placement)}},[s,t,p.isPositioned,p.placement,a,p.update]);let m=(0,z.useRef)(p.placement);return oe(()=>{m.current!==p.placement&&(m.current=p.placement,e.onPositionChange?.(p.placement))},[p.placement]),ie(()=>{t!==r.current&&(t?e.onOpen?.():e.onClose?.()),r.current=t},[t,e.onClose,e.onOpen]),{floating:p,controlled:typeof e.opened==`boolean`,opened:t,onClose:d,onToggle:f,resetLockedPlacement:u}}var Be={position:`bottom`,offset:8,transitionProps:{transition:`fade`,duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:`side`,closeOnClickOutside:!0,withinPortal:!0,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,withOverlay:!1,hideDetached:!0,preventPositionChangeWhenVisible:!0,clickOutsideEvents:[`mousedown`,`touchstart`],clickOutsideCapture:!1,zIndex:te(`popover`),__staticSelector:`Popover`,width:`max-content`},Ve=b((e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:E(t),"--popover-shadow":O(n)}}));function K(e){let t=a(`Popover`,Be,e),{children:n,position:r,offset:i,onPositionChange:s,opened:c,transitionProps:l,onExitTransitionEnd:d,onEnterTransitionEnd:m,width:h,middlewares:_,withArrow:v,arrowSize:b,arrowOffset:x,arrowRadius:S,arrowPosition:C,unstyled:w,classNames:T,styles:E,closeOnClickOutside:D,withinPortal:O,portalProps:k,closeOnEscape:A,clickOutsideEvents:ee,clickOutsideCapture:te,trapFocus:j,onClose:re,onDismiss:M,onOpen:N,onChange:P,zIndex:ie,radius:ae,shadow:oe,id:F,defaultOpened:I,__staticSelector:L,withRoles:se,disabled:ce,returnFocus:le,variant:ue,keepMounted:de,keepMountedMode:fe,vars:me,floatingStrategy:he,withOverlay:ge,overlayProps:B,hideDetached:_e,attributes:ve,preventPositionChangeWhenVisible:ye,...H}=t,be=u({name:L,props:t,classes:Ne,classNames:T,styles:E,unstyled:w,attributes:ve,rootSelector:`dropdown`,vars:me,varsResolver:Ve}),{resolvedStyles:U}=f({classNames:T,styles:E,props:t}),xe=(0,z.useRef)(null),[Se,we]=(0,z.useState)(null),[Te,Ee]=(0,z.useState)(null),{dir:De}=R(),Oe=o(),ke=ne(F),W=ze({middlewares:_,width:h,position:pe(De,r),offset:typeof i==`number`?i+(v?b/2:0):i,arrowRef:xe,arrowOffset:x,onPositionChange:s,opened:c,defaultOpened:I,onChange:P,onOpen:N,onClose:re,onDismiss:M,strategy:he,disabled:ce,preventPositionChangeWhenVisible:ye,keepMounted:de});Ce(()=>{D&&(W.onClose(),M?.())},ee,[Se,Te],!0,te);let G=(0,z.useCallback)(e=>{we(e),W.floating.refs.setReference(e)},[W.floating.refs.setReference]),je=(0,z.useCallback)(e=>{Ee(e),W.floating.refs.setFloating(e)},[W.floating.refs.setFloating]),Me=(0,z.useCallback)(()=>{l?.onExited?.(),d?.(),W.resetLockedPlacement()},[l?.onExited,d,W.resetLockedPlacement]),Pe=(0,z.useCallback)(()=>{l?.onEntered?.(),m?.()},[l?.onEntered,m]);return(0,V.jsxs)(Ae,{value:{returnFocus:le,disabled:ce,controlled:W.controlled,reference:G,floating:je,x:W.floating.x,y:W.floating.y,arrowX:W.floating?.middlewareData?.arrow?.x,arrowY:W.floating?.middlewareData?.arrow?.y,opened:W.opened,arrowRef:xe,transitionProps:{...l,onExited:Me,onEntered:Pe},width:h,withArrow:v,arrowSize:b,arrowOffset:x,arrowRadius:S,arrowPosition:C,placement:W.floating.placement,trapFocus:j,withinPortal:O,portalProps:k,zIndex:ie,radius:ae,shadow:oe,closeOnEscape:A,onDismiss:M,onClose:W.onClose,onToggle:W.onToggle,getTargetId:()=>ke,getDropdownId:()=>`${ke}-dropdown`,withRoles:se,targetProps:H,__staticSelector:L,classNames:T,styles:E,unstyled:w,variant:ue,keepMounted:de,keepMountedMode:fe,getStyles:be,resolvedStyles:U,floatingStrategy:he,referenceHidden:_e&&Oe!==`test`?W.floating.middlewareData.hide?.referenceHidden:!1},children:[n,ge&&(0,V.jsx)(g,{transition:`fade`,mounted:W.opened,duration:l?.duration||250,exitDuration:l?.exitDuration||250,children:e=>(0,V.jsx)(y,{withinPortal:O,children:(0,V.jsx)(p,{...B,...be(`overlay`,{className:B?.className,style:[e,B?.style]})})})})]})}K.Target=Ie,K.Dropdown=Pe,K.ContextMenu=Me,K.varsResolver=Ve,K.displayName=`@mantine/core/Popover`,K.extend=e=>e,K.withProps=e=>{let t=t=>(0,V.jsx)(K,{...e,...t});return t.extend=K.extend,t.displayName=`WithProps(${K.displayName})`,t};function He({size:e,style:t,...n}){let r=e===void 0?t:{width:w(e),height:w(e),...t};return(0,V.jsx)(`svg`,{viewBox:`0 0 10 7`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:r,"aria-hidden":!0,...n,children:(0,V.jsx)(`path`,{d:`M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})}var[Ue,q]=A(`Menu component was not found in the tree`),We=(0,z.createContext)(null);function Ge(e){let{value:t,defaultValue:n,onChange:r,children:i}=a(`MenuCheckboxGroup`,null,e),[o,s]=D({value:t,defaultValue:n,finalValue:[],onChange:r}),c=(0,z.useCallback)(e=>{s(o.includes(e)?o.filter(t=>t!==e):[...o,e])},[o,s]);return(0,V.jsx)(We,{value:{values:o,onChange:c},children:i})}Ge.displayName=`@mantine/core/MenuCheckboxGroup`;var J=(0,z.createContext)(null);function Ke({role:e,checked:t,indicator:n,onSelect:r,color:i,closeMenuOnClick:a,rightSection:o,children:l,disabled:u,dataDisabled:d,className:f,style:p,styles:m,classNames:h,buttonRef:g,others:_}){let v=q(),y=(0,z.use)(J),b=c(),{dir:x}=R(),S=(0,z.useRef)(null),C=U(_.onClick,()=>{d||(r(),a&&v.closeDropdownImmediately())}),w=U(_.onMouseMove,()=>{if(!v.hasSearch)return;let e=S.current?.closest(`[data-menu-dropdown]`);e&&e.querySelectorAll(`[data-menu-active]`).forEach(t=>{t!==S.current&&t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}),T=U(_.onKeyDown,e=>{e.key===`ArrowLeft`&&y&&(y.close(),y.focusParentItem())}),E=i?b.variantColorResolver({color:i,theme:b,variant:`light`}):void 0,D=i?s({color:i,theme:b}):null,O=v.alignItemsLabels!==`none`||t;return(0,V.jsxs)(I,{onMouseDown:e=>e.preventDefault(),..._,unstyled:v.unstyled,tabIndex:v.menuItemTabIndex,...v.getStyles(`item`,{className:f,style:p,styles:m,classNames:h}),ref:P(S,g),role:e,"aria-checked":t,disabled:u,"data-menu-item":!0,"data-checked":t||void 0,"data-disabled":u||d||void 0,"data-mantine-stop-propagation":!0,onClick:C,onMouseMove:w,onKeyDown:H({siblingSelector:`[data-menu-item]:not([data-disabled])`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:v.loop,dir:x,orientation:`vertical`,onKeyDown:T}),__vars:{"--menu-item-color":D?.isThemeColor&&D?.shade===void 0?`var(--mantine-color-${D.color}-6)`:E?.color,"--menu-item-hover":E?.hover},children:[O&&(0,V.jsx)(`div`,{...v.getStyles(`itemIndicator`,{styles:m,classNames:h}),"data-checked":t||void 0,children:t?n:null}),l&&(0,V.jsx)(`div`,{...v.getStyles(`itemLabel`,{styles:m,classNames:h}),"data-menu-item-label":!0,children:l}),o&&(0,V.jsx)(`div`,{...v.getStyles(`itemSection`,{styles:m,classNames:h}),"data-position":`right`,children:o})]})}var Y={dropdown:`m_dc9b7c9f`,label:`m_9bfac126`,divider:`m_efdf90cb`,item:`m_99ac2aa1`,search:`m_ef8769b6`,itemLabel:`m_5476e0d3`,itemIndicator:`m_8395186e`,itemSection:`m_8b75e504`,chevron:`m_b85b0bed`},qe=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,color:s,closeMenuOnClick:c,rightSection:l,children:u,disabled:d,"data-disabled":f,value:p,checked:m,defaultChecked:h,onChange:g,checkIcon:_,ref:v,...y}=a(`MenuCheckboxItem`,null,e),b=q(),x=(0,z.use)(We),S=x&&p!==void 0?x.values.includes(p):void 0,[C,w]=D({value:m??S,defaultValue:h,finalValue:!1,onChange:g}),T=_??b.checkIcon??(0,V.jsx)(He,{size:10});return(0,V.jsx)(Ke,{role:`menuitemcheckbox`,checked:C,indicator:T,onSelect:()=>{g?w(!C):x&&p!==void 0?x.onChange(p):w(!C)},color:s,closeMenuOnClick:c,rightSection:l,disabled:d,dataDisabled:f,className:n,style:r,styles:i,classNames:t,buttonRef:v,others:y,children:u})});qe.classes=Y,qe.displayName=`@mantine/core/MenuCheckboxItem`;function Je(e){let{children:t,disabled:n,longPressDelay:r}=a(`MenuContextMenu`,null,e),i=m(t);if(!i)throw Error(`Menu.ContextMenu component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let o=q(),s=G(),c=je({childProps:i.props,disabled:n||s.disabled,opened:o.opened,longPressDelay:r,setReference:s.reference,open:()=>o.openDropdown()});return(0,z.cloneElement)(i,c)}Je.displayName=`@mantine/core/MenuContextMenu`;var Ye=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,...s}=a(`MenuDivider`,null,e),c=q();return(0,V.jsx)(h,{...c.getStyles(`divider`,{className:n,style:r,styles:i,classNames:t}),...s})});Ye.classes=Y,Ye.displayName=`@mantine/core/MenuDivider`;var Xe=500;function Ze(e){return((e.querySelector(`[data-menu-item-label]`)??e).textContent??``).trim().toLowerCase()}function Qe(e){return e.length>1&&e.split(``).every(t=>t===e[0])}function $e({enabled:e,opened:t,getDropdown:n}){let r=(0,z.useRef)({buffer:``,timeoutId:null});return(0,z.useEffect)(()=>{if(t&&e)return;let n=r.current;n.timeoutId!==null&&(window.clearTimeout(n.timeoutId),n.timeoutId=null),n.buffer=``},[t,e]),(0,z.useEffect)(()=>()=>{let{timeoutId:e}=r.current;e!==null&&window.clearTimeout(e)},[]),t=>{if(!e||t.defaultPrevented||t.ctrlKey||t.metaKey||t.altKey||t.key.length!==1||t.key===` `)return;let i=t.target;if(i&&(i.tagName===`INPUT`||i.tagName===`TEXTAREA`||i.tagName===`SELECT`||i.isContentEditable))return;let a=n();if(!a)return;let o=Array.from(a.querySelectorAll(`[data-menu-item]:not([data-disabled])`)).filter(e=>e.closest(`[data-menu-dropdown]`)===a);if(o.length===0)return;let s=r.current;s.buffer=(s.buffer+t.key).toLowerCase(),s.timeoutId!==null&&window.clearTimeout(s.timeoutId),s.timeoutId=window.setTimeout(()=>{s.buffer=``,s.timeoutId=null},Xe);let c=document.activeElement,l=c?o.indexOf(c):-1,u=null;if(s.buffer.length===1||Qe(s.buffer)){let e=s.buffer[0],t=l+1;for(let n=0;n{let{classNames:t,className:n,style:r,styles:i,vars:o,onMouseEnter:s,onMouseLeave:c,onKeyDown:l,children:u,ref:d,...f}=a(`MenuDropdown`,null,e),p=(0,z.useRef)(null),m=q(),h=$e({enabled:!m.hasSearch,opened:m.opened,getDropdown:()=>p.current}),g=U(l,e=>{h(e),!(e.defaultPrevented||m.hasSearch)&&(e.key===`ArrowUp`||e.key===`ArrowDown`)&&(e.preventDefault(),p.current?.querySelectorAll(`[data-menu-item]:not(:disabled)`)[0]?.focus())}),_=U(s,()=>(m.trigger===`hover`||m.trigger===`click-hover`)&&m.openDropdown()),v=U(c,()=>(m.trigger===`hover`||m.trigger===`click-hover`)&&m.closeDropdown());return(0,V.jsxs)(K.Dropdown,{...f,onMouseEnter:_,onMouseLeave:v,role:`menu`,"aria-orientation":`vertical`,ref:P(d,p),...m.getStyles(`dropdown`,{className:n,style:r,styles:i,classNames:t,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:g,children:[m.withInitialFocusPlaceholder&&!m.hasSearch&&(0,V.jsx)(`div`,{role:`presentation`,tabIndex:-1,"data-autofocus":!0,"data-mantine-stop-propagation":!0,style:{outline:0}}),u]})});et.classes=Y,et.displayName=`@mantine/core/MenuDropdown`;var tt=i(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,color:l,closeMenuOnClick:u,leftSection:d,rightSection:f,children:p,disabled:m,"data-disabled":h,ref:g,..._}=a(`MenuItem`,null,e),v=q(),y=(0,z.use)(J),b=c(),{dir:x}=R(),S=(0,z.useRef)(null),C=_,w=U(C.onClick,()=>{h||(typeof u==`boolean`?u&&v.closeDropdownImmediately():v.closeOnItemClick&&v.closeDropdownImmediately())}),T=U(C.onMouseMove,()=>{if(!v.hasSearch)return;let e=S.current?.closest(`[data-menu-dropdown]`);e&&e.querySelectorAll(`[data-menu-active]`).forEach(t=>{t!==S.current&&t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}),E=l?b.variantColorResolver({color:l,theme:b,variant:`light`}):void 0,D=l?s({color:l,theme:b}):null,O=U(C.onKeyDown,e=>{e.key===`ArrowLeft`&&y&&(y.close(),y.focusParentItem())});return(0,V.jsxs)(I,{onMouseDown:e=>e.preventDefault(),..._,unstyled:v.unstyled,tabIndex:v.menuItemTabIndex,...v.getStyles(`item`,{className:n,style:r,styles:i,classNames:t}),ref:P(S,g),role:`menuitem`,disabled:m,"data-menu-item":!0,"data-disabled":m||h||void 0,"data-mantine-stop-propagation":!0,onClick:w,onMouseMove:T,onKeyDown:H({siblingSelector:`[data-menu-item]:not([data-disabled])`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:v.loop,dir:x,orientation:`vertical`,onKeyDown:O}),__vars:{"--menu-item-color":D?.isThemeColor&&D?.shade===void 0?`var(--mantine-color-${D.color}-6)`:E?.color,"--menu-item-hover":E?.hover},children:[v.alignItemsLabels===`all`&&(0,V.jsx)(`div`,{...v.getStyles(`itemIndicator`,{styles:i,classNames:t}),"data-placeholder":!0}),d&&(0,V.jsx)(`div`,{...v.getStyles(`itemSection`,{styles:i,classNames:t}),"data-position":`left`,children:d}),p&&(0,V.jsx)(`div`,{...v.getStyles(`itemLabel`,{styles:i,classNames:t}),"data-menu-item-label":!0,children:p}),f&&(0,V.jsx)(`div`,{...v.getStyles(`itemSection`,{styles:i,classNames:t}),"data-position":`right`,children:f})]})});tt.classes=Y,tt.displayName=`@mantine/core/MenuItem`;var nt=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,...s}=a(`MenuLabel`,null,e),c=q();return(0,V.jsx)(h,{...c.getStyles(`label`,{className:n,style:r,styles:i,classNames:t}),...s})});nt.classes=Y,nt.displayName=`@mantine/core/MenuLabel`;var rt=(0,z.createContext)(null);function it(e){let{value:t,defaultValue:n,onChange:r,children:i}=a(`MenuRadioGroup`,null,e),[o,s]=D({value:t,defaultValue:n,finalValue:null,onChange:r});return(0,V.jsx)(rt,{value:{value:o,onChange:e=>s(e)},children:i})}it.displayName=`@mantine/core/MenuRadioGroup`;function at({size:e,style:t,...n}){return(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 5 5`,style:{width:w(e),height:w(e),...t},"aria-hidden":!0,...n,children:(0,V.jsx)(`circle`,{cx:`2.5`,cy:`2.5`,r:`2.5`,fill:`currentColor`})})}var ot=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,color:s,closeMenuOnClick:c,rightSection:l,children:u,disabled:d,"data-disabled":f,value:p,checked:m,onChange:h,checkIcon:g,ref:_,...v}=a(`MenuRadioItem`,null,e),y=q(),b=(0,z.use)(rt),x=m??(b?b.value===p:!1),S=g??y.checkIcon??(0,V.jsx)(at,{size:5});return(0,V.jsx)(Ke,{role:`menuitemradio`,checked:x,indicator:S,onSelect:()=>{x||(h?h(p):b&&b.onChange(p))},color:s,closeMenuOnClick:c,rightSection:l,disabled:d,dataDisabled:f,className:n,style:r,styles:i,classNames:t,buttonRef:_,others:v,children:u})});ot.classes=Y,ot.displayName=`@mantine/core/MenuRadioItem`;var st=`[data-menu-item]:not([data-disabled])`,ct=`[data-menu-active]`;function lt(e){return e?.closest(`[data-menu-dropdown]`)}function ut(e){return e?Array.from(e.querySelectorAll(st)).filter(t=>t.closest(`[data-menu-dropdown]`)===e):[]}function dt(e){e&&e.querySelectorAll(ct).forEach(t=>{t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}function ft(e,t){dt(t),e&&(e.setAttribute(`data-menu-active`,`true`),e.scrollIntoView({block:`nearest`}))}function pt(e){return e.findIndex(e=>e.hasAttribute(`data-menu-active`))}var mt={clearSearchOnClose:!0},ht=r(e=>{let{classNames:t,styles:n,onKeyDown:r,onChange:i,size:o,clearSearchOnClose:s,ref:c,...l}=a(`MenuSearch`,mt,e),u=q(),f=(0,z.useRef)(null),p=P(c,f),m=(0,z.useRef)(i);m.current=i,(0,z.useEffect)(()=>u.registerSearch(),[u.registerSearch]),(0,z.useEffect)(()=>{s?u.searchExitClearRef.current=()=>{m.current?.({currentTarget:{value:``}})}:u.searchExitClearRef.current=null},[s,u.searchExitClearRef]),(0,z.useEffect)(()=>{u.opened||dt(lt(f.current))},[u.opened]);let h=U(i,e=>{dt(lt(e.currentTarget))}),g=U(r,e=>{if(e.defaultPrevented)return;let t=lt(e.currentTarget),n=ut(t);if(e.key===`ArrowDown`){if(e.preventDefault(),n.length===0)return;let r=pt(n);ft(n[r>=n.length-1?u.loop?0:r:r+1]??null,t)}else if(e.key===`ArrowUp`){if(e.preventDefault(),n.length===0)return;let r=pt(n);ft(n[r<=0?r===-1||u.loop?n.length-1:0:r-1]??null,t)}else if(e.key===`Home`)e.preventDefault(),n.length>0&&ft(n[0],t);else if(e.key===`End`)e.preventDefault(),n.length>0&&ft(n[n.length-1],t);else if(e.key===`Enter`){if(e.nativeEvent.isComposing||e.nativeEvent.keyCode===229)return;let t=n[pt(n)];t&&(e.preventDefault(),t.hasAttribute(`data-sub-menu-item`)?(t.focus(),t.dispatchEvent(new KeyboardEvent(`keydown`,{key:`ArrowRight`,bubbles:!0}))):t.click())}}),_=u.getStyles(`search`);return(0,V.jsx)(d,{"data-autofocus":!0,"data-mantine-stop-propagation":!0,type:`search`,size:o,...l,ref:p,classNames:[{input:_.className},t],styles:[{input:_.style},n],onKeyDown:g,onChange:h,__staticSelector:`Menu`})});ht.classes=Y,ht.displayName=`@mantine/core/MenuSearch`;var gt=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,onMouseEnter:s,onMouseLeave:c,onPointerEnter:l,onPointerLeave:u,onKeyDown:d,children:f,ref:p,...m}=a(`MenuSubDropdown`,null,e),h=(0,z.useRef)(null),g=q(),_=(0,z.use)(J),v=$e({enabled:!g.hasSearch,opened:_?.opened??!1,getDropdown:()=>h.current}),y=U(d,e=>{v(e),!e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.length===1&&e.key!==` `&&e.stopPropagation()}),b=_?.getFloatingProps({onMouseEnter:s,onMouseLeave:c,onPointerEnter:l,onPointerLeave:u});return(0,V.jsx)(K.Dropdown,{...m,...b,role:`menu`,"aria-orientation":`vertical`,ref:P(p,h,_?.setFloating),...g.getStyles(`dropdown`,{className:n,style:r,styles:i,classNames:t,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:y,children:f})});gt.classes=Y,gt.displayName=`@mantine/core/MenuSubDropdown`;var _t=i(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,color:u,leftSection:d,rightSection:f,children:p,disabled:m,"data-disabled":h,closeMenuOnClick:g,ref:_,...v}=a(`MenuSubItem`,null,e),y=q(),b=(0,z.use)(J),x=c(),{dir:S}=R(),C=(0,z.useRef)(null),w=v,T=u?x.variantColorResolver({color:u,theme:x,variant:`light`}):void 0,E=u?s({color:u,theme:x}):null,D=U(w.onKeyDown,e=>{e.key===`ArrowRight`&&(b?.open(),b?.focusFirstItem()),e.key===`ArrowLeft`&&b?.parentContext&&(b.parentContext.close(),b.parentContext.focusParentItem())}),O=U(w.onClick,()=>{!h&&g&&y.closeDropdownImmediately()}),k=U(w.onMouseMove,()=>{if(!y.hasSearch)return;let e=C.current?.closest(`[data-menu-dropdown]`);e&&e.querySelectorAll(`[data-menu-active]`).forEach(t=>{t!==C.current&&t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}),A=b?.getReferenceProps({onMouseEnter:w.onMouseEnter,onMouseLeave:w.onMouseLeave,onPointerEnter:w.onPointerEnter,onPointerLeave:w.onPointerLeave});return(0,V.jsxs)(I,{onMouseDown:e=>e.preventDefault(),...v,...A,unstyled:y.unstyled,tabIndex:y.menuItemTabIndex,...y.getStyles(`item`,{className:n,style:r,styles:i,classNames:t}),ref:P(C,_,b?.setReference),role:`menuitem`,disabled:m,"data-menu-item":!0,"data-sub-menu-item":!0,"data-disabled":m||h||void 0,"data-mantine-stop-propagation":!0,onClick:O,onMouseMove:k,onKeyDown:H({siblingSelector:`[data-menu-item]:not([data-disabled])`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:y.loop,dir:S,orientation:`vertical`,onKeyDown:D}),__vars:{"--menu-item-color":E?.isThemeColor&&E?.shade===void 0?`var(--mantine-color-${E.color}-6)`:T?.color,"--menu-item-hover":T?.hover},children:[y.alignItemsLabels===`all`&&(0,V.jsx)(`div`,{...y.getStyles(`itemIndicator`,{styles:i,classNames:t}),"data-placeholder":!0}),d&&(0,V.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:i,classNames:t}),"data-position":`left`,children:d}),p&&(0,V.jsx)(`div`,{...y.getStyles(`itemLabel`,{styles:i,classNames:t}),"data-menu-item-label":!0,children:p}),(0,V.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:i,classNames:t}),"data-position":`right`,children:f||(0,V.jsx)(l,{...y.getStyles(`chevron`),size:14})})]})});_t.classes=Y,_t.displayName=`@mantine/core/MenuSubItem`;function vt({children:e,refProp:t}){if(!x(e))throw Error(`Menu.Sub.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);return q(),(0,V.jsx)(K.Target,{refProp:t,popupType:`menu`,children:e})}vt.displayName=`@mantine/core/MenuSubTarget`;var yt={offset:0,position:`right-start`,safeAreaPolygon:!0,transitionProps:{duration:0},openDelay:0,middlewares:{shift:{crossAxis:!0}}};function X(e){let{children:t,closeDelay:n,openDelay:r,position:i,safeAreaPolygon:o,opened:s,onChange:c,...l}=a(`MenuSub`,yt,e),u=ne(),[d,f]=D({value:s,finalValue:!1,onChange:c}),p=(0,z.use)(J),m=q(),{dir:h}=R(),g=pe(h,i),_=p?.registerOpenSub??m.registerOpenSub,v=(0,z.useRef)(null),y=(0,z.useCallback)(e=>{let t=v.current;return t&&t!==e&&t(),v.current=e,()=>{v.current===e&&(v.current=null)}},[]),b=(0,z.useRef)(f);b.current=f;let x=(0,z.useCallback)(()=>b.current(!0),[]),S=(0,z.useCallback)(()=>b.current(!1),[]);(0,z.useEffect)(()=>{if(d)return _(S)},[d,_,S]);let{context:C,refs:w}=F({placement:g,open:d,onOpenChange:e=>{e?x():S()}}),{getReferenceProps:T,getFloatingProps:E}=L([M(C,{handleClose:o?re(typeof o==`object`?o:void 0):void 0,delay:{open:r,close:n}})]);return(0,V.jsx)(J,{value:{opened:d,close:S,open:x,focusFirstItem:()=>window.setTimeout(()=>{document.getElementById(`${u}-dropdown`)?.querySelectorAll(`[data-menu-item]:not([data-disabled])`)[0]?.focus()},16),focusParentItem:()=>window.setTimeout(()=>{document.getElementById(`${u}-target`)?.focus()},16),parentContext:p,setReference:w.setReference,setFloating:w.setFloating,getReferenceProps:T,getFloatingProps:E,registerOpenSub:y},children:(0,V.jsx)(K,{opened:d,onChange:e=>e?x():S(),withArrow:!1,id:u,position:i,...l,withinPortal:!1,children:t})})}X.extend=e=>e,X.displayName=`@mantine/core/MenuSub`,X.Target=vt,X.Dropdown=gt,X.Item=_t;var bt={refProp:`ref`};function xt(e){let{children:t,refProp:n,...r}=a(`MenuTarget`,bt,e),i=m(t);if(!i)throw Error(`Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let o=q(),s=i.props,c=U(s.onClick,()=>{o.trigger===`click`?o.toggleDropdown():o.trigger===`click-hover`&&(o.setOpenedViaClick(!0),o.opened||o.openDropdown())}),l=U(s.onMouseEnter,()=>(o.trigger===`hover`||o.trigger===`click-hover`)&&o.openDropdown()),u=U(s.onMouseLeave,()=>{(o.trigger===`hover`||o.trigger===`click-hover`&&!o.openedViaClick)&&o.closeDropdown()});return(0,V.jsx)(K.Target,{refProp:n,popupType:`menu`,...r,children:(0,z.cloneElement)(i,{onClick:c,onMouseEnter:l,onMouseLeave:u,"data-expanded":o.opened?!0:void 0})})}xt.displayName=`@mantine/core/MenuTarget`;var St={trapFocus:!0,closeOnItemClick:!0,withInitialFocusPlaceholder:!0,clickOutsideEvents:[`mousedown`,`touchstart`,`keydown`],loop:!0,trigger:`click`,openDelay:0,closeDelay:100,menuItemTabIndex:-1,alignItemsLabels:`with-indicators`},Z=r(e=>{let t=a(`Menu`,St,e),{children:n,onOpen:r,onClose:i,opened:o,defaultOpened:s,trapFocus:c,onChange:l,closeOnItemClick:d,loop:p,closeOnEscape:m,trigger:h,openDelay:g,closeDelay:_,classNames:v,styles:y,unstyled:b,variant:x,vars:S,menuItemTabIndex:C,keepMounted:w,withInitialFocusPlaceholder:T,attributes:E,onExitTransitionEnd:O,alignItemsLabels:k,checkIcon:A,...ee}=t,te=u({name:`Menu`,classes:Y,props:t,classNames:v,styles:y,unstyled:b,attributes:E}),[j,ne]=D({value:o,defaultValue:s,finalValue:!1,onChange:l}),[re,M]=(0,z.useState)(!1),N=()=>{ne(!1),M(!1),j&&i?.()},P=()=>{ne(!0),!j&&r?.()},ie=()=>{j?N():P()},{openDropdown:ae,closeDropdown:oe}=W({open:P,close:N,closeDelay:_,openDelay:g}),F=(0,z.useRef)(null),I=(0,z.useCallback)(e=>{let t=F.current;return t&&t!==e&&t(),F.current=e,()=>{F.current===e&&(F.current=null)}},[]),L=(0,z.useRef)(0),[se,R]=(0,z.useState)(!1),ce=(0,z.useCallback)(()=>(L.current+=1,L.current===1&&R(!0),()=>{--L.current,L.current===0&&R(!1)}),[]),le=(0,z.useRef)(null),ue=()=>{le.current?.(),O?.()},de=e=>xe(`[data-menu-item]`,`[data-menu-dropdown]`,e),{resolvedClassNames:fe,resolvedStyles:pe}=f({classNames:v,styles:y,props:t});return(0,V.jsx)(Ue,{value:{getStyles:te,opened:j,toggleDropdown:ie,getItemIndex:de,openedViaClick:re,setOpenedViaClick:M,closeOnItemClick:d,closeDropdown:h===`click`?N:oe,openDropdown:h===`click`?P:ae,closeDropdownImmediately:N,loop:p,trigger:h,unstyled:b,menuItemTabIndex:C,withInitialFocusPlaceholder:T,registerOpenSub:I,hasSearch:se,registerSearch:ce,searchExitClearRef:le,alignItemsLabels:k,checkIcon:A},children:(0,V.jsx)(K,{returnFocus:!0,...ee,opened:j,onChange:ie,defaultOpened:s,trapFocus:!w&&c,closeOnEscape:m,__staticSelector:`Menu`,classNames:fe,styles:pe,unstyled:b,variant:x,keepMounted:w,onExitTransitionEnd:ue,children:n})})});Z.displayName=`@mantine/core/Menu`,Z.classes=Y,Z.Item=tt,Z.Label=nt,Z.Dropdown=et,Z.Target=xt,Z.Divider=Ye,Z.Search=ht,Z.Sub=X,Z.CheckboxItem=qe,Z.CheckboxGroup=Ge,Z.RadioItem=ot,Z.RadioGroup=it,Z.ContextMenu=Je;var Ct=new Map([[`bold`,z.createElement(z.Fragment,null,z.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`,z.createElement(z.Fragment,null,z.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`}),z.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`,z.createElement(z.Fragment,null,z.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`,z.createElement(z.Fragment,null,z.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`,z.createElement(z.Fragment,null,z.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`,z.createElement(z.Fragment,null,z.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`}))]]),wt=z.forwardRef((e,t)=>z.createElement(ce,{ref:t,...e,weights:Ct}));wt.displayName=`DotsThreeIcon`;var Tt=wt,Et=[`dashboards`],Dt=3e4;async function Q(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 he(e,{...r,headers:i,body:a}),s=await o.json().catch(()=>({}));if(!o.ok)throw Ot(o,s);return s}var Ot=(e,t)=>new ge(t.message??`Request failed (${e.status})`,e.status,t.problems??[],t.code??``),$=e=>`/api/dashboards/${encodeURIComponent(e)}`,kt=()=>Q(`/api/dashboards`).then(e=>e.dashboards),At=(e,t)=>Q($(e),{signal:t}),jt=(e,t)=>Q(`${$(e)}/versions`,{signal:t}).then(e=>e.versions),Mt=(e,t,n)=>Q(`${$(e)}/versions/${t}`,{signal:n}),Nt=(e,t)=>Q(`${$(e)}/versions/${t}/restore`,{method:`POST`}),Pt=(e,t,n,r)=>Q($(e),{method:`PUT`,json:{spec:t,base_version:n,message:r}}),Ft=(e,t,n,r)=>Q($(e),{method:`PATCH`,json:{operations:t,base_version:n,message:r}});async function It(e,t,n,r=!1){let i=r?{"cache-control":`no-cache`}:{};if(!n)return Q(`/api/queries/run`,{method:`POST`,headers:i,json:e,signal:t}).then(e=>e.results);let a=await he(`/api/queries/run`,{method:`POST`,headers:{...i,"content-type":`application/json`,accept:`application/x-ndjson`},body:JSON.stringify(e),signal:t});if(!a.ok)throw Ot(a,await a.json().catch(()=>({})));let o=[],s=a.body.pipeThrough(new TextDecoderStream).getReader(),c=``;try{for(;;){let{done:e,value:t}=await s.read();c+=t??``;let r;for(;(r=c.indexOf(` +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{Dt as r,Et as i,Ft as a,Ht as o,Jt as s,Lt as c,M as l,Nt as u,P as d,Pt as f,Q as p,Qt as m,Tt as h,X as g,Xt as _,Y as v,Z as y,Zt as b,_n as x,_t as S,an as C,bn as w,bt as T,dn as E,en as D,fn as O,ft as k,gn as A,gt as ee,hn as te,ht as j,in as ne,it as re,lt as M,mt as N,nn as P,on as ie,pt as ae,sn as oe,st as F,tt as I,ut as L,vt as se,wt as R,x as ce,yt as le}from"./brand-D6fP-cLS.js";import{t as ue}from"./noop-mXPS5vjY.js";import{c as de,l as fe,o as pe,s as me}from"./format-BZjbsxwM.js";import{a as he,s as ge}from"./auth-DWqIkMZS.js";var z=n(e(),1);function B(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}var V=t();function _e(e,t,n){for(let n=e-1;n>=0;--n)if(!t[n].disabled)return n;if(n){for(let e=t.length-1;e>-1;--e)if(!t[e].disabled)return e}return e}function ve(e,t,n){for(let n=e+1;n{n?.(s);let c=Array.from(B(s.currentTarget,e)?.querySelectorAll(t)||[]).filter(t=>ye(s.currentTarget,t,e)),l=c.findIndex(e=>s.currentTarget===e),u=ve(l,c,r),d=_e(l,c,r),f=a===`rtl`?d:u,p=a===`rtl`?u:d;switch(s.key){case`ArrowRight`:o===`horizontal`&&(s.stopPropagation(),s.preventDefault(),c[f].focus(),i&&c[f].click());break;case`ArrowLeft`:o===`horizontal`&&(s.stopPropagation(),s.preventDefault(),c[p].focus(),i&&c[p].click());break;case`ArrowUp`:o===`vertical`&&(s.stopPropagation(),s.preventDefault(),c[d].focus(),i&&c[d].click());break;case`ArrowDown`:o===`vertical`&&(s.stopPropagation(),s.preventDefault(),c[u].focus(),i&&c[u].click());break;case`Home`:s.stopPropagation(),s.preventDefault(),c[ve(-1,c,!1)]?.focus();break;case`End`:s.stopPropagation(),s.preventDefault(),c[_e(c.length,c,!1)]?.focus()}}}function be(e,t={active:!0}){return typeof e!=`function`||!t.active?t.onKeyDown||ue:n=>{n.key===`Escape`&&(e(n),t.onTrigger?.())}}function U(e,t){return n=>{e?.(n),t?.(n)}}function xe(e,t,n){return n?Array.from(B(n,t)?.querySelectorAll(e)||[]).findIndex(e=>e===n):null}var Se=[`mousedown`,`touchstart`];function Ce(e,t,n,r=!0,i=!1){let a=(0,z.useRef)(null),o=t||Se,s=(0,z.useEffectEvent)(t=>{let{target:r}=t??{};if(!document.body.contains(r)&&r?.tagName!==`HTML`)return;let i=t.composedPath();Array.isArray(n)?n.every(e=>!!e&&!i.includes(e))&&e(t):a.current&&!i.includes(a.current)&&e(t)}),c=o.join(`,`);return(0,z.useEffect)(()=>{if(!r)return;let e=c.split(`,`);return e.forEach(e=>document.addEventListener(e,s,i)),()=>{e.forEach(e=>document.removeEventListener(e,s,i))}},[c,r,i]),a}var we=[`mouse`,`touch`],Te=10;function Ee(e,t={}){let{threshold:n=400,events:r=we,cancelOnMove:i=!1,onStart:a,onFinish:o,onCancel:s}=t,c=(0,z.useRef)(!1),l=(0,z.useRef)(!1),u=(0,z.useRef)(-1),d=(0,z.useRef)(null);(0,z.useEffect)(()=>()=>window.clearTimeout(u.current),[]);let f=r.join(`,`);return(0,z.useMemo)(()=>{if(typeof e!=`function`)return{};let t=i!==!1,f=i===!0?Te:i===!1?0:i,p=t=>{(ke(t)||Oe(t))&&(a&&a(t),d.current=De(t),l.current=!0,u.current=window.setTimeout(()=>{e(t),c.current=!0},n))},m=e=>{(ke(e)||Oe(e))&&(c.current?o&&o(e):l.current&&s&&s(e),c.current=!1,l.current=!1,d.current=null,u.current!==-1&&(window.clearTimeout(u.current),u.current=-1))},h=e=>{if(!t||!l.current||c.current)return;let n=De(e);if(!n||!d.current)return;let r=n.x-d.current.x,i=n.y-d.current.y;Math.sqrt(r*r+i*i)>f&&m(e)},g={};return r.includes(`mouse`)&&(g.onMouseDown=p,g.onMouseUp=m,g.onMouseLeave=m,t&&(g.onMouseMove=h)),r.includes(`touch`)&&(g.onTouchStart=p,g.onTouchEnd=m,g.onTouchCancel=m,t&&(g.onTouchMove=h)),g},[e,n,s,o,a,i,f])}function De(e){if(Oe(e)){let t=e.touches[0]??e.changedTouches[0];return t?{x:t.clientX,y:t.clientY}:null}return{x:e.clientX,y:e.clientY}}function Oe(e){return window.TouchEvent?e.nativeEvent instanceof TouchEvent:`touches`in e.nativeEvent}function ke(e){return e.nativeEvent instanceof MouseEvent}function W({open:e,close:t,openDelay:n,closeDelay:r}){let i=(0,z.useRef)(-1),a=(0,z.useRef)(-1),o=()=>{window.clearTimeout(i.current),window.clearTimeout(a.current)};return(0,z.useEffect)(()=>o,[]),{openDropdown:()=>{o(),n===0||n===void 0?e():i.current=window.setTimeout(e,n)},closeDropdown:()=>{o(),r===0||r===void 0?t():a.current=window.setTimeout(t,r)}}}var[Ae,G]=A(`Popover component was not found in the tree`);function je({childProps:e,disabled:t,opened:n,longPressDelay:r=500,setReference:i,open:a}){let o=(0,z.useRef)(!1),s=(0,z.useRef)(!1),c=(0,z.useRef)(null),l=(0,z.useRef)(t);l.current=t;let u=(e,t,n)=>{i({getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t,toJSON:()=>void 0}),contextElement:n}),a()},d=U(e.onMouseDown,e=>{t||e.button===2&&e.stopPropagation()}),f=U(e.onContextMenu,e=>{t||e.defaultPrevented||(e.preventDefault(),!s.current&&(u(e.clientX,e.clientY,e.currentTarget),o.current&&(s.current=!0)))}),p=Ee(e=>{if(l.current||s.current)return;let t=e,n=t.touches[0]??t.changedTouches[0];n&&(u(n.clientX,n.clientY,c.current),s.current=!0)},{threshold:r,events:[`touch`],cancelOnMove:!0,onStart:e=>{o.current=!0,s.current=!1,c.current=e.currentTarget},onFinish:e=>{o.current=!1,s.current=!1,l.current||e.preventDefault()},onCancel:()=>{o.current=!1,s.current=!1}});return{onContextMenu:f,onMouseDown:d,onTouchStart:U(e.onTouchStart,p.onTouchStart),onTouchEnd:U(e.onTouchEnd,p.onTouchEnd),onTouchCancel:U(e.onTouchCancel,p.onTouchCancel),onTouchMove:U(e.onTouchMove,p.onTouchMove),style:t?e.style:{...e.style,WebkitTouchCallout:`none`,WebkitUserSelect:`none`,userSelect:`none`},"data-expanded":n?!0:void 0}}function Me(e){let{children:t,disabled:n,longPressDelay:r}=a(`PopoverContextMenu`,null,e),i=m(t);if(!i)throw Error(`Popover.ContextMenu component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let o=G(),s=je({childProps:i.props,disabled:n||o.disabled,opened:o.opened,longPressDelay:r,setReference:o.reference,open:()=>{o.opened||o.onToggle()}});return(0,z.cloneElement)(i,s)}Me.displayName=`@mantine/core/PopoverContextMenu`;var Ne={dropdown:`m_38a85659`,arrow:`m_a31dc6c1`,overlay:`m_3d7bc908`},Pe=r(e=>{let t=a(`PopoverDropdown`,null,e),{className:n,style:r,vars:i,children:o,onKeyDownCapture:s,variant:c,classNames:l,styles:u,ref:d,...f}=t,p=G(),{dir:m}=R(),_=p.arrowPosition===`merge`&&p.withArrow?de({position:p.placement,dir:m}):void 0,b=C({opened:p.opened,shouldReturnFocus:p.returnFocus}),x=p.withRoles?{"aria-labelledby":p.getTargetId(),id:p.getDropdownId(),role:`dialog`,tabIndex:-1}:{},S=P(d,p.floating);return p.disabled?null:(0,V.jsx)(y,{...p.portalProps,withinPortal:p.withinPortal,children:(0,V.jsx)(g,{mounted:p.opened,...p.transitionProps,transition:p.transitionProps?.transition||`fade`,duration:p.transitionProps?.duration??150,keepMounted:p.keepMounted,keepMountedMode:p.keepMountedMode,exitDuration:typeof p.transitionProps?.exitDuration==`number`?p.transitionProps.exitDuration:p.transitionProps?.duration,children:e=>(0,V.jsx)(v,{active:p.trapFocus&&p.opened,innerRef:S,children:(0,V.jsxs)(h,{...x,...f,variant:c,onKeyDownCapture:be(()=>{p.onClose?.(),p.onDismiss?.()},{active:p.closeOnEscape,onTrigger:b,onKeyDown:s}),"data-position":p.placement,"data-fixed":p.floatingStrategy===`fixed`||void 0,...p.getStyles(`dropdown`,{className:n,props:t,classNames:l,styles:u,style:[{...e,..._,zIndex:p.zIndex,top:p.y??0,left:p.x??0,width:p.width===`target`?void 0:w(p.width),...p.referenceHidden?{display:`none`}:null},p.resolvedStyles?.dropdown,u?.dropdown,r]}),children:[o,(0,V.jsx)(me,{ref:p.arrowRef,arrowX:p.arrowX,arrowY:p.arrowY,visible:p.withArrow,position:p.placement,arrowSize:p.arrowSize,arrowRadius:p.arrowRadius,arrowOffset:p.arrowOffset,arrowPosition:p.arrowPosition,...p.getStyles(`arrow`,{props:t,classNames:l,styles:u})})]})})})})});Pe.classes=Ne,Pe.displayName=`@mantine/core/PopoverDropdown`;var Fe={refProp:`ref`,popupType:`dialog`},Ie=r(e=>{let{children:t,refProp:n,popupType:r,ref:i,...o}=a(`PopoverTarget`,Fe,e),s=m(t);if(!s)throw Error(`Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let c=o,l=G(),u=P(l.reference,fe(s),i),d=l.withRoles?{"aria-haspopup":r,"aria-expanded":l.opened,"aria-controls":l.opened?l.getDropdownId():void 0,id:l.getTargetId()}:{},f=s.props;return(0,z.cloneElement)(s,{...c,...d,...l.targetProps,className:_(l.targetProps.className,c.className,f.className),[n]:u,...l.controlled?null:{onClick:e=>{l.onToggle(),f.onClick?.(e)}}})});Ie.displayName=`@mantine/core/PopoverTarget`;function Le(e){if(e===void 0)return{shift:!0,flip:!0};let t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function Re(e,t,n,r){let i=Le(e.middlewares),a=[S(e.offset),N()];if(i.flip&&!n){let e=typeof i.flip==`boolean`?{}:i.flip,t=r?{fallbackStrategy:`initialPlacement`,...e}:e;a.push(ae(t))}if(i.shift){let t=typeof i.shift==`boolean`?{}:i.shift;a.push(se(n=>{let r=n.placement.startsWith(`top`)||n.placement.startsWith(`bottom`);return{limiter:ee(),padding:5,...e.width===`target`&&r?{mainAxis:!1}:null,...t}}))}return i.inline&&a.push(typeof i.inline==`boolean`?j():j(i.inline)),a.push(k({element:e.arrowRef,padding:e.arrowOffset})),(i.size||e.width===`target`)&&a.push(le({...typeof i.size==`boolean`?{}:i.size,apply({rects:n,availableWidth:r,availableHeight:a,...o}){let s=t().refs.floating.current?.style??{};i.size&&(typeof i.size==`object`&&i.size.apply?i.size.apply({rects:n,availableWidth:r,availableHeight:a,...o}):Object.assign(s,{maxWidth:`${r}px`,maxHeight:`${a}px`})),e.width===`target`&&Object.assign(s,{width:`${n.reference.width}px`})}})),a}function ze(e){let[t,n]=D({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=(0,z.useRef)(t),i=(0,z.useRef)(!1),[a,o]=(0,z.useState)(null),s=e.preventPositionChangeWhenVisible!==!1,c=(0,z.useRef)(t);t!==c.current&&(c.current=t,t&&a!==null&&o(null));let l=(0,z.useRef)(e.position);e.position!==l.current&&(l.current=e.position,i.current=!1,a!==null&&o(null));let u=(0,z.useCallback)(()=>o(null),[]),d=()=>{t&&!e.disabled&&n(!1)},f=()=>{e.disabled||n(!t)},p=F({open:t,strategy:e.strategy,placement:s?a??e.position:e.position,middleware:Re(e,()=>p,s&&a!==null,s),whileElementsMounted:e.keepMounted?void 0:T});(0,z.useEffect)(()=>{if(!e.keepMounted)return;let n=p.refs.reference.current,r=p.refs.floating.current;if(t&&n&&r)return T(n,r,p.update)},[e.keepMounted,t,p.update,p.elements.reference,p.elements.floating]),oe(()=>{if(!t){i.current=!1;return}if(!s||a!==null)return;let e=p.refs.floating.current;if(e&&e.offsetHeight!==0&&e.offsetWidth!==0){if(!i.current){i.current=!0,p.update();return}p.isPositioned&&o(p.placement)}},[s,t,p.isPositioned,p.placement,a,p.update]);let m=(0,z.useRef)(p.placement);return oe(()=>{m.current!==p.placement&&(m.current=p.placement,e.onPositionChange?.(p.placement))},[p.placement]),ie(()=>{t!==r.current&&(t?e.onOpen?.():e.onClose?.()),r.current=t},[t,e.onClose,e.onOpen]),{floating:p,controlled:typeof e.opened==`boolean`,opened:t,onClose:d,onToggle:f,resetLockedPlacement:u}}var Be={position:`bottom`,offset:8,transitionProps:{transition:`fade`,duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:`side`,closeOnClickOutside:!0,withinPortal:!0,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,withOverlay:!1,hideDetached:!0,preventPositionChangeWhenVisible:!0,clickOutsideEvents:[`mousedown`,`touchstart`],clickOutsideCapture:!1,zIndex:te(`popover`),__staticSelector:`Popover`,width:`max-content`},Ve=b((e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:E(t),"--popover-shadow":O(n)}}));function K(e){let t=a(`Popover`,Be,e),{children:n,position:r,offset:i,onPositionChange:s,opened:c,transitionProps:l,onExitTransitionEnd:d,onEnterTransitionEnd:m,width:h,middlewares:_,withArrow:v,arrowSize:b,arrowOffset:x,arrowRadius:S,arrowPosition:C,unstyled:w,classNames:T,styles:E,closeOnClickOutside:D,withinPortal:O,portalProps:k,closeOnEscape:A,clickOutsideEvents:ee,clickOutsideCapture:te,trapFocus:j,onClose:re,onDismiss:M,onOpen:N,onChange:P,zIndex:ie,radius:ae,shadow:oe,id:F,defaultOpened:I,__staticSelector:L,withRoles:se,disabled:ce,returnFocus:le,variant:ue,keepMounted:de,keepMountedMode:fe,vars:me,floatingStrategy:he,withOverlay:ge,overlayProps:B,hideDetached:_e,attributes:ve,preventPositionChangeWhenVisible:ye,...H}=t,be=u({name:L,props:t,classes:Ne,classNames:T,styles:E,unstyled:w,attributes:ve,rootSelector:`dropdown`,vars:me,varsResolver:Ve}),{resolvedStyles:U}=f({classNames:T,styles:E,props:t}),xe=(0,z.useRef)(null),[Se,we]=(0,z.useState)(null),[Te,Ee]=(0,z.useState)(null),{dir:De}=R(),Oe=o(),ke=ne(F),W=ze({middlewares:_,width:h,position:pe(De,r),offset:typeof i==`number`?i+(v?b/2:0):i,arrowRef:xe,arrowOffset:x,onPositionChange:s,opened:c,defaultOpened:I,onChange:P,onOpen:N,onClose:re,onDismiss:M,strategy:he,disabled:ce,preventPositionChangeWhenVisible:ye,keepMounted:de});Ce(()=>{D&&(W.onClose(),M?.())},ee,[Se,Te],!0,te);let G=(0,z.useCallback)(e=>{we(e),W.floating.refs.setReference(e)},[W.floating.refs.setReference]),je=(0,z.useCallback)(e=>{Ee(e),W.floating.refs.setFloating(e)},[W.floating.refs.setFloating]),Me=(0,z.useCallback)(()=>{l?.onExited?.(),d?.(),W.resetLockedPlacement()},[l?.onExited,d,W.resetLockedPlacement]),Pe=(0,z.useCallback)(()=>{l?.onEntered?.(),m?.()},[l?.onEntered,m]);return(0,V.jsxs)(Ae,{value:{returnFocus:le,disabled:ce,controlled:W.controlled,reference:G,floating:je,x:W.floating.x,y:W.floating.y,arrowX:W.floating?.middlewareData?.arrow?.x,arrowY:W.floating?.middlewareData?.arrow?.y,opened:W.opened,arrowRef:xe,transitionProps:{...l,onExited:Me,onEntered:Pe},width:h,withArrow:v,arrowSize:b,arrowOffset:x,arrowRadius:S,arrowPosition:C,placement:W.floating.placement,trapFocus:j,withinPortal:O,portalProps:k,zIndex:ie,radius:ae,shadow:oe,closeOnEscape:A,onDismiss:M,onClose:W.onClose,onToggle:W.onToggle,getTargetId:()=>ke,getDropdownId:()=>`${ke}-dropdown`,withRoles:se,targetProps:H,__staticSelector:L,classNames:T,styles:E,unstyled:w,variant:ue,keepMounted:de,keepMountedMode:fe,getStyles:be,resolvedStyles:U,floatingStrategy:he,referenceHidden:_e&&Oe!==`test`?W.floating.middlewareData.hide?.referenceHidden:!1},children:[n,ge&&(0,V.jsx)(g,{transition:`fade`,mounted:W.opened,duration:l?.duration||250,exitDuration:l?.exitDuration||250,children:e=>(0,V.jsx)(y,{withinPortal:O,children:(0,V.jsx)(p,{...B,...be(`overlay`,{className:B?.className,style:[e,B?.style]})})})})]})}K.Target=Ie,K.Dropdown=Pe,K.ContextMenu=Me,K.varsResolver=Ve,K.displayName=`@mantine/core/Popover`,K.extend=e=>e,K.withProps=e=>{let t=t=>(0,V.jsx)(K,{...e,...t});return t.extend=K.extend,t.displayName=`WithProps(${K.displayName})`,t};function He({size:e,style:t,...n}){let r=e===void 0?t:{width:w(e),height:w(e),...t};return(0,V.jsx)(`svg`,{viewBox:`0 0 10 7`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:r,"aria-hidden":!0,...n,children:(0,V.jsx)(`path`,{d:`M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})}var[Ue,q]=A(`Menu component was not found in the tree`),We=(0,z.createContext)(null);function Ge(e){let{value:t,defaultValue:n,onChange:r,children:i}=a(`MenuCheckboxGroup`,null,e),[o,s]=D({value:t,defaultValue:n,finalValue:[],onChange:r}),c=(0,z.useCallback)(e=>{s(o.includes(e)?o.filter(t=>t!==e):[...o,e])},[o,s]);return(0,V.jsx)(We,{value:{values:o,onChange:c},children:i})}Ge.displayName=`@mantine/core/MenuCheckboxGroup`;var J=(0,z.createContext)(null);function Ke({role:e,checked:t,indicator:n,onSelect:r,color:i,closeMenuOnClick:a,rightSection:o,children:l,disabled:u,dataDisabled:d,className:f,style:p,styles:m,classNames:h,buttonRef:g,others:_}){let v=q(),y=(0,z.use)(J),b=c(),{dir:x}=R(),S=(0,z.useRef)(null),C=U(_.onClick,()=>{d||(r(),a&&v.closeDropdownImmediately())}),w=U(_.onMouseMove,()=>{if(!v.hasSearch)return;let e=S.current?.closest(`[data-menu-dropdown]`);e&&e.querySelectorAll(`[data-menu-active]`).forEach(t=>{t!==S.current&&t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}),T=U(_.onKeyDown,e=>{e.key===`ArrowLeft`&&y&&(y.close(),y.focusParentItem())}),E=i?b.variantColorResolver({color:i,theme:b,variant:`light`}):void 0,D=i?s({color:i,theme:b}):null,O=v.alignItemsLabels!==`none`||t;return(0,V.jsxs)(I,{onMouseDown:e=>e.preventDefault(),..._,unstyled:v.unstyled,tabIndex:v.menuItemTabIndex,...v.getStyles(`item`,{className:f,style:p,styles:m,classNames:h}),ref:P(S,g),role:e,"aria-checked":t,disabled:u,"data-menu-item":!0,"data-checked":t||void 0,"data-disabled":u||d||void 0,"data-mantine-stop-propagation":!0,onClick:C,onMouseMove:w,onKeyDown:H({siblingSelector:`[data-menu-item]:not([data-disabled])`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:v.loop,dir:x,orientation:`vertical`,onKeyDown:T}),__vars:{"--menu-item-color":D?.isThemeColor&&D?.shade===void 0?`var(--mantine-color-${D.color}-6)`:E?.color,"--menu-item-hover":E?.hover},children:[O&&(0,V.jsx)(`div`,{...v.getStyles(`itemIndicator`,{styles:m,classNames:h}),"data-checked":t||void 0,children:t?n:null}),l&&(0,V.jsx)(`div`,{...v.getStyles(`itemLabel`,{styles:m,classNames:h}),"data-menu-item-label":!0,children:l}),o&&(0,V.jsx)(`div`,{...v.getStyles(`itemSection`,{styles:m,classNames:h}),"data-position":`right`,children:o})]})}var Y={dropdown:`m_dc9b7c9f`,label:`m_9bfac126`,divider:`m_efdf90cb`,item:`m_99ac2aa1`,search:`m_ef8769b6`,itemLabel:`m_5476e0d3`,itemIndicator:`m_8395186e`,itemSection:`m_8b75e504`,chevron:`m_b85b0bed`},qe=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,color:s,closeMenuOnClick:c,rightSection:l,children:u,disabled:d,"data-disabled":f,value:p,checked:m,defaultChecked:h,onChange:g,checkIcon:_,ref:v,...y}=a(`MenuCheckboxItem`,null,e),b=q(),x=(0,z.use)(We),S=x&&p!==void 0?x.values.includes(p):void 0,[C,w]=D({value:m??S,defaultValue:h,finalValue:!1,onChange:g}),T=_??b.checkIcon??(0,V.jsx)(He,{size:10});return(0,V.jsx)(Ke,{role:`menuitemcheckbox`,checked:C,indicator:T,onSelect:()=>{g?w(!C):x&&p!==void 0?x.onChange(p):w(!C)},color:s,closeMenuOnClick:c,rightSection:l,disabled:d,dataDisabled:f,className:n,style:r,styles:i,classNames:t,buttonRef:v,others:y,children:u})});qe.classes=Y,qe.displayName=`@mantine/core/MenuCheckboxItem`;function Je(e){let{children:t,disabled:n,longPressDelay:r}=a(`MenuContextMenu`,null,e),i=m(t);if(!i)throw Error(`Menu.ContextMenu component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let o=q(),s=G(),c=je({childProps:i.props,disabled:n||s.disabled,opened:o.opened,longPressDelay:r,setReference:s.reference,open:()=>o.openDropdown()});return(0,z.cloneElement)(i,c)}Je.displayName=`@mantine/core/MenuContextMenu`;var Ye=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,...s}=a(`MenuDivider`,null,e),c=q();return(0,V.jsx)(h,{...c.getStyles(`divider`,{className:n,style:r,styles:i,classNames:t}),...s})});Ye.classes=Y,Ye.displayName=`@mantine/core/MenuDivider`;var Xe=500;function Ze(e){return((e.querySelector(`[data-menu-item-label]`)??e).textContent??``).trim().toLowerCase()}function Qe(e){return e.length>1&&e.split(``).every(t=>t===e[0])}function $e({enabled:e,opened:t,getDropdown:n}){let r=(0,z.useRef)({buffer:``,timeoutId:null});return(0,z.useEffect)(()=>{if(t&&e)return;let n=r.current;n.timeoutId!==null&&(window.clearTimeout(n.timeoutId),n.timeoutId=null),n.buffer=``},[t,e]),(0,z.useEffect)(()=>()=>{let{timeoutId:e}=r.current;e!==null&&window.clearTimeout(e)},[]),t=>{if(!e||t.defaultPrevented||t.ctrlKey||t.metaKey||t.altKey||t.key.length!==1||t.key===` `)return;let i=t.target;if(i&&(i.tagName===`INPUT`||i.tagName===`TEXTAREA`||i.tagName===`SELECT`||i.isContentEditable))return;let a=n();if(!a)return;let o=Array.from(a.querySelectorAll(`[data-menu-item]:not([data-disabled])`)).filter(e=>e.closest(`[data-menu-dropdown]`)===a);if(o.length===0)return;let s=r.current;s.buffer=(s.buffer+t.key).toLowerCase(),s.timeoutId!==null&&window.clearTimeout(s.timeoutId),s.timeoutId=window.setTimeout(()=>{s.buffer=``,s.timeoutId=null},Xe);let c=document.activeElement,l=c?o.indexOf(c):-1,u=null;if(s.buffer.length===1||Qe(s.buffer)){let e=s.buffer[0],t=l+1;for(let n=0;n{let{classNames:t,className:n,style:r,styles:i,vars:o,onMouseEnter:s,onMouseLeave:c,onKeyDown:l,children:u,ref:d,...f}=a(`MenuDropdown`,null,e),p=(0,z.useRef)(null),m=q(),h=$e({enabled:!m.hasSearch,opened:m.opened,getDropdown:()=>p.current}),g=U(l,e=>{h(e),!(e.defaultPrevented||m.hasSearch)&&(e.key===`ArrowUp`||e.key===`ArrowDown`)&&(e.preventDefault(),p.current?.querySelectorAll(`[data-menu-item]:not(:disabled)`)[0]?.focus())}),_=U(s,()=>(m.trigger===`hover`||m.trigger===`click-hover`)&&m.openDropdown()),v=U(c,()=>(m.trigger===`hover`||m.trigger===`click-hover`)&&m.closeDropdown());return(0,V.jsxs)(K.Dropdown,{...f,onMouseEnter:_,onMouseLeave:v,role:`menu`,"aria-orientation":`vertical`,ref:P(d,p),...m.getStyles(`dropdown`,{className:n,style:r,styles:i,classNames:t,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:g,children:[m.withInitialFocusPlaceholder&&!m.hasSearch&&(0,V.jsx)(`div`,{role:`presentation`,tabIndex:-1,"data-autofocus":!0,"data-mantine-stop-propagation":!0,style:{outline:0}}),u]})});et.classes=Y,et.displayName=`@mantine/core/MenuDropdown`;var tt=i(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,color:l,closeMenuOnClick:u,leftSection:d,rightSection:f,children:p,disabled:m,"data-disabled":h,ref:g,..._}=a(`MenuItem`,null,e),v=q(),y=(0,z.use)(J),b=c(),{dir:x}=R(),S=(0,z.useRef)(null),C=_,w=U(C.onClick,()=>{h||(typeof u==`boolean`?u&&v.closeDropdownImmediately():v.closeOnItemClick&&v.closeDropdownImmediately())}),T=U(C.onMouseMove,()=>{if(!v.hasSearch)return;let e=S.current?.closest(`[data-menu-dropdown]`);e&&e.querySelectorAll(`[data-menu-active]`).forEach(t=>{t!==S.current&&t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}),E=l?b.variantColorResolver({color:l,theme:b,variant:`light`}):void 0,D=l?s({color:l,theme:b}):null,O=U(C.onKeyDown,e=>{e.key===`ArrowLeft`&&y&&(y.close(),y.focusParentItem())});return(0,V.jsxs)(I,{onMouseDown:e=>e.preventDefault(),..._,unstyled:v.unstyled,tabIndex:v.menuItemTabIndex,...v.getStyles(`item`,{className:n,style:r,styles:i,classNames:t}),ref:P(S,g),role:`menuitem`,disabled:m,"data-menu-item":!0,"data-disabled":m||h||void 0,"data-mantine-stop-propagation":!0,onClick:w,onMouseMove:T,onKeyDown:H({siblingSelector:`[data-menu-item]:not([data-disabled])`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:v.loop,dir:x,orientation:`vertical`,onKeyDown:O}),__vars:{"--menu-item-color":D?.isThemeColor&&D?.shade===void 0?`var(--mantine-color-${D.color}-6)`:E?.color,"--menu-item-hover":E?.hover},children:[v.alignItemsLabels===`all`&&(0,V.jsx)(`div`,{...v.getStyles(`itemIndicator`,{styles:i,classNames:t}),"data-placeholder":!0}),d&&(0,V.jsx)(`div`,{...v.getStyles(`itemSection`,{styles:i,classNames:t}),"data-position":`left`,children:d}),p&&(0,V.jsx)(`div`,{...v.getStyles(`itemLabel`,{styles:i,classNames:t}),"data-menu-item-label":!0,children:p}),f&&(0,V.jsx)(`div`,{...v.getStyles(`itemSection`,{styles:i,classNames:t}),"data-position":`right`,children:f})]})});tt.classes=Y,tt.displayName=`@mantine/core/MenuItem`;var nt=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,...s}=a(`MenuLabel`,null,e),c=q();return(0,V.jsx)(h,{...c.getStyles(`label`,{className:n,style:r,styles:i,classNames:t}),...s})});nt.classes=Y,nt.displayName=`@mantine/core/MenuLabel`;var rt=(0,z.createContext)(null);function it(e){let{value:t,defaultValue:n,onChange:r,children:i}=a(`MenuRadioGroup`,null,e),[o,s]=D({value:t,defaultValue:n,finalValue:null,onChange:r});return(0,V.jsx)(rt,{value:{value:o,onChange:e=>s(e)},children:i})}it.displayName=`@mantine/core/MenuRadioGroup`;function at({size:e,style:t,...n}){return(0,V.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 5 5`,style:{width:w(e),height:w(e),...t},"aria-hidden":!0,...n,children:(0,V.jsx)(`circle`,{cx:`2.5`,cy:`2.5`,r:`2.5`,fill:`currentColor`})})}var ot=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,color:s,closeMenuOnClick:c,rightSection:l,children:u,disabled:d,"data-disabled":f,value:p,checked:m,onChange:h,checkIcon:g,ref:_,...v}=a(`MenuRadioItem`,null,e),y=q(),b=(0,z.use)(rt),x=m??(b?b.value===p:!1),S=g??y.checkIcon??(0,V.jsx)(at,{size:5});return(0,V.jsx)(Ke,{role:`menuitemradio`,checked:x,indicator:S,onSelect:()=>{x||(h?h(p):b&&b.onChange(p))},color:s,closeMenuOnClick:c,rightSection:l,disabled:d,dataDisabled:f,className:n,style:r,styles:i,classNames:t,buttonRef:_,others:v,children:u})});ot.classes=Y,ot.displayName=`@mantine/core/MenuRadioItem`;var st=`[data-menu-item]:not([data-disabled])`,ct=`[data-menu-active]`;function lt(e){return e?.closest(`[data-menu-dropdown]`)}function ut(e){return e?Array.from(e.querySelectorAll(st)).filter(t=>t.closest(`[data-menu-dropdown]`)===e):[]}function dt(e){e&&e.querySelectorAll(ct).forEach(t=>{t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}function ft(e,t){dt(t),e&&(e.setAttribute(`data-menu-active`,`true`),e.scrollIntoView({block:`nearest`}))}function pt(e){return e.findIndex(e=>e.hasAttribute(`data-menu-active`))}var mt={clearSearchOnClose:!0},ht=r(e=>{let{classNames:t,styles:n,onKeyDown:r,onChange:i,size:o,clearSearchOnClose:s,ref:c,...l}=a(`MenuSearch`,mt,e),u=q(),f=(0,z.useRef)(null),p=P(c,f),m=(0,z.useRef)(i);m.current=i,(0,z.useEffect)(()=>u.registerSearch(),[u.registerSearch]),(0,z.useEffect)(()=>{s?u.searchExitClearRef.current=()=>{m.current?.({currentTarget:{value:``}})}:u.searchExitClearRef.current=null},[s,u.searchExitClearRef]),(0,z.useEffect)(()=>{u.opened||dt(lt(f.current))},[u.opened]);let h=U(i,e=>{dt(lt(e.currentTarget))}),g=U(r,e=>{if(e.defaultPrevented)return;let t=lt(e.currentTarget),n=ut(t);if(e.key===`ArrowDown`){if(e.preventDefault(),n.length===0)return;let r=pt(n);ft(n[r>=n.length-1?u.loop?0:r:r+1]??null,t)}else if(e.key===`ArrowUp`){if(e.preventDefault(),n.length===0)return;let r=pt(n);ft(n[r<=0?r===-1||u.loop?n.length-1:0:r-1]??null,t)}else if(e.key===`Home`)e.preventDefault(),n.length>0&&ft(n[0],t);else if(e.key===`End`)e.preventDefault(),n.length>0&&ft(n[n.length-1],t);else if(e.key===`Enter`){if(e.nativeEvent.isComposing||e.nativeEvent.keyCode===229)return;let t=n[pt(n)];t&&(e.preventDefault(),t.hasAttribute(`data-sub-menu-item`)?(t.focus(),t.dispatchEvent(new KeyboardEvent(`keydown`,{key:`ArrowRight`,bubbles:!0}))):t.click())}}),_=u.getStyles(`search`);return(0,V.jsx)(d,{"data-autofocus":!0,"data-mantine-stop-propagation":!0,type:`search`,size:o,...l,ref:p,classNames:[{input:_.className},t],styles:[{input:_.style},n],onKeyDown:g,onChange:h,__staticSelector:`Menu`})});ht.classes=Y,ht.displayName=`@mantine/core/MenuSearch`;var gt=r(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,onMouseEnter:s,onMouseLeave:c,onPointerEnter:l,onPointerLeave:u,onKeyDown:d,children:f,ref:p,...m}=a(`MenuSubDropdown`,null,e),h=(0,z.useRef)(null),g=q(),_=(0,z.use)(J),v=$e({enabled:!g.hasSearch,opened:_?.opened??!1,getDropdown:()=>h.current}),y=U(d,e=>{v(e),!e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.length===1&&e.key!==` `&&e.stopPropagation()}),b=_?.getFloatingProps({onMouseEnter:s,onMouseLeave:c,onPointerEnter:l,onPointerLeave:u});return(0,V.jsx)(K.Dropdown,{...m,...b,role:`menu`,"aria-orientation":`vertical`,ref:P(p,h,_?.setFloating),...g.getStyles(`dropdown`,{className:n,style:r,styles:i,classNames:t,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:y,children:f})});gt.classes=Y,gt.displayName=`@mantine/core/MenuSubDropdown`;var _t=i(e=>{let{classNames:t,className:n,style:r,styles:i,vars:o,color:u,leftSection:d,rightSection:f,children:p,disabled:m,"data-disabled":h,closeMenuOnClick:g,ref:_,...v}=a(`MenuSubItem`,null,e),y=q(),b=(0,z.use)(J),x=c(),{dir:S}=R(),C=(0,z.useRef)(null),w=v,T=u?x.variantColorResolver({color:u,theme:x,variant:`light`}):void 0,E=u?s({color:u,theme:x}):null,D=U(w.onKeyDown,e=>{e.key===`ArrowRight`&&(b?.open(),b?.focusFirstItem()),e.key===`ArrowLeft`&&b?.parentContext&&(b.parentContext.close(),b.parentContext.focusParentItem())}),O=U(w.onClick,()=>{!h&&g&&y.closeDropdownImmediately()}),k=U(w.onMouseMove,()=>{if(!y.hasSearch)return;let e=C.current?.closest(`[data-menu-dropdown]`);e&&e.querySelectorAll(`[data-menu-active]`).forEach(t=>{t!==C.current&&t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}),A=b?.getReferenceProps({onMouseEnter:w.onMouseEnter,onMouseLeave:w.onMouseLeave,onPointerEnter:w.onPointerEnter,onPointerLeave:w.onPointerLeave});return(0,V.jsxs)(I,{onMouseDown:e=>e.preventDefault(),...v,...A,unstyled:y.unstyled,tabIndex:y.menuItemTabIndex,...y.getStyles(`item`,{className:n,style:r,styles:i,classNames:t}),ref:P(C,_,b?.setReference),role:`menuitem`,disabled:m,"data-menu-item":!0,"data-sub-menu-item":!0,"data-disabled":m||h||void 0,"data-mantine-stop-propagation":!0,onClick:O,onMouseMove:k,onKeyDown:H({siblingSelector:`[data-menu-item]:not([data-disabled])`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:y.loop,dir:S,orientation:`vertical`,onKeyDown:D}),__vars:{"--menu-item-color":E?.isThemeColor&&E?.shade===void 0?`var(--mantine-color-${E.color}-6)`:T?.color,"--menu-item-hover":T?.hover},children:[y.alignItemsLabels===`all`&&(0,V.jsx)(`div`,{...y.getStyles(`itemIndicator`,{styles:i,classNames:t}),"data-placeholder":!0}),d&&(0,V.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:i,classNames:t}),"data-position":`left`,children:d}),p&&(0,V.jsx)(`div`,{...y.getStyles(`itemLabel`,{styles:i,classNames:t}),"data-menu-item-label":!0,children:p}),(0,V.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:i,classNames:t}),"data-position":`right`,children:f||(0,V.jsx)(l,{...y.getStyles(`chevron`),size:14})})]})});_t.classes=Y,_t.displayName=`@mantine/core/MenuSubItem`;function vt({children:e,refProp:t}){if(!x(e))throw Error(`Menu.Sub.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);return q(),(0,V.jsx)(K.Target,{refProp:t,popupType:`menu`,children:e})}vt.displayName=`@mantine/core/MenuSubTarget`;var yt={offset:0,position:`right-start`,safeAreaPolygon:!0,transitionProps:{duration:0},openDelay:0,middlewares:{shift:{crossAxis:!0}}};function X(e){let{children:t,closeDelay:n,openDelay:r,position:i,safeAreaPolygon:o,opened:s,onChange:c,...l}=a(`MenuSub`,yt,e),u=ne(),[d,f]=D({value:s,finalValue:!1,onChange:c}),p=(0,z.use)(J),m=q(),{dir:h}=R(),g=pe(h,i),_=p?.registerOpenSub??m.registerOpenSub,v=(0,z.useRef)(null),y=(0,z.useCallback)(e=>{let t=v.current;return t&&t!==e&&t(),v.current=e,()=>{v.current===e&&(v.current=null)}},[]),b=(0,z.useRef)(f);b.current=f;let x=(0,z.useCallback)(()=>b.current(!0),[]),S=(0,z.useCallback)(()=>b.current(!1),[]);(0,z.useEffect)(()=>{if(d)return _(S)},[d,_,S]);let{context:C,refs:w}=F({placement:g,open:d,onOpenChange:e=>{e?x():S()}}),{getReferenceProps:T,getFloatingProps:E}=L([M(C,{handleClose:o?re(typeof o==`object`?o:void 0):void 0,delay:{open:r,close:n}})]);return(0,V.jsx)(J,{value:{opened:d,close:S,open:x,focusFirstItem:()=>window.setTimeout(()=>{document.getElementById(`${u}-dropdown`)?.querySelectorAll(`[data-menu-item]:not([data-disabled])`)[0]?.focus()},16),focusParentItem:()=>window.setTimeout(()=>{document.getElementById(`${u}-target`)?.focus()},16),parentContext:p,setReference:w.setReference,setFloating:w.setFloating,getReferenceProps:T,getFloatingProps:E,registerOpenSub:y},children:(0,V.jsx)(K,{opened:d,onChange:e=>e?x():S(),withArrow:!1,id:u,position:i,...l,withinPortal:!1,children:t})})}X.extend=e=>e,X.displayName=`@mantine/core/MenuSub`,X.Target=vt,X.Dropdown=gt,X.Item=_t;var bt={refProp:`ref`};function xt(e){let{children:t,refProp:n,...r}=a(`MenuTarget`,bt,e),i=m(t);if(!i)throw Error(`Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let o=q(),s=i.props,c=U(s.onClick,()=>{o.trigger===`click`?o.toggleDropdown():o.trigger===`click-hover`&&(o.setOpenedViaClick(!0),o.opened||o.openDropdown())}),l=U(s.onMouseEnter,()=>(o.trigger===`hover`||o.trigger===`click-hover`)&&o.openDropdown()),u=U(s.onMouseLeave,()=>{(o.trigger===`hover`||o.trigger===`click-hover`&&!o.openedViaClick)&&o.closeDropdown()});return(0,V.jsx)(K.Target,{refProp:n,popupType:`menu`,...r,children:(0,z.cloneElement)(i,{onClick:c,onMouseEnter:l,onMouseLeave:u,"data-expanded":o.opened?!0:void 0})})}xt.displayName=`@mantine/core/MenuTarget`;var St={trapFocus:!0,closeOnItemClick:!0,withInitialFocusPlaceholder:!0,clickOutsideEvents:[`mousedown`,`touchstart`,`keydown`],loop:!0,trigger:`click`,openDelay:0,closeDelay:100,menuItemTabIndex:-1,alignItemsLabels:`with-indicators`},Z=r(e=>{let t=a(`Menu`,St,e),{children:n,onOpen:r,onClose:i,opened:o,defaultOpened:s,trapFocus:c,onChange:l,closeOnItemClick:d,loop:p,closeOnEscape:m,trigger:h,openDelay:g,closeDelay:_,classNames:v,styles:y,unstyled:b,variant:x,vars:S,menuItemTabIndex:C,keepMounted:w,withInitialFocusPlaceholder:T,attributes:E,onExitTransitionEnd:O,alignItemsLabels:k,checkIcon:A,...ee}=t,te=u({name:`Menu`,classes:Y,props:t,classNames:v,styles:y,unstyled:b,attributes:E}),[j,ne]=D({value:o,defaultValue:s,finalValue:!1,onChange:l}),[re,M]=(0,z.useState)(!1),N=()=>{ne(!1),M(!1),j&&i?.()},P=()=>{ne(!0),!j&&r?.()},ie=()=>{j?N():P()},{openDropdown:ae,closeDropdown:oe}=W({open:P,close:N,closeDelay:_,openDelay:g}),F=(0,z.useRef)(null),I=(0,z.useCallback)(e=>{let t=F.current;return t&&t!==e&&t(),F.current=e,()=>{F.current===e&&(F.current=null)}},[]),L=(0,z.useRef)(0),[se,R]=(0,z.useState)(!1),ce=(0,z.useCallback)(()=>(L.current+=1,L.current===1&&R(!0),()=>{--L.current,L.current===0&&R(!1)}),[]),le=(0,z.useRef)(null),ue=()=>{le.current?.(),O?.()},de=e=>xe(`[data-menu-item]`,`[data-menu-dropdown]`,e),{resolvedClassNames:fe,resolvedStyles:pe}=f({classNames:v,styles:y,props:t});return(0,V.jsx)(Ue,{value:{getStyles:te,opened:j,toggleDropdown:ie,getItemIndex:de,openedViaClick:re,setOpenedViaClick:M,closeOnItemClick:d,closeDropdown:h===`click`?N:oe,openDropdown:h===`click`?P:ae,closeDropdownImmediately:N,loop:p,trigger:h,unstyled:b,menuItemTabIndex:C,withInitialFocusPlaceholder:T,registerOpenSub:I,hasSearch:se,registerSearch:ce,searchExitClearRef:le,alignItemsLabels:k,checkIcon:A},children:(0,V.jsx)(K,{returnFocus:!0,...ee,opened:j,onChange:ie,defaultOpened:s,trapFocus:!w&&c,closeOnEscape:m,__staticSelector:`Menu`,classNames:fe,styles:pe,unstyled:b,variant:x,keepMounted:w,onExitTransitionEnd:ue,children:n})})});Z.displayName=`@mantine/core/Menu`,Z.classes=Y,Z.Item=tt,Z.Label=nt,Z.Dropdown=et,Z.Target=xt,Z.Divider=Ye,Z.Search=ht,Z.Sub=X,Z.CheckboxItem=qe,Z.CheckboxGroup=Ge,Z.RadioItem=ot,Z.RadioGroup=it,Z.ContextMenu=Je;var Ct=new Map([[`bold`,z.createElement(z.Fragment,null,z.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`,z.createElement(z.Fragment,null,z.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`}),z.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`,z.createElement(z.Fragment,null,z.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`,z.createElement(z.Fragment,null,z.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`,z.createElement(z.Fragment,null,z.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`,z.createElement(z.Fragment,null,z.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`}))]]),wt=z.forwardRef((e,t)=>z.createElement(ce,{ref:t,...e,weights:Ct}));wt.displayName=`DotsThreeIcon`;var Tt=wt,Et=[`dashboards`],Dt=3e4;async function Q(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 he(e,{...r,headers:i,body:a}),s=await o.json().catch(()=>({}));if(!o.ok)throw Ot(o,s);return s}var Ot=(e,t)=>new ge(t.message??`Request failed (${e.status})`,e.status,t.problems??[],t.code??``),$=e=>`/api/dashboards/${encodeURIComponent(e)}`,kt=()=>Q(`/api/dashboards`).then(e=>e.dashboards),At=(e,t)=>Q($(e),{signal:t}),jt=(e,t)=>Q(`${$(e)}/versions`,{signal:t}).then(e=>e.versions),Mt=(e,t,n)=>Q(`${$(e)}/versions/${t}`,{signal:n}),Nt=(e,t)=>Q(`${$(e)}/versions/${t}/restore`,{method:`POST`}),Pt=(e,t,n,r)=>Q($(e),{method:`PUT`,json:{spec:t,base_version:n,message:r}}),Ft=(e,t,n,r)=>Q($(e),{method:`PATCH`,json:{operations:t,base_version:n,message:r}});async function It(e,t,n,r=!1){let i=r?{"cache-control":`no-cache`}:{};if(!n)return Q(`/api/queries/run`,{method:`POST`,headers:i,json:e,signal:t}).then(e=>e.results);let a=await he(`/api/queries/run`,{method:`POST`,headers:{...i,"content-type":`application/json`,accept:`application/x-ndjson`},body:JSON.stringify(e),signal:t});if(!a.ok)throw Ot(a,await a.json().catch(()=>({})));let o=[],s=a.body.pipeThrough(new TextDecoderStream).getReader(),c=``;try{for(;;){let{done:e,value:t}=await s.read();c+=t??``;let r;for(;(r=c.indexOf(` `))>=0;){let e=c.slice(0,r);if(c=c.slice(r+1),!e.trim())continue;let t=JSON.parse(e);o.push(t),n(t)}if(e)return o}}catch(e){throw s.cancel().catch(()=>{}),e}}var Lt=e=>Q(`/api/dashboards`,{method:`POST`,json:{spec:e}}),Rt=e=>Q(`/api/telemetry/schema`,{signal:e}),zt=(e,t)=>Q(`/api/annotations/query`,{method:`POST`,json:e,signal:t}),Bt=(e,t)=>Q(`/api/queries/variables/resolve`,{method:`POST`,json:e,signal:t}).then(e=>e.options),Vt=(e,t)=>Q(`/api/queries/exemplars`,{method:`POST`,json:e,signal:t});function Ht(e,t){let n=new URLSearchParams({namespace:e.namespace??``,from:e.window_from,to:e.window_to,limit:`500`});return Q(`/api/traces/${encodeURIComponent(e.trace_id??``)}?${n}`,{signal:t})}function Ut(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 Wt(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 Ut(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 Gt(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 Kt(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 qt=[`5m`,`15m`,`1h`,`3h`,`6h`,`12h`,`24h`,`2d`,`7d`,`30d`],Jt=[`off`,`10s`,`30s`,`1m`,`5m`],Yt=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},Xt=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):void 0;function Zt(e){let t={};typeof e.range==`string`&&qt.includes(e.range)?t.range=e.range:Yt(e.from)&&Yt(e.to)&&Date.parse(e.from)typeof e==`string`)&&(i[e]=t)}}else{let t=Xt(n);t!==void 0&&(i[e]=t)}}}Object.keys(i).length>0&&(t.vars=i);let a=Ut(e.drill);return a&&(t.drill=JSON.stringify(a)),t}function Qt(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 $t(e,t){let n=new URL(e);return n.search=Gt(Qt({...Zt(Kt(n.search)),drill:JSON.stringify(t)})),n.href}function en(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}}export{Z as A,Vt as C,Bt as D,Q as E,K as M,H as N,Nt as O,zt as S,Pt as T,Ht as _,qt as a,jt as b,Kt as c,Ut as d,Lt as f,Rt as g,At as h,Zt as i,He as j,Tt as k,Gt as l,Dt as m,en as n,Jt as o,Et as p,Yt as r,Qt as s,$t as t,Wt as u,Mt as v,It as w,Ft as x,kt as y}; \ No newline at end of file diff --git a/internal/ui/dist/assets/search-page-Cs7GeQyA.js b/internal/ui/dist/assets/search-page-uYBxylji.js similarity index 94% rename from internal/ui/dist/assets/search-page-Cs7GeQyA.js rename to internal/ui/dist/assets/search-page-uYBxylji.js index 48aa216ad..275d9f36e 100644 --- a/internal/ui/dist/assets/search-page-Cs7GeQyA.js +++ b/internal/ui/dist/assets/search-page-uYBxylji.js @@ -1 +1 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{G as r,T as i,Tt as a,a as o,g as s,j as c,k as l,l as u,s as ee}from"./brand-CCQ0JT0F.js";import{a as te,c as d,d as f,f as p,g as ne,h as m,r as re,t as ie,u as ae}from"./toolbar-DV2TSB0G.js";import{d as oe,g as se,w as h}from"./search-DBgztReF.js";import{t as g}from"./NumberInput-B7uemOf3.js";import{n as ce,t as le}from"./live-data-meta-CbLSAtC3.js";import{l as _,s as ue}from"./auth-K3NK-QpB.js";import{t as v}from"./useQuery-BLTYSIvG.js";import{n as y,t as de}from"./search-Bj_SOIkw.js";import{ct as fe}from"./index-C5SsAUtw.js";import{t as b}from"./loading-skeleton-DEzWruJF.js";import{W as pe,a as x,i as me,n as he,o as ge,s as _e,t as ve}from"./save-dialog-EDUaI5f8.js";var S=n(e(),1),C=t(),w=e=>`'${e.replaceAll(`'`,`''`)}'`,T=e=>{let t=typeof e==`string`&&e?JSON.parse(e):null;return t&&typeof t==`object`&&!Array.isArray(t)?t:{}};async function E(e,t){let n=Number(e.time),r={from:new Date(n-1).toISOString(),to:new Date(n+1).toISOString(),refresh:`off`},i=Array.from(String(e.body??``)),a=i.length===2e3&&i[1999]===`…`?`starts_with(body, ${w(i.slice(0,1999).join(``))})`:`coalesce(body, '') = ${w(i.join(``))}`,o=`SELECT attributes, resource, coalesce(span_id, ''), coalesce(scope_name, '') FROM logs WHERE $__window(time) AND coalesce(service, '') = ${w(String(e.service??``))} AND coalesce(namespace, '') = ${w(String(e.namespace??``))} AND coalesce(trace_id, '') = ${w(String(e.trace_id??``))} AND ${a} LIMIT 1`,[s]=await h({dashboard:{version:1,name:`Log`,time:r,panels:[{id:`log`,title:`Log`,viz:`table`,sql:o}]},panels:[`log`],time:r},t);if(s?.status===`error`||s?.status===`invalid`)throw Error(s.error??`The log details could not load.`);let c=s?.frame?.values;if(!c||!s.frame?.rows)throw Error(`This log is no longer stored.`);return{attributes:T(c[0][0]),resource:T(c[1][0]),span_id:String(c[2][0]??``),scope:String(c[3][0]??``)}}function ye({row:e,onTrace:t}){let n=v({queryKey:[`log-extras`,e],queryFn:({signal:t})=>E(e,t),retry:!1,staleTime:1/0}),r=typeof e.trace_id==`string`?e.trace_id:``;return(0,C.jsxs)(i,{gap:`xs`,py:4,"data-log-details":!0,onClick:e=>e.stopPropagation(),style:{cursor:`auto`},children:[r&&(0,C.jsx)(a,{children:(0,C.jsx)(u,{label:`Log metadata`,items:[{label:`Trace`,value:t?(0,C.jsx)(_,{component:`button`,type:`button`,size:`sm`,ff:`monospace`,onClick:t,style:{overflowWrap:`anywhere`},children:r}):(0,C.jsx)(c,{span:!0,inherit:!0,ff:`monospace`,children:r})},...n.data?.span_id?[{label:`Span`,value:(0,C.jsx)(c,{span:!0,inherit:!0,ff:`monospace`,children:n.data.span_id})}]:[]]})}),n.isLoading&&(0,C.jsx)(o,{state:`loading`,loadingLabel:`Loading log details`,skeleton:(0,C.jsx)(b,{shape:`key_value`,rows:3})}),n.error&&(0,C.jsx)(a,{p:`xs`,children:(0,C.jsx)(o,{state:`error`,error:{message:n.error.message,onRetry:()=>void n.refetch()}})}),n.data&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(p,{label:`Attributes`,values:n.data.attributes}),(0,C.jsx)(p,{label:`Resource`,values:n.data.resource}),n.data.scope&&(0,C.jsx)(a,{children:(0,C.jsx)(u,{items:[{label:`Instrumentation scope`,value:(0,C.jsx)(c,{span:!0,inherit:!0,ff:`monospace`,children:n.data.scope})}]})})]})]})}var D={name:`Logs`,source:`logs`,viz:`logs`,fields:[`service`,`severity`],sorts:[{value:`time`,label:`Newest`},{value:`+time`,label:`Oldest`}],example:`service:checkout severity>=warn`,matching:`Bare words match anywhere in the body; body:x matches the whole body and body~x any part of it.`},O={name:`Traces`,source:`spans`,viz:`traces`,fields:[`service`,`errors`,`slower`],sorts:[{value:`duration_ms`,label:`Slowest`},{value:`+start`,label:`Oldest`}],example:`status:error duration>500ms`,matching:`Bare words match anywhere in the operation; operation:x matches the whole operation and operation~x any part of it.`},k=`search`,be=[{value:`debug`,label:`Debug and above`},{value:`info`,label:`Info and above`},{value:`warn`,label:`Warn and above`},{value:`error`,label:`Error and above`},{value:`fatal`,label:`Fatal`}];function xe(e,t){let n=[];return e.fields.includes(`service`)&&t.service&&n.push(`service:"${t.service.replaceAll(`"`,`""`)}"`),e.fields.includes(`severity`)&&t.severity&&n.push(`severity>=${t.severity}`),e.fields.includes(`errors`)&&t.errors&&n.push(`status:error`),e.fields.includes(`slower`)&&t.slower&&n.push(`duration>${t.slower}ms`),n.join(` `)}var A=560,Se=100,Ce=e=>e.reason===`busy`?{...e,error:`Not run: other queries kept the server busy. Run the search again.`}:e,we=(e,t)=>e.trim()&&t?`(${e}) ${t}`:e.trim()?e:t,Te=e=>`"${e.replaceAll(`"`,`""`)}"`,j=e=>/\bstatus\b/i.test(e.replace(/'(?:[^']|'')*'|"(?:[^"]|"")*"/g,`''`));async function Ee(e){let t=e?.where??[],n=``;return t.length>0&&(n=(await x({query:{from:`spans`,where:t},viz:`traces`})).where.filter((e,n)=>!e.startsWith(`-`)&&!j(t[n]??``)).map(e=>/\bor\b/i.test(e)?`(${e})`:e).join(` `)),`spans${n?` where ${n}`:``} | count(), error_rate(), p95(duration) by service sort error_rate`}function M({preset:e,search:t,onSearch:n,onSaved:o,onExplore:u}){let[p,g]=(0,S.useState)(t.q),[y,b]=(0,S.useState)([]),[x,w]=(0,S.useState)({shift:0,length:0}),[T,E]=(0,S.useState)([]),[D,O]=(0,S.useState)(),[j,M]=(0,S.useState)(),[N,P]=(0,S.useState)(!1),[F,I]=(0,S.useState)(),L=(0,S.useRef)(void 0),R=(0,S.useRef)(null),z=(0,S.useId)(),[Oe,ke]=(0,S.useState)(),B=de(t),V=`${t.range}|${t.from??``}|${t.to??``}`,H=t.sort&&e.sorts.some(e=>e.value===t.sort)?t.sort:e.sorts[0].value,U=(0,S.useRef)(p);U.current=p;let W=xe(e,t.picks??{}),G=(0,S.useRef)(W);G.current=W;let K=v({queryKey:[`telemetry-schema`],queryFn:({signal:e})=>se(e),staleTime:6e4,retry:!1,enabled:e.fields.includes(`service`)}),q=e=>n({...t,picks:{...t.picks,...e}}),J=(0,S.useRef)(t.q),Y=(0,S.useRef)(t);Y.current=t;let Ae=(0,S.useRef)(n);Ae.current=n;let je=(0,S.useRef)(H);je.current=H,(0,S.useEffect)(()=>()=>L.current?.abort(),[]);let X=async(t,r)=>{L.current?.abort();let i=new AbortController;L.current=i,P(!0),O(void 0),b([]),E([]);try{let a=G.current,o=we(t,a),s=t.trim()&&a?1:0;w({shift:s,length:Array.from(t).length});let c=await ge({text:o,source:e.source,viz:e.viz,window:B.from&&B.to?void 0:B.range},i.signal);if(i.signal.aborted)return;U.current===t&&E(c.notices);let l={id:k,title:he(`${e.name}: ${[t.trim(),a].filter(Boolean).join(` `)||`all`}`),viz:e.viz,query:{...c.query,sort:r}},u=t!==J.current;J.current=t,n({...Y.current,q:t,sort:r,...u?{drill:void 0}:{}},!u);let ee={version:1,name:e.name,time:B,panels:[l]},te=R.current?.clientWidth||960,d=await h({dashboard:ee,panels:[k],time:B,widths:{[k]:te}},i.signal);if(i.signal.aborted)return;let f=d.find(e=>e.id===k);if(!f)throw Error(`The search returned no result.`);if(f.status===`invalid`){U.current===t&&b(f.problems??[]);return}ke(Date.now()),M({text:t,terms:a,sort:r,window:V,panel:l,result:re(Ce(f),[k])})}catch(e){if(i.signal.aborted)return;e instanceof ue&&e.problems.length>0?U.current===t&&b(e.problems):O(e instanceof Error?e.message:`Request failed`)}finally{L.current===i&&P(!1)}},Me=(0,S.useRef)(X);Me.current=X;let Ne=(0,S.useRef)(()=>void 0);Ne.current=()=>void X(U.current,H),(0,S.useEffect)(()=>{Ne.current()},[V,H,W]),(0,S.useEffect)(()=>{t.q!==J.current&&(J.current=t.q,g(t.q),X(t.q,H))},[t.q]);let Pe=(0,S.useMemo)(()=>{let e=e=>e&&e.start>=x.shift&&e.end-x.shift<=x.length?{start:e.start-x.shift,end:e.end-x.shift}:void 0,t=t=>({...t,span:e(t.span),fix_its:t.fix_its?.flatMap(t=>{let n=e(t.span);return n?[{...t,span:n}]:[]})});return{problems:y.map(t),notices:T.map(t)}},[y,T,x]),Z=(0,S.useRef)(j);Z.current=j;let Fe=(0,S.useRef)(p);Fe.current=p;let Q=(0,S.useCallback)(e=>{let t=Z.current;if(!t)return;let n=d(t.panel,t.result,e,{});n&&Ae.current({...Y.current,drill:JSON.stringify(n.target)})},[]),Ie=(0,S.useMemo)(()=>({page:Se,details:e.viz===`logs`?e=>(0,C.jsx)(ye,{row:e,onTrace:()=>{let t=Z.current;t&&Q(f(t.panel,t.result).selection(e))}}):void 0,exclude:e.viz===`traces`?(e,t)=>{let n=Fe.current.trim(),r=[/\bor\b/i.test(n)?`(${n})`:n,`-${e}:${Te(t)}`].filter(Boolean).join(` `);g(r),Me.current(r,je.current)}:void 0}),[e.viz,Q]),Le=j!==void 0&&(j.text!==p||j.terms!==W||j.sort!==H||j.window!==V),$=j!==void 0&&!Le&&!N&&j.result.status===`ok`&&(j.result.frame?.rows??0)>0;return(0,C.jsxs)(i,{gap:`md`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,maw:1600,mx:`auto`,"data-search-page":e.viz,children:[(0,C.jsxs)(r,{justify:`space-between`,align:`flex-end`,children:[(0,C.jsx)(s,{title:e.name,description:e.name===`Logs`?`Search and inspect log events.`:`Find slow requests and inspect their traces.`,meta:(0,C.jsx)(le,{time:B,updatedAt:j?Oe:null})}),(0,C.jsx)(ie,{inHeader:!0,time:B,onRange:e=>n({...t,range:e,from:void 0,to:void 0}),onAbsolute:(e,r)=>n({...t,from:e,to:r})})]}),(0,C.jsxs)(i,{gap:`xs`,children:[(0,C.jsxs)(c,{id:z,size:`xs`,c:`dimmed`,children:[`Filter with FanQL, for example `,(0,C.jsx)(`code`,{children:e.example}),`. `,e.matching,` Press Enter to search.`]}),(0,C.jsx)(_e,{value:p,label:`Search ${e.name.toLowerCase()}`,describedBy:z,problems:Pe.problems,notices:Pe.notices,onChange:e=>{g(e),b([]),E([])},onRun:()=>void X(p,H),complete:(t,n,r)=>me({text:t,cursor:n,source:e.source,viz:e.viz,...B.from&&B.to?{from:B.from,to:B.to}:{window:B.range}},r)})]}),(0,C.jsxs)(r,{gap:`sm`,align:`flex-end`,"data-search-fields":!0,children:[e.fields.includes(`service`)&&(0,C.jsx)(m,{label:`Service`,placeholder:K.isPending?`Loading services…`:`All services`,w:220,clearable:!0,searchable:!0,value:t.picks?.service??null,error:K.isError&&(0,C.jsxs)(C.Fragment,{children:[`Services did not load. `,(0,C.jsx)(_,{component:`button`,type:`button`,fz:`xs`,onClick:()=>void K.refetch(),children:`Retry`})]}),data:[...new Set([...t.picks?.service?[t.picks.service]:[],...(K.data?.services??[]).map(e=>e.value)])],onChange:e=>q({service:e??void 0})}),e.fields.includes(`severity`)&&(0,C.jsx)(m,{label:`Severity`,placeholder:`Any severity`,w:180,clearable:!0,value:t.picks?.severity??null,data:be,onChange:e=>q({severity:e??void 0})}),e.fields.includes(`slower`)&&(0,C.jsx)(De,{value:t.picks?.slower,onCommit:e=>q({slower:e})}),e.fields.includes(`errors`)&&(0,C.jsx)(ce,{label:`Errors only`,mb:8,checked:t.picks?.errors===`1`,onChange:e=>q({errors:e.currentTarget.checked?`1`:void 0})})]}),(0,C.jsxs)(r,{justify:`space-between`,children:[(0,C.jsxs)(r,{gap:`xs`,children:[(0,C.jsx)(l,{loading:N,onClick:()=>void X(p,H),children:`Search`}),(0,C.jsx)(ne,{size:`sm`,"aria-label":`Order`,value:H,data:[...e.sorts],onChange:e=>n({...t,sort:e})}),e.viz===`traces`&&u&&(0,C.jsx)(fe,{label:`Error rate of the matching spans in each service, in Explore. Status and excluded terms are left out.`,children:(0,C.jsx)(l,{variant:`subtle`,size:`xs`,disabled:!j,onClick:()=>{j&&Ee(j.panel.query).then(u,e=>O(e instanceof Error?e.message:`Request failed`))},children:`Span error rates by service`})})]}),(0,C.jsx)(fe,{label:`Search for something that returns rows first`,disabled:$,children:(0,C.jsx)(`span`,{children:(0,C.jsx)(l,{variant:`default`,disabled:!$,onClick:()=>j&&I(j.panel),children:`Save to dashboard`})})})]}),D&&(0,C.jsx)(ee,{tone:`danger`,title:`The search could not run`,children:D}),(0,C.jsx)(a,{ref:R,children:j&&(0,C.jsxs)(i,{gap:`xs`,children:[Le&&(0,C.jsx)(c,{size:`sm`,fw:600,role:`status`,children:`Result of the last search · filters have changed`}),(0,C.jsx)(a,{h:A,children:(0,C.jsx)(te,{panel:j.panel,title:j.panel.title,result:j.result,loading:N,height:A,group:`search-${e.viz}`,editing:!1,agentAvailable:!1,range:B.range,onRetry:()=>void X(j.text,j.sort),traceLinks:`button`,controls:Ie,onPoint:Q})})]})}),j&&(0,C.jsx)(ae,{client:pe,spec:{version:1,name:e.name,time:B,panels:[{...j.panel,title:`this search`}]},time:B,vars:{},target:oe(t.drill),onChange:e=>n({...t,drill:e?JSON.stringify(e):void 0})}),F&&(0,C.jsx)(ve,{panel:F,time:B,onClose:()=>I(void 0),onSaved:o})]})}function De({value:e,onCommit:t}){let[n,r]=(0,S.useState)(e?Number(e):``);(0,S.useEffect)(()=>{r(e?Number(e):``)},[e]);let i=()=>{let r=typeof n==`number`&&n>=1?String(Math.min(y,Math.floor(n))):void 0;r!==e&&t(r)};return(0,C.jsx)(g,{label:`Slower than (ms)`,w:160,min:1,max:y,clampBehavior:`strict`,value:n,onChange:r,onBlur:i,onKeyDown:e=>{e.key===`Enter`&&i()}})}export{D as n,O as r,M as t}; \ No newline at end of file +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{G as r,T as i,Tt as a,a as o,g as s,j as c,k as l,l as u,s as ee}from"./brand-D6fP-cLS.js";import{a as te,c as d,d as f,f as p,g as ne,h as m,r as re,t as ie,u as ae}from"./toolbar-DV46cPGs.js";import{d as oe,g as se,w as h}from"./search-D_K9J6yO.js";import{t as g}from"./NumberInput-CixyOph4.js";import{n as ce,t as le}from"./live-data-meta-CUyw2snU.js";import{l as _,s as ue}from"./auth-DWqIkMZS.js";import{t as v}from"./useQuery-BLTYSIvG.js";import{n as y,t as de}from"./search-CDra9nG2.js";import{ct as fe}from"./index-C1Pd14SU.js";import{t as b}from"./loading-skeleton-D1hXpfUI.js";import{W as pe,a as x,i as me,n as he,o as ge,s as _e,t as ve}from"./save-dialog-Chbkq2Xp.js";var S=n(e(),1),C=t(),w=e=>`'${e.replaceAll(`'`,`''`)}'`,T=e=>{let t=typeof e==`string`&&e?JSON.parse(e):null;return t&&typeof t==`object`&&!Array.isArray(t)?t:{}};async function E(e,t){let n=Number(e.time),r={from:new Date(n-1).toISOString(),to:new Date(n+1).toISOString(),refresh:`off`},i=Array.from(String(e.body??``)),a=i.length===2e3&&i[1999]===`…`?`starts_with(body, ${w(i.slice(0,1999).join(``))})`:`coalesce(body, '') = ${w(i.join(``))}`,o=`SELECT attributes, resource, coalesce(span_id, ''), coalesce(scope_name, '') FROM logs WHERE $__window(time) AND coalesce(service, '') = ${w(String(e.service??``))} AND coalesce(namespace, '') = ${w(String(e.namespace??``))} AND coalesce(trace_id, '') = ${w(String(e.trace_id??``))} AND ${a} LIMIT 1`,[s]=await h({dashboard:{version:1,name:`Log`,time:r,panels:[{id:`log`,title:`Log`,viz:`table`,sql:o}]},panels:[`log`],time:r},t);if(s?.status===`error`||s?.status===`invalid`)throw Error(s.error??`The log details could not load.`);let c=s?.frame?.values;if(!c||!s.frame?.rows)throw Error(`This log is no longer stored.`);return{attributes:T(c[0][0]),resource:T(c[1][0]),span_id:String(c[2][0]??``),scope:String(c[3][0]??``)}}function ye({row:e,onTrace:t}){let n=v({queryKey:[`log-extras`,e],queryFn:({signal:t})=>E(e,t),retry:!1,staleTime:1/0}),r=typeof e.trace_id==`string`?e.trace_id:``;return(0,C.jsxs)(i,{gap:`xs`,py:4,"data-log-details":!0,onClick:e=>e.stopPropagation(),style:{cursor:`auto`},children:[r&&(0,C.jsx)(a,{children:(0,C.jsx)(u,{label:`Log metadata`,items:[{label:`Trace`,value:t?(0,C.jsx)(_,{component:`button`,type:`button`,size:`sm`,ff:`monospace`,onClick:t,style:{overflowWrap:`anywhere`},children:r}):(0,C.jsx)(c,{span:!0,inherit:!0,ff:`monospace`,children:r})},...n.data?.span_id?[{label:`Span`,value:(0,C.jsx)(c,{span:!0,inherit:!0,ff:`monospace`,children:n.data.span_id})}]:[]]})}),n.isLoading&&(0,C.jsx)(o,{state:`loading`,loadingLabel:`Loading log details`,skeleton:(0,C.jsx)(b,{shape:`key_value`,rows:3})}),n.error&&(0,C.jsx)(a,{p:`xs`,children:(0,C.jsx)(o,{state:`error`,error:{message:n.error.message,onRetry:()=>void n.refetch()}})}),n.data&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(p,{label:`Attributes`,values:n.data.attributes}),(0,C.jsx)(p,{label:`Resource`,values:n.data.resource}),n.data.scope&&(0,C.jsx)(a,{children:(0,C.jsx)(u,{items:[{label:`Instrumentation scope`,value:(0,C.jsx)(c,{span:!0,inherit:!0,ff:`monospace`,children:n.data.scope})}]})})]})]})}var D={name:`Logs`,source:`logs`,viz:`logs`,fields:[`service`,`severity`],sorts:[{value:`time`,label:`Newest`},{value:`+time`,label:`Oldest`}],example:`service:checkout severity>=warn`,matching:`Bare words match anywhere in the body; body:x matches the whole body and body~x any part of it.`},O={name:`Traces`,source:`spans`,viz:`traces`,fields:[`service`,`errors`,`slower`],sorts:[{value:`duration_ms`,label:`Slowest`},{value:`+start`,label:`Oldest`}],example:`status:error duration>500ms`,matching:`Bare words match anywhere in the operation; operation:x matches the whole operation and operation~x any part of it.`},k=`search`,be=[{value:`debug`,label:`Debug and above`},{value:`info`,label:`Info and above`},{value:`warn`,label:`Warn and above`},{value:`error`,label:`Error and above`},{value:`fatal`,label:`Fatal`}];function xe(e,t){let n=[];return e.fields.includes(`service`)&&t.service&&n.push(`service:"${t.service.replaceAll(`"`,`""`)}"`),e.fields.includes(`severity`)&&t.severity&&n.push(`severity>=${t.severity}`),e.fields.includes(`errors`)&&t.errors&&n.push(`status:error`),e.fields.includes(`slower`)&&t.slower&&n.push(`duration>${t.slower}ms`),n.join(` `)}var A=560,Se=100,Ce=e=>e.reason===`busy`?{...e,error:`Not run: other queries kept the server busy. Run the search again.`}:e,we=(e,t)=>e.trim()&&t?`(${e}) ${t}`:e.trim()?e:t,Te=e=>`"${e.replaceAll(`"`,`""`)}"`,j=e=>/\bstatus\b/i.test(e.replace(/'(?:[^']|'')*'|"(?:[^"]|"")*"/g,`''`));async function Ee(e){let t=e?.where??[],n=``;return t.length>0&&(n=(await x({query:{from:`spans`,where:t},viz:`traces`})).where.filter((e,n)=>!e.startsWith(`-`)&&!j(t[n]??``)).map(e=>/\bor\b/i.test(e)?`(${e})`:e).join(` `)),`spans${n?` where ${n}`:``} | count(), error_rate(), p95(duration) by service sort error_rate`}function M({preset:e,search:t,onSearch:n,onSaved:o,onExplore:u}){let[p,g]=(0,S.useState)(t.q),[y,b]=(0,S.useState)([]),[x,w]=(0,S.useState)({shift:0,length:0}),[T,E]=(0,S.useState)([]),[D,O]=(0,S.useState)(),[j,M]=(0,S.useState)(),[N,P]=(0,S.useState)(!1),[F,I]=(0,S.useState)(),L=(0,S.useRef)(void 0),R=(0,S.useRef)(null),z=(0,S.useId)(),[Oe,ke]=(0,S.useState)(),B=de(t),V=`${t.range}|${t.from??``}|${t.to??``}`,H=t.sort&&e.sorts.some(e=>e.value===t.sort)?t.sort:e.sorts[0].value,U=(0,S.useRef)(p);U.current=p;let W=xe(e,t.picks??{}),G=(0,S.useRef)(W);G.current=W;let K=v({queryKey:[`telemetry-schema`],queryFn:({signal:e})=>se(e),staleTime:6e4,retry:!1,enabled:e.fields.includes(`service`)}),q=e=>n({...t,picks:{...t.picks,...e}}),J=(0,S.useRef)(t.q),Y=(0,S.useRef)(t);Y.current=t;let Ae=(0,S.useRef)(n);Ae.current=n;let je=(0,S.useRef)(H);je.current=H,(0,S.useEffect)(()=>()=>L.current?.abort(),[]);let X=async(t,r)=>{L.current?.abort();let i=new AbortController;L.current=i,P(!0),O(void 0),b([]),E([]);try{let a=G.current,o=we(t,a),s=t.trim()&&a?1:0;w({shift:s,length:Array.from(t).length});let c=await ge({text:o,source:e.source,viz:e.viz,window:B.from&&B.to?void 0:B.range},i.signal);if(i.signal.aborted)return;U.current===t&&E(c.notices);let l={id:k,title:he(`${e.name}: ${[t.trim(),a].filter(Boolean).join(` `)||`all`}`),viz:e.viz,query:{...c.query,sort:r}},u=t!==J.current;J.current=t,n({...Y.current,q:t,sort:r,...u?{drill:void 0}:{}},!u);let ee={version:1,name:e.name,time:B,panels:[l]},te=R.current?.clientWidth||960,d=await h({dashboard:ee,panels:[k],time:B,widths:{[k]:te}},i.signal);if(i.signal.aborted)return;let f=d.find(e=>e.id===k);if(!f)throw Error(`The search returned no result.`);if(f.status===`invalid`){U.current===t&&b(f.problems??[]);return}ke(Date.now()),M({text:t,terms:a,sort:r,window:V,panel:l,result:re(Ce(f),[k])})}catch(e){if(i.signal.aborted)return;e instanceof ue&&e.problems.length>0?U.current===t&&b(e.problems):O(e instanceof Error?e.message:`Request failed`)}finally{L.current===i&&P(!1)}},Me=(0,S.useRef)(X);Me.current=X;let Ne=(0,S.useRef)(()=>void 0);Ne.current=()=>void X(U.current,H),(0,S.useEffect)(()=>{Ne.current()},[V,H,W]),(0,S.useEffect)(()=>{t.q!==J.current&&(J.current=t.q,g(t.q),X(t.q,H))},[t.q]);let Pe=(0,S.useMemo)(()=>{let e=e=>e&&e.start>=x.shift&&e.end-x.shift<=x.length?{start:e.start-x.shift,end:e.end-x.shift}:void 0,t=t=>({...t,span:e(t.span),fix_its:t.fix_its?.flatMap(t=>{let n=e(t.span);return n?[{...t,span:n}]:[]})});return{problems:y.map(t),notices:T.map(t)}},[y,T,x]),Z=(0,S.useRef)(j);Z.current=j;let Fe=(0,S.useRef)(p);Fe.current=p;let Q=(0,S.useCallback)(e=>{let t=Z.current;if(!t)return;let n=d(t.panel,t.result,e,{});n&&Ae.current({...Y.current,drill:JSON.stringify(n.target)})},[]),Ie=(0,S.useMemo)(()=>({page:Se,details:e.viz===`logs`?e=>(0,C.jsx)(ye,{row:e,onTrace:()=>{let t=Z.current;t&&Q(f(t.panel,t.result).selection(e))}}):void 0,exclude:e.viz===`traces`?(e,t)=>{let n=Fe.current.trim(),r=[/\bor\b/i.test(n)?`(${n})`:n,`-${e}:${Te(t)}`].filter(Boolean).join(` `);g(r),Me.current(r,je.current)}:void 0}),[e.viz,Q]),Le=j!==void 0&&(j.text!==p||j.terms!==W||j.sort!==H||j.window!==V),$=j!==void 0&&!Le&&!N&&j.result.status===`ok`&&(j.result.frame?.rows??0)>0;return(0,C.jsxs)(i,{gap:`md`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,maw:1600,mx:`auto`,"data-search-page":e.viz,children:[(0,C.jsxs)(r,{justify:`space-between`,align:`flex-end`,children:[(0,C.jsx)(s,{title:e.name,description:e.name===`Logs`?`Search and inspect log events.`:`Find slow requests and inspect their traces.`,meta:(0,C.jsx)(le,{time:B,updatedAt:j?Oe:null})}),(0,C.jsx)(ie,{inHeader:!0,time:B,onRange:e=>n({...t,range:e,from:void 0,to:void 0}),onAbsolute:(e,r)=>n({...t,from:e,to:r})})]}),(0,C.jsxs)(i,{gap:`xs`,children:[(0,C.jsxs)(c,{id:z,size:`xs`,c:`dimmed`,children:[`Filter with FanQL, for example `,(0,C.jsx)(`code`,{children:e.example}),`. `,e.matching,` Press Enter to search.`]}),(0,C.jsx)(_e,{value:p,label:`Search ${e.name.toLowerCase()}`,describedBy:z,problems:Pe.problems,notices:Pe.notices,onChange:e=>{g(e),b([]),E([])},onRun:()=>void X(p,H),complete:(t,n,r)=>me({text:t,cursor:n,source:e.source,viz:e.viz,...B.from&&B.to?{from:B.from,to:B.to}:{window:B.range}},r)})]}),(0,C.jsxs)(r,{gap:`sm`,align:`flex-end`,"data-search-fields":!0,children:[e.fields.includes(`service`)&&(0,C.jsx)(m,{label:`Service`,placeholder:K.isPending?`Loading services…`:`All services`,w:220,clearable:!0,searchable:!0,value:t.picks?.service??null,error:K.isError&&(0,C.jsxs)(C.Fragment,{children:[`Services did not load. `,(0,C.jsx)(_,{component:`button`,type:`button`,fz:`xs`,onClick:()=>void K.refetch(),children:`Retry`})]}),data:[...new Set([...t.picks?.service?[t.picks.service]:[],...(K.data?.services??[]).map(e=>e.value)])],onChange:e=>q({service:e??void 0})}),e.fields.includes(`severity`)&&(0,C.jsx)(m,{label:`Severity`,placeholder:`Any severity`,w:180,clearable:!0,value:t.picks?.severity??null,data:be,onChange:e=>q({severity:e??void 0})}),e.fields.includes(`slower`)&&(0,C.jsx)(De,{value:t.picks?.slower,onCommit:e=>q({slower:e})}),e.fields.includes(`errors`)&&(0,C.jsx)(ce,{label:`Errors only`,mb:8,checked:t.picks?.errors===`1`,onChange:e=>q({errors:e.currentTarget.checked?`1`:void 0})})]}),(0,C.jsxs)(r,{justify:`space-between`,children:[(0,C.jsxs)(r,{gap:`xs`,children:[(0,C.jsx)(l,{loading:N,onClick:()=>void X(p,H),children:`Search`}),(0,C.jsx)(ne,{size:`sm`,"aria-label":`Order`,value:H,data:[...e.sorts],onChange:e=>n({...t,sort:e})}),e.viz===`traces`&&u&&(0,C.jsx)(fe,{label:`Error rate of the matching spans in each service, in Explore. Status and excluded terms are left out.`,children:(0,C.jsx)(l,{variant:`subtle`,size:`xs`,disabled:!j,onClick:()=>{j&&Ee(j.panel.query).then(u,e=>O(e instanceof Error?e.message:`Request failed`))},children:`Span error rates by service`})})]}),(0,C.jsx)(fe,{label:`Search for something that returns rows first`,disabled:$,children:(0,C.jsx)(`span`,{children:(0,C.jsx)(l,{variant:`default`,disabled:!$,onClick:()=>j&&I(j.panel),children:`Save to dashboard`})})})]}),D&&(0,C.jsx)(ee,{tone:`danger`,title:`The search could not run`,children:D}),(0,C.jsx)(a,{ref:R,children:j&&(0,C.jsxs)(i,{gap:`xs`,children:[Le&&(0,C.jsx)(c,{size:`sm`,fw:600,role:`status`,children:`Result of the last search · filters have changed`}),(0,C.jsx)(a,{h:A,children:(0,C.jsx)(te,{panel:j.panel,title:j.panel.title,result:j.result,loading:N,height:A,group:`search-${e.viz}`,editing:!1,agentAvailable:!1,range:B.range,onRetry:()=>void X(j.text,j.sort),traceLinks:`button`,controls:Ie,onPoint:Q})})]})}),j&&(0,C.jsx)(ae,{client:pe,spec:{version:1,name:e.name,time:B,panels:[{...j.panel,title:`this search`}]},time:B,vars:{},target:oe(t.drill),onChange:e=>n({...t,drill:e?JSON.stringify(e):void 0})}),F&&(0,C.jsx)(ve,{panel:F,time:B,onClose:()=>I(void 0),onSaved:o})]})}function De({value:e,onCommit:t}){let[n,r]=(0,S.useState)(e?Number(e):``);(0,S.useEffect)(()=>{r(e?Number(e):``)},[e]);let i=()=>{let r=typeof n==`number`&&n>=1?String(Math.min(y,Math.floor(n))):void 0;r!==e&&t(r)};return(0,C.jsx)(g,{label:`Slower than (ms)`,w:160,min:1,max:y,clampBehavior:`strict`,value:n,onChange:r,onBlur:i,onKeyDown:e=>{e.key===`Enter`&&i()}})}export{D as n,O as r,M as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/settings-BhplbQY-.js b/internal/ui/dist/assets/settings-BhplbQY-.js new file mode 100644 index 000000000..1fb4e4e69 --- /dev/null +++ b/internal/ui/dist/assets/settings-BhplbQY-.js @@ -0,0 +1,16 @@ +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{$ as r,G as i,S as a,T as o,Tt as s,a as c,g as l,i as u,j as d,k as f,l as p,r as m,s as h,u as g,w as _}from"./brand-D6fP-cLS.js";import{t as v}from"./CopyButton-BIdC6qm1.js";import{a as y,c as b,i as x,l as S,n as C,r as w}from"./auth-DWqIkMZS.js";import{T,t as E}from"./useQuery-BLTYSIvG.js";import{t as D}from"./useMutation-B1CTivyp.js";import{O,ct as k,d as A,k as j,x as M}from"./index-C1Pd14SU.js";import{t as N}from"./loading-skeleton-D1hXpfUI.js";var P=n(e(),1),F=t(),I=[`settings`,`ingest`],L=[`settings`,`ingest`,`tokens`];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)?``:` + tls: + insecure: true`;return`exporters: + otlp/pitot: + endpoint: "${e}" + headers: + ${t}: "Bearer \${env:INGEST_TOKEN}"${r} + +service: + pipelines: + traces: + exporters: [otlp/pitot] + logs: + exporters: [otlp/pitot] + metrics: + exporters: [otlp/pitot]`}function B({label:e,value:t,hint:n}){return(0,F.jsx)(p,{layout:`stacked`,items:[{label:e,hint:n,value:(0,F.jsxs)(i,{gap:`xs`,wrap:`nowrap`,align:`center`,children:[(0,F.jsx)(b,{style:{flex:1,overflowX:`auto`},children:t}),(0,F.jsx)(v,{value:t,timeout:1500,children:({copied:t,copy:n})=>(0,F.jsx)(k,{label:t?`Copied`:`Copy ${e.toLowerCase()}`,withArrow:!0,children:(0,F.jsx)(f,{variant:`subtle`,color:`gray`,size:`sm`,onClick:n,"aria-label":`Copy ${e.toLowerCase()}`,children:t?(0,F.jsx)(u,{size:15,weight:`bold`}):(0,F.jsx)(m,{size:15})})})})]})}]})}function V(e){return e.hint?`foi_…${e.hint}`:`Not recorded`}function H(e){return e.last_used_at?A(Date.parse(e.last_used_at)):`Never`}function U({created:e,config:t,onDone:n}){return(0,F.jsx)(r,{withBorder:!0,radius:`md`,p:`lg`,children:(0,F.jsxs)(o,{gap:`sm`,children:[(0,F.jsx)(h,{tone:`warning`,title:`Save this token now`,children:`Pitot shows it only here and stores only a digest. Close this page or choose Done and the value is gone; creating another token is the only way back.`}),(0,F.jsx)(d,{size:`sm`,fw:600,children:e.name}),(0,F.jsx)(B,{label:`Token`,value:e.value}),(0,F.jsxs)(o,{gap:4,children:[(0,F.jsx)(d,{size:`sm`,fw:600,children:`Collector configuration`}),(0,F.jsx)(d,{c:`dimmed`,size:`xs`,children:`Set INGEST_TOKEN in the Collector's environment, not in a file you commit.`}),(0,F.jsx)(b,{block:!0,style:{fontSize:12},children:`INGEST_TOKEN=${e.value}`}),(0,F.jsx)(b,{block:!0,style:{fontSize:12},children:t})]}),(0,F.jsxs)(i,{children:[(0,F.jsx)(v,{value:t,timeout:1500,children:({copied:e,copy:t})=>(0,F.jsx)(f,{variant:`light`,size:`compact-sm`,leftSection:e?(0,F.jsx)(u,{size:15,weight:`bold`}):(0,F.jsx)(m,{size:15}),onClick:t,children:e?`Copied`:`Copy configuration`})}),(0,F.jsx)(f,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:n,children:`Done`})]})]})})}function W({token:e,onRevoke:t,disabled:n}){return(0,F.jsxs)(i,{justify:`space-between`,align:`center`,children:[(0,F.jsxs)(s,{style:{minWidth:0,overflowWrap:`anywhere`},children:[(0,F.jsx)(d,{size:`sm`,fw:600,children:e.name}),(0,F.jsx)(p,{items:[{label:`Hint`,value:(0,F.jsx)(d,{span:!0,ff:`monospace`,size:`sm`,children:V(e)})},{label:`Created`,value:(0,F.jsx)(`time`,{style:{fontFamily:`var(--mantine-font-family-monospace)`},dateTime:e.created_at,children:A(Date.parse(e.created_at))})},{label:`Last used`,value:(0,F.jsx)(d,{span:!0,ff:`monospace`,size:`sm`,children:H(e)})}]})]}),(0,F.jsx)(f,{variant:`default`,size:`sm`,onClick:t,disabled:n,children:`Revoke`})]})}function G({hasToken:e,config:t}){let n=T(),a=E({queryKey:L,queryFn:()=>O(`/api/settings/ingest/tokens`)}),[s,l]=(0,P.useState)(``),[u,p]=(0,P.useState)(null),[m,v]=(0,P.useState)(null),b=()=>Promise.all([n.invalidateQueries({queryKey:L,exact:!0}),n.invalidateQueries({queryKey:I,exact:!0})]),x=D({gcTime:0,onMutate:()=>n.cancelQueries({queryKey:L,exact:!0}),mutationFn:async e=>{let t=await y(`/api/settings/ingest/tokens`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e})}).catch(()=>{throw Error(`Pitot could not be reached. A token may still have been created; reload this page before trying again.`)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??`Pitot could not create the token. Try again.`)}return t.json()},onSuccess:e=>{p({name:e.token.name,value:e.ingest_token}),l(``),b()}}),S=D({onMutate:()=>n.cancelQueries({queryKey:L,exact:!0}),mutationFn:async e=>{let t=await y(`/api/settings/ingest/tokens/${encodeURIComponent(e.id)}/revoke`,{method:`POST`}).catch(()=>{throw Error(`Pitot could not be reached. Reload this page to see whether the token was revoked.`)});if(t.status===404)throw Error(`That token was already revoked. Reload this page.`);if(!t.ok)throw Error(`Pitot could not revoke the token. Try again.`)},onSuccess:()=>{v(null),b()}});function C(e){e.preventDefault(),!(s.trim()===``||x.isPending)&&x.mutate(s.trim())}function w(){p(null),x.reset()}let k=a.data?.tokens??[],A=k.length===1,M=a.data?.max_active??0,R=a.data!==void 0&&k.length>=M;return(0,F.jsxs)(F.Fragment,{children:[u&&(0,F.jsx)(U,{created:u,config:t,onDone:w}),(0,F.jsx)(r,{withBorder:!0,radius:`md`,p:`lg`,children:(0,F.jsxs)(o,{gap:`md`,children:[(0,F.jsx)(`form`,{onSubmit:C,children:(0,F.jsxs)(o,{gap:`xs`,children:[(0,F.jsxs)(i,{align:`flex-end`,wrap:`nowrap`,children:[(0,F.jsx)(_,{label:`Token name`,description:`Name the Collector or environment that will use it.`,placeholder:`production-collector`,maxLength:64,value:s,onChange:e=>{x.reset(),l(e.currentTarget.value)},style:{flex:1}}),(0,F.jsx)(f,{type:`submit`,leftSection:(0,F.jsx)(j,{size:15,weight:`bold`}),loading:x.isPending,disabled:s.trim()===``||R,children:`Create token`})]}),x.isError&&(0,F.jsx)(h,{tone:`danger`,children:x.error.message}),R&&(0,F.jsxs)(d,{c:`dimmed`,size:`xs`,children:[`This workspace has `,M,` active tokens, the maximum. Revoke one to create another.`]})]})}),a.data?k.length===0?(0,F.jsx)(h,{tone:e?`info`:`warning`,title:`No active tokens`,children:`Ingest rejects every export until you create a token.`}):(0,F.jsx)(o,{gap:`md`,children:k.map(e=>(0,F.jsx)(W,{token:e,disabled:S.isPending,onRevoke:()=>{S.reset(),v(e)}},e.id))}):a.isLoading?(0,F.jsx)(c,{state:`loading`,loadingLabel:`Loading ingest tokens`,skeleton:(0,F.jsx)(N,{shape:`agents`,rows:3})}):(0,F.jsxs)(o,{gap:`sm`,align:`flex-start`,children:[(0,F.jsx)(h,{tone:`danger`,children:`Pitot could not load the ingest tokens.`}),(0,F.jsx)(f,{size:`compact-sm`,variant:`light`,onClick:()=>void a.refetch(),children:`Try again`})]})]})}),(0,F.jsx)(g,{opened:m!==null,onClose:()=>{S.reset(),v(null)},title:`Revoke ${m?.name??`token`}?`,confirmLabel:`Revoke token`,tone:`danger`,pending:S.isPending?`confirm`:null,error:S.error?.message,onConfirm:()=>m&&S.mutate(m),children:A?(0,F.jsxs)(o,{gap:`xs`,children:[(0,F.jsx)(h,{tone:`danger`,title:`This is the last active token`,children:`Revoking it stops all ingest. Every Collector is rejected until you create a new token.`}),(0,F.jsx)(d,{size:`sm`,children:`The revocation takes effect immediately and cannot be undone.`})]}):`Any Collector using this token is rejected immediately. Other tokens keep working. This cannot be undone.`})]})}function K(){let e=w(),t=E({queryKey:I,queryFn:()=>O(`/api/settings/ingest`)}),[n,l]=(0,P.useState)(null);if(!t.data)return t.isLoading?(0,F.jsx)(c,{state:`loading`,loadingLabel:`Loading connection details`,skeleton:(0,F.jsx)(N,{shape:`settings`})}):(0,F.jsx)(c,{state:`error`,error:{message:`Pitot could not load this workspace's connection details.`,onRetry:()=>void t.refetch()}});let{suggested_endpoint:p,header_name:h,tls_configured:g,token_required:y}=t.data,C=n??p,T=C.trim()||p,D=e.role===`admin`,A=`${h}: Bearer `,j=z(T,h,g);return(0,F.jsxs)(o,{gap:`xl`,children:[(0,F.jsx)(a,{order:2,fz:18,children:`Connect telemetry`}),(0,F.jsx)(d,{c:`dimmed`,size:`sm`,children:`Point an OpenTelemetry collector or SDK at this workspace.`}),(0,F.jsx)(r,{withBorder:!0,radius:`md`,p:`lg`,children:(0,F.jsxs)(o,{gap:`lg`,children:[(0,F.jsxs)(o,{gap:4,children:[(0,F.jsx)(d,{size:`sm`,fw:600,children:`Endpoint`}),(0,F.jsxs)(i,{gap:`xs`,wrap:`nowrap`,align:`center`,children:[(0,F.jsx)(_,{"aria-label":`Endpoint`,value:C,onChange:e=>l(e.currentTarget.value),style:{flex:1},styles:{input:{fontFamily:`var(--mantine-font-family-monospace)`}}}),(0,F.jsx)(v,{value:T,timeout:1500,children:({copied:e,copy:t})=>(0,F.jsx)(k,{label:e?`Copied`:`Copy endpoint`,withArrow:!0,children:(0,F.jsx)(f,{variant:`subtle`,color:`gray`,size:`sm`,onClick:t,"aria-label":`Copy endpoint`,children:e?(0,F.jsx)(u,{size:15,weight:`bold`}):(0,F.jsx)(m,{size:15})})})})]}),(0,F.jsxs)(d,{c:`dimmed`,size:`xs`,children:[R(T,g)?`OTLP over gRPC, secured with TLS.`:`OTLP over gRPC. Pitot 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 Pitot through another hostname.`]})]}),(0,F.jsx)(B,{label:`Authorization`,value:A,hint:`Send one of your workspace's ingest tokens. Pitot stores only a digest of each, so it cannot show you an existing one.`})]})}),(0,F.jsxs)(o,{gap:`sm`,children:[(0,F.jsxs)(s,{children:[(0,F.jsx)(a,{order:2,fz:22,lts:`-0.02em`,children:`Collector configuration`}),(0,F.jsx)(d,{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,F.jsx)(r,{withBorder:!0,radius:`md`,p:`md`,children:(0,F.jsxs)(o,{gap:`sm`,children:[(0,F.jsx)(b,{block:!0,style:{fontSize:12},children:j}),(0,F.jsx)(i,{justify:`flex-end`,children:(0,F.jsx)(v,{value:j,timeout:1500,children:({copied:e,copy:t})=>(0,F.jsx)(f,{variant:`light`,size:`compact-sm`,leftSection:e?(0,F.jsx)(u,{size:15,weight:`bold`}):(0,F.jsx)(m,{size:15}),onClick:t,children:e?`Copied`:`Copy configuration`})})})]})})]}),(0,F.jsxs)(o,{gap:`sm`,children:[(0,F.jsxs)(s,{children:[(0,F.jsx)(a,{order:2,fz:22,lts:`-0.02em`,children:`Ingest tokens`}),(0,F.jsx)(d,{c:`dimmed`,size:`sm`,mt:2,children:y?`Each Collector can have its own token. To rotate one, create a replacement, move the Collector across, then revoke the old token.`:`This workspace has no active token, so it is rejecting telemetry.`})]}),D?(0,F.jsx)(G,{hasToken:y,config:j}):(0,F.jsx)(r,{withBorder:!0,radius:`md`,p:`lg`,children:(0,F.jsx)(d,{size:`sm`,c:`dimmed`,children:`An administrator creates and revokes ingest tokens.`})})]}),(0,F.jsxs)(d,{c:`dimmed`,size:`xs`,children:[(0,F.jsx)(S,{href:x.ingest,target:`_blank`,rel:`noopener noreferrer`,underline:`always`,children:`Sending telemetry`}),` covers SDK setup, the collector, and the OTLP/HTTP endpoint.`]})]})}var q=[`settings`,`oauth`,`connections`];function J(){let e=T(),t=E({queryKey:q,queryFn:()=>O(`/api/auth/oauth/connections`)}),[n,l]=(0,P.useState)(null),[u,m]=(0,P.useState)(``),_=D({onMutate:async()=>{m(``),await e.cancelQueries({queryKey:q})},mutationFn:async e=>{if(!(await y(`/api/auth/oauth/connections/${encodeURIComponent(e.client_id)}/revoke`,{method:`POST`})).ok)throw Error(`Pitot could not disconnect this agent. Try again.`)},onSuccess:(t,n)=>{e.setQueryData(q,e=>e&&{connections:e.connections.filter(e=>e.client_id!==n.client_id)}),l(null),m(`${n.client_name} disconnected.`)}});return(0,F.jsxs)(o,{gap:`sm`,children:[(0,F.jsxs)(s,{children:[(0,F.jsx)(a,{order:2,fz:22,lts:`-0.02em`,children:`Connected agents`}),(0,F.jsx)(d,{c:`dimmed`,size:`sm`,mt:2,children:`Agents you have authorized to access Pitot through MCP.`})]}),(0,F.jsx)(r,{withBorder:!0,radius:`md`,p:`lg`,children:t.data?t.data.connections.length===0?(0,F.jsx)(c,{state:`empty`,empty:{title:`No agents connected.`,description:`Authorize an agent to access this workspace.`,action:(0,F.jsx)(S,{href:x.connect,target:`_blank`,rel:`noopener noreferrer`,underline:`always`,children:`Connect an agent over MCP`})}}):(0,F.jsx)(o,{gap:`md`,children:t.data.connections.map(e=>(0,F.jsxs)(i,{justify:`space-between`,align:`center`,children:[(0,F.jsxs)(s,{style:{minWidth:0,overflowWrap:`anywhere`},children:[(0,F.jsx)(d,{size:`sm`,fw:600,children:e.client_name}),(0,F.jsx)(p,{items:[{label:`Connected`,value:(0,F.jsx)(`time`,{style:{fontFamily:`var(--mantine-font-family-monospace)`},dateTime:e.connected_at,children:A(Date.parse(e.connected_at))})}]})]}),(0,F.jsx)(f,{variant:`default`,size:`sm`,onClick:()=>{_.reset(),l(e)},disabled:_.isPending,children:`Disconnect`})]},e.client_id))}):t.isLoading?(0,F.jsx)(c,{state:`loading`,loadingLabel:`Loading connected agents`,skeleton:(0,F.jsx)(N,{shape:`agents`,rows:3})}):(0,F.jsxs)(o,{gap:`sm`,align:`flex-start`,children:[(0,F.jsx)(h,{tone:`danger`,children:`Pitot could not load your connected agents.`}),(0,F.jsx)(f,{size:`compact-sm`,variant:`light`,onClick:()=>void t.refetch(),children:`Try again`})]})}),(0,F.jsx)(d,{size:`sm`,c:`dimmed`,role:`status`,"aria-live":`polite`,children:u}),(0,F.jsxs)(g,{opened:n!==null,onClose:()=>{_.reset(),l(null)},title:`Disconnect ${n?.client_name??`agent`}?`,confirmLabel:`Disconnect agent`,tone:`danger`,pending:_.isPending?`confirm`:null,error:_.isError?`Pitot could not disconnect this agent. Try again.`:void 0,onConfirm:()=>n&&_.mutate(n),children:[(0,F.jsx)(d,{span:!0,ff:`monospace`,children:n?.client_name}),` loses access immediately. Your other agents and browser session stay connected. You can authorize the agent again to reconnect.`]})]})}var Y=`Administrators can still change an email or display name, suspend or reactivate an account, and delete an account.`,X={identity_provider_roles:{tone:`info`,title:`Managed by your identity provider`,reason:`Your identity provider creates accounts at first sign-in and assigns roles, so Pitot refuses both here. ${Y}`},identity_provider_roles_no_provisioning:{tone:`warning`,title:`New people cannot be added`,reason:`Your identity provider assigns roles, so Pitot refuses creating accounts and changing roles here, and this workspace does not create accounts at sign-in. People without an account stay out until automatic provisioning with an allow-list or SCIM is configured. ${Y}`},identity_provider_directory:{tone:`info`,title:`Managed by your identity provider`,reason:`Your identity provider owns accounts through SCIM. Pitot refuses creating or deleting an account and changing its role, status, or email here. Display names can still be edited.`}};function Z(){let{account_ownership:e}=C();return e===`local`?null:(0,F.jsxs)(o,{gap:`sm`,children:[(0,F.jsx)(a,{order:2,fz:22,lts:`-0.02em`,children:`User accounts`}),(0,F.jsxs)(h,{tone:X[e].tone,title:X[e].title,children:[X[e].reason,` `,(0,F.jsx)(S,{href:x.authentication,target:`_blank`,rel:`noopener noreferrer`,underline:`always`,children:`Authentication`}),` covers what stays in Pitot.`]})]})}function Q(){let{agentAvailable:e}=M();return(0,F.jsx)(s,{w:`100%`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,children:(0,F.jsxs)(o,{gap:`xl`,children:[(0,F.jsx)(l,{title:`Settings`,description:`Manage telemetry connections and authorized agents.`}),(0,F.jsx)(K,{}),!e&&(0,F.jsxs)(o,{gap:`sm`,children:[(0,F.jsx)(a,{order:2,fz:22,lts:`-0.02em`,children:`Chat is disabled`}),(0,F.jsx)(r,{withBorder:!0,radius:`md`,p:`lg`,children:(0,F.jsxs)(o,{gap:`sm`,children:[(0,F.jsxs)(d,{size:`sm`,children:[`To enable chat on a self-hosted instance, set `,(0,F.jsx)(b,{children:`PITOT_AI_PROVIDER`}),` to `,(0,F.jsx)(b,{children:`anthropic`}),` with `,(0,F.jsx)(b,{children:`ANTHROPIC_API_KEY`}),`, or `,(0,F.jsx)(b,{children:`openai`}),` with `,(0,F.jsx)(b,{children:`OPENAI_API_KEY`}),`, then restart Pitot.`]}),(0,F.jsxs)(d,{size:`sm`,children:[`You can also `,(0,F.jsx)(S,{href:x.connect,target:`_blank`,rel:`noopener noreferrer`,underline:`always`,children:`connect an MCP client`}),` such as Claude, Codex, or ChatGPT to use your own AI.`]})]})})]}),(0,F.jsx)(Z,{}),(0,F.jsx)(J,{})]})})}function $(){return(0,F.jsx)(s,{w:`100%`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,children:(0,F.jsxs)(o,{gap:`xl`,children:[(0,F.jsx)(l,{title:`Ingest tokens`,description:`Create and revoke the tokens Collectors use to send telemetry.`}),(0,F.jsx)(K,{})]})})}export{Q as n,$ as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/settings-CXC__vby.js b/internal/ui/dist/assets/settings-CXC__vby.js deleted file mode 100644 index ec8e4edca..000000000 --- a/internal/ui/dist/assets/settings-CXC__vby.js +++ /dev/null @@ -1,16 +0,0 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{$ as r,G as i,S as a,T as o,Tt as s,a as c,g as l,i as u,j as d,k as f,l as p,r as m,s as h,u as g,w as _}from"./brand-CCQ0JT0F.js";import{t as v}from"./CopyButton-Btk7J2NS.js";import{a as y,c as b,i as x,l as S,n as C,r as w}from"./auth-K3NK-QpB.js";import{T,t as E}from"./useQuery-BLTYSIvG.js";import{t as D}from"./useMutation-rZS3GfBb.js";import{O,ct as k,d as A,k as j,x as M}from"./index-C5SsAUtw.js";import{t as N}from"./loading-skeleton-DEzWruJF.js";var P=n(e(),1),F=t(),I=[`settings`,`ingest`],L=[`settings`,`ingest`,`tokens`];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)?``:` - tls: - insecure: true`;return`exporters: - otlp/fanout: - endpoint: "${e}" - headers: - ${t}: "Bearer \${env:INGEST_TOKEN}"${r} - -service: - pipelines: - traces: - exporters: [otlp/fanout] - logs: - exporters: [otlp/fanout] - metrics: - exporters: [otlp/fanout]`}function B({label:e,value:t,hint:n}){return(0,F.jsx)(p,{layout:`stacked`,items:[{label:e,hint:n,value:(0,F.jsxs)(i,{gap:`xs`,wrap:`nowrap`,align:`center`,children:[(0,F.jsx)(b,{style:{flex:1,overflowX:`auto`},children:t}),(0,F.jsx)(v,{value:t,timeout:1500,children:({copied:t,copy:n})=>(0,F.jsx)(k,{label:t?`Copied`:`Copy ${e.toLowerCase()}`,withArrow:!0,children:(0,F.jsx)(f,{variant:`subtle`,color:`gray`,size:`sm`,onClick:n,"aria-label":`Copy ${e.toLowerCase()}`,children:t?(0,F.jsx)(u,{size:15,weight:`bold`}):(0,F.jsx)(m,{size:15})})})})]})}]})}function V(e){return e.hint?`foi_…${e.hint}`:`Not recorded`}function H(e){return e.last_used_at?A(Date.parse(e.last_used_at)):`Never`}function U({created:e,config:t,onDone:n}){return(0,F.jsx)(r,{withBorder:!0,radius:`md`,p:`lg`,children:(0,F.jsxs)(o,{gap:`sm`,children:[(0,F.jsx)(h,{tone:`warning`,title:`Save this token now`,children:`Fanout shows it only here and stores only a digest. Close this page or choose Done and the value is gone; creating another token is the only way back.`}),(0,F.jsx)(d,{size:`sm`,fw:600,children:e.name}),(0,F.jsx)(B,{label:`Token`,value:e.value}),(0,F.jsxs)(o,{gap:4,children:[(0,F.jsx)(d,{size:`sm`,fw:600,children:`Collector configuration`}),(0,F.jsx)(d,{c:`dimmed`,size:`xs`,children:`Set INGEST_TOKEN in the Collector's environment, not in a file you commit.`}),(0,F.jsx)(b,{block:!0,style:{fontSize:12},children:`INGEST_TOKEN=${e.value}`}),(0,F.jsx)(b,{block:!0,style:{fontSize:12},children:t})]}),(0,F.jsxs)(i,{children:[(0,F.jsx)(v,{value:t,timeout:1500,children:({copied:e,copy:t})=>(0,F.jsx)(f,{variant:`light`,size:`compact-sm`,leftSection:e?(0,F.jsx)(u,{size:15,weight:`bold`}):(0,F.jsx)(m,{size:15}),onClick:t,children:e?`Copied`:`Copy configuration`})}),(0,F.jsx)(f,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:n,children:`Done`})]})]})})}function W({token:e,onRevoke:t,disabled:n}){return(0,F.jsxs)(i,{justify:`space-between`,align:`center`,children:[(0,F.jsxs)(s,{style:{minWidth:0,overflowWrap:`anywhere`},children:[(0,F.jsx)(d,{size:`sm`,fw:600,children:e.name}),(0,F.jsx)(p,{items:[{label:`Hint`,value:(0,F.jsx)(d,{span:!0,ff:`monospace`,size:`sm`,children:V(e)})},{label:`Created`,value:(0,F.jsx)(`time`,{style:{fontFamily:`var(--mantine-font-family-monospace)`},dateTime:e.created_at,children:A(Date.parse(e.created_at))})},{label:`Last used`,value:(0,F.jsx)(d,{span:!0,ff:`monospace`,size:`sm`,children:H(e)})}]})]}),(0,F.jsx)(f,{variant:`default`,size:`sm`,onClick:t,disabled:n,children:`Revoke`})]})}function G({hasToken:e,config:t}){let n=T(),a=E({queryKey:L,queryFn:()=>O(`/api/settings/ingest/tokens`)}),[s,l]=(0,P.useState)(``),[u,p]=(0,P.useState)(null),[m,v]=(0,P.useState)(null),b=()=>Promise.all([n.invalidateQueries({queryKey:L,exact:!0}),n.invalidateQueries({queryKey:I,exact:!0})]),x=D({gcTime:0,onMutate:()=>n.cancelQueries({queryKey:L,exact:!0}),mutationFn:async e=>{let t=await y(`/api/settings/ingest/tokens`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e})}).catch(()=>{throw Error(`Fanout could not be reached. A token may still have been created; reload this page before trying again.`)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??`Fanout could not create the token. Try again.`)}return t.json()},onSuccess:e=>{p({name:e.token.name,value:e.ingest_token}),l(``),b()}}),S=D({onMutate:()=>n.cancelQueries({queryKey:L,exact:!0}),mutationFn:async e=>{let t=await y(`/api/settings/ingest/tokens/${encodeURIComponent(e.id)}/revoke`,{method:`POST`}).catch(()=>{throw Error(`Fanout could not be reached. Reload this page to see whether the token was revoked.`)});if(t.status===404)throw Error(`That token was already revoked. Reload this page.`);if(!t.ok)throw Error(`Fanout could not revoke the token. Try again.`)},onSuccess:()=>{v(null),b()}});function C(e){e.preventDefault(),!(s.trim()===``||x.isPending)&&x.mutate(s.trim())}function w(){p(null),x.reset()}let k=a.data?.tokens??[],A=k.length===1,M=a.data?.max_active??0,R=a.data!==void 0&&k.length>=M;return(0,F.jsxs)(F.Fragment,{children:[u&&(0,F.jsx)(U,{created:u,config:t,onDone:w}),(0,F.jsx)(r,{withBorder:!0,radius:`md`,p:`lg`,children:(0,F.jsxs)(o,{gap:`md`,children:[(0,F.jsx)(`form`,{onSubmit:C,children:(0,F.jsxs)(o,{gap:`xs`,children:[(0,F.jsxs)(i,{align:`flex-end`,wrap:`nowrap`,children:[(0,F.jsx)(_,{label:`Token name`,description:`Name the Collector or environment that will use it.`,placeholder:`production-collector`,maxLength:64,value:s,onChange:e=>{x.reset(),l(e.currentTarget.value)},style:{flex:1}}),(0,F.jsx)(f,{type:`submit`,leftSection:(0,F.jsx)(j,{size:15,weight:`bold`}),loading:x.isPending,disabled:s.trim()===``||R,children:`Create token`})]}),x.isError&&(0,F.jsx)(h,{tone:`danger`,children:x.error.message}),R&&(0,F.jsxs)(d,{c:`dimmed`,size:`xs`,children:[`This workspace has `,M,` active tokens, the maximum. Revoke one to create another.`]})]})}),a.data?k.length===0?(0,F.jsx)(h,{tone:e?`info`:`warning`,title:`No active tokens`,children:`Ingest rejects every export until you create a token.`}):(0,F.jsx)(o,{gap:`md`,children:k.map(e=>(0,F.jsx)(W,{token:e,disabled:S.isPending,onRevoke:()=>{S.reset(),v(e)}},e.id))}):a.isLoading?(0,F.jsx)(c,{state:`loading`,loadingLabel:`Loading ingest tokens`,skeleton:(0,F.jsx)(N,{shape:`agents`,rows:3})}):(0,F.jsxs)(o,{gap:`sm`,align:`flex-start`,children:[(0,F.jsx)(h,{tone:`danger`,children:`Fanout could not load the ingest tokens.`}),(0,F.jsx)(f,{size:`compact-sm`,variant:`light`,onClick:()=>void a.refetch(),children:`Try again`})]})]})}),(0,F.jsx)(g,{opened:m!==null,onClose:()=>{S.reset(),v(null)},title:`Revoke ${m?.name??`token`}?`,confirmLabel:`Revoke token`,tone:`danger`,pending:S.isPending?`confirm`:null,error:S.error?.message,onConfirm:()=>m&&S.mutate(m),children:A?(0,F.jsxs)(o,{gap:`xs`,children:[(0,F.jsx)(h,{tone:`danger`,title:`This is the last active token`,children:`Revoking it stops all ingest. Every Collector is rejected until you create a new token.`}),(0,F.jsx)(d,{size:`sm`,children:`The revocation takes effect immediately and cannot be undone.`})]}):`Any Collector using this token is rejected immediately. Other tokens keep working. This cannot be undone.`})]})}function K(){let e=w(),t=E({queryKey:I,queryFn:()=>O(`/api/settings/ingest`)}),[n,l]=(0,P.useState)(null);if(!t.data)return t.isLoading?(0,F.jsx)(c,{state:`loading`,loadingLabel:`Loading connection details`,skeleton:(0,F.jsx)(N,{shape:`settings`})}):(0,F.jsx)(c,{state:`error`,error:{message:`Fanout could not load this workspace's connection details.`,onRetry:()=>void t.refetch()}});let{suggested_endpoint:p,header_name:h,tls_configured:g,token_required:y}=t.data,C=n??p,T=C.trim()||p,D=e.role===`admin`,A=`${h}: Bearer `,j=z(T,h,g);return(0,F.jsxs)(o,{gap:`xl`,children:[(0,F.jsx)(a,{order:2,fz:18,children:`Connect telemetry`}),(0,F.jsx)(d,{c:`dimmed`,size:`sm`,children:`Point an OpenTelemetry collector or SDK at this workspace.`}),(0,F.jsx)(r,{withBorder:!0,radius:`md`,p:`lg`,children:(0,F.jsxs)(o,{gap:`lg`,children:[(0,F.jsxs)(o,{gap:4,children:[(0,F.jsx)(d,{size:`sm`,fw:600,children:`Endpoint`}),(0,F.jsxs)(i,{gap:`xs`,wrap:`nowrap`,align:`center`,children:[(0,F.jsx)(_,{"aria-label":`Endpoint`,value:C,onChange:e=>l(e.currentTarget.value),style:{flex:1},styles:{input:{fontFamily:`var(--mantine-font-family-monospace)`}}}),(0,F.jsx)(v,{value:T,timeout:1500,children:({copied:e,copy:t})=>(0,F.jsx)(k,{label:e?`Copied`:`Copy endpoint`,withArrow:!0,children:(0,F.jsx)(f,{variant:`subtle`,color:`gray`,size:`sm`,onClick:t,"aria-label":`Copy endpoint`,children:e?(0,F.jsx)(u,{size:15,weight:`bold`}):(0,F.jsx)(m,{size:15})})})})]}),(0,F.jsxs)(d,{c:`dimmed`,size:`xs`,children:[R(T,g)?`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,F.jsx)(B,{label:`Authorization`,value:A,hint:`Send one of your workspace's ingest tokens. Fanout stores only a digest of each, so it cannot show you an existing one.`})]})}),(0,F.jsxs)(o,{gap:`sm`,children:[(0,F.jsxs)(s,{children:[(0,F.jsx)(a,{order:2,fz:22,lts:`-0.02em`,children:`Collector configuration`}),(0,F.jsx)(d,{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,F.jsx)(r,{withBorder:!0,radius:`md`,p:`md`,children:(0,F.jsxs)(o,{gap:`sm`,children:[(0,F.jsx)(b,{block:!0,style:{fontSize:12},children:j}),(0,F.jsx)(i,{justify:`flex-end`,children:(0,F.jsx)(v,{value:j,timeout:1500,children:({copied:e,copy:t})=>(0,F.jsx)(f,{variant:`light`,size:`compact-sm`,leftSection:e?(0,F.jsx)(u,{size:15,weight:`bold`}):(0,F.jsx)(m,{size:15}),onClick:t,children:e?`Copied`:`Copy configuration`})})})]})})]}),(0,F.jsxs)(o,{gap:`sm`,children:[(0,F.jsxs)(s,{children:[(0,F.jsx)(a,{order:2,fz:22,lts:`-0.02em`,children:`Ingest tokens`}),(0,F.jsx)(d,{c:`dimmed`,size:`sm`,mt:2,children:y?`Each Collector can have its own token. To rotate one, create a replacement, move the Collector across, then revoke the old token.`:`This workspace has no active token, so it is rejecting telemetry.`})]}),D?(0,F.jsx)(G,{hasToken:y,config:j}):(0,F.jsx)(r,{withBorder:!0,radius:`md`,p:`lg`,children:(0,F.jsx)(d,{size:`sm`,c:`dimmed`,children:`An administrator creates and revokes ingest tokens.`})})]}),(0,F.jsxs)(d,{c:`dimmed`,size:`xs`,children:[(0,F.jsx)(S,{href:x.ingest,target:`_blank`,rel:`noopener noreferrer`,underline:`always`,children:`Sending telemetry`}),` covers SDK setup, the collector, and the OTLP/HTTP endpoint.`]})]})}var q=[`settings`,`oauth`,`connections`];function J(){let e=T(),t=E({queryKey:q,queryFn:()=>O(`/api/auth/oauth/connections`)}),[n,l]=(0,P.useState)(null),[u,m]=(0,P.useState)(``),_=D({onMutate:async()=>{m(``),await e.cancelQueries({queryKey:q})},mutationFn:async e=>{if(!(await y(`/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(q,e=>e&&{connections:e.connections.filter(e=>e.client_id!==n.client_id)}),l(null),m(`${n.client_name} disconnected.`)}});return(0,F.jsxs)(o,{gap:`sm`,children:[(0,F.jsxs)(s,{children:[(0,F.jsx)(a,{order:2,fz:22,lts:`-0.02em`,children:`Connected agents`}),(0,F.jsx)(d,{c:`dimmed`,size:`sm`,mt:2,children:`Agents you have authorized to access Fanout through MCP.`})]}),(0,F.jsx)(r,{withBorder:!0,radius:`md`,p:`lg`,children:t.data?t.data.connections.length===0?(0,F.jsx)(c,{state:`empty`,empty:{title:`No agents connected.`,description:`Authorize an agent to access this workspace.`,action:(0,F.jsx)(S,{href:x.connect,target:`_blank`,rel:`noopener noreferrer`,underline:`always`,children:`Connect an agent over MCP`})}}):(0,F.jsx)(o,{gap:`md`,children:t.data.connections.map(e=>(0,F.jsxs)(i,{justify:`space-between`,align:`center`,children:[(0,F.jsxs)(s,{style:{minWidth:0,overflowWrap:`anywhere`},children:[(0,F.jsx)(d,{size:`sm`,fw:600,children:e.client_name}),(0,F.jsx)(p,{items:[{label:`Connected`,value:(0,F.jsx)(`time`,{style:{fontFamily:`var(--mantine-font-family-monospace)`},dateTime:e.connected_at,children:A(Date.parse(e.connected_at))})}]})]}),(0,F.jsx)(f,{variant:`default`,size:`sm`,onClick:()=>{_.reset(),l(e)},disabled:_.isPending,children:`Disconnect`})]},e.client_id))}):t.isLoading?(0,F.jsx)(c,{state:`loading`,loadingLabel:`Loading connected agents`,skeleton:(0,F.jsx)(N,{shape:`agents`,rows:3})}):(0,F.jsxs)(o,{gap:`sm`,align:`flex-start`,children:[(0,F.jsx)(h,{tone:`danger`,children:`Fanout could not load your connected agents.`}),(0,F.jsx)(f,{size:`compact-sm`,variant:`light`,onClick:()=>void t.refetch(),children:`Try again`})]})}),(0,F.jsx)(d,{size:`sm`,c:`dimmed`,role:`status`,"aria-live":`polite`,children:u}),(0,F.jsxs)(g,{opened:n!==null,onClose:()=>{_.reset(),l(null)},title:`Disconnect ${n?.client_name??`agent`}?`,confirmLabel:`Disconnect agent`,tone:`danger`,pending:_.isPending?`confirm`:null,error:_.isError?`Fanout could not disconnect this agent. Try again.`:void 0,onConfirm:()=>n&&_.mutate(n),children:[(0,F.jsx)(d,{span:!0,ff:`monospace`,children:n?.client_name}),` loses access immediately. Your other agents and browser session stay connected. You can authorize the agent again to reconnect.`]})]})}var Y=`Administrators can still change an email or display name, suspend or reactivate an account, and delete an account.`,X={identity_provider_roles:{tone:`info`,title:`Managed by your identity provider`,reason:`Your identity provider creates accounts at first sign-in and assigns roles, so Fanout refuses both here. ${Y}`},identity_provider_roles_no_provisioning:{tone:`warning`,title:`New people cannot be added`,reason:`Your identity provider assigns roles, so Fanout refuses creating accounts and changing roles here, and this workspace does not create accounts at sign-in. People without an account stay out until automatic provisioning with an allow-list or SCIM is configured. ${Y}`},identity_provider_directory:{tone:`info`,title:`Managed by your identity provider`,reason:`Your identity provider owns accounts through SCIM. Fanout refuses creating or deleting an account and changing its role, status, or email here. Display names can still be edited.`}};function Z(){let{account_ownership:e}=C();return e===`local`?null:(0,F.jsxs)(o,{gap:`sm`,children:[(0,F.jsx)(a,{order:2,fz:22,lts:`-0.02em`,children:`User accounts`}),(0,F.jsxs)(h,{tone:X[e].tone,title:X[e].title,children:[X[e].reason,` `,(0,F.jsx)(S,{href:x.authentication,target:`_blank`,rel:`noopener noreferrer`,underline:`always`,children:`Authentication`}),` covers what stays in Fanout.`]})]})}function Q(){let{agentAvailable:e}=M();return(0,F.jsx)(s,{w:`100%`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,children:(0,F.jsxs)(o,{gap:`xl`,children:[(0,F.jsx)(l,{title:`Settings`,description:`Manage telemetry connections and authorized agents.`}),(0,F.jsx)(K,{}),!e&&(0,F.jsxs)(o,{gap:`sm`,children:[(0,F.jsx)(a,{order:2,fz:22,lts:`-0.02em`,children:`Chat is disabled`}),(0,F.jsx)(r,{withBorder:!0,radius:`md`,p:`lg`,children:(0,F.jsxs)(o,{gap:`sm`,children:[(0,F.jsxs)(d,{size:`sm`,children:[`To enable chat on a self-hosted instance, set `,(0,F.jsx)(b,{children:`FANOUT_AI_PROVIDER`}),` to `,(0,F.jsx)(b,{children:`anthropic`}),` with `,(0,F.jsx)(b,{children:`ANTHROPIC_API_KEY`}),`, or `,(0,F.jsx)(b,{children:`openai`}),` with `,(0,F.jsx)(b,{children:`OPENAI_API_KEY`}),`, then restart Fanout.`]}),(0,F.jsxs)(d,{size:`sm`,children:[`You can also `,(0,F.jsx)(S,{href:x.connect,target:`_blank`,rel:`noopener noreferrer`,underline:`always`,children:`connect an MCP client`}),` such as Claude, Codex, or ChatGPT to use your own AI.`]})]})})]}),(0,F.jsx)(Z,{}),(0,F.jsx)(J,{})]})})}function $(){return(0,F.jsx)(s,{w:`100%`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,children:(0,F.jsxs)(o,{gap:`xl`,children:[(0,F.jsx)(l,{title:`Ingest tokens`,description:`Create and revoke the tokens Collectors use to send telemetry.`}),(0,F.jsx)(K,{})]})})}export{Q as n,$ as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/settings-D9KXz_MJ.js b/internal/ui/dist/assets/settings-D9KXz_MJ.js deleted file mode 100644 index 208199890..000000000 --- a/internal/ui/dist/assets/settings-D9KXz_MJ.js +++ /dev/null @@ -1 +0,0 @@ -import{n as e}from"./settings-CXC__vby.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/settings-_0QC4d6a.js b/internal/ui/dist/assets/settings-_0QC4d6a.js new file mode 100644 index 000000000..ce38b128b --- /dev/null +++ b/internal/ui/dist/assets/settings-_0QC4d6a.js @@ -0,0 +1 @@ +import{n as e}from"./settings-BhplbQY-.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/settings_.ingest-7LDcHtKJ.js b/internal/ui/dist/assets/settings_.ingest-7LDcHtKJ.js new file mode 100644 index 000000000..cd81c253a --- /dev/null +++ b/internal/ui/dist/assets/settings_.ingest-7LDcHtKJ.js @@ -0,0 +1 @@ +import{t as e}from"./settings-BhplbQY-.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/settings_.ingest-BmeDHL8A.js b/internal/ui/dist/assets/settings_.ingest-BmeDHL8A.js deleted file mode 100644 index e49732dae..000000000 --- a/internal/ui/dist/assets/settings_.ingest-BmeDHL8A.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./settings-CXC__vby.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/theme-B_iWg-Ot.js b/internal/ui/dist/assets/theme-DXTVNXHm.js similarity index 99% rename from internal/ui/dist/assets/theme-B_iWg-Ot.js rename to internal/ui/dist/assets/theme-DXTVNXHm.js index 2faa4d66d..8dadb9343 100644 --- a/internal/ui/dist/assets/theme-B_iWg-Ot.js +++ b/internal/ui/dist/assets/theme-DXTVNXHm.js @@ -1 +1 @@ -import{a as e,i as t,r as n,s as r}from"./useRouter-ByJ6_rwb.js";import{B as i,Dt as a,Ft as o,H as s,I as c,Jt as l,Kt as u,L as d,Nt as f,R as p,U as m,V as h,Yt as ee,Zt as g,bn as _,gn as v,h as te,hn as y,nt as ne,pn as re,wt as ie,x as b,z as ae}from"./brand-CCQ0JT0F.js";function oe({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function se(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var x=[],S=0,{link:C,unlink:ce,propagate:le,checkDirty:w,shallowPropagate:T}=oe({update(e){return e._update()},notify(e){x[D++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,A(e))}}),E=0,D=0,O,k=0;function ue(e){try{++k,e()}finally{--k||j()}}function A(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=ce(n,e)}function j(){if(!(k>0)){for(;E{i.get(),n.current?(O=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=O,o=t?.compare??Object.is;if(n)O=i,++S,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{O=a,n&&(i.flags&=-5),A(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&w(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&T(e)}}else e&32&&(i.flags=e&-33);return O!==void 0&&C(i,O,S),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(le(e),T(e),j())}},i}function fe(e){let t=()=>{let t=O;O=n,++S,n.depsTail=void 0,n.flags=6;try{return e()}finally{O=t,n.flags&=-5,A(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&w(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,A(this)}};return t(),n}var pe=e((e=>{var n=t();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useState,o=n.useEffect,s=n.useLayoutEffect,c=n.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=n.useSyncExternalStore===void 0?f:n.useSyncExternalStore})),me=e(((e,t)=>{t.exports=pe()})),he=e((e=>{var n=t(),r=me();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=n.useRef,c=n.useEffect,l=n.useMemo,u=n.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),ge=e(((e,t)=>{t.exports=he()})),M=r(t(),1),_e=ge();function ve(e,t){return e===t}function ye(e,t=e=>e,n){let r=n?.compare??ve,i=(0,M.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,M.useCallback)(()=>e.get(),[e]);return(0,_e.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function be(e){return typeof e!=`string`||!e.includes(`var(--mantine-scale)`)?e:e.match(/^calc\((.*?)\)$/)?.[1].split(`*`)[0].trim()}function N(e){let t=be(e);return typeof t==`number`?t:typeof t==`string`?t.includes(`calc`)||t.includes(`var`)?t:t.includes(`px`)?Number(t.replace(`px`,``)):t.includes(`rem`)?Number(t.replace(`rem`,``))*16:t.includes(`em`)?Number(t.replace(`em`,``))*16:Number(t):NaN}function P(e,t){return e in t?N(t[e]):N(e)}function xe(e,t){let n=e.map(e=>({value:e,px:P(e,t)}));return n.sort((e,t)=>e.px-t.px),n}function F({color:e,theme:t,autoContrast:n,colorScheme:r}){return(typeof n==`boolean`?n:t.autoContrast)&&l({color:e||t.primaryColor,theme:t,colorScheme:r}).isLight?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function I(e,t,n){return F({color:n===`dark`?e.dark:e.light,theme:t,colorScheme:n,autoContrast:!0})}function Se(e,t){let n=e.colors[e.primaryColor];return u(n)?e.autoContrast?I(n,e,t):`var(--mantine-color-white)`:F({color:n[ee(e,t)],theme:e,autoContrast:null})}var[Ce,L]=v(`Drawer component was not found in tree`),R={root:`m_f11b401e`,header:`m_5a7c2c9`,content:`m_b8a05bbd`,inner:`m_31cd769a`},z=n(),B=a(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...c}=o(`DrawerBody`,null,e),l=L();return(0,z.jsx)(s,{...l.getStyles(`body`,{classNames:t,style:r,styles:i,className:n}),...c})});B.classes=R,B.displayName=`@mantine/core/DrawerBody`;var V=a(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=o(`DrawerCloseButton`,null,e),c=L();return(0,z.jsx)(h,{...c.getStyles(`close`,{classNames:t,style:r,styles:i,className:n}),...s})});V.classes=R,V.displayName=`@mantine/core/DrawerCloseButton`;var H=a(e=>{let{classNames:t,className:n,style:r,styles:a,vars:s,children:l,radius:u,__hidden:d,...f}=o(`DrawerContent`,null,e),p=L(),m=p.scrollAreaComponent||c;return(0,z.jsx)(i,{...p.getStyles(`content`,{className:n,style:r,styles:a,classNames:t}),innerProps:p.getStyles(`inner`,{className:n,style:r,styles:a,classNames:t}),...f,radius:u||p.radius||0,"data-hidden":d||void 0,children:(0,z.jsx)(m,{style:{height:`calc(100vh - var(--drawer-offset) * 2)`},children:l})})});H.classes=R,H.displayName=`@mantine/core/DrawerContent`;var U=a(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=o(`DrawerHeader`,null,e),c=L();return(0,z.jsx)(ae,{...c.getStyles(`header`,{classNames:t,style:r,styles:i,className:n}),...s})});U.classes=R,U.displayName=`@mantine/core/DrawerHeader`;var W=a(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=o(`DrawerOverlay`,null,e),c=L();return(0,z.jsx)(p,{...c.getStyles(`overlay`,{classNames:t,style:r,styles:i,className:n}),...s})});W.classes=R,W.displayName=`@mantine/core/DrawerOverlay`;function we(e){switch(e){case`top`:return`flex-start`;case`bottom`:return`flex-end`;default:return}}function Te(e){if(e===`top`||e===`bottom`)return`0 0 calc(100% - var(--drawer-offset, 0rem) * 2)`}var Ee={top:`slide-down`,bottom:`slide-up`,left:`slide-right`,right:`slide-left`},De={top:`slide-down`,bottom:`slide-up`,right:`slide-right`,left:`slide-left`},Oe={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:y(`modal`),position:`left`},G=g((e,{position:t,size:n,offset:r})=>({root:{"--drawer-size":re(n,`drawer-size`),"--drawer-flex":Te(t),"--drawer-height":t===`left`||t===`right`?void 0:`var(--drawer-size)`,"--drawer-align":we(t),"--drawer-justify":t===`right`?`flex-end`:void 0,"--drawer-offset":_(r)}})),K=a(e=>{let t=o(`DrawerRoot`,Oe,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,vars:c,scrollAreaComponent:l,position:u,transitionProps:d,radius:p,attributes:h,...ee}=t,{dir:g}=ie(),_=f({name:`Drawer`,classes:R,props:t,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:h,vars:c,varsResolver:G}),v=(g===`rtl`?De:Ee)[u];return(0,z.jsx)(Ce,{value:{scrollAreaComponent:l,getStyles:_,radius:p},children:(0,z.jsx)(m,{..._(`root`),transitionProps:{transition:v,...d},"data-offset-scrollbars":l===ne.Autosize||void 0,unstyled:s,...ee})})});K.classes=R,K.varsResolver=G,K.displayName=`@mantine/core/DrawerRoot`;var q=(0,M.createContext)(null);function J({children:e}){let[t,n]=(0,M.useState)([]),[r,i]=(0,M.useState)(y(`modal`)),[a]=(0,M.useState)(()=>new WeakSet);return(0,z.jsx)(q,{value:{stack:t,addModal:(e,t)=>{n(t=>[...new Set([...t,e])]),i(e=>typeof t==`number`&&typeof e==`number`?Math.max(e,t):e)},removeModal:e=>n(t=>t.filter(t=>t!==e)),getZIndex:e=>`calc(${r} + ${t.indexOf(e)} + 1)`,currentId:t[t.length-1],maxZIndex:r,handledEscapeEvents:a},children:e})}J.displayName=`@mantine/core/DrawerStack`;var Y=a(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=o(`DrawerTitle`,null,e),c=L();return(0,z.jsx)(d,{...c.getStyles(`title`,{classNames:t,style:r,styles:i,className:n}),...s})});Y.classes=R,Y.displayName=`@mantine/core/DrawerTitle`;var ke={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:y(`modal`),withOverlay:!0,withCloseButton:!0},X=a(e=>{let{title:t,withOverlay:n,overlayProps:r,withCloseButton:i,closeButtonProps:a,children:s,opened:c,stackId:l,zIndex:u,...d}=o(`Drawer`,ke,e),f=(0,M.use)(q),p=!!t||i,m=f&&l?{closeOnEscape:f.currentId===l,trapFocus:f.currentId===l,zIndex:f.getZIndex(l),__handledEscapeEvents:f.handledEscapeEvents}:{},h=n===!1?!1:l&&f?f.currentId===l:c;return(0,M.useEffect)(()=>{f&&l&&(c?f.addModal(l,u||y(`modal`)):f.removeModal(l))},[c,l,u]),(0,z.jsxs)(K,{opened:c,zIndex:f&&l?f.getZIndex(l):u,...d,...m,children:[n&&(0,z.jsx)(W,{visible:h,transitionProps:f&&l?{duration:0}:void 0,...r}),(0,z.jsxs)(H,{__hidden:f&&l&&c?l!==f.currentId:!1,children:[p&&(0,z.jsxs)(U,{children:[t&&(0,z.jsx)(Y,{children:t}),i&&(0,z.jsx)(V,{...a})]}),(0,z.jsx)(B,{children:s})]})]})});X.classes=R,X.displayName=`@mantine/core/Drawer`,X.Root=K,X.Overlay=W,X.Content=H,X.Body=B,X.Header=U,X.Title=Y,X.CloseButton=V,X.Stack=J;var Ae=new Map([[`bold`,M.createElement(M.Fragment,null,M.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`,M.createElement(M.Fragment,null,M.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`}),M.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`,M.createElement(M.Fragment,null,M.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`,M.createElement(M.Fragment,null,M.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`,M.createElement(M.Fragment,null,M.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`,M.createElement(M.Fragment,null,M.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`}))]]),je=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`}))]]),Me=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`}))]]),Z=M.forwardRef((e,t)=>M.createElement(b,{ref:t,...e,weights:Ae}));Z.displayName=`KeyboardIcon`;var Ne=Z,Pe=M.forwardRef((e,t)=>M.createElement(b,{ref:t,...e,weights:je}));Pe.displayName=`PencilSimpleIcon`;var Fe=Pe,Ie=M.forwardRef((e,t)=>M.createElement(b,{ref:t,...e,weights:Me}));Ie.displayName=`TrashIcon`;var Le=Ie,Q=te(),Re=Q.theme,ze=Q.cssVariablesResolver,$=Q.chart,Be={light:$.light.series,dark:$.dark.series};export{de as _,Le as a,X as c,I as d,xe as f,ue as g,ye as h,Be as i,F as l,N as m,ze as n,Fe as o,P as p,Re as r,Ne as s,$ as t,Se as u}; \ No newline at end of file +import{a as e,i as t,r as n,s as r}from"./useRouter-ByJ6_rwb.js";import{B as i,Dt as a,Ft as o,H as s,I as c,Jt as l,Kt as u,L as d,Nt as f,R as p,U as m,V as h,Yt as ee,Zt as g,bn as _,gn as v,h as te,hn as y,nt as ne,pn as re,wt as ie,x as b,z as ae}from"./brand-D6fP-cLS.js";function oe({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function se(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var x=[],S=0,{link:C,unlink:ce,propagate:le,checkDirty:w,shallowPropagate:T}=oe({update(e){return e._update()},notify(e){x[D++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,A(e))}}),E=0,D=0,O,k=0;function ue(e){try{++k,e()}finally{--k||j()}}function A(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=ce(n,e)}function j(){if(!(k>0)){for(;E{i.get(),n.current?(O=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=O,o=t?.compare??Object.is;if(n)O=i,++S,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{O=a,n&&(i.flags&=-5),A(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&w(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&T(e)}}else e&32&&(i.flags=e&-33);return O!==void 0&&C(i,O,S),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(le(e),T(e),j())}},i}function fe(e){let t=()=>{let t=O;O=n,++S,n.depsTail=void 0,n.flags=6;try{return e()}finally{O=t,n.flags&=-5,A(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&w(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,A(this)}};return t(),n}var pe=e((e=>{var n=t();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useState,o=n.useEffect,s=n.useLayoutEffect,c=n.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=n.useSyncExternalStore===void 0?f:n.useSyncExternalStore})),me=e(((e,t)=>{t.exports=pe()})),he=e((e=>{var n=t(),r=me();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=n.useRef,c=n.useEffect,l=n.useMemo,u=n.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),ge=e(((e,t)=>{t.exports=he()})),M=r(t(),1),_e=ge();function ve(e,t){return e===t}function ye(e,t=e=>e,n){let r=n?.compare??ve,i=(0,M.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,M.useCallback)(()=>e.get(),[e]);return(0,_e.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function be(e){return typeof e!=`string`||!e.includes(`var(--mantine-scale)`)?e:e.match(/^calc\((.*?)\)$/)?.[1].split(`*`)[0].trim()}function N(e){let t=be(e);return typeof t==`number`?t:typeof t==`string`?t.includes(`calc`)||t.includes(`var`)?t:t.includes(`px`)?Number(t.replace(`px`,``)):t.includes(`rem`)?Number(t.replace(`rem`,``))*16:t.includes(`em`)?Number(t.replace(`em`,``))*16:Number(t):NaN}function P(e,t){return e in t?N(t[e]):N(e)}function xe(e,t){let n=e.map(e=>({value:e,px:P(e,t)}));return n.sort((e,t)=>e.px-t.px),n}function F({color:e,theme:t,autoContrast:n,colorScheme:r}){return(typeof n==`boolean`?n:t.autoContrast)&&l({color:e||t.primaryColor,theme:t,colorScheme:r}).isLight?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function I(e,t,n){return F({color:n===`dark`?e.dark:e.light,theme:t,colorScheme:n,autoContrast:!0})}function Se(e,t){let n=e.colors[e.primaryColor];return u(n)?e.autoContrast?I(n,e,t):`var(--mantine-color-white)`:F({color:n[ee(e,t)],theme:e,autoContrast:null})}var[Ce,L]=v(`Drawer component was not found in tree`),R={root:`m_f11b401e`,header:`m_5a7c2c9`,content:`m_b8a05bbd`,inner:`m_31cd769a`},z=n(),B=a(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...c}=o(`DrawerBody`,null,e),l=L();return(0,z.jsx)(s,{...l.getStyles(`body`,{classNames:t,style:r,styles:i,className:n}),...c})});B.classes=R,B.displayName=`@mantine/core/DrawerBody`;var V=a(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=o(`DrawerCloseButton`,null,e),c=L();return(0,z.jsx)(h,{...c.getStyles(`close`,{classNames:t,style:r,styles:i,className:n}),...s})});V.classes=R,V.displayName=`@mantine/core/DrawerCloseButton`;var H=a(e=>{let{classNames:t,className:n,style:r,styles:a,vars:s,children:l,radius:u,__hidden:d,...f}=o(`DrawerContent`,null,e),p=L(),m=p.scrollAreaComponent||c;return(0,z.jsx)(i,{...p.getStyles(`content`,{className:n,style:r,styles:a,classNames:t}),innerProps:p.getStyles(`inner`,{className:n,style:r,styles:a,classNames:t}),...f,radius:u||p.radius||0,"data-hidden":d||void 0,children:(0,z.jsx)(m,{style:{height:`calc(100vh - var(--drawer-offset) * 2)`},children:l})})});H.classes=R,H.displayName=`@mantine/core/DrawerContent`;var U=a(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=o(`DrawerHeader`,null,e),c=L();return(0,z.jsx)(ae,{...c.getStyles(`header`,{classNames:t,style:r,styles:i,className:n}),...s})});U.classes=R,U.displayName=`@mantine/core/DrawerHeader`;var W=a(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=o(`DrawerOverlay`,null,e),c=L();return(0,z.jsx)(p,{...c.getStyles(`overlay`,{classNames:t,style:r,styles:i,className:n}),...s})});W.classes=R,W.displayName=`@mantine/core/DrawerOverlay`;function we(e){switch(e){case`top`:return`flex-start`;case`bottom`:return`flex-end`;default:return}}function Te(e){if(e===`top`||e===`bottom`)return`0 0 calc(100% - var(--drawer-offset, 0rem) * 2)`}var Ee={top:`slide-down`,bottom:`slide-up`,left:`slide-right`,right:`slide-left`},De={top:`slide-down`,bottom:`slide-up`,right:`slide-right`,left:`slide-left`},Oe={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:y(`modal`),position:`left`},G=g((e,{position:t,size:n,offset:r})=>({root:{"--drawer-size":re(n,`drawer-size`),"--drawer-flex":Te(t),"--drawer-height":t===`left`||t===`right`?void 0:`var(--drawer-size)`,"--drawer-align":we(t),"--drawer-justify":t===`right`?`flex-end`:void 0,"--drawer-offset":_(r)}})),K=a(e=>{let t=o(`DrawerRoot`,Oe,e),{classNames:n,className:r,style:i,styles:a,unstyled:s,vars:c,scrollAreaComponent:l,position:u,transitionProps:d,radius:p,attributes:h,...ee}=t,{dir:g}=ie(),_=f({name:`Drawer`,classes:R,props:t,className:r,style:i,classNames:n,styles:a,unstyled:s,attributes:h,vars:c,varsResolver:G}),v=(g===`rtl`?De:Ee)[u];return(0,z.jsx)(Ce,{value:{scrollAreaComponent:l,getStyles:_,radius:p},children:(0,z.jsx)(m,{..._(`root`),transitionProps:{transition:v,...d},"data-offset-scrollbars":l===ne.Autosize||void 0,unstyled:s,...ee})})});K.classes=R,K.varsResolver=G,K.displayName=`@mantine/core/DrawerRoot`;var q=(0,M.createContext)(null);function J({children:e}){let[t,n]=(0,M.useState)([]),[r,i]=(0,M.useState)(y(`modal`)),[a]=(0,M.useState)(()=>new WeakSet);return(0,z.jsx)(q,{value:{stack:t,addModal:(e,t)=>{n(t=>[...new Set([...t,e])]),i(e=>typeof t==`number`&&typeof e==`number`?Math.max(e,t):e)},removeModal:e=>n(t=>t.filter(t=>t!==e)),getZIndex:e=>`calc(${r} + ${t.indexOf(e)} + 1)`,currentId:t[t.length-1],maxZIndex:r,handledEscapeEvents:a},children:e})}J.displayName=`@mantine/core/DrawerStack`;var Y=a(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=o(`DrawerTitle`,null,e),c=L();return(0,z.jsx)(d,{...c.getStyles(`title`,{classNames:t,style:r,styles:i,className:n}),...s})});Y.classes=R,Y.displayName=`@mantine/core/DrawerTitle`;var ke={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:y(`modal`),withOverlay:!0,withCloseButton:!0},X=a(e=>{let{title:t,withOverlay:n,overlayProps:r,withCloseButton:i,closeButtonProps:a,children:s,opened:c,stackId:l,zIndex:u,...d}=o(`Drawer`,ke,e),f=(0,M.use)(q),p=!!t||i,m=f&&l?{closeOnEscape:f.currentId===l,trapFocus:f.currentId===l,zIndex:f.getZIndex(l),__handledEscapeEvents:f.handledEscapeEvents}:{},h=n===!1?!1:l&&f?f.currentId===l:c;return(0,M.useEffect)(()=>{f&&l&&(c?f.addModal(l,u||y(`modal`)):f.removeModal(l))},[c,l,u]),(0,z.jsxs)(K,{opened:c,zIndex:f&&l?f.getZIndex(l):u,...d,...m,children:[n&&(0,z.jsx)(W,{visible:h,transitionProps:f&&l?{duration:0}:void 0,...r}),(0,z.jsxs)(H,{__hidden:f&&l&&c?l!==f.currentId:!1,children:[p&&(0,z.jsxs)(U,{children:[t&&(0,z.jsx)(Y,{children:t}),i&&(0,z.jsx)(V,{...a})]}),(0,z.jsx)(B,{children:s})]})]})});X.classes=R,X.displayName=`@mantine/core/Drawer`,X.Root=K,X.Overlay=W,X.Content=H,X.Body=B,X.Header=U,X.Title=Y,X.CloseButton=V,X.Stack=J;var Ae=new Map([[`bold`,M.createElement(M.Fragment,null,M.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`,M.createElement(M.Fragment,null,M.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`}),M.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`,M.createElement(M.Fragment,null,M.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`,M.createElement(M.Fragment,null,M.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`,M.createElement(M.Fragment,null,M.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`,M.createElement(M.Fragment,null,M.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`}))]]),je=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`}))]]),Me=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`}))]]),Z=M.forwardRef((e,t)=>M.createElement(b,{ref:t,...e,weights:Ae}));Z.displayName=`KeyboardIcon`;var Ne=Z,Pe=M.forwardRef((e,t)=>M.createElement(b,{ref:t,...e,weights:je}));Pe.displayName=`PencilSimpleIcon`;var Fe=Pe,Ie=M.forwardRef((e,t)=>M.createElement(b,{ref:t,...e,weights:Me}));Ie.displayName=`TrashIcon`;var Le=Ie,Q=te(),Re=Q.theme,ze=Q.cssVariablesResolver,$=Q.chart,Be={light:$.light.series,dark:$.dark.series};export{de as _,Le as a,X as c,I as d,xe as f,ue as g,ye as h,Be as i,F as l,N as m,ze as n,Fe as o,P as p,Re as r,Ne as s,$ as t,Se as u}; \ No newline at end of file diff --git a/internal/ui/dist/assets/toolbar-DV2TSB0G.js b/internal/ui/dist/assets/toolbar-DV46cPGs.js similarity index 99% rename from internal/ui/dist/assets/toolbar-DV2TSB0G.js rename to internal/ui/dist/assets/toolbar-DV46cPGs.js index 67fea8d71..41d3050c7 100644 --- a/internal/ui/dist/assets/toolbar-DV2TSB0G.js +++ b/internal/ui/dist/assets/toolbar-DV46cPGs.js @@ -1,4 +1,4 @@ -import{i as e,o as t,r as n,s as r}from"./useRouter-ByJ6_rwb.js";import{$ as i,$t as a,A as o,At as s,Cn as c,D as l,Dt as u,Ft as d,G as f,Ht as p,J as m,K as h,Lt as g,Mt as _,N as v,Nt as y,Ot as b,Pt as x,Sn as S,St as C,T as w,Tt as T,Zt as E,_ as D,a as O,b as k,bn as A,c as j,cn as ee,d as M,dn as N,en as P,et as te,f as F,gn as ne,i as re,in as ie,j as I,k as ae,l as oe,ln as se,mn as ce,nn as le,pn as ue,q as de,qt as fe,r as pe,s as me,tt as he,un as ge,v as _e,vn as ve,w as ye,wt as be,x as xe}from"./brand-CCQ0JT0F.js";import{_ as Se,a as Ce,c as we,f as Te,g as Ee,h as De,i as Oe,l as ke,m as Ae,o as je,s as Me,t as Ne}from"./theme-B_iWg-Ot.js";import{A as Pe,N as Fe,a as Ie,k as Le,o as Re,t as ze,u as Be,w as Ve}from"./search-DBgztReF.js";import{t as He}from"./CopyButton-Btk7J2NS.js";import{n as Ue,t as We}from"./Table-Bid0E8qM.js";import{a as Ge,i as Ke,n as qe,r as Je,t as Ye}from"./format-fsvZ_y78.js";import{c as Xe,i as Ze,l as Qe,n as $e,o as et,r as tt,s as nt,u as rt}from"./live-data-meta-CbLSAtC3.js";import{c as it,l as at}from"./auth-K3NK-QpB.js";import{t as ot}from"./useQuery-BLTYSIvG.js";import{n as st,r as ct,t as lt}from"./lib-8mi5olAL.js";import{c as ut,ct as dt,d as ft,f as pt,h as mt,l as ht,m as gt,o as _t,p as vt,s as yt,u as bt,ut as xt}from"./index-C5SsAUtw.js";import{t as St}from"./loading-skeleton-DEzWruJF.js";function Ct(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=wt(e);if(n.length!==wt(t).length)return!1;for(let r=0;r{if(typeof n!=`string`||n.trim().length===0)throw Error(t);return`${e}-${n}`}}function Et(e){return typeof e==`object`&&e?`base`in e?e.base:void 0:e}function Dt(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(e+1)%1e6;function kt(){let[,e]=(0,L.useReducer)(Ot,0);return e}function At(e,t){if(!e||!t)return!1;if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{r.current||=window.setTimeout(()=>{i(...e),r.current=null},t)},[t]),o=(0,L.useCallback)(()=>{r.current&&=(window.clearTimeout(r.current),null)},[]);return(0,L.useEffect)(()=>(n.autoInvoke&&a(),o),[o,a]),{start:a,clear:o}}function Pt(e){let t=(0,L.useRef)(void 0);return(0,L.useEffect)(()=>{t.current=e},[e]),t.current}function Ft(e,t,n){let r=(0,L.useRef)(null);(0,L.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 It(){let[e,t]=(0,L.useState)(!1);return(0,L.useEffect)(()=>t(!0),[]),e}function Lt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`}function Rt(e,t){return typeof e==`boolean`?e:t.autoContrast}function zt(e,t){if(!t||!e)return!1;let n=t.parentNode;for(;n!=null;){if(n===e)return!0;n=n.parentNode}return!1}function Bt({target:e,parent:t,ref:n,displayAfterTransitionEnd:r,onTransitionStart:i,onTransitionEnd:a}){let o=(0,L.useRef)(-1),s=(0,L.useRef)(e),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(typeof r==`boolean`&&r),f=()=>{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=C(s.borderTopWidth)+C(c.borderTopWidth),u=C(s.borderLeftWidth)+C(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,L.useRef)(null),h=(0,L.useRef)(null);return(0,L.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,L.useEffect)(()=>{if(t){let e=e=>{zt(e.target,t)&&(p(),d(!1))};return t.addEventListener(`transitionend`,e),()=>{t.removeEventListener(`transitionend`,e)}}},[t]),(0,L.useEffect)(()=>{if(n.current&&a){let e=e=>{e.propertyName===`transform`&&a()};return n.current.addEventListener(`transitionend`,e),()=>{n.current?.removeEventListener(`transitionend`,e)}}},[a]),Nt(()=>{Ue()!==`test`&&l(!0)},20,{autoInvoke:!0}),Ft(e=>{e.forEach(e=>{e.type===`attributes`&&e.attributeName===`dir`&&p()})},{attributes:!0,attributeFilter:[`dir`]},()=>document.documentElement),{initialized:c,hidden:u}}var Vt={root:`m_96b553a6`},Ht=E((e,{transitionDuration:t},{shouldReduceMotion:n})=>({root:{"--transition-duration":e.respectReducedMotion&&n?`0ms`:typeof t==`number`?`${t}ms`:t||`150ms`}})),Ut=u(e=>{let t=d(`FloatingIndicator`,null,e),{classNames:n,className:r,style:i,styles:o,unstyled:s,vars:c,target:l,parent:u,transitionDuration:f,mod:p,displayAfterTransitionEnd:m,onTransitionStart:h,onTransitionEnd:g,attributes:_,ref:v,...b}=t,x=a(),S=y({name:`FloatingIndicator`,classes:Vt,props:t,className:r,style:i,classNames:n,styles:o,unstyled:s,attributes:_,vars:c,varsResolver:Ht,stylesCtx:{shouldReduceMotion:x}}),C=(0,L.useRef)(null),{initialized:w,hidden:E}=Bt({target:l,parent:u,ref:C,displayAfterTransitionEnd:m,onTransitionStart:h,onTransitionEnd:g}),D=le(v,C);return!l||!u?null:(0,R.jsx)(T,{ref:D,mod:[{initialized:w,hidden:E},p],...S(`root`),...b})});Ut.displayName=`@mantine/core/FloatingIndicator`,Ut.classes=Vt,Ut.varsResolver=Ht;function Wt(e){let t=e.currentTarget;return rt(t).activeElement!==t}function Gt(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}var[Kt,qt]=ne(`Progress.Root component was not found in tree`),Jt={root:`m_db6d6462`,section:`m_2242eb65`,"stripes-animation":`m_81a374bd`,"stripes-animation-vertical":`m_e0fb7a86`,label:`m_91e40b74`},Yt=u(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=d(`ProgressLabel`,null,e),s=qt();return(0,R.jsx)(T,{...s.getStyles(`label`,{className:n,style:r,classNames:t,styles:i}),...o})});Yt.classes=Jt,Yt.displayName=`@mantine/core/ProgressLabel`;var Xt=E((e,{size:t,radius:n,transitionDuration:r})=>({root:{"--progress-size":ue(t,`progress-size`),"--progress-radius":n===void 0?void 0:N(n),"--progress-transition-duration":typeof r==`number`?`${r}ms`:void 0}})),Zt=u(e=>{let t=d(`ProgressRoot`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,autoContrast:c,transitionDuration:l,orientation:u,attributes:f,mod:p,...m}=t,h=y({name:`Progress`,classes:Jt,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:f,vars:s,varsResolver:Xt});return(0,R.jsx)(Kt,{value:{getStyles:h,autoContrast:c},children:(0,R.jsx)(T,{mod:[{orientation:u},p],...h(`root`),...m})})});Zt.classes=Jt,Zt.varsResolver=Xt,Zt.displayName=`@mantine/core/ProgressRoot`;var Qt={withAria:!0},$t=u(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,value:o,withAria:s,color:c,striped:l,animated:u,mod:f,...p}=d(`ProgressSection`,Qt,e),m=qt(),h=g(),_=s?{role:`progressbar`,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":o,"aria-valuetext":`${o}%`}:{};return(0,R.jsx)(T,{...m.getStyles(`section`,{className:n,classNames:t,styles:i,style:r}),...p,..._,mod:[{striped:l||u,animated:u},f],__vars:{"--progress-section-size":`${o}%`,"--progress-section-color":fe(c,h),"--progress-label-color":Rt(m.autoContrast,h)?ke({color:c,theme:h,autoContrast:m.autoContrast}):void 0}})});$t.classes=Jt,$t.displayName=`@mantine/core/ProgressSection`;var en=u(e=>{let t=d(`Progress`,null,e),{value:n,classNames:r,styles:i,vars:a,color:o,striped:s,animated:c,"aria-label":l,...u}=t,{resolvedClassNames:f,resolvedStyles:p}=x({classNames:r,styles:i,props:t});return(0,R.jsx)(Zt,{classNames:f,styles:p,vars:a,...u,children:(0,R.jsx)($t,{value:n,color:o,striped:s,animated:c,"aria-label":l})})});en.classes=Jt,en.displayName=`@mantine/core/Progress`,en.Section=$t,en.Root=Zt,en.Label=Yt;var tn={root:`m_cf365364`,indicator:`m_9e182ccd`,label:`m_1738fcb2`,input:`m_1714d588`,control:`m_69686b9b`,innerLabel:`m_78882f40`},nn={withItemsBorders:!0},rn=E((e,{radius:t,color:n,transitionDuration:r,size:i,transitionTimingFunction:a})=>({root:{"--sc-radius":t===void 0?void 0:N(t),"--sc-color":n?fe(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":ue(i,`sc-padding`),"--sc-font-size":ge(i)}})),an=b(e=>{let t=d(`SegmentedControl`,nn,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,data:c,value:l,defaultValue:u,onChange:f,size:p,name:m,disabled:h,readOnly:_,fullWidth:v,orientation:b,radius:x,color:S,transitionDuration:C,transitionTimingFunction:w,variant:E,autoContrast:D,withItemsBorders:O,mod:k,attributes:A,ref:j,...ee}=t,M=y({name:`SegmentedControl`,props:t,classes:tn,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:A,vars:s,varsResolver:rn}),N=g(),te=c.map(e=>Lt(e)?{label:`${e}`,value:e}:e),F=It(),[ne,re]=(0,L.useState)(0),[I,ae]=(0,L.useState)(null),[oe,se]=(0,L.useState)({}),ce=(e,t)=>{e!==null&&oe[t]!==e&&(oe[t]=e,se({...oe}))},[ue,de]=P({value:l,defaultValue:u,finalValue:Array.isArray(c)?te.find(e=>!e.disabled)?.value??c[0]?.value??null:null,onChange:f}),fe=ie(m),pe=te.map(e=>`${e.value}`),me=te.map(e=>(0,L.createElement)(T,{...M(`control`),mod:{active:ue===e.value,orientation:b},key:`${e.value}`},(0,L.createElement)(`input`,{...M(`input`),disabled:h||e.disabled,type:`radio`,name:fe,value:`${e.value}`,id:`${fe}-${e.value}`,checked:ue===e.value,onChange:()=>!_&&de(e.value),"data-focus-ring":N.focusRing,key:`${e.value}-input`}),(0,L.createElement)(T,{component:`label`,...M(`label`),mod:{active:ue===e.value&&!(h||e.disabled),disabled:h||e.disabled,"read-only":_},htmlFor:`${fe}-${e.value}`,ref:t=>ce(t,`${e.value}`),__vars:{"--sc-label-color":S===void 0?void 0:ke({color:S,theme:N,autoContrast:D})},key:`${e.value}-label`},(0,R.jsx)(`span`,{...M(`innerLabel`),children:e.label})))),he=le(j,ae);return Mt(()=>{re(e=>e+1)},[c.length]),Mt(()=>{se(e=>{let t={};return pe.forEach(n=>{n in e&&(t[n]=e[n])}),Object.keys(t).length===Object.keys(e).length?e:t})},[pe]),c.length===0?null:(0,R.jsxs)(T,{...M(`root`),variant:E,size:p,ref:he,mod:[{"full-width":v,orientation:b,initialized:F,"with-items-borders":O},k],...ee,role:`radiogroup`,"data-disabled":h,children:[ue!==void 0&&(0,R.jsx)(Ut,{target:oe[`${ue}`],parent:I,component:`span`,transitionDuration:`var(--sc-transition-duration)`,...M(`indicator`)},ne),me]})});an.classes=tn,an.varsResolver=rn,an.displayName=`@mantine/core/SegmentedControl`;var on={size:`sm`,withCheckIcon:!0,allowDeselect:!0,checkIconPosition:`left`,openOnFocus:!0},sn=b(e=>{let t=d([`Input`,`InputWrapper`,`Select`],on,e),{classNames:n,styles:r,unstyled:i,vars:a,dropdownOpened:o,defaultDropdownOpened:s,onDropdownClose:c,onDropdownOpen:l,onFocus:u,onBlur:f,onClick:p,onChange:m,data:h,value:g,defaultValue:_,selectFirstOptionOnChange:y,selectFirstOptionOnDropdownOpen:b,onOptionSubmit:S,comboboxProps:C,readOnly:w,disabled:T,filter:E,limit:D,withScrollArea:O,maxDropdownHeight:k,floatingHeight:A,size:j,searchable:ee,rightSection:M,checkIconPosition:N,withCheckIcon:te,withAlignedLabels:F,nothingFoundMessage:ne,name:re,form:I,searchValue:ae,defaultSearchValue:oe,onSearchChange:se,allowDeselect:ce,error:le,rightSectionPointerEvents:ue,id:de,clearable:fe,clearSectionMode:pe,clearButtonProps:me,hiddenInputProps:he,renderOption:ge,onClear:_e,autoComplete:ve,scrollAreaProps:ye,__defaultRightSection:be,__clearSection:xe,__clearable:Se,chevronColor:Ce,autoSelectOnBlur:we,openOnFocus:Te,attributes:Ee,...De}=t,Oe=(0,L.useMemo)(()=>Qe(h),[h]),ke=(0,L.useRef)({}),Ae=(0,L.useMemo)(()=>Xe(Oe),[Oe]),je=ie(de),Me=tt({id:je,label:De.label,labelProps:De.labelProps,inputWrapperOrder:De.inputWrapperOrder}),[Ne,Pe,Fe]=P({value:g,defaultValue:_,finalValue:null,onChange:m}),Ie=Ne==null?void 0:`${Ne}`in Ae?Ae[`${Ne}`]:ke.current[`${Ne}`],Le=Pt(Ie),[Re,ze,Be]=P({value:ae,defaultValue:oe,finalValue:Ie?Ie.label:``,onChange:se}),Ve=nt({opened:o,defaultOpened:s,onDropdownOpen:()=>{l?.(),b?Ve.selectFirstOption():Ve.updateSelectedOptionIndex(`active`,{scrollIntoView:!0})},onDropdownClose:()=>{c?.(),setTimeout(Ve.resetSelectedOption,0)}}),He=e=>{ze(e),Ve.resetSelectedOption()},{resolvedClassNames:Ue,resolvedStyles:We}=x({props:t,styles:r,classNames:n});(0,L.useEffect)(()=>{y&&Ve.selectFirstOption()},[y,Re]),(0,L.useEffect)(()=>{g===null&&He(``),g!=null&&Ie&&(Le?.value!==Ie.value||Le?.label!==Ie.label)&&He(Ie.label)},[g,Ie]),(0,L.useEffect)(()=>{!Fe&&!Be&&He(Ne==null?``:`${Ne}`in Ae?Ae[`${Ne}`]?.label:ke.current[`${Ne}`]?.label||``)},[Ae,Ne]),(0,L.useEffect)(()=>{Ne&&`${Ne}`in Ae&&(ke.current[`${Ne}`]=Ae[`${Ne}`])},[Ae,Ne]);let Ge=(0,R.jsx)(et.ClearButton,{...me,onClear:()=>{Pe(null,null),He(``),_e?.()}}),Ke=fe&&Ne!=null&&!T&&!w;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(et,{store:Ve,__staticSelector:`Select`,classNames:Ue,styles:We,unstyled:i,readOnly:w,size:j,attributes:Ee,floatingHeight:A,keepMounted:we,onOptionSubmit:e=>{S?.(e);let t=ce&&`${Ae[e].value}`==`${Ne}`?null:Ae[e],n=t?t.value:null;n!==Ne&&Pe(n,t),!Fe&&He(n==null?``:t?.label||``),Ve.closeDropdown()},...C,children:[(0,R.jsx)(et.Target,{targetType:ee?`input`:`button`,autoComplete:ve,withExpandedAttribute:!0,children:(0,R.jsx)(v,{id:je,__defaultRightSection:(0,R.jsx)(et.Chevron,{size:j,error:le,unstyled:i,color:Ce}),__clearSection:Ge,__clearable:Ke,__clearSectionMode:pe,rightSection:M,rightSectionPointerEvents:ue||`none`,...De,size:j,__staticSelector:`Select`,disabled:T,readOnly:w||!ee,value:Re,onChange:e=>{if(Wt(e)){if(!w){let t=Gt(Ae,e.currentTarget.value);t&&`${t.value}`!=`${Ne}`&&(Pe(t.value,t),!Fe&&He(t.label))}return}He(e.currentTarget.value),Ve.openDropdown(),y&&Ve.selectFirstOption()},onFocus:e=>{Te&&ee&&Ve.openDropdown(),u?.(e)},onBlur:e=>{we&&Ve.clickSelectedOption(),Ve.closeDropdown();let t=Ne!=null&&(`${Ne}`in Ae?Ae[`${Ne}`]:ke.current[`${Ne}`]);He(t&&t.label||``),f?.(e)},onClick:e=>{ee?Ve.openDropdown():Ve.toggleDropdown(),p?.(e)},classNames:Ue,styles:We,unstyled:i,pointer:!ee,error:le,attributes:Ee})}),(0,R.jsx)(Ze,{data:Oe,hidden:w||T,filter:E,search:Re,limit:D,hiddenWhenEmpty:!ne,withScrollArea:O,maxDropdownHeight:k,filterOptions:!!ee&&Ie?.label!==Re,value:Ne,checkIconPosition:N,withCheckIcon:te,withAlignedLabels:F,nothingFoundMessage:ne,unstyled:i,labelId:Me,"aria-label":Me?void 0:De[`aria-label`],renderOption:ge,scrollAreaProps:ye})]}),(0,R.jsx)(et.HiddenInput,{value:Ne,name:re,form:I,disabled:T,...he})]})});sn.classes={...v.classes,...et.classes},sn.displayName=`@mantine/core/Select`;function cn(e){if(e!==void 0)return typeof e==`number`?A(e):e}function ln({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=g(),s=t===void 0?e:t,c=r!==void 0,l=ve({"--sg-spacing-x":ce(Et(e)),"--sg-spacing-y":ce(Et(s)),"--sg-auto-rows":i,...c?{"--sg-min-col-width":cn(r)}:{"--sg-cols":Et(n)?.toString()}}),u=S(o.breakpoints).reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=ce(e[r])),typeof s==`object`&&s[r]!==void 0&&(t[r][`--sg-spacing-y`]=ce(s[r])),!c&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{}),d=Te(S(u),o.breakpoints).filter(e=>S(u[e.value]).length>0).map(e=>({query:`(min-width: ${o.breakpoints[e.value]})`,styles:u[e.value]}));return(0,R.jsx)(_,{styles:l,media:d,selector:a})}function un(e){return typeof e==`object`&&e?S(e):[]}function dn(e){return e.sort((e,t)=>Ae(e)-Ae(t))}function fn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}){return dn(Array.from(new Set([...un(e),...un(t),...r===void 0?un(n):[]])))}function pn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=t===void 0?e:t,s=r!==void 0,c=ve({"--sg-spacing-x":ce(Et(e)),"--sg-spacing-y":ce(Et(o)),"--sg-auto-rows":i,...s?{"--sg-min-col-width":cn(r)}:{"--sg-cols":Et(n)?.toString()}}),l=fn({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`]=ce(e[r])),typeof o==`object`&&o[r]!==void 0&&(t[r][`--sg-spacing-y`]=ce(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,R.jsx)(_,{styles:c,container:d,selector:a})}var mn={container:`m_925c2d2c`,root:`m_2415a157`},hn={cols:1,spacing:`md`,type:`media`},gn=u(e=>{let t=d(`SimpleGrid`,hn,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:c,cols:l,verticalSpacing:u,spacing:f,type:p,minColWidth:m,autoFlow:h,autoRows:g,attributes:_,...v}=t,b=y({name:`SimpleGrid`,classes:mn,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:_,vars:c}),x=s(),S=m===void 0?void 0:h||`auto-fill`;return p===`container`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(pn,{...t,selector:`.${x}`}),(0,R.jsx)(`div`,{...b(`container`),children:(0,R.jsx)(T,{...b(`root`,{className:x}),...v,"data-auto-cols":S})})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ln,{...t,selector:`.${x}`}),(0,R.jsx)(T,{...b(`root`,{className:x}),...v,"data-auto-cols":S})]})});gn.classes=mn,gn.displayName=`@mantine/core/SimpleGrid`;var[_n,vn]=ne(`Tabs component was not found in the tree`),yn={root:`m_89d60db1`,"list--default":`m_576c9d4`,list:`m_89d33d6d`,tab:`m_4ec4dce6`,panel:`m_b0c91715`,tabSection:`m_fc420b1f`,tabLabel:`m_42bbd1ae`,"tab--default":`m_539e827b`,"list--outline":`m_6772fbd5`,"tab--outline":`m_b59ab47c`,"tab--pills":`m_c3381914`},bn=u(e=>{let t=d(`TabsList`,null,e),{children:n,className:r,grow:i,justify:a,classNames:o,styles:s,style:c,mod:l,...u}=t,f=vn();return(0,R.jsx)(T,{...f.getStyles(`list`,{className:r,style:c,classNames:o,styles:s,props:t,variant:f.variant}),role:`tablist`,variant:f.variant,mod:[{grow:i,orientation:f.orientation,placement:f.orientation===`vertical`&&f.placement,inverted:f.inverted},l],"aria-orientation":f.orientation,__vars:{"--tabs-justify":a},...u,children:n})});bn.classes=yn,bn.displayName=`@mantine/core/TabsList`;var xn=u(e=>{let t=d(`TabsPanel`,null,e),{children:n,className:r,value:i,classNames:a,styles:o,style:s,mod:c,keepMounted:l,...u}=t,f=p(),m=vn();(0,L.useEffect)(()=>(m.setMountedPanel(i,!0),()=>{m.setMountedPanel(i,!1)}),[i]);let h=m.value===i,g=m.keepMounted||l,_=m.keepMountedMode!==`display-none`,v=g&&_&&f!==`test`?(0,R.jsx)(L.Activity,{mode:h?`visible`:`hidden`,children:n}):g||h?n:null;return(0,R.jsx)(T,{...m.getStyles(`panel`,{className:r,classNames:a,styles:o,style:[s,h?void 0:{display:`none`}],props:t}),mod:[{orientation:m.orientation},c],role:`tabpanel`,id:m.getPanelId(i),"aria-labelledby":m.getTabId(i),...u,children:v})});xn.classes=yn,xn.displayName=`@mantine/core/TabsPanel`;var Sn=u(e=>{let t=d(`TabsTab`,null,e),{className:n,children:r,rightSection:i,leftSection:a,value:o,onClick:s,onKeyDown:c,disabled:l,color:u,style:f,classNames:p,styles:m,vars:h,mod:_,tabIndex:v,...y}=t,b=g(),{dir:x}=be(),S=vn(),C=o===S.value,w=e=>{S.onChange(S.allowTabDeactivation&&o===S.value?null:o),s?.(e)},T={classNames:p,styles:m,props:t};return(0,R.jsxs)(he,{...S.getStyles(`tab`,{className:n,style:f,variant:S.variant,...T}),disabled:l,unstyled:S.unstyled,variant:S.variant,mod:[{active:C,disabled:l,orientation:S.orientation,inverted:S.inverted,placement:S.orientation===`vertical`&&S.placement},_],role:`tab`,id:S.getTabId(o),"aria-selected":C,tabIndex:v===void 0?C||S.value===null?0:-1:v,"aria-controls":S.mountedPanels.current.has(o)?S.getPanelId(o):void 0,onClick:w,__vars:{"--tabs-color":u?fe(u,b):void 0},onKeyDown:Fe({siblingSelector:`[role="tab"]`,parentSelector:`[role="tablist"]`,activateOnFocus:S.activateTabWithKeyboard,loop:S.loop,orientation:S.orientation||`horizontal`,dir:x,onKeyDown:c}),...y,children:[a&&(0,R.jsx)(`span`,{...S.getStyles(`tabSection`,T),"data-position":`left`,children:a}),r&&(0,R.jsx)(`span`,{...S.getStyles(`tabLabel`,T),children:r}),i&&(0,R.jsx)(`span`,{...S.getStyles(`tabSection`,T),"data-position":`right`,children:i})]})});Sn.classes=yn,Sn.displayName=`@mantine/core/TabsTab`;var Cn=`Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value`,wn={keepMounted:!0,keepMountedMode:`activity`,orientation:`horizontal`,loop:!0,activateTabWithKeyboard:!0,variant:`default`,placement:`left`},Tn=E((e,{radius:t,color:n,autoContrast:r})=>({root:{"--tabs-radius":N(t),"--tabs-color":fe(n,e),"--tabs-text-color":Rt(r,e)?ke({color:n,theme:e,autoContrast:r}):void 0}})),En=u(e=>{let t=d(`Tabs`,wn,e),{defaultValue:n,value:r,onChange:i,orientation:a,children:o,loop:s,id:c,activateTabWithKeyboard:l,allowTabDeactivation:u,variant:f,color:p,radius:m,inverted:h,placement:g,keepMounted:_,keepMountedMode:v,classNames:b,styles:x,unstyled:S,className:C,style:w,vars:E,autoContrast:D,mod:O,attributes:k,...A}=t,j=ie(c),ee=(0,L.useRef)(new Set),M=kt(),N=(0,L.useCallback)((e,t)=>{let n=ee.current;t&&!n.has(e)?(n.add(e),M()):!t&&n.has(e)&&(n.delete(e),M())},[]),[te,F]=P({value:r,defaultValue:n,finalValue:null,onChange:i}),ne=y({name:`Tabs`,props:t,classes:yn,className:C,style:w,classNames:b,styles:x,unstyled:S,attributes:k,vars:E,varsResolver:Tn});return(0,R.jsx)(_n,{value:{placement:g,value:te,orientation:a,id:j,loop:s,activateTabWithKeyboard:l,getTabId:Tt(`${j}-tab`,Cn),getPanelId:Tt(`${j}-panel`,Cn),onChange:F,allowTabDeactivation:u,variant:f,color:p,radius:m,inverted:h,keepMounted:_,keepMountedMode:v,unstyled:S,getStyles:ne,mountedPanels:ee,setMountedPanel:N},children:(0,R.jsx)(T,{id:j,variant:f,mod:[{orientation:a,inverted:a===`horizontal`&&h,placement:a===`vertical`&&g},O],...ne(`root`),...A,children:o})})});En.classes=yn,En.varsResolver=Tn,En.displayName=`@mantine/core/Tabs`,En.Tab=Sn,En.Panel=xn,En.List=bn;var Dn=new Map([[`bold`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M208,160H48l80-80Z`,opacity:`0.2`}),L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`}))]]),On=L.forwardRef((e,t)=>L.createElement(xe,{ref:t,...e,weights:Dn}));On.displayName=`CaretUpIcon`;var kn=On,An=new Map([[`bold`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`}))]]),jn=new Map([[`bold`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M208,48V208H48V48Z`,opacity:`0.2`}),L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`}))]]),Mn=new Map([[`bold`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`}),L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`}))]]),Nn=new Map([[`bold`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`}))]]),Pn=new Map([[`bold`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`}))]]),Fn=new Map([[`bold`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M216,64V192H88V64Z`,opacity:`0.2`}),L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`}))]]),In=new Map([[`bold`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`}))]]),Ln=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M180,128a12,12,0,0,1-12,12H88a12,12,0,0,1,0-24h80A12,12,0,0,1,180,128Zm56,0A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M176,128a8,8,0,0,1-8,8H88a8,8,0,0,1,0-16h80A8,8,0,0,1,176,128Zm56,0A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm40,112H88a8,8,0,0,1,0-16h80a8,8,0,0,1,0,16Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M174,128a6,6,0,0,1-6,6H88a6,6,0,0,1,0-12h80A6,6,0,0,1,174,128Zm56,0A102,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`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M176,128a8,8,0,0,1-8,8H88a8,8,0,0,1,0-16h80A8,8,0,0,1,176,128Zm56,0A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M172,128a4,4,0,0,1-4,4H88a4,4,0,0,1,0-8h80A4,4,0,0,1,172,128Zm56,0A100,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`}))]]),Rn=L.forwardRef((e,t)=>L.createElement(xe,{ref:t,...e,weights:An}));Rn.displayName=`ArrowClockwiseIcon`;var zn=Rn,Bn=L.forwardRef((e,t)=>L.createElement(xe,{ref:t,...e,weights:jn}));Bn.displayName=`ArrowsOutIcon`;var Vn=Bn,Hn=L.forwardRef((e,t)=>L.createElement(xe,{ref:t,...e,weights:Mn}));Hn.displayName=`ChatCircleTextIcon`;var Un=Hn,Wn=L.forwardRef((e,t)=>L.createElement(xe,{ref:t,...e,weights:Nn}));Wn.displayName=`ClockIcon`;var Gn=Wn,Kn=L.forwardRef((e,t)=>L.createElement(xe,{ref:t,...e,weights:Pn}));Kn.displayName=`ClockCounterClockwiseIcon`;var qn=Kn,Jn=L.forwardRef((e,t)=>L.createElement(xe,{ref:t,...e,weights:Fn}));Jn.displayName=`ListBulletsIcon`;var Yn=Jn,Xn=L.forwardRef((e,t)=>L.createElement(xe,{ref:t,...e,weights:In}));Xn.displayName=`MagnifyingGlassMinusIcon`;var Zn=Xn,Qn=L.forwardRef((e,t)=>L.createElement(xe,{ref:t,...e,weights:Ln}));Qn.displayName=`MinusCircleIcon`;var $n=Qn,er=[`#F1F0FF`,`#E4E2FF`,`#CDC9FF`,`#B5B0FF`,`#A29CFF`,`#8F8CFF`,`#756DEB`,`#5A50D8`,`#463DAE`,`#332B81`],tr={dark:{ground:`#0B0B0C`,raised:`#121214`,inset:`#08080A`,hover:`#1A1A1D`,border:`#232327`,borderSoft:`#1A1A1E`,controlBorder:`#828288`,text:`#EDEDEF`,muted:`#A1A1A9`},light:{ground:`#F5F5F6`,raised:`#FFFFFF`,inset:`#EFEFF1`,hover:`#EDEDEF`,border:`#E3E3E6`,borderSoft:`#ECECEE`,controlBorder:`#6D6D73`,text:`#111113`,muted:`#53535B`}},nr=[`#eefbe6`,`#dcf7cc`,`#c2f0a6`,`#a5e880`,`#8fe06c`,`#7fd962`,`#66c04b`,`#4f9c3a`,`#3b7a2c`,`#2a5a1f`],rr=[`#fff5e6`,`#ffe9c9`,`#ffd79b`,`#ffc571`,`#ffbc62`,`#ffb454`,`#ef9c33`,`#c87d21`,`#9c5f16`,`#74460f`],ir=[`#fdecee`,`#fbd9dc`,`#f8b6bc`,`#f59099`,`#f37d87`,`#f26d78`,`#e04d5a`,`#c03642`,`#96262f`,`#6f1a21`],ar=[`#e8f6ff`,`#ccebff`,`#a3daff`,`#7dcbff`,`#66c5ff`,`#59c2ff`,`#33a7e6`,`#1e86bd`,`#146694`,`#0d4a6d`],or={micro:11,small:12,body:14,title:16,section:20,page:28},sr={display:`"Geist Mono Variable", "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,body:`"Geist Variable", "Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`};function cr(e){return e===`healthy`?`ok`:e===`degraded`?`warn`:e===`unknown`?`gray`:`bad`}function lr(e){return Ne[e?`dark`:`light`]}function ur(e){let t=e?5:7;return{ok:nr[t],warn:rr[t],bad:ir[t],info:ar[t]}}function dr(e,t){return Oe[t?`dark`:`light`][e]??lr(t).muted}function fr(e){return e===`unhealthy`?`diamond`:e===`degraded`?`roundRect`:`circle`}function pr(e){return e===`unknown`?`dashed`:`solid`}function mr(e){let t=e.map(e=>{let t=e.start.match(/\.(\d+)(?=Z|[+-]\d{2}:\d{2}$)/),n=t?e.start.replace(t[0],``):e.start,r=Date.parse(n);if(Number.isFinite(r))return BigInt(r)*1000000n+BigInt((t?.[1]??``).slice(0,9).padEnd(9,`0`))}),n=t.filter(e=>e!==void 0),r=n.reduce((e,t)=>t[e,Number((t[n]??r)-r)/1e6]))}function hr(e){let t=mr(e),n=e.map(e=>{let n=t.get(e);return{span:e,start:n,end:n+Math.max(0,e.duration_ms),children:[]}}),r=new Map(n.map((e,t)=>[e.span.span_id,t])),i;for(let e=0;en[i].end-n[i].start)&&(i=e)}if(i===void 0)return[];for(let e of n)e.children.sort((t,r)=>Math.min(n[r].end,e.end)-Math.min(n[t].end,e.end)||n[r].start-n[t].start||t-r);let a=(e,t,n)=>({id:e,start:t,end:n,cursor:n,next:0}),o=[a(i,n[i].start,n[i].end)],s=[],c=(e,t,r)=>{r>t&&s.push({span_id:n[e].span.span_id,start:t,end:r})};for(;o.length;){let e=o[o.length-1],t=n[e.id].children[e.next++];if(t===void 0||e.cursor<=e.start){c(e.id,e.start,e.cursor),o.pop();continue}let r=n[t],i=Math.min(r.end,e.end);if(i>e.cursor)continue;let s=Math.max(r.start,e.start);i<=s||(c(e.id,i,e.cursor),e.cursor=s,o.push(a(t,s,i)))}return s}function gr(e,t){let n=new Set(e.map(e=>e.span_id)),r=(e,n)=>t.get(e)-t.get(n),i=new Map,a=[];for(let t of e){let e=t.parent_span_id;if(e&&e!==t.span_id&&n.has(e)){let n=i.get(e);n?n.push(t):i.set(e,[t])}else a.push(t)}let o=[],s=new Set,c=a.sort(r).reverse().map(e=>({span:e,depth:0})),l=()=>{for(;c.length;){let e=c.pop();if(!s.has(e.span)){s.add(e.span),o.push(e);for(let t of[...i.get(e.span.span_id)??[]].sort(r).reverse())c.push({span:t,depth:e.depth+1})}}};l();for(let t of e)s.has(t)||(c.push({span:t,depth:0}),l());return o}function _r({spans:e,dark:t,onSpan:n,selected:r,showCriticalPath:i=!0}){let a=(0,L.useMemo)(()=>{let t=new Map;for(let n of hr(e)){let e=t.get(n.span_id);e?e.push(n):t.set(n.span_id,[n])}return t},[e]),o=(0,L.useMemo)(()=>{let n=mr(e),r=e.reduce((e,t)=>Math.max(e,n.get(t)+t.duration_ms),1),i=[...new Set(e.map(e=>e.service))];return gr(e,n).map(({span:e,depth:a})=>{let o=n.get(e)/r*100,s=dr(i.indexOf(e.service),t);return{span:e,depth:a,offset:o,total:r,width:Math.min(Math.max(e.duration_ms/r*100,.6),100-o),color:s,failed:e.status===`STATUS_CODE_ERROR`}})},[e,t]);return(0,R.jsx)(T,{"data-waterfall":!0,style:{maxHeight:520,overflow:`auto`},children:(0,R.jsxs)(We,{highlightOnHover:!!n,verticalSpacing:6,layout:`fixed`,stickyHeader:!0,children:[(0,R.jsxs)(`colgroup`,{children:[(0,R.jsx)(`col`,{style:{width:`42%`}}),(0,R.jsx)(`col`,{}),(0,R.jsx)(`col`,{style:{width:76}})]}),(0,R.jsx)(We.Thead,{children:(0,R.jsxs)(We.Tr,{children:[(0,R.jsx)(We.Th,{children:`Operation`}),(0,R.jsx)(We.Th,{children:`Timeline`}),(0,R.jsx)(We.Th,{ta:`right`,children:`Duration`})]})}),(0,R.jsx)(We.Tbody,{children:o.map(({span:e,depth:t,offset:o,total:s,width:c,color:l,failed:u})=>{let d=i?a.get(e.span_id)??[]:[],f=d.reduce((e,t)=>e+t.end-t.start,0),p=d.length?` · on critical path · ${Ye(f)} (${(f/e.duration_ms*100).toFixed(1)}% of span)`:``,m=`${e.service} · ${e.operation} · ${Ye(e.duration_ms)}${p}`;return(0,R.jsxs)(We.Tr,{"data-depth":t,"data-selected":e.span_id===r||void 0,"aria-selected":n?e.span_id===r:void 0,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,R.jsx)(We.Td,{title:m,children:(0,R.jsxs)(T,{style:{display:`flex`,alignItems:`center`,gap:6,paddingLeft:Math.min(t,16)*10,minWidth:0},children:[(0,R.jsx)(T,{w:8,h:8,bg:l,style:{borderRadius:`50%`,flex:`0 0 auto`}}),(0,R.jsxs)(T,{miw:0,children:[(0,R.jsxs)(I,{fw:600,size:`sm`,truncate:!0,children:[u&&(0,R.jsx)(D,{size:14,"aria-label":`Error`,color:`var(--mantine-color-bad-text)`}),e.operation]}),(0,R.jsx)(I,{c:`dimmed`,size:`xs`,truncate:!0,children:e.service})]})]})}),(0,R.jsx)(We.Td,{children:(0,R.jsxs)(T,{pos:`relative`,h:14,bg:`var(--mantine-color-default-hover)`,role:`img`,title:m,"aria-label":`${e.operation} on ${e.service} took ${Ye(e.duration_ms)}${p}`,style:{borderRadius:`var(--mantine-radius-sm)`},children:[(0,R.jsx)(T,{pos:`absolute`,left:`${o}%`,w:`${c}%`,h:`100%`,bg:u?`bad`:l,style:{borderRadius:`var(--mantine-radius-sm)`,minWidth:3}}),d.map((t,n)=>(0,R.jsx)(T,{"data-critical-path-segment":e.span_id,"aria-hidden":`true`,pos:`absolute`,left:`${t.start/s*100}%`,w:`${(t.end-t.start)/s*100}%`,top:`50%`,bg:`var(--mantine-color-text)`,style:{height:3,transform:`translateY(-50%)`,pointerEvents:`none`,boxShadow:`0 0 0 1px var(--mantine-color-body)`}},n))]})}),(0,R.jsx)(We.Td,{ta:`right`,children:(0,R.jsx)(I,{size:`sm`,ff:`monospace`,children:Ye(e.duration_ms)})})]},e.span_id)})})]})})}var vr={STATUS_CODE_ERROR:`Error`,STATUS_CODE_OK:`OK`,STATUS_CODE_UNSET:`Unset`},yr=e=>e==null?void 0:typeof e==`string`?e:JSON.stringify(e);function br({label:e,values:t}){let n=Object.keys(t).sort();return(0,R.jsxs)(T,{children:[(0,R.jsx)(I,{size:`xs`,fw:600,c:`dimmed`,mb:4,children:e}),n.length===0?(0,R.jsx)(I,{size:`xs`,c:`dimmed`,children:`None`}):(0,R.jsx)(oe,{label:e,items:n.map(e=>({label:(0,R.jsx)(I,{span:!0,inherit:!0,ff:`monospace`,children:e}),value:(0,R.jsx)(I,{span:!0,inherit:!0,ff:`monospace`,style:{whiteSpace:`pre-wrap`},children:typeof t[e]==`string`?String(t[e]):JSON.stringify(t[e])})}))})]})}function xr({traceId:e,span:t,load:n,onClose:r}){let a=(0,L.useRef)(null);(0,L.useEffect)(()=>{a.current?.scrollIntoView?.({block:`nearest`})},[t]);let o=ot({queryKey:[`span-extras`,e,t.span_id,t.start],queryFn:({signal:r})=>n(e,t,r),enabled:!!n,retry:!1,staleTime:1/0}),s=M(`danger`),c=t.status===`STATUS_CODE_ERROR`,l=o.data?.events.filter(e=>e.name===`exception`)??[];return(0,R.jsx)(i,{ref:a,withBorder:!0,p:`sm`,radius:`md`,"data-span-details":!0,"aria-label":`Span ${t.operation}`,role:`region`,children:(0,R.jsxs)(w,{gap:`sm`,children:[(0,R.jsxs)(f,{justify:`space-between`,wrap:`nowrap`,align:`flex-start`,children:[(0,R.jsxs)(T,{miw:0,children:[(0,R.jsx)(I,{fw:600,style:{overflowWrap:`anywhere`},children:t.operation}),(0,R.jsxs)(I,{size:`xs`,c:`dimmed`,children:[t.service,` · `,t.kind.replace(/^SPAN_KIND_/,``).toLowerCase(),` · `,Ye(t.duration_ms),` · `,(0,R.jsx)(I,{span:!0,ff:`monospace`,size:`xs`,children:ft(Date.parse(t.start))})]})]}),(0,R.jsx)(h,{"aria-label":`Close span details`,onClick:r})]}),(0,R.jsx)(T,{children:(0,R.jsx)(oe,{label:`Span metadata`,items:[{label:`Status`,value:(0,R.jsx)(F,{tone:c?`danger`:`neutral`,children:vr[t.status]??t.status})},{label:`Span`,value:(0,R.jsx)(I,{span:!0,inherit:!0,ff:`monospace`,children:t.span_id})},...t.parent_span_id?[{label:`Parent`,value:(0,R.jsx)(I,{span:!0,inherit:!0,ff:`monospace`,children:t.parent_span_id})}]:[]]})}),t.status_message&&(0,R.jsx)(I,{size:`sm`,c:c?s:void 0,style:{overflowWrap:`anywhere`},children:t.status_message}),o.isLoading&&(0,R.jsx)(O,{state:`loading`,loadingLabel:`Loading span details`,skeleton:(0,R.jsx)(St,{shape:`key_value`,rows:3})}),o.error&&(0,R.jsx)(T,{p:`xs`,children:(0,R.jsx)(O,{state:`error`,error:{message:o.error.message,onRetry:()=>void o.refetch()}})}),l.map((e,t)=>{let n=yr(e.attributes[`exception.message`]),r=yr(e.attributes[`exception.stacktrace`]);return(0,R.jsx)(T,{p:`xs`,children:(0,R.jsxs)(me,{tone:`danger`,title:yr(e.attributes[`exception.type`])??`Exception`,children:[n&&(0,R.jsx)(I,{size:`sm`,style:{overflowWrap:`anywhere`},children:n}),r&&(0,R.jsx)(it,{block:!0,mt:4,fz:12,style:{maxHeight:220,overflow:`auto`},children:r})]})},t)}),o.data&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(br,{label:`Attributes`,values:o.data.attributes}),o.data.events.length>0&&(0,R.jsxs)(T,{children:[(0,R.jsx)(I,{size:`xs`,fw:600,c:`dimmed`,mb:4,children:`Events`}),(0,R.jsx)(w,{gap:4,children:o.data.events.map((e,t)=>(0,R.jsxs)(T,{children:[(0,R.jsxs)(I,{size:`xs`,children:[(0,R.jsxs)(I,{span:!0,ff:`monospace`,c:`dimmed`,children:[`+`,Ye(e.offset_ns/1e6)]}),` `,e.name]}),e.name!==`exception`&&Object.keys(e.attributes).length>0&&(0,R.jsx)(T,{pl:`md`,children:(0,R.jsx)(br,{label:`Event attributes`,values:e.attributes})})]},t))})]}),(0,R.jsx)(br,{label:`Resource`,values:o.data.resource}),o.data.scope&&(0,R.jsx)(T,{children:(0,R.jsx)(oe,{items:[{label:`Instrumentation scope`,value:(0,R.jsx)(I,{span:!0,inherit:!0,ff:`monospace`,children:o.data.scope})}]})})]})]})})}function Sr({value:e,children:t}){return(0,R.jsxs)(f,{gap:4,wrap:`nowrap`,children:[(0,R.jsx)(T,{miw:0,flex:1,children:t}),(0,R.jsx)(He,{value:e,children:({copied:t,copy:n})=>(0,R.jsx)(de,{size:`xs`,variant:`subtle`,color:`gray`,"aria-label":t?`Trace ID copied`:`Copy trace ID`,title:e,onClick:e=>{e.stopPropagation(),n()},children:t?(0,R.jsx)(re,{size:12}):(0,R.jsx)(pe,{size:12})})})]})}function Cr(e){return e!==`OK`&&/^[A-Za-z]+$/.test(e)?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():e}function wr(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 Tr(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 Er(e,t){let n=t.frame??{columns:[],values:[],rows:0};return{columns:n.columns.map(e=>e.name),rows:wr(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 Dr(e){return Or(e)||typeof e==`function`||kr(e)}function Or(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function kr(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function Ar(e,t){return e==null?null:Dr(e)?L.createElement(e,t):e}function jr(e){if(`cell`in e&&e.cell){let t=e.cell,n=t.column.columnDef,r=t,i=n;return r.getIsAggregated?.()?Ar(i.aggregatedCell??n.cell,t.getContext()):r.getIsPlaceholder?.()?null:Ar(n.cell,t.getContext())}return`header`in e&&e.header?Ar(e.header.column.columnDef.header,e.header.getContext()):`footer`in e&&e.footer?Ar(e.footer.column.columnDef.footer,e.footer.getContext()):null}function Mr(e){let t=De(e.source,e.selector,{compare:Ct});return typeof e.children==`function`?e.children(t):e.children}function Nr(e){let t=e;return Object.defineProperty(e,"state",{get(){return e.get()}}),`set`in e&&(t.setState=e.set.bind(e)),t}function Pr(e){let{createAtom:t,batch:n}=e,r=t(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:()=>{throw Error(`Feature not supported in current reactivity implementation`)},unmount:()=>{throw Error(`Feature not supported in current reactivity implementation`)},schedule:e.schedule??(e=>queueMicrotask(e)),batch:n,untrack:e=>e(),createReadonlyAtom:(e,n)=>{let i=n?.compare??Object.is,a=!1,o,s=()=>{let t=e();return(!a||!i(o,t))&&(o=t,a=!0),o},c=t(()=>(r.get(),s()),{compare:i});return{get:s,subscribe:c.subscribe.bind(c)}},createWritableAtom:(e,n)=>t(e,{compare:n?.compare}),commit:()=>{r.set(e=>e+1)}}}function Fr(e,t=Object.is){let n=!1,r;return{get:e.get,markCommitted:e=>{r=e,n=!0},subscribe:i=>e.subscribe(e=>{(!n||!t(r,e))&&i(e)})}}function Ir(){return Pr({createAtom:Se,batch:Ee})}function Lr(e,t){return typeof e==`function`?e(t):e}function Rr(e){if(Array.isArray(e))return e.map(Rr);if(e&&typeof e==`object`){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e;let n=t===null?Br():{},r=Object.keys(e);for(let t=0;t{(t.options.atoms?.[e]??t.baseAtoms[e]).set(e=>Lr(n,e))}}function Ur(e){if(typeof e!=`object`||!e)return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Wr(e){return Reflect.ownKeys(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}var Gr=3;function Kr(e,t){return qr(e,t,Gr)}function qr(e,t,n){if(Object.is(e,t))return!0;if(n<=0||!Ur(e)||!Ur(t)||(Array.isArray(e)||Array.isArray(t))&&(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length))return!1;let r=Wr(e),i=Wr(t);if(r.length!==i.length)return!1;let a=e,o=t;for(let e=0;e{let t=Lr(n,e);return r(e,t)?e:t})}function Yr(e){return e instanceof Function}function Xr(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i.length&&r(i)})};return r(e),n}var Zr=({fn:e,memoDeps:t,onAfterCompare:n,onAfterUpdate:r,onBeforeCompare:i,onBeforeUpdate:a})=>{let o=[],s;return c=>{i?.();let l=t?.(c),u=!l||l.length!==o?.length;if(!u&&l){for(let e=0;e{if(!t){t=!0;return}e()}}function $r({feature:e,fnName:t,objectId:n,onAfterUpdate:r,table:i,...a}){let o={onAfterUpdate:r?()=>{let{schedule:e,untrack:t}=i._reactivity;e(()=>t(()=>r()))}:void 0};return Zr({...a,...o})}function ei(e,t=`_`){let[n,r]=e.replace(t,` `).split(` `);return{fnKey:r,fnName:`${n}.${r}`,parentName:n}}function ti(e,t,n){for(let[r,{fn:i,memoDeps:a}]of Object.entries(n)){let{fnKey:n,fnName:o}=ei(r);t[n]=a?$r({memoDeps:a,fn:i,fnName:o,table:t,feature:e}):i}}function ni(e,t,n,r){for(let[i,{fn:a,memoDeps:o}]of Object.entries(r)){let{fnKey:r,fnName:s}=ei(i);if(o){let i=`_memo_${r}`;t[r]=function(...t){if(!this[i]){let t=this;this[i]=$r({memoDeps:e=>o(t,e),fn:(...e)=>a(t,...e),fnName:s,objectId:t.id,table:n,feature:e})}return this[i](...t)}}else t[r]=function(...e){return a(this,...e)}}}function ri(e){return e.row.getValue(e.column.id)}function ii(e){return e.getValue()??e.table.options.renderFallbackValue}function ai(e){return{table:e.table,column:e.column,row:e.row,cell:e,getValue:()=>e.getValue(),renderValue:()=>e.renderValue()}}var oi={assignCellPrototype:(e,t)=>{ni(`coreCellsFeature`,e,t,{cell_getValue:{fn:e=>ri(e)},cell_renderValue:{fn:e=>ii(e)},cell_getContext:{fn:e=>ai(e),memoDeps:e=>[e]}})}};function si(e){if(!e._columnPrototype){e._columnPrototype={table:e};let t=Object.values(e._features);for(let n=0;n{let n=t;for(let t=0;te[i.accessorKey]}if(!s)throw Error();let l=si(e),u=Object.create(l);u.accessorFn=c,u.columnDef=i,u.columns=[],u.depth=n,u.id=`${String(s)}`,u.parent=r;let d=e._columnInstanceInitFns;for(let e=0;ee.getFlatColumns())]}function yi(e){if(e.columns.length){let t=e.columns.flatMap(e=>e.getLeafColumns());return di(e.table,t)}return[e]}function bi(e){return{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>e.renderValue()?.toString?.()??null,...Object.values(e._features).reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef?.()),{}),...e.options.defaultColumn}}function xi(e,t,n,r=0){let i=Array(t.length);for(let a=0;ae.getFlatColumns())}function wi(e){let t=Br(),n=e.getAllFlatColumns();for(let e=0;ee.getLeafColumns()))}function Ei(e){let t=Br(),n=e.getAllLeafColumns();for(let e=0;e{ni(`coreColumnsFeature`,e,t,{column_getFlatColumns:{fn:e=>vi(e),memoDeps:e=>[e.table.options.columns]},column_getLeafColumns:{fn:e=>yi(e),memoDeps:e=>[e.table.atoms.columnOrder?.get(),e.table.atoms.grouping?.get(),e.table.options.columns,e.table.options.groupedColumnMode]}})},constructTableAPIs:e=>{ti(`coreColumnsFeature`,e,{table_getDefaultColumnDef:{fn:()=>bi(e),memoDeps:()=>[e.options.defaultColumn]},table_getAllColumns:{fn:()=>Si(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumns:{fn:()=>Ci(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumnsById:{fn:()=>wi(e),memoDeps:()=>[e.options.columns]},table_getAllLeafColumns:{fn:()=>Ti(e),memoDeps:()=>[e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getAllLeafColumnsById:{fn:()=>Ei(e),memoDeps:()=>[e.getAllLeafColumns()]},table_getColumn:{fn:t=>Di(e,t)}})}};function ki(e){if(!e._headerPrototype){e._headerPrototype={table:e};let t=Object.values(e._features);for(let n=0;n0&&Fi(s,t-1,n,r,i,a)}function Ii(e){for(let t=0;te.id),e)}function Hi(e){return[...e.getHeaderGroups()].reverse()}function Ui(e){let t=e.getHeaderGroups(),n=[];for(let e=0;e{ni(`coreHeadersFeature`,e,t,{header_getLeafHeaders:{fn:e=>zi(e),memoDeps:e=>[e.column.table.options.columns]},header_getContext:{fn:e=>Bi(e),memoDeps:e=>[e.column.table.options.columns]}})},constructTableAPIs:e=>{ti(`coreHeadersFeature`,e,{table_getHeaderGroups:{fn:()=>Vi(e),memoDeps:()=>[e.options.columns,e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.options.groupedColumnMode]},table_getFooterGroups:{fn:()=>Hi(e),memoDeps:()=>[e.getHeaderGroups()]},table_getFlatHeaders:{fn:()=>Ui(e),memoDeps:()=>[e.getHeaderGroups()]},table_getLeafHeaders:{fn:()=>Wi(e),memoDeps:()=>[e.getHeaderGroups()]}})}};function Ki(e){if(!e._rowPrototype){e._rowPrototype={table:e};let t=Object.values(e._features);for(let n=0;n{let s=Ki(e),c=Object.create(s);c._displayIndexCache=-1,c._uniqueValuesCache=Br(),c._valuesCache=Br(),c.depth=i,c.id=t,c.index=r,c.original=n,c.parentId=o,c.subRows=a??[];let l=e._rowInstanceInitFns;for(let e=0;e$r({feature:`coreRowModelsFeature`,table:e,fnName:`table.getCoreRowModel`,memoDeps:()=>[e.options.data],fn:()=>Xi(e,e.options.data),onAfterUpdate:Qr(()=>{mi(e),hi(e),gi(e),_i(e)})})}function Yi(e,t,n,r=0,i){let a=[];for(let o=0;o{ti(`coreRowModelsFeature`,e,{table_getCoreRowModel:{fn:()=>Zi(e)},table_getPreFilteredRowModel:{fn:()=>Qi(e)},table_getFilteredRowModel:{fn:()=>$i(e)},table_getPreGroupedRowModel:{fn:()=>ea(e)},table_getGroupedRowModel:{fn:()=>ta(e)},table_getPreSortedRowModel:{fn:()=>na(e)},table_getSortedRowModel:{fn:()=>ra(e)},table_getPreExpandedRowModel:{fn:()=>ia(e)},table_getExpandedRowModel:{fn:()=>aa(e)},table_getPrePaginatedRowModel:{fn:()=>oa(e)},table_getPaginatedRowModel:{fn:()=>sa(e)},table_getRowModel:{fn:()=>ca(e)}})}};function ua(e){if(!e._cellPrototype){e._cellPrototype={table:e};let t=Object.values(e._features);for(let n=0;ne.subRows)}function va(e){let t=e.getCoreRowModel().flatRows,n=0;for(let e=0;e{ni(`coreRowsFeature`,e,t,{row_getDisplayIndex:{fn:e=>fa(e)},row_getAllCellsByColumnId:{fn:e=>Sa(e),memoDeps:e=>[e.getAllCells()]},row_getAllCells:{fn:e=>xa(e),memoDeps:e=>[e.table.getAllLeafColumns()]},row_getLeafRows:{fn:e=>_a(e),memoDeps:e=>[e.subRows]},row_getParentRow:{fn:e=>ya(e)},row_getParentRows:{fn:e=>ba(e)},row_getUniqueValues:{fn:(e,t)=>ha(e,t)},row_getValue:{fn:(e,t)=>ma(e,t)},row_renderValue:{fn:(e,t)=>ga(e,t)}})},constructTableAPIs:e=>{ti(`coreRowsFeature`,e,{table_getRowsInDisplayOrder:{fn:()=>pa(e),memoDeps:()=>[e.getPrePaginatedRowModel().rows,e.options.paginateExpandedRows,e.options.paginateExpandedRows===!1?e.atoms.expanded?.get():void 0]},table_getRowId:{fn:(t,n,r)=>Ca(t,e,n,r)},table_getRow:{fn:(t,n)=>wa(e,t,n)},table_getMaxSubRowDepth:{fn:()=>va(e),memoDeps:()=>[e.getCoreRowModel()]}})}};function Ea(e,t,n=(e,t)=>e===t){let r=t===void 0?e.options.state:t;e._reactivity.batch(()=>{if(r)for(let t in r){let i=e.baseAtoms[t];if(!i)continue;let a=r[t],o=a===void 0?e.initialState[t]:a;n(e._reactivity.untrack(()=>i.get()),o)||i.set(()=>o)}})}function Da(e,t,n=(e,t)=>e===t){e._reactivity.batch(()=>{Ea(e,t,n),e._reactivity.commit?.()})}function Oa(e){let t=Rr(e.initialState);e._reactivity.batch(()=>{let n=Object.keys(t);for(let r=0;rr):e.options=r,n?.syncExternalState!==!1&&Da(e,r.state??null)}var ja={coreCellsFeature:oi,coreColumnsFeature:Oi,coreHeadersFeature:Gi,coreRowModelsFeature:la,coreRowsFeature:Ta,coreTablesFeature:{constructTableAPIs:e=>{ti(`coreTablesFeature`,e,{table_reset:{fn:()=>Oa(e)},table_setOptions:{fn:t=>Aa(e,t)}})}}};function Ma(e){return e}function Na(e,t={}){return Object.values(e).forEach(e=>{t=e.getInitialState?.(t)??t}),Rr(t)}function Pa(e){let t=e.features.coreReactivityFeature,{aggregationFns:n,columnMeta:r,coreRowModel:i,expandedRowModel:a,facetedMinMaxValues:o,facetedRowModel:s,facetedUniqueValues:c,filterFns:l,filterMeta:u,filteredRowModel:d,groupedRowModel:f,paginatedRowModel:p,sortFns:m,sortedRowModel:h,tableMeta:g,..._}=e.features,v={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...ja,..._},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:t,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:l,sortFns:m},_rowModels:{},atoms:{},baseAtoms:{}},y=Object.values(v._features),b={...y.reduce((e,t)=>Object.assign(e,t.getDefaultTableOptions?.(v)),{}),...e};if(t.wrapExternalAtoms&&b.atoms)for(let[e,n]of Object.entries(b.atoms)){let r=n,i=t.createWritableAtom(r.get(),{debugName:`externalAtom/${e}`});b.atoms[e]=i;let a=!1,o=r.subscribe(e=>{a||i.set(e)}),s=i.subscribe(e=>{a=!0,r.set(e),a=!1});t.addSubscription(o),t.addSubscription(s)}t.createOptionsStore?(v.optionsStore=t.createWritableAtom(b,{debugName:`table/optionsStore`}),Object.defineProperty(v,"options",{configurable:!0,enumerable:!0,get(){return v.optionsStore.get()},set(e){v.optionsStore.set(()=>e)}})):v.options=b,v.initialState=Na(v._features,v.options.initialState);let x=Object.keys(v.initialState);for(let e=0;e{let e=v.options,t=e.atoms?.[n],r=t?t.get():v.baseAtoms[n].get();if(t)return r;let i=e.state;if(i&&Vr(i,n)){let e=i[n];return e===void 0?v.initialState[n]:e}return r},{debugName:`table/atoms/${n}`})}Ea(v),v.store=Nr(t.createReadonlyAtom(()=>{let e={};for(let t=0;t{let i=e.getValue(r),a=n.getValue(r),o=t.resolveDataValue;return o&&(i=o(i),a=o(a)),t.sort(i,a,e,n,r)},e);return t}var La=Ia({resolveDataValue:e=>Ba(e).toLowerCase(),sort:(e,t)=>Va(e,t)}),Ra=Ia({sort:(e,t)=>za(e,t)});function za(e,t){return e===t?0:e>t?1:-1}function Ba(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function Va(e,t){let n=0,r=0,i=e.length,a=t.length;for(;n=48&&e<=57}function Ua(e,t,n){let r=t+1;for(;ro)return 1;if(o>a)return-1}return o>s?1:s>o?-1:0}function Ga(e,t,n,r,i,a){let o=t;for(;oi?1:i>t?-1:0}let u=parseInt(e.slice(t,n),10),d=parseInt(r.slice(i,a),10);return u>d?1:d>u?-1:0}function Ka(e,t,n){let r=0;for(let i=t;i1)){r=`alphanumeric`;break}}if(!r&&i&&(r=`text`),r){let e=t?.[r];if(e||r===`alphanumeric`&&(e=t?.text),e)return e}return Ra}function $a(e){let t=e.table.getFilteredRowModel().flatRows.slice(0,10);for(let n=0;n{let o=a.findIndex(t=>t.id===e.id),s=o===-1?void 0:a[o],c=[],l,u=i?t:r===`desc`,d=!!(a.length&&ao(e)&&n);return l=d?s?`toggle`:`add`:s?`toggle`:`replace`,l===`toggle`&&(i||r||(l=`remove`)),l===`add`?(c=[...a,{id:e.id,desc:u}],c.splice(0,c.length-(e.table.options.maxMultiSortColCount??2**53-1))):c=l===`toggle`?d?a.map(t=>t.id===e.id?{...t,desc:u}:t):[{id:e.id,desc:u}]:l===`remove`?d?a.filter(t=>t.id!==e.id):[]:[{id:e.id,desc:u}],c})}function no(e){return e.columnDef.sortDescFirst??e.table.options.sortDescFirst??$a(e)===`desc`?`desc`:`asc`}function ro(e,t){let n=no(e),r=oo(e);return r?r!==n&&(e.table.options.enableSortingRemoval??!0)&&(!t||(e.table.options.enableMultiRemove??!0))?!1:r===`desc`?`asc`:`desc`:n}function io(e){return(e.columnDef.enableSorting??!0)&&(e.table.options.enableSorting??!0)&&!!e.accessorFn}function ao(e){return e.columnDef.enableMultiSort??e.table.options.enableMultiSort??!!e.accessorFn}function oo(e){let t=e.table.atoms.sorting?.get()?.find(t=>t.id===e.id);return t?t.desc?`desc`:`asc`:!1}function so(e){return e.table.atoms.sorting?.get()?.findIndex(t=>t.id===e.id)??-1}function co(e){Ya(e.table,t=>t.length?t.filter(t=>t.id!==e.id):[])}function lo(e){let t=io(e);return n=>{t&&to(e,void 0,ao(e)?e.table.options.isMultiSortEvent?.(n):!1)}}var uo={getInitialState(e){return{sorting:Ja(),...e}},getDefaultColumnDef(){return{sortFn:`auto`,sortUndefined:1}},getDefaultTableOptions(e){return{autoResetSorting:!1,onSortingChange:Hr(`sorting`,e),isMultiSortEvent:e=>e.shiftKey}},assignColumnPrototype(e,t){ni(`rowSortingFeature`,e,t,{column_getAutoSortFn:{fn:e=>Qa(e)},column_getAutoSortDir:{fn:e=>$a(e)},column_getSortFn:{fn:e=>eo(e)},column_toggleSorting:{fn:(e,t,n)=>to(e,t,n)},column_getFirstSortDir:{fn:e=>no(e)},column_getNextSortingOrder:{fn:(e,t)=>ro(e,t)},column_getCanSort:{fn:e=>io(e)},column_getCanMultiSort:{fn:e=>ao(e)},column_getIsSorted:{fn:e=>oo(e)},column_getSortIndex:{fn:e=>so(e)},column_clearSorting:{fn:e=>co(e)},column_getToggleSortingHandler:{fn:e=>lo(e)}})},constructTableAPIs(e){ti(`rowSortingFeature`,e,{table_autoResetSorting:{fn:()=>Za(e)},table_setSorting:{fn:t=>Ya(e,t)},table_resetSorting:{fn:t=>Xa(e,t)}})}};function fo(){return e=>{let t=e;return $r({feature:`rowSortingFeature`,table:t,fnName:`table.getSortedRowModel`,memoDeps:()=>[t.atoms.sorting?.get(),t.getPreSortedRowModel()],fn:()=>po(t),onAfterUpdate:Qr(()=>hi(t))})}}function po(e){let t=e.getPreSortedRowModel(),n=e.atoms.sorting?.get();if(!t.rows.length||!n?.length)return t;let r=[],i=n.filter(t=>{let n=e.getColumn(t.id);return n?io(n):!1});if(!i.length)return t;let a=[];for(let t=0;t{for(let n=0;n{let t=e.slice();t.sort(o);let n=!1;for(let i=0;i`u`?L.useEffect:L.useLayoutEffect;function ho(e,t){let[{table:n,rootSource:r}]=(0,L.useState)(()=>{let t=Pa({...e,features:{coreReactivityFeature:Ir(),...e.features}});return t.Subscribe=(e=>Mr({...e,source:e.source??t.store})),t.FlexRender=jr,{table:t,rootSource:Fr(t.store,Ct)}}),i=n;Aa(i,t=>({...t,...e}),{syncExternalState:!1});let a=i.options.state,o=r.get(),s=De(r,t,{compare:Ct});return mo(()=>{r.markCommitted(o),Da(i,a??null,Ct)}),(0,L.useMemo)(()=>({...n,options:e,state:s}),[n,e,s])}var go=new Set([`id`,`http`,`https`,`rpc`,`grpc`,`cpu`,`sql`,`url`,`uri`,`ip`,`io`,`db`,`gc`,`tls`,`api`]),_o={ms:`ms`,ns:`ns`,s:`s`,us:`µs`,bytes:`bytes`,percent:`%`,ratio:`ratio`,per_second:`/s`,per_minute:`/min`},vo={body_template:`message template`,calls:`requests`,spans:`requests`,parquet_index:`traces`};function yo(e,t,{withUnit:n=!0}={}){let r=typeof e==`string`?e:e.name,i=t?.options?.columns?.find(e=>e.field===r)?.unit??(typeof e==`string`?void 0:e.unit)??(typeof e!=`string`&&e.role===`measure`?t?.unit:void 0),a=vo[r]??r;/\b(?:duckdb|parquet|sqlite|variant|timestamptz_ns|timestamp_ns)\b|\btelemetry\./i.test(a)&&(a=`value`),a=a.replace(/^(\w+)\(([^()]*)\)$/,(e,t,n)=>[t,n].filter(Boolean).join(`_`));let o=a.match(/_(ms|ns|us|s|bytes|percent)$/i);o&&(a=a.slice(0,-o[0].length));let s=i??o?.[1]?.toLowerCase();return a=a.split(`_`).map((e,t)=>/^p\d+$/i.test(e)||go.has(e.toLowerCase())?/^p\d+$/i.test(e)?e.toLowerCase():e.toUpperCase():t===0?e.charAt(0).toUpperCase()+e.slice(1):e).join(` `),a+(n&&s&&s!==`none`&&s!==`count`?` (${_o[s]??s})`:``)}var bo={ok:0,warn:1,bad:2};function xo(e){if(!e?.length)return;let t=[...e].sort((e,t)=>bo[e.status]-bo[t.status]),n=t[0],r=t[t.length-1];return bo[r.status]>bo[n.status]&&r.value!==n.value?r.value>n.value?`lower`:`higher`:`lower`}function So(e,t,n){if(e===null||!t||t.length===0)return null;n??=xo(t);let r=`ok`;for(let i of t)(n===`lower`?e>=i.value:e<=i.value)&&bo[i.status]>bo[r]&&(r=i.status);return r}var Co=e=>String(e??``)||`(none)`,wo=e=>typeof e==`number`&&Number.isFinite(e)?e:null;function To(e){return e.columns.flatMap((e,t)=>e.role===`measure`?[t]:[])}function Eo(e){let t=e.columns.findIndex(e=>e.role===`time`);if(t<0)return[];let n=e.columns.findIndex(e=>e.role===`dimension`),r=To(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),wo(e.values[n][r])])}))}function Do(e){let t=e.columns.flatMap((e,t)=>e.role===`dimension`?[t]:[]),n=To(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]??``))]=wo(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(wo)}))}}function Oo(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 ko(e,t){let n=To(t)[0];return n===void 0?null:(e.reduce??`window`)===`window`?t.totals?wo(t.totals[n]):Oo(t.values[n].map(wo),`mean`):Oo(t.values[n].map(wo),e.reduce??`mean`)}function Ao(e){let t=To(e)[0];return t===void 0?[]:e.values[t].map(wo)}function jo(e,t){return!t.previous||(e.reduce??`window`)===`window`&&!t.previous.totals?null:ko(e,t.previous)}function Mo(e,t){return`rgba(${[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)).join(`, `)}, ${t})`}function No(e,t){return{color:e,...j(e,t.surface)<3?{borderColor:t.text,borderWidth:1}:{}}}function Po(e,t){return{color:e,...j(e,t.surface)<3?{shadowColor:t.text,shadowBlur:2}:{}}}function Fo(e,t){return{ok:nr,warn:rr,bad:ir}[e][t?5:8]}function Io({panel:e,result:t,dark:n=!1,compare:r=!0,range:i}){let a=t.frame,o=ko(e,a),s=a.columns.find(e=>e.role===`measure`)?.unit??e.unit,c=e.better??t.better??xo(e.thresholds),l=So(o,e.thresholds,c)??(a.health?.health===`healthy`?`ok`:a.health?.health===`degraded`?`warn`:a.health?.health===`unhealthy`?`bad`:null),u=jo(e,t),d=Ao(a),p=e.thresholds?.find(e=>e.status===l&&o!==null&&(c===`higher`?o<=e.value:o>=e.value))?.label;return(0,R.jsxs)(T,{h:`100%`,style:{display:`flex`,flexDirection:`column`,justifyContent:`space-between`,gap:4},children:[(0,R.jsxs)(f,{justify:`space-between`,align:`flex-start`,wrap:`nowrap`,gap:`xs`,children:[(0,R.jsx)(I,{"data-stat-value":!0,fz:24,fw:500,lh:1.1,lts:`-0.02em`,ff:`var(--mantine-font-family-monospace)`,children:pt(s,o)}),l&&(0,R.jsx)(T,{"data-stat-status":!0,children:(0,R.jsx)(F,{tone:l===`bad`?`danger`:l===`warn`?`warning`:`success`,children:p??(l===`bad`?`Unhealthy`:l===`warn`?`Degraded`:`Healthy`)})})]}),r&&u!==null&&o!==null&&(0,R.jsx)(Lo,{dark:n,value:o,previous:u,better:c,unit:s,period:Ro(i,t)}),(0,R.jsx)(zo,{points:d,area:!0,dark:n,height:40})]})}function Lo({value:e,previous:t,better:n,unit:r,period:i,dark:a}){let o=r===`percent`,s=o?e-t:t===0?e===0?0:1/0:(e-t)/Math.abs(t)*100,c=s>=0,l=s===0||!n?null:c?n===`higher`:n===`lower`,u=Number.isFinite(s)?o?`${c?`+`:`−`}${Math.abs(s).toFixed(1)} pts`:`${c?`+`:`−`}${Math.abs(s).toFixed(0)}%`:`new`;return(0,R.jsxs)(f,{gap:6,children:[(0,R.jsxs)(I,{"data-stat-delta":!0,fz:12,fw:600,style:{color:l===null?`var(--mantine-color-dimmed)`:Fo(l?`ok`:`bad`,a)},children:[c?`▲`:`▼`,` `,u]}),(0,R.jsxs)(I,{fz:12,c:`dimmed`,children:[`vs previous `,i]})]})}function Ro(e,t){let n=t.from_ms!==void 0&&t.to_ms!==void 0?t.to_ms-t.from_ms:t.shift_ms,r=/^(\d+)(s|m|h|d|w)$/.exec(e??``),i=r?Number(r[1])*{s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5}[r[2]]:n;if(!i)return`period`;let a=i>=6048e5?`week`:i>=864e5?`day`:i>=36e5?`hour`:i>=6e4?`minute`:`second`,o=i/{week:6048e5,day:864e5,hour:36e5,minute:6e4,second:1e3}[a];return o===1?a:`${Number(o.toFixed(2))} ${a}s`}function zo({points:e,area:t=!1,dark:n=!1,height:r=32}){let i=e.filter(e=>e!==null&&Number.isFinite(e));if(i.length<2)return null;let a=Math.min(...i),o=Math.max(...i),s=r,c=t=>t/(e.length-1)*200,l=e=>s-2-(e-a)/(o-a||1)*(s-4),u=e.map((t,n)=>t===null||!Number.isFinite(t)?``:`${n===0||e[n-1]===null||!Number.isFinite(e[n-1])?`M`:`L`}${c(n).toFixed(1)},${l(t).toFixed(1)}`).join(``),d=[];return e.forEach((t,n)=>{if(t!==null&&Number.isFinite(t)){if(!n||e[n-1]===null||!Number.isFinite(e[n-1]))d.push({start:n,end:n,path:`M${c(n).toFixed(1)},${l(t).toFixed(1)}`});else{let e=d.at(-1);e.end=n,e.path+=`L${c(n).toFixed(1)},${l(t).toFixed(1)}`}}}),(0,R.jsxs)(`svg`,{viewBox:`0 0 200 ${s}`,preserveAspectRatio:`none`,width:`100%`,height:s,role:`img`,"aria-label":`Value over this panel's time range`,children:[t&&d.filter(e=>e.end>e.start).map(e=>(0,R.jsx)(`path`,{"data-sparkline-area":!0,d:`${e.path}L${c(e.end)},${s}L${c(e.start)},${s}Z`,fill:dr(0,n),opacity:.18},e.start)),(0,R.jsx)(`path`,{"data-sparkline-line":!0,d:u,fill:`none`,stroke:dr(0,n),strokeWidth:1.5,vectorEffect:`non-scaling-stroke`})]})}function Bo(e,t,n,r,i,a){e.format===`status`&&e.unit&&typeof t==`string`&&t.trim()!==``&&Number.isFinite(Number(t))&&(t=Number(t));let o=t===null?`—`:String(t),s={kind:e.format,text:o};if([`unit`,`bar`,`status`,`sparkline`].includes(e.format)&&(s.text=typeof t==`number`?pt(e.unit,t):o),e.format===`bar`&&(s.fraction=typeof t==`number`&&n>0?Math.max(0,Math.min(1,t/n)):0),e.format===`status`&&typeof t==`number`&&(s.status=So(Number.isFinite(t)?t:null,r?.thresholds,r?.better??i)),e.format===`service_link`&&(s.variable=e.variable),e.format===`sparkline`&&a)return s.points=a.slice(0,240),s;if(e.format===`sparkline`)try{let e=JSON.parse(o);Array.isArray(e)?s.points=e.slice(0,240).map(e=>typeof e==`number`&&Number.isFinite(e)?e:null):s.unsupported=`Sparkline requires an array column`}catch{s.unsupported=`Sparkline requires an array column`}return s}function Vo({text:e,template:t=!1,highlight:n=``}){let r=xt(`light`)===`dark`,i=er[r?5:7],a=[1,3,5].map(e=>parseInt(i.slice(e,e+2),16)).join(`, `),o=[];if(n){let t=e.toLowerCase(),r=n.toLowerCase();for(let e=t.indexOf(r);e!==-1;e=t.indexOf(r,e+r.length))o.push(e)}let s=(t,i)=>{let s=[],c=t;for(let l of o){let o=Math.max(t,l),u=Math.min(i,l+n.length);o>=u||(s.push(e.slice(c,o),(0,R.jsx)(`mark`,{"data-highlight-match":!0,style:{background:`rgba(${a}, ${r?.22:.3})`,color:`inherit`,borderRadius:3,padding:`0 2px`},children:e.slice(o,u)},o)),c=u)}return s.push(e.slice(c,i)),s},c=[],l=0;if(t)for(let t of e.matchAll(/<\*>||||