From cbd2a0af41a94daa9d1b4b338f1ccd259c934e8b Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Tue, 8 Sep 2026 10:00:51 -0700 Subject: [PATCH 1/3] feat!: serve all protocols on one port --- Dockerfile | 2 +- README.md | 27 +- cmd/fanout-docgen/main.go | 6 +- cmd/fanout-docgen/routes.go | 4 +- cmd/fanout/main.go | 84 +---- cmd/fanout/main_test.go | 2 +- docs/benchmarks/single-port-2026-09-08.json | 338 ++++++++++++++++++ docs/benchmarks/single-port-2026-09-08.log | 101 ++++++ docs/benchmarks/single-port-2026-09-08.md | 87 +++++ .../single-port-stdlib-2026-09-08.json | 170 +++++++++ .../single-port-stdlib-2026-09-08.log | 53 +++ docs/diagrams/architecture.d2 | 2 +- docs/diagrams/architecture.svg | 198 +++++----- docs/operations.md | 60 ++-- fanout.docker.yaml | 12 +- fanout.example.yaml | 4 +- internal/api/auth.go | 4 +- internal/api/settings.go | 47 ++- internal/api/settings_test.go | 33 +- internal/api/shared_listener_test.go | 68 ++++ internal/config/config.go | 21 +- internal/config/config_test.go | 79 ++-- internal/ingest/auth.go | 30 +- internal/ingest/auth_test.go | 94 +---- internal/ingest/http.go | 2 +- internal/ingest/listener_test.go | 253 +++++++++++++ internal/ingest/transport_bench_test.go | 222 ++++++++++++ internal/server/http.go | 41 +++ ...q2AFnK.js => WarningCircle.es-BrGtHGYK.js} | 2 +- .../{api-Be5Lq4YA.js => api-CB7Xlqes.js} | 2 +- .../{auth-BeUORN-q.js => auth-B1VNekWU.js} | 2 +- .../{chat-B-nb-Yp3.js => chat-B3ZKcKVO.js} | 4 +- .../ui/dist/assets/chat._threadId-B6mb73V8.js | 1 - .../ui/dist/assets/chat._threadId-DYB6vKSb.js | 1 + .../ui/dist/assets/chat.index-B6mb73V8.js | 1 - .../ui/dist/assets/chat.index-DYB6vKSb.js | 1 + ...oard-BfR0ACHf.js => dashboard-yZ7oG_PO.js} | 2 +- ...js => dashboards._dashboardId-rFBmUOpC.js} | 2 +- ...8hpWIl.js => dashboards.index-D2SA6vFv.js} | 2 +- .../{index-C8q_YUYV.js => index-BHeU96Kj.js} | 6 +- ...-BZJusU6-.js => mcp-app-frame-GqrqdVoY.js} | 2 +- ...{routes-D1xQhcK4.js => routes-VCBnBbPZ.js} | 2 +- ...tings-D20O7uBo.js => settings-BTUR4pT4.js} | 2 +- ...{tokens-DNprTSRA.js => tokens-CPxx1QN7.js} | 2 +- internal/ui/dist/index.html | 8 +- site/public/diagrams/architecture.svg | 198 +++++----- .../content/docs/explanation/performance.mdx | 2 +- .../docs/guides/back-up-and-restore.mdx | 4 +- .../src/content/docs/guides/terminate-tls.mdx | 41 ++- site/src/content/docs/guides/troubleshoot.mdx | 13 +- site/src/content/docs/reference/endpoints.mdx | 24 +- .../content/docs/reference/http-routes.mdx | 4 +- .../docs/reference/settings/ingest.mdx | 6 +- .../docs/reference/settings/server.mdx | 10 +- site/src/content/docs/start/install.mdx | 26 +- .../src/content/docs/start/send-telemetry.mdx | 34 +- site/src/content/docs/status/capabilities.mdx | 2 +- site/src/pages/llms.txt.ts | 2 +- ui/host/src/auth.tsx | 2 +- ui/host/src/settings.test.tsx | 4 +- ui/host/src/settings.tsx | 2 +- 61 files changed, 1837 insertions(+), 623 deletions(-) create mode 100644 docs/benchmarks/single-port-2026-09-08.json create mode 100644 docs/benchmarks/single-port-2026-09-08.log create mode 100644 docs/benchmarks/single-port-2026-09-08.md create mode 100644 docs/benchmarks/single-port-stdlib-2026-09-08.json create mode 100644 docs/benchmarks/single-port-stdlib-2026-09-08.log create mode 100644 internal/api/shared_listener_test.go create mode 100644 internal/ingest/listener_test.go create mode 100644 internal/ingest/transport_bench_test.go create mode 100644 internal/server/http.go rename internal/ui/dist/assets/{WarningCircle.es-DDq2AFnK.js => WarningCircle.es-BrGtHGYK.js} (98%) rename internal/ui/dist/assets/{api-Be5Lq4YA.js => api-CB7Xlqes.js} (99%) rename internal/ui/dist/assets/{auth-BeUORN-q.js => auth-B1VNekWU.js} (73%) rename internal/ui/dist/assets/{chat-B-nb-Yp3.js => chat-B3ZKcKVO.js} (99%) delete mode 100644 internal/ui/dist/assets/chat._threadId-B6mb73V8.js create mode 100644 internal/ui/dist/assets/chat._threadId-DYB6vKSb.js delete mode 100644 internal/ui/dist/assets/chat.index-B6mb73V8.js create mode 100644 internal/ui/dist/assets/chat.index-DYB6vKSb.js rename internal/ui/dist/assets/{dashboard-BfR0ACHf.js => dashboard-yZ7oG_PO.js} (99%) rename internal/ui/dist/assets/{dashboards._dashboardId-CMjPkGKO.js => dashboards._dashboardId-rFBmUOpC.js} (81%) rename internal/ui/dist/assets/{dashboards.index-Bm8hpWIl.js => dashboards.index-D2SA6vFv.js} (73%) rename internal/ui/dist/assets/{index-C8q_YUYV.js => index-BHeU96Kj.js} (99%) rename internal/ui/dist/assets/{mcp-app-frame-BZJusU6-.js => mcp-app-frame-GqrqdVoY.js} (99%) rename internal/ui/dist/assets/{routes-D1xQhcK4.js => routes-VCBnBbPZ.js} (84%) rename internal/ui/dist/assets/{settings-D20O7uBo.js => settings-BTUR4pT4.js} (97%) rename internal/ui/dist/assets/{tokens-DNprTSRA.js => tokens-CPxx1QN7.js} (99%) diff --git a/Dockerfile b/Dockerfile index 02a4342af..620021391 100644 --- a/Dockerfile +++ b/Dockerfile @@ -62,7 +62,7 @@ COPY --from=build --chown=nonroot:nonroot /runtime/var/lib/fanout /var/lib/fanou USER nonroot:nonroot WORKDIR /var/lib/fanout -EXPOSE 7520 4317 4318 +EXPOSE 7520 # Startup does DuckDB catalog attachment and maintenance, so the grace period # is generous relative to the check interval. diff --git a/README.md b/README.md index 0d0964fde..5ab6e38bb 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ choose the installation directory. ### Docker ```sh -docker run --name fanout -p 7520:7520 -p 4317:4317 -p 4318:4318 \ +docker run --name fanout -p 7520:7520 \ -v fanout-data:/var/lib/fanout/data \ -e FANOUT_AUTH_CODE_SECRET=$(openssl rand -hex 32) \ labstack/fanout:latest @@ -122,7 +122,7 @@ your collector secrets. A standard OTLP/HTTP exporter can then use: ```sh export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf -export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 +export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:7520 export OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer%20$INGEST_TOKEN" ``` @@ -131,7 +131,7 @@ For a Collector on the same private container network, the forwarding side is: ```yaml exporters: otlp_http/fanout: - endpoint: http://fanout:4318 + endpoint: http://fanout:7520 headers: Authorization: "Bearer ${env:INGEST_TOKEN}" @@ -146,7 +146,10 @@ This assumes the Collector's existing `otlp` receiver and an environment variable containing the one-time token. Replace `fanout` with the private hostname reachable from that Collector. -The equivalent OTLP/gRPC endpoint is `localhost:4317`. For later sign-in +The equivalent OTLP/gRPC endpoint is `localhost:7520` (plaintext locally). +Behind a TLS proxy, both transports use the public origin; gRPC requires +HTTP/2 to Fanout. See the [single-port migration notes](docs/operations.md#single-port-migration). +For later sign-in without SMTP, mint a 15-minute, single-use link against the running container's control database: @@ -166,7 +169,7 @@ needs no such handling. The image selects `/etc/fanout/fanout.yaml` by default. That file contains only the container listener and data-directory defaults; it does not contain credentials. Start a container-specific document from that file so it retains -the externally reachable HTTP and OTLP bind addresses: +the shared listener and persistent data-directory settings: ```sh cp fanout.docker.yaml fanout.yaml @@ -175,10 +178,8 @@ docker run -v ./fanout.yaml:/etc/fanout/fanout.yaml:ro \ labstack/fanout:latest ``` -A replacement document must set `server.http_addr: ":7520"`, -`ingest.otlp_grpc_addr: ":4317"`, and `ingest.otlp_http_addr: ":4318"`; -omitting either ingest address restores its secure loopback-only built-in -default, which is unreachable through a published container port. +All surfaces use `server.addr` (`:7520` by default). Publish only that +port; OTLP/HTTP and OTLP/gRPC use the same address as the application. ### From source @@ -201,8 +202,8 @@ Optionally set `FANOUT_AI_API_KEY` for chat and the SMTP variables shown above for email-code login. Without SMTP, run `./bin/fanout login-link admin@example.com` from the same configuration and data directory. -Fanout serves the UI on , accepts OTLP/gRPC on -`127.0.0.1:4317`, and accepts OTLP/HTTP on `127.0.0.1:4318`. The first account +Fanout serves the UI, API, MCP, OTLP/gRPC and OTLP/HTTP on +. The first account created becomes the administrator and receives the ingest token once. Point any OpenTelemetry collector or SDK at either OTLP endpoint with the @@ -241,9 +242,7 @@ operators touch are: | YAML key | Environment override | Default | Purpose | | --- | --- | --- | --- | -| `server.http_addr` | `FANOUT_HTTP_ADDR` | `:7520` | UI, API, and MCP listener | -| `ingest.otlp_grpc_addr` | `FANOUT_OTLP_GRPC_ADDR` | `127.0.0.1:4317` | OTLP/gRPC ingest listener | -| `ingest.otlp_http_addr` | `FANOUT_OTLP_HTTP_ADDR` | `127.0.0.1:4318` | OTLP/HTTP ingest listener | +| `server.addr` | `FANOUT_ADDR` | `:7520` | UI, API, MCP, and both OTLP transports | | `storage.data_dir` | `FANOUT_DATA_DIR` | `./data` | Parquet, query state, and control SQLite | | `auth.mode` | `FANOUT_AUTH_MODE` | `local` | `local` (login link or SMTP) or `oidc` | | `auth.code_secret` | `FANOUT_AUTH_CODE_SECRET` | — | Required in local mode, 32+ characters | diff --git a/cmd/fanout-docgen/main.go b/cmd/fanout-docgen/main.go index 72f68c554..4d2eddf4f 100644 --- a/cmd/fanout-docgen/main.go +++ b/cmd/fanout-docgen/main.go @@ -433,8 +433,8 @@ type groupPage struct { var groups = map[string]groupPage{ "server": { Title: "Server settings", - Description: "The HTTP listener, the public URL, TLS, and proxy trust.", - Summary: "Settings for the listener that serves the browser client, the API, chat and MCP.", + 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.", "Browser sessions are not getting Secure cookies.", @@ -442,7 +442,7 @@ var groups = map[string]groupPage{ }, "ingest": { Title: "Ingest settings", - Description: "The OTLP listeners, the advertised endpoint, batching, and the default namespace.", + Description: "The advertised OTLP endpoint, batching, and the default namespace.", Summary: "Settings for how telemetry arrives and how it is batched before it is written.", ReadWhen: []string{ "Exporters cannot reach the instance.", diff --git a/cmd/fanout-docgen/routes.go b/cmd/fanout-docgen/routes.go index 845f44322..945b203b7 100644 --- a/cmd/fanout-docgen/routes.go +++ b/cmd/fanout-docgen/routes.go @@ -246,8 +246,8 @@ func renderRoutes(routes []api.RouteDoc) []byte { 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("Every route below is served on `FANOUT_HTTP_ADDR` (`:7520` by default).\n") - b.WriteString("Telemetry does not arrive here — OTLP has its own two listeners, described in\n") + b.WriteString("Every route below is served on `FANOUT_ADDR` (`:7520` by default).\n") + b.WriteString("OTLP shares this listener but uses its own handlers and ingest credential; see\n") b.WriteString("[send your first telemetry](/start/send-telemetry).\n\n") b.WriteString(":::note[What this table is, and what it is not]\n") diff --git a/cmd/fanout/main.go b/cmd/fanout/main.go index 273f15416..57b91fa7f 100644 --- a/cmd/fanout/main.go +++ b/cmd/fanout/main.go @@ -2,7 +2,6 @@ package main import ( "context" - "crypto/tls" "errors" "flag" "fmt" @@ -39,6 +38,7 @@ import ( 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" @@ -190,53 +190,12 @@ func main() { slog.Error("setup token init failed", "err", err) os.Exit(1) } - printSetupBanner(cfg.HTTPAddr, token) + printSetupBanner(cfg.Addr, token) } - // Start gRPC ingest (OTLP) - grpcLis, err := net.Listen("tcp", cfg.OTLPGRPCAddr) - if err != nil { - slog.Error("listen gRPC failed", "err", err) - os.Exit(1) - } - grpcOpts, err := ingest.GRPCServerOptions(cfg, settingsStore) - if err != nil { - slog.Error("OTLP gRPC TLS init failed", "err", err) - os.Exit(1) - } - grpcSrv := grpc.NewServer(grpcOpts...) + grpcSrv := grpc.NewServer(ingest.GRPCServerOptions(settingsStore)...) ing := ingest.NewServer(cfg, writer) ingest.RegisterOTLP(grpcSrv, ing) - otlpHTTPLis, err := net.Listen("tcp", cfg.OTLPHTTPAddr) - if err != nil { - slog.Error("listen OTLP HTTP failed", "err", err) - os.Exit(1) - } - otlpHTTPSrv := &http.Server{ - Handler: ingest.NewHTTPHandler(ing, settingsStore), - TLSConfig: &tls.Config{MinVersion: tls.VersionTLS13}, - ReadHeaderTimeout: 5 * time.Second, - IdleTimeout: 2 * time.Minute, - } - - go func() { - slog.Info("gRPC OTLP listening", "addr", cfg.OTLPGRPCAddr, "tls", cfg.TLSEnabled()) - if err := grpcSrv.Serve(grpcLis); err != nil && err != grpc.ErrServerStopped { - errCh <- fmt.Errorf("gRPC server: %w", err) - } - }() - go func() { - slog.Info("HTTP OTLP listening", "addr", cfg.OTLPHTTPAddr, "tls", cfg.TLSEnabled()) - var serveErr error - if cfg.TLSEnabled() { - serveErr = otlpHTTPSrv.ServeTLS(otlpHTTPLis, cfg.TLSCertFile, cfg.TLSKeyFile) - } else { - serveErr = otlpHTTPSrv.Serve(otlpHTTPLis) - } - if serveErr != nil && serveErr != http.ErrServerClosed { - errCh <- fmt.Errorf("OTLP HTTP server: %w", serveErr) - } - }() // Start Echo HTTP API e := echo.New() @@ -417,22 +376,14 @@ func main() { e.GET("/", spa) e.GET("/*", spa) - // Run HTTP - httpCtx, httpCancel := context.WithCancel(context.Background()) + httpSrv := server.New(cfg.Addr, e, ingest.NewHTTPHandler(ing, settingsStore), grpcSrv) go func() { - sc := echo.StartConfig{ - Address: cfg.HTTPAddr, - HideBanner: true, - GracefulTimeout: 5 * time.Second, - } - slog.Info("HTTP listening", "addr", cfg.HTTPAddr, "tls", cfg.TLSEnabled()) + slog.Info("HTTP and OTLP listening", "addr", cfg.Addr, "tls", cfg.TLSEnabled()) var err error if cfg.TLSEnabled() { - // Match the OTLP gRPC listener's TLS 1.3 floor; Echo otherwise defaults to 1.2. - sc.TLSConfig = &tls.Config{MinVersion: tls.VersionTLS13} - err = sc.StartTLS(httpCtx, e, cfg.TLSCertFile, cfg.TLSKeyFile) + err = httpSrv.ListenAndServeTLS(cfg.TLSCertFile, cfg.TLSKeyFile) } else { - err = sc.Start(httpCtx, e) + err = httpSrv.ListenAndServe() } if err != nil && err != http.ErrServerClosed { errCh <- fmt.Errorf("HTTP server: %w", err) @@ -450,22 +401,21 @@ func main() { slog.Error("fatal error, shutting down", "err", err) } - // Stop accepting OTLP and let in-flight exporters finish while the writer is - // still draining. Cancelling the writer first could strand a handler on a full - // channel or accept rows after its final drain. - otlpShutdownCtx, otlpShutdownCancel := context.WithTimeout(context.Background(), 5*time.Second) - if err := otlpHTTPSrv.Shutdown(otlpShutdownCtx); err != nil { - slog.Error("OTLP HTTP graceful shutdown failed", "err", err) - _ = otlpHTTPSrv.Close() + // Stop every surface and finish in-flight exports before stopping the writer. + // The deadline also bounds long-lived SSE requests; Close cancels any that + // remain. net/http owns the gRPC connections, including plaintext HTTP/2. + shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 5*time.Second) + if err := httpSrv.Shutdown(shutdownCtx); err != nil { + slog.Error("HTTP graceful shutdown failed", "err", err) + _ = httpSrv.Close() } - otlpShutdownCancel() - grpcSrv.GracefulStop() + shutdownCancel() + grpcSrv.Stop() cancel() writer.Wait() if err := <-writerResult; err != nil { slog.Error("telemetry writer stopped with unwritten telemetry", "err", err) } - httpCancel() // triggers graceful HTTP shutdown (5s timeout) } func parseCommandLine(args []string, output io.Writer) (configPath string, showVersion bool, loginEmail, healthURL string, repair *repairCommand, err error) { @@ -630,7 +580,7 @@ func browserLoginURL(cfg config.Config) *url.URL { publicURL.Fragment = "" return publicURL } - loginURL, _ := url.Parse(setupLoginURL(cfg.HTTPAddr)) + loginURL, _ := url.Parse(setupLoginURL(cfg.Addr)) return loginURL } diff --git a/cmd/fanout/main_test.go b/cmd/fanout/main_test.go index 5e0482e67..e9c6fe4b2 100644 --- a/cmd/fanout/main_test.go +++ b/cmd/fanout/main_test.go @@ -157,7 +157,7 @@ func TestCreateLoginLink(t *testing.T) { AuthMode: "local", AuthCodeSecret: "0123456789abcdef0123456789abcdef", DataDir: t.TempDir(), - HTTPAddr: ":7520", + Addr: ":7520", PublicURL: "https://fanout.example.com/base", } if err := os.MkdirAll(cfg.ControlDir(), 0o755); err != nil { diff --git a/docs/benchmarks/single-port-2026-09-08.json b/docs/benchmarks/single-port-2026-09-08.json new file mode 100644 index 000000000..62bcfa505 --- /dev/null +++ b/docs/benchmarks/single-port-2026-09-08.json @@ -0,0 +1,338 @@ +[ + { + "allocated_bytes_per_row": 2065.429636767318, + "concurrency": 1, + "cpu_cores_client_and_server": 1.668108766224098, + "durable": false, + "errors": 0, + "mode": "native", + "p50_ms": 0.8185, + "p95_ms": 2.228833, + "p99_ms": 2.348875, + "rows": 9008000, + "rows_per_second": 900673.042659051, + "seconds": 10.001409583 + }, + { + "allocated_bytes_per_row": 2235.167287165282, + "concurrency": 1, + "cpu_cores_client_and_server": 1.7853236068469907, + "durable": false, + "errors": 0, + "mode": "shared", + "p50_ms": 0.942958, + "p95_ms": 2.266666, + "p99_ms": 2.417417, + "rows": 8664000, + "rows_per_second": 866387.191851588, + "seconds": 10.000147834 + }, + { + "allocated_bytes_per_row": 2244.0646240875913, + "concurrency": 1, + "cpu_cores_client_and_server": 1.785360650700898, + "durable": false, + "errors": 0, + "mode": "shared", + "p50_ms": 0.93325, + "p95_ms": 2.236125, + "p99_ms": 2.372625, + "rows": 8768000, + "rows_per_second": 876795.1629841244, + "seconds": 10.000055167 + }, + { + "allocated_bytes_per_row": 2066.4755709403594, + "concurrency": 1, + "cpu_cores_client_and_server": 1.6860995332039543, + "durable": false, + "errors": 0, + "mode": "native", + "p50_ms": 0.815, + "p95_ms": 2.21025, + "p99_ms": 2.328125, + "rows": 9071000, + "rows_per_second": 906928.1635046254, + "seconds": 10.001894709 + }, + { + "allocated_bytes_per_row": 2058.800469744509, + "concurrency": 1, + "cpu_cores_client_and_server": 1.692699146091521, + "durable": false, + "errors": 0, + "mode": "native", + "p50_ms": 0.841209, + "p95_ms": 2.23975, + "p99_ms": 2.377375, + "rows": 8924000, + "rows_per_second": 892354.6869428807, + "seconds": 10.000507792 + }, + { + "allocated_bytes_per_row": 2231.728527462008, + "concurrency": 1, + "cpu_cores_client_and_server": 1.773189609549387, + "durable": false, + "errors": 0, + "mode": "shared", + "p50_ms": 0.986333, + "p95_ms": 2.330292, + "p99_ms": 2.48125, + "rows": 8357000, + "rows_per_second": 835663.8575381615, + "seconds": 10.0004325 + }, + { + "allocated_bytes_per_row": 1961.8700916580628, + "concurrency": 16, + "cpu_cores_client_and_server": 9.112946253819041, + "durable": false, + "errors": 0, + "mode": "native", + "p50_ms": 2.9295, + "p95_ms": 6.656667, + "p99_ms": 10.422292, + "rows": 47459000, + "rows_per_second": 4744631.522762389, + "seconds": 10.0026735 + }, + { + "allocated_bytes_per_row": 1983.2758534517795, + "concurrency": 16, + "cpu_cores_client_and_server": 10.30437775355329, + "durable": false, + "errors": 0, + "mode": "shared", + "p50_ms": 2.88375, + "p95_ms": 6.07375, + "p99_ms": 7.402625, + "rows": 51669000, + "rows_per_second": 5165202.800618604, + "seconds": 10.003285833 + }, + { + "allocated_bytes_per_row": 1981.7025076054413, + "concurrency": 16, + "cpu_cores_client_and_server": 9.900270964204253, + "durable": false, + "errors": 0, + "mode": "shared", + "p50_ms": 2.990417, + "p95_ms": 6.380041, + "p99_ms": 7.895125, + "rows": 49767000, + "rows_per_second": 4975016.06054384, + "seconds": 10.003384792 + }, + { + "allocated_bytes_per_row": 1954.849820058997, + "concurrency": 16, + "cpu_cores_client_and_server": 8.843126095230799, + "durable": false, + "errors": 0, + "mode": "native", + "p50_ms": 3.130334, + "p95_ms": 7.114459, + "p99_ms": 9.972708, + "rows": 46104000, + "rows_per_second": 4609332.824217873, + "seconds": 10.00231525 + }, + { + "allocated_bytes_per_row": 1961.0370257659515, + "concurrency": 16, + "cpu_cores_client_and_server": 10.23542983013505, + "durable": false, + "errors": 0, + "mode": "native", + "p50_ms": 2.757583, + "p95_ms": 6.046208, + "p99_ms": 7.41125, + "rows": 53365000, + "rows_per_second": 5335229.726618022, + "seconds": 10.002380916 + }, + { + "allocated_bytes_per_row": 1981.4924883456838, + "concurrency": 16, + "cpu_cores_client_and_server": 10.292444172154767, + "durable": false, + "errors": 0, + "mode": "shared", + "p50_ms": 2.8625, + "p95_ms": 6.068416, + "p99_ms": 7.409542, + "rows": 51955000, + "rows_per_second": 5194012.650847724, + "seconds": 10.002863584 + }, + { + "allocated_bytes_per_row": 3932.1484444444445, + "concurrency": 1, + "cpu_cores_client_and_server": 0.1526923273839045, + "durable": true, + "errors": 0, + "mode": "native", + "p50_ms": 38.967166, + "p95_ms": 45.813792, + "p99_ms": 49.388542, + "rows": 252000, + "rows_per_second": 25170.777251163567, + "seconds": 10.011609792 + }, + { + "allocated_bytes_per_row": 3967.582976, + "concurrency": 1, + "cpu_cores_client_and_server": 0.16019880419809268, + "durable": true, + "errors": 0, + "mode": "shared", + "p50_ms": 39.060458, + "p95_ms": 45.031083, + "p99_ms": 48.052708, + "rows": 250000, + "rows_per_second": 24952.665001599085, + "seconds": 10.018969917 + }, + { + "allocated_bytes_per_row": 3934.2855843137254, + "concurrency": 1, + "cpu_cores_client_and_server": 0.16431193790352888, + "durable": true, + "errors": 0, + "mode": "shared", + "p50_ms": 38.887167, + "p95_ms": 44.072084, + "p99_ms": 47.978208, + "rows": 255000, + "rows_per_second": 25450.023364104516, + "seconds": 10.019637167 + }, + { + "allocated_bytes_per_row": 3954.68196875, + "concurrency": 1, + "cpu_cores_client_and_server": 0.15213216881861105, + "durable": true, + "errors": 0, + "mode": "native", + "p50_ms": 38.871625, + "p95_ms": 43.972292, + "p99_ms": 46.758167, + "rows": 256000, + "rows_per_second": 25572.04123321355, + "seconds": 10.010933334 + }, + { + "allocated_bytes_per_row": 3962.5928971962617, + "concurrency": 1, + "cpu_cores_client_and_server": 0.10835271108696926, + "durable": true, + "errors": 0, + "mode": "native", + "p50_ms": 43.871792, + "p95_ms": 62.9245, + "p99_ms": 69.515125, + "rows": 214000, + "rows_per_second": 21316.058162309007, + "seconds": 10.039379625 + }, + { + "allocated_bytes_per_row": 3965.29671875, + "concurrency": 1, + "cpu_cores_client_and_server": 0.15934341461007848, + "durable": true, + "errors": 0, + "mode": "shared", + "p50_ms": 38.152041, + "p95_ms": 44.984292, + "p99_ms": 47.031625, + "rows": 256000, + "rows_per_second": 25585.791889941116, + "seconds": 10.005553125 + }, + { + "allocated_bytes_per_row": 4384.688459183673, + "concurrency": 16, + "cpu_cores_client_and_server": 1.0979446755771467, + "durable": true, + "errors": 0, + "mode": "native", + "p50_ms": 51.31025, + "p95_ms": 58.145042, + "p99_ms": 61.531208, + "rows": 3136000, + "rows_per_second": 312193.6858291852, + "seconds": 10.045046208 + }, + { + "allocated_bytes_per_row": 4435.00769402985, + "concurrency": 16, + "cpu_cores_client_and_server": 1.2326325489358088, + "durable": true, + "errors": 0, + "mode": "shared", + "p50_ms": 49.280917, + "p95_ms": 56.741875, + "p99_ms": 58.569708, + "rows": 3216000, + "rows_per_second": 320595.9336104238, + "seconds": 10.03131875 + }, + { + "allocated_bytes_per_row": 4437.08422162324, + "concurrency": 16, + "cpu_cores_client_and_server": 1.2485428225271538, + "durable": true, + "errors": 0, + "mode": "shared", + "p50_ms": 47.988375, + "p95_ms": 54.267709, + "p99_ms": 57.947375, + "rows": 3339000, + "rows_per_second": 332345.6347210742, + "seconds": 10.046769541 + }, + { + "allocated_bytes_per_row": 4399.0799876237625, + "concurrency": 16, + "cpu_cores_client_and_server": 1.2168461407210889, + "durable": true, + "errors": 0, + "mode": "native", + "p50_ms": 49.54425, + "p95_ms": 56.040916, + "p99_ms": 60.273375, + "rows": 3232000, + "rows_per_second": 323135.08351888845, + "seconds": 10.002008958 + }, + { + "allocated_bytes_per_row": 4394.639358536585, + "concurrency": 16, + "cpu_cores_client_and_server": 1.2036325654104647, + "durable": true, + "errors": 0, + "mode": "native", + "p50_ms": 48.741959, + "p95_ms": 56.026459, + "p99_ms": 59.231583, + "rows": 3280000, + "rows_per_second": 326997.2370743304, + "seconds": 10.030665792 + }, + { + "allocated_bytes_per_row": 4453.083403381643, + "concurrency": 16, + "cpu_cores_client_and_server": 1.2782997399849019, + "durable": true, + "errors": 0, + "mode": "shared", + "p50_ms": 47.938416, + "p95_ms": 54.979458, + "p99_ms": 58.008667, + "rows": 3312000, + "rows_per_second": 330111.723454227, + "seconds": 10.032966916 + } +] diff --git a/docs/benchmarks/single-port-2026-09-08.log b/docs/benchmarks/single-port-2026-09-08.log new file mode 100644 index 000000000..76ad6c238 --- /dev/null +++ b/docs/benchmarks/single-port-2026-09-08.log @@ -0,0 +1,101 @@ +=== RUN TestTransportComparison + transport_bench_test.go:38: environment go=go1.27.0 os=darwin arch=arm64 CPUs=14 GOMAXPROCS=14 +=== RUN TestTransportComparison/durable=false/c=1/rep=1/native +2026/09/08 09:22:56 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":2065.429636767318,"concurrency":1,"cpu_cores_client_and_server":1.668108766224098,"durable":false,"errors":0,"mode":"native","p50_ms":0.8185,"p95_ms":2.228833,"p99_ms":2.348875,"rows":9008000,"rows_per_second":900673.042659051,"seconds":10.001409583} +=== RUN TestTransportComparison/durable=false/c=1/rep=1/shared +2026/09/08 09:23:06 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":2235.167287165282,"concurrency":1,"cpu_cores_client_and_server":1.7853236068469907,"durable":false,"errors":0,"mode":"shared","p50_ms":0.942958,"p95_ms":2.266666,"p99_ms":2.417417,"rows":8664000,"rows_per_second":866387.191851588,"seconds":10.000147834} +=== RUN TestTransportComparison/durable=false/c=1/rep=2/shared +2026/09/08 09:23:16 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":2244.0646240875913,"concurrency":1,"cpu_cores_client_and_server":1.785360650700898,"durable":false,"errors":0,"mode":"shared","p50_ms":0.93325,"p95_ms":2.236125,"p99_ms":2.372625,"rows":8768000,"rows_per_second":876795.1629841244,"seconds":10.000055167} +=== RUN TestTransportComparison/durable=false/c=1/rep=2/native +2026/09/08 09:23:26 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":2066.4755709403594,"concurrency":1,"cpu_cores_client_and_server":1.6860995332039543,"durable":false,"errors":0,"mode":"native","p50_ms":0.815,"p95_ms":2.21025,"p99_ms":2.328125,"rows":9071000,"rows_per_second":906928.1635046254,"seconds":10.001894709} +=== RUN TestTransportComparison/durable=false/c=1/rep=3/native +2026/09/08 09:23:36 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":2058.800469744509,"concurrency":1,"cpu_cores_client_and_server":1.692699146091521,"durable":false,"errors":0,"mode":"native","p50_ms":0.841209,"p95_ms":2.23975,"p99_ms":2.377375,"rows":8924000,"rows_per_second":892354.6869428807,"seconds":10.000507792} +=== RUN TestTransportComparison/durable=false/c=1/rep=3/shared +2026/09/08 09:23:46 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":2231.728527462008,"concurrency":1,"cpu_cores_client_and_server":1.773189609549387,"durable":false,"errors":0,"mode":"shared","p50_ms":0.986333,"p95_ms":2.330292,"p99_ms":2.48125,"rows":8357000,"rows_per_second":835663.8575381615,"seconds":10.0004325} +=== RUN TestTransportComparison/durable=false/c=16/rep=1/native +2026/09/08 09:23:56 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":1961.8700916580628,"concurrency":16,"cpu_cores_client_and_server":9.112946253819041,"durable":false,"errors":0,"mode":"native","p50_ms":2.9295,"p95_ms":6.656667,"p99_ms":10.422292,"rows":47459000,"rows_per_second":4744631.522762389,"seconds":10.0026735} +=== RUN TestTransportComparison/durable=false/c=16/rep=1/shared +2026/09/08 09:24:06 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":1983.2758534517795,"concurrency":16,"cpu_cores_client_and_server":10.30437775355329,"durable":false,"errors":0,"mode":"shared","p50_ms":2.88375,"p95_ms":6.07375,"p99_ms":7.402625,"rows":51669000,"rows_per_second":5165202.800618604,"seconds":10.003285833} +=== RUN TestTransportComparison/durable=false/c=16/rep=2/shared +2026/09/08 09:24:16 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":1981.7025076054413,"concurrency":16,"cpu_cores_client_and_server":9.900270964204253,"durable":false,"errors":0,"mode":"shared","p50_ms":2.990417,"p95_ms":6.380041,"p99_ms":7.895125,"rows":49767000,"rows_per_second":4975016.06054384,"seconds":10.003384792} +=== RUN TestTransportComparison/durable=false/c=16/rep=2/native +2026/09/08 09:24:27 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":1954.849820058997,"concurrency":16,"cpu_cores_client_and_server":8.843126095230799,"durable":false,"errors":0,"mode":"native","p50_ms":3.130334,"p95_ms":7.114459,"p99_ms":9.972708,"rows":46104000,"rows_per_second":4609332.824217873,"seconds":10.00231525} +=== RUN TestTransportComparison/durable=false/c=16/rep=3/native +2026/09/08 09:24:37 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":1961.0370257659515,"concurrency":16,"cpu_cores_client_and_server":10.23542983013505,"durable":false,"errors":0,"mode":"native","p50_ms":2.757583,"p95_ms":6.046208,"p99_ms":7.41125,"rows":53365000,"rows_per_second":5335229.726618022,"seconds":10.002380916} +=== RUN TestTransportComparison/durable=false/c=16/rep=3/shared +2026/09/08 09:24:47 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":1981.4924883456838,"concurrency":16,"cpu_cores_client_and_server":10.292444172154767,"durable":false,"errors":0,"mode":"shared","p50_ms":2.8625,"p95_ms":6.068416,"p99_ms":7.409542,"rows":51955000,"rows_per_second":5194012.650847724,"seconds":10.002863584} +=== RUN TestTransportComparison/durable=true/c=1/rep=1/native +2026/09/08 09:24:57 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":3932.1484444444445,"concurrency":1,"cpu_cores_client_and_server":0.1526923273839045,"durable":true,"errors":0,"mode":"native","p50_ms":38.967166,"p95_ms":45.813792,"p99_ms":49.388542,"rows":252000,"rows_per_second":25170.777251163567,"seconds":10.011609792} +=== RUN TestTransportComparison/durable=true/c=1/rep=1/shared +2026/09/08 09:25:07 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":3967.582976,"concurrency":1,"cpu_cores_client_and_server":0.16019880419809268,"durable":true,"errors":0,"mode":"shared","p50_ms":39.060458,"p95_ms":45.031083,"p99_ms":48.052708,"rows":250000,"rows_per_second":24952.665001599085,"seconds":10.018969917} +=== RUN TestTransportComparison/durable=true/c=1/rep=2/shared +2026/09/08 09:25:18 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":3934.2855843137254,"concurrency":1,"cpu_cores_client_and_server":0.16431193790352888,"durable":true,"errors":0,"mode":"shared","p50_ms":38.887167,"p95_ms":44.072084,"p99_ms":47.978208,"rows":255000,"rows_per_second":25450.023364104516,"seconds":10.019637167} +=== RUN TestTransportComparison/durable=true/c=1/rep=2/native +2026/09/08 09:25:28 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":3954.68196875,"concurrency":1,"cpu_cores_client_and_server":0.15213216881861105,"durable":true,"errors":0,"mode":"native","p50_ms":38.871625,"p95_ms":43.972292,"p99_ms":46.758167,"rows":256000,"rows_per_second":25572.04123321355,"seconds":10.010933334} +=== RUN TestTransportComparison/durable=true/c=1/rep=3/native +2026/09/08 09:25:39 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":3962.5928971962617,"concurrency":1,"cpu_cores_client_and_server":0.10835271108696926,"durable":true,"errors":0,"mode":"native","p50_ms":43.871792,"p95_ms":62.9245,"p99_ms":69.515125,"rows":214000,"rows_per_second":21316.058162309007,"seconds":10.039379625} +=== RUN TestTransportComparison/durable=true/c=1/rep=3/shared +2026/09/08 09:25:49 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":3965.29671875,"concurrency":1,"cpu_cores_client_and_server":0.15934341461007848,"durable":true,"errors":0,"mode":"shared","p50_ms":38.152041,"p95_ms":44.984292,"p99_ms":47.031625,"rows":256000,"rows_per_second":25585.791889941116,"seconds":10.005553125} +=== RUN TestTransportComparison/durable=true/c=16/rep=1/native +2026/09/08 09:26:00 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":4384.688459183673,"concurrency":16,"cpu_cores_client_and_server":1.0979446755771467,"durable":true,"errors":0,"mode":"native","p50_ms":51.31025,"p95_ms":58.145042,"p99_ms":61.531208,"rows":3136000,"rows_per_second":312193.6858291852,"seconds":10.045046208} +=== RUN TestTransportComparison/durable=true/c=16/rep=1/shared +2026/09/08 09:26:15 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":4435.00769402985,"concurrency":16,"cpu_cores_client_and_server":1.2326325489358088,"durable":true,"errors":0,"mode":"shared","p50_ms":49.280917,"p95_ms":56.741875,"p99_ms":58.569708,"rows":3216000,"rows_per_second":320595.9336104238,"seconds":10.03131875} +=== RUN TestTransportComparison/durable=true/c=16/rep=2/shared +2026/09/08 09:26:29 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":4437.08422162324,"concurrency":16,"cpu_cores_client_and_server":1.2485428225271538,"durable":true,"errors":0,"mode":"shared","p50_ms":47.988375,"p95_ms":54.267709,"p99_ms":57.947375,"rows":3339000,"rows_per_second":332345.6347210742,"seconds":10.046769541} +=== RUN TestTransportComparison/durable=true/c=16/rep=2/native +2026/09/08 09:26:44 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":4399.0799876237625,"concurrency":16,"cpu_cores_client_and_server":1.2168461407210889,"durable":true,"errors":0,"mode":"native","p50_ms":49.54425,"p95_ms":56.040916,"p99_ms":60.273375,"rows":3232000,"rows_per_second":323135.08351888845,"seconds":10.002008958} +=== RUN TestTransportComparison/durable=true/c=16/rep=3/native +2026/09/08 09:26:59 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":4394.639358536585,"concurrency":16,"cpu_cores_client_and_server":1.2036325654104647,"durable":true,"errors":0,"mode":"native","p50_ms":48.741959,"p95_ms":56.026459,"p99_ms":59.231583,"rows":3280000,"rows_per_second":326997.2370743304,"seconds":10.030665792} +=== RUN TestTransportComparison/durable=true/c=16/rep=3/shared +2026/09/08 09:27:14 INFO migrations applied + transport_bench_test.go:230: RESULT {"allocated_bytes_per_row":4453.083403381643,"concurrency":16,"cpu_cores_client_and_server":1.2782997399849019,"durable":true,"errors":0,"mode":"shared","p50_ms":47.938416,"p95_ms":54.979458,"p99_ms":58.008667,"rows":3312000,"rows_per_second":330111.723454227,"seconds":10.032966916} +--- PASS: TestTransportComparison (272.63s) + --- PASS: TestTransportComparison/durable=false/c=1/rep=1/native (10.02s) + --- PASS: TestTransportComparison/durable=false/c=1/rep=1/shared (10.01s) + --- PASS: TestTransportComparison/durable=false/c=1/rep=2/shared (10.01s) + --- PASS: TestTransportComparison/durable=false/c=1/rep=2/native (10.01s) + --- PASS: TestTransportComparison/durable=false/c=1/rep=3/native (10.01s) + --- PASS: TestTransportComparison/durable=false/c=1/rep=3/shared (10.01s) + --- PASS: TestTransportComparison/durable=false/c=16/rep=1/native (10.08s) + --- PASS: TestTransportComparison/durable=false/c=16/rep=1/shared (10.08s) + --- PASS: TestTransportComparison/durable=false/c=16/rep=2/shared (10.07s) + --- PASS: TestTransportComparison/durable=false/c=16/rep=2/native (10.07s) + --- PASS: TestTransportComparison/durable=false/c=16/rep=3/native (10.07s) + --- PASS: TestTransportComparison/durable=false/c=16/rep=3/shared (10.07s) + --- PASS: TestTransportComparison/durable=true/c=1/rep=1/native (10.50s) + --- PASS: TestTransportComparison/durable=true/c=1/rep=1/shared (10.51s) + --- PASS: TestTransportComparison/durable=true/c=1/rep=2/shared (10.50s) + --- PASS: TestTransportComparison/durable=true/c=1/rep=2/native (10.51s) + --- PASS: TestTransportComparison/durable=true/c=1/rep=3/native (10.57s) + --- PASS: TestTransportComparison/durable=true/c=1/rep=3/shared (10.53s) + --- PASS: TestTransportComparison/durable=true/c=16/rep=1/native (14.75s) + --- PASS: TestTransportComparison/durable=true/c=16/rep=1/shared (14.69s) + --- PASS: TestTransportComparison/durable=true/c=16/rep=2/shared (15.12s) + --- PASS: TestTransportComparison/durable=true/c=16/rep=2/native (14.69s) + --- PASS: TestTransportComparison/durable=true/c=16/rep=3/native (15.02s) + --- PASS: TestTransportComparison/durable=true/c=16/rep=3/shared (14.72s) +PASS +ok github.com/labstack/fanout/internal/ingest 273.072s diff --git a/docs/benchmarks/single-port-2026-09-08.md b/docs/benchmarks/single-port-2026-09-08.md new file mode 100644 index 000000000..20ab0e891 --- /dev/null +++ b/docs/benchmarks/single-port-2026-09-08.md @@ -0,0 +1,87 @@ +# Single-port gRPC comparison — 2026-09-08 + +## Final implementation: Go's built-in HTTP/2 server + +The implementation uses `internal/server.New` with HTTP/1, HTTP/2 over TLS and unencrypted HTTP/2 enabled through `http.Protocols`. It needs no h2c wrapper. The benchmark harness now calls this production factory directly. + +All twelve durable-write cases passed: three repetitions each for native and shared gRPC at one and sixteen concurrent exporters. All acknowledgements matched the server row counts, and all Parquet repositories passed verification. The workload, machine and measurement method match the prototype experiment below. + +| Exporters | Native rows/s | Shared rows/s | Change | Native p95 | Shared p95 | Native p99 | Shared p99 | +|---|---:|---:|---:|---:|---:|---:|---:| +| 1 | 24,526 | 25,028 | +2.0% | 48.83 ms | 44.98 ms | 50.18 ms | 48.19 ms | +| 16 | 325,896 | 326,300 | +0.1% | 55.38 ms | 54.53 ms | 59.41 ms | 58.53 ms | + +Throughput and tail latency showed no regression in these local durable workloads. Treat the small throughput differences as run variation. At sixteen exporters, combined client/server CPU rose from 1.177 to 1.327 cores (12.8%); allocated bytes per accepted row rose from 4,409 to 4,442 (0.8%). The transport is not cost-free. These measurements do not isolate server CPU and do not certify production capacity or performance under concurrent dashboard traffic. + +Raw final evidence: [test log](single-port-stdlib-2026-09-08.log), [JSON measurements](single-port-stdlib-2026-09-08.json). + +Reproduce the final durable comparison: + +```sh +rtk just test '-tags transportbench ./internal/ingest -run ^TestTransportComparison$/durable=true -v -count=1 -timeout=10m' +``` + +Functional validation also passed: full Go suite, 122 UI tests, 13 focused shared-listener tests under the race detector, lint, dependency notices, release-script tests, UI dependency audits, generated docs, diagram consistency and the documentation build. Those tests cover HTTP and gRPC on one port, plaintext and TLS, credential separation, invalid ingest routes, export draining and forced cancellation of long-lived HTTP/2 streams. + +## Original prototype experiment + +The following measurements are retained as historical evidence for the earlier `h2c.NewHandler` prototype. The current harness uses the final factory above, so rerunning it exercises the final implementation rather than reproducing that wrapper verbatim. + + +The local experiment found no durable-ingest throughput or tail-latency regression from using gRPC ServeHTTP behind the proposed h2c dispatcher. Median durable throughput was 1.1% higher with one exporter and 2.2% higher with sixteen; these small differences should be treated as run variation, not a demonstrated speedup. This is local engineering evidence, not a production capacity certification. + +## Durable ingest results + +Values are medians of three runs. Each latency value is the median of the three per-run percentiles, not a percentile pooled across runs. + +| Exporters | Native rows/s | Shared rows/s | Change | Native p95 | Shared p95 | Native p99 | Shared p99 | +|---|---:|---:|---:|---:|---:|---:|---:| +| 1 | 25,171 | 25,450 | +1.1% | 45.81 ms | 44.98 ms | 49.39 ms | 47.98 ms | +| 16 | 323,135 | 330,112 | +2.2% | 56.04 ms | 54.98 ms | 60.27 ms | 58.01 ms | + +## All measurements + +CPU includes the generator and server in the same process. Allocated bytes are cumulative allocation per accepted row, not retained memory or peak RSS. The non-durable runs count converted rows without storing them, and must not be interpreted as Fanout's durable ingest capacity. + +| Durable | Exporters | Mode | Median rows/s | Rows/s range | CPU cores | Allocated bytes/row | +|---|---:|---|---:|---|---:|---:| +| False | 1 | native | 900,673 | 892,355–906,928 | 1.686 | 2,065 | +| False | 1 | shared | 866,387 | 835,664–876,795 | 1.785 | 2,235 | +| False | 16 | native | 4,744,632 | 4,609,333–5,335,230 | 9.113 | 1,961 | +| False | 16 | shared | 5,165,203 | 4,975,016–5,194,013 | 10.292 | 1,982 | +| True | 1 | native | 25,171 | 21,316–25,572 | 0.152 | 3,955 | +| True | 1 | shared | 25,450 | 24,953–25,586 | 0.160 | 3,965 | +| True | 16 | native | 323,135 | 312,194–326,997 | 1.204 | 4,395 | +| True | 16 | shared | 330,112 | 320,596–332,346 | 1.249 | 4,437 | + +Without storage, one exporter was 3.8% slower on the shared transport and allocated approximately 8.2% more bytes per row. At sixteen exporters the shared median was higher, but the throughput ranges overlapped. This does not establish a universal transport advantage or penalty. With durable writes and sixteen exporters, combined CPU medians were 1.204 versus 1.249 cores, and allocation per row rose approximately 1.0%. + +## Method + +- Fanout revision: `9c6567c24a591f233faaaa950a4be2e7912efc32`; production code unchanged. +- Go 1.27.0, darwin/arm64, 14 logical CPUs and GOMAXPROCS=14; grpc-go v1.83.2. +- Real loopback TCP, plaintext gRPC. Native `grpc.Server.Serve` versus `grpc.Server.ServeHTTP` wrapped in `h2c.NewHandler` and the proposed content-type/path dispatcher. +- Same production ingest authentication interceptor, temporary SQLite settings store, and OTLP conversion handlers in both modes. Generated temporary credentials are never logged. +- 1,000-row exports cycling through traces, logs and gauge metric points. Each worker owns a persistent gRPC connection with one outstanding export. Requests reuse the existing small test fixtures; values have low cardinality and are repeated. +- Each connection and all three signals are warmed before timing. Each measured case issues requests for ten seconds, then waits for in-flight acknowledgements; that drain time is included in throughput. +- Three repetitions for each mode at one and sixteen workers, with native/shared order reversed in repetition two. Runs are sequential, with a fresh store for every case. +- Durable mode uses the production writer, default 50,000-row batch target, and a fresh temporary Parquet repository. Counting occurs only after Submit succeeds. Accepted server rows must exactly equal successful exports times 1,000. +- Zero export errors in all 24 cases. Every durable repository passed VerifyBatches after writer shutdown. The earlier four-second smoke matrix also passed, but its timings are not included here. + +## Limits and decision + +Proceeding with a single-port prototype is supported by these results: the tested durable workloads did not show a performance regression. They do not prove zero overhead or establish equivalence across workloads. There are only three short repetitions, the laptop is not a dedicated benchmark host, and client/server CPU contention and filesystem behavior affect the measurements. + +TLS, an actual reverse proxy, remote network latency, concurrent dashboard/API queries, RSS, OTLP/HTTP load, compression, larger or higher-cardinality payloads, sustained saturation and production lifecycle behavior were not measured. The normal app server was not started: its fallback in the isolated dispatcher returns 404. Production auth-boundary and shutdown integration still require their own tests when implementing the feature. + +The independent fanout-bench suite was inspected but not used: its managed path requires a provisioned Linux host. Before claiming deployment-wide performance equivalence, repeat the comparison on the target Linux host with representative telemetry and concurrent read load. + +## Reproduce + +The experiment is build-tagged and excluded from normal tests: + +```sh +rtk proxy env GOTOOLCHAIN=go1.27.0 go test -tags transportbench ./internal/ingest -run '^TestTransportComparison$' -v -count=1 -timeout=10m +``` + +Raw evidence: [test log](single-port-2026-09-08.log), [JSON measurements](single-port-2026-09-08.json), [harness](../../internal/ingest/transport_bench_test.go). diff --git a/docs/benchmarks/single-port-stdlib-2026-09-08.json b/docs/benchmarks/single-port-stdlib-2026-09-08.json new file mode 100644 index 000000000..19ed47b33 --- /dev/null +++ b/docs/benchmarks/single-port-stdlib-2026-09-08.json @@ -0,0 +1,170 @@ +[ + { + "allocated_bytes_per_row": 3945.206243902439, + "concurrency": 1, + "cpu_cores_client_and_server": 0.146333894075857, + "durable": true, + "errors": 0, + "mode": "native", + "p50_ms": 39.925292, + "p95_ms": 47.1955, + "p99_ms": 49.865125, + "rows": 246000, + "rows_per_second": 24526.31976662056, + "seconds": 10.030041292 + }, + { + "allocated_bytes_per_row": 3930.7976356275303, + "concurrency": 1, + "cpu_cores_client_and_server": 0.14484815287822964, + "durable": true, + "errors": 0, + "mode": "shared", + "p50_ms": 40.84975, + "p95_ms": 46.052958, + "p99_ms": 48.194958, + "rows": 247000, + "rows_per_second": 24618.919334652703, + "seconds": 10.032934291 + }, + { + "allocated_bytes_per_row": 3854.1562071713147, + "concurrency": 1, + "cpu_cores_client_and_server": 0.15097412191439982, + "durable": true, + "errors": 0, + "mode": "shared", + "p50_ms": 39.2065, + "p95_ms": 44.976666, + "p99_ms": 48.267792, + "rows": 251000, + "rows_per_second": 25028.205131931874, + "seconds": 10.028685584 + }, + { + "allocated_bytes_per_row": 3897.151394957983, + "concurrency": 1, + "cpu_cores_client_and_server": 0.14661725025933367, + "durable": true, + "errors": 0, + "mode": "native", + "p50_ms": 42.032416, + "p95_ms": 48.907666, + "p99_ms": 51.136625, + "rows": 238000, + "rows_per_second": 23734.89863359627, + "seconds": 10.027428542 + }, + { + "allocated_bytes_per_row": 3882.825702811245, + "concurrency": 1, + "cpu_cores_client_and_server": 0.1426491135595872, + "durable": true, + "errors": 0, + "mode": "native", + "p50_ms": 39.078625, + "p95_ms": 48.826792, + "p99_ms": 50.178542, + "rows": 249000, + "rows_per_second": 24840.100170104146, + "seconds": 10.024114166 + }, + { + "allocated_bytes_per_row": 3860.12705511811, + "concurrency": 1, + "cpu_cores_client_and_server": 0.1874227890608438, + "durable": true, + "errors": 0, + "mode": "shared", + "p50_ms": 38.953792, + "p95_ms": 43.977375, + "p99_ms": 47.464416, + "rows": 254000, + "rows_per_second": 25359.20412085933, + "seconds": 10.016087208 + }, + { + "allocated_bytes_per_row": 4408.656080882353, + "concurrency": 16, + "cpu_cores_client_and_server": 1.2766668814177105, + "durable": true, + "errors": 0, + "mode": "native", + "p50_ms": 48.944, + "p95_ms": 55.227084, + "p99_ms": 59.405833, + "rows": 3264000, + "rows_per_second": 325895.7333843411, + "seconds": 10.01547325 + }, + { + "allocated_bytes_per_row": 4449.913323529412, + "concurrency": 16, + "cpu_cores_client_and_server": 1.3294230659456743, + "durable": true, + "errors": 0, + "mode": "shared", + "p50_ms": 49.078709, + "p95_ms": 54.261042, + "p99_ms": 57.480583, + "rows": 3264000, + "rows_per_second": 326299.92381336645, + "seconds": 10.003067 + }, + { + "allocated_bytes_per_row": 4439.541574257426, + "concurrency": 16, + "cpu_cores_client_and_server": 1.3270159228705851, + "durable": true, + "errors": 0, + "mode": "shared", + "p50_ms": 49.207083, + "p95_ms": 56.226542, + "p99_ms": 59.5035, + "rows": 3232000, + "rows_per_second": 322148.3627771322, + "seconds": 10.0326445 + }, + { + "allocated_bytes_per_row": 4385.397882681565, + "concurrency": 16, + "cpu_cores_client_and_server": 1.006868867588621, + "durable": true, + "errors": 0, + "mode": "native", + "p50_ms": 48.135958, + "p95_ms": 102.589958, + "p99_ms": 147.188333, + "rows": 2864000, + "rows_per_second": 286068.59668245824, + "seconds": 10.01158475 + }, + { + "allocated_bytes_per_row": 4411.760161057692, + "concurrency": 16, + "cpu_cores_client_and_server": 1.1766323221883561, + "durable": true, + "errors": 0, + "mode": "native", + "p50_ms": 47.915458, + "p95_ms": 55.384167, + "p99_ms": 59.140833, + "rows": 3328000, + "rows_per_second": 332615.7807498317, + "seconds": 10.0055385 + }, + { + "allocated_bytes_per_row": 4442.297849282297, + "concurrency": 16, + "cpu_cores_client_and_server": 1.2361489518626845, + "durable": true, + "errors": 0, + "mode": "shared", + "p50_ms": 47.525083, + "p95_ms": 54.529584, + "p99_ms": 58.530417, + "rows": 3344000, + "rows_per_second": 332983.25474749616, + "seconds": 10.042547042 + } +] diff --git a/docs/benchmarks/single-port-stdlib-2026-09-08.log b/docs/benchmarks/single-port-stdlib-2026-09-08.log new file mode 100644 index 000000000..1303de98e --- /dev/null +++ b/docs/benchmarks/single-port-stdlib-2026-09-08.log @@ -0,0 +1,53 @@ +=== RUN TestTransportComparison + transport_bench_test.go:36: environment go=go1.27.0 os=darwin arch=arm64 CPUs=14 GOMAXPROCS=14 +=== RUN TestTransportComparison/durable=true/c=1/rep=1/native +2026/09/08 09:42:42 INFO migrations applied + transport_bench_test.go:213: RESULT {"allocated_bytes_per_row":3945.206243902439,"concurrency":1,"cpu_cores_client_and_server":0.146333894075857,"durable":true,"errors":0,"mode":"native","p50_ms":39.925292,"p95_ms":47.1955,"p99_ms":49.865125,"rows":246000,"rows_per_second":24526.31976662056,"seconds":10.030041292} +=== RUN TestTransportComparison/durable=true/c=1/rep=1/shared +2026/09/08 09:42:53 INFO migrations applied + transport_bench_test.go:213: RESULT {"allocated_bytes_per_row":3930.7976356275303,"concurrency":1,"cpu_cores_client_and_server":0.14484815287822964,"durable":true,"errors":0,"mode":"shared","p50_ms":40.84975,"p95_ms":46.052958,"p99_ms":48.194958,"rows":247000,"rows_per_second":24618.919334652703,"seconds":10.032934291} +=== RUN TestTransportComparison/durable=true/c=1/rep=2/shared +2026/09/08 09:43:03 INFO migrations applied + transport_bench_test.go:213: RESULT {"allocated_bytes_per_row":3854.1562071713147,"concurrency":1,"cpu_cores_client_and_server":0.15097412191439982,"durable":true,"errors":0,"mode":"shared","p50_ms":39.2065,"p95_ms":44.976666,"p99_ms":48.267792,"rows":251000,"rows_per_second":25028.205131931874,"seconds":10.028685584} +=== RUN TestTransportComparison/durable=true/c=1/rep=2/native +2026/09/08 09:43:14 INFO migrations applied + transport_bench_test.go:213: RESULT {"allocated_bytes_per_row":3897.151394957983,"concurrency":1,"cpu_cores_client_and_server":0.14661725025933367,"durable":true,"errors":0,"mode":"native","p50_ms":42.032416,"p95_ms":48.907666,"p99_ms":51.136625,"rows":238000,"rows_per_second":23734.89863359627,"seconds":10.027428542} +=== RUN TestTransportComparison/durable=true/c=1/rep=3/native +2026/09/08 09:43:24 INFO migrations applied + transport_bench_test.go:213: RESULT {"allocated_bytes_per_row":3882.825702811245,"concurrency":1,"cpu_cores_client_and_server":0.1426491135595872,"durable":true,"errors":0,"mode":"native","p50_ms":39.078625,"p95_ms":48.826792,"p99_ms":50.178542,"rows":249000,"rows_per_second":24840.100170104146,"seconds":10.024114166} +=== RUN TestTransportComparison/durable=true/c=1/rep=3/shared +2026/09/08 09:43:35 INFO migrations applied + transport_bench_test.go:213: RESULT {"allocated_bytes_per_row":3860.12705511811,"concurrency":1,"cpu_cores_client_and_server":0.1874227890608438,"durable":true,"errors":0,"mode":"shared","p50_ms":38.953792,"p95_ms":43.977375,"p99_ms":47.464416,"rows":254000,"rows_per_second":25359.20412085933,"seconds":10.016087208} +=== RUN TestTransportComparison/durable=true/c=16/rep=1/native +2026/09/08 09:43:45 INFO migrations applied + transport_bench_test.go:213: RESULT {"allocated_bytes_per_row":4408.656080882353,"concurrency":16,"cpu_cores_client_and_server":1.2766668814177105,"durable":true,"errors":0,"mode":"native","p50_ms":48.944,"p95_ms":55.227084,"p99_ms":59.405833,"rows":3264000,"rows_per_second":325895.7333843411,"seconds":10.01547325} +=== RUN TestTransportComparison/durable=true/c=16/rep=1/shared +2026/09/08 09:44:00 INFO migrations applied + transport_bench_test.go:213: RESULT {"allocated_bytes_per_row":4449.913323529412,"concurrency":16,"cpu_cores_client_and_server":1.3294230659456743,"durable":true,"errors":0,"mode":"shared","p50_ms":49.078709,"p95_ms":54.261042,"p99_ms":57.480583,"rows":3264000,"rows_per_second":326299.92381336645,"seconds":10.003067} +=== RUN TestTransportComparison/durable=true/c=16/rep=2/shared +2026/09/08 09:44:15 INFO migrations applied + transport_bench_test.go:213: RESULT {"allocated_bytes_per_row":4439.541574257426,"concurrency":16,"cpu_cores_client_and_server":1.3270159228705851,"durable":true,"errors":0,"mode":"shared","p50_ms":49.207083,"p95_ms":56.226542,"p99_ms":59.5035,"rows":3232000,"rows_per_second":322148.3627771322,"seconds":10.0326445} +=== RUN TestTransportComparison/durable=true/c=16/rep=2/native +2026/09/08 09:44:29 INFO migrations applied + transport_bench_test.go:213: RESULT {"allocated_bytes_per_row":4385.397882681565,"concurrency":16,"cpu_cores_client_and_server":1.006868867588621,"durable":true,"errors":0,"mode":"native","p50_ms":48.135958,"p95_ms":102.589958,"p99_ms":147.188333,"rows":2864000,"rows_per_second":286068.59668245824,"seconds":10.01158475} +=== RUN TestTransportComparison/durable=true/c=16/rep=3/native +2026/09/08 09:44:44 INFO migrations applied + transport_bench_test.go:213: RESULT {"allocated_bytes_per_row":4411.760161057692,"concurrency":16,"cpu_cores_client_and_server":1.1766323221883561,"durable":true,"errors":0,"mode":"native","p50_ms":47.915458,"p95_ms":55.384167,"p99_ms":59.140833,"rows":3328000,"rows_per_second":332615.7807498317,"seconds":10.0055385} +=== RUN TestTransportComparison/durable=true/c=16/rep=3/shared +2026/09/08 09:44:59 INFO migrations applied + transport_bench_test.go:213: RESULT {"allocated_bytes_per_row":4442.297849282297,"concurrency":16,"cpu_cores_client_and_server":1.2361489518626845,"durable":true,"errors":0,"mode":"shared","p50_ms":47.525083,"p95_ms":54.529584,"p99_ms":58.530417,"rows":3344000,"rows_per_second":332983.25474749616,"seconds":10.042547042} +--- PASS: TestTransportComparison (152.17s) + --- PASS: TestTransportComparison/durable=true/c=1/rep=1/native (10.56s) + --- PASS: TestTransportComparison/durable=true/c=1/rep=1/shared (10.51s) + --- PASS: TestTransportComparison/durable=true/c=1/rep=2/shared (10.54s) + --- PASS: TestTransportComparison/durable=true/c=1/rep=2/native (10.51s) + --- PASS: TestTransportComparison/durable=true/c=1/rep=3/native (10.54s) + --- PASS: TestTransportComparison/durable=true/c=1/rep=3/shared (10.50s) + --- PASS: TestTransportComparison/durable=true/c=16/rep=1/native (14.72s) + --- PASS: TestTransportComparison/durable=true/c=16/rep=1/shared (14.68s) + --- PASS: TestTransportComparison/durable=true/c=16/rep=2/shared (14.72s) + --- PASS: TestTransportComparison/durable=true/c=16/rep=2/native (14.62s) + --- PASS: TestTransportComparison/durable=true/c=16/rep=3/native (15.38s) + --- PASS: TestTransportComparison/durable=true/c=16/rep=3/shared (14.91s) +PASS +ok github.com/labstack/fanout/internal/ingest 152.730s diff --git a/docs/diagrams/architecture.d2 b/docs/diagrams/architecture.d2 index 8a8ca36fa..1aa4d40f2 100644 --- a/docs/diagrams/architecture.d2 +++ b/docs/diagrams/architecture.d2 @@ -21,7 +21,7 @@ fanout: "fanout — one Go process" { style.stroke-width: 2 http: "HTTP :7520\nroutes + auth middleware" - ingest: "Ingest\nOTLP gRPC :4317 + HTTP :4318" + ingest: "Ingest\nOTLP gRPC + HTTP :7520" ui: "Embedded React assets" agent: "Agent runtime\nmodel + tool loop" mcp: "MCP server\n5 typed + 4 dashboard tools" diff --git a/docs/diagrams/architecture.svg b/docs/diagrams/architecture.svg index 47ec18192..01633b3e2 100644 --- a/docs/diagrams/architecture.svg +++ b/docs/diagrams/architecture.svg @@ -1,24 +1,24 @@ -Clientsfanout — one Go processStorageAnthropic or OpenAIOTLP collector or SDKBrowserExternal MCP hostHTTP :7520routes + auth middlewareIngestOTLP gRPC :4317 + HTTP :4318Embedded React assetsAgent runtimemodel + tool loopMCP server5 typed + 4 dashboard toolsTyped observability contractTelemetry commit workersatomic Parquet batchesQuery kernelDuckDB + rollupsStorage maintenanceretention + native compactionAlert enginerule evaluation + webhooksParquet batches + trace indexesstorage.data_dir/telemetryDuckDB query statestorage.data_dir/queryControl SQLitestorage.data_dir/control serves embedded assetsAG-UI streamin-memory transporttyped HTTP APIevaluates rollupsOTLP/gRPC or OTLP/HTTPHTTPS/mcp — OAuthindexed traces + SQL scansatomic replacementusers, sessions, settings, dashboards, threadsrules and fired alertsHTTPS - - - - - - - - - - - - - - + .d2-625626608 .fill-N1{fill:#0A0F25;} + .d2-625626608 .fill-N2{fill:#676C7E;} + .d2-625626608 .fill-N3{fill:#9499AB;} + .d2-625626608 .fill-N4{fill:#CFD2DD;} + .d2-625626608 .fill-N5{fill:#DEE1EB;} + .d2-625626608 .fill-N6{fill:#EEF1F8;} + .d2-625626608 .fill-N7{fill:#FFFFFF;} + .d2-625626608 .fill-B1{fill:#000536;} + .d2-625626608 .fill-B2{fill:#0F66B7;} + .d2-625626608 .fill-B3{fill:#4393DD;} + .d2-625626608 .fill-B4{fill:#87BFF3;} + .d2-625626608 .fill-B5{fill:#BCDDFB;} + .d2-625626608 .fill-B6{fill:#E5F3FF;} + .d2-625626608 .fill-AA2{fill:#7639C5;} + .d2-625626608 .fill-AA4{fill:#C1A2F3;} + .d2-625626608 .fill-AA5{fill:#DACEFB;} + .d2-625626608 .fill-AB4{fill:#EA99C6;} + .d2-625626608 .fill-AB5{fill:#FFDEF1;} + .d2-625626608 .stroke-N1{stroke:#0A0F25;} + .d2-625626608 .stroke-N2{stroke:#676C7E;} + .d2-625626608 .stroke-N3{stroke:#9499AB;} + .d2-625626608 .stroke-N4{stroke:#CFD2DD;} + .d2-625626608 .stroke-N5{stroke:#DEE1EB;} + .d2-625626608 .stroke-N6{stroke:#EEF1F8;} + .d2-625626608 .stroke-N7{stroke:#FFFFFF;} + .d2-625626608 .stroke-B1{stroke:#000536;} + .d2-625626608 .stroke-B2{stroke:#0F66B7;} + .d2-625626608 .stroke-B3{stroke:#4393DD;} + .d2-625626608 .stroke-B4{stroke:#87BFF3;} + .d2-625626608 .stroke-B5{stroke:#BCDDFB;} + .d2-625626608 .stroke-B6{stroke:#E5F3FF;} + .d2-625626608 .stroke-AA2{stroke:#7639C5;} + .d2-625626608 .stroke-AA4{stroke:#C1A2F3;} + .d2-625626608 .stroke-AA5{stroke:#DACEFB;} + .d2-625626608 .stroke-AB4{stroke:#EA99C6;} + .d2-625626608 .stroke-AB5{stroke:#FFDEF1;} + .d2-625626608 .background-color-N1{background-color:#0A0F25;} + .d2-625626608 .background-color-N2{background-color:#676C7E;} + .d2-625626608 .background-color-N3{background-color:#9499AB;} + .d2-625626608 .background-color-N4{background-color:#CFD2DD;} + .d2-625626608 .background-color-N5{background-color:#DEE1EB;} + .d2-625626608 .background-color-N6{background-color:#EEF1F8;} + .d2-625626608 .background-color-N7{background-color:#FFFFFF;} + .d2-625626608 .background-color-B1{background-color:#000536;} + .d2-625626608 .background-color-B2{background-color:#0F66B7;} + .d2-625626608 .background-color-B3{background-color:#4393DD;} + .d2-625626608 .background-color-B4{background-color:#87BFF3;} + .d2-625626608 .background-color-B5{background-color:#BCDDFB;} + .d2-625626608 .background-color-B6{background-color:#E5F3FF;} + .d2-625626608 .background-color-AA2{background-color:#7639C5;} + .d2-625626608 .background-color-AA4{background-color:#C1A2F3;} + .d2-625626608 .background-color-AA5{background-color:#DACEFB;} + .d2-625626608 .background-color-AB4{background-color:#EA99C6;} + .d2-625626608 .background-color-AB5{background-color:#FFDEF1;} + .d2-625626608 .color-N1{color:#0A0F25;} + .d2-625626608 .color-N2{color:#676C7E;} + .d2-625626608 .color-N3{color:#9499AB;} + .d2-625626608 .color-N4{color:#CFD2DD;} + .d2-625626608 .color-N5{color:#DEE1EB;} + .d2-625626608 .color-N6{color:#EEF1F8;} + .d2-625626608 .color-N7{color:#FFFFFF;} + .d2-625626608 .color-B1{color:#000536;} + .d2-625626608 .color-B2{color:#0F66B7;} + .d2-625626608 .color-B3{color:#4393DD;} + .d2-625626608 .color-B4{color:#87BFF3;} + .d2-625626608 .color-B5{color:#BCDDFB;} + .d2-625626608 .color-B6{color:#E5F3FF;} + .d2-625626608 .color-AA2{color:#7639C5;} + .d2-625626608 .color-AA4{color:#C1A2F3;} + .d2-625626608 .color-AA5{color:#DACEFB;} + .d2-625626608 .color-AB4{color:#EA99C6;} + .d2-625626608 .color-AB5{color:#FFDEF1;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#000536;--color-border-muted:#0F66B7;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0F66B7;--color-accent-emphasis:#0F66B7;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker-d2-625626608);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-dark-d2-625626608);mix-blend-mode:overlay}.sketch-overlay-B3{fill:url(#streaks-dark-d2-625626608);mix-blend-mode:overlay}.sketch-overlay-B4{fill:url(#streaks-normal-d2-625626608);mix-blend-mode:color-burn}.sketch-overlay-B5{fill:url(#streaks-normal-d2-625626608);mix-blend-mode:color-burn}.sketch-overlay-B6{fill:url(#streaks-bright-d2-625626608);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark-d2-625626608);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-normal-d2-625626608);mix-blend-mode:color-burn}.sketch-overlay-AA5{fill:url(#streaks-normal-d2-625626608);mix-blend-mode:color-burn}.sketch-overlay-AB4{fill:url(#streaks-normal-d2-625626608);mix-blend-mode:color-burn}.sketch-overlay-AB5{fill:url(#streaks-bright-d2-625626608);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker-d2-625626608);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark-d2-625626608);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal-d2-625626608);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal-d2-625626608);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright-d2-625626608);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright-d2-625626608);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright-d2-625626608);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>Clientsfanout — one Go processStorageAnthropic or OpenAIOTLP collector or SDKBrowserExternal MCP hostHTTP :7520routes + auth middlewareIngestOTLP gRPC + HTTP :7520Embedded React assetsAgent runtimemodel + tool loopMCP server5 typed + 4 dashboard toolsTyped observability contractTelemetry commit workersatomic Parquet batchesQuery kernelDuckDB + rollupsStorage maintenanceretention + native compactionAlert enginerule evaluation + webhooksParquet batches + trace indexesstorage.data_dir/telemetryDuckDB query statestorage.data_dir/queryControl SQLitestorage.data_dir/control serves embedded assetsAG-UI streamin-memory transporttyped HTTP APIevaluates rollupsOTLP/gRPC or OTLP/HTTPHTTPS/mcp — OAuthindexed traces + SQL scansatomic replacementusers, sessions, settings, dashboards, threadsrules and fired alertsHTTPS + + + + + + + + + + + + + + diff --git a/docs/operations.md b/docs/operations.md index 49599efd0..e555fc613 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -2,28 +2,25 @@ Fanout 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 -keep the ingest listeners private to trusted services and collectors. +give ingest credentials only to trusted services and collectors. ## Network surface | Default | Purpose | Exposure | |---|---|---| -| `:7520` | Browser, API, MCP, health and metrics | Users or a trusted reverse proxy | -| `127.0.0.1:4317` | OTLP/gRPC | Trusted collectors and backend services | -| `127.0.0.1:4318` | OTLP/HTTP | Trusted collectors and backend services | - -The native ingest defaults are loopback-only. The container configuration uses -`:4317` and `:4318` so explicitly published container ports are reachable. -Every OTLP request still requires the ingest token created during first-admin -setup. Do not embed that shared backend secret in a browser or shipped mobile -application; put a customer-controlled Collector or gateway in front of Fanout -when public clients are involved. - -For OTLP/HTTP, set the exporter protocol to `http/protobuf`, use the base -endpoint `http://fanout:4318`, and supply the ingest token as -`Authorization: Bearer `. Exporters derive the standard `/v1/traces`, -`/v1/metrics`, and `/v1/logs` paths from the base endpoint. OTLP/gRPC uses the -same authorization value as gRPC metadata on port `4317`. +| `:7520` | 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. Set +`FANOUT_ADDR=127.0.0.1:7520` for loopback-only access. Every OTLP request +requires the ingest token created during first-admin setup; 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 +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 @@ -41,9 +38,9 @@ mobile SDK or a public Fanout listener. ## TLS and reverse proxies Setting both `FANOUT_TLS_CERT_FILE` and `FANOUT_TLS_KEY_FILE` enables TLS 1.3 on -the browser, OTLP/gRPC, and OTLP/HTTP listeners. If a reverse proxy terminates -TLS only for the browser listener, keep the ingest listeners on a trusted -private network or terminate their protocols separately. +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. +HTTP/1.1 forwarding supports OTLP/HTTP, but cannot carry gRPC. Set `FANOUT_PUBLIC_URL` to the externally reachable HTTPS browser origin. When using forwarded client addresses, set `FANOUT_TRUSTED_PROXY_CIDRS` to only the @@ -73,8 +70,9 @@ subdirectory does not produce a recoverable installation. 1. Record the running Fanout version and configuration, excluding secrets from ordinary logs or tickets. -2. Stop Fanout cleanly and wait for the process to exit. Shutdown stops both - OTLP listeners before draining the telemetry commit workers. +2. Stop Fanout 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`. @@ -98,6 +96,24 @@ 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 ` as documented in [authentication.md](authentication.md). +## Single-port migration + +This is a breaking configuration change: + +1. Remove `FANOUT_OTLP_GRPC_ADDR` and `FANOUT_OTLP_HTTP_ADDR`, or YAML + `ingest.otlp_grpc_addr` and `ingest.otlp_http_addr`. They are rejected at startup. +2. Rename `FANOUT_HTTP_ADDR` to `FANOUT_ADDR`, or YAML `server.http_addr` + to `server.addr` (default `:7520`). Publish only that container port. +3. Change exporters from ports `4317`/`4318` to `7520`, or to the public HTTPS + origin and port. The ingest token and OTLP signal paths do not change. +4. Enable HTTP/2 backend forwarding for gRPC at any proxy. Remove obsolete + ingest port mappings and proxy upstreams. A separate ingest hostname may + still route to the same Fanout port if required by the edge configuration. +5. Set `FANOUT_PUBLIC_URL` to the external origin so setup instructions advertise + the reachable endpoint. An explicit `FANOUT_INGEST_ADVERTISED_ENDPOINT` wins. + +Local comparison results are in [the single-port benchmark report](benchmarks/single-port-2026-09-08.md). + ## Upgrade and rollback 1. Read the release notes and pin the target image tag or binary version. diff --git a/fanout.docker.yaml b/fanout.docker.yaml index 1a8c78e60..ad49d6e66 100644 --- a/fanout.docker.yaml +++ b/fanout.docker.yaml @@ -1,13 +1,7 @@ -# Container-specific listener and storage defaults. Runtime environment -# variables still override these values. Start replacement container configs -# from this file: omitting either ingest address restores its loopback-only -# built-in default, which is unreachable through a published container port. +# One listener for the browser, API, MCP and both OTLP transports. +# Runtime environment variables override these container defaults. server: - http_addr: ":7520" - -ingest: - otlp_grpc_addr: ":4317" - otlp_http_addr: ":4318" + addr: ":7520" storage: data_dir: /var/lib/fanout/data diff --git a/fanout.example.yaml b/fanout.example.yaml index c8c6eb17e..068695938 100644 --- a/fanout.example.yaml +++ b/fanout.example.yaml @@ -8,7 +8,7 @@ # Null values (a key with nothing after the colon) are rejected. server: - http_addr: ":7520" # FANOUT_HTTP_ADDR + addr: ":7520" # FANOUT_ADDR public_url: "" # FANOUT_PUBLIC_URL trusted_proxy_cidrs: "" # FANOUT_TRUSTED_PROXY_CIDRS pprof_enabled: false # FANOUT_PPROF_ENABLED @@ -17,8 +17,6 @@ server: key_file: "" # FANOUT_TLS_KEY_FILE ingest: - otlp_grpc_addr: "127.0.0.1:4317" # FANOUT_OTLP_GRPC_ADDR - otlp_http_addr: "127.0.0.1:4318" # FANOUT_OTLP_HTTP_ADDR advertised_endpoint: "" # FANOUT_INGEST_ADVERTISED_ENDPOINT default_namespace: default # FANOUT_DEFAULT_NAMESPACE batch_size: 50000 # FANOUT_INGEST_BATCH_SIZE diff --git a/internal/api/auth.go b/internal/api/auth.go index 2ffca624b..0dbedce11 100644 --- a/internal/api/auth.go +++ b/internal/api/auth.go @@ -169,8 +169,8 @@ func (h *AuthHandler) Setup(c *echo.Context) error { resp["ingest_header_name"] = "Authorization" // The endpoint collectors should actually use. Behind a reverse proxy // this is the advertised TLS endpoint (e.g. https://ingest.example.com), - // not the internal :4317 — see suggestedIngestEndpoint. - resp["suggested_endpoint"] = suggestedIngestEndpoint(c.Request(), h.cfg.OTLPGRPCAddr, h.cfg.IngestAdvertisedEndpoint) + // not the internal bind address — see suggestedIngestEndpoint. + resp["suggested_endpoint"] = suggestedIngestEndpoint(c.Request(), h.cfg) } slog.Info("auth: first admin setup completed", "email", email) diff --git a/internal/api/settings.go b/internal/api/settings.go index c905bc27b..6f5f6a05f 100644 --- a/internal/api/settings.go +++ b/internal/api/settings.go @@ -40,7 +40,7 @@ func (h *SettingsHandler) GetIngest(c *echo.Context) error { } return c.JSON(http.StatusOK, ingestResponse{ TokenRequired: current.TokenHash != "", - SuggestedEndpoint: suggestedIngestEndpoint(c.Request(), h.cfg.OTLPGRPCAddr, h.cfg.IngestAdvertisedEndpoint), + SuggestedEndpoint: suggestedIngestEndpoint(c.Request(), h.cfg), TLSConfigured: h.cfg.TLSEnabled(), HeaderName: "Authorization", }) @@ -65,7 +65,7 @@ func (h *SettingsHandler) RotateIngestToken(c *echo.Context) error { c.Response().Header().Set("Cache-Control", "no-store") return c.JSON(http.StatusOK, ingestResponse{ TokenRequired: true, - SuggestedEndpoint: suggestedIngestEndpoint(c.Request(), h.cfg.OTLPGRPCAddr, h.cfg.IngestAdvertisedEndpoint), + SuggestedEndpoint: suggestedIngestEndpoint(c.Request(), h.cfg), TLSConfigured: h.cfg.TLSEnabled(), HeaderName: "Authorization", IngestToken: token, @@ -80,33 +80,26 @@ type ingestResponse struct { IngestToken string `json:"ingest_token,omitempty"` } -func suggestedIngestEndpoint(req *http.Request, grpcAddr, advertised string) string { - // An explicit advertised endpoint (e.g. "https://ingest.example.com") - // wins — it's the only value that's correct behind a reverse proxy, where - // the browser host and the OTLP host differ. - if advertised != "" { - return advertised +func suggestedIngestEndpoint(req *http.Request, cfg config.Config) string { + if cfg.IngestAdvertisedEndpoint != "" { + return cfg.IngestAdvertisedEndpoint } - host, port := splitHostPort(grpcAddr) - bindIP := net.ParseIP(strings.Trim(host, "[]")) - if host == "" || host == "0.0.0.0" || host == "::" || host == "localhost" || (bindIP != nil && bindIP.IsLoopback()) { - host = req.Host - if requestHost, _, err := net.SplitHostPort(req.Host); err == nil { - host = requestHost - } - } - if host == "" { - host = "localhost" + if cfg.PublicURL != "" { + return strings.TrimRight(cfg.PublicURL, "/") } - return net.JoinHostPort(host, port) -} - -func splitHostPort(addr string) (string, string) { - if host, port, err := net.SplitHostPort(addr); err == nil { - return host, port + scheme := "http" + if cfg.TLSEnabled() || req.TLS != nil { + scheme = "https" } - if strings.HasPrefix(addr, ":") { - return "", strings.TrimPrefix(addr, ":") + host := req.Host + if host == "" { + host = cfg.Addr + if bindHost, port, err := net.SplitHostPort(host); err == nil && (bindHost == "" || bindHost == "0.0.0.0" || bindHost == "::") { + host = net.JoinHostPort("localhost", port) + } + if host == "" { + host = "localhost:7520" + } } - return addr, "4317" + return scheme + "://" + host } diff --git a/internal/api/settings_test.go b/internal/api/settings_test.go index e85f04b51..0721143d7 100644 --- a/internal/api/settings_test.go +++ b/internal/api/settings_test.go @@ -21,7 +21,7 @@ func newConfigServer(t *testing.T, cfg config.Config) (*testAuthServer, *setting } func TestGetIngest_EmptyBeforeSetup(t *testing.T) { - s, _ := newConfigServer(t, config.Config{OTLPGRPCAddr: ":4317"}) + s, _ := newConfigServer(t, config.Config{Addr: ":7520"}) admin, _ := s.users.Create("admin@example.com", "", "admin") cookie := s.login(t, admin) req := sessionRequest(http.MethodGet, "/api/settings/ingest", nil, cookie) @@ -35,13 +35,13 @@ 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 != "fanout.example.com:4317" || resp.HeaderName != "Authorization" { + if resp.TokenRequired || resp.SuggestedEndpoint != "http://fanout.example.com:7520" || resp.HeaderName != "Authorization" { t.Fatalf("response = %+v", resp) } } func TestRotateIngestToken_PersistsHashReturnsPlaintext(t *testing.T) { - s, store := newConfigServer(t, config.Config{OTLPGRPCAddr: ":4317"}) + s, store := newConfigServer(t, config.Config{Addr: ":7520"}) admin, _ := s.users.Create("admin@example.com", "", "admin") cookie := s.login(t, admin) req := sessionRequest(http.MethodPost, "/api/settings/ingest/rotate-token", nil, cookie) @@ -62,7 +62,7 @@ func TestRotateIngestToken_PersistsHashReturnsPlaintext(t *testing.T) { } func TestIngestSettingsCapabilities(t *testing.T) { - s, _ := newConfigServer(t, config.Config{OTLPGRPCAddr: ":4317"}) + s, _ := newConfigServer(t, config.Config{Addr: ":7520"}) viewer, _ := s.users.Create("viewer@example.com", "", "viewer") cookie := s.login(t, viewer) readRec := httptest.NewRecorder() @@ -78,18 +78,27 @@ func TestIngestSettingsCapabilities(t *testing.T) { } func TestSuggestedIngestEndpoint(t *testing.T) { - tests := []struct{ name, grpcAddr, advertised, reqHost, want string }{ - {"advertised endpoint wins verbatim", ":4317", "https://ingest.example.com", "fanout.example.com", "https://ingest.example.com"}, - {"wildcard addr derives host from request", ":4317", "", "fanout.example.com:443", "fanout.example.com:4317"}, - {"explicit grpc host is used as-is", "1.2.3.4:5317", "", "ignored.example.com", "1.2.3.4:5317"}, - {"loopback bind advertises application host", "127.0.0.1:4317", "", "fanout.example.com", "fanout.example.com:4317"}, - {"missing request host falls back", ":4317", "", "", "localhost:4317"}, + tests := []struct { + name string + cfg config.Config + host string + want string + }{ + {"advertised wins", config.Config{PublicURL: "https://fanout.example.com", IngestAdvertisedEndpoint: "https://ingest.example.com"}, "ignored", "https://ingest.example.com"}, + {"public origin", config.Config{Addr: ":7520", PublicURL: "https://fanout.example.com/"}, "internal:7520", "https://fanout.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"}, + {"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"}, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { req := httptest.NewRequest(http.MethodGet, "/api/settings/ingest", nil) - req.Host = tc.reqHost - if got := suggestedIngestEndpoint(req, tc.grpcAddr, tc.advertised); got != tc.want { + req.Host = tc.host + req.Header.Set("X-Forwarded-Host", "untrusted.example.com") + req.Header.Set("X-Forwarded-Proto", "https") + if got := suggestedIngestEndpoint(req, tc.cfg); got != tc.want { t.Fatalf("got %q want %q", got, tc.want) } }) diff --git a/internal/api/shared_listener_test.go b/internal/api/shared_listener_test.go new file mode 100644 index 000000000..073070a38 --- /dev/null +++ b/internal/api/shared_listener_test.go @@ -0,0 +1,68 @@ +package api + +import ( + "context" + "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" + "google.golang.org/grpc" +) + +type discardExport struct{} + +func (discardExport) Submit(context.Context, telemetrystore.Batch) error { return nil } + +func TestSharedListenerCredentialBoundaries(t *testing.T) { + s := newTestAuthServer(t) + user, err := s.users.Create("listener@example.com", "", "admin") + if err != nil { + t.Fatal(err) + } + cookie := s.login(t, user) + store := settings.NewStore(s.db.DB) + token, hash, err := settings.GenerateIngestToken() + if err != nil { + t.Fatal(err) + } + if err := store.SetIngest(context.Background(), settings.Ingest{TokenHash: hash}); err != nil { + t.Fatal(err) + } + ing := ingest.NewServer(config.Config{}, discardExport{}) + g := grpc.NewServer(ingest.GRPCServerOptions(store)...) + defer g.Stop() + ingest.RegisterOTLP(g, ing) + h := httpserver.New("", s.e, ingest.NewHTTPHandler(ing, store), g).Handler + for _, tc := range []struct { + name, method, path string + session, ingest bool + want int + }{ + {"session reads API", "GET", "/api/auth/me", true, false, 200}, + {"ingest cannot read API", "GET", "/api/auth/me", false, true, 401}, + {"session cannot export", "POST", "/v1/traces", true, false, 401}, + {"ingest exports without browser CSRF header", "POST", "/v1/traces", false, true, 200}, + {"unknown ingest path", "GET", "/v1/unknown", true, false, 404}, + } { + t.Run(tc.name, func(t *testing.T) { + req := httptest.NewRequest(tc.method, tc.path, strings.NewReader("")) + req.Header.Set("Content-Type", "application/x-protobuf") + if tc.session { + req.AddCookie(cookie) + } + if tc.ingest { + req.Header.Set("Authorization", "Bearer "+token) + } + rec := httptest.NewRecorder() + h.ServeHTTP(rec, req) + if rec.Code != tc.want { + t.Fatalf("status=%d want=%d body=%s", rec.Code, tc.want, rec.Body.String()) + } + }) + } +} diff --git a/internal/config/config.go b/internal/config/config.go index 721937c25..7db8768ef 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -19,14 +19,13 @@ const maxIngestBatchSize = 50_000 // same terminology across YAML, environment variables, Go, logs, and docs. // Elapsed-time settings use time.Duration with unit-bearing values. type Config struct { - HTTPAddr string `koanf:"server.http_addr" env:"FANOUT_HTTP_ADDR" default:":7520"` - OTLPGRPCAddr string `koanf:"ingest.otlp_grpc_addr" env:"FANOUT_OTLP_GRPC_ADDR" default:"127.0.0.1:4317"` - OTLPHTTPAddr string `koanf:"ingest.otlp_http_addr" env:"FANOUT_OTLP_HTTP_ADDR" default:"127.0.0.1:4318"` + // Addr binds the browser, API, MCP, OTLP/gRPC and OTLP/HTTP listener. + Addr string `koanf:"server.addr" env:"FANOUT_ADDR" default:":7520"` // IngestAdvertisedEndpoint is the OTLP endpoint shown in collector setup // guidance (e.g. "https://ingest.example.com"). It is an operator hint for // trusted services and collectors, not a public-client or mobile endpoint; - // unlike OTLPGRPCAddr, it does not control the bind/listen address. Empty means - // derive host:port from the browser request and OTLPGRPCAddr as a best effort. + // it does not control the bind address. Empty uses server.public_url, or + // the browser request origin when no public URL is configured. IngestAdvertisedEndpoint string `koanf:"ingest.advertised_endpoint" env:"FANOUT_INGEST_ADVERTISED_ENDPOINT"` DataDir string `koanf:"storage.data_dir" env:"FANOUT_DATA_DIR" default:"./data"` IngestBatchSize int `koanf:"ingest.batch_size" env:"FANOUT_INGEST_BATCH_SIZE" default:"50000"` @@ -161,7 +160,7 @@ func (c Config) ControlSQLitePath() string { } // TLSEnabled reports whether a cert/key pair is configured. When true, HTTP -// serves HTTPS on server.http_addr and OTLP gRPC accepts TLS. +// serves HTTPS and OTLP gRPC over TLS on server.addr. func (c Config) TLSEnabled() bool { return strings.TrimSpace(c.TLSCertFile) != "" && strings.TrimSpace(c.TLSKeyFile) != "" @@ -169,14 +168,8 @@ func (c Config) TLSEnabled() bool { // Validate checks that config values are sane. func (c Config) Validate() error { - if strings.TrimSpace(c.HTTPAddr) == "" { - return fmt.Errorf("server.http_addr must not be empty") - } - if strings.TrimSpace(c.OTLPGRPCAddr) == "" { - return fmt.Errorf("ingest.otlp_grpc_addr must not be empty") - } - if strings.TrimSpace(c.OTLPHTTPAddr) == "" { - return fmt.Errorf("ingest.otlp_http_addr must not be empty") + if strings.TrimSpace(c.Addr) == "" { + return fmt.Errorf("server.addr must not be empty") } if strings.TrimSpace(c.DataDir) == "" { return fmt.Errorf("storage.data_dir must not be empty") diff --git a/internal/config/config_test.go b/internal/config/config_test.go index bcd169473..6f1e21cbc 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -30,15 +30,10 @@ func TestLoadReturnsDefaults(t *testing.T) { t.Fatalf("Load: %v", err) } - if cfg.HTTPAddr != ":7520" { - t.Errorf("HTTPAddr = %q, want %q", cfg.HTTPAddr, ":7520") - } - if cfg.OTLPGRPCAddr != "127.0.0.1:4317" { - t.Errorf("OTLPGRPCAddr = %q, want %q", cfg.OTLPGRPCAddr, "127.0.0.1:4317") - } - if cfg.OTLPHTTPAddr != "127.0.0.1:4318" { - t.Errorf("OTLPHTTPAddr = %q, want %q", cfg.OTLPHTTPAddr, "127.0.0.1:4318") + if cfg.Addr != ":7520" { + t.Errorf("Addr = %q, want %q", cfg.Addr, ":7520") } + if cfg.DataDir != "./data" { t.Errorf("DataDir = %q, want %q", cfg.DataDir, "./data") } @@ -73,7 +68,7 @@ func TestLoadReturnsDefaults(t *testing.T) { func TestLoadLayering(t *testing.T) { path := filepath.Join(t.TempDir(), "fanout.yaml") if err := os.WriteFile(path, []byte(`server: - http_addr: ":1111" + addr: ":1111" mcp: enabled: false metrics: @@ -87,13 +82,13 @@ auth: cfg, err := Load(LoadOptions{ Path: path, - Environ: append(validEnvironment(), "FANOUT_HTTP_ADDR=:2222"), + Environ: append(validEnvironment(), "FANOUT_ADDR=:2222"), }) if err != nil { t.Fatalf("Load: %v", err) } - if cfg.HTTPAddr != ":2222" { - t.Fatalf("HTTPAddr = %q, want environment override", cfg.HTTPAddr) + if cfg.Addr != ":2222" { + t.Fatalf("Addr = %q, want environment override", cfg.Addr) } if cfg.MCPEnabled || !cfg.MetricsPublic || cfg.SessionIdleTTL != 10*time.Hour || !cfg.SelfSignup { t.Fatalf("YAML values were not merged: %+v", cfg) @@ -147,16 +142,14 @@ func TestLoadAdvertisedIngestEndpoint(t *testing.T) { func TestLoadTreatsEmptyEnvironmentValuesAsAbsent(t *testing.T) { cfg, err := Load(LoadOptions{Environ: append(validEnvironment(), - "FANOUT_HTTP_ADDR=", - "FANOUT_OTLP_GRPC_ADDR=", - "FANOUT_OTLP_HTTP_ADDR=", + "FANOUT_ADDR=", "FANOUT_MCP_ENABLED=", "FANOUT_RETENTION_DAYS=", )}) if err != nil { t.Fatalf("Load: %v", err) } - if cfg.HTTPAddr != ":7520" || cfg.OTLPGRPCAddr != "127.0.0.1:4317" || cfg.OTLPHTTPAddr != "127.0.0.1:4318" || !cfg.MCPEnabled || cfg.RetentionDays != 30 { + if cfg.Addr != ":7520" || !cfg.MCPEnabled || cfg.RetentionDays != 30 { t.Fatalf("empty environment values erased defaults: %+v", cfg) } } @@ -190,8 +183,8 @@ func TestExampleConfigurationMatchesSchema(t *testing.T) { if err != nil { t.Fatalf("Load example: %v", err) } - if cfg.HTTPAddr != ":7520" || cfg.DataDir != "./data" { - t.Fatalf("example defaults = HTTP %q data %q", cfg.HTTPAddr, cfg.DataDir) + if cfg.Addr != ":7520" || cfg.DataDir != "./data" { + t.Fatalf("example defaults = HTTP %q data %q", cfg.Addr, cfg.DataDir) } defaults, err := Load(LoadOptions{Environ: validEnvironment()}) if err != nil { @@ -320,8 +313,8 @@ func TestDockerConfigurationMatchesSchema(t *testing.T) { if err != nil { t.Fatalf("Load Docker config: %v", err) } - if cfg.HTTPAddr != ":7520" || cfg.OTLPGRPCAddr != ":4317" || cfg.OTLPHTTPAddr != ":4318" || cfg.DataDir != "/var/lib/fanout/data" { - t.Fatalf("Docker config values = HTTP %q OTLP/gRPC %q OTLP/HTTP %q data %q", cfg.HTTPAddr, cfg.OTLPGRPCAddr, cfg.OTLPHTTPAddr, cfg.DataDir) + if cfg.Addr != ":7520" || cfg.DataDir != "/var/lib/fanout/data" { + t.Fatalf("Docker config values = HTTP %q data %q", cfg.Addr, cfg.DataDir) } } @@ -416,7 +409,7 @@ func TestLoadRejectsUnknownInputs(t *testing.T) { }) t.Run("malformed environment entry", func(t *testing.T) { - _, err := Load(LoadOptions{Environ: append(validEnvironment(), "FANOUT_HTTP_ADDR")}) + _, err := Load(LoadOptions{Environ: append(validEnvironment(), "FANOUT_ADDR")}) if err == nil || !strings.Contains(err.Error(), "NAME=value") { t.Fatalf("error = %v, want malformed environment error", err) } @@ -464,7 +457,7 @@ func TestLoadRejectsYAMLNullValues(t *testing.T) { for _, key := range []struct { name, document string }{ - {"HTTP address", "server:\n http_addr:\n"}, + {"HTTP address", "server:\n addr:\n"}, {"MCP enabled", "mcp:\n enabled:\n"}, {"retention", "storage:\n retention_days:\n"}, } { @@ -561,7 +554,7 @@ func TestLoadRejectsInvalidFilesAndValues(t *testing.T) { func TestLoadIgnoresDotenvInputs(t *testing.T) { dir := t.TempDir() - if err := os.WriteFile(filepath.Join(dir, ".env"), []byte("FANOUT_HTTP_ADDR=:9999\n"), 0o600); err != nil { + if err := os.WriteFile(filepath.Join(dir, ".env"), []byte("FANOUT_ADDR=:9999\n"), 0o600); err != nil { t.Fatalf("write .env: %v", err) } t.Chdir(dir) @@ -570,8 +563,8 @@ func TestLoadIgnoresDotenvInputs(t *testing.T) { if err != nil { t.Fatalf("Load: %v", err) } - if cfg.HTTPAddr != ":7520" { - t.Fatalf("HTTPAddr = %q, want default", cfg.HTTPAddr) + if cfg.Addr != ":7520" { + t.Fatalf("Addr = %q, want default", cfg.Addr) } } @@ -604,9 +597,7 @@ func TestLoadRequiresPrivatePermissionsForConfigSecrets(t *testing.T) { func TestValidate(t *testing.T) { valid := Config{ - HTTPAddr: ":7520", - OTLPGRPCAddr: "127.0.0.1:4317", - OTLPHTTPAddr: "127.0.0.1:4318", + Addr: ":7520", DataDir: "./data", IngestBatchSize: 50000, RollupInterval: time.Minute, @@ -641,9 +632,7 @@ func TestValidate(t *testing.T) { {"RollupInterval=0", func(c *Config) { c.RollupInterval = 0 }}, {"RollupInterval=999ms", func(c *Config) { c.RollupInterval = 999 * time.Millisecond }}, {"RetentionDays=-1", func(c *Config) { c.RetentionDays = -1 }}, - {"HTTPAddr empty", func(c *Config) { c.HTTPAddr = "" }}, - {"OTLPGRPCAddr empty", func(c *Config) { c.OTLPGRPCAddr = "" }}, - {"OTLPHTTPAddr empty", func(c *Config) { c.OTLPHTTPAddr = "" }}, + {"Addr empty", func(c *Config) { c.Addr = "" }}, {"DataDir empty", func(c *Config) { c.DataDir = "" }}, {"MaintenanceInterval=0", func(c *Config) { c.MaintenanceInterval = 0 }}, {"MaintenanceInterval=999ms", func(c *Config) { c.MaintenanceInterval = 999 * time.Millisecond }}, @@ -853,3 +842,31 @@ func TestSecureCookies(t *testing.T) { }) } } + +func TestRemovedIngestListenersRejected(t *testing.T) { + t.Run("old server address", func(t *testing.T) { + path := filepath.Join(t.TempDir(), "fanout.yaml") + if err := os.WriteFile(path, []byte("server:\n http_addr: ':7520'\n"), 0o600); err != nil { + t.Fatal(err) + } + if _, err := Load(LoadOptions{Path: path, Environ: validEnvironment()}); err == nil || !strings.Contains(err.Error(), "server.http_addr") { + t.Fatalf("removed key: %v", err) + } + }) + for _, key := range []string{"otlp_grpc_addr", "otlp_http_addr"} { + t.Run(key, func(t *testing.T) { + path := filepath.Join(t.TempDir(), "fanout.yaml") + if err := os.WriteFile(path, []byte("ingest:\n "+key+": ':4317'\n"), 0o600); err != nil { + t.Fatal(err) + } + if _, err := Load(LoadOptions{Path: path, Environ: validEnvironment()}); err == nil || !strings.Contains(err.Error(), key) { + t.Fatalf("removed key: %v", err) + } + }) + } + for _, name := range []string{"FANOUT_HTTP_ADDR", "FANOUT_OTLP_GRPC_ADDR", "FANOUT_OTLP_HTTP_ADDR"} { + if _, err := Load(LoadOptions{Environ: append(validEnvironment(), name+"=:4317")}); err == nil || !strings.Contains(err.Error(), name) { + t.Fatalf("removed variable: %v", err) + } + } +} diff --git a/internal/ingest/auth.go b/internal/ingest/auth.go index 3ca77e6b1..1a42f1c17 100644 --- a/internal/ingest/auth.go +++ b/internal/ingest/auth.go @@ -2,7 +2,6 @@ package ingest import ( "context" - "crypto/tls" "errors" "fmt" "log/slog" @@ -10,40 +9,17 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" - "github.com/labstack/fanout/internal/config" "github.com/labstack/fanout/internal/settings" ) -func GRPCServerOptions(cfg config.Config, settingsStore *settings.Store) ([]grpc.ServerOption, error) { - opts := []grpc.ServerOption{ +// GRPCServerOptions authenticates exports. The shared HTTP server owns TLS. +func GRPCServerOptions(settingsStore *settings.Store) []grpc.ServerOption { + return []grpc.ServerOption{ grpc.UnaryInterceptor(newIngestAuthorizer(settingsStore).Unary()), } - if !cfg.TLSEnabled() { - return opts, nil - } - - tlsConfig, err := tlsServerConfig(cfg) - if err != nil { - return nil, err - } - return append(opts, grpc.Creds(credentials.NewTLS(tlsConfig))), nil -} - -func tlsServerConfig(cfg config.Config) (*tls.Config, error) { - cert, err := tls.LoadX509KeyPair(cfg.TLSCertFile, cfg.TLSKeyFile) - if err != nil { - return nil, fmt.Errorf("load TLS server cert: %w", err) - } - - return &tls.Config{ - MinVersion: tls.VersionTLS13, - Certificates: []tls.Certificate{cert}, - NextProtos: []string{"h2"}, - }, nil } type ingestAuthorizer struct { diff --git a/internal/ingest/auth_test.go b/internal/ingest/auth_test.go index b5540ccee..f9182461b 100644 --- a/internal/ingest/auth_test.go +++ b/internal/ingest/auth_test.go @@ -2,57 +2,22 @@ package ingest import ( "context" - "crypto/rand" - "crypto/rsa" - "crypto/tls" - "crypto/x509" - "crypto/x509/pkix" - "encoding/pem" - "math/big" - "os" - "path/filepath" "testing" - "time" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" - "github.com/labstack/fanout/internal/config" "github.com/labstack/fanout/internal/settings" appstore "github.com/labstack/fanout/internal/store" ) -func TestGRPCServerOptions_NoTLS(t *testing.T) { - store := newRuntimeStore(t) - opts, err := GRPCServerOptions(config.Config{}, store) - if err != nil { - t.Fatalf("GRPCServerOptions: %v", err) - } - if len(opts) != 1 { +func TestGRPCServerOptions(t *testing.T) { + if opts := GRPCServerOptions(newRuntimeStore(t)); len(opts) != 1 { t.Fatalf("len(opts) = %d, want 1", len(opts)) } } -func TestTLSConfig(t *testing.T) { - dir := t.TempDir() - certFile, keyFile := writeServerTLSFiles(t, dir) - - tlsConfig, err := tlsServerConfig(config.Config{ - TLSCertFile: certFile, - TLSKeyFile: keyFile, - }) - if err != nil { - t.Fatalf("tlsServerConfig: %v", err) - } - if tlsConfig.MinVersion != tls.VersionTLS13 { - t.Fatalf("MinVersion = %v, want TLS 1.3", tlsConfig.MinVersion) - } - if len(tlsConfig.Certificates) != 1 { - t.Fatalf("len(Certificates) = %d, want 1", len(tlsConfig.Certificates)) - } -} - func TestAuthorize_RejectsWhenPreSetup(t *testing.T) { // With no token persisted (pre-admin-setup), every request is rejected — // collectors must wait for the operator to complete setup. @@ -167,58 +132,3 @@ func newRuntimeStore(t *testing.T) *settings.Store { t.Cleanup(func() { sqlite.Close() }) return settings.NewStore(sqlite.DB) } - -func writeServerTLSFiles(t *testing.T, dir string) (string, string) { - t.Helper() - - caKey, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - t.Fatalf("GenerateKey(ca): %v", err) - } - caTemplate := certificateTemplate("fanout-test-ca", true) - caTemplate.KeyUsage = x509.KeyUsageCertSign | x509.KeyUsageCRLSign - caDER, err := x509.CreateCertificate(rand.Reader, caTemplate, caTemplate, &caKey.PublicKey, caKey) - if err != nil { - t.Fatalf("CreateCertificate(ca): %v", err) - } - - serverKey, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - t.Fatalf("GenerateKey(server): %v", err) - } - serverTemplate := certificateTemplate("fanout.example.com", false) - serverTemplate.ExtKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth} - serverTemplate.DNSNames = []string{"fanout.example.com", "localhost"} - serverDER, err := x509.CreateCertificate(rand.Reader, serverTemplate, caTemplate, &serverKey.PublicKey, caKey) - if err != nil { - t.Fatalf("CreateCertificate(server): %v", err) - } - - certFile := filepath.Join(dir, "server.pem") - keyFile := filepath.Join(dir, "server-key.pem") - - writePEMFile(t, certFile, "CERTIFICATE", serverDER) - writePEMFile(t, keyFile, "RSA PRIVATE KEY", x509.MarshalPKCS1PrivateKey(serverKey)) - _ = caDER - return certFile, keyFile -} - -func certificateTemplate(commonName string, isCA bool) *x509.Certificate { - now := time.Now().UTC() - return &x509.Certificate{ - SerialNumber: big.NewInt(now.UnixNano()), - Subject: pkix.Name{CommonName: commonName}, - NotBefore: now.Add(-time.Minute), - NotAfter: now.Add(24 * time.Hour), - BasicConstraintsValid: true, - IsCA: isCA, - } -} - -func writePEMFile(t *testing.T, path, blockType string, der []byte) { - t.Helper() - block := &pem.Block{Type: blockType, Bytes: der} - if err := os.WriteFile(path, pem.EncodeToMemory(block), 0o600); err != nil { - t.Fatalf("WriteFile(%s): %v", path, err) - } -} diff --git a/internal/ingest/http.go b/internal/ingest/http.go index 8d2f5d60a..2ce17a448 100644 --- a/internal/ingest/http.go +++ b/internal/ingest/http.go @@ -29,7 +29,7 @@ var ( ) // NewHTTPHandler exposes only the three stable OTLP/HTTP signal endpoints. -// Browser/API routes live on a different listener and are deliberately absent. +// Browser/API routes use a separate handler and are deliberately absent. func NewHTTPHandler(srv *Server, settingsStore *settings.Store) http.Handler { return &httpIngestHandler{ srv: srv, diff --git a/internal/ingest/listener_test.go b/internal/ingest/listener_test.go new file mode 100644 index 000000000..04aabaf32 --- /dev/null +++ b/internal/ingest/listener_test.go @@ -0,0 +1,253 @@ +package ingest + +import ( + "bytes" + "context" + "crypto/tls" + "crypto/x509" + "errors" + "io" + "net/http" + "net/http/httptest" + "strings" + "testing" + "time" + + "github.com/labstack/fanout/internal/config" + httpserver "github.com/labstack/fanout/internal/server" + telemetrystore "github.com/labstack/fanout/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" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +func TestSharedListenerProtocols(t *testing.T) { + for _, secure := range []bool{false, true} { + t.Run(map[bool]string{false: "plaintext", true: "TLS"}[secure], func(t *testing.T) { + f := newHTTPIngestFixture(t, true) + g := grpc.NewServer(GRPCServerOptions(f.store)...) + RegisterOTLP(g, NewServer(config.Config{}, newTestSubmitter(f.spans, f.logs, f.metrics))) + defer g.Stop() + app := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { _, _ = io.WriteString(w, "SPA") }) + ts := httptest.NewUnstartedServer(nil) + ts.Config = httpserver.New("", app, f.handler, g) + creds := insecure.NewCredentials() + if secure { + ts.EnableHTTP2 = true + ts.StartTLS() + roots := x509.NewCertPool() + roots.AddCert(ts.Certificate()) + creds = credentials.NewTLS(&tls.Config{RootCAs: roots, MinVersion: tls.VersionTLS13}) + } else { + ts.Start() + } + defer ts.Close() + conn, err := grpc.NewClient(ts.Listener.Addr().String(), grpc.WithTransportCredentials(creds)) + if err != nil { + t.Fatal(err) + } + defer conn.Close() + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + tc := collectortrace.NewTraceServiceClient(conn) + if _, err := tc.Export(ctx, testTraceRequest()); status.Code(err) != codes.Unauthenticated { + t.Fatalf("unauthenticated gRPC: %v", err) + } + ctx = metadata.AppendToOutgoingContext(ctx, "authorization", "Bearer "+f.token) + if _, err := tc.Export(ctx, testTraceRequest()); err != nil { + t.Fatal(err) + } + if _, err := collectorlogs.NewLogsServiceClient(conn).Export(ctx, testLogsRequest()); err != nil { + t.Fatal(err) + } + if _, err := collectormetrics.NewMetricsServiceClient(conn).Export(ctx, testMetricsRequest()); err != nil { + t.Fatal(err) + } + <-f.spans + <-f.logs + <-f.metrics + for _, tc := range []struct { + path string + message proto.Message + }{ + {"/v1/traces", testTraceRequest()}, {"/v1/logs", testLogsRequest()}, {"/v1/metrics", testMetricsRequest()}, + } { + payload, err := proto.Marshal(tc.message) + if err != nil { + t.Fatal(err) + } + req, err := http.NewRequest(http.MethodPost, ts.URL+tc.path, bytes.NewReader(payload)) + if err != nil { + t.Fatal(err) + } + req.Header.Set("Content-Type", otlpProtobufContentType) + req.Header.Set("Authorization", "Bearer "+f.token) + resp, err := ts.Client().Do(req) + if err != nil { + t.Fatal(err) + } + _ = resp.Body.Close() + if resp.StatusCode != http.StatusOK { + t.Fatalf("%s: %d", tc.path, resp.StatusCode) + } + } + <-f.spans + <-f.logs + <-f.metrics + for _, tc := range []struct { + path string + want int + }{ + {"/", 200}, {"/v1/traces", 405}, {"/v1/unknown", 404}, {"/v1", 404}, + } { + resp, err := ts.Client().Get(ts.URL + tc.path) + if err != nil { + t.Fatal(err) + } + _ = resp.Body.Close() + if resp.StatusCode != tc.want { + t.Fatalf("%s: %d, want %d", tc.path, resp.StatusCode, tc.want) + } + } + // Even malformed gRPC must not fall through to a successful SPA GET. + req := httptest.NewRequest(http.MethodGet, "/unknown.Service/Export", nil) + req.Header.Set("Content-Type", "application/grpc") + rec := httptest.NewRecorder() + ts.Config.Handler.ServeHTTP(rec, req) + if rec.Code == 200 || strings.Contains(rec.Body.String(), "SPA") { + t.Fatalf("gRPC fell through: %d %s", rec.Code, rec.Body.String()) + } + }) + } +} + +type blockedExport struct{ started, release chan struct{} } + +func (b *blockedExport) Submit(ctx context.Context, _ telemetrystore.Batch) error { + close(b.started) + select { + case <-b.release: + return nil + case <-ctx.Done(): + return ctx.Err() + } +} + +func TestSharedListenerShutdownDrainsExports(t *testing.T) { + for _, transport := range []string{"grpc", "http"} { + t.Run(transport, func(t *testing.T) { + f := newHTTPIngestFixture(t, true) + blocked := &blockedExport{make(chan struct{}), make(chan struct{})} + srv := NewServer(config.Config{}, blocked) + g := grpc.NewServer(GRPCServerOptions(f.store)...) + RegisterOTLP(g, srv) + defer g.Stop() + ts := httptest.NewUnstartedServer(nil) + ts.Config = httpserver.New("", http.NotFoundHandler(), NewHTTPHandler(srv, f.store), g) + ts.Start() + defer ts.Close() + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + conn, err := grpc.NewClient(ts.Listener.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + t.Fatal(err) + } + defer conn.Close() + exported := make(chan error, 1) + go func() { + if transport == "grpc" { + _, err := collectortrace.NewTraceServiceClient(conn).Export(metadata.AppendToOutgoingContext(ctx, "authorization", "Bearer "+f.token), testTraceRequest()) + exported <- err + return + } + payload, _ := proto.Marshal(testTraceRequest()) + req, err := http.NewRequestWithContext(ctx, http.MethodPost, ts.URL+"/v1/traces", bytes.NewReader(payload)) + if err != nil { + exported <- err + return + } + req.Header.Set("Content-Type", otlpProtobufContentType) + req.Header.Set("Authorization", "Bearer "+f.token) + resp, err := ts.Client().Do(req) + if err == nil { + _ = resp.Body.Close() + if resp.StatusCode != http.StatusOK { + err = status.Errorf(codes.Internal, "HTTP %d", resp.StatusCode) + } + } + exported <- err + }() + select { + case <-blocked.started: + case <-ctx.Done(): + t.Fatal("export did not start") + } + stopped := make(chan error, 1) + go func() { stopped <- ts.Config.Shutdown(ctx) }() + select { + case err := <-stopped: + t.Fatalf("shutdown returned before commit: %v", err) + case <-time.After(50 * time.Millisecond): + } + close(blocked.release) + if err := <-exported; err != nil { + t.Fatal(err) + } + if err := <-stopped; err != nil { + t.Fatal(err) + } + }) + } +} + +func TestSharedListenerForceCloseCancelsHTTP2Stream(t *testing.T) { + started, canceled := make(chan struct{}), make(chan struct{}) + app := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.ProtoMajor != 2 { + t.Errorf("protocol = %s, want HTTP/2", r.Proto) + } + w.Header().Set("Content-Type", "text/event-stream") + _, _ = io.WriteString(w, "data: ready\n\n") + if err := http.NewResponseController(w).Flush(); err != nil { + t.Error(err) + } + close(started) + <-r.Context().Done() + close(canceled) + }) + ts := httptest.NewUnstartedServer(nil) + ts.Config = httpserver.New("", app, http.NotFoundHandler(), http.NotFoundHandler()) + ts.Start() + defer ts.Close() + protocols := new(http.Protocols) + protocols.SetUnencryptedHTTP2(true) + transport := &http.Transport{Protocols: protocols} + defer transport.CloseIdleConnections() + client := &http.Client{Transport: transport, Timeout: 5 * time.Second} + resp, err := client.Get(ts.URL + "/api/agent") + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + <-started + ctx, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond) + defer cancel() + if err := ts.Config.Shutdown(ctx); !errors.Is(err, context.DeadlineExceeded) { + t.Fatalf("shutdown with active stream: %v", err) + } + if err := ts.Config.Close(); err != nil { + t.Fatal(err) + } + select { + case <-canceled: + case <-time.After(5 * time.Second): + t.Fatal("HTTP/2 stream context was not canceled") + } +} diff --git a/internal/ingest/transport_bench_test.go b/internal/ingest/transport_bench_test.go new file mode 100644 index 000000000..29e5299d2 --- /dev/null +++ b/internal/ingest/transport_bench_test.go @@ -0,0 +1,222 @@ +//go:build transportbench + +package ingest + +import ( + "context" + "encoding/json" + "fmt" + "net" + "net/http" + "runtime" + "sort" + "sync" + "sync/atomic" + "syscall" + "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" + 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" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/metadata" +) + +// Opt-in experiment, not part of normal tests. Both paths use real auth and +// 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 +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)) + for _, durable := range []bool{false, true} { + for _, concurrency := range []int{1, 16} { + for rep := range 3 { + modes := []string{"native", "shared"} + if rep%2 == 1 { + modes[0], modes[1] = modes[1], modes[0] + } + for _, mode := range modes { + t.Run(fmt.Sprintf("durable=%t/c=%d/rep=%d/%s", durable, concurrency, rep+1, mode), func(t *testing.T) { + runTransportComparison(t, mode, durable, concurrency) + }) + } + } + } + } +} + +type transportCountSubmitter struct { + downstream batchSubmitter + rows atomic.Int64 +} + +func (s *transportCountSubmitter) Submit(ctx context.Context, b telemetrystore.Batch) error { + if s.downstream != nil { + if err := s.downstream.Submit(ctx, b); err != nil { + return err + } + } + s.rows.Add(int64(len(b.Spans) + len(b.Logs) + len(b.Metrics))) + return nil +} + +func runTransportComparison(t *testing.T, mode string, durable bool, concurrency int) { + store := newRuntimeStore(t) + token, hash, err := settings.GenerateIngestToken() + if err != nil { + t.Fatal(err) + } + if err := store.SetIngest(context.Background(), settings.Ingest{TokenHash: hash}); err != nil { + t.Fatal(err) + } + sink := &transportCountSubmitter{} + if durable { + root := t.TempDir() + repo, err := telemetrystore.Open(root) + if err != nil { + t.Fatal(err) + } + writer := telemetrystore.NewWriter(repo, 50000) + ctx, cancel := context.WithCancel(context.Background()) + done := make(chan error, 1) + go func() { done <- writer.Run(ctx) }() + sink.downstream = writer + t.Cleanup(func() { + cancel() + writer.Wait() + if err := <-done; err != nil { + t.Error(err) + } + if err := repo.Close(); err != nil { + t.Error(err) + } + issues, err := telemetrystore.VerifyBatches(root) + if err != nil || len(issues) > 0 { + t.Errorf("Parquet verification: %v, issues=%v", err, issues) + } + }) + } + g := grpc.NewServer(GRPCServerOptions(store)...) + srv := NewServer(config.Config{DefaultNamespace: "default"}, sink) + RegisterOTLP(g, srv) + lis, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + t.Fatal(err) + } + serveErr := make(chan error, 1) + if mode == "native" { + go func() { serveErr <- g.Serve(lis) }() + t.Cleanup(func() { + g.Stop() + if err := <-serveErr; err != nil && err != grpc.ErrServerStopped { + t.Error(err) + } + }) + } else { + h := NewHTTPHandler(srv, store) + hs := httpserver.New(lis.Addr().String(), http.NotFoundHandler(), h, g) + go func() { serveErr <- hs.Serve(lis) }() + t.Cleanup(func() { + g.Stop() + _ = hs.Close() + if err := <-serveErr; err != http.ErrServerClosed { + t.Error(err) + } + }) + } + tr, lo, me := testTraceRequest(), testLogsRequest(), testMetricsRequest() + // Equal, nonempty batches for all three signals, reused read-only by clients. + for i := 1; i < 1000; i++ { + tr.ResourceSpans[0].ScopeSpans[0].Spans = append(tr.ResourceSpans[0].ScopeSpans[0].Spans, tr.ResourceSpans[0].ScopeSpans[0].Spans[0]) + lo.ResourceLogs[0].ScopeLogs[0].LogRecords = append(lo.ResourceLogs[0].ScopeLogs[0].LogRecords, lo.ResourceLogs[0].ScopeLogs[0].LogRecords[0]) + me.ResourceMetrics[0].ScopeMetrics[0].Metrics[0].GetGauge().DataPoints = append(me.ResourceMetrics[0].ScopeMetrics[0].Metrics[0].GetGauge().DataPoints, me.ResourceMetrics[0].ScopeMetrics[0].Metrics[0].GetGauge().DataPoints[0]) + } + calls := make([]func(int) error, concurrency) + for i := range calls { + conn, err := grpc.NewClient(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = conn.Close() }) + tc, lc, mc := collectortrace.NewTraceServiceClient(conn), collectorlogs.NewLogsServiceClient(conn), collectormetrics.NewMetricsServiceClient(conn) + calls[i] = func(signal int) error { + ctx, cancel := context.WithTimeout(metadata.AppendToOutgoingContext(context.Background(), "authorization", "Bearer "+token), 10*time.Second) + defer cancel() + switch signal % 3 { + case 0: + _, err = tc.Export(ctx, tr) + case 1: + _, err = lc.Export(ctx, lo) + case 2: + _, err = mc.Export(ctx, me) + } + return err + } + // Warm each connection and each signal before measuring. + for signal := range 3 { + if err := calls[i](signal); err != nil { + t.Fatal(err) + } + } + } + runtime.GC() + var before, after runtime.MemStats + runtime.ReadMemStats(&before) + cpuBefore := transportCPU() + rowsBefore := sink.rows.Load() + start := time.Now() + deadline := start.Add(10 * time.Second) + var wg sync.WaitGroup + latencies := make([][]float64, concurrency) + errors := make([]error, concurrency) + for worker := range concurrency { + wg.Add(1) + go func() { + defer wg.Done() + for n := worker; time.Now().Before(deadline); n++ { + at := time.Now() + if err := calls[worker](n); err != nil { + errors[worker] = err + return + } + latencies[worker] = append(latencies[worker], float64(time.Since(at))/float64(time.Millisecond)) + } + }() + } + wg.Wait() + elapsed := time.Since(start).Seconds() + cpu := transportCPU() - cpuBefore + runtime.ReadMemStats(&after) + var samples []float64 + for i := range concurrency { + if errors[i] != nil { + t.Fatal(errors[i]) + } + samples = append(samples, latencies[i]...) + } + sort.Float64s(samples) + rows := sink.rows.Load() - rowsBefore + if rows != int64(len(samples)*1000) { + t.Fatalf("server rows %d != acknowledged %d", rows, len(samples)*1000) + } + if len(samples) == 0 { + t.Fatal("no exports") + } + result := map[string]any{"mode": mode, "durable": durable, "concurrency": concurrency, "rows": rows, "seconds": elapsed, "rows_per_second": float64(rows) / elapsed, "p50_ms": samples[(len(samples)-1)*50/100], "p95_ms": samples[(len(samples)-1)*95/100], "p99_ms": samples[(len(samples)-1)*99/100], "cpu_cores_client_and_server": cpu / elapsed, "allocated_bytes_per_row": float64(after.TotalAlloc-before.TotalAlloc) / float64(rows), "errors": 0} + encoded, _ := json.Marshal(result) + t.Log("RESULT " + string(encoded)) +} + +func transportCPU() float64 { + var usage syscall.Rusage + if err := syscall.Getrusage(syscall.RUSAGE_SELF, &usage); err != nil { + panic(err) + } + return float64(usage.Utime.Sec+usage.Stime.Sec) + float64(usage.Utime.Usec+usage.Stime.Usec)/1e6 +} diff --git a/internal/server/http.go b/internal/server/http.go new file mode 100644 index 000000000..682dddd95 --- /dev/null +++ b/internal/server/http.go @@ -0,0 +1,41 @@ +// Package server serves Fanout's browser and OTLP surfaces on one listener. +package server + +import ( + "crypto/tls" + "net/http" + "strings" + "time" +) + +// New keeps ingest outside browser middleware. net/http owns both HTTP/1 and +// HTTP/2 connections, including plaintext HTTP/2, so Shutdown drains them all. +func New(addr string, app, otlp, grpc http.Handler) *http.Server { + protocols := new(http.Protocols) + protocols.SetHTTP1(true) + protocols.SetHTTP2(true) + protocols.SetUnencryptedHTTP2(true) + return &http.Server{ + Addr: addr, + Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // Reserve the whole OTLP HTTP namespace, including invalid paths and + // methods, so they can never fall through to the SPA. + if r.URL.Path == "/v1" || strings.HasPrefix(r.URL.Path, "/v1/") { + otlp.ServeHTTP(w, r) + return + } + if strings.HasPrefix(r.Header.Get("Content-Type"), "application/grpc") { + // ServeHTTP rejects HTTP/1 and unsupported gRPC content types. + grpc.ServeHTTP(w, r) + return + } + app.ServeHTTP(w, r) + }), + Protocols: protocols, + TLSConfig: &tls.Config{MinVersion: tls.VersionTLS13}, + ReadHeaderTimeout: 5 * time.Second, + IdleTimeout: 2 * time.Minute, + // No global read/write deadline: agent SSE can outlive an export. + // OTLP/HTTP enforces its own decompressed body limit. + } +} diff --git a/internal/ui/dist/assets/WarningCircle.es-DDq2AFnK.js b/internal/ui/dist/assets/WarningCircle.es-BrGtHGYK.js similarity index 98% rename from internal/ui/dist/assets/WarningCircle.es-DDq2AFnK.js rename to internal/ui/dist/assets/WarningCircle.es-BrGtHGYK.js index 2da6a032e..0dae83b0a 100644 --- a/internal/ui/dist/assets/WarningCircle.es-DDq2AFnK.js +++ b/internal/ui/dist/assets/WarningCircle.es-BrGtHGYK.js @@ -1 +1 @@ -import{St as e,a as t,gt as n}from"./brand-MzZ03bSa.js";import{O as r,T as i,_ as a,h as o,p as s,s as c,w as l,x as u}from"./api-Be5Lq4YA.js";var d=class extends o{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),l(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&a(t.mutationKey)!==a(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??c();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){s.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},f=e(n(),1);function p(e,t){let n=r(t),[a]=f.useState(()=>new d(n,e));f.useEffect(()=>{a.setOptions(e)},[a,e]);let o=f.useSyncExternalStore(f.useCallback(e=>a.subscribe(s.batchCalls(e)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),c=f.useCallback((...e)=>{a.mutate(e[0],e[1]).catch(u)},[a]);if(o.error&&i(a.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:c,mutateAsync:o.mutate}}var m=new Map([[`bold`,f.createElement(f.Fragment,null,f.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`,f.createElement(f.Fragment,null,f.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),f.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`,f.createElement(f.Fragment,null,f.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`,f.createElement(f.Fragment,null,f.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`,f.createElement(f.Fragment,null,f.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`,f.createElement(f.Fragment,null,f.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`}))]]),h=f.forwardRef((e,n)=>f.createElement(t,{ref:n,...e,weights:m}));h.displayName=`WarningCircleIcon`;var g=h;export{p as n,g as t}; \ No newline at end of file +import{St as e,a as t,gt as n}from"./brand-MzZ03bSa.js";import{O as r,T as i,_ as a,h as o,p as s,s as c,w as l,x as u}from"./api-CB7Xlqes.js";var d=class extends o{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),l(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&a(t.mutationKey)!==a(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??c();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){s.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},f=e(n(),1);function p(e,t){let n=r(t),[a]=f.useState(()=>new d(n,e));f.useEffect(()=>{a.setOptions(e)},[a,e]);let o=f.useSyncExternalStore(f.useCallback(e=>a.subscribe(s.batchCalls(e)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),c=f.useCallback((...e)=>{a.mutate(e[0],e[1]).catch(u)},[a]);if(o.error&&i(a.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:c,mutateAsync:o.mutate}}var m=new Map([[`bold`,f.createElement(f.Fragment,null,f.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`,f.createElement(f.Fragment,null,f.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),f.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`,f.createElement(f.Fragment,null,f.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`,f.createElement(f.Fragment,null,f.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`,f.createElement(f.Fragment,null,f.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`,f.createElement(f.Fragment,null,f.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`}))]]),h=f.forwardRef((e,n)=>f.createElement(t,{ref:n,...e,weights:m}));h.displayName=`WarningCircleIcon`;var g=h;export{p as n,g as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/api-Be5Lq4YA.js b/internal/ui/dist/assets/api-CB7Xlqes.js similarity index 99% rename from internal/ui/dist/assets/api-Be5Lq4YA.js rename to internal/ui/dist/assets/api-CB7Xlqes.js index bce949b9e..d87379636 100644 --- a/internal/ui/dist/assets/api-Be5Lq4YA.js +++ b/internal/ui/dist/assets/api-CB7Xlqes.js @@ -1,4 +1,4 @@ -import{$ as e,C as t,S as n,St as r,U as i,X as a,Y as o,Z as s,at as c,ct as l,dt as u,et as d,g as f,gt as p,j as m,k as h,mt as g,ot as _,st as v,tt as y,v as b,x,y as S}from"./brand-MzZ03bSa.js";import{i as C}from"./auth-BeUORN-q.js";import{C as w,n as ee,o as te,w as ne,x as T}from"./Tooltip-BJiO7C_G.js";var E=r(p(),1);function re({opened:e,shouldReturnFocus:t=!0}){let n=(0,E.useRef)(null),r=()=>{n.current&&`focus`in n.current&&typeof n.current.focus==`function`&&n.current?.focus({preventScroll:!0})};return y(()=>{let i=-1,a=e=>{e.key===`Tab`&&window.clearTimeout(i)};if(document.addEventListener(`keydown`,a),e)n.current=document.activeElement;else if(t){let e=document.activeElement;i=window.setTimeout(()=>{let t=document.activeElement;(t===null||t===document.body||t===e)&&r()},10)}return()=>{window.clearTimeout(i),document.removeEventListener(`keydown`,a)}},[e,t]),r}var ie=/input|select|textarea|button|object/,ae=`a, input, select, textarea, button, object, [tabindex]`;function oe(e){return e.style.display===`none`}function se(e){if(e.getAttribute(`aria-hidden`)||e.getAttribute(`hidden`)||e.getAttribute(`type`)===`hidden`)return!1;let t=e;for(;t&&t!==document.body&&t.nodeType!==11;){if(oe(t))return!1;t=t.parentNode}return!0}function ce(e){let t=e.getAttribute(`tabindex`);return t===null&&(t=void 0),parseInt(t,10)}function le(e){let t=e.nodeName.toLowerCase(),n=!Number.isNaN(ce(e));return(ie.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&se(e)}function ue(e){let t=ce(e);return(Number.isNaN(t)||t>=0)&&le(e)}function de(e){return Array.from(e.querySelectorAll(ae)).filter(ue)}function fe(e,t){let n=de(e);if(!n.length){t.preventDefault();return}let r=n[t.shiftKey?0:n.length-1],i=e.getRootNode(),a=r===i.activeElement||e===i.activeElement,o=i.activeElement;if(o.tagName===`INPUT`&&o.getAttribute(`type`)===`radio`&&(a=n.filter(e=>e.getAttribute(`type`)===`radio`&&e.getAttribute(`name`)===o.getAttribute(`name`)).includes(r)),!a)return;t.preventDefault();let s=n[t.shiftKey?n.length-1:0];s&&s.focus()}function pe(e=!0){let t=(0,E.useRef)(null),n=e=>{let t=e.querySelector(`[data-autofocus]`);if(!t){let n=Array.from(e.querySelectorAll(ae));t=n.find(ue)||n.find(le)||null,!t&&le(e)&&(t=e)}t?t.focus({preventScroll:!0}):console.warn(`[@mantine/hooks/use-focus-trap] Failed to find focusable element within provided node`,e)},r=(0,E.useCallback)(r=>{if(e){if(r===null){t.current=null;return}t.current!==r&&(setTimeout(()=>{r.getRootNode()?n(r):console.warn(`[@mantine/hooks/use-focus-trap] Ref node is not part of the dom`,r)}),t.current=r)}},[e]);return(0,E.useEffect)(()=>{if(!e)return;t.current&&setTimeout(()=>{t.current&&n(t.current)});let r=e=>{e.key===`Tab`&&t.current&&fe(t.current,e)};return document.addEventListener(`keydown`,r),()=>document.removeEventListener(`keydown`,r)},[e]),r}function me(e,t,n){let r=(0,E.useEffectEvent)(t);(0,E.useEffect)(()=>(window.addEventListener(e,r,n),()=>window.removeEventListener(e,r,n)),[e])}var D=g(),he={root:`m_515a97f8`},O=t(e=>{let t=m(`VisuallyHidden`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,attributes:c,...l}=t;return(0,D.jsx)(x,{component:`span`,...h({name:`VisuallyHidden`,classes:he,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:c})(`root`),...l})});O.classes=he,O.displayName=`@mantine/core/VisuallyHidden`;var ge={root:`m_9814e45f`},_e={zIndex:w(`modal`)},ve=a((e,{gradient:t,color:n,backgroundOpacity:r,blur:a,radius:o,zIndex:s})=>({root:{"--overlay-bg":t||(n!==void 0||r!==void 0)&&i(n||`#000`,r??.6)||void 0,"--overlay-filter":a?`blur(${u(a)})`:void 0,"--overlay-radius":o===void 0?void 0:c(o),"--overlay-z-index":s?.toString()}})),k=n(e=>{let t=m(`Overlay`,_e,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,fixed:c,center:l,children:u,radius:d,zIndex:f,gradient:p,blur:g,color:_,backgroundOpacity:v,mod:y,attributes:b,...S}=t;return(0,D.jsx)(x,{...h({name:`Overlay`,props:t,classes:ge,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:b,vars:s,varsResolver:ve})(`root`),mod:[{center:l,fixed:c},y],...S,children:u})});k.classes=ge,k.varsResolver=ve,k.displayName=`@mantine/core/Overlay`;function A({children:t,active:n=!0,refProp:r=`ref`,innerRef:i}){let a=e(pe(n),i),o=T(t);return o?(0,E.cloneElement)(o,{[r]:a}):t}function ye(e){return(0,D.jsx)(O,{tabIndex:-1,"data-autofocus":!0,...e})}A.displayName=`@mantine/core/FocusTrap`,ye.displayName=`@mantine/core/FocusTrapInitialFocus`,A.InitialFocus=ye;var[be,j]=ne(`ModalBase component was not found in tree`);function xe({opened:e,transitionDuration:t}){let[n,r]=(0,E.useState)(e),i=(0,E.useRef)(-1),a=s()?0:t;return(0,E.useEffect)(()=>(e?(r(!0),window.clearTimeout(i.current)):a===0?r(!1):i.current=window.setTimeout(()=>r(!1),a),()=>window.clearTimeout(i.current)),[e,a]),n}function Se({id:e,transitionProps:t,opened:n,trapFocus:r,closeOnEscape:i,onClose:a,returnFocus:o}){let s=d(e),[c,l]=(0,E.useState)(!1),[u,f]=(0,E.useState)(!1),p=xe({opened:n,transitionDuration:typeof t?.duration==`number`?t?.duration:200});return me(`keydown`,e=>{e.key===`Escape`&&i&&!e.isComposing&&n&&e.target?.getAttribute(`data-mantine-stop-propagation`)!==`true`&&a()},{capture:!0}),re({opened:n,shouldReturnFocus:r&&o}),{_id:s,titleMounted:c,bodyMounted:u,shouldLockScroll:p,setTitleMounted:l,setBodyMounted:f}}var M=function(){return M=Object.assign||function(e){for(var t,n=1,r=arguments.length;n`u`)return Xe;var t=Qe(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},et=Ye(),P=`data-scroll-locked`,tt=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),` +import{$ as e,C as t,S as n,St as r,U as i,X as a,Y as o,Z as s,at as c,ct as l,dt as u,et as d,g as f,gt as p,j as m,k as h,mt as g,ot as _,st as v,tt as y,v as b,x,y as S}from"./brand-MzZ03bSa.js";import{i as C}from"./auth-B1VNekWU.js";import{C as w,n as ee,o as te,w as ne,x as T}from"./Tooltip-BJiO7C_G.js";var E=r(p(),1);function re({opened:e,shouldReturnFocus:t=!0}){let n=(0,E.useRef)(null),r=()=>{n.current&&`focus`in n.current&&typeof n.current.focus==`function`&&n.current?.focus({preventScroll:!0})};return y(()=>{let i=-1,a=e=>{e.key===`Tab`&&window.clearTimeout(i)};if(document.addEventListener(`keydown`,a),e)n.current=document.activeElement;else if(t){let e=document.activeElement;i=window.setTimeout(()=>{let t=document.activeElement;(t===null||t===document.body||t===e)&&r()},10)}return()=>{window.clearTimeout(i),document.removeEventListener(`keydown`,a)}},[e,t]),r}var ie=/input|select|textarea|button|object/,ae=`a, input, select, textarea, button, object, [tabindex]`;function oe(e){return e.style.display===`none`}function se(e){if(e.getAttribute(`aria-hidden`)||e.getAttribute(`hidden`)||e.getAttribute(`type`)===`hidden`)return!1;let t=e;for(;t&&t!==document.body&&t.nodeType!==11;){if(oe(t))return!1;t=t.parentNode}return!0}function ce(e){let t=e.getAttribute(`tabindex`);return t===null&&(t=void 0),parseInt(t,10)}function le(e){let t=e.nodeName.toLowerCase(),n=!Number.isNaN(ce(e));return(ie.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&se(e)}function ue(e){let t=ce(e);return(Number.isNaN(t)||t>=0)&&le(e)}function de(e){return Array.from(e.querySelectorAll(ae)).filter(ue)}function fe(e,t){let n=de(e);if(!n.length){t.preventDefault();return}let r=n[t.shiftKey?0:n.length-1],i=e.getRootNode(),a=r===i.activeElement||e===i.activeElement,o=i.activeElement;if(o.tagName===`INPUT`&&o.getAttribute(`type`)===`radio`&&(a=n.filter(e=>e.getAttribute(`type`)===`radio`&&e.getAttribute(`name`)===o.getAttribute(`name`)).includes(r)),!a)return;t.preventDefault();let s=n[t.shiftKey?n.length-1:0];s&&s.focus()}function pe(e=!0){let t=(0,E.useRef)(null),n=e=>{let t=e.querySelector(`[data-autofocus]`);if(!t){let n=Array.from(e.querySelectorAll(ae));t=n.find(ue)||n.find(le)||null,!t&&le(e)&&(t=e)}t?t.focus({preventScroll:!0}):console.warn(`[@mantine/hooks/use-focus-trap] Failed to find focusable element within provided node`,e)},r=(0,E.useCallback)(r=>{if(e){if(r===null){t.current=null;return}t.current!==r&&(setTimeout(()=>{r.getRootNode()?n(r):console.warn(`[@mantine/hooks/use-focus-trap] Ref node is not part of the dom`,r)}),t.current=r)}},[e]);return(0,E.useEffect)(()=>{if(!e)return;t.current&&setTimeout(()=>{t.current&&n(t.current)});let r=e=>{e.key===`Tab`&&t.current&&fe(t.current,e)};return document.addEventListener(`keydown`,r),()=>document.removeEventListener(`keydown`,r)},[e]),r}function me(e,t,n){let r=(0,E.useEffectEvent)(t);(0,E.useEffect)(()=>(window.addEventListener(e,r,n),()=>window.removeEventListener(e,r,n)),[e])}var D=g(),he={root:`m_515a97f8`},O=t(e=>{let t=m(`VisuallyHidden`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,attributes:c,...l}=t;return(0,D.jsx)(x,{component:`span`,...h({name:`VisuallyHidden`,classes:he,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:c})(`root`),...l})});O.classes=he,O.displayName=`@mantine/core/VisuallyHidden`;var ge={root:`m_9814e45f`},_e={zIndex:w(`modal`)},ve=a((e,{gradient:t,color:n,backgroundOpacity:r,blur:a,radius:o,zIndex:s})=>({root:{"--overlay-bg":t||(n!==void 0||r!==void 0)&&i(n||`#000`,r??.6)||void 0,"--overlay-filter":a?`blur(${u(a)})`:void 0,"--overlay-radius":o===void 0?void 0:c(o),"--overlay-z-index":s?.toString()}})),k=n(e=>{let t=m(`Overlay`,_e,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,fixed:c,center:l,children:u,radius:d,zIndex:f,gradient:p,blur:g,color:_,backgroundOpacity:v,mod:y,attributes:b,...S}=t;return(0,D.jsx)(x,{...h({name:`Overlay`,props:t,classes:ge,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:b,vars:s,varsResolver:ve})(`root`),mod:[{center:l,fixed:c},y],...S,children:u})});k.classes=ge,k.varsResolver=ve,k.displayName=`@mantine/core/Overlay`;function A({children:t,active:n=!0,refProp:r=`ref`,innerRef:i}){let a=e(pe(n),i),o=T(t);return o?(0,E.cloneElement)(o,{[r]:a}):t}function ye(e){return(0,D.jsx)(O,{tabIndex:-1,"data-autofocus":!0,...e})}A.displayName=`@mantine/core/FocusTrap`,ye.displayName=`@mantine/core/FocusTrapInitialFocus`,A.InitialFocus=ye;var[be,j]=ne(`ModalBase component was not found in tree`);function xe({opened:e,transitionDuration:t}){let[n,r]=(0,E.useState)(e),i=(0,E.useRef)(-1),a=s()?0:t;return(0,E.useEffect)(()=>(e?(r(!0),window.clearTimeout(i.current)):a===0?r(!1):i.current=window.setTimeout(()=>r(!1),a),()=>window.clearTimeout(i.current)),[e,a]),n}function Se({id:e,transitionProps:t,opened:n,trapFocus:r,closeOnEscape:i,onClose:a,returnFocus:o}){let s=d(e),[c,l]=(0,E.useState)(!1),[u,f]=(0,E.useState)(!1),p=xe({opened:n,transitionDuration:typeof t?.duration==`number`?t?.duration:200});return me(`keydown`,e=>{e.key===`Escape`&&i&&!e.isComposing&&n&&e.target?.getAttribute(`data-mantine-stop-propagation`)!==`true`&&a()},{capture:!0}),re({opened:n,shouldReturnFocus:r&&o}),{_id:s,titleMounted:c,bodyMounted:u,shouldLockScroll:p,setTitleMounted:l,setBodyMounted:f}}var M=function(){return M=Object.assign||function(e){for(var t,n=1,r=arguments.length;n`u`)return Xe;var t=Qe(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},et=Ye(),P=`data-scroll-locked`,tt=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),` .${Ee} { overflow: hidden ${r}; padding-right: ${s}px ${r}; diff --git a/internal/ui/dist/assets/auth-BeUORN-q.js b/internal/ui/dist/assets/auth-B1VNekWU.js similarity index 73% rename from internal/ui/dist/assets/auth-BeUORN-q.js rename to internal/ui/dist/assets/auth-B1VNekWU.js index 18b96097f..d9bda89e1 100644 --- a/internal/ui/dist/assets/auth-BeUORN-q.js +++ b/internal/ui/dist/assets/auth-B1VNekWU.js @@ -1 +1 @@ -import{A as e,C as t,K as n,Q as r,St as i,X as a,_ as o,a as s,c,d as l,et as ee,f as u,gt as d,h as f,i as te,j as p,k as ne,l as re,m,mt as h,o as g,p as _,r as ie,s as v,st as ae,t as oe,u as y,x as se,y as ce}from"./brand-MzZ03bSa.js";var b=i(d(),1),le=b.use,x=b.useLayoutEffect;function S(e,t,n){b.useEffect(()=>{if(!e.current||n||typeof IntersectionObserver!=`function`)return()=>t();let r=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`});return r.observe(e.current),()=>{r.disconnect(),t()}},[t,n,e])}function C(e){let t=b.useRef(null);return b.useImperativeHandle(e,()=>t.current,[]),t}var w=b.createContext(null);function T(e){return b.useContext(w)}function E(e){let t=T();return b.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function D(e){let t=T(),n=E(),r=b.useRef(null);return x(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function O({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){let[i,a]=(0,b.useState)(t===void 0?n:t);return e===void 0?[i,(e,...t)=>{a(e),r?.(e,...t)},!1]:[e,r,!0]}var k={root:`m_b183c0a2`},A=h(),ue=a((e,{color:t})=>({root:{"--code-bg":t?n(t,e):void 0}})),j=t(e=>{let t=p(`Code`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,color:c,block:l,mod:ee,attributes:u,...d}=t,f=ne({name:`Code`,props:t,classes:k,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:u,vars:s,varsResolver:ue});return(0,A.jsx)(se,{component:l?`pre`:`code`,mod:[{block:l},ee],...f(`root`),...d,dir:`ltr`})});j.classes=k,j.varsResolver=ue,j.displayName=`@mantine/core/Code`;function M(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":ae(t??`sm`,`pin-input-size`)}})),L=t(t=>{let{name:n,form:i,className:a,value:o,defaultValue:s,variant:c,gap:l,style:u,size:d,classNames:te,styles:re,unstyled:h,length:g,onChange:_,onComplete:ie,manageFocus:v,autoFocus:ae,error:oe,success:y,radius:se,disabled:ce,oneTimeCode:le,placeholder:x,type:S,mask:C,readOnly:w,inputType:T,inputMode:E,ariaLabel:D,vars:k,id:ue,hiddenInputProps:j,rootRef:L,getInputProps:R,attributes:z,ref:de,...fe}=p([`Input`,`PinInput`],F,t),B=ee(ue),pe=ne({name:`PinInput`,classes:N,props:t,className:a,style:u,classNames:te,styles:re,unstyled:h,attributes:z,vars:k,varsResolver:I}),{resolvedClassNames:V,resolvedStyles:H}=e({classNames:te,styles:re,props:t}),[U,me]=(0,b.useState)(-1),W=(0,b.useRef)([]),G=g??4,he=(0,b.useRef)(!1),[ge,K]=O({value:o===void 0?void 0:M(G,o),defaultValue:s?.split(``).slice(0,G),finalValue:M(G,``),onChange:e=>{let t=e.join(``).trim();_?.(t),t.length===G&&!he.current?(he.current=!0,ie?.(t)):t.length(S instanceof RegExp?S:S&&S in P?P[S]:null)?.test(e),X=(e,t)=>{if(v){if(e===`next`){let e=t+1;e=0&&W.current[e]?.focus()}}},Z=(e,t)=>{let n=[...q];return n[t]=e,K(n),n},_e=(e,t)=>{let n=e.target.value;if(n.length>1){if(n.length>2){if(Y(n)){K(M(G,n));let e=Math.min(n.length,G);e{let{ctrlKey:n,metaKey:r,key:i,shiftKey:a,target:o}=e,s=o.value;if(E===`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(),X(`prev`,t);break;case`ArrowRight`:e.preventDefault(),X(`next`,t);break;case`Tab`:a&&t>0&&v&&(e.preventDefault(),X(`prev`,t));break;case` `:e.preventDefault(),X(`next`,t);break;case`Delete`:e.preventDefault(),Z(``,t);break;case`Backspace`:s===``?(e.preventDefault(),X(`prev`,t)):(Z(``,t),t0&&i===q[t]&&(e.preventDefault(),X(`next`,t))}},ye=(e,t)=>{e.target.select(),me(t)},Q=()=>{me(-1)},$=e=>{e.preventDefault();let t=e.clipboardData.getData(`text/plain`).replace(/[\n\r\s]+/g,``);if(Y(t.trim())){let e=M(G,t);K(e);let n=e.filter(e=>e!==``).length;n>=G?W.current[G-1]?.focus():W.current[n]?.focus()}};return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(f,{...fe,...pe(`root`),ref:L,role:`group`,id:B,gap:l,unstyled:h,wrap:`nowrap`,variant:c,__size:d,dir:`ltr`,children:q.map((e,t)=>(0,b.createElement)(m,{component:`input`,...pe(`pinInput`,{style:{"--input-padding":`0`,"--input-text-align":`center`}}),classNames:V,styles:H,size:d,__staticSelector:`PinInput`,id:`${B}-${t+1}`,key:`${B}-${t}`,inputMode:E||(S===`number`?`numeric`:`text`),onChange:e=>_e(e,t),onKeyDown:e=>ve(e,t),onFocus:e=>ye(e,t),onBlur:Q,onPaste:$,type:T||(C?`password`:S===`number`?`tel`:`text`),radius:se,error:oe,success:y,variant:c,disabled:ce,ref:e=>{e&&(t===0&&r(de,e),W.current[t]=e)},autoComplete:le?`one-time-code`:`off`,placeholder:U===t?``:x,value:e,autoFocus:ae&&t===0,unstyled:h,"aria-label":D,readOnly:w,...R?.(t)}))}),(0,A.jsx)(`input`,{type:`hidden`,name:n,form:i,value:J,...j})]})});L.classes={...N,..._.classes},L.varsResolver=I,L.displayName=`@mantine/core/PinInput`;var R=t(e=>(0,A.jsx)(_,{component:`input`,...p([`Input`,`InputWrapper`,`TextInput`],null,e),__staticSelector:`TextInput`}));R.classes=_.classes,R.displayName=`@mantine/core/TextInput`;var z=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M112,56V200L40,128Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z`}))]]),de=new Map([[`bold`,b.createElement(b.Fragment,null,b.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`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M216,128l-72,72V56Z`,opacity:`0.2`}),b.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`,b.createElement(b.Fragment,null,b.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`,b.createElement(b.Fragment,null,b.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`,b.createElement(b.Fragment,null,b.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`,b.createElement(b.Fragment,null,b.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`}))]]),fe=new Map([[`bold`,b.createElement(b.Fragment,null,b.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`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z`,opacity:`0.2`}),b.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`,b.createElement(b.Fragment,null,b.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`,b.createElement(b.Fragment,null,b.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`,b.createElement(b.Fragment,null,b.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`,b.createElement(b.Fragment,null,b.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`}))]]),B=b.forwardRef((e,t)=>b.createElement(s,{ref:t,...e,weights:z}));B.displayName=`ArrowLeftIcon`;var pe=B,V=b.forwardRef((e,t)=>b.createElement(s,{ref:t,...e,weights:de}));V.displayName=`ArrowRightIcon`;var H=V,U=b.forwardRef((e,t)=>b.createElement(s,{ref:t,...e,weights:fe}));U.displayName=`UserPlusIcon`;var me=U,W=`fanout.access-token`,G=`fanout:unauthorized`;function he(){let e=new URLSearchParams(window.location.search).get(`return_to`);if(!e)return``;let t=new URL(e,window.location.origin);return t.origin!==window.location.origin||t.pathname!==`/api/auth/oauth/authorize`?``:`${t.pathname}${t.search}`}function ge(e){return!e||typeof e!=`object`||!(`id`in e)||typeof e.id!=`string`||e.id===``?`none`:`user`}function K(){localStorage.removeItem(W)}function q(){K(),window.dispatchEvent(new Event(G))}async function J(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&&q(),r.status===403){let e=await r.clone().json().catch(()=>({}));throw Error(e.message??e.error??`You do not have permission to perform this action.`)}return r}async function Y(){let e=await J(`/api/auth/logout`,{method:`POST`});if(!e.ok&&e.status!==401)throw Error(`Sign-out failed — your session is still active.`);e.status!==401&&q(),window.location.assign(`/`)}var X=(0,b.createContext)(null);function Z(){let e=(0,b.useContext)(X);if(!e)throw Error(`Fanout runtime status is unavailable`);return e}var _e=(0,b.createContext)(null);function ve(){let e=(0,b.useContext)(_e);if(!e)throw Error(`Fanout viewer is unavailable`);return e}function ye(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||t.id===``?null:{id:t.id,email:typeof t.email==`string`?t.email:``,name:typeof t.name==`string`?t.name:``,role:typeof t.role==`string`?t.role:``}}async function Q(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??r.error??`Request failed (${n.status})`);return r}function $({children:e,wide:t=!1}){return(0,A.jsx)(se,{mih:`100dvh`,style:{background:`radial-gradient(circle at 50% -12%, var(--mantine-color-brand-light), transparent 38%), linear-gradient(180deg, var(--mantine-color-default-hover), var(--mantine-color-body) 62%)`},children:(0,A.jsx)(re,{mih:`100dvh`,px:`md`,py:48,children:(0,A.jsx)(c,{size:t?680:480,w:`100%`,children:(0,A.jsx)(ce,{radius:28,p:{base:24,sm:40},style:{background:`var(--mantine-color-body)`,border:`1px solid var(--mantine-color-default-border)`,boxShadow:`var(--mantine-shadow-xl)`},children:e})})})})}function be(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`setup_token`)??``}function xe(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`login_token`)??``}function Se({children:e}){let t=E(),[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(!1),[s,c]=(0,b.useState)(`none`),[ee,d]=(0,b.useState)(null),[p,ne]=(0,b.useState)(!1),[m,h]=(0,b.useState)(``),[_,ae]=(0,b.useState)(``),[ce,le]=(0,b.useState)(be),[x,S]=(0,b.useState)(xe),[C,w]=(0,b.useState)(``),[T,D]=(0,b.useState)(!1),[O,k]=(0,b.useState)(0),[ue,M]=(0,b.useState)(()=>Date.now()),[N,P]=(0,b.useState)(!1),[F,I]=(0,b.useState)(``),[z,de]=(0,b.useState)(null),[fe,B]=(0,b.useState)(!1),V=(0,b.useRef)(null),U=he(),W=s===`user`;async function q(){let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok){c(`none`),d(null);return}let t=await e.json().catch(()=>null);c(ge(t)),d(ye(t))}async function J(){try{let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok)return;d(ye(await e.json().catch(()=>null)))}catch{}}(0,b.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,b.useEffect)(()=>{K(),Q(`/api/auth/status`).then(r).catch(e=>I(String(e))).finally(()=>a(!0)),q().catch(()=>c(`none`)).finally(()=>ne(!0));let e=()=>{c(`none`),d(null)};return window.addEventListener(G,e),()=>window.removeEventListener(G,e)},[]),(0,b.useEffect)(()=>{p&&s===`none`&&x&&(P(!0),I(``),Q(`/api/auth/login-link`,{token:x}).then(()=>{c(`user`),J()}).catch(e=>I(e instanceof Error?e.message:String(e))).finally(()=>{S(``),P(!1)}))},[x,p,s]),(0,b.useEffect)(()=>{W&&p&&U&&window.location.replace(U)},[W,U,p]),(0,b.useEffect)(()=>{if(O<=Date.now())return;let e=setInterval(()=>{M(Date.now()),Date.now()>=O&&clearInterval(e)},1e3);return()=>clearInterval(e)},[O]);let Y=Math.max(0,Math.ceil((O-ue)/1e3));(0,b.useEffect)(()=>{T&&!N&&F&&V.current?.querySelector(`input`)?.focus()},[N,T,F]);async function Z(e){try{await navigator.clipboard.writeText(e),B(!0)}catch{I(`Clipboard access failed. Select and copy the token manually.`)}}if(z?.ingest_token)return(0,A.jsx)($,{wide:!0,children:(0,A.jsxs)(v,{gap:`lg`,children:[(0,A.jsx)(oe,{}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(l,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Setup complete`}),(0,A.jsx)(g,{order:1,mt:`xs`,fz:{base:28,sm:32},lh:1.08,children:`Save your ingest token`})]}),(0,A.jsx)(l,{c:`dimmed`,children:`Fanout shows this token once. Store it with your collector secrets before continuing.`}),(0,A.jsxs)(v,{gap:`xs`,children:[(0,A.jsx)(l,{size:`sm`,fw:600,children:`OTLP endpoint`}),(0,A.jsx)(j,{block:!0,children:z.suggested_endpoint??`${window.location.hostname}:4317`})]}),(0,A.jsxs)(v,{gap:`xs`,children:[(0,A.jsx)(l,{size:`sm`,fw:600,children:`Header`}),(0,A.jsxs)(j,{block:!0,children:[z.ingest_header_name??`Authorization`,`: Bearer `,z.ingest_token]})]}),F&&(0,A.jsx)(u,{color:`bad`,radius:`md`,children:F}),(0,A.jsxs)(f,{grow:!0,align:`stretch`,children:[(0,A.jsx)(y,{variant:`light`,radius:`md`,leftSection:fe?(0,A.jsx)(te,{size:16,weight:`bold`}):(0,A.jsx)(ie,{size:16}),onClick:()=>void Z(`${z.ingest_header_name??`Authorization`}: Bearer ${z.ingest_token}`),children:fe?`Copied`:`Copy header`}),(0,A.jsx)(y,{radius:`md`,rightSection:(0,A.jsx)(H,{size:16,weight:`bold`}),onClick:()=>{c(`user`),de(null),J()},children:`Continue to Fanout`})]}),(0,A.jsx)(y,{variant:`subtle`,size:`compact-xs`,onClick:()=>void Z(z.ingest_token??``),children:`Copy token only`})]})});if(!p||!i||x)return(0,A.jsx)(re,{mih:`100dvh`,children:(0,A.jsx)(o,{size:`sm`})});if(!n)return(0,A.jsx)($,{children:(0,A.jsxs)(v,{gap:`lg`,children:[(0,A.jsx)(oe,{}),(0,A.jsx)(g,{order:1,children:`Fanout is unavailable`}),(0,A.jsx)(u,{color:`bad`,radius:`md`,children:F||`Authentication status could not be loaded.`})]})});if(W&&U)return null;if(W)return(0,A.jsx)(X.Provider,{value:n,children:(0,A.jsx)(_e.Provider,{value:ee??{id:``,email:m,name:_,role:``},children:e})});if(n&&!n.setup_required&&n.auth_mode===`oidc`){let e=U?`/api/auth/oidc/start?return_to=${encodeURIComponent(U)}`:`/api/auth/oidc/start`;return(0,A.jsx)($,{children:(0,A.jsxs)(v,{gap:28,children:[(0,A.jsx)(oe,{}),(0,A.jsxs)(v,{gap:10,children:[(0,A.jsx)(l,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Secure workspace`}),(0,A.jsx)(g,{order:1,fz:{base:28,sm:32},lh:1.08,children:`Sign in`}),(0,A.jsx)(l,{c:`dimmed`,size:`md`,lh:1.6,children:`Use your organization's identity provider to continue.`})]}),F&&(0,A.jsx)(u,{color:`bad`,radius:`md`,children:F}),(0,A.jsx)(y,{component:`a`,href:e,size:`md`,radius:`md`,rightSection:(0,A.jsx)(H,{size:17,weight:`bold`}),children:`Continue with SSO`})]})})}async function ve(){P(!0),I(``);try{await Q(`/api/auth/start`,{email:m}),D(!0),w(``),k(Date.now()+3e4),M(Date.now())}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}}async function Se(e){P(!0),I(``);try{await Q(`/api/auth/verify`,{email:m,code:e}),c(`user`),D(!1),w(``),k(0),J()}catch(e){w(``),I(e instanceof Error?e.message:String(e))}finally{P(!1)}}function Ce(){D(!1),w(``),I(``)}async function we(e){e.preventDefault(),P(!0),I(``);try{if(n?.setup_required){let e=await Q(`/api/auth/setup`,{email:m,name:_,setup_token:ce});e.ingest_token?de(e):(c(`user`),J())}else if(T){await Se(C);return}else{await ve();return}}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}}let Te=T&&!n?.setup_required,Ee=n?.setup_required?`Create the first admin`:Te?`Check your email`:n?.self_signup?`Sign in or create an account`:`Sign in`,De=n?.setup_required?`Use the one-time token printed by the Fanout process.`:n?.smtp_configured?Te?`We sent a code to ${m}.`:n?.self_signup?`Enter your email to sign in or create a viewer account. No password needed.`:`Enter your email and we’ll send a short verification code. No password needed.`:`Email delivery is not configured. Ask the operator to run fanout login-link with your email address.`;return(0,A.jsx)($,{children:(0,A.jsxs)(v,{gap:28,children:[(0,A.jsx)(oe,{}),(0,A.jsxs)(v,{gap:10,children:[(0,A.jsx)(l,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:n?.setup_required?`One-time setup`:`Secure workspace`}),(0,A.jsx)(g,{order:1,fz:{base:28,sm:32},lh:1.08,children:Ee}),De&&(0,A.jsx)(l,{c:`dimmed`,size:`md`,lh:1.6,maw:390,children:De})]}),(0,A.jsx)(`form`,{onSubmit:we,children:(0,A.jsxs)(v,{gap:`md`,children:[(0,A.jsx)(R,{label:`Email`,placeholder:`you@company.com`,type:`email`,required:!0,value:m,onChange:e=>h(e.currentTarget.value),disabled:T,variant:`filled`,radius:`md`,size:`md`,autoFocus:!T}),n?.setup_required&&(0,A.jsx)(R,{label:`Name`,placeholder:`Your name`,value:_,onChange:e=>ae(e.currentTarget.value),variant:`filled`,radius:`md`,size:`md`}),n?.setup_required&&(0,A.jsx)(R,{label:`Setup token`,placeholder:`from the setup URL printed at startup`,required:!0,value:ce,onChange:e=>le(e.currentTarget.value),autoComplete:`one-time-code`,variant:`filled`,radius:`md`,size:`md`}),Te&&(0,A.jsxs)(v,{gap:`xs`,children:[(0,A.jsx)(l,{size:`sm`,fw:600,children:`Verification code`}),(0,A.jsx)(se,{ref:V,children:(0,A.jsx)(L,{length:6,type:`number`,oneTimeCode:!0,autoFocus:!0,value:C,onChange:w,onComplete:e=>void Se(e),disabled:N,error:!!F,size:`md`,radius:`md`,"aria-label":`Verification code`,getInputProps:e=>({"aria-label":`Digit ${e+1}`})})}),(0,A.jsxs)(f,{justify:`space-between`,gap:`xs`,children:[(0,A.jsxs)(l,{c:`dimmed`,size:`xs`,children:[`Sent to `,m]}),(0,A.jsx)(y,{variant:`subtle`,size:`compact-xs`,leftSection:(0,A.jsx)(pe,{size:12,weight:`bold`}),onClick:Ce,disabled:N,children:`Change email`})]}),(0,A.jsxs)(f,{justify:`space-between`,gap:`xs`,children:[(0,A.jsx)(l,{c:`dimmed`,size:`xs`,children:`Codes expire in 5 minutes`}),(0,A.jsx)(y,{variant:`subtle`,size:`compact-xs`,onClick:()=>void ve(),disabled:N||Y>0,children:Y>0?`Resend in ${Y}s`:`Resend code`})]})]}),F&&(0,A.jsx)(u,{color:`bad`,radius:`md`,children:F}),Te?(0,A.jsx)(y,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:N,disabled:N||C.length<6,rightSection:(0,A.jsx)(H,{size:17,weight:`bold`}),children:`Verify code`}):(0,A.jsx)(y,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:N,disabled:!n||!n.setup_required&&!n.smtp_configured,leftSection:n?.setup_required?(0,A.jsx)(me,{size:17,weight:`bold`}):void 0,rightSection:n?.setup_required?void 0:(0,A.jsx)(H,{size:17,weight:`bold`}),children:n?.setup_required?`Create admin`:`Send code`})]})})]})})}export{Y as a,O as c,T as d,w as f,x as g,S as h,J as i,D as l,C as m,Z as n,R as o,le as p,ve as r,j as s,Se as t,E as u}; \ No newline at end of file +import{A as e,C as t,K as n,Q as r,St as i,X as a,_ as o,a as s,c,d as l,et as ee,f as u,gt as d,h as f,i as te,j as p,k as ne,l as re,m,mt as h,o as g,p as _,r as ie,s as v,st as ae,t as oe,u as y,x as se,y as ce}from"./brand-MzZ03bSa.js";var b=i(d(),1),le=b.use,x=b.useLayoutEffect;function S(e,t,n){b.useEffect(()=>{if(!e.current||n||typeof IntersectionObserver!=`function`)return()=>t();let r=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`});return r.observe(e.current),()=>{r.disconnect(),t()}},[t,n,e])}function C(e){let t=b.useRef(null);return b.useImperativeHandle(e,()=>t.current,[]),t}var w=b.createContext(null);function T(e){return b.useContext(w)}function E(e){let t=T();return b.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function D(e){let t=T(),n=E(),r=b.useRef(null);return x(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function O({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){let[i,a]=(0,b.useState)(t===void 0?n:t);return e===void 0?[i,(e,...t)=>{a(e),r?.(e,...t)},!1]:[e,r,!0]}var k={root:`m_b183c0a2`},A=h(),ue=a((e,{color:t})=>({root:{"--code-bg":t?n(t,e):void 0}})),j=t(e=>{let t=p(`Code`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,color:c,block:l,mod:ee,attributes:u,...d}=t,f=ne({name:`Code`,props:t,classes:k,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:u,vars:s,varsResolver:ue});return(0,A.jsx)(se,{component:l?`pre`:`code`,mod:[{block:l},ee],...f(`root`),...d,dir:`ltr`})});j.classes=k,j.varsResolver=ue,j.displayName=`@mantine/core/Code`;function M(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":ae(t??`sm`,`pin-input-size`)}})),L=t(t=>{let{name:n,form:i,className:a,value:o,defaultValue:s,variant:c,gap:l,style:u,size:d,classNames:te,styles:re,unstyled:h,length:g,onChange:_,onComplete:ie,manageFocus:v,autoFocus:ae,error:oe,success:y,radius:se,disabled:ce,oneTimeCode:le,placeholder:x,type:S,mask:C,readOnly:w,inputType:T,inputMode:E,ariaLabel:D,vars:k,id:ue,hiddenInputProps:j,rootRef:L,getInputProps:R,attributes:z,ref:de,...fe}=p([`Input`,`PinInput`],F,t),B=ee(ue),pe=ne({name:`PinInput`,classes:N,props:t,className:a,style:u,classNames:te,styles:re,unstyled:h,attributes:z,vars:k,varsResolver:I}),{resolvedClassNames:V,resolvedStyles:H}=e({classNames:te,styles:re,props:t}),[U,me]=(0,b.useState)(-1),W=(0,b.useRef)([]),G=g??4,he=(0,b.useRef)(!1),[ge,K]=O({value:o===void 0?void 0:M(G,o),defaultValue:s?.split(``).slice(0,G),finalValue:M(G,``),onChange:e=>{let t=e.join(``).trim();_?.(t),t.length===G&&!he.current?(he.current=!0,ie?.(t)):t.length(S instanceof RegExp?S:S&&S in P?P[S]:null)?.test(e),X=(e,t)=>{if(v){if(e===`next`){let e=t+1;e=0&&W.current[e]?.focus()}}},Z=(e,t)=>{let n=[...q];return n[t]=e,K(n),n},_e=(e,t)=>{let n=e.target.value;if(n.length>1){if(n.length>2){if(Y(n)){K(M(G,n));let e=Math.min(n.length,G);e{let{ctrlKey:n,metaKey:r,key:i,shiftKey:a,target:o}=e,s=o.value;if(E===`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(),X(`prev`,t);break;case`ArrowRight`:e.preventDefault(),X(`next`,t);break;case`Tab`:a&&t>0&&v&&(e.preventDefault(),X(`prev`,t));break;case` `:e.preventDefault(),X(`next`,t);break;case`Delete`:e.preventDefault(),Z(``,t);break;case`Backspace`:s===``?(e.preventDefault(),X(`prev`,t)):(Z(``,t),t0&&i===q[t]&&(e.preventDefault(),X(`next`,t))}},ye=(e,t)=>{e.target.select(),me(t)},Q=()=>{me(-1)},$=e=>{e.preventDefault();let t=e.clipboardData.getData(`text/plain`).replace(/[\n\r\s]+/g,``);if(Y(t.trim())){let e=M(G,t);K(e);let n=e.filter(e=>e!==``).length;n>=G?W.current[G-1]?.focus():W.current[n]?.focus()}};return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(f,{...fe,...pe(`root`),ref:L,role:`group`,id:B,gap:l,unstyled:h,wrap:`nowrap`,variant:c,__size:d,dir:`ltr`,children:q.map((e,t)=>(0,b.createElement)(m,{component:`input`,...pe(`pinInput`,{style:{"--input-padding":`0`,"--input-text-align":`center`}}),classNames:V,styles:H,size:d,__staticSelector:`PinInput`,id:`${B}-${t+1}`,key:`${B}-${t}`,inputMode:E||(S===`number`?`numeric`:`text`),onChange:e=>_e(e,t),onKeyDown:e=>ve(e,t),onFocus:e=>ye(e,t),onBlur:Q,onPaste:$,type:T||(C?`password`:S===`number`?`tel`:`text`),radius:se,error:oe,success:y,variant:c,disabled:ce,ref:e=>{e&&(t===0&&r(de,e),W.current[t]=e)},autoComplete:le?`one-time-code`:`off`,placeholder:U===t?``:x,value:e,autoFocus:ae&&t===0,unstyled:h,"aria-label":D,readOnly:w,...R?.(t)}))}),(0,A.jsx)(`input`,{type:`hidden`,name:n,form:i,value:J,...j})]})});L.classes={...N,..._.classes},L.varsResolver=I,L.displayName=`@mantine/core/PinInput`;var R=t(e=>(0,A.jsx)(_,{component:`input`,...p([`Input`,`InputWrapper`,`TextInput`],null,e),__staticSelector:`TextInput`}));R.classes=_.classes,R.displayName=`@mantine/core/TextInput`;var z=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M112,56V200L40,128Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z`}))]]),de=new Map([[`bold`,b.createElement(b.Fragment,null,b.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`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M216,128l-72,72V56Z`,opacity:`0.2`}),b.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`,b.createElement(b.Fragment,null,b.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`,b.createElement(b.Fragment,null,b.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`,b.createElement(b.Fragment,null,b.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`,b.createElement(b.Fragment,null,b.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`}))]]),fe=new Map([[`bold`,b.createElement(b.Fragment,null,b.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`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z`,opacity:`0.2`}),b.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`,b.createElement(b.Fragment,null,b.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`,b.createElement(b.Fragment,null,b.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`,b.createElement(b.Fragment,null,b.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`,b.createElement(b.Fragment,null,b.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`}))]]),B=b.forwardRef((e,t)=>b.createElement(s,{ref:t,...e,weights:z}));B.displayName=`ArrowLeftIcon`;var pe=B,V=b.forwardRef((e,t)=>b.createElement(s,{ref:t,...e,weights:de}));V.displayName=`ArrowRightIcon`;var H=V,U=b.forwardRef((e,t)=>b.createElement(s,{ref:t,...e,weights:fe}));U.displayName=`UserPlusIcon`;var me=U,W=`fanout.access-token`,G=`fanout:unauthorized`;function he(){let e=new URLSearchParams(window.location.search).get(`return_to`);if(!e)return``;let t=new URL(e,window.location.origin);return t.origin!==window.location.origin||t.pathname!==`/api/auth/oauth/authorize`?``:`${t.pathname}${t.search}`}function ge(e){return!e||typeof e!=`object`||!(`id`in e)||typeof e.id!=`string`||e.id===``?`none`:`user`}function K(){localStorage.removeItem(W)}function q(){K(),window.dispatchEvent(new Event(G))}async function J(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&&q(),r.status===403){let e=await r.clone().json().catch(()=>({}));throw Error(e.message??e.error??`You do not have permission to perform this action.`)}return r}async function Y(){let e=await J(`/api/auth/logout`,{method:`POST`});if(!e.ok&&e.status!==401)throw Error(`Sign-out failed — your session is still active.`);e.status!==401&&q(),window.location.assign(`/`)}var X=(0,b.createContext)(null);function Z(){let e=(0,b.useContext)(X);if(!e)throw Error(`Fanout runtime status is unavailable`);return e}var _e=(0,b.createContext)(null);function ve(){let e=(0,b.useContext)(_e);if(!e)throw Error(`Fanout viewer is unavailable`);return e}function ye(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||t.id===``?null:{id:t.id,email:typeof t.email==`string`?t.email:``,name:typeof t.name==`string`?t.name:``,role:typeof t.role==`string`?t.role:``}}async function Q(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??r.error??`Request failed (${n.status})`);return r}function $({children:e,wide:t=!1}){return(0,A.jsx)(se,{mih:`100dvh`,style:{background:`radial-gradient(circle at 50% -12%, var(--mantine-color-brand-light), transparent 38%), linear-gradient(180deg, var(--mantine-color-default-hover), var(--mantine-color-body) 62%)`},children:(0,A.jsx)(re,{mih:`100dvh`,px:`md`,py:48,children:(0,A.jsx)(c,{size:t?680:480,w:`100%`,children:(0,A.jsx)(ce,{radius:28,p:{base:24,sm:40},style:{background:`var(--mantine-color-body)`,border:`1px solid var(--mantine-color-default-border)`,boxShadow:`var(--mantine-shadow-xl)`},children:e})})})})}function be(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`setup_token`)??``}function xe(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`login_token`)??``}function Se({children:e}){let t=E(),[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(!1),[s,c]=(0,b.useState)(`none`),[ee,d]=(0,b.useState)(null),[p,ne]=(0,b.useState)(!1),[m,h]=(0,b.useState)(``),[_,ae]=(0,b.useState)(``),[ce,le]=(0,b.useState)(be),[x,S]=(0,b.useState)(xe),[C,w]=(0,b.useState)(``),[T,D]=(0,b.useState)(!1),[O,k]=(0,b.useState)(0),[ue,M]=(0,b.useState)(()=>Date.now()),[N,P]=(0,b.useState)(!1),[F,I]=(0,b.useState)(``),[z,de]=(0,b.useState)(null),[fe,B]=(0,b.useState)(!1),V=(0,b.useRef)(null),U=he(),W=s===`user`;async function q(){let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok){c(`none`),d(null);return}let t=await e.json().catch(()=>null);c(ge(t)),d(ye(t))}async function J(){try{let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok)return;d(ye(await e.json().catch(()=>null)))}catch{}}(0,b.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,b.useEffect)(()=>{K(),Q(`/api/auth/status`).then(r).catch(e=>I(String(e))).finally(()=>a(!0)),q().catch(()=>c(`none`)).finally(()=>ne(!0));let e=()=>{c(`none`),d(null)};return window.addEventListener(G,e),()=>window.removeEventListener(G,e)},[]),(0,b.useEffect)(()=>{p&&s===`none`&&x&&(P(!0),I(``),Q(`/api/auth/login-link`,{token:x}).then(()=>{c(`user`),J()}).catch(e=>I(e instanceof Error?e.message:String(e))).finally(()=>{S(``),P(!1)}))},[x,p,s]),(0,b.useEffect)(()=>{W&&p&&U&&window.location.replace(U)},[W,U,p]),(0,b.useEffect)(()=>{if(O<=Date.now())return;let e=setInterval(()=>{M(Date.now()),Date.now()>=O&&clearInterval(e)},1e3);return()=>clearInterval(e)},[O]);let Y=Math.max(0,Math.ceil((O-ue)/1e3));(0,b.useEffect)(()=>{T&&!N&&F&&V.current?.querySelector(`input`)?.focus()},[N,T,F]);async function Z(e){try{await navigator.clipboard.writeText(e),B(!0)}catch{I(`Clipboard access failed. Select and copy the token manually.`)}}if(z?.ingest_token)return(0,A.jsx)($,{wide:!0,children:(0,A.jsxs)(v,{gap:`lg`,children:[(0,A.jsx)(oe,{}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(l,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Setup complete`}),(0,A.jsx)(g,{order:1,mt:`xs`,fz:{base:28,sm:32},lh:1.08,children:`Save your ingest token`})]}),(0,A.jsx)(l,{c:`dimmed`,children:`Fanout shows this token once. Store it with your collector secrets before continuing.`}),(0,A.jsxs)(v,{gap:`xs`,children:[(0,A.jsx)(l,{size:`sm`,fw:600,children:`OTLP endpoint`}),(0,A.jsx)(j,{block:!0,children:z.suggested_endpoint??window.location.origin})]}),(0,A.jsxs)(v,{gap:`xs`,children:[(0,A.jsx)(l,{size:`sm`,fw:600,children:`Header`}),(0,A.jsxs)(j,{block:!0,children:[z.ingest_header_name??`Authorization`,`: Bearer `,z.ingest_token]})]}),F&&(0,A.jsx)(u,{color:`bad`,radius:`md`,children:F}),(0,A.jsxs)(f,{grow:!0,align:`stretch`,children:[(0,A.jsx)(y,{variant:`light`,radius:`md`,leftSection:fe?(0,A.jsx)(te,{size:16,weight:`bold`}):(0,A.jsx)(ie,{size:16}),onClick:()=>void Z(`${z.ingest_header_name??`Authorization`}: Bearer ${z.ingest_token}`),children:fe?`Copied`:`Copy header`}),(0,A.jsx)(y,{radius:`md`,rightSection:(0,A.jsx)(H,{size:16,weight:`bold`}),onClick:()=>{c(`user`),de(null),J()},children:`Continue to Fanout`})]}),(0,A.jsx)(y,{variant:`subtle`,size:`compact-xs`,onClick:()=>void Z(z.ingest_token??``),children:`Copy token only`})]})});if(!p||!i||x)return(0,A.jsx)(re,{mih:`100dvh`,children:(0,A.jsx)(o,{size:`sm`})});if(!n)return(0,A.jsx)($,{children:(0,A.jsxs)(v,{gap:`lg`,children:[(0,A.jsx)(oe,{}),(0,A.jsx)(g,{order:1,children:`Fanout is unavailable`}),(0,A.jsx)(u,{color:`bad`,radius:`md`,children:F||`Authentication status could not be loaded.`})]})});if(W&&U)return null;if(W)return(0,A.jsx)(X.Provider,{value:n,children:(0,A.jsx)(_e.Provider,{value:ee??{id:``,email:m,name:_,role:``},children:e})});if(n&&!n.setup_required&&n.auth_mode===`oidc`){let e=U?`/api/auth/oidc/start?return_to=${encodeURIComponent(U)}`:`/api/auth/oidc/start`;return(0,A.jsx)($,{children:(0,A.jsxs)(v,{gap:28,children:[(0,A.jsx)(oe,{}),(0,A.jsxs)(v,{gap:10,children:[(0,A.jsx)(l,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Secure workspace`}),(0,A.jsx)(g,{order:1,fz:{base:28,sm:32},lh:1.08,children:`Sign in`}),(0,A.jsx)(l,{c:`dimmed`,size:`md`,lh:1.6,children:`Use your organization's identity provider to continue.`})]}),F&&(0,A.jsx)(u,{color:`bad`,radius:`md`,children:F}),(0,A.jsx)(y,{component:`a`,href:e,size:`md`,radius:`md`,rightSection:(0,A.jsx)(H,{size:17,weight:`bold`}),children:`Continue with SSO`})]})})}async function ve(){P(!0),I(``);try{await Q(`/api/auth/start`,{email:m}),D(!0),w(``),k(Date.now()+3e4),M(Date.now())}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}}async function Se(e){P(!0),I(``);try{await Q(`/api/auth/verify`,{email:m,code:e}),c(`user`),D(!1),w(``),k(0),J()}catch(e){w(``),I(e instanceof Error?e.message:String(e))}finally{P(!1)}}function Ce(){D(!1),w(``),I(``)}async function we(e){e.preventDefault(),P(!0),I(``);try{if(n?.setup_required){let e=await Q(`/api/auth/setup`,{email:m,name:_,setup_token:ce});e.ingest_token?de(e):(c(`user`),J())}else if(T){await Se(C);return}else{await ve();return}}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}}let Te=T&&!n?.setup_required,Ee=n?.setup_required?`Create the first admin`:Te?`Check your email`:n?.self_signup?`Sign in or create an account`:`Sign in`,De=n?.setup_required?`Use the one-time token printed by the Fanout process.`:n?.smtp_configured?Te?`We sent a code to ${m}.`:n?.self_signup?`Enter your email to sign in or create a viewer account. No password needed.`:`Enter your email and we’ll send a short verification code. No password needed.`:`Email delivery is not configured. Ask the operator to run fanout login-link with your email address.`;return(0,A.jsx)($,{children:(0,A.jsxs)(v,{gap:28,children:[(0,A.jsx)(oe,{}),(0,A.jsxs)(v,{gap:10,children:[(0,A.jsx)(l,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:n?.setup_required?`One-time setup`:`Secure workspace`}),(0,A.jsx)(g,{order:1,fz:{base:28,sm:32},lh:1.08,children:Ee}),De&&(0,A.jsx)(l,{c:`dimmed`,size:`md`,lh:1.6,maw:390,children:De})]}),(0,A.jsx)(`form`,{onSubmit:we,children:(0,A.jsxs)(v,{gap:`md`,children:[(0,A.jsx)(R,{label:`Email`,placeholder:`you@company.com`,type:`email`,required:!0,value:m,onChange:e=>h(e.currentTarget.value),disabled:T,variant:`filled`,radius:`md`,size:`md`,autoFocus:!T}),n?.setup_required&&(0,A.jsx)(R,{label:`Name`,placeholder:`Your name`,value:_,onChange:e=>ae(e.currentTarget.value),variant:`filled`,radius:`md`,size:`md`}),n?.setup_required&&(0,A.jsx)(R,{label:`Setup token`,placeholder:`from the setup URL printed at startup`,required:!0,value:ce,onChange:e=>le(e.currentTarget.value),autoComplete:`one-time-code`,variant:`filled`,radius:`md`,size:`md`}),Te&&(0,A.jsxs)(v,{gap:`xs`,children:[(0,A.jsx)(l,{size:`sm`,fw:600,children:`Verification code`}),(0,A.jsx)(se,{ref:V,children:(0,A.jsx)(L,{length:6,type:`number`,oneTimeCode:!0,autoFocus:!0,value:C,onChange:w,onComplete:e=>void Se(e),disabled:N,error:!!F,size:`md`,radius:`md`,"aria-label":`Verification code`,getInputProps:e=>({"aria-label":`Digit ${e+1}`})})}),(0,A.jsxs)(f,{justify:`space-between`,gap:`xs`,children:[(0,A.jsxs)(l,{c:`dimmed`,size:`xs`,children:[`Sent to `,m]}),(0,A.jsx)(y,{variant:`subtle`,size:`compact-xs`,leftSection:(0,A.jsx)(pe,{size:12,weight:`bold`}),onClick:Ce,disabled:N,children:`Change email`})]}),(0,A.jsxs)(f,{justify:`space-between`,gap:`xs`,children:[(0,A.jsx)(l,{c:`dimmed`,size:`xs`,children:`Codes expire in 5 minutes`}),(0,A.jsx)(y,{variant:`subtle`,size:`compact-xs`,onClick:()=>void ve(),disabled:N||Y>0,children:Y>0?`Resend in ${Y}s`:`Resend code`})]})]}),F&&(0,A.jsx)(u,{color:`bad`,radius:`md`,children:F}),Te?(0,A.jsx)(y,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:N,disabled:N||C.length<6,rightSection:(0,A.jsx)(H,{size:17,weight:`bold`}),children:`Verify code`}):(0,A.jsx)(y,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:N,disabled:!n||!n.setup_required&&!n.smtp_configured,leftSection:n?.setup_required?(0,A.jsx)(me,{size:17,weight:`bold`}):void 0,rightSection:n?.setup_required?void 0:(0,A.jsx)(H,{size:17,weight:`bold`}),children:n?.setup_required?`Create admin`:`Send code`})]})})]})})}export{Y as a,O as c,T as d,w as f,x as g,S as h,J as i,D as l,C as m,Z as n,R as o,le as p,ve as r,j as s,Se as t,E as u}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat-B-nb-Yp3.js b/internal/ui/dist/assets/chat-B3ZKcKVO.js similarity index 99% rename from internal/ui/dist/assets/chat-B-nb-Yp3.js rename to internal/ui/dist/assets/chat-B3ZKcKVO.js index fe17fa291..423b7bf2e 100644 --- a/internal/ui/dist/assets/chat-B-nb-Yp3.js +++ b/internal/ui/dist/assets/chat-B3ZKcKVO.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mcp-app-frame-BZJusU6-.js","assets/brand-MzZ03bSa.js","assets/auth-BeUORN-q.js","assets/use-computed-color-scheme-6JIsge00.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mcp-app-frame-GqrqdVoY.js","assets/brand-MzZ03bSa.js","assets/auth-B1VNekWU.js","assets/use-computed-color-scheme-6JIsge00.js"])))=>i.map(i=>d[i]); import{$ as e,C as t,St as n,_ as r,_t as i,a,c as o,d as s,f as c,gt as l,h as u,i as d,j as f,k as p,l as m,mt as h,n as g,o as _,p as v,r as y,s as b,u as x,x as S,y as C,yt as w}from"./brand-MzZ03bSa.js";import{t as T}from"./Tooltip-BJiO7C_G.js";import{a as E,o as D,t as O}from"./preload-helper-BL3qEkUh.js";import{c as k,n as ee,s as te}from"./format-urrStEsn.js";function A(){return`development`}var j=n(l(),1),M=h(),ne=[`borderBottomWidth`,`borderLeftWidth`,`borderRightWidth`,`borderTopWidth`,`boxSizing`,`fontFamily`,`fontSize`,`fontStyle`,`fontWeight`,`letterSpacing`,`lineHeight`,`paddingBottom`,`paddingLeft`,`paddingRight`,`paddingTop`,`tabSize`,`textIndent`,`textRendering`,`textTransform`,`width`,`wordBreak`,`wordSpacing`,`scrollbarGutter`],N={"min-height":`0`,"max-height":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`,display:`block`};function re(e){Object.keys(N).forEach(t=>{e.style.setProperty(t,N[t],`important`)})}function ie(e){let t=window.getComputedStyle(e);if(t===null)return null;let n={};for(let e of ne)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 P=null;function ae(e,t,n=1,r=1/0){P||(P=document.createElement(`textarea`),P.setAttribute(`tabindex`,`-1`),P.setAttribute(`aria-hidden`,`true`),P.setAttribute(`aria-label`,`autosize measurement`),re(P)),P.parentNode===null&&document.body.appendChild(P);let{paddingSize:i,borderSize:a,sizingStyle:o}=e,{boxSizing:s}=o;Object.keys(o).forEach(e=>{P.style[e]=o[e]}),re(P),P.value=t;let c=s===`border-box`?P.scrollHeight+a:P.scrollHeight-i;P.value=t,c=s===`border-box`?P.scrollHeight+a:P.scrollHeight-i,P.value=`x`;let l=P.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 oe({maxRows:t,minRows:n,onChange:r,ref:i,...a}){let o=a.value!==void 0,s=(0,j.useRef)(null),c=e(s,i),l=(0,j.useRef)(0),u=(0,j.useRef)(0),d=()=>{let e=s.current;if(!e)return;let r=ie(e);if(!r)return;let[i]=ae(r,e.value||e.placeholder||`x`,n,t);l.current!==i&&(l.current=i,e.style.setProperty(`height`,`${i}px`,`important`))},f=e=>{o||d(),r?.(e)};return(0,j.useLayoutEffect)(d),(0,j.useEffect)(()=>{let e=()=>d();return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,j.useEffect)(()=>{let e=s.current;if(!e||typeof ResizeObserver>`u`)return;u.current=e.offsetWidth;let t=new ResizeObserver(()=>{s.current&&s.current.offsetWidth!==u.current&&(u.current=s.current.offsetWidth,d())});return t.observe(e),()=>t.disconnect()},[]),(0,j.useEffect)(()=>{let e=()=>d();return document.fonts.addEventListener(`loadingdone`,e),()=>document.fonts.removeEventListener(`loadingdone`,e)},[]),(0,j.useEffect)(()=>{let e=e=>{if(s.current?.form===e.target&&!o){let e=s.current.value;requestAnimationFrame(()=>{s.current&&e!==s.current.value&&d()})}};return document.body.addEventListener(`reset`,e),()=>document.body.removeEventListener(`reset`,e)},[o]),(0,M.jsx)(`textarea`,{rows:n,...a,onChange:f,ref:c})}var se=t(e=>{let{autosize:t,maxRows:n,minRows:r,__staticSelector:i,resize:a,bottomSection:o,bottomSectionProps:s,...c}=f([`Input`,`InputWrapper`,`Textarea`],null,e),l=t&&A()!==`test`,u=l?{maxRows:n,minRows:r}:{};return(0,M.jsx)(v,{component:l?oe:`textarea`,...c,__staticSelector:i||`Textarea`,__bottomSection:o,__bottomSectionProps:s,multiline:!0,"data-no-overflow":t&&n===void 0||void 0,__vars:{"--input-resize":a},...u})});se.classes=v.classes,se.displayName=`@mantine/core/Textarea`;var ce={root:`m_d08caa0`},le=t(e=>{let t=f(`Typography`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,attributes:s,...c}=t;return(0,M.jsx)(S,{...p({name:`Typography`,classes:ce,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:s})(`root`),...c})});le.classes=ce,le.displayName=`@mantine/core/Typography`;var ue=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M230.14,25.86a20,20,0,0,0-19.57-5.11l-.22.07L18.44,79a20,20,0,0,0-3.06,37.25L99,157l40.71,83.65a19.81,19.81,0,0,0,18,11.38c.57,0,1.15,0,1.73-.07A19.82,19.82,0,0,0,177,237.56L235.18,45.65a1.42,1.42,0,0,0,.07-.22A20,20,0,0,0,230.14,25.86ZM156.91,221.07l-34.37-70.64,46-45.95a12,12,0,0,0-17-17l-46,46L34.93,99.09,210,46Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M223.69,42.18l-58.22,192a8,8,0,0,1-14.92,1.25L108,148,20.58,105.45a8,8,0,0,1,1.25-14.92l192-58.22A8,8,0,0,1,223.69,42.18Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M231.4,44.34s0,.1,0,.15l-58.2,191.94a15.88,15.88,0,0,1-14,11.51q-.69.06-1.38.06a15.86,15.86,0,0,1-14.42-9.15L107,164.15a4,4,0,0,1,.77-4.58l57.92-57.92a8,8,0,0,0-11.31-11.31L96.43,148.26a4,4,0,0,1-4.58.77L17.08,112.64a16,16,0,0,1,2.49-29.8l191.94-58.2.15,0A16,16,0,0,1,231.4,44.34Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M225.88,30.12a13.83,13.83,0,0,0-13.7-3.58l-.11,0L20.14,84.77A14,14,0,0,0,18,110.85l85.56,41.64L145.12,238a13.87,13.87,0,0,0,12.61,8c.4,0,.81,0,1.21-.05a13.9,13.9,0,0,0,12.29-10.09l58.2-191.93,0-.11A13.83,13.83,0,0,0,225.88,30.12Zm-8,10.4L159.73,232.43l0,.11a2,2,0,0,1-3.76.26l-40.68-83.58,49-49a6,6,0,1,0-8.49-8.49l-49,49L23.15,100a2,2,0,0,1,.31-3.74l.11,0L215.48,38.08a1.94,1.94,0,0,1,1.92.52A2,2,0,0,1,217.92,40.52Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224.47,31.52a11.87,11.87,0,0,0-11.82-3L20.74,86.67a12,12,0,0,0-1.91,22.38L105,151l41.92,86.15A11.88,11.88,0,0,0,157.74,244c.34,0,.69,0,1,0a11.89,11.89,0,0,0,10.52-8.63l58.21-192,0-.08A11.85,11.85,0,0,0,224.47,31.52Zm-4.62,9.54-58.23,192a4,4,0,0,1-7.48.59l-41.3-84.86,50-50a4,4,0,1,0-5.66-5.66l-50,50-84.9-41.31a3.88,3.88,0,0,1-2.27-4,3.93,3.93,0,0,1,3-3.54L214.9,36.16A3.93,3.93,0,0,1,216,36a4,4,0,0,1,2.79,1.19A3.93,3.93,0,0,1,219.85,41.06Z`}))]]),de=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,160H60V60H196Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,158a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2H200a2,2,0,0,1,2,2Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,156a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4H200a4,4,0,0,1,4,4Z`}))]]),fe=j.forwardRef((e,t)=>j.createElement(a,{ref:t,...e,weights:ue}));fe.displayName=`PaperPlaneTiltIcon`;var pe=fe,me=j.forwardRef((e,t)=>j.createElement(a,{ref:t,...e,weights:de}));me.displayName=`StopIcon`;var he=me;function ge(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var _e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ve=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ye={};function be(e,t){return((t||ye).jsx?ve:_e).test(e)}var xe=/[ \t\n\f\r]/g;function Se(e){return typeof e==`object`?e.type===`text`&&Ce(e.value):Ce(e)}function Ce(e){return e.replace(xe,``)===``}var we=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};we.prototype.normal={},we.prototype.property={},we.prototype.space=void 0;function Te(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new we(n,r,t)}function Ee(e){return e.toLowerCase()}var F=class{constructor(e,t){this.attribute=t,this.property=e}};F.prototype.attribute=``,F.prototype.booleanish=!1,F.prototype.boolean=!1,F.prototype.commaOrSpaceSeparated=!1,F.prototype.commaSeparated=!1,F.prototype.defined=!1,F.prototype.mustUseProperty=!1,F.prototype.number=!1,F.prototype.overloadedBoolean=!1,F.prototype.property=``,F.prototype.spaceSeparated=!1,F.prototype.space=void 0;var De=w({boolean:()=>I,booleanish:()=>L,commaOrSpaceSeparated:()=>B,commaSeparated:()=>Ae,number:()=>R,overloadedBoolean:()=>ke,spaceSeparated:()=>z}),Oe=0,I=je(),L=je(),ke=je(),R=je(),z=je(),Ae=je(),B=je();function je(){return 2**++Oe}var Me=Object.keys(De),Ne=class extends F{constructor(e,t,n,r){let i=-1;if(super(e,t),Pe(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&qe.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Ke,Xe);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Ke.test(e)){let n=e.replace(Ge,Ye);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ne}return new i(r,t)}function Ye(e){return`-`+e.toLowerCase()}function Xe(e){return e.charAt(1).toUpperCase()}var Ze=Te([Ie,ze,Ve,He,Ue],`html`),Qe=Te([Ie,Be,Ve,He,Ue],`svg`);function $e(e){return e.join(` `).trim()}var et=i(((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})),tt=i((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(et());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}})),nt=i((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))}})),rt=i(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(tt()),r=nt();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})),it=ot(`end`),at=ot(`start`);function ot(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 st(e){let t=at(e),n=it(e);if(t&&n)return{start:t,end:n}}function ct(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?ut(e.position):`start`in e||`end`in e?ut(e):`line`in e||`column`in e?lt(e):``}function lt(e){return dt(e&&e.line)+`:`+dt(e&&e.column)}function ut(e){return lt(e&&e.start)+`-`+lt(e&&e.end)}function dt(e){return e&&typeof e==`number`?e:1}var V=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=ct(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};V.prototype.file=``,V.prototype.name=``,V.prototype.reason=``,V.prototype.message=``,V.prototype.stack=``,V.prototype.column=void 0,V.prototype.line=void 0,V.prototype.ancestors=void 0,V.prototype.cause=void 0,V.prototype.fatal=void 0,V.prototype.place=void 0,V.prototype.ruleId=void 0,V.prototype.source=void 0;var ft=n(rt(),1),pt={}.hasOwnProperty,mt=new Map,ht=/[A-Z]/g,gt=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),_t=new Set([`td`,`th`]),vt=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function yt(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=At(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=kt(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`?Qe:Ze,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=bt(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function bt(e,t,n){if(t.type===`element`)return xt(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return St(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return wt(e,t,n);if(t.type===`mdxjsEsm`)return Ct(e,t);if(t.type===`root`)return Tt(e,t,n);if(t.type===`text`)return Et(e,t)}function xt(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Qe,e.schema=i),e.ancestors.push(t);let a=It(e,t.tagName,!1),o=jt(e,t),s=Nt(e,t);return gt.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Se(e)})),Dt(e,o,a,t),Ot(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function St(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)}Lt(e,t.position)}function Ct(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Lt(e,t.position)}function wt(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Qe,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:It(e,t.name,!0),o=Mt(e,t),s=Nt(e,t);return Dt(e,o,a,t),Ot(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Tt(e,t,n){let r={};return Ot(r,Nt(e,t)),e.create(t,e.Fragment,r,n)}function Et(e,t){return t.value}function Dt(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ot(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function kt(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 At(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=at(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 jt(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&pt.call(t.properties,i)){let a=Pt(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&_t.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 Mt(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 Lt(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 Lt(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Nt(e,t){let n=[],r=-1,i=e.passKeys?new Map:mt;for(;++ri?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(H(e,e.length,0,t),e):t}var Yt={}.hasOwnProperty;function Xt(e){let t={},n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function W(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var G=cn(/[A-Za-z]/),K=cn(/[\dA-Za-z]/),en=cn(/[#-'*+\--9=?A-Z^-~]/);function tn(e){return e!==null&&(e<32||e===127)}var nn=cn(/\d/),rn=cn(/[\dA-Fa-f]/),an=cn(/[!-/:-@[-`{-~]/);function q(e){return e!==null&&e<-2}function J(e){return e!==null&&(e<0||e===32)}function Y(e){return e===-2||e===-1||e===32}var on=cn(/\p{P}|\p{S}/u),sn=cn(/\s/);function cn(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function ln(e){let t=[],n=-1,r=0,i=0;for(;++n55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function X(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Y(r)?(e.enter(n),s(r)):t(r)}function s(r){return Y(r)&&a++o))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 hn(e,t,n){return X(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function gn(e){if(e===null||J(e)||sn(e))return 1;if(on(e))return 2}function _n(e,t,n){let r=[],i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};xn(d,-c),xn(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=U(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=U(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=U(l,_n(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=U(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=U(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,H(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n0&&Y(t)?X(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||q(t)?e.check(Pn,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||q(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Y(t)?X(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Y(t)?X(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||q(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Ln(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Rn={name:`codeIndented`,tokenize:Bn},zn={partial:!0,tokenize:Vn};function Bn(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),X(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):q(t)?e.attempt(zn,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||q(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Vn(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):X(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):q(e)?i(e):n(e)}}var Hn={name:`codeText`,previous:Wn,resolve:Un,tokenize:Gn};function Un(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&&qn(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),qn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),qn(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 tr(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||tn(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||q(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||J(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):q(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||q(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Y(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function rr(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||q(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function ir(e,t){let n;return r;function r(i){return q(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Y(i)?X(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var ar={name:`definition`,tokenize:sr},or={partial:!0,tokenize:cr};function sr(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return nr.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=W(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return J(t)?ir(e,l)(t):l(t)}function l(t){return tr(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(or,d,d)(t)}function d(t){return Y(t)?X(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||q(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function cr(e,t,n){return r;function r(t){return J(t)?ir(e,i)(t):n(t)}function i(t){return rr(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Y(t)?X(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||q(e)?t(e):n(e)}}var lr={name:`hardBreakEscape`,tokenize:ur};function ur(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return q(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var dr={name:`headingAtx`,resolve:fr,tokenize:pr};function fr(e,t){let n=e.length-2,r=3,i,a;return 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&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},H(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function pr(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||J(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||q(n)?(e.exit(`atxHeading`),t(n)):Y(n)?X(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||J(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var mr=`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(`.`),hr=[`pre`,`script`,`style`,`textarea`],gr={concrete:!0,name:`htmlFlow`,resolveTo:yr,tokenize:br},_r={partial:!0,tokenize:Sr},vr={partial:!0,tokenize:xr};function yr(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 br(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:N):G(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):G(a)?(e.consume(a),i=4,r.interrupt?t:N):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:N):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return G(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||J(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&hr.includes(l)?(i=1,r.interrupt?t(s):O(s)):mr.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||K(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Y(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||G(t)?(e.consume(t),b):Y(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||K(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Y(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Y(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||q(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||J(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Y(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||q(t)?O(t):Y(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),A):t===60&&i===1?(e.consume(t),j):t===62&&i===4?(e.consume(t),re):t===63&&i===3?(e.consume(t),N):t===93&&i===5?(e.consume(t),ne):q(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(_r,ie,k)(t)):t===null||q(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(vr,ee,ie)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||q(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function A(t){return t===45?(e.consume(t),N):O(t)}function j(t){return t===47?(e.consume(t),o=``,M):O(t)}function M(t){if(t===62){let n=o.toLowerCase();return hr.includes(n)?(e.consume(t),re):O(t)}return G(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),M):O(t)}function ne(t){return t===93?(e.consume(t),N):O(t)}function N(t){return t===62?(e.consume(t),re):t===45&&i===2?(e.consume(t),N):O(t)}function re(t){return t===null||q(t)?(e.exit(`htmlFlowData`),ie(t)):(e.consume(t),re)}function ie(n){return e.exit(`htmlFlow`),t(n)}}function xr(e,t,n){let r=this;return i;function i(t){return q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Sr(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(wn,t,n)}}var Cr={name:`htmlText`,tokenize:wr};function wr(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):G(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):G(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):q(t)?(o=d,j(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?A(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):q(t)?(o=h,j(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?A(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?A(t):q(t)?(o=v,j(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):q(t)?(o=y,j(t)):(e.consume(t),y)}function b(e){return e===62?A(e):y(e)}function x(t){return G(t)?(e.consume(t),S):n(t)}function S(t){return t===45||K(t)?(e.consume(t),S):C(t)}function C(t){return q(t)?(o=C,j(t)):Y(t)?(e.consume(t),C):A(t)}function w(t){return t===45||K(t)?(e.consume(t),w):t===47||t===62||J(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),A):t===58||t===95||G(t)?(e.consume(t),E):q(t)?(o=T,j(t)):Y(t)?(e.consume(t),T):A(t)}function E(t){return t===45||t===46||t===58||t===95||K(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):q(t)?(o=D,j(t)):Y(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):q(t)?(o=O,j(t)):Y(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):q(t)?(o=k,j(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||J(t)?T(t):(e.consume(t),ee)}function te(e){return e===47||e===62||J(e)?T(e):n(e)}function A(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function j(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),M}function M(t){return Y(t)?X(e,ne,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ne(t)}function ne(t){return e.enter(`htmlTextData`),o(t)}}var Tr={name:`labelEnd`,resolveAll:kr,resolveTo:Ar,tokenize:jr},Er={tokenize:Mr},Dr={tokenize:Nr},Or={tokenize:Pr};function kr(e){let t=-1,n=[];for(;++t=3&&(a===null||q(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Y(t)?X(e,s,`whitespace`)(t):s(t))}}var Z={continuation:{tokenize:Kr},exit:Jr,name:`list`,tokenize:Gr},Ur={partial:!0,tokenize:Yr},Wr={partial:!0,tokenize:qr};function Gr(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:nn(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(Vr,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 nn(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(wn,r.interrupt?n:u,e.attempt(Ur,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Y(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Kr(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(wn,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,X(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Y(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Wr,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,X(e,e.attempt(Z,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function qr(e,t,n){let r=this;return X(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Jr(e){e.exit(this.containerState.type)}function Yr(e,t,n){let r=this;return X(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Y(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Xr={name:`setextUnderline`,resolveTo:Zr,tokenize:Qr};function Zr(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Qr(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Y(t)?X(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||q(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var $r={tokenize:ei};function ei(e){let t=this,n=e.attempt(wn,r,e.attempt(this.parser.constructs.flowInitial,i,X(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Xn,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 ti={resolveAll:ai()},ni=ii(`string`),ri=ii(`text`);function ii(e){return{resolveAll:ai(e===`text`?oi: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(;++ihi,contentInitial:()=>li,disable:()=>gi,document:()=>ci,flow:()=>di,flowInitial:()=>ui,insideSpan:()=>mi,string:()=>fi,text:()=>pi}),ci={42:Z,43:Z,45:Z,48:Z,49:Z,50:Z,51:Z,52:Z,53:Z,54:Z,55:Z,56:Z,57:Z,62:En},li={91:ar},ui={[-2]:Rn,[-1]:Rn,32:Rn},di={35:dr,42:Vr,45:[Xr,Vr],60:gr,61:Xr,95:Vr,96:Fn,126:Fn},fi={38:Mn,92:An},pi={[-5]:zr,[-4]:zr,[-3]:zr,33:Fr,38:Mn,42:vn,60:[Sn,Cr],91:Lr,92:[lr,An],93:Tr,95:vn,96:Hn},mi={null:[vn,ti]},hi={null:[42,95]},gi={null:[]};function _i(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=U(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=_n(a,l.events,l),l.events):[]}function f(e,t){return yi(p(e),t)}function p(e){return vi(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(){let e;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 yi(e,t){let n=-1,r=[],i;for(;++n`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function ic(){return`!`}ac.peek=oc;function ac(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function oc(){return`!`}sc.peek=cc;function sc(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a\u007F]/.test(e.url))}uc.peek=dc;function uc(e,t,n,r){let i=Ks(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(lc(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function dc(e,t,n){return lc(e,n)?`<`:`[`}fc.peek=pc;function fc(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function pc(){return`[`}function mc(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function hc(e){let t=mc(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function gc(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function _c(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function vc(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?gc(n):mc(n),s=e.ordered?o===`.`?`)`:`.`:hc(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),_c(n)===o&&t){let t=-1;for(;++t-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function xc(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var Sc=Aa([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function Cc(e,t,n,r){return(e.children.some(function(e){return Sc(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function wc(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Tc.peek=Ec;function Tc(e,t,n,r){let i=wc(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=Xs(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=Ys(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Xs(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+Ys(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Ec(e,t,n){return n.options.strong||`*`}function Dc(e,t,n,r){return n.safe(e.value,r)}function Oc(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function kc(e,t,n){let r=(_c(n)+(n.options.ruleSpaces?` `:``)).repeat(Oc(n));return n.options.ruleSpaces?r.slice(0,-1):r}var Ac={blockquote:Is,break:Bs,code:Ws,definition:qs,emphasis:Zs,hardBreak:Bs,heading:ec,html:tc,image:rc,imageReference:ac,inlineCode:sc,link:uc,linkReference:fc,list:vc,listItem:bc,paragraph:xc,root:Cc,strong:Tc,text:Dc,thematicBreak:kc};function jc(){return{enter:{table:Mc,tableData:Ic,tableHeader:Ic,tableRow:Pc},exit:{codeText:Lc,table:Nc,tableData:Fc,tableHeader:Fc,tableRow:Fc}}}function Mc(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function Nc(e){this.exit(e),this.data.inTable=void 0}function Pc(e){this.enter({type:`tableRow`,children:[]},e)}function Fc(e){this.exit(e)}function Ic(e){this.enter({type:`tableCell`,children:[]},e)}function Lc(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Rc));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Rc(e,t){return t===`|`?t:e}function zc(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:` `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(` -`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return Ns(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var gl={tokenize:wl,partial:!0};function _l(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:xl,continuation:{tokenize:Sl},exit:Cl}},text:{91:{name:`gfmFootnoteCall`,tokenize:bl},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:vl,resolveTo:yl}}}}function vl(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=W(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function yl(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function bl(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||J(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(W(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return J(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function xl(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||J(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=W(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return J(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),X(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Sl(e,t,n){return e.check(wn,t,e.attempt(gl,t,n))}function Cl(e){e.exit(`gfmFootnoteDefinition`)}function wl(e,t,n){let r=this;return X(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function Tl(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=gn(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var El=class{constructor(){this.map=[]}add(e,t,n){Dl(this,e,t,n)}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}};function Dl(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):q(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Y(t)?X(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||J(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Y(t)?X(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Y(t)?X(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||q(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Y(t)?X(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||q(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||q(n)?(e.exit(`tableRow`),t(n)):Y(n)?X(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||J(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function jl(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new El;for(;++nn[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},Pl(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function Nl(e,t,n,r,i){let a=[],o=Pl(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function Pl(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Fl={name:`tasklistCheck`,tokenize:Ll};function Il(){return{text:{91:Fl}}}function Ll(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return J(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return q(r)?t(r):Y(r)?e.check({tokenize:Rl},t,n)(r):n(r)}}function Rl(e,t,n){return X(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function zl(e){return Xt([tl(),_l(),Tl(e),kl(),Il()])}var Bl={};function Vl(e){let t=this,n=e||Bl,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(zl(n)),a.push(Gc()),o.push(Kc(n))}var Hl=64,Ul=300;function Wl(){let e=(0,j.useRef)(null),t=(0,j.useRef)(!0),n=(0,j.useRef)(()=>{}),r=(0,j.useRef)(null),i=(0,j.useCallback)(()=>{let n=e.current;n&&t.current&&(n.scrollTop=n.scrollHeight)},[]);return{scrollRef:(0,j.useCallback)(r=>{if(n.current(),e.current=r,!r)return;let i=0,a=!1,o=()=>{i=Date.now()},s=()=>{a=!0},c=()=>{a=!1},l=()=>{r.scrollHeight-r.clientHeight-r.scrollTop<=Hl?t.current=!0:(a||Date.now()-i{r.removeEventListener(`scroll`,l),r.removeEventListener(`wheel`,o),r.removeEventListener(`touchmove`,o),r.removeEventListener(`keydown`,o),r.removeEventListener(`pointerdown`,s),window.removeEventListener(`pointerup`,c),n.current=()=>{}},t.current=!0,r.scrollTop=r.scrollHeight},[]),contentRef:(0,j.useCallback)(e=>{r.current?.disconnect(),r.current=null,e&&(r.current=new ResizeObserver(i),r.current.observe(e))},[i]),toBottom:(0,j.useCallback)(()=>{t.current=!0,i()},[i])}}var Gl=(0,j.lazy)(()=>O(()=>import(`./mcp-app-frame-BZJusU6-.js`),__vite__mapDeps([0,1,2,3]))),Kl=[`Summarize system health for the last hour`,`Find the source of elevated errors`,`Map the current service dependencies`,`Show the slowest endpoints`];function ql(e){return{observability_overview:`System health`,service_topology:`Service map`,service_performance:`Performance`,trace_detail:`Trace analysis`,search_logs:`Logs`}[e]??`System analysis`}function Jl(){let{agentAvailable:e,messages:t,messageTimes:n,ready:i,running:a,activity:l,error:d,threadMissing:f,send:p,retry:h,reloadThread:g,newThread:v}=E(),{scrollRef:y,contentRef:w,toBottom:T}=Wl(),D=t.filter(e=>e.role===`user`).at(-1)?.id;if((0,j.useEffect)(()=>{D&&T()},[D,T]),!e)return(0,M.jsx)(o,{size:`sm`,py:96,children:(0,M.jsx)(C,{withBorder:!0,radius:`lg`,p:{base:`xl`,sm:40},children:(0,M.jsxs)(b,{gap:`md`,children:[(0,M.jsx)(s,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Optional capability`}),(0,M.jsx)(_,{order:1,fz:28,children:`Chat is not configured`}),(0,M.jsx)(s,{c:`dimmed`,children:`Add an AI provider key to enable chat. Telemetry ingest, dashboards, traces, logs, and metrics remain available without it.`}),(0,M.jsx)(x,{component:`a`,href:`/dashboards`,variant:`light`,mt:`sm`,children:`Open dashboards`})]})})});let O=t.filter(e=>e.role!==`tool`);return(0,M.jsxs)(S,{className:`chat-pane`,children:[(0,M.jsx)(S,{className:`chat-scroll`,ref:y,tabIndex:0,role:`log`,"aria-label":`Conversation`,children:(0,M.jsxs)(o,{size:880,px:{base:`md`,sm:`xl`},py:`lg`,ref:w,children:[f&&(0,M.jsx)(c,{color:`warn`,radius:`lg`,title:`This chat no longer exists`,children:(0,M.jsxs)(u,{justify:`space-between`,children:[(0,M.jsx)(s,{size:`sm`,children:`It was deleted, or the link is wrong.`}),(0,M.jsx)(x,{size:`compact-sm`,variant:`light`,onClick:v,children:`New chat`})]})}),!f&&!i&&d&&(0,M.jsx)(Yl,{message:d,onRetry:g,onNewThread:v}),!f&&!i&&!d&&(0,M.jsxs)(m,{mih:`40vh`,children:[(0,M.jsx)(r,{size:`sm`}),(0,M.jsx)(s,{c:`dimmed`,size:`sm`,ml:`sm`,children:`Loading chat`})]}),!f&&i&&(0,M.jsxs)(M.Fragment,{children:[O.length===0&&(0,M.jsx)(Zl,{onSelect:p}),(0,M.jsxs)(b,{gap:`lg`,"aria-live":`polite`,children:[O.map(e=>(0,M.jsx)(Ql,{message:e,time:n[e.id],send:p},e.id)),a&&(0,M.jsxs)(u,{gap:`xs`,children:[(0,M.jsx)(r,{type:`dots`,size:`sm`}),(0,M.jsx)(s,{c:`dimmed`,size:`sm`,children:l||`Analyzing your system`})]}),d&&(0,M.jsx)(Yl,{message:d,onRetry:h})]})]})]})}),!f&&(0,M.jsx)(Xl,{})]})}function Yl({message:e,onRetry:t,onNewThread:n}){return(0,M.jsx)(c,{color:`bad`,radius:`lg`,title:`Something went wrong`,children:(0,M.jsxs)(u,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,M.jsx)(s,{size:`sm`,children:e}),(0,M.jsxs)(u,{gap:`xs`,wrap:`nowrap`,children:[n&&(0,M.jsx)(x,{size:`compact-sm`,variant:`subtle`,color:`bad`,onClick:n,children:`New chat`}),(0,M.jsx)(x,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:t,children:`Retry`})]})]})})}function Xl(){let{input:e,setInput:t,inputRef:n,submit:r,send:i,stop:a,ready:c,running:l}=E();return(0,M.jsx)(S,{className:`chat-composer`,children:(0,M.jsxs)(o,{size:880,px:{base:`md`,sm:`xl`},children:[(0,M.jsx)(C,{component:`form`,onSubmit:r,className:`chat-composer-field`,withBorder:!0,radius:24,py:6,pl:`lg`,pr:6,children:(0,M.jsxs)(u,{align:`flex-end`,gap:`xs`,wrap:`nowrap`,children:[(0,M.jsx)(se,{ref:n,"aria-label":`Message Fanout`,value:e,onChange:e=>t(e.currentTarget.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),i(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,M.jsx)(T,{label:`Stop`,children:(0,M.jsx)(D,{type:`button`,variant:`default`,size:40,radius:`xl`,"aria-label":`Stop`,onClick:a,children:(0,M.jsx)(he,{size:16,weight:`fill`})})}):(0,M.jsx)(D,{type:`submit`,variant:`filled`,size:40,radius:`xl`,disabled:!e.trim()||!c,"aria-label":`Send message`,children:(0,M.jsx)(pe,{size:17,weight:`fill`})})]})}),(0,M.jsx)(s,{c:`dimmed`,size:`xs`,ta:`center`,mt:6,children:`Enter to send, Shift+Enter for a new line`})]})})}function Zl({onSelect:e}){return(0,M.jsxs)(b,{align:`center`,gap:`md`,pt:{base:32,sm:88},pb:`xl`,ta:`center`,children:[(0,M.jsx)(g,{size:`large`}),(0,M.jsx)(_,{order:1,fz:24,fw:500,lh:1.25,maw:560,children:`What do you want to know about your system?`}),(0,M.jsx)(u,{justify:`center`,gap:`xs`,mt:`xs`,maw:720,children:Kl.map(t=>(0,M.jsx)(x,{variant:`default`,size:`sm`,radius:`xl`,onClick:()=>void e(t),children:t},t))})]})}function Ql({message:e,time:t,send:n}){if(e.role===`activity`){let t=e;return t.activityType===`mcp-app`?(0,M.jsx)(C,{withBorder:!0,radius:`lg`,style:{overflow:`hidden`},"aria-label":ql(t.content.toolName),children:(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(m,{mih:180,children:(0,M.jsx)(r,{size:`sm`})}),children:(0,M.jsx)(Gl,{content:t.content,onMessage:n})})}):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,M.jsxs)(S,{className:`chat-message`,"data-role":a?`user`:`assistant`,children:[a?(0,M.jsx)(C,{radius:`lg`,px:`md`,py:`sm`,bg:`var(--mantine-color-brand-light)`,maw:`70%`,ml:`auto`,w:`fit-content`,children:(0,M.jsx)(s,{style:{whiteSpace:`pre-wrap`},children:i})}):(0,M.jsx)(le,{className:`chat-markdown`,children:(0,M.jsx)(Ro,{remarkPlugins:[Vl],components:eu,children:i})}),(0,M.jsxs)(u,{className:`chat-message-meta`,gap:6,justify:a?`flex-end`:`flex-start`,mt:4,children:[o&&t&&(0,M.jsx)(s,{c:`dimmed`,size:`xs`,title:ee(t),children:o}),!a&&(0,M.jsx)($l,{text:i,label:`Copy message`})]})]})}function $l({text:e,label:t}){let{state:n,copy:r}=te();return(0,M.jsx)(T,{label:n===`failed`?`Could not copy`:n===`copied`?`Copied`:t,children:(0,M.jsx)(D,{variant:`subtle`,color:`gray`,size:`sm`,"aria-label":t,"data-state":n===`idle`?void 0:n,onClick:()=>r(e),children:n===`copied`?(0,M.jsx)(d,{size:13,weight:`bold`}):(0,M.jsx)(y,{size:13})})})}var eu={table:({children:e})=>(0,M.jsx)(S,{className:`chat-table`,children:(0,M.jsx)(k,{striped:!0,highlightOnHover:!0,withTableBorder:!0,verticalSpacing:`xs`,fz:`sm`,children:e})}),thead:({children:e})=>(0,M.jsx)(k.Thead,{children:e}),tbody:({children:e})=>(0,M.jsx)(k.Tbody,{children:e}),tr:({children:e})=>(0,M.jsx)(k.Tr,{children:e}),th:({children:e})=>(0,M.jsx)(k.Th,{children:e}),td:({children:e})=>(0,M.jsx)(k.Td,{children:e}),pre:({children:e})=>(0,M.jsx)(tu,{children:e}),a:({href:e,children:t})=>(0,M.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t})};function tu({children:e}){let t=nu(e);return(0,M.jsxs)(S,{className:`chat-code`,pos:`relative`,children:[(0,M.jsx)(S,{className:`chat-code-actions`,pos:`absolute`,top:6,right:6,children:(0,M.jsx)($l,{text:t,label:`Copy code`})}),(0,M.jsx)(`pre`,{children:e})]})}function nu(e){return typeof e==`string`?e:Array.isArray(e)?e.map(nu).join(``):e&&typeof e==`object`&&`props`in e?nu(e.props.children):``}export{Jl as t}; \ No newline at end of file +`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return Ns(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var gl={tokenize:wl,partial:!0};function _l(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:xl,continuation:{tokenize:Sl},exit:Cl}},text:{91:{name:`gfmFootnoteCall`,tokenize:bl},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:vl,resolveTo:yl}}}}function vl(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=W(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function yl(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function bl(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||J(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(W(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return J(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function xl(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||J(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=W(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return J(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),X(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Sl(e,t,n){return e.check(wn,t,e.attempt(gl,t,n))}function Cl(e){e.exit(`gfmFootnoteDefinition`)}function wl(e,t,n){let r=this;return X(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function Tl(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=gn(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var El=class{constructor(){this.map=[]}add(e,t,n){Dl(this,e,t,n)}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}};function Dl(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):q(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Y(t)?X(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||J(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Y(t)?X(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Y(t)?X(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||q(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Y(t)?X(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||q(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||q(n)?(e.exit(`tableRow`),t(n)):Y(n)?X(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||J(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function jl(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new El;for(;++nn[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},Pl(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function Nl(e,t,n,r,i){let a=[],o=Pl(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function Pl(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Fl={name:`tasklistCheck`,tokenize:Ll};function Il(){return{text:{91:Fl}}}function Ll(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return J(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return q(r)?t(r):Y(r)?e.check({tokenize:Rl},t,n)(r):n(r)}}function Rl(e,t,n){return X(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function zl(e){return Xt([tl(),_l(),Tl(e),kl(),Il()])}var Bl={};function Vl(e){let t=this,n=e||Bl,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(zl(n)),a.push(Gc()),o.push(Kc(n))}var Hl=64,Ul=300;function Wl(){let e=(0,j.useRef)(null),t=(0,j.useRef)(!0),n=(0,j.useRef)(()=>{}),r=(0,j.useRef)(null),i=(0,j.useCallback)(()=>{let n=e.current;n&&t.current&&(n.scrollTop=n.scrollHeight)},[]);return{scrollRef:(0,j.useCallback)(r=>{if(n.current(),e.current=r,!r)return;let i=0,a=!1,o=()=>{i=Date.now()},s=()=>{a=!0},c=()=>{a=!1},l=()=>{r.scrollHeight-r.clientHeight-r.scrollTop<=Hl?t.current=!0:(a||Date.now()-i{r.removeEventListener(`scroll`,l),r.removeEventListener(`wheel`,o),r.removeEventListener(`touchmove`,o),r.removeEventListener(`keydown`,o),r.removeEventListener(`pointerdown`,s),window.removeEventListener(`pointerup`,c),n.current=()=>{}},t.current=!0,r.scrollTop=r.scrollHeight},[]),contentRef:(0,j.useCallback)(e=>{r.current?.disconnect(),r.current=null,e&&(r.current=new ResizeObserver(i),r.current.observe(e))},[i]),toBottom:(0,j.useCallback)(()=>{t.current=!0,i()},[i])}}var Gl=(0,j.lazy)(()=>O(()=>import(`./mcp-app-frame-GqrqdVoY.js`),__vite__mapDeps([0,1,2,3]))),Kl=[`Summarize system health for the last hour`,`Find the source of elevated errors`,`Map the current service dependencies`,`Show the slowest endpoints`];function ql(e){return{observability_overview:`System health`,service_topology:`Service map`,service_performance:`Performance`,trace_detail:`Trace analysis`,search_logs:`Logs`}[e]??`System analysis`}function Jl(){let{agentAvailable:e,messages:t,messageTimes:n,ready:i,running:a,activity:l,error:d,threadMissing:f,send:p,retry:h,reloadThread:g,newThread:v}=E(),{scrollRef:y,contentRef:w,toBottom:T}=Wl(),D=t.filter(e=>e.role===`user`).at(-1)?.id;if((0,j.useEffect)(()=>{D&&T()},[D,T]),!e)return(0,M.jsx)(o,{size:`sm`,py:96,children:(0,M.jsx)(C,{withBorder:!0,radius:`lg`,p:{base:`xl`,sm:40},children:(0,M.jsxs)(b,{gap:`md`,children:[(0,M.jsx)(s,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Optional capability`}),(0,M.jsx)(_,{order:1,fz:28,children:`Chat is not configured`}),(0,M.jsx)(s,{c:`dimmed`,children:`Add an AI provider key to enable chat. Telemetry ingest, dashboards, traces, logs, and metrics remain available without it.`}),(0,M.jsx)(x,{component:`a`,href:`/dashboards`,variant:`light`,mt:`sm`,children:`Open dashboards`})]})})});let O=t.filter(e=>e.role!==`tool`);return(0,M.jsxs)(S,{className:`chat-pane`,children:[(0,M.jsx)(S,{className:`chat-scroll`,ref:y,tabIndex:0,role:`log`,"aria-label":`Conversation`,children:(0,M.jsxs)(o,{size:880,px:{base:`md`,sm:`xl`},py:`lg`,ref:w,children:[f&&(0,M.jsx)(c,{color:`warn`,radius:`lg`,title:`This chat no longer exists`,children:(0,M.jsxs)(u,{justify:`space-between`,children:[(0,M.jsx)(s,{size:`sm`,children:`It was deleted, or the link is wrong.`}),(0,M.jsx)(x,{size:`compact-sm`,variant:`light`,onClick:v,children:`New chat`})]})}),!f&&!i&&d&&(0,M.jsx)(Yl,{message:d,onRetry:g,onNewThread:v}),!f&&!i&&!d&&(0,M.jsxs)(m,{mih:`40vh`,children:[(0,M.jsx)(r,{size:`sm`}),(0,M.jsx)(s,{c:`dimmed`,size:`sm`,ml:`sm`,children:`Loading chat`})]}),!f&&i&&(0,M.jsxs)(M.Fragment,{children:[O.length===0&&(0,M.jsx)(Zl,{onSelect:p}),(0,M.jsxs)(b,{gap:`lg`,"aria-live":`polite`,children:[O.map(e=>(0,M.jsx)(Ql,{message:e,time:n[e.id],send:p},e.id)),a&&(0,M.jsxs)(u,{gap:`xs`,children:[(0,M.jsx)(r,{type:`dots`,size:`sm`}),(0,M.jsx)(s,{c:`dimmed`,size:`sm`,children:l||`Analyzing your system`})]}),d&&(0,M.jsx)(Yl,{message:d,onRetry:h})]})]})]})}),!f&&(0,M.jsx)(Xl,{})]})}function Yl({message:e,onRetry:t,onNewThread:n}){return(0,M.jsx)(c,{color:`bad`,radius:`lg`,title:`Something went wrong`,children:(0,M.jsxs)(u,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,M.jsx)(s,{size:`sm`,children:e}),(0,M.jsxs)(u,{gap:`xs`,wrap:`nowrap`,children:[n&&(0,M.jsx)(x,{size:`compact-sm`,variant:`subtle`,color:`bad`,onClick:n,children:`New chat`}),(0,M.jsx)(x,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:t,children:`Retry`})]})]})})}function Xl(){let{input:e,setInput:t,inputRef:n,submit:r,send:i,stop:a,ready:c,running:l}=E();return(0,M.jsx)(S,{className:`chat-composer`,children:(0,M.jsxs)(o,{size:880,px:{base:`md`,sm:`xl`},children:[(0,M.jsx)(C,{component:`form`,onSubmit:r,className:`chat-composer-field`,withBorder:!0,radius:24,py:6,pl:`lg`,pr:6,children:(0,M.jsxs)(u,{align:`flex-end`,gap:`xs`,wrap:`nowrap`,children:[(0,M.jsx)(se,{ref:n,"aria-label":`Message Fanout`,value:e,onChange:e=>t(e.currentTarget.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),i(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,M.jsx)(T,{label:`Stop`,children:(0,M.jsx)(D,{type:`button`,variant:`default`,size:40,radius:`xl`,"aria-label":`Stop`,onClick:a,children:(0,M.jsx)(he,{size:16,weight:`fill`})})}):(0,M.jsx)(D,{type:`submit`,variant:`filled`,size:40,radius:`xl`,disabled:!e.trim()||!c,"aria-label":`Send message`,children:(0,M.jsx)(pe,{size:17,weight:`fill`})})]})}),(0,M.jsx)(s,{c:`dimmed`,size:`xs`,ta:`center`,mt:6,children:`Enter to send, Shift+Enter for a new line`})]})})}function Zl({onSelect:e}){return(0,M.jsxs)(b,{align:`center`,gap:`md`,pt:{base:32,sm:88},pb:`xl`,ta:`center`,children:[(0,M.jsx)(g,{size:`large`}),(0,M.jsx)(_,{order:1,fz:24,fw:500,lh:1.25,maw:560,children:`What do you want to know about your system?`}),(0,M.jsx)(u,{justify:`center`,gap:`xs`,mt:`xs`,maw:720,children:Kl.map(t=>(0,M.jsx)(x,{variant:`default`,size:`sm`,radius:`xl`,onClick:()=>void e(t),children:t},t))})]})}function Ql({message:e,time:t,send:n}){if(e.role===`activity`){let t=e;return t.activityType===`mcp-app`?(0,M.jsx)(C,{withBorder:!0,radius:`lg`,style:{overflow:`hidden`},"aria-label":ql(t.content.toolName),children:(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(m,{mih:180,children:(0,M.jsx)(r,{size:`sm`})}),children:(0,M.jsx)(Gl,{content:t.content,onMessage:n})})}):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,M.jsxs)(S,{className:`chat-message`,"data-role":a?`user`:`assistant`,children:[a?(0,M.jsx)(C,{radius:`lg`,px:`md`,py:`sm`,bg:`var(--mantine-color-brand-light)`,maw:`70%`,ml:`auto`,w:`fit-content`,children:(0,M.jsx)(s,{style:{whiteSpace:`pre-wrap`},children:i})}):(0,M.jsx)(le,{className:`chat-markdown`,children:(0,M.jsx)(Ro,{remarkPlugins:[Vl],components:eu,children:i})}),(0,M.jsxs)(u,{className:`chat-message-meta`,gap:6,justify:a?`flex-end`:`flex-start`,mt:4,children:[o&&t&&(0,M.jsx)(s,{c:`dimmed`,size:`xs`,title:ee(t),children:o}),!a&&(0,M.jsx)($l,{text:i,label:`Copy message`})]})]})}function $l({text:e,label:t}){let{state:n,copy:r}=te();return(0,M.jsx)(T,{label:n===`failed`?`Could not copy`:n===`copied`?`Copied`:t,children:(0,M.jsx)(D,{variant:`subtle`,color:`gray`,size:`sm`,"aria-label":t,"data-state":n===`idle`?void 0:n,onClick:()=>r(e),children:n===`copied`?(0,M.jsx)(d,{size:13,weight:`bold`}):(0,M.jsx)(y,{size:13})})})}var eu={table:({children:e})=>(0,M.jsx)(S,{className:`chat-table`,children:(0,M.jsx)(k,{striped:!0,highlightOnHover:!0,withTableBorder:!0,verticalSpacing:`xs`,fz:`sm`,children:e})}),thead:({children:e})=>(0,M.jsx)(k.Thead,{children:e}),tbody:({children:e})=>(0,M.jsx)(k.Tbody,{children:e}),tr:({children:e})=>(0,M.jsx)(k.Tr,{children:e}),th:({children:e})=>(0,M.jsx)(k.Th,{children:e}),td:({children:e})=>(0,M.jsx)(k.Td,{children:e}),pre:({children:e})=>(0,M.jsx)(tu,{children:e}),a:({href:e,children:t})=>(0,M.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t})};function tu({children:e}){let t=nu(e);return(0,M.jsxs)(S,{className:`chat-code`,pos:`relative`,children:[(0,M.jsx)(S,{className:`chat-code-actions`,pos:`absolute`,top:6,right:6,children:(0,M.jsx)($l,{text:t,label:`Copy code`})}),(0,M.jsx)(`pre`,{children:e})]})}function nu(e){return typeof e==`string`?e:Array.isArray(e)?e.map(nu).join(``):e&&typeof e==`object`&&`props`in e?nu(e.props.children):``}export{Jl as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat._threadId-B6mb73V8.js b/internal/ui/dist/assets/chat._threadId-B6mb73V8.js deleted file mode 100644 index 18391c737..000000000 --- a/internal/ui/dist/assets/chat._threadId-B6mb73V8.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./chat-B-nb-Yp3.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat._threadId-DYB6vKSb.js b/internal/ui/dist/assets/chat._threadId-DYB6vKSb.js new file mode 100644 index 000000000..5f85e082d --- /dev/null +++ b/internal/ui/dist/assets/chat._threadId-DYB6vKSb.js @@ -0,0 +1 @@ +import{t as e}from"./chat-B3ZKcKVO.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat.index-B6mb73V8.js b/internal/ui/dist/assets/chat.index-B6mb73V8.js deleted file mode 100644 index 18391c737..000000000 --- a/internal/ui/dist/assets/chat.index-B6mb73V8.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./chat-B-nb-Yp3.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat.index-DYB6vKSb.js b/internal/ui/dist/assets/chat.index-DYB6vKSb.js new file mode 100644 index 000000000..5f85e082d --- /dev/null +++ b/internal/ui/dist/assets/chat.index-DYB6vKSb.js @@ -0,0 +1 @@ +import{t as e}from"./chat-B3ZKcKVO.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboard-BfR0ACHf.js b/internal/ui/dist/assets/dashboard-yZ7oG_PO.js similarity index 99% rename from internal/ui/dist/assets/dashboard-BfR0ACHf.js rename to internal/ui/dist/assets/dashboard-yZ7oG_PO.js index df5055250..11ece3413 100644 --- a/internal/ui/dist/assets/dashboard-BfR0ACHf.js +++ b/internal/ui/dist/assets/dashboard-yZ7oG_PO.js @@ -1,4 +1,4 @@ -import{$ as e,A as t,C as n,D as r,E as i,K as a,N as o,O as s,R as c,S as l,St as u,T as d,X as f,Y as p,_ as m,_t as h,a as g,at as _,ct as v,d as y,dt as b,et as x,f as S,gt as C,h as w,ht as T,i as E,it as D,j as O,k,l as A,lt as j,m as M,mt as N,o as P,p as ee,pt as te,r as ne,s as re,st as ie,u as ae,w as oe,x as se,y as ce,yt as le}from"./brand-MzZ03bSa.js";import{c as ue,i as F,o as I}from"./auth-BeUORN-q.js";import{C as de,D as fe,E as pe,N as me,O as he,S as ge,T as _e,_ as ve,b as ye,c as be,f as xe,g as Se,h as Ce,i as we,j as Te,l as Ee,m as De,n as Oe,o as ke,p as Ae,s as je,u as Me,v as Ne,w as Pe,x as Fe,y as Ie}from"./tokens-DNprTSRA.js";import{S as Le,T as Re,o as ze,t as Be,w as Ve,x as He}from"./Tooltip-BJiO7C_G.js";import{t as Ue}from"./use-computed-color-scheme-6JIsge00.js";import{O as We,V as Ge,i as Ke,k as qe,n as Je,t as Ye}from"./api-Be5Lq4YA.js";import{o as Xe}from"./preload-helper-BL3qEkUh.js";import{a as Ze,c as Qe,i as $e,n as et,o as tt,r as nt,s as rt,t as it}from"./format-urrStEsn.js";import{n as at,t as ot}from"./WarningCircle.es-DDq2AFnK.js";var L=u(C(),1),R=N();function st(e){return typeof e==`object`&&e?`base`in e?e.base:void 0:e}function ct(e){let t=(0,L.useRef)(void 0);return(0,L.useEffect)(()=>{t.current=e},[e]),t.current}function lt(e,t=document){let n=t.querySelector(e);if(n)return n;let r=t.querySelectorAll(`*`);for(let t=0;t{let t=O(`Flex`,null,e),{classNames:n,className:a,style:l,styles:u,unstyled:f,vars:p,gap:m,rowGap:h,columnGap:g,align:_,justify:v,wrap:y,direction:b,attributes:x,...S}=t,C=k({name:`Flex`,classes:mt,props:t,className:a,style:l,classNames:n,styles:u,unstyled:f,attributes:x,vars:p}),w=o(),T=d(),E=i({styleProps:{gap:m,rowGap:h,columnGap:g,align:_,justify:v,wrap:y,direction:b},theme:w,data:pt}),D=c(),A=D&&E.hasResponsiveStyles?r(E.styles,E.media):T;return(0,R.jsxs)(R.Fragment,{children:[E.hasResponsiveStyles&&(0,R.jsx)(s,{selector:`.${A}`,styles:E.styles,media:E.media,deduplicate:D}),(0,R.jsx)(se,{...C(`root`,{className:A,style:j(E.inlineStyles)}),...S})]})});ht.classes=mt,ht.displayName=`@mantine/core/Flex`;function gt(e){return typeof e==`string`?{value:e,label:e}:typeof e==`object`&&`value`in e&&!(`label`in e)?{value:e.value,label:`${e.value}`,disabled:e.disabled}:typeof e==`object`&&`group`in e?{group:e.group,items:e.items.map(e=>gt(e))}:typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?{value:e,label:`${e}`}:e}function _t(e){return e?e.map(e=>gt(e)):[]}function vt(e){return e.reduce((e,t)=>`group`in t?{...e,...vt(t.items)}:(e[`${t.value}`]=t,e),{})}var yt={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`},bt={error:null},xt=f((e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":ie(t,`combobox-chevron-size`),"--combobox-chevron-color":n?a(n,e):void 0}})),St=n(e=>{let t=O(`ComboboxChevron`,bt,e),{size:n,error:r,style:i,className:a,classNames:o,styles:s,unstyled:c,vars:l,attributes:u,mod:d,...f}=t,p=k({name:`ComboboxChevron`,classes:yt,props:t,style:i,className:a,classNames:o,styles:s,unstyled:c,vars:l,varsResolver:xt,attributes:u,rootSelector:`chevron`});return(0,R.jsx)(se,{component:`svg`,...f,...p(`chevron`),size:n,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,mod:[`combobox-chevron`,{error:r},d],children:(0,R.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`})})});St.classes=yt,St.varsResolver=xt,St.displayName=`@mantine/core/ComboboxChevron`;var[Ct,wt]=Ve(`Combobox component was not found in tree`);function Tt({onMouseDown:e,onClick:t,onClear:n,...r}){return(0,R.jsx)(M.ClearButton,{tabIndex:-1,"aria-hidden":!0,...r,onMouseDown:t=>{t.preventDefault(),e?.(t)},onClick:e=>{n(),t?.(e)}})}Tt.displayName=`@mantine/core/ComboboxClearButton`;var Et=n(e=>{let{classNames:t,styles:n,className:r,style:i,hidden:a,...o}=O(`ComboboxDropdown`,null,e),s=wt();return(0,R.jsx)(fe.Dropdown,{...o,role:`presentation`,"data-hidden":a||void 0,"data-floating-height":s.floatingHeight||void 0,...s.getStyles(`dropdown`,{className:r,style:i,classNames:t,styles:n})})});Et.classes=yt,Et.displayName=`@mantine/core/ComboboxDropdown`;var Dt={refProp:`ref`},Ot=n(e=>{let{children:t,refProp:n,ref:r}=O(`ComboboxDropdownTarget`,Dt,e);if(wt(),!Re(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,R.jsx)(fe.Target,{ref:r,refProp:n,children:t})});Ot.displayName=`@mantine/core/ComboboxDropdownTarget`;var kt=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=O(`ComboboxEmpty`,null,e);return(0,R.jsx)(se,{...wt().getStyles(`empty`,{className:n,classNames:t,styles:i,style:r}),...o})});kt.classes=yt,kt.displayName=`@mantine/core/ComboboxEmpty`;function At({onKeyDown:e,onClick:t,withKeyboardNavigation:n,withAriaAttributes:r,withExpandedAttribute:i,targetType:a,autoComplete:o}){let s=wt(),[c,l]=(0,L.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 jt={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},Mt=n(t=>{let{children:n,refProp:r,withKeyboardNavigation:i,withAriaAttributes:a,withExpandedAttribute:o,targetType:s,autoComplete:c,ref:l,...u}=O(`ComboboxEventsTarget`,jt,t),d=He(n);if(!d)throw Error(`Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=wt();return(0,L.cloneElement)(d,{...At({targetType:s,withAriaAttributes:a,withKeyboardNavigation:i,withExpandedAttribute:o,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:c}),...u,[r]:e(l,f.store.targetRef,Le(d))})});Mt.displayName=`@mantine/core/ComboboxEventsTarget`;var Nt=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=O(`ComboboxFooter`,null,e);return(0,R.jsx)(se,{...wt().getStyles(`footer`,{className:n,classNames:t,style:r,styles:i}),...o,onMouseDown:e=>{e.preventDefault()}})});Nt.classes=yt,Nt.displayName=`@mantine/core/ComboboxFooter`;var Pt=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:o,label:s,id:c,...l}=O(`ComboboxGroup`,null,e),u=wt(),d=x(c),f=s!=null&&s!==!1&&s!==``;return(0,R.jsxs)(se,{role:`group`,"aria-labelledby":f?d:void 0,...u.getStyles(`group`,{className:n,classNames:t,style:r,styles:i}),...l,children:[f&&(0,R.jsx)(`div`,{id:d,...u.getStyles(`groupLabel`,{classNames:t,styles:i}),children:s}),o]})});Pt.classes=yt,Pt.displayName=`@mantine/core/ComboboxGroup`;var Ft=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=O(`ComboboxHeader`,null,e);return(0,R.jsx)(se,{...wt().getStyles(`header`,{className:n,classNames:t,style:r,styles:i}),...o,onMouseDown:e=>{e.preventDefault()}})});Ft.classes=yt,Ft.displayName=`@mantine/core/ComboboxHeader`;function It({value:e,valuesDivider:t=`,`,...n}){return(0,R.jsx)(`input`,{type:`hidden`,value:Array.isArray(e)?e.join(t):e?`${e}`:``,...n})}It.displayName=`@mantine/core/ComboboxHiddenInput`;var Lt=n(e=>{let t=O(`ComboboxOption`,null,e),{classNames:n,className:r,style:i,styles:a,vars:o,onClick:s,id:c,active:l,onMouseDown:u,onMouseOver:d,disabled:f,selected:p,mod:m,...h}=t,g=wt(),_=(0,L.useId)(),v=c||_;return(0,R.jsx)(se,{...g.getStyles(`option`,{className:r,classNames:n,styles:a,style:i}),...h,id:v,mod:[`combobox-option`,{"combobox-active":l,"combobox-disabled":f,"combobox-selected":p},m],role:`option`,onClick:e=>{f?e.preventDefault():(g.onOptionSubmit?.(t.value,t),s?.(e))},onMouseDown:e=>{e.preventDefault(),u?.(e)},onMouseOver:e=>{g.resetSelectionOnOptionHover&&g.store.resetSelectedOption(),d?.(e)}})});Lt.classes=yt,Lt.displayName=`@mantine/core/ComboboxOption`;var Rt=n(e=>{let{classNames:t,className:n,style:r,styles:i,id:a,onMouseDown:o,labelledBy:s,...c}=O(`ComboboxOptions`,null,e),l=wt(),u=x(a);return(0,L.useEffect)(()=>{l.store.setListId(u)},[u]),(0,R.jsx)(se,{...l.getStyles(`options`,{className:n,style:r,classNames:t,styles:i}),...c,id:u,role:`listbox`,"aria-labelledby":s,onMouseDown:e=>{e.preventDefault(),o?.(e)}})});Rt.classes=yt,Rt.displayName=`@mantine/core/ComboboxOptions`;var zt={withAriaAttributes:!0,withKeyboardNavigation:!0},Bt=n(t=>{let{classNames:n,styles:r,unstyled:i,vars:a,withAriaAttributes:o,onKeyDown:s,onClick:c,withKeyboardNavigation:l,size:u,ref:d,...f}=O(`ComboboxSearch`,zt,t),p=wt(),m=p.getStyles(`search`),h=At({targetType:`input`,withAriaAttributes:o,withKeyboardNavigation:l,withExpandedAttribute:!1,onKeyDown:s,onClick:c,autoComplete:`off`});return(0,R.jsx)(M,{ref:e(d,p.store.searchRef),classNames:[{input:m.className},n],styles:[{input:m.style},r],size:u||p.size,...h,...f,__staticSelector:`Combobox`})});Bt.classes=yt,Bt.displayName=`@mantine/core/ComboboxSearch`;var Vt={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},Ht=n(t=>{let{children:n,refProp:r,withKeyboardNavigation:i,withAriaAttributes:a,withExpandedAttribute:o,targetType:s,autoComplete:c,ref:l,...u}=O(`ComboboxTarget`,Vt,t),d=He(n);if(!d)throw Error(`Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=wt(),p=(0,L.cloneElement)(d,{...At({targetType:s,withAriaAttributes:a,withKeyboardNavigation:i,withExpandedAttribute:o,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:c}),...u});return(0,R.jsx)(fe.Target,{refProp:r,ref:e(l,f.store.targetRef),children:p})});Ht.displayName=`@mantine/core/ComboboxTarget`;function Ut(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 Wt(e,t,n){for(let n=e+1;n{s||(c(!0),i?.(e))},[c,i,s]),_=(0,L.useCallback)((e=`unknown`)=>{s&&(c(!1),r?.(e))},[c,r,s]),v=(0,L.useCallback)((e=`unknown`)=>{s?_(e):g(e)},[_,g,s]),y=(0,L.useCallback)(()=>{let e=dt(f.current),t=lt(`#${l.current} [data-combobox-selected]`,e);t?.removeAttribute(`data-combobox-selected`),t?.removeAttribute(`aria-selected`)},[]),b=(0,L.useCallback)(e=>{let t=dt(f.current),n=lt(`#${l.current}`,t),r=n?ut(`[data-combobox-option]`,n):null;if(!r)return null;let i=e>=r.length?0:e<0?r.length-1:e;return u.current=i,r?.[i]&&!r[i].hasAttribute(`data-combobox-disabled`)?(y(),r[i].setAttribute(`data-combobox-selected`,`true`),r[i].setAttribute(`aria-selected`,`true`),r[i].scrollIntoView({block:`nearest`,behavior:o}),r[i].id):null},[o,y]),x=(0,L.useCallback)(()=>{let e=dt(f.current),t=lt(`#${l.current} [data-combobox-active]`,e);if(t){let n=ut(`#${l.current} [data-combobox-option]`,e).findIndex(e=>e===t);return b(n)}return b(0)},[b]),S=(0,L.useCallback)(()=>{let e=dt(f.current),t=ut(`#${l.current} [data-combobox-option]`,e);return b(Wt(u.current,t,a))},[b,a]),C=(0,L.useCallback)(()=>{let e=dt(f.current),t=ut(`#${l.current} [data-combobox-option]`,e);return b(Ut(u.current,t,a))},[b,a]),w=(0,L.useCallback)(()=>{let e=dt(f.current),t=ut(`#${l.current} [data-combobox-option]`,e);return b(Gt(t))},[b]),T=(0,L.useCallback)((e=`selected`,t)=>{if(typeof e==`number`){u.current=e;let n=dt(f.current),r=ut(`#${l.current} [data-combobox-option]`,n);t?.scrollIntoView&&r[e]?.scrollIntoView({block:`nearest`,behavior:o});return}h.current=window.setTimeout(()=>{let n=dt(f.current),r=ut(`#${l.current} [data-combobox-option]`,n),i=r.findIndex(t=>t.hasAttribute(`data-combobox-${e}`));u.current=i,t?.scrollIntoView&&r[i]?.scrollIntoView({block:`nearest`,behavior:o})},0)},[]),E=(0,L.useCallback)(()=>{u.current=-1,y()},[y]),D=(0,L.useCallback)(()=>{let e=dt(f.current);(ut(`#${l.current} [data-combobox-option]`,e)?.[u.current])?.click()},[]),O=(0,L.useCallback)(e=>{l.current=e},[]),k=(0,L.useCallback)(()=>{p.current=window.setTimeout(()=>d.current?.focus(),0)},[]),A=(0,L.useCallback)(()=>{m.current=window.setTimeout(()=>f.current?.focus(),0)},[]),j=(0,L.useCallback)(()=>u.current,[]);return(0,L.useEffect)(()=>()=>{window.clearTimeout(p.current),window.clearTimeout(m.current),window.clearTimeout(h.current)},[]),{dropdownOpened:s,openDropdown:g,closeDropdown:_,toggleDropdown:v,selectedOptionIndex:u.current,getSelectedOptionIndex:j,selectOption:b,selectFirstOption:w,selectActiveOption:x,selectNextOption:S,selectPreviousOption:C,resetSelectedOption:E,updateSelectedOptionIndex:T,listId:l.current,setListId:O,clickSelectedOption:D,searchRef:d,focusSearchInput:k,targetRef:f,focusTarget:A}}var qt={keepMounted:!0,keepMountedMode:`display-none`,withinPortal:!0,resetSelectionOnOptionHover:!1,width:`target`,transitionProps:{transition:`fade`,duration:0},size:`sm`},Jt=f((e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":D(t),"--combobox-option-padding":ie(t,`combobox-option-padding`)},dropdown:{"--combobox-padding":n===void 0?void 0:b(n),"--combobox-option-fz":D(t),"--combobox-option-padding":ie(t,`combobox-option-padding`)}})),Yt=e=>{let t=O(`Combobox`,qt,e),{classNames:n,styles:r,unstyled:i,children:a,store:o,vars:s,onOptionSubmit:c,onClose:l,size:u,dropdownPadding:d,resetSelectionOnOptionHover:f,__staticSelector:p,readOnly:m,attributes:h,floatingHeight:g,middlewares:_,...v}=t,y=g===`viewport`?{..._,flip:!1,size:{...typeof _?.size==`object`?_.size:{},padding:typeof _?.size==`object`&&_.size.padding!==void 0?_.size.padding:10,apply:({availableHeight:e,availableWidth:t,elements:n,...r})=>{n.floating.style.setProperty(`--combobox-floating-max-height`,`${e}px`);let i=_?.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`})}}}:_,b=Kt(),x=o||b,S=k({name:p||`Combobox`,classes:yt,props:t,classNames:n,styles:r,unstyled:i,attributes:h,vars:s,varsResolver:Jt}),C=()=>{l?.(),x.closeDropdown()};return(0,R.jsx)(Ct,{value:{getStyles:S,store:x,onOptionSubmit:c,size:u,resetSelectionOnOptionHover:f,readOnly:m,floatingHeight:g},children:(0,R.jsx)(fe,{opened:x.dropdownOpened,...v,middlewares:y,onChange:e=>!e&&C(),withRoles:!1,unstyled:i,children:a})})};Yt.extend=e=>e,Yt.classes=yt,Yt.varsResolver=Jt,Yt.displayName=`@mantine/core/Combobox`,Yt.Target=Ht,Yt.Dropdown=Et,Yt.Options=Rt,Yt.Option=Lt,Yt.Search=Bt,Yt.Empty=kt,Yt.Chevron=St,Yt.Footer=Nt,Yt.Header=Ft,Yt.EventsTarget=Mt,Yt.DropdownTarget=Ot,Yt.Group=Pt,Yt.ClearButton=Tt,Yt.HiddenInput=It;function Xt(e){return`group`in e}function Zt({options:e,search:t,limit:n}){let r=t.trim().toLowerCase(),i=[];for(let a=0;a0)return!1;return!0}function $t(e,t=new Set){if(Array.isArray(e))for(let n of e)if(Xt(n))$t(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 en(e,t){return Array.isArray(e)?e.includes(t):e===t}function tn({data:e,withCheckIcon:t,withAlignedLabels:n,value:r,checkIconPosition:i,unstyled:a,renderOption:o}){if(!Xt(e)){let s=en(r,e.value),c=t&&(s?(0,R.jsx)(pe,{className:yt.optionsDropdownCheckIcon}):n?(0,R.jsx)(`div`,{className:yt.optionsDropdownCheckPlaceholder}):null),l=(0,R.jsxs)(R.Fragment,{children:[i===`left`&&c,(0,R.jsx)(`span`,{children:e.label}),i===`right`&&c]});return(0,R.jsx)(Yt.Option,{value:e.value,disabled:e.disabled,className:p({[yt.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,R.jsx)(tn,{data:e,value:r,unstyled:a,withCheckIcon:t,withAlignedLabels:n,checkIconPosition:i,renderOption:o},`${e.value}`));return(0,R.jsx)(Yt.Group,{label:e.group,children:s})}function nn({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=wt();$t(e);let x=typeof i==`string`?(r||Zt)({options:e,search:l?i:``,limit:a??1/0}):e,S=Qt(x),C=x.map((e,t)=>(0,R.jsx)(tn,{data:e,withCheckIcon:u,withAlignedLabels:d,value:f,checkIconPosition:p,unstyled:h,renderOption:_},Xt(e)?`group-${typeof e.group==`string`?e.group:t}`:`${e.value}`));return(0,R.jsx)(Yt.Dropdown,{hidden:t||n&&S,"data-composed":!0,children:(0,R.jsxs)(Yt.Options,{labelledBy:g,"aria-label":y,children:[c?(0,R.jsx)(ze.Autosize,{mah:(s??b.floatingHeight)===`viewport`?`var(--combobox-floating-options-max-height)`:o??220,type:`scroll`,scrollbarSize:`var(--combobox-padding)`,offsetScrollbars:`y`,...v,children:C}):C,S&&m&&(0,R.jsx)(Yt.Empty,{children:m})]})})}function rn(e){let t=e.currentTarget;return dt(t).activeElement!==t}function an(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[on,sn]=Ve(`Progress.Root component was not found in tree`),cn={root:`m_db6d6462`,section:`m_2242eb65`,"stripes-animation":`m_81a374bd`,"stripes-animation-vertical":`m_e0fb7a86`,label:`m_91e40b74`},ln=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=O(`ProgressLabel`,null,e);return(0,R.jsx)(se,{...sn().getStyles(`label`,{className:n,style:r,classNames:t,styles:i}),...o})});ln.classes=cn,ln.displayName=`@mantine/core/ProgressLabel`;var un=f((e,{size:t,radius:n,transitionDuration:r})=>({root:{"--progress-size":ie(t,`progress-size`),"--progress-radius":n===void 0?void 0:_(n),"--progress-transition-duration":typeof r==`number`?`${r}ms`:void 0}})),dn=n(e=>{let t=O(`ProgressRoot`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,autoContrast:c,transitionDuration:l,orientation:u,attributes:d,mod:f,...p}=t,m=k({name:`Progress`,classes:cn,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:d,vars:s,varsResolver:un});return(0,R.jsx)(on,{value:{getStyles:m,autoContrast:c},children:(0,R.jsx)(se,{mod:[{orientation:u},f],...m(`root`),...p})})});dn.classes=cn,dn.varsResolver=un,dn.displayName=`@mantine/core/ProgressRoot`;var fn={withAria:!0},pn=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:s,value:c,withAria:l,color:u,striped:d,animated:f,mod:p,...m}=O(`ProgressSection`,fn,e),h=sn(),g=o(),_=l?{role:`progressbar`,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":c,"aria-valuetext":`${c}%`}:{};return(0,R.jsx)(se,{...h.getStyles(`section`,{className:n,classNames:t,styles:i,style:r}),...m,..._,mod:[{striped:d||f,animated:f},p],__vars:{"--progress-section-size":`${c}%`,"--progress-section-color":a(u,g),"--progress-label-color":ft(h.autoContrast,g)?he({color:u,theme:g,autoContrast:h.autoContrast}):void 0}})});pn.classes=cn,pn.displayName=`@mantine/core/ProgressSection`;var mn=n(e=>{let n=O(`Progress`,null,e),{value:r,classNames:i,styles:a,vars:o,color:s,striped:c,animated:l,"aria-label":u,...d}=n,{resolvedClassNames:f,resolvedStyles:p}=t({classNames:i,styles:a,props:n});return(0,R.jsx)(dn,{classNames:f,styles:p,vars:o,...d,children:(0,R.jsx)(pn,{value:r,color:s,striped:c,animated:l,"aria-label":u})})});mn.classes=cn,mn.displayName=`@mantine/core/Progress`,mn.Section=pn,mn.Root=dn,mn.Label=ln;var hn={size:`sm`,withCheckIcon:!0,allowDeselect:!0,checkIconPosition:`left`,openOnFocus:!0},gn=oe(e=>{let n=O([`Input`,`InputWrapper`,`Select`],hn,e),{classNames:r,styles:i,unstyled:a,vars:o,dropdownOpened:s,defaultDropdownOpened:c,onDropdownClose:l,onDropdownOpen:u,onFocus:d,onBlur:f,onClick:p,onChange:m,data:h,value:g,defaultValue:_,selectFirstOptionOnChange:v,selectFirstOptionOnDropdownOpen:y,onOptionSubmit:b,comboboxProps:S,readOnly:C,disabled:w,filter:T,limit:E,withScrollArea:D,maxDropdownHeight:k,floatingHeight:A,size:j,searchable:M,rightSection:N,checkIconPosition:P,withCheckIcon:te,withAlignedLabels:ne,nothingFoundMessage:re,name:ie,form:ae,searchValue:oe,defaultSearchValue:se,onSearchChange:ce,allowDeselect:le,error:F,rightSectionPointerEvents:I,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}=n,Oe=(0,L.useMemo)(()=>_t(h),[h]),ke=(0,L.useRef)({}),Ae=(0,L.useMemo)(()=>vt(Oe),[Oe]),je=x(de),[Me,Ne,Pe]=ue({value:g,defaultValue:_,finalValue:null,onChange:m}),Fe=Me==null?void 0:`${Me}`in Ae?Ae[`${Me}`]:ke.current[`${Me}`],Ie=ct(Fe),[Le,Re,ze]=ue({value:oe,defaultValue:se,finalValue:Fe?Fe.label:``,onChange:ce}),Be=Kt({opened:s,defaultOpened:c,onDropdownOpen:()=>{u?.(),y?Be.selectFirstOption():Be.updateSelectedOptionIndex(`active`,{scrollIntoView:!0})},onDropdownClose:()=>{l?.(),setTimeout(Be.resetSelectedOption,0)}}),Ve=e=>{Re(e),Be.resetSelectedOption()},{resolvedClassNames:He,resolvedStyles:Ue}=t({props:n,styles:i,classNames:r});(0,L.useEffect)(()=>{v&&Be.selectFirstOption()},[v,Le]),(0,L.useEffect)(()=>{g===null&&Ve(``),g!=null&&Fe&&(Ie?.value!==Fe.value||Ie?.label!==Fe.label)&&Ve(Fe.label)},[g,Fe]),(0,L.useEffect)(()=>{!Pe&&!ze&&Ve(Me==null?``:`${Me}`in Ae?Ae[`${Me}`]?.label:ke.current[`${Me}`]?.label||``)},[Ae,Me]),(0,L.useEffect)(()=>{Me&&`${Me}`in Ae&&(ke.current[`${Me}`]=Ae[`${Me}`])},[Ae,Me]);let We=(0,R.jsx)(Yt.ClearButton,{...me,onClear:()=>{Ne(null,null),Ve(``),_e?.()}}),Ge=fe&&Me!=null&&!w&&!C;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(Yt,{store:Be,__staticSelector:`Select`,classNames:He,styles:Ue,unstyled:a,readOnly:C,size:j,attributes:Ee,floatingHeight:A,keepMounted:we,onOptionSubmit:e=>{b?.(e);let t=le&&`${Ae[e].value}`==`${Me}`?null:Ae[e],n=t?t.value:null;n!==Me&&Ne(n,t),!Pe&&Ve(n==null?``:t?.label||``),Be.closeDropdown()},...S,children:[(0,R.jsx)(Yt.Target,{targetType:M?`input`:`button`,autoComplete:ve,withExpandedAttribute:!0,children:(0,R.jsx)(ee,{id:je,__defaultRightSection:(0,R.jsx)(Yt.Chevron,{size:j,error:F,unstyled:a,color:Ce}),__clearSection:We,__clearable:Ge,__clearSectionMode:pe,rightSection:N,rightSectionPointerEvents:I||`none`,...De,size:j,__staticSelector:`Select`,disabled:w,readOnly:C||!M,value:Le,onChange:e=>{if(rn(e)){if(!C){let t=an(Ae,e.currentTarget.value);t&&`${t.value}`!=`${Me}`&&(Ne(t.value,t),!Pe&&Ve(t.label))}return}Ve(e.currentTarget.value),Be.openDropdown(),v&&Be.selectFirstOption()},onFocus:e=>{Te&&M&&Be.openDropdown(),d?.(e)},onBlur:e=>{we&&Be.clickSelectedOption(),M&&Be.closeDropdown();let t=Me!=null&&(`${Me}`in Ae?Ae[`${Me}`]:ke.current[`${Me}`]);Ve(t&&t.label||``),f?.(e)},onClick:e=>{M?Be.openDropdown():Be.toggleDropdown(),p?.(e)},classNames:He,styles:Ue,unstyled:a,pointer:!M,error:F,attributes:Ee})}),(0,R.jsx)(nn,{data:Oe,hidden:C||w,filter:T,search:Le,limit:E,hiddenWhenEmpty:!re,withScrollArea:D,maxDropdownHeight:k,filterOptions:!!M&&Fe?.label!==Le,value:Me,checkIconPosition:P,withCheckIcon:te,withAlignedLabels:ne,nothingFoundMessage:re,unstyled:a,labelId:De.label?`${je}-label`:void 0,"aria-label":De.label?void 0:De[`aria-label`],renderOption:ge,scrollAreaProps:ye})]}),(0,R.jsx)(Yt.HiddenInput,{value:Me,name:ie,form:ae,disabled:w,...he})]})});gn.classes={...ee.classes,...Yt.classes},gn.displayName=`@mantine/core/Select`;function _n(e){if(e!==void 0)return typeof e==`number`?b(e):e}function vn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let c=o(),l=t===void 0?e:t,u=r!==void 0,d=j({"--sg-spacing-x":v(st(e)),"--sg-spacing-y":v(st(l)),"--sg-auto-rows":i,...u?{"--sg-min-col-width":_n(r)}:{"--sg-cols":st(n)?.toString()}}),f=te(c.breakpoints).reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=v(e[r])),typeof l==`object`&&l[r]!==void 0&&(t[r][`--sg-spacing-y`]=v(l[r])),!u&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{});return(0,R.jsx)(s,{styles:d,media:Te(te(f),c.breakpoints).filter(e=>te(f[e.value]).length>0).map(e=>({query:`(min-width: ${c.breakpoints[e.value]})`,styles:f[e.value]})),selector:a})}function yn(e){return typeof e==`object`&&e?te(e):[]}function bn(e){return e.sort((e,t)=>me(e)-me(t))}function xn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}){return bn(Array.from(new Set([...yn(e),...yn(t),...r===void 0?yn(n):[]])))}function Sn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=t===void 0?e:t,c=r!==void 0,l=j({"--sg-spacing-x":v(st(e)),"--sg-spacing-y":v(st(o)),"--sg-auto-rows":i,...c?{"--sg-min-col-width":_n(r)}:{"--sg-cols":st(n)?.toString()}}),u=xn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}),d=u.reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=v(e[r])),typeof o==`object`&&o[r]!==void 0&&(t[r][`--sg-spacing-y`]=v(o[r])),!c&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{});return(0,R.jsx)(s,{styles:l,container:u.map(e=>({query:`simple-grid (min-width: ${e})`,styles:d[e]})),selector:a})}var Cn={container:`m_925c2d2c`,root:`m_2415a157`},wn={cols:1,spacing:`md`,type:`media`},Tn=n(e=>{let t=O(`SimpleGrid`,wn,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,cols:c,verticalSpacing:l,spacing:u,type:f,minColWidth:p,autoFlow:m,autoRows:h,attributes:g,..._}=t,v=k({name:`SimpleGrid`,classes:Cn,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:g,vars:s}),y=d(),b=p===void 0?void 0:m||`auto-fill`;return f===`container`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Sn,{...t,selector:`.${y}`}),(0,R.jsx)(`div`,{...v(`container`),children:(0,R.jsx)(se,{...v(`root`,{className:y}),..._,"data-auto-cols":b})})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(vn,{...t,selector:`.${y}`}),(0,R.jsx)(se,{...v(`root`,{className:y}),..._,"data-auto-cols":b})]})});Tn.classes=Cn,Tn.displayName=`@mantine/core/SimpleGrid`;var En=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M204,64V168a12,12,0,0,1-24,0V93L72.49,200.49a12,12,0,0,1-17-17L163,76H88a12,12,0,0,1,0-24H192A12,12,0,0,1,204,64Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M192,64V168L88,64Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M192,56H88a8,8,0,0,0-5.66,13.66L128.69,116,58.34,186.34a8,8,0,0,0,11.32,11.32L140,127.31l46.34,46.35A8,8,0,0,0,200,168V64A8,8,0,0,0,192,56Zm-8,92.69-38.34-38.34h0L107.31,72H184Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-13.66,5.66L140,127.31,69.66,197.66a8,8,0,0,1-11.32-11.32L128.69,116,82.34,69.66A8,8,0,0,1,88,56H192A8,8,0,0,1,200,64Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M198,64V168a6,6,0,0,1-12,0V78.48L68.24,196.24a6,6,0,0,1-8.48-8.48L177.52,70H88a6,6,0,0,1,0-12H192A6,6,0,0,1,198,64Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-16,0V83.31L69.66,197.66a8,8,0,0,1-11.32-11.32L172.69,72H88a8,8,0,0,1,0-16H192A8,8,0,0,1,200,64Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M196,64V168a4,4,0,0,1-8,0V73.66L66.83,194.83a4,4,0,0,1-5.66-5.66L182.34,68H88a4,4,0,0,1,0-8H192A4,4,0,0,1,196,64Z`}))]]),Dn=new Map([[`bold`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`}))]]),On=new Map([[`bold`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M216,144a32,32,0,1,1-32-32A32,32,0,0,1,216,144Z`,opacity:`0.2`}),L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`}))]]),kn=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M40,92H70.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24H137.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24Zm64-24A12,12,0,1,1,92,80,12,12,0,0,1,104,68Zm112,96H201.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24h94.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24Zm-48,24a12,12,0,1,1,12-12A12,12,0,0,1,168,188Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M128,80a24,24,0,1,1-24-24A24,24,0,0,1,128,80Zm40,72a24,24,0,1,0,24,24A24,24,0,0,0,168,152Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M32,80a8,8,0,0,1,8-8H77.17a28,28,0,0,1,53.66,0H216a8,8,0,0,1,0,16H130.83a28,28,0,0,1-53.66,0H40A8,8,0,0,1,32,80Zm184,88H194.83a28,28,0,0,0-53.66,0H40a8,8,0,0,0,0,16H141.17a28,28,0,0,0,53.66,0H216a8,8,0,0,0,0-16Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M40,86H74.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12H133.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12Zm64-24A18,18,0,1,1,86,80,18,18,0,0,1,104,62ZM216,170H197.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12h98.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12Zm-48,24a18,18,0,1,1,18-18A18,18,0,0,1,168,194Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M40,84H76.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8H131.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8Zm64-24A20,20,0,1,1,84,80,20,20,0,0,1,104,60ZM216,172H195.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8H140.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8Zm-48,24a20,20,0,1,1,20-20A20,20,0,0,1,168,196Z`}))]]),An=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:En}));An.displayName=`ArrowUpRightIcon`;var jn=An,Mn=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:Dn}));Mn.displayName=`CaretDownIcon`;var Nn=Mn,Pn=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:On}));Pn.displayName=`ListMagnifyingGlassIcon`;var Fn=Pn,In=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:kn}));In.displayName=`SlidersHorizontalIcon`;var Ln=In;function Rn(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function zn(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function Bn(e,t,n,r,i,a,o){let{margin:s,containerPadding:c,rowHeight:l}=e,u=Rn(e),d,f,p,m;if(o?(d=Math.round(o.width),f=Math.round(o.height)):(d=zn(r,u,s[0]),f=zn(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 Vn(e,t,n,r,i){let{margin:a,containerPadding:o,cols:s,rowHeight:c,maxRows:l}=e,u=Rn(e),d=Math.round((n-o[0])/(u+a[0])),f=Math.round((t-o[1])/(c+a[1]));return d=Wn(d,0,s-r),f=Wn(f,0,l-i),{x:d,y:f}}function Hn(e,t,n){let{margin:r,containerPadding:i,rowHeight:a}=e,o=Rn(e);return{x:Math.round((n-i[0])/(o+r[0])),y:Math.round((t-i[1])/(a+r[1]))}}function Un(e,t,n){let{margin:r,rowHeight:i}=e,a=Rn(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 Wn(e,t,n){return Math.max(Math.min(e,n),t)}function Gn(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 Kn(e,t){for(let n=0;nGn(e,t))}function Jn(e,t){return t===`horizontal`?Xn(e):t===`vertical`||t===`wrap`?Yn(e):[...e]}function Yn(e){return[...e].sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y)}function Xn(e){return[...e].sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x)}function Zn(e){let t=0;for(let n=0;nt&&(t=e)}}return t}function Qn(e,t){for(let n=0;ne.static===!0)}function er(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 tr(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.static)n.push(i);else for(;Kn(n,i);)i.y++}}return e}function ar(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=Jn(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(d=d.reverse());let f=qn(d,t),p=f.length>0;if(p&&c)return tr(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 ar(e,n,o?a.x:void 0,s?a.y:void 0,r,c,i);if(u&&s)return ar(e,n,void 0,n.y+1,r,c,i);if(u&&i===null)return t.y=n.y,n.y+=n.h,[...e];if(d&&o)return ar(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]:ar(e,n,l,u,r,c,i)}function sr(e,t,n){return Math.max(t,Math.min(n,e))}var cr=[{name:`gridBounds`,constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:sr(t,0,Math.max(0,r-e.w)),y:sr(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:sr(t,1,Math.max(1,o)),h:sr(n,1,Math.max(1,s))}}},{name:`minMaxSize`,constrainSize(e,t,n){return{w:sr(t,e.minW??1,e.maxW??1/0),h:sr(n,e.minH??1,e.maxH??1/0)}}}];function lr(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 ur(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 dr({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 fr({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:`absolute`}}function pr(e){return e*100+`%`}function mr(e,t,n,r){return e+n>r?t:n}function hr(e,t,n){return e<0?t:n}function gr(e){return Math.max(0,e)}function _r(e){return Math.max(0,e)}var vr=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:hr(o,e.height,i),top:_r(o)}},yr=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:mr(e.left,e.width,o,n),left:gr(i)}},br=(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:_r(r),left:0}:{height:i,width:a,top:_r(r),left:o}},xr=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:hr(r,e.height,a),top:_r(r)}},Sr={n:vr,ne:(e,t,n)=>vr(e,yr(e,t,n)),e:yr,se:(e,t,n)=>xr(e,yr(e,t,n)),s:xr,sw:(e,t,n)=>xr(e,br(e,t)),w:br,nw:(e,t,n)=>vr(e,br(e,t))};function Cr(e,t,n,r){let i=Sr[e];return i?i(t,{...t,...n},r):n}var wr={type:`transform`,scale:1,calcStyle(e){return dr(e)}},Tr={type:`absolute`,scale:1,calcStyle(e){return fr(e)}};function Er(e){return{type:`transform`,scale:e,calcStyle(e){return dr(e)},calcDragPosition(t,n,r,i){return{left:(t-r)/e,top:(n-i)/e}}}}var Dr=wr,Or={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},kr={enabled:!0,bounded:!1,threshold:3},Ar={enabled:!0,handles:[`se`]},jr={enabled:!1,defaultItem:{w:1,h:1}};function Mr(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??$n(e).length>0;for(let i=o+1;it.y+t.h)break;Gn(t,o)&&Mr(e,o,n+t[a],r,s)}}t[r]=n}function Nr(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&&!Kn(e,t);)t.y--;let i;for(;(i=Kn(e,t))!==void 0;)Mr(n,t,i.y+i.h,`y`);return t.y=Math.max(t.y,0),t}function Pr(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!Kn(e,t);)t.x--;let i;for(;(i=Kn(e,t))!==void 0;)if(Mr(r,t,i.x+i.w,`x`),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!Kn(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var Fr={type:`vertical`,allowOverlap:!1,compact(e,t){let n=$n(e),r=Zn(n),i=Yn(e),a=Array(e.length);for(let t=0;te[t]-e[n])}function Ur(e,t){let n=Hr(e),r=n[0];if(r===void 0)throw Error(`No breakpoints defined`);for(let i=1;ie[a]&&(r=a)}return r}function Wr(e,t){let n=t[e];if(n===void 0)throw Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function Gr(e,t,n,r,i,a){let o=e[n];if(o)return tr(o);let s=e[r],c=Hr(t),l=c.slice(c.indexOf(n));for(let t=0;t{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Jr=h(((e,t)=>{var n=qr();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}})),Yr=h(((e,t)=>{t.exports=Jr()()})),Xr=u(Yr(),1),Zr=u(T(),1);function Qr(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&&Qr(e.changedTouches,e=>t===e.identifier)}function Si(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function Ci(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function wi(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??Ci();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;} +import{$ as e,A as t,C as n,D as r,E as i,K as a,N as o,O as s,R as c,S as l,St as u,T as d,X as f,Y as p,_ as m,_t as h,a as g,at as _,ct as v,d as y,dt as b,et as x,f as S,gt as C,h as w,ht as T,i as E,it as D,j as O,k,l as A,lt as j,m as M,mt as N,o as P,p as ee,pt as te,r as ne,s as re,st as ie,u as ae,w as oe,x as se,y as ce,yt as le}from"./brand-MzZ03bSa.js";import{c as ue,i as F,o as I}from"./auth-B1VNekWU.js";import{C as de,D as fe,E as pe,N as me,O as he,S as ge,T as _e,_ as ve,b as ye,c as be,f as xe,g as Se,h as Ce,i as we,j as Te,l as Ee,m as De,n as Oe,o as ke,p as Ae,s as je,u as Me,v as Ne,w as Pe,x as Fe,y as Ie}from"./tokens-CPxx1QN7.js";import{S as Le,T as Re,o as ze,t as Be,w as Ve,x as He}from"./Tooltip-BJiO7C_G.js";import{t as Ue}from"./use-computed-color-scheme-6JIsge00.js";import{O as We,V as Ge,i as Ke,k as qe,n as Je,t as Ye}from"./api-CB7Xlqes.js";import{o as Xe}from"./preload-helper-BL3qEkUh.js";import{a as Ze,c as Qe,i as $e,n as et,o as tt,r as nt,s as rt,t as it}from"./format-urrStEsn.js";import{n as at,t as ot}from"./WarningCircle.es-BrGtHGYK.js";var L=u(C(),1),R=N();function st(e){return typeof e==`object`&&e?`base`in e?e.base:void 0:e}function ct(e){let t=(0,L.useRef)(void 0);return(0,L.useEffect)(()=>{t.current=e},[e]),t.current}function lt(e,t=document){let n=t.querySelector(e);if(n)return n;let r=t.querySelectorAll(`*`);for(let t=0;t{let t=O(`Flex`,null,e),{classNames:n,className:a,style:l,styles:u,unstyled:f,vars:p,gap:m,rowGap:h,columnGap:g,align:_,justify:v,wrap:y,direction:b,attributes:x,...S}=t,C=k({name:`Flex`,classes:mt,props:t,className:a,style:l,classNames:n,styles:u,unstyled:f,attributes:x,vars:p}),w=o(),T=d(),E=i({styleProps:{gap:m,rowGap:h,columnGap:g,align:_,justify:v,wrap:y,direction:b},theme:w,data:pt}),D=c(),A=D&&E.hasResponsiveStyles?r(E.styles,E.media):T;return(0,R.jsxs)(R.Fragment,{children:[E.hasResponsiveStyles&&(0,R.jsx)(s,{selector:`.${A}`,styles:E.styles,media:E.media,deduplicate:D}),(0,R.jsx)(se,{...C(`root`,{className:A,style:j(E.inlineStyles)}),...S})]})});ht.classes=mt,ht.displayName=`@mantine/core/Flex`;function gt(e){return typeof e==`string`?{value:e,label:e}:typeof e==`object`&&`value`in e&&!(`label`in e)?{value:e.value,label:`${e.value}`,disabled:e.disabled}:typeof e==`object`&&`group`in e?{group:e.group,items:e.items.map(e=>gt(e))}:typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?{value:e,label:`${e}`}:e}function _t(e){return e?e.map(e=>gt(e)):[]}function vt(e){return e.reduce((e,t)=>`group`in t?{...e,...vt(t.items)}:(e[`${t.value}`]=t,e),{})}var yt={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`},bt={error:null},xt=f((e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":ie(t,`combobox-chevron-size`),"--combobox-chevron-color":n?a(n,e):void 0}})),St=n(e=>{let t=O(`ComboboxChevron`,bt,e),{size:n,error:r,style:i,className:a,classNames:o,styles:s,unstyled:c,vars:l,attributes:u,mod:d,...f}=t,p=k({name:`ComboboxChevron`,classes:yt,props:t,style:i,className:a,classNames:o,styles:s,unstyled:c,vars:l,varsResolver:xt,attributes:u,rootSelector:`chevron`});return(0,R.jsx)(se,{component:`svg`,...f,...p(`chevron`),size:n,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,mod:[`combobox-chevron`,{error:r},d],children:(0,R.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`})})});St.classes=yt,St.varsResolver=xt,St.displayName=`@mantine/core/ComboboxChevron`;var[Ct,wt]=Ve(`Combobox component was not found in tree`);function Tt({onMouseDown:e,onClick:t,onClear:n,...r}){return(0,R.jsx)(M.ClearButton,{tabIndex:-1,"aria-hidden":!0,...r,onMouseDown:t=>{t.preventDefault(),e?.(t)},onClick:e=>{n(),t?.(e)}})}Tt.displayName=`@mantine/core/ComboboxClearButton`;var Et=n(e=>{let{classNames:t,styles:n,className:r,style:i,hidden:a,...o}=O(`ComboboxDropdown`,null,e),s=wt();return(0,R.jsx)(fe.Dropdown,{...o,role:`presentation`,"data-hidden":a||void 0,"data-floating-height":s.floatingHeight||void 0,...s.getStyles(`dropdown`,{className:r,style:i,classNames:t,styles:n})})});Et.classes=yt,Et.displayName=`@mantine/core/ComboboxDropdown`;var Dt={refProp:`ref`},Ot=n(e=>{let{children:t,refProp:n,ref:r}=O(`ComboboxDropdownTarget`,Dt,e);if(wt(),!Re(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,R.jsx)(fe.Target,{ref:r,refProp:n,children:t})});Ot.displayName=`@mantine/core/ComboboxDropdownTarget`;var kt=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=O(`ComboboxEmpty`,null,e);return(0,R.jsx)(se,{...wt().getStyles(`empty`,{className:n,classNames:t,styles:i,style:r}),...o})});kt.classes=yt,kt.displayName=`@mantine/core/ComboboxEmpty`;function At({onKeyDown:e,onClick:t,withKeyboardNavigation:n,withAriaAttributes:r,withExpandedAttribute:i,targetType:a,autoComplete:o}){let s=wt(),[c,l]=(0,L.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 jt={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},Mt=n(t=>{let{children:n,refProp:r,withKeyboardNavigation:i,withAriaAttributes:a,withExpandedAttribute:o,targetType:s,autoComplete:c,ref:l,...u}=O(`ComboboxEventsTarget`,jt,t),d=He(n);if(!d)throw Error(`Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=wt();return(0,L.cloneElement)(d,{...At({targetType:s,withAriaAttributes:a,withKeyboardNavigation:i,withExpandedAttribute:o,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:c}),...u,[r]:e(l,f.store.targetRef,Le(d))})});Mt.displayName=`@mantine/core/ComboboxEventsTarget`;var Nt=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=O(`ComboboxFooter`,null,e);return(0,R.jsx)(se,{...wt().getStyles(`footer`,{className:n,classNames:t,style:r,styles:i}),...o,onMouseDown:e=>{e.preventDefault()}})});Nt.classes=yt,Nt.displayName=`@mantine/core/ComboboxFooter`;var Pt=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:o,label:s,id:c,...l}=O(`ComboboxGroup`,null,e),u=wt(),d=x(c),f=s!=null&&s!==!1&&s!==``;return(0,R.jsxs)(se,{role:`group`,"aria-labelledby":f?d:void 0,...u.getStyles(`group`,{className:n,classNames:t,style:r,styles:i}),...l,children:[f&&(0,R.jsx)(`div`,{id:d,...u.getStyles(`groupLabel`,{classNames:t,styles:i}),children:s}),o]})});Pt.classes=yt,Pt.displayName=`@mantine/core/ComboboxGroup`;var Ft=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=O(`ComboboxHeader`,null,e);return(0,R.jsx)(se,{...wt().getStyles(`header`,{className:n,classNames:t,style:r,styles:i}),...o,onMouseDown:e=>{e.preventDefault()}})});Ft.classes=yt,Ft.displayName=`@mantine/core/ComboboxHeader`;function It({value:e,valuesDivider:t=`,`,...n}){return(0,R.jsx)(`input`,{type:`hidden`,value:Array.isArray(e)?e.join(t):e?`${e}`:``,...n})}It.displayName=`@mantine/core/ComboboxHiddenInput`;var Lt=n(e=>{let t=O(`ComboboxOption`,null,e),{classNames:n,className:r,style:i,styles:a,vars:o,onClick:s,id:c,active:l,onMouseDown:u,onMouseOver:d,disabled:f,selected:p,mod:m,...h}=t,g=wt(),_=(0,L.useId)(),v=c||_;return(0,R.jsx)(se,{...g.getStyles(`option`,{className:r,classNames:n,styles:a,style:i}),...h,id:v,mod:[`combobox-option`,{"combobox-active":l,"combobox-disabled":f,"combobox-selected":p},m],role:`option`,onClick:e=>{f?e.preventDefault():(g.onOptionSubmit?.(t.value,t),s?.(e))},onMouseDown:e=>{e.preventDefault(),u?.(e)},onMouseOver:e=>{g.resetSelectionOnOptionHover&&g.store.resetSelectedOption(),d?.(e)}})});Lt.classes=yt,Lt.displayName=`@mantine/core/ComboboxOption`;var Rt=n(e=>{let{classNames:t,className:n,style:r,styles:i,id:a,onMouseDown:o,labelledBy:s,...c}=O(`ComboboxOptions`,null,e),l=wt(),u=x(a);return(0,L.useEffect)(()=>{l.store.setListId(u)},[u]),(0,R.jsx)(se,{...l.getStyles(`options`,{className:n,style:r,classNames:t,styles:i}),...c,id:u,role:`listbox`,"aria-labelledby":s,onMouseDown:e=>{e.preventDefault(),o?.(e)}})});Rt.classes=yt,Rt.displayName=`@mantine/core/ComboboxOptions`;var zt={withAriaAttributes:!0,withKeyboardNavigation:!0},Bt=n(t=>{let{classNames:n,styles:r,unstyled:i,vars:a,withAriaAttributes:o,onKeyDown:s,onClick:c,withKeyboardNavigation:l,size:u,ref:d,...f}=O(`ComboboxSearch`,zt,t),p=wt(),m=p.getStyles(`search`),h=At({targetType:`input`,withAriaAttributes:o,withKeyboardNavigation:l,withExpandedAttribute:!1,onKeyDown:s,onClick:c,autoComplete:`off`});return(0,R.jsx)(M,{ref:e(d,p.store.searchRef),classNames:[{input:m.className},n],styles:[{input:m.style},r],size:u||p.size,...h,...f,__staticSelector:`Combobox`})});Bt.classes=yt,Bt.displayName=`@mantine/core/ComboboxSearch`;var Vt={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},Ht=n(t=>{let{children:n,refProp:r,withKeyboardNavigation:i,withAriaAttributes:a,withExpandedAttribute:o,targetType:s,autoComplete:c,ref:l,...u}=O(`ComboboxTarget`,Vt,t),d=He(n);if(!d)throw Error(`Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=wt(),p=(0,L.cloneElement)(d,{...At({targetType:s,withAriaAttributes:a,withKeyboardNavigation:i,withExpandedAttribute:o,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:c}),...u});return(0,R.jsx)(fe.Target,{refProp:r,ref:e(l,f.store.targetRef),children:p})});Ht.displayName=`@mantine/core/ComboboxTarget`;function Ut(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 Wt(e,t,n){for(let n=e+1;n{s||(c(!0),i?.(e))},[c,i,s]),_=(0,L.useCallback)((e=`unknown`)=>{s&&(c(!1),r?.(e))},[c,r,s]),v=(0,L.useCallback)((e=`unknown`)=>{s?_(e):g(e)},[_,g,s]),y=(0,L.useCallback)(()=>{let e=dt(f.current),t=lt(`#${l.current} [data-combobox-selected]`,e);t?.removeAttribute(`data-combobox-selected`),t?.removeAttribute(`aria-selected`)},[]),b=(0,L.useCallback)(e=>{let t=dt(f.current),n=lt(`#${l.current}`,t),r=n?ut(`[data-combobox-option]`,n):null;if(!r)return null;let i=e>=r.length?0:e<0?r.length-1:e;return u.current=i,r?.[i]&&!r[i].hasAttribute(`data-combobox-disabled`)?(y(),r[i].setAttribute(`data-combobox-selected`,`true`),r[i].setAttribute(`aria-selected`,`true`),r[i].scrollIntoView({block:`nearest`,behavior:o}),r[i].id):null},[o,y]),x=(0,L.useCallback)(()=>{let e=dt(f.current),t=lt(`#${l.current} [data-combobox-active]`,e);if(t){let n=ut(`#${l.current} [data-combobox-option]`,e).findIndex(e=>e===t);return b(n)}return b(0)},[b]),S=(0,L.useCallback)(()=>{let e=dt(f.current),t=ut(`#${l.current} [data-combobox-option]`,e);return b(Wt(u.current,t,a))},[b,a]),C=(0,L.useCallback)(()=>{let e=dt(f.current),t=ut(`#${l.current} [data-combobox-option]`,e);return b(Ut(u.current,t,a))},[b,a]),w=(0,L.useCallback)(()=>{let e=dt(f.current),t=ut(`#${l.current} [data-combobox-option]`,e);return b(Gt(t))},[b]),T=(0,L.useCallback)((e=`selected`,t)=>{if(typeof e==`number`){u.current=e;let n=dt(f.current),r=ut(`#${l.current} [data-combobox-option]`,n);t?.scrollIntoView&&r[e]?.scrollIntoView({block:`nearest`,behavior:o});return}h.current=window.setTimeout(()=>{let n=dt(f.current),r=ut(`#${l.current} [data-combobox-option]`,n),i=r.findIndex(t=>t.hasAttribute(`data-combobox-${e}`));u.current=i,t?.scrollIntoView&&r[i]?.scrollIntoView({block:`nearest`,behavior:o})},0)},[]),E=(0,L.useCallback)(()=>{u.current=-1,y()},[y]),D=(0,L.useCallback)(()=>{let e=dt(f.current);(ut(`#${l.current} [data-combobox-option]`,e)?.[u.current])?.click()},[]),O=(0,L.useCallback)(e=>{l.current=e},[]),k=(0,L.useCallback)(()=>{p.current=window.setTimeout(()=>d.current?.focus(),0)},[]),A=(0,L.useCallback)(()=>{m.current=window.setTimeout(()=>f.current?.focus(),0)},[]),j=(0,L.useCallback)(()=>u.current,[]);return(0,L.useEffect)(()=>()=>{window.clearTimeout(p.current),window.clearTimeout(m.current),window.clearTimeout(h.current)},[]),{dropdownOpened:s,openDropdown:g,closeDropdown:_,toggleDropdown:v,selectedOptionIndex:u.current,getSelectedOptionIndex:j,selectOption:b,selectFirstOption:w,selectActiveOption:x,selectNextOption:S,selectPreviousOption:C,resetSelectedOption:E,updateSelectedOptionIndex:T,listId:l.current,setListId:O,clickSelectedOption:D,searchRef:d,focusSearchInput:k,targetRef:f,focusTarget:A}}var qt={keepMounted:!0,keepMountedMode:`display-none`,withinPortal:!0,resetSelectionOnOptionHover:!1,width:`target`,transitionProps:{transition:`fade`,duration:0},size:`sm`},Jt=f((e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":D(t),"--combobox-option-padding":ie(t,`combobox-option-padding`)},dropdown:{"--combobox-padding":n===void 0?void 0:b(n),"--combobox-option-fz":D(t),"--combobox-option-padding":ie(t,`combobox-option-padding`)}})),Yt=e=>{let t=O(`Combobox`,qt,e),{classNames:n,styles:r,unstyled:i,children:a,store:o,vars:s,onOptionSubmit:c,onClose:l,size:u,dropdownPadding:d,resetSelectionOnOptionHover:f,__staticSelector:p,readOnly:m,attributes:h,floatingHeight:g,middlewares:_,...v}=t,y=g===`viewport`?{..._,flip:!1,size:{...typeof _?.size==`object`?_.size:{},padding:typeof _?.size==`object`&&_.size.padding!==void 0?_.size.padding:10,apply:({availableHeight:e,availableWidth:t,elements:n,...r})=>{n.floating.style.setProperty(`--combobox-floating-max-height`,`${e}px`);let i=_?.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`})}}}:_,b=Kt(),x=o||b,S=k({name:p||`Combobox`,classes:yt,props:t,classNames:n,styles:r,unstyled:i,attributes:h,vars:s,varsResolver:Jt}),C=()=>{l?.(),x.closeDropdown()};return(0,R.jsx)(Ct,{value:{getStyles:S,store:x,onOptionSubmit:c,size:u,resetSelectionOnOptionHover:f,readOnly:m,floatingHeight:g},children:(0,R.jsx)(fe,{opened:x.dropdownOpened,...v,middlewares:y,onChange:e=>!e&&C(),withRoles:!1,unstyled:i,children:a})})};Yt.extend=e=>e,Yt.classes=yt,Yt.varsResolver=Jt,Yt.displayName=`@mantine/core/Combobox`,Yt.Target=Ht,Yt.Dropdown=Et,Yt.Options=Rt,Yt.Option=Lt,Yt.Search=Bt,Yt.Empty=kt,Yt.Chevron=St,Yt.Footer=Nt,Yt.Header=Ft,Yt.EventsTarget=Mt,Yt.DropdownTarget=Ot,Yt.Group=Pt,Yt.ClearButton=Tt,Yt.HiddenInput=It;function Xt(e){return`group`in e}function Zt({options:e,search:t,limit:n}){let r=t.trim().toLowerCase(),i=[];for(let a=0;a0)return!1;return!0}function $t(e,t=new Set){if(Array.isArray(e))for(let n of e)if(Xt(n))$t(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 en(e,t){return Array.isArray(e)?e.includes(t):e===t}function tn({data:e,withCheckIcon:t,withAlignedLabels:n,value:r,checkIconPosition:i,unstyled:a,renderOption:o}){if(!Xt(e)){let s=en(r,e.value),c=t&&(s?(0,R.jsx)(pe,{className:yt.optionsDropdownCheckIcon}):n?(0,R.jsx)(`div`,{className:yt.optionsDropdownCheckPlaceholder}):null),l=(0,R.jsxs)(R.Fragment,{children:[i===`left`&&c,(0,R.jsx)(`span`,{children:e.label}),i===`right`&&c]});return(0,R.jsx)(Yt.Option,{value:e.value,disabled:e.disabled,className:p({[yt.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,R.jsx)(tn,{data:e,value:r,unstyled:a,withCheckIcon:t,withAlignedLabels:n,checkIconPosition:i,renderOption:o},`${e.value}`));return(0,R.jsx)(Yt.Group,{label:e.group,children:s})}function nn({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=wt();$t(e);let x=typeof i==`string`?(r||Zt)({options:e,search:l?i:``,limit:a??1/0}):e,S=Qt(x),C=x.map((e,t)=>(0,R.jsx)(tn,{data:e,withCheckIcon:u,withAlignedLabels:d,value:f,checkIconPosition:p,unstyled:h,renderOption:_},Xt(e)?`group-${typeof e.group==`string`?e.group:t}`:`${e.value}`));return(0,R.jsx)(Yt.Dropdown,{hidden:t||n&&S,"data-composed":!0,children:(0,R.jsxs)(Yt.Options,{labelledBy:g,"aria-label":y,children:[c?(0,R.jsx)(ze.Autosize,{mah:(s??b.floatingHeight)===`viewport`?`var(--combobox-floating-options-max-height)`:o??220,type:`scroll`,scrollbarSize:`var(--combobox-padding)`,offsetScrollbars:`y`,...v,children:C}):C,S&&m&&(0,R.jsx)(Yt.Empty,{children:m})]})})}function rn(e){let t=e.currentTarget;return dt(t).activeElement!==t}function an(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[on,sn]=Ve(`Progress.Root component was not found in tree`),cn={root:`m_db6d6462`,section:`m_2242eb65`,"stripes-animation":`m_81a374bd`,"stripes-animation-vertical":`m_e0fb7a86`,label:`m_91e40b74`},ln=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=O(`ProgressLabel`,null,e);return(0,R.jsx)(se,{...sn().getStyles(`label`,{className:n,style:r,classNames:t,styles:i}),...o})});ln.classes=cn,ln.displayName=`@mantine/core/ProgressLabel`;var un=f((e,{size:t,radius:n,transitionDuration:r})=>({root:{"--progress-size":ie(t,`progress-size`),"--progress-radius":n===void 0?void 0:_(n),"--progress-transition-duration":typeof r==`number`?`${r}ms`:void 0}})),dn=n(e=>{let t=O(`ProgressRoot`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,autoContrast:c,transitionDuration:l,orientation:u,attributes:d,mod:f,...p}=t,m=k({name:`Progress`,classes:cn,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:d,vars:s,varsResolver:un});return(0,R.jsx)(on,{value:{getStyles:m,autoContrast:c},children:(0,R.jsx)(se,{mod:[{orientation:u},f],...m(`root`),...p})})});dn.classes=cn,dn.varsResolver=un,dn.displayName=`@mantine/core/ProgressRoot`;var fn={withAria:!0},pn=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:s,value:c,withAria:l,color:u,striped:d,animated:f,mod:p,...m}=O(`ProgressSection`,fn,e),h=sn(),g=o(),_=l?{role:`progressbar`,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":c,"aria-valuetext":`${c}%`}:{};return(0,R.jsx)(se,{...h.getStyles(`section`,{className:n,classNames:t,styles:i,style:r}),...m,..._,mod:[{striped:d||f,animated:f},p],__vars:{"--progress-section-size":`${c}%`,"--progress-section-color":a(u,g),"--progress-label-color":ft(h.autoContrast,g)?he({color:u,theme:g,autoContrast:h.autoContrast}):void 0}})});pn.classes=cn,pn.displayName=`@mantine/core/ProgressSection`;var mn=n(e=>{let n=O(`Progress`,null,e),{value:r,classNames:i,styles:a,vars:o,color:s,striped:c,animated:l,"aria-label":u,...d}=n,{resolvedClassNames:f,resolvedStyles:p}=t({classNames:i,styles:a,props:n});return(0,R.jsx)(dn,{classNames:f,styles:p,vars:o,...d,children:(0,R.jsx)(pn,{value:r,color:s,striped:c,animated:l,"aria-label":u})})});mn.classes=cn,mn.displayName=`@mantine/core/Progress`,mn.Section=pn,mn.Root=dn,mn.Label=ln;var hn={size:`sm`,withCheckIcon:!0,allowDeselect:!0,checkIconPosition:`left`,openOnFocus:!0},gn=oe(e=>{let n=O([`Input`,`InputWrapper`,`Select`],hn,e),{classNames:r,styles:i,unstyled:a,vars:o,dropdownOpened:s,defaultDropdownOpened:c,onDropdownClose:l,onDropdownOpen:u,onFocus:d,onBlur:f,onClick:p,onChange:m,data:h,value:g,defaultValue:_,selectFirstOptionOnChange:v,selectFirstOptionOnDropdownOpen:y,onOptionSubmit:b,comboboxProps:S,readOnly:C,disabled:w,filter:T,limit:E,withScrollArea:D,maxDropdownHeight:k,floatingHeight:A,size:j,searchable:M,rightSection:N,checkIconPosition:P,withCheckIcon:te,withAlignedLabels:ne,nothingFoundMessage:re,name:ie,form:ae,searchValue:oe,defaultSearchValue:se,onSearchChange:ce,allowDeselect:le,error:F,rightSectionPointerEvents:I,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}=n,Oe=(0,L.useMemo)(()=>_t(h),[h]),ke=(0,L.useRef)({}),Ae=(0,L.useMemo)(()=>vt(Oe),[Oe]),je=x(de),[Me,Ne,Pe]=ue({value:g,defaultValue:_,finalValue:null,onChange:m}),Fe=Me==null?void 0:`${Me}`in Ae?Ae[`${Me}`]:ke.current[`${Me}`],Ie=ct(Fe),[Le,Re,ze]=ue({value:oe,defaultValue:se,finalValue:Fe?Fe.label:``,onChange:ce}),Be=Kt({opened:s,defaultOpened:c,onDropdownOpen:()=>{u?.(),y?Be.selectFirstOption():Be.updateSelectedOptionIndex(`active`,{scrollIntoView:!0})},onDropdownClose:()=>{l?.(),setTimeout(Be.resetSelectedOption,0)}}),Ve=e=>{Re(e),Be.resetSelectedOption()},{resolvedClassNames:He,resolvedStyles:Ue}=t({props:n,styles:i,classNames:r});(0,L.useEffect)(()=>{v&&Be.selectFirstOption()},[v,Le]),(0,L.useEffect)(()=>{g===null&&Ve(``),g!=null&&Fe&&(Ie?.value!==Fe.value||Ie?.label!==Fe.label)&&Ve(Fe.label)},[g,Fe]),(0,L.useEffect)(()=>{!Pe&&!ze&&Ve(Me==null?``:`${Me}`in Ae?Ae[`${Me}`]?.label:ke.current[`${Me}`]?.label||``)},[Ae,Me]),(0,L.useEffect)(()=>{Me&&`${Me}`in Ae&&(ke.current[`${Me}`]=Ae[`${Me}`])},[Ae,Me]);let We=(0,R.jsx)(Yt.ClearButton,{...me,onClear:()=>{Ne(null,null),Ve(``),_e?.()}}),Ge=fe&&Me!=null&&!w&&!C;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(Yt,{store:Be,__staticSelector:`Select`,classNames:He,styles:Ue,unstyled:a,readOnly:C,size:j,attributes:Ee,floatingHeight:A,keepMounted:we,onOptionSubmit:e=>{b?.(e);let t=le&&`${Ae[e].value}`==`${Me}`?null:Ae[e],n=t?t.value:null;n!==Me&&Ne(n,t),!Pe&&Ve(n==null?``:t?.label||``),Be.closeDropdown()},...S,children:[(0,R.jsx)(Yt.Target,{targetType:M?`input`:`button`,autoComplete:ve,withExpandedAttribute:!0,children:(0,R.jsx)(ee,{id:je,__defaultRightSection:(0,R.jsx)(Yt.Chevron,{size:j,error:F,unstyled:a,color:Ce}),__clearSection:We,__clearable:Ge,__clearSectionMode:pe,rightSection:N,rightSectionPointerEvents:I||`none`,...De,size:j,__staticSelector:`Select`,disabled:w,readOnly:C||!M,value:Le,onChange:e=>{if(rn(e)){if(!C){let t=an(Ae,e.currentTarget.value);t&&`${t.value}`!=`${Me}`&&(Ne(t.value,t),!Pe&&Ve(t.label))}return}Ve(e.currentTarget.value),Be.openDropdown(),v&&Be.selectFirstOption()},onFocus:e=>{Te&&M&&Be.openDropdown(),d?.(e)},onBlur:e=>{we&&Be.clickSelectedOption(),M&&Be.closeDropdown();let t=Me!=null&&(`${Me}`in Ae?Ae[`${Me}`]:ke.current[`${Me}`]);Ve(t&&t.label||``),f?.(e)},onClick:e=>{M?Be.openDropdown():Be.toggleDropdown(),p?.(e)},classNames:He,styles:Ue,unstyled:a,pointer:!M,error:F,attributes:Ee})}),(0,R.jsx)(nn,{data:Oe,hidden:C||w,filter:T,search:Le,limit:E,hiddenWhenEmpty:!re,withScrollArea:D,maxDropdownHeight:k,filterOptions:!!M&&Fe?.label!==Le,value:Me,checkIconPosition:P,withCheckIcon:te,withAlignedLabels:ne,nothingFoundMessage:re,unstyled:a,labelId:De.label?`${je}-label`:void 0,"aria-label":De.label?void 0:De[`aria-label`],renderOption:ge,scrollAreaProps:ye})]}),(0,R.jsx)(Yt.HiddenInput,{value:Me,name:ie,form:ae,disabled:w,...he})]})});gn.classes={...ee.classes,...Yt.classes},gn.displayName=`@mantine/core/Select`;function _n(e){if(e!==void 0)return typeof e==`number`?b(e):e}function vn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let c=o(),l=t===void 0?e:t,u=r!==void 0,d=j({"--sg-spacing-x":v(st(e)),"--sg-spacing-y":v(st(l)),"--sg-auto-rows":i,...u?{"--sg-min-col-width":_n(r)}:{"--sg-cols":st(n)?.toString()}}),f=te(c.breakpoints).reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=v(e[r])),typeof l==`object`&&l[r]!==void 0&&(t[r][`--sg-spacing-y`]=v(l[r])),!u&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{});return(0,R.jsx)(s,{styles:d,media:Te(te(f),c.breakpoints).filter(e=>te(f[e.value]).length>0).map(e=>({query:`(min-width: ${c.breakpoints[e.value]})`,styles:f[e.value]})),selector:a})}function yn(e){return typeof e==`object`&&e?te(e):[]}function bn(e){return e.sort((e,t)=>me(e)-me(t))}function xn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}){return bn(Array.from(new Set([...yn(e),...yn(t),...r===void 0?yn(n):[]])))}function Sn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=t===void 0?e:t,c=r!==void 0,l=j({"--sg-spacing-x":v(st(e)),"--sg-spacing-y":v(st(o)),"--sg-auto-rows":i,...c?{"--sg-min-col-width":_n(r)}:{"--sg-cols":st(n)?.toString()}}),u=xn({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}),d=u.reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=v(e[r])),typeof o==`object`&&o[r]!==void 0&&(t[r][`--sg-spacing-y`]=v(o[r])),!c&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{});return(0,R.jsx)(s,{styles:l,container:u.map(e=>({query:`simple-grid (min-width: ${e})`,styles:d[e]})),selector:a})}var Cn={container:`m_925c2d2c`,root:`m_2415a157`},wn={cols:1,spacing:`md`,type:`media`},Tn=n(e=>{let t=O(`SimpleGrid`,wn,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,cols:c,verticalSpacing:l,spacing:u,type:f,minColWidth:p,autoFlow:m,autoRows:h,attributes:g,..._}=t,v=k({name:`SimpleGrid`,classes:Cn,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:g,vars:s}),y=d(),b=p===void 0?void 0:m||`auto-fill`;return f===`container`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Sn,{...t,selector:`.${y}`}),(0,R.jsx)(`div`,{...v(`container`),children:(0,R.jsx)(se,{...v(`root`,{className:y}),..._,"data-auto-cols":b})})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(vn,{...t,selector:`.${y}`}),(0,R.jsx)(se,{...v(`root`,{className:y}),..._,"data-auto-cols":b})]})});Tn.classes=Cn,Tn.displayName=`@mantine/core/SimpleGrid`;var En=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M204,64V168a12,12,0,0,1-24,0V93L72.49,200.49a12,12,0,0,1-17-17L163,76H88a12,12,0,0,1,0-24H192A12,12,0,0,1,204,64Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M192,64V168L88,64Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M192,56H88a8,8,0,0,0-5.66,13.66L128.69,116,58.34,186.34a8,8,0,0,0,11.32,11.32L140,127.31l46.34,46.35A8,8,0,0,0,200,168V64A8,8,0,0,0,192,56Zm-8,92.69-38.34-38.34h0L107.31,72H184Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-13.66,5.66L140,127.31,69.66,197.66a8,8,0,0,1-11.32-11.32L128.69,116,82.34,69.66A8,8,0,0,1,88,56H192A8,8,0,0,1,200,64Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M198,64V168a6,6,0,0,1-12,0V78.48L68.24,196.24a6,6,0,0,1-8.48-8.48L177.52,70H88a6,6,0,0,1,0-12H192A6,6,0,0,1,198,64Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-16,0V83.31L69.66,197.66a8,8,0,0,1-11.32-11.32L172.69,72H88a8,8,0,0,1,0-16H192A8,8,0,0,1,200,64Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M196,64V168a4,4,0,0,1-8,0V73.66L66.83,194.83a4,4,0,0,1-5.66-5.66L182.34,68H88a4,4,0,0,1,0-8H192A4,4,0,0,1,196,64Z`}))]]),Dn=new Map([[`bold`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`}))]]),On=new Map([[`bold`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M216,144a32,32,0,1,1-32-32A32,32,0,0,1,216,144Z`,opacity:`0.2`}),L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`,L.createElement(L.Fragment,null,L.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`}))]]),kn=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M40,92H70.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24H137.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24Zm64-24A12,12,0,1,1,92,80,12,12,0,0,1,104,68Zm112,96H201.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24h94.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24Zm-48,24a12,12,0,1,1,12-12A12,12,0,0,1,168,188Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M128,80a24,24,0,1,1-24-24A24,24,0,0,1,128,80Zm40,72a24,24,0,1,0,24,24A24,24,0,0,0,168,152Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M32,80a8,8,0,0,1,8-8H77.17a28,28,0,0,1,53.66,0H216a8,8,0,0,1,0,16H130.83a28,28,0,0,1-53.66,0H40A8,8,0,0,1,32,80Zm184,88H194.83a28,28,0,0,0-53.66,0H40a8,8,0,0,0,0,16H141.17a28,28,0,0,0,53.66,0H216a8,8,0,0,0,0-16Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M40,86H74.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12H133.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12Zm64-24A18,18,0,1,1,86,80,18,18,0,0,1,104,62ZM216,170H197.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12h98.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12Zm-48,24a18,18,0,1,1,18-18A18,18,0,0,1,168,194Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M40,84H76.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8H131.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8Zm64-24A20,20,0,1,1,84,80,20,20,0,0,1,104,60ZM216,172H195.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8H140.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8Zm-48,24a20,20,0,1,1,20-20A20,20,0,0,1,168,196Z`}))]]),An=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:En}));An.displayName=`ArrowUpRightIcon`;var jn=An,Mn=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:Dn}));Mn.displayName=`CaretDownIcon`;var Nn=Mn,Pn=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:On}));Pn.displayName=`ListMagnifyingGlassIcon`;var Fn=Pn,In=L.forwardRef((e,t)=>L.createElement(g,{ref:t,...e,weights:kn}));In.displayName=`SlidersHorizontalIcon`;var Ln=In;function Rn(e){let{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function zn(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function Bn(e,t,n,r,i,a,o){let{margin:s,containerPadding:c,rowHeight:l}=e,u=Rn(e),d,f,p,m;if(o?(d=Math.round(o.width),f=Math.round(o.height)):(d=zn(r,u,s[0]),f=zn(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 Vn(e,t,n,r,i){let{margin:a,containerPadding:o,cols:s,rowHeight:c,maxRows:l}=e,u=Rn(e),d=Math.round((n-o[0])/(u+a[0])),f=Math.round((t-o[1])/(c+a[1]));return d=Wn(d,0,s-r),f=Wn(f,0,l-i),{x:d,y:f}}function Hn(e,t,n){let{margin:r,containerPadding:i,rowHeight:a}=e,o=Rn(e);return{x:Math.round((n-i[0])/(o+r[0])),y:Math.round((t-i[1])/(a+r[1]))}}function Un(e,t,n){let{margin:r,rowHeight:i}=e,a=Rn(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 Wn(e,t,n){return Math.max(Math.min(e,n),t)}function Gn(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 Kn(e,t){for(let n=0;nGn(e,t))}function Jn(e,t){return t===`horizontal`?Xn(e):t===`vertical`||t===`wrap`?Yn(e):[...e]}function Yn(e){return[...e].sort((e,t)=>e.y===t.y?e.x-t.x:e.y-t.y)}function Xn(e){return[...e].sort((e,t)=>e.x===t.x?e.y-t.y:e.x-t.x)}function Zn(e){let t=0;for(let n=0;nt&&(t=e)}}return t}function Qn(e,t){for(let n=0;ne.static===!0)}function er(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 tr(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.static)n.push(i);else for(;Kn(n,i);)i.y++}}return e}function ar(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=Jn(e,o);(o===`vertical`&&typeof r==`number`?u>=r:o===`horizontal`&&typeof n==`number`&&l>=n)&&(d=d.reverse());let f=qn(d,t),p=f.length>0;if(p&&c)return tr(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 ar(e,n,o?a.x:void 0,s?a.y:void 0,r,c,i);if(u&&s)return ar(e,n,void 0,n.y+1,r,c,i);if(u&&i===null)return t.y=n.y,n.y+=n.h,[...e];if(d&&o)return ar(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]:ar(e,n,l,u,r,c,i)}function sr(e,t,n){return Math.max(t,Math.min(n,e))}var cr=[{name:`gridBounds`,constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:sr(t,0,Math.max(0,r-e.w)),y:sr(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:sr(t,1,Math.max(1,o)),h:sr(n,1,Math.max(1,s))}}},{name:`minMaxSize`,constrainSize(e,t,n){return{w:sr(t,e.minW??1,e.maxW??1/0),h:sr(n,e.minH??1,e.maxH??1/0)}}}];function lr(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 ur(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 dr({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 fr({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:`absolute`}}function pr(e){return e*100+`%`}function mr(e,t,n,r){return e+n>r?t:n}function hr(e,t,n){return e<0?t:n}function gr(e){return Math.max(0,e)}function _r(e){return Math.max(0,e)}var vr=(e,t,n)=>{let{left:r,height:i,width:a}=t,o=e.top-(i-e.height);return{left:r,width:a,height:hr(o,e.height,i),top:_r(o)}},yr=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{top:r,height:a,width:mr(e.left,e.width,o,n),left:gr(i)}},br=(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:_r(r),left:0}:{height:i,width:a,top:_r(r),left:o}},xr=(e,t,n)=>{let{top:r,left:i,height:a,width:o}=t;return{width:o,left:i,height:hr(r,e.height,a),top:_r(r)}},Sr={n:vr,ne:(e,t,n)=>vr(e,yr(e,t,n)),e:yr,se:(e,t,n)=>xr(e,yr(e,t,n)),s:xr,sw:(e,t,n)=>xr(e,br(e,t)),w:br,nw:(e,t,n)=>vr(e,br(e,t))};function Cr(e,t,n,r){let i=Sr[e];return i?i(t,{...t,...n},r):n}var wr={type:`transform`,scale:1,calcStyle(e){return dr(e)}},Tr={type:`absolute`,scale:1,calcStyle(e){return fr(e)}};function Er(e){return{type:`transform`,scale:e,calcStyle(e){return dr(e)},calcDragPosition(t,n,r,i){return{left:(t-r)/e,top:(n-i)/e}}}}var Dr=wr,Or={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},kr={enabled:!0,bounded:!1,threshold:3},Ar={enabled:!0,handles:[`se`]},jr={enabled:!1,defaultItem:{w:1,h:1}};function Mr(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??$n(e).length>0;for(let i=o+1;it.y+t.h)break;Gn(t,o)&&Mr(e,o,n+t[a],r,s)}}t[r]=n}function Nr(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&&!Kn(e,t);)t.y--;let i;for(;(i=Kn(e,t))!==void 0;)Mr(n,t,i.y+i.h,`y`);return t.y=Math.max(t.y,0),t}function Pr(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!Kn(e,t);)t.x--;let i;for(;(i=Kn(e,t))!==void 0;)if(Mr(r,t,i.x+i.w,`x`),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!Kn(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var Fr={type:`vertical`,allowOverlap:!1,compact(e,t){let n=$n(e),r=Zn(n),i=Yn(e),a=Array(e.length);for(let t=0;te[t]-e[n])}function Ur(e,t){let n=Hr(e),r=n[0];if(r===void 0)throw Error(`No breakpoints defined`);for(let i=1;ie[a]&&(r=a)}return r}function Wr(e,t){let n=t[e];if(n===void 0)throw Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function Gr(e,t,n,r,i,a){let o=e[n];if(o)return tr(o);let s=e[r],c=Hr(t),l=c.slice(c.indexOf(n));for(let t=0;t{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Jr=h(((e,t)=>{var n=qr();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}})),Yr=h(((e,t)=>{t.exports=Jr()()})),Xr=u(Yr(),1),Zr=u(T(),1);function Qr(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&&Qr(e.changedTouches,e=>t===e.identifier)}function Si(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function Ci(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function wi(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??Ci();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&&Di(e.body,`react-draggable-transparent-selection`)}function Ti(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{Ei(e)}):Ei(e)}function Ei(e){if(e)try{e.body&&Oi(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 Di(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function Oi(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function ki(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:Ii(r);let i=Li(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+ti(s.paddingLeft)+ti(o.marginLeft),top:-i.offsetTop+ti(s.paddingTop)+ti(o.marginTop),right:gi(a)-mi(i)-i.offsetLeft+ti(s.paddingRight)-ti(o.marginRight),bottom:hi(a)-pi(i)-i.offsetTop+ti(s.paddingBottom)-ti(o.marginBottom)}}return ei(r.right)&&(t=Math.min(t,r.right)),ei(r.bottom)&&(n=Math.min(n,r.bottom)),ei(r.left)&&(t=Math.max(t,r.left)),ei(r.top)&&(n=Math.max(n,r.top)),[t,n]}function Ai(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function ji(e){return e.props.axis===`both`||e.props.axis===`x`}function Mi(e){return e.props.axis===`both`||e.props.axis===`y`}function Ni(e,t,n){let r=typeof t==`number`?xi(e,t):null;if(typeof t==`number`&&!r)return null;let i=Li(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return _i(r||e,a,n.props.scale)}function Pi(e,t,n){let r=!ei(e.lastX),i=Li(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 Fi(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 Ii(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Li(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var Ri=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},zi={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},Bi=zi.mouse,Vi=class extends L.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&&!ui(e.target,this.props.handle,t)||this.props.cancel&&ui(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=Si(e);this.touchIdentifier=r;let i=Ni(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=Pi(this,a,o);Ri(`DraggableCore: handleDragStart: %j`,s),Ri(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&wi(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,di(n,Bi.move,this.handleDrag),di(n,Bi.stop,this.handleDragStop))},this.handleDrag=e=>{let t=Ni(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]=Ai(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=Pi(this,n,r);if(Ri(`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=Ni(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]=Ai(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=Pi(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&Ti(a.ownerDocument),Ri(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(Ri(`DraggableCore: Removing handlers`),fi(a.ownerDocument,Bi.move,this.handleDrag),fi(a.ownerDocument,Bi.stop,this.handleDragStop))},this.onMouseDown=e=>(Bi=zi.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(Bi=zi.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(Bi=zi.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(Bi=zi.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&di(e,zi.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;fi(t,zi.mouse.move,this.handleDrag),fi(t,zi.touch.move,this.handleDrag),fi(t,zi.mouse.stop,this.handleDragStop),fi(t,zi.touch.stop,this.handleDragStop),fi(e,zi.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&Ti(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=Zr.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(Ri(`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 L.cloneElement(L.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Vi.displayName=`DraggableCore`,Vi.propTypes={allowAnyClick:Xr.default.bool,allowMobileScroll:Xr.default.bool,children:Xr.default.node.isRequired,disabled:Xr.default.bool,enableUserSelectHack:Xr.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:Xr.default.arrayOf(Xr.default.number),handle:Xr.default.string,cancel:Xr.default.string,nodeRef:Xr.default.object,nonce:Xr.default.string,onStart:Xr.default.func,onDrag:Xr.default.func,onStop:Xr.default.func,onMouseDown:Xr.default.func,scale:Xr.default.number,className:ni,style:ni,transform:ni},Vi.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var Hi=class extends L.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(Ri(`Draggable: onDragStart: %j`,t),this.props.onStart(e,Fi(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;Ri(`Draggable: onDrag: %j`,t);let n=Fi(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]=ki(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,Fi(this,t))===!1)return!1;Ri(`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)?(Ri(`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=Zr.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,m=!s||this.state.dragging,h=s||r,g={x:ji(this)&&m?this.state.x:h.x,y:Mi(this)&&m?this.state.y:h.y};this.state.isElementSVG?f=yi(g,c):d=vi(g,c);let _=L.Children.only(n),v=p(_.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return L.createElement(Vi,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},L.cloneElement(_,{className:v,style:{..._.props.style,...d},transform:f}))}};Hi.displayName=`Draggable`,Hi.propTypes={...Vi.propTypes,axis:Xr.default.oneOf([`both`,`x`,`y`,`none`]),bounds:Xr.default.oneOfType([Xr.default.shape({left:Xr.default.number,right:Xr.default.number,top:Xr.default.number,bottom:Xr.default.number}),Xr.default.string,Xr.default.oneOf([!1])]),defaultClassName:Xr.default.string,defaultClassNameDragging:Xr.default.string,defaultClassNameDragged:Xr.default.string,defaultPosition:Xr.default.shape({x:Xr.default.number,y:Xr.default.number}),positionOffset:Xr.default.shape({x:Xr.default.oneOfType([Xr.default.number,Xr.default.string]),y:Xr.default.oneOfType([Xr.default.number,Xr.default.string])}),position:Xr.default.shape({x:Xr.default.number,y:Xr.default.number}),className:ni,style:ni,transform:ni},Hi.defaultProps={...Vi.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1};var Ui=h(((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 n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),d=e=>l(r({},`__esModule`,{value:!0}),e),f={};c(f,{DraggableCore:()=>Oe,default:()=>ke}),t.exports=d(f);var p=u(C()),m=u(Yr()),h=u(T()),g=Ui();function _(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&&_(e.changedTouches,e=>t===e.identifier)}function ce(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function le(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function ue(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??le();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;} `,n.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;} diff --git a/internal/ui/dist/assets/dashboards._dashboardId-CMjPkGKO.js b/internal/ui/dist/assets/dashboards._dashboardId-rFBmUOpC.js similarity index 81% rename from internal/ui/dist/assets/dashboards._dashboardId-CMjPkGKO.js rename to internal/ui/dist/assets/dashboards._dashboardId-rFBmUOpC.js index efdb8d83a..ec4576f97 100644 --- a/internal/ui/dist/assets/dashboards._dashboardId-CMjPkGKO.js +++ b/internal/ui/dist/assets/dashboards._dashboardId-rFBmUOpC.js @@ -1 +1 @@ -import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-BeUORN-q.js";import{t as n}from"./dashboard-BfR0ACHf.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{t as i}from"./index-C8q_YUYV.js";var a=e();function o(){let{dashboardId:e}=i.useParams(),o=i.useSearch(),s=t(),{agentAvailable:c,openChat:l}=r();return(0,a.jsx)(n,{dashboardID:e,agentAvailable:c,onOpenChat:l,onDashboardChange:(e,t)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:o,replace:t}),urlFilters:o,onFiltersChange:t=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{window:t.window,namespace:t.namespace||void 0},replace:!0})})}export{o as component}; \ No newline at end of file +import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-B1VNekWU.js";import{t as n}from"./dashboard-yZ7oG_PO.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{t as i}from"./index-BHeU96Kj.js";var a=e();function o(){let{dashboardId:e}=i.useParams(),o=i.useSearch(),s=t(),{agentAvailable:c,openChat:l}=r();return(0,a.jsx)(n,{dashboardID:e,agentAvailable:c,onOpenChat:l,onDashboardChange:(e,t)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:o,replace:t}),urlFilters:o,onFiltersChange:t=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{window:t.window,namespace:t.namespace||void 0},replace:!0})})}export{o as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboards.index-Bm8hpWIl.js b/internal/ui/dist/assets/dashboards.index-D2SA6vFv.js similarity index 73% rename from internal/ui/dist/assets/dashboards.index-Bm8hpWIl.js rename to internal/ui/dist/assets/dashboards.index-D2SA6vFv.js index f91cd1015..0e3f3315b 100644 --- a/internal/ui/dist/assets/dashboards.index-Bm8hpWIl.js +++ b/internal/ui/dist/assets/dashboards.index-D2SA6vFv.js @@ -1 +1 @@ -import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-BeUORN-q.js";import{t as n}from"./dashboard-BfR0ACHf.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{n as i}from"./index-C8q_YUYV.js";var a=e();function o(){let e=i.useSearch(),o=t(),{agentAvailable:s,openChat:c}=r();return(0,a.jsx)(n,{agentAvailable:s,onOpenChat:c,onDashboardChange:t=>void o({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:e,replace:!0}),urlFilters:e})}export{o as component}; \ No newline at end of file +import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-B1VNekWU.js";import{t as n}from"./dashboard-yZ7oG_PO.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{n as i}from"./index-BHeU96Kj.js";var a=e();function o(){let e=i.useSearch(),o=t(),{agentAvailable:s,openChat:c}=r();return(0,a.jsx)(n,{agentAvailable:s,onOpenChat:c,onDashboardChange:t=>void o({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:e,replace:!0}),urlFilters:e})}export{o as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/index-C8q_YUYV.js b/internal/ui/dist/assets/index-BHeU96Kj.js similarity index 99% rename from internal/ui/dist/assets/index-C8q_YUYV.js rename to internal/ui/dist/assets/index-BHeU96Kj.js index 96e0d2ce9..ff72ad7b1 100644 --- a/internal/ui/dist/assets/index-C8q_YUYV.js +++ b/internal/ui/dist/assets/index-BHeU96Kj.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-D1xQhcK4.js","assets/brand-MzZ03bSa.js","assets/auth-BeUORN-q.js","assets/settings-D20O7uBo.js","assets/Tooltip-BJiO7C_G.js","assets/api-Be5Lq4YA.js","assets/WarningCircle.es-DDq2AFnK.js","assets/chat.index-B6mb73V8.js","assets/chat-B-nb-Yp3.js","assets/preload-helper-BL3qEkUh.js","assets/format-urrStEsn.js","assets/chat._threadId-B6mb73V8.js","assets/dashboards.index-Bm8hpWIl.js","assets/dashboard-BfR0ACHf.js","assets/tokens-DNprTSRA.js","assets/use-computed-color-scheme-6JIsge00.js","assets/dashboards._dashboardId-CMjPkGKO.js"])))=>i.map(i=>d[i]); -import{B as e,C as t,F as n,G as r,H as i,I as a,J as o,K as s,L as c,M as l,N as u,O as d,P as f,S as p,St as m,V as h,W as g,X as _,Y as v,_ as y,_t as b,a as x,at as ee,b as te,ct as ne,d as re,dt as S,et as ie,f as ae,ft as oe,gt as se,h as ce,ht as le,j as ue,k as de,l as C,mt as fe,nt as pe,pt as me,rt as he,s as ge,st as _e,t as ve,u as ye,ut as be,x as xe,yt as Se}from"./brand-MzZ03bSa.js";import{a as Ce,d as we,f as Te,g as Ee,i as De,l as Oe,n as ke,o as Ae,r as je,t as Me,u as Ne}from"./auth-BeUORN-q.js";import{$ as Pe,A as Fe,B as Ie,C as Le,F as Re,G as ze,H as Be,I as Ve,J as He,K as Ue,L as We,M as Ge,N as Ke,P as qe,Q as Je,R as Ye,S as Xe,T as Ze,U as Qe,V as $e,W as et,X as tt,Y as nt,Z as rt,_ as it,a as at,at as ot,b as st,ct,d as lt,dt as ut,et as dt,ft,g as pt,i as mt,it as ht,j as gt,k as _t,l as vt,lt as yt,m as bt,n as xt,nt as St,o as Ct,ot as wt,pt as Tt,q as Et,r as Dt,rt as Ot,s as kt,st as At,t as jt,tt as Mt,u as Nt,ut as Pt,w as Ft,x as It,y as Lt,z as Rt}from"./tokens-DNprTSRA.js";import{C as zt,b as Bt,o as Vt,t as Ht,w as Ut}from"./Tooltip-BJiO7C_G.js";import{n as Wt,t as Gt}from"./use-computed-color-scheme-6JIsge00.js";import{A as Kt,C as qt,D as Jt,E as Yt,F as Xt,H as Zt,I as Qt,L as $t,M as en,N as tn,O as nn,P as rn,R as an,S as on,_ as sn,a as cn,b as ln,c as un,d as dn,f as fn,g as pn,h as mn,i as hn,j as gn,k as _n,l as vn,m as yn,n as bn,o as xn,p as Sn,r as Cn,t as wn,u as Tn,v as En,x as Dn,y as On}from"./api-Be5Lq4YA.js";import{a as kn,i as An,n as jn,o as Mn,r as Nn,t as Pn}from"./preload-helper-BL3qEkUh.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 Fn=b((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,ae());else{var t=n(l);t!==null&&ce(x,t.startTime-e)}}}var ee=!1,te=-1,ne=5,re=-1;function S(){return g?!0:!(e.unstable_now()-ret&&S());){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&&ce(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ae():ee=!1}}}var ae;if(typeof y==`function`)ae=function(){y(ie)};else if(typeof MessageChannel<`u`){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=ie,ae=function(){se.postMessage(null)}}else ae=function(){_(ie,0)};function ce(t,n){te=_(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(te),te=-1):h=!0,ce(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,ae()))),r},e.unstable_shouldYield=S,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),In=b(((e,t)=>{t.exports=Fn()})),Ln=b((e=>{var t=In(),n=se(),r=le();function i(e){var t=`https://react.dev/errors/`+e;if(1he||(e.current=me[he],me[he]=null,he--)}function ve(e,t){he++,me[he]=e.current,e.current=t}var ye=ge(null),be=ge(null),xe=ge(null),Se=ge(null);function Ce(e,t){switch(ve(xe,t),ve(be,e),ve(ye,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?$d(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=$d(t),e=ef(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}_e(ye),ve(ye,e)}function we(){_e(ye),_e(be),_e(xe)}function Te(e){e.memoizedState!==null&&ve(Se,e);var t=ye.current,n=ef(t,e.type);t!==n&&(ve(be,e),ve(ye,n))}function Ee(e){be.current===e&&(_e(ye),_e(be)),Se.current===e&&(_e(Se),sp._currentValue=pe)}var De,Oe;function ke(e){if(De===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);De=t&&t[1]||``,Oe=-1i.map(i=>d[i]); +import{B as e,C as t,F as n,G as r,H as i,I as a,J as o,K as s,L as c,M as l,N as u,O as d,P as f,S as p,St as m,V as h,W as g,X as _,Y as v,_ as y,_t as b,a as x,at as ee,b as te,ct as ne,d as re,dt as S,et as ie,f as ae,ft as oe,gt as se,h as ce,ht as le,j as ue,k as de,l as C,mt as fe,nt as pe,pt as me,rt as he,s as ge,st as _e,t as ve,u as ye,ut as be,x as xe,yt as Se}from"./brand-MzZ03bSa.js";import{a as Ce,d as we,f as Te,g as Ee,i as De,l as Oe,n as ke,o as Ae,r as je,t as Me,u as Ne}from"./auth-B1VNekWU.js";import{$ as Pe,A as Fe,B as Ie,C as Le,F as Re,G as ze,H as Be,I as Ve,J as He,K as Ue,L as We,M as Ge,N as Ke,P as qe,Q as Je,R as Ye,S as Xe,T as Ze,U as Qe,V as $e,W as et,X as tt,Y as nt,Z as rt,_ as it,a as at,at as ot,b as st,ct,d as lt,dt as ut,et as dt,ft,g as pt,i as mt,it as ht,j as gt,k as _t,l as vt,lt as yt,m as bt,n as xt,nt as St,o as Ct,ot as wt,pt as Tt,q as Et,r as Dt,rt as Ot,s as kt,st as At,t as jt,tt as Mt,u as Nt,ut as Pt,w as Ft,x as It,y as Lt,z as Rt}from"./tokens-CPxx1QN7.js";import{C as zt,b as Bt,o as Vt,t as Ht,w as Ut}from"./Tooltip-BJiO7C_G.js";import{n as Wt,t as Gt}from"./use-computed-color-scheme-6JIsge00.js";import{A as Kt,C as qt,D as Jt,E as Yt,F as Xt,H as Zt,I as Qt,L as $t,M as en,N as tn,O as nn,P as rn,R as an,S as on,_ as sn,a as cn,b as ln,c as un,d as dn,f as fn,g as pn,h as mn,i as hn,j as gn,k as _n,l as vn,m as yn,n as bn,o as xn,p as Sn,r as Cn,t as wn,u as Tn,v as En,x as Dn,y as On}from"./api-CB7Xlqes.js";import{a as kn,i as An,n as jn,o as Mn,r as Nn,t as Pn}from"./preload-helper-BL3qEkUh.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 Fn=b((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,ae());else{var t=n(l);t!==null&&ce(x,t.startTime-e)}}}var ee=!1,te=-1,ne=5,re=-1;function S(){return g?!0:!(e.unstable_now()-ret&&S());){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&&ce(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ae():ee=!1}}}var ae;if(typeof y==`function`)ae=function(){y(ie)};else if(typeof MessageChannel<`u`){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=ie,ae=function(){se.postMessage(null)}}else ae=function(){_(ie,0)};function ce(t,n){te=_(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(te),te=-1):h=!0,ce(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,ae()))),r},e.unstable_shouldYield=S,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),In=b(((e,t)=>{t.exports=Fn()})),Ln=b((e=>{var t=In(),n=se(),r=le();function i(e){var t=`https://react.dev/errors/`+e;if(1he||(e.current=me[he],me[he]=null,he--)}function ve(e,t){he++,me[he]=e.current,e.current=t}var ye=ge(null),be=ge(null),xe=ge(null),Se=ge(null);function Ce(e,t){switch(ve(xe,t),ve(be,e),ve(ye,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?$d(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=$d(t),e=ef(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}_e(ye),ve(ye,e)}function we(){_e(ye),_e(be),_e(xe)}function Te(e){e.memoizedState!==null&&ve(Se,e);var t=ye.current,n=ef(t,e.type);t!==n&&(ve(be,e),ve(ye,n))}function Ee(e){be.current===e&&(_e(ye),_e(be)),Se.current===e&&(_e(Se),sp._currentValue=pe)}var De,Oe;function ke(e){if(De===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);De=t&&t[1]||``,Oe=-1)`:-1=0}function Mf(e){for(var t=[`topLevel`],n=0,r,i,a,o=function(e){return t.push(e)},s=function(e){return t[t.length-1]=e},c=function(e){r??(r=n,i=t.length,a=e)},l=function(e){e===a&&(r=void 0,i=void 0,a=void 0)},u=function(){return t.pop()},d=function(){return n--},f=function(e){if(`0`<=e&&e<=`9`){o(`number`);return}switch(e){case`"`:o(`string`);return;case`-`:o(`numberNeedsDigit`);return;case`t`:o(`true`);return;case`f`:o(`false`);return;case`n`:o(`null`);return;case`[`:o(`arrayNeedsValue`);return;case`{`:o(`objectNeedsKey`);return}},p=e.length;n`9`)&&(d(),u());break;case`numberNeedsDigit`:s(`number`);break;case`numberNeedsExponent`:s(m===`+`||m===`-`?`numberNeedsDigit`:`number`);break;case`true`:case`false`:case`null`:(m<`a`||m>`z`)&&(d(),u());break;case`arrayNeedsValue`:m===`]`?u():jf(m)||(l(`collectionItem`),s(`arrayNeedsComma`),f(m));break;case`arrayNeedsComma`:m===`]`?u():m===`,`&&(c(`collectionItem`),s(`arrayNeedsValue`));break;case`objectNeedsKey`:m===`}`?u():m===`"`&&(c(`collectionItem`),s(`objectNeedsColon`),o(`string`));break;case`objectNeedsColon`:m===`:`&&s(`objectNeedsValue`);break;case`objectNeedsValue`:jf(m)||(l(`collectionItem`),s(`objectNeedsComma`),f(m));break;case`objectNeedsComma`:m===`}`?u():m===`,`&&(c(`collectionItem`),s(`objectNeedsKey`))}}i!=null&&(t.length=i);for(var h=[r==null?e:e.slice(0,r)],g=function(t){return h.push(t.slice(e.length-e.lastIndexOf(t[0])))},_=t.length-1;_>=0;_--)switch(t[_]){case`string`:h.push(`"`);break;case`numberNeedsDigit`:case`numberNeedsExponent`:h.push(`0`);break;case`true`:g(`true`);break;case`false`:g(`false`);break;case`null`:g(`null`);break;case`arrayNeedsValue`:case`arrayNeedsComma`:h.push(`]`);break;case`objectNeedsKey`:case`objectNeedsColon`:case`objectNeedsValue`:case`objectNeedsComma`:h.push(`}`)}return h.join(``)}function Nf(){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)<=Pf&&(i+=r/Pf|0,r%=Pf)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?Bf(r,i):zf(r,i)}function If(e,t){let n=zf(e,t),r=n.hi&2147483648;r&&(n=Bf(n.lo,n.hi));let i=Lf(n.lo,n.hi);return r?`-`+i:i}function Lf(e,t){if({lo:e,hi:t}=Rf(e,t),t<=2097151)return String(Pf*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()+Vf(o)+Vf(a)}function Rf(e,t){return{lo:e>>>0,hi:t>>>0}}function zf(e,t){return{lo:e|0,hi:t|0}}function Bf(e,t){return t=~t,e?e=~e+1:t+=1,zf(e,t)}var Vf=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function Hf(){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 Uf=Wf();function Wf(){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)),Jf(i)}return qf}function Xf(e){return(t,n)=>{let r=e(t);return n.set(r),{written:r.byteLength}}}var Zf;(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`})(Zf||={});var U=class{constructor(e){this.stackPos=[],this.encodeUtf8Into=e?Xf(e):Yf().encodeUtf8Into,this.buffer=ep,this.viewCache=tp,this.pos=0}ensureCapacity(e){let t=this.pos+e;if(t>this.buffer.length){let e=this.buffer.length||Qf;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($f),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-$f,n=rp(t);return n>$f&&(this.ensureCapacity(n-$f),this.buffer.copyWithin(e+n,e+$f,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(ap(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(ip(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<=np){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=rp(t),r=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(e,r.subarray(i+n)),o=rp(a);return o!=n&&r.copyWithin(i+o,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(e){return op(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 ap(e),this.ensureCapacity(4),this.view().setUint32(this.pos,e,!0),this.pos+=4,this}sfixed32(e){return ip(e),this.ensureCapacity(4),this.view().setInt32(this.pos,e,!0),this.pos+=4,this}sint32(e){return ip(e),this.uint32((e<<1^e>>31)>>>0)}sfixed64(e){let t=Uf.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=Uf.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=Uf.enc(e);return this.writeVarint64(t.lo,t.hi)}sint64(e){let t=Uf.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=Uf.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}},Qf=128,$f=1,ep=new Uint8Array,tp=new DataView(ep.buffer),np=32;function rp(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var W=class{constructor(e,t=Yf().decodeUtf8){this.decodeUtf8=t,this.varint64Lo=0,this.varint64Hi=0,this.varint64=Nf,this.uint32=Hf,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 Zf.Varint:for(;this.buf[this.pos++]&128;);break;case Zf.Bit64:this.pos+=4;case Zf.Bit32:this.pos+=4;break;case Zf.LengthDelimited:let r=this.uint32();this.pos+=r;break;case Zf.StartGroup:if(n<=0)throw Error(`maximum recursion depth reached`);for(;;){let[e,r]=this.tag();if(r===Zf.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(),Uf.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Uf.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,Uf.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 Uf.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Uf.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<=np){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 ip(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 ap(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 op(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(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw Error(`invalid float32: `+e)}var sp=function(e){return e[e.NULL_VALUE=0]=`NULL_VALUE`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function cp(){return{fields:{}}}var lp={encode(e,t=new U){return Object.entries(e.fields).forEach(([e,n])=>{n!==void 0&&dp.encode({key:e,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=cp();for(;n.pos>>3){case 1:{if(e!==10)break;let t=dp.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 lp.fromPartial(e??{})},fromPartial(e){let t=cp();return t.fields=Object.entries(e.fields??{}).reduce((e,[t,n])=>(n!==void 0&&(e[t]=n),e),{}),t},wrap(e){let t=cp();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 up(){return{key:``,value:void 0}}var dp={encode(e,t=new U){return e.key!==``&&t.uint32(10).string(e.key),e.value!==void 0&&G.encode(G.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=up();for(;n.pos>>3){case 1:if(e!==10)break;i.key=n.string();continue;case 2:if(e!==18)break;i.value=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return dp.fromPartial(e??{})},fromPartial(e){let t=up();return t.key=e.key??``,t.value=e.value??void 0,t}};function fp(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var G={encode(e,t=new U){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&&lp.encode(lp.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&mp.encode(mp.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=fp();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=lp.unwrap(lp.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.listValue=mp.unwrap(mp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return G.fromPartial(e??{})},fromPartial(e){let t=fp();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=fp();if(e===null)t.nullValue=sp.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 pp(){return{values:[]}}var mp={encode(e,t=new U){for(let n of e.values)G.encode(G.wrap(n),t.uint32(10).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=pp();for(;n.pos>>3){case 1:if(e!==10)break;i.values.push(G.unwrap(G.decode(n,n.uint32())));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return mp.fromPartial(e??{})},fromPartial(e){let t=pp();return t.values=e.values?.map(e=>e)||[],t},wrap(e){let t=pp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty(`values`)&&globalThis.Array.isArray(e.values)?e.values:e}},hp=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 gp(){return{op:0,path:``,from:void 0,value:void 0}}var _p={encode(e,t=new U){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&&G.encode(G.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=gp();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=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return _p.fromPartial(e??{})},fromPartial(e){let t=gp();return t.op=e.op??0,t.path=e.path??``,t.from=e.from??void 0,t.value=e.value??void 0,t}};function vp(){return{id:``,type:``,function:void 0,metadata:void 0}}var yp={encode(e,t=new U){return e.id!==``&&t.uint32(10).string(e.id),e.type!==``&&t.uint32(18).string(e.type),e.function!==void 0&&xp.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&lp.encode(lp.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=vp();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=xp.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.metadata=lp.unwrap(lp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return yp.fromPartial(e??{})},fromPartial(e){let t=vp();return t.id=e.id??``,t.type=e.type??``,t.function=e.function!==void 0&&e.function!==null?xp.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function bp(){return{name:``,arguments:``}}var xp={encode(e,t=new U){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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=bp();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 xp.fromPartial(e??{})},fromPartial(e){let t=bp();return t.name=e.name??``,t.arguments=e.arguments??``,t}};function Sp(){return{value:``,mimeType:``}}var Cp={encode(e,t=new U){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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Sp();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 Cp.fromPartial(e??{})},fromPartial(e){let t=Sp();return t.value=e.value??``,t.mimeType=e.mimeType??``,t}};function wp(){return{value:``,mimeType:void 0}}var Tp={encode(e,t=new U){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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=wp();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 Tp.fromPartial(e??{})},fromPartial(e){let t=wp();return t.value=e.value??``,t.mimeType=e.mimeType??void 0,t}};function Ep(){return{data:void 0,url:void 0}}var Dp={encode(e,t=new U){return e.data!==void 0&&Cp.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Tp.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Ep();for(;n.pos>>3){case 1:if(e!==10)break;i.data=Cp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.url=Tp.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Dp.fromPartial(e??{})},fromPartial(e){let t=Ep();return t.data=e.data!==void 0&&e.data!==null?Cp.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Tp.fromPartial(e.url):void 0,t}};function Op(){return{text:``}}var kp={encode(e,t=new U){return e.text!==``&&t.uint32(10).string(e.text),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Op();for(;n.pos>>3){case 1:if(e!==10)break;i.text=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return kp.fromPartial(e??{})},fromPartial(e){let t=Op();return t.text=e.text??``,t}};function Ap(){return{source:void 0,metadata:void 0}}var jp={encode(e,t=new U){return e.source!==void 0&&Dp.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Ap();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Dp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return jp.fromPartial(e??{})},fromPartial(e){let t=Ap();return t.source=e.source!==void 0&&e.source!==null?Dp.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Mp(){return{source:void 0,metadata:void 0}}var Np={encode(e,t=new U){return e.source!==void 0&&Dp.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Mp();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Dp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Np.fromPartial(e??{})},fromPartial(e){let t=Mp();return t.source=e.source!==void 0&&e.source!==null?Dp.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Pp(){return{source:void 0,metadata:void 0}}var Fp={encode(e,t=new U){return e.source!==void 0&&Dp.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Pp();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Dp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Fp.fromPartial(e??{})},fromPartial(e){let t=Pp();return t.source=e.source!==void 0&&e.source!==null?Dp.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Ip(){return{source:void 0,metadata:void 0}}var Lp={encode(e,t=new U){return e.source!==void 0&&Dp.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Ip();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Dp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Lp.fromPartial(e??{})},fromPartial(e){let t=Ip();return t.source=e.source!==void 0&&e.source!==null?Dp.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Rp(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var zp={encode(e,t=new U){return e.text!==void 0&&kp.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&jp.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Np.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Fp.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Lp.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Rp();for(;n.pos>>3){case 1:if(e!==10)break;i.text=kp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.image=jp.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.audio=Np.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.video=Fp.decode(n,n.uint32());continue;case 5:if(e!==42)break;i.document=Lp.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return zp.fromPartial(e??{})},fromPartial(e){let t=Rp();return t.text=e.text!==void 0&&e.text!==null?kp.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?jp.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Np.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Fp.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Lp.fromPartial(e.document):void 0,t}};function Bp(){return{id:``,role:``,content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var Vp={encode(e,t=new U){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)yp.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)zp.encode(n,t.uint32(66).fork()).join();return e.metadata!==void 0&&lp.encode(lp.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Bp();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(yp.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(zp.decode(n,n.uint32()));continue;case 9:if(e!==74)break;i.metadata=lp.unwrap(lp.decode(n,n.uint32()));continue;case 10:if(e!==82)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Vp.fromPartial(e??{})},fromPartial(e){let t=Bp();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=>yp.fromPartial(e))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(e=>zp.fromPartial(e))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function Hp(){return{id:``,reason:``,message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var Up={encode(e,t=new U){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&&G.encode(G.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&G.encode(G.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Hp();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=G.unwrap(G.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.expiresAt=n.string();continue;case 7:if(e!==58)break;i.metadata=G.unwrap(G.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 Up.fromPartial(e??{})},fromPartial(e){let t=Hp();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}},Wp=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.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function Gp(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var K={encode(e,t=new U){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&G.encode(G.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&lp.encode(lp.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Gp();for(;n.pos>>3){case 1:if(e!==8)break;i.type=n.int32();continue;case 2:if(e!==16)break;i.timestamp=Rm(n.int64());continue;case 3:if(e!==26)break;i.rawEvent=G.unwrap(G.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.metadata=lp.unwrap(lp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return K.fromPartial(e??{})},fromPartial(e){let t=Gp();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 Kp(){return{baseEvent:void 0,messageId:``,role:void 0,name:void 0,subagentRunId:void 0}}var qp={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Kp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 qp.fromPartial(e??{})},fromPartial(e){let t=Kp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.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 Jp(){return{baseEvent:void 0,messageId:``,delta:``,subagentRunId:void 0}}var Yp={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Jp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 Yp.fromPartial(e??{})},fromPartial(e){let t=Jp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.delta=e.delta??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Xp(){return{baseEvent:void 0,messageId:``,subagentRunId:void 0}}var Zp={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Xp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 Zp.fromPartial(e??{})},fromPartial(e){let t=Xp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Qp(){return{baseEvent:void 0,toolCallId:``,toolCallName:``,parentMessageId:void 0,subagentRunId:void 0}}var $p={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Qp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 $p.fromPartial(e??{})},fromPartial(e){let t=Qp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.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 em(){return{baseEvent:void 0,toolCallId:``,delta:``,subagentRunId:void 0}}var tm={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=em();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 tm.fromPartial(e??{})},fromPartial(e){let t=em();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.delta=e.delta??``,t.subagentRunId=e.subagentRunId??void 0,t}};function nm(){return{baseEvent:void 0,toolCallId:``,subagentRunId:void 0}}var rm={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=nm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 rm.fromPartial(e??{})},fromPartial(e){let t=nm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.subagentRunId=e.subagentRunId??void 0,t}};function im(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var am={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&G.encode(G.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=im();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.snapshot=G.unwrap(G.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 am.fromPartial(e??{})},fromPartial(e){let t=im();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function om(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var sm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.delta)_p.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=om();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.delta.push(_p.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 sm.fromPartial(e??{})},fromPartial(e){let t=om();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(e=>_p.fromPartial(e))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function cm(){return{baseEvent:void 0,messages:[]}}var lm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.messages)Vp.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=cm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messages.push(Vp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return lm.fromPartial(e??{})},fromPartial(e){let t=cm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(e=>Vp.fromPartial(e))||[],t}};function um(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var dm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&G.encode(G.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=um();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.event=G.unwrap(G.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 dm.fromPartial(e??{})},fromPartial(e){let t=um();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.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 fm(){return{baseEvent:void 0,name:``,value:void 0,subagentRunId:void 0}}var pm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==``&&t.uint32(18).string(e.name),e.value!==void 0&&G.encode(G.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=fm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.name=n.string();continue;case 3:if(e!==26)break;i.value=G.unwrap(G.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 pm.fromPartial(e??{})},fromPartial(e){let t=fm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.name=e.name??``,t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function mm(){return{baseEvent:void 0,threadId:``,runId:``}}var hm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==``&&t.uint32(18).string(e.threadId),e.runId!==``&&t.uint32(26).string(e.runId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=mm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return hm.fromPartial(e??{})},fromPartial(e){let t=mm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??``,t.runId=e.runId??``,t}};function gm(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var _m={encode(e,t=new U){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),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=gm();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=Rm(n.int64());continue;case 4:if(e!==32)break;i.outputTokens=Rm(n.int64());continue;case 5:if(e!==40)break;i.totalTokens=Rm(n.int64());continue;case 6:if(e!==48)break;i.reasoningTokens=Rm(n.int64());continue;case 7:if(e!==56)break;i.cachedInputTokens=Rm(n.int64());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return _m.fromPartial(e??{})},fromPartial(e){let t=gm();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}};function vm(){return{baseEvent:void 0,threadId:``,runId:``,result:void 0,outcome:``,interrupts:[],usage:[]}}var ym={encode(e,t=new U){e.baseEvent!==void 0&&K.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&&G.encode(G.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==``&&t.uint32(42).string(e.outcome);for(let n of e.interrupts)Up.encode(n,t.uint32(50).fork()).join();for(let n of e.usage)_m.encode(n,t.uint32(58).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=vm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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=G.unwrap(G.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(Up.decode(n,n.uint32()));continue;case 7:if(e!==58)break;i.usage.push(_m.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return ym.fromPartial(e??{})},fromPartial(e){let t=vm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.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=>Up.fromPartial(e))||[],t.usage=e.usage?.map(e=>_m.fromPartial(e))||[],t}};function bm(){return{baseEvent:void 0,code:void 0,message:``,usage:[]}}var xm={encode(e,t=new U){e.baseEvent!==void 0&&K.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)_m.encode(n,t.uint32(34).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=bm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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(_m.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return xm.fromPartial(e??{})},fromPartial(e){let t=bm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??``,t.usage=e.usage?.map(e=>_m.fromPartial(e))||[],t}};function Sm(){return{baseEvent:void 0,stepName:``,subagentRunId:void 0}}var Cm={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Sm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 Cm.fromPartial(e??{})},fromPartial(e){let t=Sm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??``,t.subagentRunId=e.subagentRunId??void 0,t}};function wm(){return{baseEvent:void 0,stepName:``,subagentRunId:void 0}}var Tm={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=wm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 Tm.fromPartial(e??{})},fromPartial(e){let t=wm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Em(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var Dm={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Em();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 Dm.fromPartial(e??{})},fromPartial(e){let t=Em();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.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 Om(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var km={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Om();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 km.fromPartial(e??{})},fromPartial(e){let t=Om();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.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 Am(){return{baseEvent:void 0,subagentRunId:``,name:``,description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var jm={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Am();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 jm.fromPartial(e??{})},fromPartial(e){let t=Am();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.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 Mm(){return{baseEvent:void 0,subagentRunId:``,result:void 0,outcome:``,interruptIds:[]}}var Nm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&G.encode(G.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Mm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.result=G.unwrap(G.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 Nm.fromPartial(e??{})},fromPartial(e){let t=Mm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.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 Pm(){return{baseEvent:void 0,subagentRunId:``,message:``,code:void 0}}var Fm={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Pm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 Fm.fromPartial(e??{})},fromPartial(e){let t=Pm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.message=e.message??``,t.code=e.code??void 0,t}};function Im(){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}}var Lm={encode(e,t=new U){return e.textMessageStart!==void 0&&qp.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Yp.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Zp.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&$p.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&tm.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&rm.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&am.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&sm.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&lm.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&dm.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&pm.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&hm.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&ym.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&xm.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Cm.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Tm.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Dm.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&km.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&jm.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&Nm.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&Fm.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Im();for(;n.pos>>3){case 1:if(e!==10)break;i.textMessageStart=qp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.textMessageContent=Yp.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.textMessageEnd=Zp.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.toolCallStart=$p.decode(n,n.uint32());continue;case 5:if(e!==42)break;i.toolCallArgs=tm.decode(n,n.uint32());continue;case 6:if(e!==50)break;i.toolCallEnd=rm.decode(n,n.uint32());continue;case 7:if(e!==58)break;i.stateSnapshot=am.decode(n,n.uint32());continue;case 8:if(e!==66)break;i.stateDelta=sm.decode(n,n.uint32());continue;case 9:if(e!==74)break;i.messagesSnapshot=lm.decode(n,n.uint32());continue;case 10:if(e!==82)break;i.raw=dm.decode(n,n.uint32());continue;case 11:if(e!==90)break;i.custom=pm.decode(n,n.uint32());continue;case 12:if(e!==98)break;i.runStarted=hm.decode(n,n.uint32());continue;case 13:if(e!==106)break;i.runFinished=ym.decode(n,n.uint32());continue;case 14:if(e!==114)break;i.runError=xm.decode(n,n.uint32());continue;case 15:if(e!==122)break;i.stepStarted=Cm.decode(n,n.uint32());continue;case 16:if(e!==130)break;i.stepFinished=Tm.decode(n,n.uint32());continue;case 17:if(e!==138)break;i.textMessageChunk=Dm.decode(n,n.uint32());continue;case 18:if(e!==146)break;i.toolCallChunk=km.decode(n,n.uint32());continue;case 19:if(e!==154)break;i.subagentStarted=jm.decode(n,n.uint32());continue;case 20:if(e!==162)break;i.subagentFinished=Nm.decode(n,n.uint32());continue;case 21:if(e!==170)break;i.subagentError=Fm.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Lm.fromPartial(e??{})},fromPartial(e){let t=Im();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?qp.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Yp.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Zp.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?$p.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?tm.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?rm.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?am.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?sm.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?lm.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?dm.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?pm.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?hm.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?ym.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?xm.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Cm.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Tm.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Dm.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?km.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?jm.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?Nm.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?Fm.fromPartial(e.subagentError):void 0,t}};function Rm(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,Bm=e=>{let t=zm(e);if(t){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}}}},Vm=e=>{let t=zm(e);if(t){if(t.text)return{type:`text`,text:t.text.text};if(t.image){let e=t.image;return{type:`image`,source:Bm(e.source),metadata:e.metadata}}if(t.audio){let e=t.audio;return{type:`audio`,source:Bm(e.source),metadata:e.metadata}}if(t.video){let e=t.video;return{type:`video`,source:Bm(e.source),metadata:e.metadata}}if(t.document){let e=t.document;return{type:`document`,source:Bm(e.source),metadata:e.metadata}}}};function Hm(e){let t=Lm.decode(e),n=Object.values(t).find(e=>e!==void 0);if(!n)throw Error(`Invalid event`);if(n.type=Wp[n.baseEvent.type],n.timestamp=n.baseEvent.timestamp,n.rawEvent=n.baseEvent.rawEvent,n.baseEvent.metadata!==void 0&&(n.metadata=n.baseEvent.metadata),delete n.baseEvent,n.type===B.MESSAGES_SNAPSHOT)for(let e of n.messages){let t=e;if(t.role===`user`&&Array.isArray(t.contentParts)){let e=t.contentParts.map(e=>Vm(e)).filter(e=>e!==void 0);e.length>0&&(t.content=e)}Array.isArray(t.contentParts)&&t.contentParts.length===0&&(t.contentParts=void 0),t.toolCalls?.length===0&&(t.toolCalls=void 0)}if(n.type===B.RUN_FINISHED){let e=n,t=typeof e.outcome==`string`&&e.outcome!==``?e.outcome:void 0,r=Array.isArray(e.interrupts)?e.interrupts:[];delete e.interrupts,t===`interrupt`?e.outcome={type:`interrupt`,interrupts:r}:t===`success`?e.outcome={type:`success`}:delete e.outcome}if(n.type===B.SUBAGENT_FINISHED){let e=n,t=typeof e.outcome==`string`&&e.outcome!==``?e.outcome:void 0,r=Array.isArray(e.interruptIds)?e.interruptIds:[];delete e.interruptIds,t===`suspended`?e.outcome={type:`suspended`,...r.length>0&&{interruptIds:r}}:t===`success`?e.outcome={type:`success`}:delete e.outcome}if((n.type===B.RUN_FINISHED||n.type===B.RUN_ERROR)&&Array.isArray(n.usage)&&n.usage.length===0&&delete n.usage,n.type===B.STATE_DELTA)for(let e of n.delta)e.op=hp[e.op].toLowerCase(),Object.keys(e).forEach(t=>{e[t]===void 0&&delete e[t]});return Object.keys(n).forEach(e=>{n[e]===void 0&&delete n[e]}),Zl.parse(n)}var Um;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(Um||={});var Wm;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Wm||={});var q=Um.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),Gm=e=>{switch(typeof e){case`undefined`:return q.undefined;case`string`:return q.string;case`number`:return Number.isNaN(e)?q.nan:q.number;case`boolean`:return q.boolean;case`function`:return q.function;case`bigint`:return q.bigint;case`symbol`:return q.symbol;case`object`:return Array.isArray(e)?q.array:e===null?q.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?q.promise:typeof Map<`u`&&e instanceof Map?q.map:typeof Set<`u`&&e instanceof Set?q.set:typeof Date<`u`&&e instanceof Date?q.date:q.object;default:return q.unknown}},J=Um.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),Km=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;re.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Km.create=e=>new Km(e);var qm=(e,t)=>{let n;switch(e.code){case J.invalid_type:n=e.received===q.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case J.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Um.jsonStringifyReplacer)}`;break;case J.unrecognized_keys:n=`Unrecognized key(s) in object: ${Um.joinValues(e.keys,`, `)}`;break;case J.invalid_union:n=`Invalid input`;break;case J.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Um.joinValues(e.options)}`;break;case J.invalid_enum_value:n=`Invalid enum value. Expected ${Um.joinValues(e.options)}, received '${e.received}'`;break;case J.invalid_arguments:n=`Invalid function arguments`;break;case J.invalid_return_type:n=`Invalid function return type`;break;case J.invalid_date:n=`Invalid date`;break;case J.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Um.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case J.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case J.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case J.custom:n=`Invalid input`;break;case J.invalid_intersection_types:n=`Intersection results could not be merged`;break;case J.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case J.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,Um.assertNever(e)}return{message:n}},Jm=qm;function Ym(){return Jm}var Xm=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function Y(e,t){let n=Ym(),r=Xm({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===qm?void 0:qm].filter(e=>!!e)});e.common.issues.push(r)}var Zm=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return X;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return X;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},X=Object.freeze({status:`aborted`}),Qm=e=>({status:`dirty`,value:e}),$m=e=>({status:`valid`,value:e}),eh=e=>e.status===`aborted`,th=e=>e.status===`dirty`,nh=e=>e.status===`valid`,rh=e=>typeof Promise<`u`&&e instanceof Promise,Z;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(Z||={});var ih=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ah=(e,t)=>{if(nh(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new Km(e.common.issues);return this._error=t,this._error}}};function Q(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var oh=class{get description(){return this._def.description}_getType(e){return Gm(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Gm(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Zm,ctx:{common:e.parent.common,data:e.data,parsedType:Gm(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(rh(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Gm(e)};return ah(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Gm(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return nh(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>nh(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Gm(e)},r=this._parse({data:e,path:n.path,parent:n});return ah(n,await(rh(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:J.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new lg({schema:this,typeName:$.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return ug.create(this,this._def)}nullable(){return dg.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Wh.create(this)}promise(){return cg.create(this,this._def)}or(e){return qh.create([this,e],this._def)}and(e){return Zh.create(this,e,this._def)}transform(e){return new lg({...Q(this._def),schema:this,typeName:$.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new fg({...Q(this._def),innerType:this,defaultValue:t,typeName:$.ZodDefault})}brand(){return new hg({typeName:$.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new pg({...Q(this._def),innerType:this,catchValue:t,typeName:$.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return gg.create(this,e)}readonly(){return _g.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},sh=/^c[^\s-]{8,}$/i,ch=/^[0-9a-z]+$/,lh=/^[0-9A-HJKMNP-TV-Z]{26}$/i,uh=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,dh=/^[a-z0-9_-]{21}$/i,fh=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ph=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,mh=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,hh=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,gh,_h=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,vh=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,yh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,bh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,xh=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Sh=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ch=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,wh=RegExp(`^${Ch}$`);function Th(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Eh(e){return RegExp(`^${Th(e)}$`)}function Dh(e){let t=`${Ch}T${Th(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function Oh(e,t){return!((t!==`v4`&&t||!_h.test(e))&&(t!==`v6`&&t||!yh.test(e)))}function kh(e,t){if(!fh.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function Ah(e,t){return!((t!==`v4`&&t||!vh.test(e))&&(t!==`v6`&&t||!bh.test(e)))}var jh=class e extends oh{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.string,received:t.parsedType}),X}let t=new Zm,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.lengthr.value&&(n=this._getOrReturnCtx(e,n),Y(n,{code:J.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.lengthe.test(t),{validation:t,code:J.invalid_string,...Z.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...Z.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...Z.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...Z.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...Z.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...Z.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...Z.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...Z.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...Z.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...Z.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...Z.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...Z.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...Z.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...Z.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Z.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...Z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...Z.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...Z.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...Z.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...Z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...Z.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...Z.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...Z.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...Z.errToObj(t)})}nonempty(e){return this.min(1,Z.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew jh({checks:[],typeName:$.ZodString,coerce:e?.coerce??!1,...Q(e)});function Mh(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Nh=class e extends oh{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==q.number){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.number,received:t.parsedType}),X}let t,n=new Zm;for(let r of this._def.checks)r.kind===`int`?Um.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Y(t,{code:J.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Mh(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Y(t,{code:J.not_finite,message:r.message}),n.dirty()):Um.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,Z.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Z.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Z.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Z.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Z.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:Z.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Z.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:Z.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:Z.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:Z.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuee.kind===`int`||e.kind===`multipleOf`&&Um.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.valuenew Nh({checks:[],typeName:$.ZodNumber,coerce:e?.coerce||!1,...Q(e)});var Ph=class e extends oh{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==q.bigint)return this._getInvalidInput(e);let t,n=new Zm;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Um.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.bigint,received:t.parsedType}),X}gte(e,t){return this.setLimit(`min`,e,!0,Z.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Z.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Z.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Z.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Z.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Z.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Ph({checks:[],typeName:$.ZodBigInt,coerce:e?.coerce??!1,...Q(e)});var Fh=class extends oh{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.boolean){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.boolean,received:t.parsedType}),X}return $m(e.data)}};Fh.create=e=>new Fh({typeName:$.ZodBoolean,coerce:e?.coerce||!1,...Q(e)});var Ih=class e extends oh{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.date,received:t.parsedType}),X}if(Number.isNaN(e.data.getTime()))return Y(this._getOrReturnCtx(e),{code:J.invalid_date}),X;let t=new Zm,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()r.value&&(n=this._getOrReturnCtx(e,n),Y(n,{code:J.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):Um.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:Z.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:Z.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Ih({checks:[],coerce:e?.coerce||!1,typeName:$.ZodDate,...Q(e)});var Lh=class extends oh{_parse(e){if(this._getType(e)!==q.symbol){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.symbol,received:t.parsedType}),X}return $m(e.data)}};Lh.create=e=>new Lh({typeName:$.ZodSymbol,...Q(e)});var Rh=class extends oh{_parse(e){if(this._getType(e)!==q.undefined){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.undefined,received:t.parsedType}),X}return $m(e.data)}};Rh.create=e=>new Rh({typeName:$.ZodUndefined,...Q(e)});var zh=class extends oh{_parse(e){if(this._getType(e)!==q.null){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.null,received:t.parsedType}),X}return $m(e.data)}};zh.create=e=>new zh({typeName:$.ZodNull,...Q(e)});var Bh=class extends oh{constructor(){super(...arguments),this._any=!0}_parse(e){return $m(e.data)}};Bh.create=e=>new Bh({typeName:$.ZodAny,...Q(e)});var Vh=class extends oh{constructor(){super(...arguments),this._unknown=!0}_parse(e){return $m(e.data)}};Vh.create=e=>new Vh({typeName:$.ZodUnknown,...Q(e)});var Hh=class extends oh{_parse(e){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.never,received:t.parsedType}),X}};Hh.create=e=>new Hh({typeName:$.ZodNever,...Q(e)});var Uh=class extends oh{_parse(e){if(this._getType(e)!==q.undefined){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.void,received:t.parsedType}),X}return $m(e.data)}};Uh.create=e=>new Uh({typeName:$.ZodVoid,...Q(e)});var Wh=class e extends oh{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==q.array)return Y(t,{code:J.invalid_type,expected:q.array,received:t.parsedType}),X;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.lengthr.maxLength.value&&(Y(t,{code:J.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new ih(t,e,t.path,n)))).then(e=>Zm.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new ih(t,e,t.path,n)));return Zm.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:Z.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:Z.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:Z.toString(n)}})}nonempty(e){return this.min(1,e)}};Wh.create=(e,t)=>new Wh({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$.ZodArray,...Q(t)});function Gh(e){if(e instanceof Kh){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=ug.create(Gh(r))}return new Kh({...e._def,shape:()=>t})}return e instanceof Wh?new Wh({...e._def,type:Gh(e.element)}):e instanceof ug?ug.create(Gh(e.unwrap())):e instanceof dg?dg.create(Gh(e.unwrap())):e instanceof Qh?Qh.create(e.items.map(e=>Gh(e))):e}var Kh=class e extends oh{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Um.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==q.object){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.object,received:t.parsedType}),X}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Hh&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new ih(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Hh){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(Y(n,{code:J.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new ih(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Zm.mergeObjectSync(t,e)):Zm.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return Z.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:Z.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:$.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of Um.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of Um.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Gh(this)}partial(t){let n={};for(let e of Um.objectKeys(this.shape)){let r=this.shape[e];n[e]=t&&!t[e]?r:r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of Um.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof ug;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return ag(Um.objectKeys(this.shape))}};Kh.create=(e,t)=>new Kh({shape:()=>e,unknownKeys:`strip`,catchall:Hh.create(),typeName:$.ZodObject,...Q(t)}),Kh.strictCreate=(e,t)=>new Kh({shape:()=>e,unknownKeys:`strict`,catchall:Hh.create(),typeName:$.ZodObject,...Q(t)}),Kh.lazycreate=(e,t)=>new Kh({shape:e,unknownKeys:`strip`,catchall:Hh.create(),typeName:$.ZodObject,...Q(t)});var qh=class extends oh{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Km(e.ctx.common.issues));return Y(t,{code:J.invalid_union,unionErrors:n}),X}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Km(e));return Y(t,{code:J.invalid_union,unionErrors:i}),X}}get options(){return this._def.options}};qh.create=(e,t)=>new qh({options:e,typeName:$.ZodUnion,...Q(t)});var Jh=e=>e instanceof rg?Jh(e.schema):e instanceof lg?Jh(e.innerType()):e instanceof ig?[e.value]:e instanceof og?e.options:e instanceof sg?Um.objectValues(e.enum):e instanceof fg?Jh(e._def.innerType):e instanceof Rh?[void 0]:e instanceof zh?[null]:e instanceof ug?[void 0,...Jh(e.unwrap())]:e instanceof dg?[null,...Jh(e.unwrap())]:e instanceof hg||e instanceof _g?Jh(e.unwrap()):e instanceof pg?Jh(e._def.innerType):[],Yh=class e extends oh{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.object)return Y(t,{code:J.invalid_type,expected:q.object,received:t.parsedType}),X;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(Y(t,{code:J.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),X)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=Jh(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:$.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Q(r)})}};function Xh(e,t){let n=Gm(e),r=Gm(t);if(e===t)return{valid:!0,data:e};if(n===q.object&&r===q.object){let n=Um.objectKeys(t),r=Um.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Xh(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===q.array&&r===q.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r{if(eh(e)||eh(r))return X;let i=Xh(e.value,r.value);return i.valid?((th(e)||th(r))&&t.dirty(),{status:t.value,value:i.data}):(Y(n,{code:J.invalid_intersection_types}),X)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Zh.create=(e,t,n)=>new Zh({left:e,right:t,typeName:$.ZodIntersection,...Q(n)});var Qh=class e extends oh{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.array)return Y(n,{code:J.invalid_type,expected:q.array,received:n.parsedType}),X;if(n.data.lengththis._def.items.length&&(Y(n,{code:J.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new ih(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>Zm.mergeArray(t,e)):Zm.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Qh.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new Qh({items:e,typeName:$.ZodTuple,rest:null,...Q(t)})};var $h=class e extends oh{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.object)return Y(n,{code:J.invalid_type,expected:q.object,received:n.parsedType}),X;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new ih(n,e,n.path,e)),value:a._parse(new ih(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Zm.mergeObjectAsync(t,r):Zm.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof oh?new e({keyType:t,valueType:n,typeName:$.ZodRecord,...Q(r)}):new e({keyType:jh.create(),valueType:t,typeName:$.ZodRecord,...Q(n)})}},eg=class extends oh{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.map)return Y(n,{code:J.invalid_type,expected:q.map,received:n.parsedType}),X;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new ih(n,e,n.path,[a,`key`])),value:i._parse(new ih(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return X;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return X;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};eg.create=(e,t,n)=>new eg({valueType:t,keyType:e,typeName:$.ZodMap,...Q(n)});var tg=class e extends oh{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.set)return Y(n,{code:J.invalid_type,expected:q.set,received:n.parsedType}),X;let r=this._def;r.minSize!==null&&n.data.sizer.maxSize.value&&(Y(n,{code:J.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return X;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new ih(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:Z.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:Z.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};tg.create=(e,t)=>new tg({valueType:e,minSize:null,maxSize:null,typeName:$.ZodSet,...Q(t)});var ng=class e extends oh{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.function)return Y(t,{code:J.invalid_type,expected:q.function,received:t.parsedType}),X;function n(e,n){return Xm({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ym(),qm].filter(e=>!!e),issueData:{code:J.invalid_arguments,argumentsError:n}})}function r(e,n){return Xm({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ym(),qm].filter(e=>!!e),issueData:{code:J.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof cg){let e=this;return $m(async function(...t){let o=new Km([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}{let e=this;return $m(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Km([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Km([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Qh.create(t).rest(Vh.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||Qh.create([]).rest(Vh.create()),returns:n||Vh.create(),typeName:$.ZodFunction,...Q(r)})}},rg=class extends oh{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};rg.create=(e,t)=>new rg({getter:e,typeName:$.ZodLazy,...Q(t)});var ig=class extends oh{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Y(t,{received:t.data,code:J.invalid_literal,expected:this._def.value}),X}return{status:`valid`,value:e.data}}get value(){return this._def.value}};ig.create=(e,t)=>new ig({value:e,typeName:$.ZodLiteral,...Q(t)});function ag(e,t){return new og({values:e,typeName:$.ZodEnum,...Q(t)})}var og=class e extends oh{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{expected:Um.joinValues(n),received:t.parsedType,code:J.invalid_type}),X}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{received:t.data,code:J.invalid_enum_value,options:n}),X}return $m(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};og.create=ag;var sg=class extends oh{_parse(e){let t=Um.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==q.string&&n.parsedType!==q.number){let e=Um.objectValues(t);return Y(n,{expected:Um.joinValues(e),received:n.parsedType,code:J.invalid_type}),X}if(this._cache||=new Set(Um.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=Um.objectValues(t);return Y(n,{received:n.data,code:J.invalid_enum_value,options:e}),X}return $m(e.data)}get enum(){return this._def.values}};sg.create=(e,t)=>new sg({values:e,typeName:$.ZodNativeEnum,...Q(t)});var cg=class extends oh{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==q.promise&&t.common.async===!1?(Y(t,{code:J.invalid_type,expected:q.promise,received:t.parsedType}),X):$m((t.parsedType===q.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};cg.create=(e,t)=>new cg({type:e,typeName:$.ZodPromise,...Q(t)});var lg=class extends oh{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{Y(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return X;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?X:r.status===`dirty`||t.value===`dirty`?Qm(r.value):r});{if(t.value===`aborted`)return X;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?X:r.status===`dirty`||t.value===`dirty`?Qm(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?X:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?X:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!nh(e))return X;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>nh(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):X)}Um.assertNever(r)}};lg.create=(e,t,n)=>new lg({schema:e,typeName:$.ZodEffects,effect:t,...Q(n)}),lg.createWithPreprocess=(e,t,n)=>new lg({schema:t,effect:{type:`preprocess`,transform:e},typeName:$.ZodEffects,...Q(n)});var ug=class extends oh{_parse(e){return this._getType(e)===q.undefined?$m(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ug.create=(e,t)=>new ug({innerType:e,typeName:$.ZodOptional,...Q(t)});var dg=class extends oh{_parse(e){return this._getType(e)===q.null?$m(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};dg.create=(e,t)=>new dg({innerType:e,typeName:$.ZodNullable,...Q(t)});var fg=class extends oh{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===q.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};fg.create=(e,t)=>new fg({innerType:e,typeName:$.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...Q(t)});var pg=class extends oh{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return rh(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Km(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Km(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};pg.create=(e,t)=>new pg({innerType:e,typeName:$.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...Q(t)});var mg=class extends oh{_parse(e){if(this._getType(e)!==q.nan){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.nan,received:t.parsedType}),X}return{status:`valid`,value:e.data}}};mg.create=e=>new mg({typeName:$.ZodNaN,...Q(e)});var hg=class extends oh{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},gg=class e extends oh{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?X:e.status===`dirty`?(t.dirty(),Qm(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?X:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:$.ZodPipeline})}},_g=class extends oh{_parse(e){let t=this._def.innerType._parse(e),n=e=>(nh(e)&&(e.value=Object.freeze(e.value)),e);return rh(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};_g.create=(e,t)=>new _g({innerType:e,typeName:$.ZodReadonly,...Q(t)}),Kh.lazycreate;var $;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})($||={});var vg=jh.create;Nh.create,mg.create,Ph.create;var yg=Fh.create;Ih.create,Lh.create,Rh.create,zh.create;var bg=Bh.create;Vh.create,Hh.create,Uh.create,Wh.create;var xg=Kh.create;Kh.strictCreate,qh.create;var Sg=Yh.create;Zh.create,Qh.create,$h.create,eg.create,tg.create,ng.create,rg.create;var Cg=ig.create,wg=og.create;sg.create,cg.create,lg.create,ug.create,dg.create,lg.createWithPreprocess,gg.create;var Tg=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Eg=e=>{if(typeof e!=`string`)throw TypeError(`Invalid argument expected string`);let t=e.match(Tg);if(!t)throw Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Dg=e=>e===`*`||e===`x`||e===`X`,Og=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},kg=(e,t)=>typeof e==typeof t?[e,t]:[String(e),String(t)],Ag=(e,t)=>{if(Dg(e)||Dg(t))return 0;let[n,r]=kg(Og(e),Og(t));return n>r?1:n{for(let n=0;n{let n=Eg(e),r=Eg(t),i=n.pop(),a=r.pop(),o=jg(n,r);return o===0?i&&a?jg(i.split(`.`),a.split(`.`)):i||a?i?-1:1:0:o},Ng=e=>{if(typeof structuredClone==`function`)return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Pg(){return Go()}function Fg(e){if(Object.freeze(e),typeof e==`object`&&e)for(let t of Object.values(e))typeof t==`object`&&t&&!Object.isFrozen(t)&&Fg(t);return e}var Ig=524288;function Lg(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 Rg(e,t,n,r){let i=typeof process<`u`&&!0,a=i&&!!{}.VITEST_WORKER_ID,o=i&&!!{}.VITEST_WORKER_ID,s=o&&!Lg(t,n,Ig),c=s?Ng(t):t,l=s?Ng(n):n,u=!1,d=!1,f;for(let t of e)try{s&&(Fg(c),Fg(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=Ng(e.messages),u=!0,n=!0),e.state!==void 0&&e.state!==l&&(l=Ng(e.state),d=!0,n=!0),s&&n&&Lg(c,l,Ig)&&(s=!1),f=e.stopPropagation,f===!0)break}catch(e){if(o&&e instanceof TypeError){if(a)throw e;console.error(`AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.`,e)}else a||console.error(`Subscriber error:`,e);continue}return{...u?{messages:Object.isFrozen(c)?Ng(c):c}:{},...d?{state:Object.isFrozen(l)?Ng(l):l}:{},...f===void 0?{}:{stopPropagation:f}}}function zg(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 Bg(e){if(e instanceof Vg)return e;if(e===!0)return new Vg(zg(!0))}var Vg=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 Hg(e){return e.enabled?new Vg(e):void 0}function Ug(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 Wg(e,t){return!e||t.metadata===void 0?!1:(e.metadata=Mc(e.metadata,Ng(t.metadata)),!0)}var Gg=(e,t,n,r,i)=>{let a=Bg(i),o=Ng(n.messages),s=Ng(e.state),c={},l=e=>{e.messages!==void 0&&(o=e.messages,c.messages=e.messages),e.state!==void 0&&(s=e.state,c.state=e.state)},u=()=>{let e=Ng(c);return c={},e.messages!==void 0||e.state!==void 0?hf(e):Fd};return t.pipe(Tf(async t=>{let i=await Rg(r,o,s,(r,i,a)=>r.onEvent?.({event:t,agent:n,input:e,messages:i,state:a}));if(l(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 u();switch(t.type){case B.TEXT_MESSAGE_START:{let i=await Rg(r,o,s,(r,i,a)=>r.onTextMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(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`),u();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=Wg(s,t);(!a||c)&&l({messages:o})}return u()}case B.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}'`),u();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`),u();let d=await Rg(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 l(d),d.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,Wg(c,t),l({messages:o})),u()}case B.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}'`),u();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`),u();let c=await Rg(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 l(c),c.stopPropagation!==!0&&Wg(a,t)&&l({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),u()}case B.TOOL_CALL_START:{let i=await Rg(r,o,s,(r,i,a)=>r.onToolCallStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{toolCallId:e,toolCallName:n,parentMessageId:r,subagentRunId:i}=t,a=o.find(t=>t.toolCalls?.some(t=>t.id===e))?.toolCalls?.find(t=>t.id===e);if(a){let r=a.function.name!==n;return r&&(console.warn(`TOOL_CALL_START: tool call '${e}' already exists with name '${a.function.name}' — updating it to '${n}'`),a.function.name=n),(Wg(a,t)||r)&&l({messages:o}),u()}let s=new Set(o.map(e=>e.id)),c=Ug(o,r,e);!s.has(c.id)&&i!=null&&c.subagentRunId===void 0&&(c.subagentRunId=i),c.toolCalls??=[];let d={id:e,type:`function`,function:{name:n,arguments:``}};c.toolCalls.push(d),Wg(d,t),l({messages:o})}return u()}case B.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}'`),u();let d=c.toolCalls?.find(e=>e.id===i);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${i}'`),u();let f=await Rg(r,o,s,(r,i,a)=>{let o=d.function.arguments,s=d.function.name,c={};try{c=Mf(o)}catch{}return r.onToolCallArgsEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallBuffer:o,toolCallName:s,partialToolCallArgs:c})});return l(f),f.stopPropagation!==!0&&(d.function.arguments+=a,Wg(d,t),l({messages:o})),u()}case B.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}'`),u();let c=a.toolCalls?.find(e=>e.id===i);if(!c)return console.warn(`TOOL_CALL_END: No tool call found with ID '${i}'`),u();let d=await Rg(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 l(d),d.stopPropagation!==!0&&Wg(c,t)&&l({messages:o}),await Promise.all(r.map(t=>{t.onNewToolCall?.({toolCall:c,messages:o,state:s,agent:n,input:e})})),u()}case B.TOOL_CALL_RESULT:{let i=await Rg(r,o,s,(r,i,a)=>r.onToolCallResultEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messageId:i,toolCallId:a,content:c,role:u,subagentRunId:d}=t,f={id:i,toolCallId:a,role:u||`tool`,content:c,...d!=null&&{subagentRunId:d}};Wg(f,t);let p=o.findIndex(e=>e.role===`assistant`&&e.toolCalls?.some(e=>e.id===a));if(p===-1)o.push(f);else{let e=p+1;for(;e{t.onNewMessage?.({message:f,messages:o,state:s,agent:n,input:e})})),l({messages:o})}return u()}case B.STATE_SNAPSHOT:{let i=await Rg(r,o,s,(r,i,a)=>r.onStateSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{snapshot:e}=t;s=e,l({state:s})}return u()}case B.STATE_DELTA:{let i=await Rg(r,o,s,(r,i,a)=>r.onStateDeltaEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{delta:e}=t;try{s=Nu.applyPatch(s,e,!0,!1).newDocument,l({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 u()}case B.MESSAGES_SNAPSHOT:{let i=await Rg(r,o,s,(r,i,a)=>r.onMessagesSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messages:e}=t,n=e.map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}),r=new Map(n.map(e=>[e.id,e])),i=n.some(e=>e.role===`activity`),a=n.some(e=>e.role===`reasoning`),s=e=>e.role===`activity`&&!i||e.role===`reasoning`&&!a;o=o.filter(e=>s(e)||r.has(e.id)).map(e=>s(e)?e:r.get(e.id));let c=new Set(o.map(e=>e.id));for(let e of n)c.has(e.id)||o.push(e);l({messages:o})}return u()}case B.ACTIVITY_SNAPSHOT:{let i=t,a=o.findIndex(e=>e.id===i.messageId),c=a>=0?o[a]:void 0,d=c?.role===`activity`?c:void 0,f=i.replace??!0,p=await Rg(r,o,s,(t,r,a)=>t.onActivitySnapshotEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:d,existingMessage:c}));if(l(p),p.stopPropagation!==!0){let t={id:i.messageId,role:`activity`,activityType:i.activityType,content:Ng(i.content),...i.subagentRunId!=null&&{subagentRunId:i.subagentRunId}},c,u;a===-1?(o.push(t),c=t,u=t):d?(f&&(o[a]={...d,activityType:i.activityType,content:Ng(i.content),subagentRunId:i.subagentRunId},i.subagentRunId??delete o[a].subagentRunId),u=o[a]):f&&(o[a]=t,c=t,u=t),Wg(u,i),l({messages:o}),c&&await Promise.all(r.map(t=>t.onNewMessage?.({message:c,messages:o,state:s,agent:n,input:e})))}return u()}case B.ACTIVITY_DELTA:{let i=t,a=o.findIndex(e=>e.id===i.messageId);if(a===-1)return u();let c=o[a];if(c.role!==`activity`)return console.warn(`ACTIVITY_DELTA: Message '${i.messageId}' is not an activity message`),u();let d=c,f=await Rg(r,o,s,(t,r,a)=>t.onActivityDeltaEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:d}));if(l(f),f.stopPropagation!==!0)try{Wg(d,i)&&l({messages:o});let e=Ng(d.content??{}),t=Nu.applyPatch(e,i.patch??[],!0,!1).newDocument;o[a]={...d,content:Ng(t),activityType:i.activityType},l({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 u()}case B.RAW:return l(await Rg(r,o,s,(r,i,a)=>r.onRawEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.CUSTOM:return l(await Rg(r,o,s,(r,i,a)=>r.onCustomEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.RUN_STARTED:{let i=await Rg(r,o,s,(r,i,a)=>r.onRunStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let e=t;if(e.input?.messages){for(let t of e.input.messages){let e=t;if(t.subagentRunId===null){let n={...t};delete n.subagentRunId,e=n}o.find(t=>t.id===e.id)||o.push(e)}l({messages:o})}}return u()}case B.RUN_FINISHED:{let i=t,a=i.outcome?.type===`interrupt`?{event:i,outcome:`interrupt`,interrupts:i.outcome.interrupts}:{event:i,outcome:`success`,result:i.result},c=await Rg(r,o,s,(t,r,i)=>t.onRunFinishedEvent?.({...a,messages:r,state:i,agent:n,input:e}));return l(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}):[]),u()}case B.RUN_ERROR:return l(await Rg(r,o,s,(r,i,a)=>r.onRunErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.STEP_STARTED:return l(await Rg(r,o,s,(r,i,a)=>r.onStepStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.STEP_FINISHED:return l(await Rg(r,o,s,(r,i,a)=>r.onStepFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.TEXT_MESSAGE_CHUNK:throw Error(`TEXT_MESSAGE_CHUNK must be transformed before being applied`);case B.TOOL_CALL_CHUNK:throw Error(`TOOL_CALL_CHUNK must be transformed before being applied`);case B.THINKING_START:return u();case B.THINKING_END:return u();case B.THINKING_TEXT_MESSAGE_START:return u();case B.THINKING_TEXT_MESSAGE_CONTENT:return u();case B.THINKING_TEXT_MESSAGE_END:return u();case B.REASONING_START:return l(await Rg(r,o,s,(r,i,a)=>r.onReasoningStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.REASONING_MESSAGE_START:{let i=await Rg(r,o,s,(r,i,a)=>r.onReasoningMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messageId:e,subagentRunId:n}=t,r=o.find(t=>t.id===e),i=r;if(!i){let t={id:e,role:`reasoning`,content:``,...n!=null&&{subagentRunId:n}};o.push(t),i=t}let a=Wg(i,t);(!r||a)&&l({messages:o})}return u()}case B.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}'`),u();let d=await Rg(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 l(d),d.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,Wg(c,t),l({messages:o})),u()}case B.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}'`),u();let c=await Rg(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 l(c),c.stopPropagation!==!0&&Wg(a,t)&&l({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),u()}case B.REASONING_MESSAGE_CHUNK:throw Error(`REASONING_MESSAGE_CHUNK must be transformed before being applied`);case B.REASONING_END:return l(await Rg(r,o,s,(r,i,a)=>r.onReasoningEndEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.REASONING_ENCRYPTED_VALUE:{let{subtype:i,entityId:a,encryptedValue:d}=t,f=await Rg(r,o,s,(r,i,a)=>r.onReasoningEncryptedValueEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(f),f.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=d,e=!0;break}}}else{let t=o.find(e=>e.id===a);t?.role!==`activity`&&t&&(t.encryptedValue=d,e=!0)}e&&(c.messages=o)}return u()}case B.SUBAGENT_STARTED:return l(await Rg(r,o,s,(r,i,a)=>r.onSubagentStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.SUBAGENT_FINISHED:return l(await Rg(r,o,s,(r,i,a)=>r.onSubagentFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.SUBAGENT_ERROR:return l(await Rg(r,o,s,(r,i,a)=>r.onSubagentErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u()}return t.type,u()}),xf(),r.length>0?Ef({}):e=>e)},Kg=e=>t=>{let n=Bg(e),r=new Set,i=new Set,a=new Set,o={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},s=!1,c=!1,l=!1,u=new Map,d=e=>{let t=u.get(e);return t||(t=new Map,u.set(e,t)),t},f=()=>{for(let e of u.values())if(e.size>0)return!0;return!1},p=new Map,m=new Set,h=!1,g=!1,_=!1,v=()=>{r.clear(),i.clear(),a.clear(),o.message.clear(),o.toolCall.clear(),o.activity.clear(),o.reasoning.clear(),u.clear(),p.clear(),m.clear(),h=!1,g=!1,s=!1,c=!1,_=!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 z(`Cannot send a message (id '${e.id}') with 'subagentRunId: null'. The field is optional — omit it entirely.`);let n=e.role===`reasoning`?o.reasoning:e.role===`activity`?o.activity:o.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||!o.toolCall.has(n.id))&&o.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 z(`Cannot send '${e}': subagentRunId '${t}' does not match the ${r} '${i}' opener's subagent '${n.subagentRunId??`(the parent agent)`}'.`)};return t.pipe(bf(e=>{let t=e.type;if(n?.event(`VERIFY`,`Event:`,e,{type:e.type}),c&&t!==B.RUN_STARTED)return H(()=>new z(`Cannot send event type '${t}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(s&&t!==B.RUN_ERROR&&t!==B.RUN_STARTED)return H(()=>new z(`Cannot send event type '${t}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(!l){if(l=!0,t!==B.RUN_STARTED&&t!==B.RUN_ERROR)return H(()=>new z(`First event must be 'RUN_STARTED'`))}else if(t===B.RUN_STARTED){if(_&&!s&&!c)return H(()=>new z(`Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run.`));(s||c)&&v()}if(e.subagentRunId===null)return H(()=>new z(`Cannot send '${t}' with 'subagentRunId: null'. The field is optional — omit it entirely.`));if(t===B.SUBAGENT_STARTED||t===B.SUBAGENT_FINISHED||t===B.SUBAGENT_ERROR){let n=t===B.SUBAGENT_STARTED?[`description`,`parentSubagentRunId`,`parentToolCallId`,`parentMessageId`]:t===B.SUBAGENT_FINISHED?[`outcome`]:[`code`];for(let r of n)if(e[r]===null)return H(()=>new z(`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 H(()=>new z(`Cannot send '${t}' with outcome type '${String(r.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(r&&r.interruptIds===null)return H(()=>new z(`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 H(()=>new z(`Cannot send '${t}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(t===B.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 H(()=>new z(`Cannot send 'RUN_FINISHED' with an interrupt (id '${e.id}') carrying 'subagentRunId: null'. The field is optional — omit it entirely.`))}}switch(t){case B.TEXT_MESSAGE_START:{let n=e.messageId;if(r.has(n))return H(()=>new z(`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=o.message.get(n);if(i){let r=b(t,e.subagentRunId,i,`message`,n);if(r)return H(()=>r)}return r.add(n),i||o.message.set(n,{subagentRunId:e.subagentRunId}),hf(e)}case B.TEXT_MESSAGE_CONTENT:{let n=e.messageId;if(!r.has(n))return H(()=>new z(`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,o.message.get(n),`message`,n);return i?H(()=>i):hf(e)}case B.TEXT_MESSAGE_END:{let n=e.messageId;if(!r.has(n))return H(()=>new z(`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,o.message.get(n),`message`,n);return i?H(()=>i):(r.delete(n),hf(e))}case B.TOOL_CALL_START:{let n=e.toolCallId;if(i.has(n))return H(()=>new z(`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,s;if(r!==void 0){let e=o.message.get(r);if(e){if(a!==void 0&&a!==e.subagentRunId)return H(()=>new z(`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.`));s=e}}let c=o.toolCall.get(n);if(c){let e=b(t,a,c,`tool call`,n);if(e)return H(()=>e);if(a===void 0&&s&&s.subagentRunId!==c.subagentRunId)return H(()=>new z(`Cannot send 'TOOL_CALL_START': tool call '${n}' is owned by '${c.subagentRunId??`(the parent agent)`}' but its parent message '${r}' is owned by '${s.subagentRunId??`(the parent agent)`}'. A tool call belongs to the message that carries it.`))}return i.add(n),c||o.toolCall.set(n,a===void 0?s??{subagentRunId:void 0}:{subagentRunId:a}),hf(e)}case B.TOOL_CALL_ARGS:{let n=e.toolCallId;if(!i.has(n))return H(()=>new z(`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,o.toolCall.get(n),`tool call`,n);return r?H(()=>r):hf(e)}case B.TOOL_CALL_END:{let n=e.toolCallId;if(!i.has(n))return H(()=>new z(`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,o.toolCall.get(n),`tool call`,n);return r?H(()=>r):(i.delete(n),hf(e))}case B.STEP_STARTED:{let t=e.stepName,n=e.subagentRunId;return d(n).has(t)?H(()=>new z(`Step "${t}" is already active for 'STEP_STARTED'${n===void 0?``:` in subagent '${n}'`}`)):(d(n).set(t,!0),hf(e))}case B.STEP_FINISHED:{let t=e.stepName,n=e.subagentRunId;if(!d(n).has(t)){let e,r=!1;for(let[i,a]of u)if(i!==n&&a.has(t)){e=i,r=!0;break}return H(r?()=>new z(`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 z(`Cannot send 'STEP_FINISHED' for step "${t}" that was not started`))}return d(n).delete(t),hf(e)}case B.ACTIVITY_SNAPSHOT:{let t=e.messageId;return(!o.activity.has(t)||e.replace!==!1)&&o.activity.set(t,{subagentRunId:e.subagentRunId}),hf(e)}case B.TOOL_CALL_RESULT:{let t=e.messageId;return typeof t==`string`&&o.message.set(t,{subagentRunId:e.subagentRunId}),hf(e)}case B.REASONING_START:case B.REASONING_MESSAGE_START:{let n=e.messageId,r=o.reasoning.get(n);if(r){let i=b(t,e.subagentRunId,r,`reasoning message`,n);if(i)return H(()=>i)}return a.add(n),r||o.reasoning.set(n,{subagentRunId:e.subagentRunId}),hf(e)}case B.REASONING_MESSAGE_CONTENT:case B.REASONING_MESSAGE_END:case B.REASONING_END:{let n=e.messageId,r=b(t,e.subagentRunId,o.reasoning.get(n),`reasoning message`,n);return r?H(()=>r):(t===B.REASONING_END&&a.delete(n),hf(e))}case B.REASONING_ENCRYPTED_VALUE:{let n=e.entityId,r=e.subtype,i=r===`tool-call`?o.toolCall.get(n):r===`message`?o.message.get(n)??o.reasoning.get(n):o.reasoning.get(n),a=r===`tool-call`?`tool call`:r===`message`?`message`:`reasoning message`,s=b(t,e.subagentRunId,i,a,n);return s?H(()=>s):hf(e)}case B.ACTIVITY_DELTA:{let n=e.messageId,r=b(t,e.subagentRunId,o.activity.get(n),`activity`,n);return r?H(()=>r):hf(e)}case B.SUBAGENT_STARTED:{if(typeof e.subagentRunId!=`string`)return H(()=>new z(`Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'.`));if(typeof e.name!=`string`)return H(()=>new z(`Cannot send 'SUBAGENT_STARTED' without a 'name'.`));let t=e.subagentRunId,n=e.parentSubagentRunId;return p.has(t)?H(()=>new z(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):m.has(t)?H(()=>new z(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):n!==void 0&&!p.has(n)&&!m.has(n)?H(()=>new z(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${n}' has not been started in this run.`)):(p.set(t,!0),hf(e))}case B.SUBAGENT_FINISHED:case B.SUBAGENT_ERROR:{if(typeof e.subagentRunId!=`string`)return H(()=>new z(`Cannot send '${t}' without a 'subagentRunId'.`));if(t===B.SUBAGENT_ERROR&&typeof e.message!=`string`)return H(()=>new z(`Cannot send 'SUBAGENT_ERROR' without a 'message'.`));let n=e.subagentRunId;return p.has(n)?(p.delete(n),m.add(n),hf(e)):H(()=>new z(`Cannot send '${t}': no active subagent found with ID '${n}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case B.MESSAGES_SNAPSHOT:{let t=y(e.messages,!0);if(t)return H(()=>t)}return hf(e);case B.RUN_STARTED:_=!0;{let t=y((e.input??{}).messages,!1);if(t)return H(()=>t)}return hf(e);case B.RUN_FINISHED:if(f()){let e=[];for(let[t,n]of u)for(let r of n.keys())e.push(t===void 0?r:`${r} (subagent '${t}')`);let t=e.join(`, `);return H(()=>new z(`Cannot send 'RUN_FINISHED' while steps are still active: ${t}`))}if(r.size>0){let e=Array.from(r.keys()).join(`, `);return H(()=>new z(`Cannot send 'RUN_FINISHED' while text messages are still active: ${e}`))}if(i.size>0){let e=Array.from(i.keys()).join(`, `);return H(()=>new z(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${e}`))}if(p.size>0){let e=Array.from(p.keys()).join(`, `);return H(()=>new z(`Cannot send 'RUN_FINISHED' while subagents are still active: ${e}`))}return s=!0,hf(e);case B.RUN_ERROR:return c=!0,hf(e);case B.CUSTOM:return hf(e);case B.THINKING_TEXT_MESSAGE_START:return h?g?H(()=>new z(`Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.`)):(g=!0,hf(e)):H(()=>new z(`Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first.`));case B.THINKING_TEXT_MESSAGE_CONTENT:return g?hf(e):H(()=>new z(`Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first.`));case B.THINKING_TEXT_MESSAGE_END:return g?(g=!1,hf(e)):H(()=>new z(`Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first.`));case B.THINKING_START:return h?H(()=>new z(`Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.`)):(h=!0,hf(e));case B.THINKING_END:return h?(h=!1,hf(e)):H(()=>new z(`Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first.`));default:return hf(e)}}))},qg=function(e){return e.HEADERS=`headers`,e.DATA=`data`,e}({}),Jg=e=>Sf(()=>mf(e())).pipe(Of(e=>{if(!e.ok){let t=e.headers.get(`content-type`)||``;return mf(e.text()).pipe(bf(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,H(()=>i)}))}let t={type:qg.HEADERS,status:e.status,headers:e.headers},n=e.body?.getReader();return n?new Sd(e=>(e.next(t),(async()=>{try{for(;;){let{done:t,value:r}=await n.read();if(t)break;let i={type:qg.DATA,data:r};e.next(i)}e.complete()}catch(t){e.error(t)}})(),()=>{n.cancel().catch(e=>{if(e?.name!==`AbortError`)throw e})})):H(()=>Error(`Failed to getReader() from response`))})),Yg=(e,t)=>{let n=Bg(t),r=new jd,i=new TextDecoder(`utf-8`,{fatal:!1}),a=``;e.subscribe({next:e=>{if(e.type!==qg.HEADERS&&e.type===qg.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)}},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()},Xg=e=>{let t=new jd,n=new Uint8Array;e.subscribe({next:e=>{if(e.type!==qg.HEADERS&&e.type===qg.DATA&&e.data){let t=new Uint8Array(n.length+e.data.length);t.set(n,0),t.set(e.data,n.length),n=t,r()}},error:e=>t.error(e),complete:()=>{if(n.length>0)try{r()}catch{console.warn(`Incomplete or invalid protocol buffer data at stream end`)}t.complete()}});function r(){for(;n.length>=4;){let e=4+new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(n.length{let n=Bg(t),r=new jd,i=new Pd,a=!1;return e.subscribe({next:e=>{if(i.next(e),e.type===qg.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`?Xg(i).subscribe({next:e=>r.next(e),error:e=>r.error(e),complete:()=>r.complete()}):Yg(i,n).subscribe({next:e=>{try{let t=Zl.parse(e);n?.event(`HTTP`,`Event validated:`,t,{type:t.type,valid:!0}),r.next(t)}catch(t){n?.event(`HTTP`,`Event invalid:`,{json:e,error:String(t)}),r.error(t)}},error:e=>{if(e?.name===`AbortError`){r.next({type:B.RUN_ERROR,message:e.message||`Request aborted`,code:`abort`,rawEvent:e}),r.complete();return}return r.error(e)},complete:()=>r.complete()})}else a||r.error(Error(`No headers event received before data events`))},error:e=>{i.error(e),r.error(e)},complete:()=>{i.complete()}}),r.asObservable()},Qg=wg([`TextMessageStart`,`TextMessageContent`,`TextMessageEnd`,`ActionExecutionStart`,`ActionExecutionArgs`,`ActionExecutionEnd`,`ActionExecutionResult`,`AgentStateMessage`,`MetaEvent`,`RunStarted`,`RunFinished`,`RunError`,`NodeStarted`,`NodeFinished`]),$g=wg([`LangGraphInterruptEvent`,`PredictState`,`Exit`]);Sg(`type`,[xg({type:Cg(Qg.enum.TextMessageStart),messageId:vg(),parentMessageId:vg().optional(),role:vg().optional()}),xg({type:Cg(Qg.enum.TextMessageContent),messageId:vg(),content:vg()}),xg({type:Cg(Qg.enum.TextMessageEnd),messageId:vg()}),xg({type:Cg(Qg.enum.ActionExecutionStart),actionExecutionId:vg(),actionName:vg(),parentMessageId:vg().optional()}),xg({type:Cg(Qg.enum.ActionExecutionArgs),actionExecutionId:vg(),args:vg()}),xg({type:Cg(Qg.enum.ActionExecutionEnd),actionExecutionId:vg()}),xg({type:Cg(Qg.enum.ActionExecutionResult),actionName:vg(),actionExecutionId:vg(),result:vg()}),xg({type:Cg(Qg.enum.AgentStateMessage),threadId:vg(),agentName:vg(),nodeName:vg(),runId:vg(),active:yg(),role:vg(),state:vg(),running:yg()}),xg({type:Cg(Qg.enum.MetaEvent),name:$g,value:bg()}),xg({type:Cg(Qg.enum.RunError),message:vg(),code:vg().optional()})]),xg({id:vg(),role:vg(),content:vg(),parentMessageId:vg().optional()}),xg({id:vg(),name:vg(),arguments:bg(),parentMessageId:vg().optional()}),xg({id:vg(),result:bg(),actionExecutionId:vg(),actionName:vg()});var e_=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(` -`)},t_=(e,t,n)=>r=>{let i={},a=!0,o=!0,s=``,c=null,l=null,u=[],d={},f=e=>{typeof e==`object`&&e&&(`messages`in e&&delete e.messages,i=e)};return r.pipe(bf(r=>{switch(r.type){case B.TEXT_MESSAGE_START:{let e=r;return[{type:Qg.enum.TextMessageStart,messageId:e.messageId,role:e.role}]}case B.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:Qg.enum.TextMessageContent,messageId:e.messageId,content:e.delta}]}case B.TEXT_MESSAGE_END:{let e=r;return[{type:Qg.enum.TextMessageEnd,messageId:e.messageId}]}case B.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:Qg.enum.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case B.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let p=!1;if(l){let e=l.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(Mf(d.function.arguments));e.tool_argument&&e.tool_argument in t?(f({...i,[e.state_key]:t[e.tool_argument]}),p=!0):e.tool_argument||(f({...i,[e.state_key]:t}),p=!0)}catch{}}return[{type:Qg.enum.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...p?[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case B.TOOL_CALL_END:{let e=r;return[{type:Qg.enum.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case B.TOOL_CALL_RESULT:{let e=r;return[{type:Qg.enum.ActionExecutionResult,actionExecutionId:e.toolCallId,result:e.content,actionName:d[e.toolCallId]||`unknown`}]}case B.RAW:return[];case B.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:Qg.enum.MetaEvent,name:e.name,value:e.value}]}case B.STATE_SNAPSHOT:return f(r.snapshot),[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case B.STATE_DELTA:{let c=r,l=Nu.applyPatch(i,c.delta,!0,!1);return l?(f(l.newDocument),[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]):[]}case B.MESSAGES_SNAPSHOT:return c=r.messages,[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case B.RUN_STARTED:return[];case B.RUN_FINISHED:return c&&(i.messages=c),Object.keys(i).length===0?[]:[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:n_(c)}:{}}),active:!1}];case B.RUN_ERROR:{let e=r;return[{type:Qg.enum.RunError,message:e.message,code:e.code}]}case B.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case B.STEP_FINISHED:return u=[],l=null,[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function n_(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=e_(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={id:e.id,name:e.function.name,arguments:JSON.parse(e.function.arguments),parentMessageId:n.id};t.push(r)}}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:n.content,actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var r_=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,i_=e=>e===`tool`?`toolCallId`:`messageId`,a_=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},o_=e=>t=>{let n=Bg(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:B.TEXT_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TEXT_MESSAGE_END`,e,{messageId:e.messageId}),[e]}case`tool`:{let e={type:B.TOOL_CALL_END,toolCallId:t.fields.toolCallId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TOOL_CALL_END`,e,{toolCallId:e.toolCallId}),[e]}case`reasoning`:{let e={type:B.REASONING_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{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&&r_(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 ${i_(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(bf(e=>{switch(e.type){case B.TEXT_MESSAGE_START:case B.TEXT_MESSAGE_CONTENT:case B.TEXT_MESSAGE_END:case B.TOOL_CALL_START:case B.TOOL_CALL_ARGS:case B.TOOL_CALL_END:case B.TOOL_CALL_RESULT:case B.STATE_SNAPSHOT:case B.STATE_DELTA:case B.CUSTOM:case B.STEP_STARTED:case B.STEP_FINISHED:case B.THINKING_START:case B.THINKING_END:case B.THINKING_TEXT_MESSAGE_START:case B.THINKING_TEXT_MESSAGE_CONTENT:case B.THINKING_TEXT_MESSAGE_END:case B.REASONING_START:case B.REASONING_MESSAGE_START:case B.REASONING_MESSAGE_CONTENT:case B.REASONING_MESSAGE_END:case B.REASONING_END:return[...i(e.subagentRunId??void 0),e];case B.RUN_STARTED:case B.RUN_FINISHED:case B.RUN_ERROR:case B.MESSAGES_SNAPSHOT:return[...a(),e];case B.RAW:case B.ACTIVITY_SNAPSHOT:case B.ACTIVITY_DELTA:case B.REASONING_ENCRYPTED_VALUE:case B.SUBAGENT_STARTED:return[e];case B.SUBAGENT_FINISHED:case B.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case B.TEXT_MESSAGE_CHUNK:{let t=e,a=s(`text`,t.messageId,t.subagentRunId??void 0,`TEXT_MESSAGE_CHUNK`,`text message`),o=r.get(a),c=[],l;if(o?.kind===`text`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First TEXT_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,name:t.name,subagentRunId:t.subagentRunId},r.set(a,{kind:`text`,fields:l});let e=a_({type:B.TEXT_MESSAGE_START,messageId:t.messageId,role:t.role||`assistant`,...t.name!==void 0&&{name:t.name},...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TEXT_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=a_({type:B.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TEXT_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:B.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case B.TOOL_CALL_CHUNK:{let t=e,a=s(`tool`,t.toolCallId,t.subagentRunId??void 0,`TOOL_CALL_CHUNK`,`tool call`),o=r.get(a),c=[],l;if(o?.kind===`tool`&&(t.toolCallId===void 0||t.toolCallId===o.fields.toolCallId))l=o.fields;else{if(c.push(...i(a)),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`);l={toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`tool`,fields:l});let e=a_({type:B.TOOL_CALL_START,toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TOOL_CALL_START`,e,{toolCallId:t.toolCallId,toolCallName:t.toolCallName})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=a_({type:B.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TOOL_CALL_ARGS`,r,{toolCallId:l.toolCallId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:B.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case B.REASONING_MESSAGE_CHUNK:{let t=e,a=s(`reasoning`,t.messageId,t.subagentRunId??void 0,`REASONING_MESSAGE_CHUNK`,`reasoning message`),o=r.get(a),c=[],l;if(o?.kind===`reasoning`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First REASONING_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`reasoning`,fields:l});let e=a_({type:B.REASONING_MESSAGE_START,messageId:t.messageId,role:`reasoning`,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`REASONING_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=a_({type:B.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`REASONING_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:B.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}}return e.type,[]}),Df(()=>{a()}))};function s_(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}var c_=class{runNext(e,t){return t.run(e).pipe(o_(!1))}runNextWithState(e,t){let n=Ng(e.messages||[]),r=Ng(e.state||{}),i=new Pd;return Gg(e,i,t,[]).subscribe(e=>{e.messages!==void 0&&(n=e.messages),e.state!==void 0&&(r=e.state)}),this.runNext(e,t).pipe(Tf(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:Ng(n),state:Ng(r)})))}},l_=class extends c_{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function u_(e){let t=e.content;if(Array.isArray(t)){let n=t.filter(e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``);return{...e,content:n}}return typeof t==`string`?e:{...e,content:``}}var d_=class extends c_{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(u_)};return this.runNext(i,t)}},f_=`THINKING_START`,p_=`THINKING_END`,m_=`THINKING_TEXT_MESSAGE_START`,h_=`THINKING_TEXT_MESSAGE_CONTENT`,g_=`THINKING_TEXT_MESSAGE_END`,__=class extends c_{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(vf(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case f_:{this.currentReasoningId=Pg();let{title:t,...n}=e;return this.warnAboutTransformation(f_,B.REASONING_START),{...n,type:B.REASONING_START,messageId:this.currentReasoningId}}case m_:return this.currentMessageId=Pg(),this.warnAboutTransformation(m_,B.REASONING_MESSAGE_START),{...e,type:B.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`assistant`};case h_:{let{delta:t,...n}=e;return this.warnAboutTransformation(h_,B.REASONING_MESSAGE_CONTENT),{...n,type:B.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Pg(),delta:t}}case g_:{let t=this.currentMessageId??Pg();return this.warnAboutTransformation(g_,B.REASONING_MESSAGE_END),{...e,type:B.REASONING_MESSAGE_END,messageId:t}}case p_:{let t=this.currentReasoningId??Pg();return this.warnAboutTransformation(p_,B.REASONING_END),{...e,type:B.REASONING_END,messageId:t}}default:return e}}};function v_(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function y_(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function b_(e){let t=v_(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}}:{}}:e}function x_(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>y_(e)?b_(e):e);return{...e,content:n}}var S_=class extends c_{run(e,t){let n={...e,messages:e.messages.map(x_)};return this.runNext(n,t)}},C_=`SUBAGENT_STARTED`,w_=`SUBAGENT_FINISHED`,T_=`SUBAGENT_ERROR`;function E_(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function D_(e){return e.map(e=>E_(e))}var O_=class extends c_{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=>E_(e))};return this.runNext(n,t).pipe(Af(e=>{let t=e.type;(t===C_||t===w_||t===T_)&&this.warnDroppedLifecycleEvent(t)}),Cf(e=>{let t=e.type;return t!==C_&&t!==w_&&t!==T_}),vf(e=>{let t=E_(e);if(t.type===B.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:D_(e.messages)}}if(t.type===B.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>E_(e))}}}if(t.type===B.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:D_(e.input.messages)}}}return t}))}},k_=`0.0.59`,A_=class{get maxVersion(){return k_}get debug(){return this._debug}set debug(e){this._debug=zg(e),this._debugLogger=Hg(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?Hg(zg(!0)):void 0:e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??``,this.threadId=n??Go(),this.messages=Ng(r??[]),this.state=Ng(i??{}),this._debug=zg(a),this._debugLogger=Hg(this._debug),Mg(this.maxVersion,`0.0.39`)<=0&&this.middlewares.unshift(new d_),Mg(this.maxVersion,`0.0.45`)<=0&&this.middlewares.unshift(new __),Mg(this.maxVersion,`0.0.47`)<=0&&this.middlewares.unshift(new S_),Mg(this.maxVersion,`0.0.57`)<=0&&this.middlewares.unshift(new O_)}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 l_(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();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=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new jd;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await _f(bd(()=>this.middlewares.length===0?this.run(n):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),o_(this.debugLogger),Kg(this.debugLogger),e=>e.pipe(kf(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),wf(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))),Df(()=>{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}))(hf(null)));let s=Ng(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new Qc}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new jd;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await _f(bd(()=>Sf(()=>this.connect(n)),o_(this.debugLogger),Kg(this.debugLogger),e=>e.pipe(kf(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),wf(e=>(this.isRunning=!1,e instanceof Qc?Fd:this.onError(n,e,a))),Df(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(hf(null)),{defaultValue:void 0});let s=Ng(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}apply(e,t,n){return Gg(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(Af(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Ng(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=t.filter(e=>e.role!==`activity`);return{threadId:this.threadId,runId:e?.runId||Go(),tools:Ng(e?.tools??[]),context:Ng(e?.context??[]),forwardedProps:Ng(e?.forwardedProps??{}),state:Ng(this.state),messages:n,...e?.resume===void 0?{}:{resume:Ng(e.resume)}}}async onInitialize(e,t){if(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 z(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let e of this.pendingInterrupts)if(s_(e))throw new z(`Interrupt ${e.id} expired at ${e.expiresAt}`)}let n=await Rg(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){this.messages=n.messages;for(let e of n.messages)e.subagentRunId===null&&delete e.subagentRunId;e.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})}n.state&&(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 mf(Rg(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(vf(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 Rg(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=Ng(this.messages),e.state=Ng(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Ng(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=Ng(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=Ng(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??Go();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t)).pipe(o_(this.debugLogger),Kg(this.debugLogger),t_(this.threadId,t.runId,this.agentId),e=>e.pipe(vf(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function j_(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 M_=class extends A_{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(j_(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=Ng(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return Zg(Jg(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Ng(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}},N_=class extends un{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:Tn(t,n.data),hasPreviousPage:dn(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},P_=class extends mn{#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 xn({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=F_(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=F_(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=F_(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=F_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Sn.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=>On(t,e))}findAll(e={}){return this.getAll().filter(t=>On(e,t))}notify(e){Sn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Sn.batch(()=>Promise.all(e.map(e=>e.continue().catch(Dn))))}};function F_(e){return e.options.scope?.id}var I_=class extends mn{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??En(r,t),a=this.get(i);return a||(a=new vn({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){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Sn.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=>ln(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ln(e,t)):t}notify(e){Sn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Sn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Sn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},L_=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new I_,this.#t=e.mutationCache||new P_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=yn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=fn.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(qt(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=pn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Sn.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;Sn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Sn.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=Sn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Dn).catch(Dn)}invalidateQueries(e,t={}){return Sn.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=Sn.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(Dn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Dn)}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(qt(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(qt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Dn).catch(Dn)}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(Dn).catch(Dn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return fn.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(sn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{on(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(sn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{on(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||=En(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===Yt&&(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 R_(e,t){return cn(e,N_,t)}var z_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),B_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),V_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),H_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),U_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),W_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),G_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),K_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:z_}));K_.displayName=`BookOpenIcon`;var q_=K_,J_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:B_}));J_.displayName=`MagnifyingGlassIcon`;var Y_=J_,X_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:V_}));X_.displayName=`MoonIcon`;var Z_=X_,Q_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:H_}));Q_.displayName=`PencilSimpleIcon`;var $_=Q_,ev=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:U_}));ev.displayName=`PlugsConnectedIcon`;var tv=ev,nv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:W_}));nv.displayName=`SignOutIcon`;var rv=nv,iv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:G_}));iv.displayName=`SunIcon`;var av=iv,ov={home:`https://fanout.run/start/what-fanout-is`,ingest:`https://fanout.run/start/send-telemetry`};async function sv(e,t){let n=new URLSearchParams({limit:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await De(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function cv({agentAvailable:e,activeThreadID:t,activeDashboardID:n,autoFocusSearch:r=!1,onNewChat:i,onSelectThread:a,onDeletedThread:o,onSelectDashboard:s,onCreateDashboard:c,onInvestigateService:l,ref:u}){let d=nn(),[f,p]=(0,w.useState)(``),[m]=fa(f.trim(),250),[h,g]=(0,w.useState)(null),[_,v]=(0,w.useState)(null),[b,x]=(0,w.useState)(``),[ee,ne]=(0,w.useState)(``),[S,ie]=(0,w.useState)(!1),oe=(0,w.useRef)(null);(0,w.useImperativeHandle)(u,()=>({focusSearch:()=>oe.current?.focus()}),[]),(0,w.useEffect)(()=>{r&&requestAnimationFrame(()=>oe.current?.focus())},[r]);let se=R_({queryKey:[...Cn,m],queryFn:({pageParam:e})=>sv(m,e),initialPageParam:``,getNextPageParam:e=>e.nextCursor||void 0,enabled:e}),le=hn({queryKey:wn,queryFn:()=>bn(`/api/dashboards`),refetchInterval:3e4,staleTime:bt}),ue=(0,w.useMemo)(()=>se.data?.pages.flatMap(e=>e.threads)??[],[se.data]),de=(0,w.useMemo)(()=>mv(ue),[ue]),fe=pt(`overview`,it({window:`1h`,namespace:``}),!!m&&!!l),pe=(0,w.useMemo)(()=>{if(!m)return[];let e=m.toLowerCase();return(fe.data?.data.services??[]).map(e=>e.service).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[fe.data,m]),me=(0,w.useMemo)(()=>{let e=le.data?.dashboards??[],t=m.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[le.data,m]);function he(e){ne(``),x(e.title),g(e)}async function _e(){if(h&&b.trim()){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(h.threadId)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:b.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await d.invalidateQueries({queryKey:Cn}),g(null)}catch(e){ne(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{ie(!1)}}}async function ve(){if(_){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(_.threadId)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=_.threadId;v(null),await d.invalidateQueries({queryKey:Cn}),o(t)}catch(e){ne(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{ie(!1)}}}return(0,T.jsxs)(ge,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[e&&(0,T.jsx)(ye,{leftSection:(0,T.jsx)(Xe,{size:16,weight:`bold`}),onClick:i,children:`New chat`}),(0,T.jsx)(Vt,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,T.jsxs)(ge,{gap:`lg`,pb:`sm`,children:[e&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(lv,{children:`Chats`}),se.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),se.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Chats could not be loaded.`}),!se.isLoading&&!se.isError&&ue.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:m?`No matching chats`:`No chats yet`}),de.map(e=>(0,T.jsxs)(ge,{gap:2,children:[de.length>1&&(0,T.jsx)(re,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,T.jsx)(uv,{thread:e,active:e.threadId===t,onSelect:()=>a(e.threadId),onRename:()=>he(e),onDelete:()=>{ne(``),v(e)}},e.threadId))]},e.label)),se.hasNextPage&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:se.isFetchingNextPage,onClick:()=>void se.fetchNextPage(),children:`See all`})]}),pe.length>0&&l&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(lv,{children:`Services`}),pe.map(e=>(0,T.jsx)(te,{className:`rail-row`,p:`sm`,onClick:()=>l(e),children:(0,T.jsx)(re,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(lv,{children:`Dashboards`}),le.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),le.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Dashboards could not be loaded.`}),!le.isLoading&&!le.isError&&m&&me.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:`No matching dashboards`}),me.map(e=>{let t=e.id===n;return(0,T.jsx)(te,{className:`rail-row`,"data-active":t||void 0,"aria-current":t?`page`:void 0,p:`sm`,onClick:()=>s(e.id),children:(0,T.jsxs)(ce,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.name}),e.is_default&&(0,T.jsx)(Ze,{size:`xs`,variant:`light`,color:`gray`,children:`Default`})]})},e.id)}),e&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,justify:`flex-start`,leftSection:(0,T.jsx)(It,{size:14,weight:`fill`}),onClick:c,children:`Create with AI`})]})]})}),(0,T.jsx)(Ae,{ref:oe,value:f,onChange:e=>p(e.currentTarget.value),leftSection:(0,T.jsx)(Y_,{size:15}),rightSection:(0,T.jsx)(Ro,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,T.jsx)(_n,{opened:h!==null,onClose:()=>!S&&g(null),title:`Rename chat`,centered:!0,children:(0,T.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),_e()},children:(0,T.jsxs)(ge,{children:[(0,T.jsx)(Ae,{label:`Name`,value:b,onChange:e=>x(e.currentTarget.value),maxLength:120,autoFocus:!0}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>g(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{type:`submit`,loading:S,disabled:!b.trim(),children:`Save`})]})]})})}),(0,T.jsx)(_n,{opened:_!==null,onClose:()=>!S&&v(null),title:`Delete chat?`,centered:!0,children:(0,T.jsxs)(ge,{children:[(0,T.jsxs)(re,{size:`sm`,children:[`This permanently removes `,(0,T.jsx)(re,{span:!0,fw:650,children:_?.title}),` and its saved messages.`]}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>v(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{color:`bad`,loading:S,onClick:()=>void ve(),children:`Delete`})]})]})})]})}function lv({children:e}){return(0,T.jsx)(re,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function uv({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,T.jsx)(xe,{"data-active":t||void 0,className:`rail-row`,children:(0,T.jsxs)(ce,{gap:2,wrap:`nowrap`,children:[(0,T.jsx)(te,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,T.jsxs)(ge,{gap:0,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.title}),(0,T.jsx)(re,{c:`dimmed`,size:`xs`,children:hv(e.updatedAt)})]})}),(0,T.jsxs)(Ft,{position:`bottom-end`,withinPortal:!0,children:[(0,T.jsx)(Ft.Target,{children:(0,T.jsx)(Mn,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,T.jsx)(Le,{size:18,weight:`bold`})})}),(0,T.jsxs)(Ft.Dropdown,{children:[(0,T.jsx)(Ft.Item,{leftSection:(0,T.jsx)($_,{size:15}),onClick:r,children:`Rename`}),(0,T.jsx)(Ft.Item,{color:`bad`,leftSection:(0,T.jsx)(st,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function dv(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function fv(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var pv=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function mv(e){let t=fv(new Date),n=new Map;for(let r of e){let e=Math.floor((t-fv(dv(r.updatedAt)))/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 pv.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function hv(e){let t=dv(e),n=fv(new Date);return Math.floor((n-fv(t))/864e5)<=1?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t):new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function gv({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=kn(),s=Ne(),c=da({select:e=>e.location.pathname}),{dashboardId:l}=We({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=pa(!1),[p,m]=(0,w.useState)(!1),[h,g]=(0,w.useState)(``),_=(0,w.useRef)(null),v=he(`(max-width: 62em)`),y=(0,w.useRef)(v);y.current=v,(0,w.useEffect)(()=>{f.close()},[c]),(0,w.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),y.current?(m(!0),f.open()):_.current?.focusSearch())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let b={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e}}),onCreateDashboard:()=>o(An),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)};return(0,T.jsxs)(to,{header:{height:52},navbar:{width:256,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,T.jsx)(to.Header,{children:(0,T.jsxs)(ce,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,T.jsxs)(ce,{gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(go,{hiddenFrom:`md`,opened:d,onClick:()=>{m(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,T.jsx)(ve,{size:`small`})]}),(0,T.jsxs)(ce,{gap:`xs`,wrap:`nowrap`,children:[(0,T.jsx)(Ht,{label:`Documentation`,children:(0,T.jsx)(Mn,{component:`a`,href:ov.home,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,"aria-label":`Documentation`,children:(0,T.jsx)(q_,{size:17,weight:`bold`})})}),(0,T.jsx)(_v,{}),(0,T.jsx)(vv,{onError:g})]})]})}),(0,T.jsx)(to.Navbar,{p:`sm`,children:(0,T.jsx)(cv,{ref:_,...b})}),(0,T.jsx)(Fo,{opened:d,onClose:f.close,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,T.jsx)(ve,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,T.jsx)(cv,{...b,autoFocusSearch:d&&p})}),(0,T.jsxs)(to.Main,{children:[h&&(0,T.jsx)(ae,{color:`bad`,m:`md`,withCloseButton:!0,onClose:()=>g(``),children:h}),e]})]})}function _v(){let{setColorScheme:e}=Wt(),t=Gt(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`,[r,i]=(0,w.useState)(!1);return(0,T.jsx)(Ht,{label:`Switch to ${n} theme`,opened:r,children:(0,T.jsx)(Mn,{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,T.jsx)(av,{size:17,weight:`bold`}):(0,T.jsx)(Z_,{size:17,weight:`bold`})})})}function vv({onError:e}){let t=Ne(),n=je(),r=(n.name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,T.jsxs)(Ft,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,T.jsx)(Ft.Target,{children:(0,T.jsx)(Mn,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`Account menu`,children:(0,T.jsx)(po,{size:26,radius:`xl`,color:`brand`,children:r})})}),(0,T.jsxs)(Ft.Dropdown,{children:[(0,T.jsx)(Ft.Label,{children:n.email||`Signed in`}),(0,T.jsx)(Ft.Item,{leftSection:(0,T.jsx)(tv,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,T.jsx)(Ft.Divider,{}),(0,T.jsx)(Ft.Item,{leftSection:(0,T.jsx)(rv,{size:15}),onClick:()=>void Ce().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function yv(){let{agent_available:e}=ke(),t=Ne(),n=nn(),{threadId:r}=We({strict:!1}),[i,a]=(0,w.useState)(Lt),o=(0,w.useRef)(new Set),s=r??i,[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)({}),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(``),[b,x]=(0,w.useState)(``),[ee,te]=(0,w.useState)(``),[ne,re]=(0,w.useState)(0),S=(0,w.useRef)(``),ie=(0,w.useRef)(null),ae=(0,w.useRef)(0),oe=(0,w.useMemo)(()=>new M_({url:`/api/agent`,threadId:s,fetch:(e,t)=>De(e,t)}),[s]),se=!e||f===s;function ce(){ae.current=0,y(``)}(0,w.useEffect)(()=>{let t=!0;if(l([]),d({}),p(``),h(!1),_(!1),ce(),te(``),!e){p(s);return}!r||o.current.has(s)?(oe.setMessages([]),p(s)):De(`/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}oe.setMessages(e.messages??[]),l([...e.messages??[]]),p(s)}}).catch(()=>{t&&(S.current=``,te(`This chat could not be restored. Start a new chat or try again.`))});let i=oe.subscribe({onEvent:({messages:e})=>l([...e]),onRunInitialized:()=>{_(!0),te(``)},onToolCallStartEvent:({event:e})=>{ae.current+=1,y(Nn(e.toolCallName))},onToolCallEndEvent:()=>{ae.current=Math.max(0,ae.current-1),ae.current===0&&y(``)},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),ce(),o.current.delete(s),n.invalidateQueries({queryKey:Cn})},onRunFailed:e=>{console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),ce(),o.current.delete(s),n.invalidateQueries({queryKey:Cn})}});return()=>{t=!1,i.unsubscribe(),oe.abortRun()}},[oe,e,n,ne,s]),(0,w.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(()=>ie.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>ie.current?.focus()))),e.key===`Escape`&&n===ie.current&&(x(``),ie.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function le(){_(!0),te(``);try{await oe.runAgent()}catch(e){console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),ce(),o.current.delete(s)}}async function ue(n){let i=n.trim();if(!e||!i||g||!se||m)return;r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let a={id:Lt(),role:`user`,content:i};oe.addMessage(a),l([...oe.messages]),d(e=>({...e,[a.id]:Date.now()})),x(``),await le()}(0,w.useEffect)(()=>{let e=S.current;se&&r&&e&&(S.current=``,ue(e))},[se,r,s]);function de(e){e.preventDefault(),ue(b)}function C(){oe.abortRun(),_(!1),ce(),o.current.delete(s)}function fe(){!g&&oe.messages.some(e=>e.role===`user`)&&le()}function pe(n){if(!e)return;let r=Lt();o.current.add(r),S.current=n??``,t({to:`/chat/$threadId`,params:{threadId:r}})}function me(){oe.abortRun(),S.current=``,a(Lt()),t({to:`/chat`})}function he(e){t({to:`/chat/$threadId`,params:{threadId:e}})}function ge(){re(e=>e+1)}return(0,T.jsx)(jn.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:se,running:g,activity:v,input:b,setInput:x,error:ee,inputRef:ie,send:ue,submit:de,stop:C,retry:fe,reloadThread:ge,openChat:pe,newThread:me,selectThread:he},children:(0,T.jsx)(gv,{children:(0,T.jsx)(ta,{})})})}function bv(){let e=(0,w.useMemo)(()=>new L_,[]);return(0,T.jsx)(Jt,{client:e,children:(0,T.jsx)(Me,{children:(0,T.jsx)(yv,{})})})}var xv=Ve({component:bv,notFoundComponent:()=>(0,T.jsx)(Oe,{to:`/`,replace:!0})}),Sv=Re(`/`)({component:qe(()=>Pn(()=>import(`./routes-D1xQhcK4.js`),__vite__mapDeps([0,1,2])),`component`)}),Cv=Re(`/settings`)({component:qe(()=>Pn(()=>import(`./settings-D20O7uBo.js`),__vite__mapDeps([3,1,2,4,5,6])),`component`)}),wv=Re(`/chat/`)({component:qe(()=>Pn(()=>import(`./chat.index-B6mb73V8.js`),__vite__mapDeps([7,8,1,4,9,10])),`component`)}),Tv=Re(`/chat/$threadId`)({component:qe(()=>Pn(()=>import(`./chat._threadId-B6mb73V8.js`),__vite__mapDeps([11,8,1,4,9,10])),`component`)}),Ev=Re(`/dashboards/`)({component:qe(()=>Pn(()=>import(`./dashboards.index-Bm8hpWIl.js`),__vite__mapDeps([12,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:lt}),Dv=Re(`/dashboards/$dashboardId`)({component:qe(()=>Pn(()=>import(`./dashboards._dashboardId-CMjPkGKO.js`),__vite__mapDeps([16,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:lt}),Ov=Sv.update({id:`/`,path:`/`,getParentRoute:()=>xv}),kv=Cv.update({id:`/settings`,path:`/settings`,getParentRoute:()=>xv}),Av=wv.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>xv}),jv=Tv.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>xv}),Mv=Ev.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>xv}),Nv={IndexRoute:Ov,SettingsRoute:kv,ChatThreadIdRoute:jv,DashboardsDashboardIdRoute:Dv.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>xv}),ChatIndexRoute:Av,DashboardsIndexRoute:Mv},Pv=sa({routeTree:xv._addFileChildren(Nv)._addFileTypes(),defaultPreload:`intent`,scrollRestoration:!0}),Fv={brand:Dt,ok:kt,warn:Nt,bad:xt,info:Ct},Iv={light:7,dark:5};function Lv(e){let t=e.replace(`#`,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=e=>{let t=parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(2)+.0722*r(4)}function Rv(e){let t=Lv(e),n=1.05/(t+.05);return(t+.05)/.05>n?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function zv(e){return Object.fromEntries(Object.entries(Fv).map(([t,n])=>[`--fanout-color-${t}-contrast`,Rv(n[Iv[e]])]))}function Bv(e){return t=>{let n=t.color??Uv.primaryColor,r=e({...t,color:n}),i=t.variant===`filled`||t.variant===void 0;return t.autoContrast===!1||!i||!Object.hasOwn(Fv,n)?r:{...r,color:`var(--fanout-color-${n}-contrast)`}}}var Vv=.25,Hv={xs:9,sm:10,md:11,lg:13,xl:16},Uv={primaryColor:`brand`,primaryShade:Iv,autoContrast:!0,luminanceThreshold:Vv,colors:{dark:jt,brand:Dt,ok:kt,warn:Nt,bad:xt,info:Ct},defaultRadius:`md`,fontFamily:at.body,fontFamilyMonospace:at.display,headings:{fontFamily:at.body,fontWeight:`600`},cursorType:`pointer`,components:{Tabs:{styles:(e,t)=>({tab:Kv(t.color,`--tabs-text-color`)})},Pagination:{styles:(e,t)=>({control:Kv(t.color,`--pagination-active-color`)})},Badge:{vars:(e,t)=>({root:Gv(t.size)})}}},Wv=()=>({variables:{"--mantine-color-error":`var(--mantine-color-bad-filled)`},light:{"--mantine-color-dimmed":mt.light.muted,...zv(`light`)},dark:zv(`dark`)});function Gv(e){let t=Hv[e??`md`];return t===void 0||t>=vt.micro?{}:{"--badge-fz":`${vt.micro/16}rem`}}function Kv(e,t){return!e||e===Uv.primaryColor?{[t]:`var(--fanout-color-${Uv.primaryColor}-contrast)`}:{}}var qv=Bv(h),Jv=ja({...Uv,variantColorResolver:qv});(0,Ac.createRoot)(document.getElementById(`root`)).render((0,T.jsx)(w.StrictMode,{children:(0,T.jsx)(Aa,{theme:Jv,defaultColorScheme:`auto`,cssVariablesResolver:Wv,children:(0,T.jsx)(ua,{router:Pv})})}));export{Ev as n,ov as r,Dv as t}; \ No newline at end of file +`)},t_=(e,t,n)=>r=>{let i={},a=!0,o=!0,s=``,c=null,l=null,u=[],d={},f=e=>{typeof e==`object`&&e&&(`messages`in e&&delete e.messages,i=e)};return r.pipe(bf(r=>{switch(r.type){case B.TEXT_MESSAGE_START:{let e=r;return[{type:Qg.enum.TextMessageStart,messageId:e.messageId,role:e.role}]}case B.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:Qg.enum.TextMessageContent,messageId:e.messageId,content:e.delta}]}case B.TEXT_MESSAGE_END:{let e=r;return[{type:Qg.enum.TextMessageEnd,messageId:e.messageId}]}case B.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:Qg.enum.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case B.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let p=!1;if(l){let e=l.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(Mf(d.function.arguments));e.tool_argument&&e.tool_argument in t?(f({...i,[e.state_key]:t[e.tool_argument]}),p=!0):e.tool_argument||(f({...i,[e.state_key]:t}),p=!0)}catch{}}return[{type:Qg.enum.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...p?[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case B.TOOL_CALL_END:{let e=r;return[{type:Qg.enum.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case B.TOOL_CALL_RESULT:{let e=r;return[{type:Qg.enum.ActionExecutionResult,actionExecutionId:e.toolCallId,result:e.content,actionName:d[e.toolCallId]||`unknown`}]}case B.RAW:return[];case B.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:Qg.enum.MetaEvent,name:e.name,value:e.value}]}case B.STATE_SNAPSHOT:return f(r.snapshot),[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case B.STATE_DELTA:{let c=r,l=Nu.applyPatch(i,c.delta,!0,!1);return l?(f(l.newDocument),[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]):[]}case B.MESSAGES_SNAPSHOT:return c=r.messages,[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case B.RUN_STARTED:return[];case B.RUN_FINISHED:return c&&(i.messages=c),Object.keys(i).length===0?[]:[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:n_(c)}:{}}),active:!1}];case B.RUN_ERROR:{let e=r;return[{type:Qg.enum.RunError,message:e.message,code:e.code}]}case B.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case B.STEP_FINISHED:return u=[],l=null,[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function n_(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=e_(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={id:e.id,name:e.function.name,arguments:JSON.parse(e.function.arguments),parentMessageId:n.id};t.push(r)}}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:n.content,actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var r_=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,i_=e=>e===`tool`?`toolCallId`:`messageId`,a_=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},o_=e=>t=>{let n=Bg(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:B.TEXT_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TEXT_MESSAGE_END`,e,{messageId:e.messageId}),[e]}case`tool`:{let e={type:B.TOOL_CALL_END,toolCallId:t.fields.toolCallId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TOOL_CALL_END`,e,{toolCallId:e.toolCallId}),[e]}case`reasoning`:{let e={type:B.REASONING_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{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&&r_(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 ${i_(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(bf(e=>{switch(e.type){case B.TEXT_MESSAGE_START:case B.TEXT_MESSAGE_CONTENT:case B.TEXT_MESSAGE_END:case B.TOOL_CALL_START:case B.TOOL_CALL_ARGS:case B.TOOL_CALL_END:case B.TOOL_CALL_RESULT:case B.STATE_SNAPSHOT:case B.STATE_DELTA:case B.CUSTOM:case B.STEP_STARTED:case B.STEP_FINISHED:case B.THINKING_START:case B.THINKING_END:case B.THINKING_TEXT_MESSAGE_START:case B.THINKING_TEXT_MESSAGE_CONTENT:case B.THINKING_TEXT_MESSAGE_END:case B.REASONING_START:case B.REASONING_MESSAGE_START:case B.REASONING_MESSAGE_CONTENT:case B.REASONING_MESSAGE_END:case B.REASONING_END:return[...i(e.subagentRunId??void 0),e];case B.RUN_STARTED:case B.RUN_FINISHED:case B.RUN_ERROR:case B.MESSAGES_SNAPSHOT:return[...a(),e];case B.RAW:case B.ACTIVITY_SNAPSHOT:case B.ACTIVITY_DELTA:case B.REASONING_ENCRYPTED_VALUE:case B.SUBAGENT_STARTED:return[e];case B.SUBAGENT_FINISHED:case B.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case B.TEXT_MESSAGE_CHUNK:{let t=e,a=s(`text`,t.messageId,t.subagentRunId??void 0,`TEXT_MESSAGE_CHUNK`,`text message`),o=r.get(a),c=[],l;if(o?.kind===`text`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First TEXT_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,name:t.name,subagentRunId:t.subagentRunId},r.set(a,{kind:`text`,fields:l});let e=a_({type:B.TEXT_MESSAGE_START,messageId:t.messageId,role:t.role||`assistant`,...t.name!==void 0&&{name:t.name},...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TEXT_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=a_({type:B.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TEXT_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:B.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case B.TOOL_CALL_CHUNK:{let t=e,a=s(`tool`,t.toolCallId,t.subagentRunId??void 0,`TOOL_CALL_CHUNK`,`tool call`),o=r.get(a),c=[],l;if(o?.kind===`tool`&&(t.toolCallId===void 0||t.toolCallId===o.fields.toolCallId))l=o.fields;else{if(c.push(...i(a)),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`);l={toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`tool`,fields:l});let e=a_({type:B.TOOL_CALL_START,toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TOOL_CALL_START`,e,{toolCallId:t.toolCallId,toolCallName:t.toolCallName})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=a_({type:B.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TOOL_CALL_ARGS`,r,{toolCallId:l.toolCallId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:B.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case B.REASONING_MESSAGE_CHUNK:{let t=e,a=s(`reasoning`,t.messageId,t.subagentRunId??void 0,`REASONING_MESSAGE_CHUNK`,`reasoning message`),o=r.get(a),c=[],l;if(o?.kind===`reasoning`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First REASONING_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`reasoning`,fields:l});let e=a_({type:B.REASONING_MESSAGE_START,messageId:t.messageId,role:`reasoning`,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`REASONING_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=a_({type:B.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`REASONING_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:B.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}}return e.type,[]}),Df(()=>{a()}))};function s_(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}var c_=class{runNext(e,t){return t.run(e).pipe(o_(!1))}runNextWithState(e,t){let n=Ng(e.messages||[]),r=Ng(e.state||{}),i=new Pd;return Gg(e,i,t,[]).subscribe(e=>{e.messages!==void 0&&(n=e.messages),e.state!==void 0&&(r=e.state)}),this.runNext(e,t).pipe(Tf(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:Ng(n),state:Ng(r)})))}},l_=class extends c_{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function u_(e){let t=e.content;if(Array.isArray(t)){let n=t.filter(e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``);return{...e,content:n}}return typeof t==`string`?e:{...e,content:``}}var d_=class extends c_{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(u_)};return this.runNext(i,t)}},f_=`THINKING_START`,p_=`THINKING_END`,m_=`THINKING_TEXT_MESSAGE_START`,h_=`THINKING_TEXT_MESSAGE_CONTENT`,g_=`THINKING_TEXT_MESSAGE_END`,__=class extends c_{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(vf(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case f_:{this.currentReasoningId=Pg();let{title:t,...n}=e;return this.warnAboutTransformation(f_,B.REASONING_START),{...n,type:B.REASONING_START,messageId:this.currentReasoningId}}case m_:return this.currentMessageId=Pg(),this.warnAboutTransformation(m_,B.REASONING_MESSAGE_START),{...e,type:B.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`assistant`};case h_:{let{delta:t,...n}=e;return this.warnAboutTransformation(h_,B.REASONING_MESSAGE_CONTENT),{...n,type:B.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Pg(),delta:t}}case g_:{let t=this.currentMessageId??Pg();return this.warnAboutTransformation(g_,B.REASONING_MESSAGE_END),{...e,type:B.REASONING_MESSAGE_END,messageId:t}}case p_:{let t=this.currentReasoningId??Pg();return this.warnAboutTransformation(p_,B.REASONING_END),{...e,type:B.REASONING_END,messageId:t}}default:return e}}};function v_(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function y_(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function b_(e){let t=v_(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}}:{}}:e}function x_(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>y_(e)?b_(e):e);return{...e,content:n}}var S_=class extends c_{run(e,t){let n={...e,messages:e.messages.map(x_)};return this.runNext(n,t)}},C_=`SUBAGENT_STARTED`,w_=`SUBAGENT_FINISHED`,T_=`SUBAGENT_ERROR`;function E_(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function D_(e){return e.map(e=>E_(e))}var O_=class extends c_{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=>E_(e))};return this.runNext(n,t).pipe(Af(e=>{let t=e.type;(t===C_||t===w_||t===T_)&&this.warnDroppedLifecycleEvent(t)}),Cf(e=>{let t=e.type;return t!==C_&&t!==w_&&t!==T_}),vf(e=>{let t=E_(e);if(t.type===B.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:D_(e.messages)}}if(t.type===B.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>E_(e))}}}if(t.type===B.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:D_(e.input.messages)}}}return t}))}},k_=`0.0.59`,A_=class{get maxVersion(){return k_}get debug(){return this._debug}set debug(e){this._debug=zg(e),this._debugLogger=Hg(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?Hg(zg(!0)):void 0:e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??``,this.threadId=n??Go(),this.messages=Ng(r??[]),this.state=Ng(i??{}),this._debug=zg(a),this._debugLogger=Hg(this._debug),Mg(this.maxVersion,`0.0.39`)<=0&&this.middlewares.unshift(new d_),Mg(this.maxVersion,`0.0.45`)<=0&&this.middlewares.unshift(new __),Mg(this.maxVersion,`0.0.47`)<=0&&this.middlewares.unshift(new S_),Mg(this.maxVersion,`0.0.57`)<=0&&this.middlewares.unshift(new O_)}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 l_(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();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=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new jd;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await _f(bd(()=>this.middlewares.length===0?this.run(n):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),o_(this.debugLogger),Kg(this.debugLogger),e=>e.pipe(kf(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),wf(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))),Df(()=>{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}))(hf(null)));let s=Ng(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new Qc}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new jd;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await _f(bd(()=>Sf(()=>this.connect(n)),o_(this.debugLogger),Kg(this.debugLogger),e=>e.pipe(kf(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),wf(e=>(this.isRunning=!1,e instanceof Qc?Fd:this.onError(n,e,a))),Df(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(hf(null)),{defaultValue:void 0});let s=Ng(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}apply(e,t,n){return Gg(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(Af(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Ng(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=t.filter(e=>e.role!==`activity`);return{threadId:this.threadId,runId:e?.runId||Go(),tools:Ng(e?.tools??[]),context:Ng(e?.context??[]),forwardedProps:Ng(e?.forwardedProps??{}),state:Ng(this.state),messages:n,...e?.resume===void 0?{}:{resume:Ng(e.resume)}}}async onInitialize(e,t){if(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 z(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let e of this.pendingInterrupts)if(s_(e))throw new z(`Interrupt ${e.id} expired at ${e.expiresAt}`)}let n=await Rg(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){this.messages=n.messages;for(let e of n.messages)e.subagentRunId===null&&delete e.subagentRunId;e.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})}n.state&&(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 mf(Rg(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(vf(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 Rg(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=Ng(this.messages),e.state=Ng(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Ng(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=Ng(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=Ng(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??Go();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t)).pipe(o_(this.debugLogger),Kg(this.debugLogger),t_(this.threadId,t.runId,this.agentId),e=>e.pipe(vf(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function j_(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 M_=class extends A_{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(j_(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=Ng(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return Zg(Jg(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Ng(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}},N_=class extends un{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:Tn(t,n.data),hasPreviousPage:dn(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},P_=class extends mn{#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 xn({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=F_(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=F_(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=F_(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=F_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Sn.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=>On(t,e))}findAll(e={}){return this.getAll().filter(t=>On(e,t))}notify(e){Sn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Sn.batch(()=>Promise.all(e.map(e=>e.continue().catch(Dn))))}};function F_(e){return e.options.scope?.id}var I_=class extends mn{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??En(r,t),a=this.get(i);return a||(a=new vn({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){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Sn.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=>ln(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ln(e,t)):t}notify(e){Sn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Sn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Sn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},L_=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new I_,this.#t=e.mutationCache||new P_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=yn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=fn.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(qt(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=pn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Sn.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;Sn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Sn.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=Sn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Dn).catch(Dn)}invalidateQueries(e,t={}){return Sn.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=Sn.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(Dn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Dn)}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(qt(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(qt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Dn).catch(Dn)}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(Dn).catch(Dn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return fn.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(sn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{on(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(sn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{on(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||=En(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===Yt&&(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 R_(e,t){return cn(e,N_,t)}var z_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),B_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),V_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),H_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),U_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),W_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),G_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),K_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:z_}));K_.displayName=`BookOpenIcon`;var q_=K_,J_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:B_}));J_.displayName=`MagnifyingGlassIcon`;var Y_=J_,X_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:V_}));X_.displayName=`MoonIcon`;var Z_=X_,Q_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:H_}));Q_.displayName=`PencilSimpleIcon`;var $_=Q_,ev=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:U_}));ev.displayName=`PlugsConnectedIcon`;var tv=ev,nv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:W_}));nv.displayName=`SignOutIcon`;var rv=nv,iv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:G_}));iv.displayName=`SunIcon`;var av=iv,ov={home:`https://fanout.run/start/what-fanout-is`,ingest:`https://fanout.run/start/send-telemetry`};async function sv(e,t){let n=new URLSearchParams({limit:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await De(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function cv({agentAvailable:e,activeThreadID:t,activeDashboardID:n,autoFocusSearch:r=!1,onNewChat:i,onSelectThread:a,onDeletedThread:o,onSelectDashboard:s,onCreateDashboard:c,onInvestigateService:l,ref:u}){let d=nn(),[f,p]=(0,w.useState)(``),[m]=fa(f.trim(),250),[h,g]=(0,w.useState)(null),[_,v]=(0,w.useState)(null),[b,x]=(0,w.useState)(``),[ee,ne]=(0,w.useState)(``),[S,ie]=(0,w.useState)(!1),oe=(0,w.useRef)(null);(0,w.useImperativeHandle)(u,()=>({focusSearch:()=>oe.current?.focus()}),[]),(0,w.useEffect)(()=>{r&&requestAnimationFrame(()=>oe.current?.focus())},[r]);let se=R_({queryKey:[...Cn,m],queryFn:({pageParam:e})=>sv(m,e),initialPageParam:``,getNextPageParam:e=>e.nextCursor||void 0,enabled:e}),le=hn({queryKey:wn,queryFn:()=>bn(`/api/dashboards`),refetchInterval:3e4,staleTime:bt}),ue=(0,w.useMemo)(()=>se.data?.pages.flatMap(e=>e.threads)??[],[se.data]),de=(0,w.useMemo)(()=>mv(ue),[ue]),fe=pt(`overview`,it({window:`1h`,namespace:``}),!!m&&!!l),pe=(0,w.useMemo)(()=>{if(!m)return[];let e=m.toLowerCase();return(fe.data?.data.services??[]).map(e=>e.service).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[fe.data,m]),me=(0,w.useMemo)(()=>{let e=le.data?.dashboards??[],t=m.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[le.data,m]);function he(e){ne(``),x(e.title),g(e)}async function _e(){if(h&&b.trim()){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(h.threadId)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:b.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await d.invalidateQueries({queryKey:Cn}),g(null)}catch(e){ne(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{ie(!1)}}}async function ve(){if(_){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(_.threadId)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=_.threadId;v(null),await d.invalidateQueries({queryKey:Cn}),o(t)}catch(e){ne(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{ie(!1)}}}return(0,T.jsxs)(ge,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[e&&(0,T.jsx)(ye,{leftSection:(0,T.jsx)(Xe,{size:16,weight:`bold`}),onClick:i,children:`New chat`}),(0,T.jsx)(Vt,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,T.jsxs)(ge,{gap:`lg`,pb:`sm`,children:[e&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(lv,{children:`Chats`}),se.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),se.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Chats could not be loaded.`}),!se.isLoading&&!se.isError&&ue.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:m?`No matching chats`:`No chats yet`}),de.map(e=>(0,T.jsxs)(ge,{gap:2,children:[de.length>1&&(0,T.jsx)(re,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,T.jsx)(uv,{thread:e,active:e.threadId===t,onSelect:()=>a(e.threadId),onRename:()=>he(e),onDelete:()=>{ne(``),v(e)}},e.threadId))]},e.label)),se.hasNextPage&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:se.isFetchingNextPage,onClick:()=>void se.fetchNextPage(),children:`See all`})]}),pe.length>0&&l&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(lv,{children:`Services`}),pe.map(e=>(0,T.jsx)(te,{className:`rail-row`,p:`sm`,onClick:()=>l(e),children:(0,T.jsx)(re,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(lv,{children:`Dashboards`}),le.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),le.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Dashboards could not be loaded.`}),!le.isLoading&&!le.isError&&m&&me.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:`No matching dashboards`}),me.map(e=>{let t=e.id===n;return(0,T.jsx)(te,{className:`rail-row`,"data-active":t||void 0,"aria-current":t?`page`:void 0,p:`sm`,onClick:()=>s(e.id),children:(0,T.jsxs)(ce,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.name}),e.is_default&&(0,T.jsx)(Ze,{size:`xs`,variant:`light`,color:`gray`,children:`Default`})]})},e.id)}),e&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,justify:`flex-start`,leftSection:(0,T.jsx)(It,{size:14,weight:`fill`}),onClick:c,children:`Create with AI`})]})]})}),(0,T.jsx)(Ae,{ref:oe,value:f,onChange:e=>p(e.currentTarget.value),leftSection:(0,T.jsx)(Y_,{size:15}),rightSection:(0,T.jsx)(Ro,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,T.jsx)(_n,{opened:h!==null,onClose:()=>!S&&g(null),title:`Rename chat`,centered:!0,children:(0,T.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),_e()},children:(0,T.jsxs)(ge,{children:[(0,T.jsx)(Ae,{label:`Name`,value:b,onChange:e=>x(e.currentTarget.value),maxLength:120,autoFocus:!0}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>g(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{type:`submit`,loading:S,disabled:!b.trim(),children:`Save`})]})]})})}),(0,T.jsx)(_n,{opened:_!==null,onClose:()=>!S&&v(null),title:`Delete chat?`,centered:!0,children:(0,T.jsxs)(ge,{children:[(0,T.jsxs)(re,{size:`sm`,children:[`This permanently removes `,(0,T.jsx)(re,{span:!0,fw:650,children:_?.title}),` and its saved messages.`]}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>v(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{color:`bad`,loading:S,onClick:()=>void ve(),children:`Delete`})]})]})})]})}function lv({children:e}){return(0,T.jsx)(re,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function uv({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,T.jsx)(xe,{"data-active":t||void 0,className:`rail-row`,children:(0,T.jsxs)(ce,{gap:2,wrap:`nowrap`,children:[(0,T.jsx)(te,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,T.jsxs)(ge,{gap:0,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.title}),(0,T.jsx)(re,{c:`dimmed`,size:`xs`,children:hv(e.updatedAt)})]})}),(0,T.jsxs)(Ft,{position:`bottom-end`,withinPortal:!0,children:[(0,T.jsx)(Ft.Target,{children:(0,T.jsx)(Mn,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,T.jsx)(Le,{size:18,weight:`bold`})})}),(0,T.jsxs)(Ft.Dropdown,{children:[(0,T.jsx)(Ft.Item,{leftSection:(0,T.jsx)($_,{size:15}),onClick:r,children:`Rename`}),(0,T.jsx)(Ft.Item,{color:`bad`,leftSection:(0,T.jsx)(st,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function dv(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function fv(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var pv=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function mv(e){let t=fv(new Date),n=new Map;for(let r of e){let e=Math.floor((t-fv(dv(r.updatedAt)))/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 pv.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function hv(e){let t=dv(e),n=fv(new Date);return Math.floor((n-fv(t))/864e5)<=1?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t):new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function gv({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=kn(),s=Ne(),c=da({select:e=>e.location.pathname}),{dashboardId:l}=We({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=pa(!1),[p,m]=(0,w.useState)(!1),[h,g]=(0,w.useState)(``),_=(0,w.useRef)(null),v=he(`(max-width: 62em)`),y=(0,w.useRef)(v);y.current=v,(0,w.useEffect)(()=>{f.close()},[c]),(0,w.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),y.current?(m(!0),f.open()):_.current?.focusSearch())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let b={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e}}),onCreateDashboard:()=>o(An),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)};return(0,T.jsxs)(to,{header:{height:52},navbar:{width:256,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,T.jsx)(to.Header,{children:(0,T.jsxs)(ce,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,T.jsxs)(ce,{gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(go,{hiddenFrom:`md`,opened:d,onClick:()=>{m(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,T.jsx)(ve,{size:`small`})]}),(0,T.jsxs)(ce,{gap:`xs`,wrap:`nowrap`,children:[(0,T.jsx)(Ht,{label:`Documentation`,children:(0,T.jsx)(Mn,{component:`a`,href:ov.home,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,"aria-label":`Documentation`,children:(0,T.jsx)(q_,{size:17,weight:`bold`})})}),(0,T.jsx)(_v,{}),(0,T.jsx)(vv,{onError:g})]})]})}),(0,T.jsx)(to.Navbar,{p:`sm`,children:(0,T.jsx)(cv,{ref:_,...b})}),(0,T.jsx)(Fo,{opened:d,onClose:f.close,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,T.jsx)(ve,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,T.jsx)(cv,{...b,autoFocusSearch:d&&p})}),(0,T.jsxs)(to.Main,{children:[h&&(0,T.jsx)(ae,{color:`bad`,m:`md`,withCloseButton:!0,onClose:()=>g(``),children:h}),e]})]})}function _v(){let{setColorScheme:e}=Wt(),t=Gt(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`,[r,i]=(0,w.useState)(!1);return(0,T.jsx)(Ht,{label:`Switch to ${n} theme`,opened:r,children:(0,T.jsx)(Mn,{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,T.jsx)(av,{size:17,weight:`bold`}):(0,T.jsx)(Z_,{size:17,weight:`bold`})})})}function vv({onError:e}){let t=Ne(),n=je(),r=(n.name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,T.jsxs)(Ft,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,T.jsx)(Ft.Target,{children:(0,T.jsx)(Mn,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`Account menu`,children:(0,T.jsx)(po,{size:26,radius:`xl`,color:`brand`,children:r})})}),(0,T.jsxs)(Ft.Dropdown,{children:[(0,T.jsx)(Ft.Label,{children:n.email||`Signed in`}),(0,T.jsx)(Ft.Item,{leftSection:(0,T.jsx)(tv,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,T.jsx)(Ft.Divider,{}),(0,T.jsx)(Ft.Item,{leftSection:(0,T.jsx)(rv,{size:15}),onClick:()=>void Ce().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function yv(){let{agent_available:e}=ke(),t=Ne(),n=nn(),{threadId:r}=We({strict:!1}),[i,a]=(0,w.useState)(Lt),o=(0,w.useRef)(new Set),s=r??i,[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)({}),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(``),[b,x]=(0,w.useState)(``),[ee,te]=(0,w.useState)(``),[ne,re]=(0,w.useState)(0),S=(0,w.useRef)(``),ie=(0,w.useRef)(null),ae=(0,w.useRef)(0),oe=(0,w.useMemo)(()=>new M_({url:`/api/agent`,threadId:s,fetch:(e,t)=>De(e,t)}),[s]),se=!e||f===s;function ce(){ae.current=0,y(``)}(0,w.useEffect)(()=>{let t=!0;if(l([]),d({}),p(``),h(!1),_(!1),ce(),te(``),!e){p(s);return}!r||o.current.has(s)?(oe.setMessages([]),p(s)):De(`/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}oe.setMessages(e.messages??[]),l([...e.messages??[]]),p(s)}}).catch(()=>{t&&(S.current=``,te(`This chat could not be restored. Start a new chat or try again.`))});let i=oe.subscribe({onEvent:({messages:e})=>l([...e]),onRunInitialized:()=>{_(!0),te(``)},onToolCallStartEvent:({event:e})=>{ae.current+=1,y(Nn(e.toolCallName))},onToolCallEndEvent:()=>{ae.current=Math.max(0,ae.current-1),ae.current===0&&y(``)},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),ce(),o.current.delete(s),n.invalidateQueries({queryKey:Cn})},onRunFailed:e=>{console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),ce(),o.current.delete(s),n.invalidateQueries({queryKey:Cn})}});return()=>{t=!1,i.unsubscribe(),oe.abortRun()}},[oe,e,n,ne,s]),(0,w.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(()=>ie.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>ie.current?.focus()))),e.key===`Escape`&&n===ie.current&&(x(``),ie.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function le(){_(!0),te(``);try{await oe.runAgent()}catch(e){console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),ce(),o.current.delete(s)}}async function ue(n){let i=n.trim();if(!e||!i||g||!se||m)return;r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let a={id:Lt(),role:`user`,content:i};oe.addMessage(a),l([...oe.messages]),d(e=>({...e,[a.id]:Date.now()})),x(``),await le()}(0,w.useEffect)(()=>{let e=S.current;se&&r&&e&&(S.current=``,ue(e))},[se,r,s]);function de(e){e.preventDefault(),ue(b)}function C(){oe.abortRun(),_(!1),ce(),o.current.delete(s)}function fe(){!g&&oe.messages.some(e=>e.role===`user`)&&le()}function pe(n){if(!e)return;let r=Lt();o.current.add(r),S.current=n??``,t({to:`/chat/$threadId`,params:{threadId:r}})}function me(){oe.abortRun(),S.current=``,a(Lt()),t({to:`/chat`})}function he(e){t({to:`/chat/$threadId`,params:{threadId:e}})}function ge(){re(e=>e+1)}return(0,T.jsx)(jn.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:se,running:g,activity:v,input:b,setInput:x,error:ee,inputRef:ie,send:ue,submit:de,stop:C,retry:fe,reloadThread:ge,openChat:pe,newThread:me,selectThread:he},children:(0,T.jsx)(gv,{children:(0,T.jsx)(ta,{})})})}function bv(){let e=(0,w.useMemo)(()=>new L_,[]);return(0,T.jsx)(Jt,{client:e,children:(0,T.jsx)(Me,{children:(0,T.jsx)(yv,{})})})}var xv=Ve({component:bv,notFoundComponent:()=>(0,T.jsx)(Oe,{to:`/`,replace:!0})}),Sv=Re(`/`)({component:qe(()=>Pn(()=>import(`./routes-VCBnBbPZ.js`),__vite__mapDeps([0,1,2])),`component`)}),Cv=Re(`/settings`)({component:qe(()=>Pn(()=>import(`./settings-BTUR4pT4.js`),__vite__mapDeps([3,1,2,4,5,6])),`component`)}),wv=Re(`/chat/`)({component:qe(()=>Pn(()=>import(`./chat.index-DYB6vKSb.js`),__vite__mapDeps([7,8,1,4,9,10])),`component`)}),Tv=Re(`/chat/$threadId`)({component:qe(()=>Pn(()=>import(`./chat._threadId-DYB6vKSb.js`),__vite__mapDeps([11,8,1,4,9,10])),`component`)}),Ev=Re(`/dashboards/`)({component:qe(()=>Pn(()=>import(`./dashboards.index-D2SA6vFv.js`),__vite__mapDeps([12,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:lt}),Dv=Re(`/dashboards/$dashboardId`)({component:qe(()=>Pn(()=>import(`./dashboards._dashboardId-rFBmUOpC.js`),__vite__mapDeps([16,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:lt}),Ov=Sv.update({id:`/`,path:`/`,getParentRoute:()=>xv}),kv=Cv.update({id:`/settings`,path:`/settings`,getParentRoute:()=>xv}),Av=wv.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>xv}),jv=Tv.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>xv}),Mv=Ev.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>xv}),Nv={IndexRoute:Ov,SettingsRoute:kv,ChatThreadIdRoute:jv,DashboardsDashboardIdRoute:Dv.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>xv}),ChatIndexRoute:Av,DashboardsIndexRoute:Mv},Pv=sa({routeTree:xv._addFileChildren(Nv)._addFileTypes(),defaultPreload:`intent`,scrollRestoration:!0}),Fv={brand:Dt,ok:kt,warn:Nt,bad:xt,info:Ct},Iv={light:7,dark:5};function Lv(e){let t=e.replace(`#`,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=e=>{let t=parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(2)+.0722*r(4)}function Rv(e){let t=Lv(e),n=1.05/(t+.05);return(t+.05)/.05>n?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function zv(e){return Object.fromEntries(Object.entries(Fv).map(([t,n])=>[`--fanout-color-${t}-contrast`,Rv(n[Iv[e]])]))}function Bv(e){return t=>{let n=t.color??Uv.primaryColor,r=e({...t,color:n}),i=t.variant===`filled`||t.variant===void 0;return t.autoContrast===!1||!i||!Object.hasOwn(Fv,n)?r:{...r,color:`var(--fanout-color-${n}-contrast)`}}}var Vv=.25,Hv={xs:9,sm:10,md:11,lg:13,xl:16},Uv={primaryColor:`brand`,primaryShade:Iv,autoContrast:!0,luminanceThreshold:Vv,colors:{dark:jt,brand:Dt,ok:kt,warn:Nt,bad:xt,info:Ct},defaultRadius:`md`,fontFamily:at.body,fontFamilyMonospace:at.display,headings:{fontFamily:at.body,fontWeight:`600`},cursorType:`pointer`,components:{Tabs:{styles:(e,t)=>({tab:Kv(t.color,`--tabs-text-color`)})},Pagination:{styles:(e,t)=>({control:Kv(t.color,`--pagination-active-color`)})},Badge:{vars:(e,t)=>({root:Gv(t.size)})}}},Wv=()=>({variables:{"--mantine-color-error":`var(--mantine-color-bad-filled)`},light:{"--mantine-color-dimmed":mt.light.muted,...zv(`light`)},dark:zv(`dark`)});function Gv(e){let t=Hv[e??`md`];return t===void 0||t>=vt.micro?{}:{"--badge-fz":`${vt.micro/16}rem`}}function Kv(e,t){return!e||e===Uv.primaryColor?{[t]:`var(--fanout-color-${Uv.primaryColor}-contrast)`}:{}}var qv=Bv(h),Jv=ja({...Uv,variantColorResolver:qv});(0,Ac.createRoot)(document.getElementById(`root`)).render((0,T.jsx)(w.StrictMode,{children:(0,T.jsx)(Aa,{theme:Jv,defaultColorScheme:`auto`,cssVariablesResolver:Wv,children:(0,T.jsx)(ua,{router:Pv})})}));export{Ev as n,ov as r,Dv as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/mcp-app-frame-BZJusU6-.js b/internal/ui/dist/assets/mcp-app-frame-GqrqdVoY.js similarity index 99% rename from internal/ui/dist/assets/mcp-app-frame-BZJusU6-.js rename to internal/ui/dist/assets/mcp-app-frame-GqrqdVoY.js index c54e4b0bc..79cb2f9a7 100644 --- a/internal/ui/dist/assets/mcp-app-frame-BZJusU6-.js +++ b/internal/ui/dist/assets/mcp-app-frame-GqrqdVoY.js @@ -1,4 +1,4 @@ -import{St as e,_ as t,_t as n,bt as r,d as i,f as a,gt as o,l as s,mt as c,vt as l,x as u,xt as d,yt as f}from"./brand-MzZ03bSa.js";import{i as p}from"./auth-BeUORN-q.js";import{t as m}from"./use-computed-color-scheme-6JIsge00.js";function h(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function g(e,t=`|`){return e.map(e=>se(e)).join(t)}function _(e,t){return typeof t==`bigint`?t.toString():t}function v(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function y(e){return e==null}function b(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function x(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r){};function w(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var re=v(()=>{if(Ke.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function T(e){if(w(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return w(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ie(e){return T(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ae=new Set([`string`,`number`,`symbol`]);function oe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function E(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function D(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function se(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function ce(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var le={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ue(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return E(e,C(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&S(e,r,n.shape[r])}return S(this,`shape`,e),e},checks:[]}))}function de(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return E(e,C(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return S(this,`shape`,r),r},checks:[]}))}function fe(e,t){if(!T(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return E(e,C(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return S(this,`shape`,n),n}}))}function pe(e,t){if(!T(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return E(e,C(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return S(this,`shape`,n),n}}))}function me(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return E(e,C(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return S(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function he(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);return E(t,C(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return S(this,`shape`,i),i},checks:[]}))}function ge(e,t,n){return E(t,C(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return S(this,`shape`,i),i}}))}function _e(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function be(e){return typeof e==`string`?e:e?.message}function xe(e,t,n){var r;for(let i=t;ie;return t[Le]=!0,t}var ze,Be=Object.freeze({status:`aborted`}),Ve={value:void 0,enumerable:!1},He=`captureStackTrace`in Error?Error:null;function Ue(e){let t=He;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return He=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function k(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Ve.value=new a(r);try{Object.defineProperty(n,"_zod",Ve)}finally{Ve.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Oe(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Ue(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var We=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ge=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ze=globalThis).__zod_globalConfig??(ze.__zod_globalConfig={});var Ke=globalThis.__zod_globalConfig;function qe(e){return e&&Object.assign(Ke,e),Ke}function Je(){let e=this._zod;return e.message??=JSON.stringify(e.def,_,2),e.message}function Ye(e){this._zod.message=e}var Xe={get:Je,set:Ye,enumerable:!0,configurable:!0},Ze={value:void 0,enumerable:!1},Qe={value:void 0,enumerable:!1},$e=new WeakSet([Object.prototype,Error.prototype]),et=(e,t)=>{e.name=`$ZodError`,Ze.value=e._zod,Object.defineProperty(e,"_zod",Ze),Qe.value=t,Object.defineProperty(e,"issues",Qe),Ze.value=void 0,Qe.value=void 0,Object.defineProperty(e,"message",Xe);let n=Object.getPrototypeOf(e);$e.has(n)||($e.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},tt=k(`$ZodError`,et),nt=k(`$ZodError`,et,void 0,{Parent:Error});function rt(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function it(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?rt(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function at(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new We;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Se(e,o,qe())));throw ne(n,a?.callee??t),n}return s.value};return t},ct=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Se(e,o,qe())));throw ne(n,a?.callee??t),n}return s.value};return t},lt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new We;return a.issues.length?{success:!1,error:new(e??tt)(a.issues.map(e=>Se(e,i,qe())))}:{success:!0,data:a.value}},ut=lt(nt),dt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Se(e,i,qe())))}:{success:!0,data:a.value}},ft=dt(nt),pt=e=>{let t=st(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,ot(n,a))};return n},mt=e=>{let t=st(e),n=(e,r,i,a)=>t(e,r,i,ot(n,a));return n},ht=e=>{let t=ct(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,ot(n,a))};return n},gt=e=>{let t=ct(e),n=async(e,r,i,a)=>await t(e,r,i,ot(n,a));return n},_t=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return lt(e)(t,n,i)},vt=e=>(t,n,r)=>lt(e)(t,n,r),yt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return dt(e)(t,n,i)},bt=e=>async(t,n,r)=>dt(e)(t,n,r),xt=/^[cC][0-9a-z]{6,}$/,St=/^[0-9a-z]+$/,Ct=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,wt=/^[0-9a-vA-V]{20}$/,Tt=/^[A-Za-z0-9]{27}$/,Et=/^[a-zA-Z0-9_-]{21}$/;function Dt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Ot=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,kt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,At=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,jt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Mt=`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Nt(){return new RegExp(Mt,`u`)}var Pt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ft=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,It=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Lt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Rt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,zt=/^[A-Za-z0-9_-]*$/,Bt=/^https?$/,Vt=/^\+[1-9]\d{6,14}$/,Ht=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Ut(e){return RegExp(`^${e}$`)}var Wt=Ut(Ht);function Gt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Kt(e){return RegExp(`^${Gt(e)}$`)}function qt(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Gt({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Gt({precision:e.precision})}`:n;return RegExp(`^${Ht}T(?:${r})$`)}var Jt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Yt=/^-?\d+$/,Xt=/^-?\d+(?:\.\d+)?$/,Zt=/^(?:true|false)$/i,Qt=/^null$/i,$t=/^undefined$/i,en=/^[^A-Z]*$/,tn=/^[^a-z]*$/,nn=k(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),rn=e=>{let t=e.value;return!y(t)&&t.length!==void 0},an={number:`number`,bigint:`bigint`,object:`date`},on=k(`$ZodCheckLessThan`,(e,t)=>{nn.init(e,t);let n=an[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value{(t.inclusive?r.value<=t.value:r.value{nn.init(e,t);let n=an[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:an[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cn=k(`$ZodCheckMultipleOf`,(e,t)=>{nn.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):x(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ln=k(`$ZodCheckNumberFormat`,(e,t)=>{nn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=le[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Yt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),un=k(`$ZodCheckMaxLength`,(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=rn),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?we(r):i)<=t.maximum)return;let a=Te(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dn=k(`$ZodCheckMinLength`,(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=rn),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i=t.minimum)return;let a=Te(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),fn=k(`$ZodCheckLengthEquals`,(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=rn),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?we(r):i;if(a===t.length)return;let o=Te(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),pn=k(`$ZodCheckStringFormat`,(e,t)=>{var n,r;nn.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),mn=k(`$ZodCheckRegex`,(e,t)=>{pn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),hn=k(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=en,pn.init(e,t)}),gn=k(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=tn,pn.init(e,t)}),_n=k(`$ZodCheckIncludes`,(e,t)=>{nn.init(e,t);let n=oe(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),vn=k(`$ZodCheckStartsWith`,(e,t)=>{nn.init(e,t);let n=RegExp(`^${oe(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),yn=k(`$ZodCheckEndsWith`,(e,t)=>{nn.init(e,t);let n=RegExp(`.*${oe(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),bn=k(`$ZodCheckOverwrite`,(e,t)=>{nn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),xn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` +import{St as e,_ as t,_t as n,bt as r,d as i,f as a,gt as o,l as s,mt as c,vt as l,x as u,xt as d,yt as f}from"./brand-MzZ03bSa.js";import{i as p}from"./auth-B1VNekWU.js";import{t as m}from"./use-computed-color-scheme-6JIsge00.js";function h(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function g(e,t=`|`){return e.map(e=>se(e)).join(t)}function _(e,t){return typeof t==`bigint`?t.toString():t}function v(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function y(e){return e==null}function b(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function x(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r){};function w(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var re=v(()=>{if(Ke.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function T(e){if(w(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return w(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ie(e){return T(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ae=new Set([`string`,`number`,`symbol`]);function oe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function E(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function D(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function se(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function ce(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var le={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ue(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return E(e,C(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&S(e,r,n.shape[r])}return S(this,`shape`,e),e},checks:[]}))}function de(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return E(e,C(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return S(this,`shape`,r),r},checks:[]}))}function fe(e,t){if(!T(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return E(e,C(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return S(this,`shape`,n),n}}))}function pe(e,t){if(!T(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return E(e,C(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return S(this,`shape`,n),n}}))}function me(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return E(e,C(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return S(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function he(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);return E(t,C(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return S(this,`shape`,i),i},checks:[]}))}function ge(e,t,n){return E(t,C(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return S(this,`shape`,i),i}}))}function _e(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function be(e){return typeof e==`string`?e:e?.message}function xe(e,t,n){var r;for(let i=t;ie;return t[Le]=!0,t}var ze,Be=Object.freeze({status:`aborted`}),Ve={value:void 0,enumerable:!1},He=`captureStackTrace`in Error?Error:null;function Ue(e){let t=He;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return He=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function k(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Ve.value=new a(r);try{Object.defineProperty(n,"_zod",Ve)}finally{Ve.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Oe(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Ue(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var We=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ge=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ze=globalThis).__zod_globalConfig??(ze.__zod_globalConfig={});var Ke=globalThis.__zod_globalConfig;function qe(e){return e&&Object.assign(Ke,e),Ke}function Je(){let e=this._zod;return e.message??=JSON.stringify(e.def,_,2),e.message}function Ye(e){this._zod.message=e}var Xe={get:Je,set:Ye,enumerable:!0,configurable:!0},Ze={value:void 0,enumerable:!1},Qe={value:void 0,enumerable:!1},$e=new WeakSet([Object.prototype,Error.prototype]),et=(e,t)=>{e.name=`$ZodError`,Ze.value=e._zod,Object.defineProperty(e,"_zod",Ze),Qe.value=t,Object.defineProperty(e,"issues",Qe),Ze.value=void 0,Qe.value=void 0,Object.defineProperty(e,"message",Xe);let n=Object.getPrototypeOf(e);$e.has(n)||($e.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},tt=k(`$ZodError`,et),nt=k(`$ZodError`,et,void 0,{Parent:Error});function rt(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function it(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?rt(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function at(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new We;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Se(e,o,qe())));throw ne(n,a?.callee??t),n}return s.value};return t},ct=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Se(e,o,qe())));throw ne(n,a?.callee??t),n}return s.value};return t},lt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new We;return a.issues.length?{success:!1,error:new(e??tt)(a.issues.map(e=>Se(e,i,qe())))}:{success:!0,data:a.value}},ut=lt(nt),dt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Se(e,i,qe())))}:{success:!0,data:a.value}},ft=dt(nt),pt=e=>{let t=st(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,ot(n,a))};return n},mt=e=>{let t=st(e),n=(e,r,i,a)=>t(e,r,i,ot(n,a));return n},ht=e=>{let t=ct(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,ot(n,a))};return n},gt=e=>{let t=ct(e),n=async(e,r,i,a)=>await t(e,r,i,ot(n,a));return n},_t=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return lt(e)(t,n,i)},vt=e=>(t,n,r)=>lt(e)(t,n,r),yt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return dt(e)(t,n,i)},bt=e=>async(t,n,r)=>dt(e)(t,n,r),xt=/^[cC][0-9a-z]{6,}$/,St=/^[0-9a-z]+$/,Ct=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,wt=/^[0-9a-vA-V]{20}$/,Tt=/^[A-Za-z0-9]{27}$/,Et=/^[a-zA-Z0-9_-]{21}$/;function Dt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Ot=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,kt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,At=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,jt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Mt=`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Nt(){return new RegExp(Mt,`u`)}var Pt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ft=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,It=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Lt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Rt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,zt=/^[A-Za-z0-9_-]*$/,Bt=/^https?$/,Vt=/^\+[1-9]\d{6,14}$/,Ht=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Ut(e){return RegExp(`^${e}$`)}var Wt=Ut(Ht);function Gt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Kt(e){return RegExp(`^${Gt(e)}$`)}function qt(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Gt({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Gt({precision:e.precision})}`:n;return RegExp(`^${Ht}T(?:${r})$`)}var Jt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Yt=/^-?\d+$/,Xt=/^-?\d+(?:\.\d+)?$/,Zt=/^(?:true|false)$/i,Qt=/^null$/i,$t=/^undefined$/i,en=/^[^A-Z]*$/,tn=/^[^a-z]*$/,nn=k(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),rn=e=>{let t=e.value;return!y(t)&&t.length!==void 0},an={number:`number`,bigint:`bigint`,object:`date`},on=k(`$ZodCheckLessThan`,(e,t)=>{nn.init(e,t);let n=an[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value{(t.inclusive?r.value<=t.value:r.value{nn.init(e,t);let n=an[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:an[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cn=k(`$ZodCheckMultipleOf`,(e,t)=>{nn.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):x(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ln=k(`$ZodCheckNumberFormat`,(e,t)=>{nn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=le[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Yt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),un=k(`$ZodCheckMaxLength`,(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=rn),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?we(r):i)<=t.maximum)return;let a=Te(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dn=k(`$ZodCheckMinLength`,(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=rn),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i=t.minimum)return;let a=Te(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),fn=k(`$ZodCheckLengthEquals`,(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=rn),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?we(r):i;if(a===t.length)return;let o=Te(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),pn=k(`$ZodCheckStringFormat`,(e,t)=>{var n,r;nn.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),mn=k(`$ZodCheckRegex`,(e,t)=>{pn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),hn=k(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=en,pn.init(e,t)}),gn=k(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=tn,pn.init(e,t)}),_n=k(`$ZodCheckIncludes`,(e,t)=>{nn.init(e,t);let n=oe(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),vn=k(`$ZodCheckStartsWith`,(e,t)=>{nn.init(e,t);let n=RegExp(`^${oe(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),yn=k(`$ZodCheckEndsWith`,(e,t)=>{nn.init(e,t);let n=RegExp(`.*${oe(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),bn=k(`$ZodCheckOverwrite`,(e,t)=>{nn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),xn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(` `)}\n};`)(...Object.values(this.closed))}},Sn={major:4,minor:5,patch:4},A=k(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Sn;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=_e(t),a;for(let o of n){if(o._zod.def.when){if(ve(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new We;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(xe(t.issues,n,e),i||=_e(t,n))});else{if(t.issues.length===n)continue;xe(t.issues,n,e),i||=_e(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(_e(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new We;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new We;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Ae(this,`~standard`,wn(this))},set"~standard"(e){ke(this,`~standard`,e)}}),Cn=e=>e.success?{value:e.data}:{issues:e.error?.issues};function wn(e){return{validate:t=>{try{return Cn(ut(e,t))}catch{return ft(e,t).then(Cn)}},vendor:`zod`,version:1}}var Tn=k(`$ZodString`,(e,t)=>{A.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Jt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),j=k(`$ZodStringFormat`,(e,t)=>{pn.init(e,t),Tn.init(e,t)}),En=k(`$ZodGUID`,(e,t)=>{t.pattern??=kt,j.init(e,t)}),Dn=k(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=At(e)}else t.pattern??=At();j.init(e,t)}),On=k(`$ZodEmail`,(e,t)=>{t.pattern??=jt,j.init(e,t)});function kn(e,t){if(!t.normalize&&t.protocol?.source===Bt.source&&!/^https?:\/\//i.test(e))return 1;try{return new URL(e)}catch{return 2}}var An=/[\t\n\r]/g;function jn(e){return e.replace(An,``)}function Mn(e,t){return t.lastIndex=0,t.test(e.hostname)}function Nn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Pn=k(`$ZodURL`,(e,t)=>{j.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=kn(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}t.hostname&&!Mn(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Nn(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:jn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Fn=k(`$ZodEmoji`,(e,t)=>{t.pattern??=Nt(),j.init(e,t)}),In=k(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Et:Dt(t.length),j.init(e,t)}),Ln=k(`$ZodCUID`,(e,t)=>{t.pattern??=xt,j.init(e,t)}),Rn=k(`$ZodCUID2`,(e,t)=>{t.pattern??=St,j.init(e,t)}),zn=k(`$ZodULID`,(e,t)=>{t.pattern??=Ct,j.init(e,t)}),Bn=k(`$ZodXID`,(e,t)=>{t.pattern??=wt,j.init(e,t)}),Vn=k(`$ZodKSUID`,(e,t)=>{t.pattern??=Tt,j.init(e,t)}),Hn=k(`$ZodISODateTime`,(e,t)=>{t.pattern??=qt(t),j.init(e,t),(t.local||t.precision===-1)&&(e._zod.bag.laxFormat=!0,e._zod.onattach.push(e=>{e._zod.bag.laxFormat=!0}))}),Un=k(`$ZodISODate`,(e,t)=>{t.pattern??=Wt,j.init(e,t)}),Wn=k(`$ZodISOTime`,(e,t)=>{t.pattern??=Kt(t),j.init(e,t)}),Gn=k(`$ZodISODuration`,(e,t)=>{t.pattern??=Ot,j.init(e,t)}),Kn=k(`$ZodIPv4`,(e,t)=>{t.pattern??=Pt,j.init(e,t),e._zod.bag.format=`ipv4`}),qn=/^[0-9a-fA-F:.]+$/;function Jn(e){if(!qn.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}var Yn=k(`$ZodIPv6`,(e,t)=>{t.pattern??=Ft,j.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{Jn(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Xn=k(`$ZodCIDRv4`,(e,t)=>{t.pattern??=It,j.init(e,t)});function Zn(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Jn(n)}var Qn=k(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Lt,j.init(e,t),e._zod.check=n=>{Zn(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function $n(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var er=k(`$ZodBase64`,(e,t)=>{t.pattern??=Rt,j.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{$n(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function tr(e){if(!zt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return $n(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var nr=k(`$ZodBase64URL`,(e,t)=>{t.pattern??=zt,j.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{tr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),rr=k(`$ZodE164`,(e,t)=>{t.pattern??=Vt,j.init(e,t)});function ir(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var ar=k(`$ZodJWT`,(e,t)=>{j.init(e,t),e._zod.check=n=>{ir(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),or=k(`$ZodNumber`,(e,t)=>{A.init(e,t),e._zod.pattern=e._zod.bag.pattern??Xt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),sr=k(`$ZodNumberFormat`,(e,t)=>{ln.init(e,t),or.init(e,t)}),cr=k(`$ZodBoolean`,(e,t)=>{A.init(e,t),e._zod.pattern=Zt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),lr=k(`$ZodUndefined`,(e,t)=>{A.init(e,t),e._zod.pattern=$t,e._zod.values=new Set([void 0]),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),ur=k(`$ZodNull`,(e,t)=>{A.init(e,t),e._zod.pattern=Qt,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),dr=k(`$ZodAny`,(e,t)=>{A.init(e,t),e._zod.parse=e=>e}),fr=k(`$ZodUnknown`,(e,t)=>{A.init(e,t),e._zod.parse=e=>e}),pr=k(`$ZodNever`,(e,t)=>{A.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function mr(e,t,n){e.issues.length&&t.issues.push(...ye(n,e.issues)),t.value[n]=e.value}var hr=k(`$ZodArray`,(e,t)=>{A.init(e,t);let n=Ke.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[];for(let e=0;emr(t,r,e))):mr(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function gr(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...ye(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}}var _r=[];function vr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:_r,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=ce(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function yr(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin,d=c.optout;for(let i in t){if(s.has(i))continue;if(i===`__proto__`){l===`never`&&o.push(i);continue}if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>gr(e,n,i,t,u,d))):gr(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var br=new WeakMap,xr=k(`$ZodObject`,(e,t)=>{if(A.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;br.set(t,e),Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),br.set(t,n),n}})}let n=v(()=>vr(t));O(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||S(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let r=w,i=t.catchall,a,o=Ke.memoizer;o?.attach(e),e._zod.parse=(t,s)=>{a??=n.value;let c=t.value;if(!r(c))return t.issues.push({expected:`object`,code:`invalid_type`,input:c,inst:e}),t;t.value=o?o.alloc(e,t,{},s):{};let l=[],u=a.shape;for(let e of a.allKeys){if(e===`__proto__`)continue;let n=u[e],r=n._zod.optin,i=n._zod.optout,a=n._zod.run({value:c[e],issues:[]},s);a instanceof Promise?l.push(a.then(n=>gr(n,t,e,c,r,i))):gr(a,t,e,c,r,i)}return i?yr(l,c,t,s,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),Sr=k(`$ZodObjectJIT`,(e,t)=>{xr.init(e,t);let n=e._zod.parse,r=v(()=>vr(t)),i=Ke.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new xn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>` for (let i = 0; i < ${e}.issues.length; i++) { diff --git a/internal/ui/dist/assets/routes-D1xQhcK4.js b/internal/ui/dist/assets/routes-VCBnBbPZ.js similarity index 84% rename from internal/ui/dist/assets/routes-D1xQhcK4.js rename to internal/ui/dist/assets/routes-VCBnBbPZ.js index b9c1fe212..a595b1aab 100644 --- a/internal/ui/dist/assets/routes-D1xQhcK4.js +++ b/internal/ui/dist/assets/routes-VCBnBbPZ.js @@ -1 +1 @@ -import{mt as e}from"./brand-MzZ03bSa.js";import{l as t,n}from"./auth-BeUORN-q.js";var r=e();function i(){let{agent_available:e}=n();if(!e)return(0,r.jsx)(t,{to:`/dashboards`,replace:!0});let i=localStorage.getItem(`fanout.thread-id`);return i?(localStorage.removeItem(`fanout.thread-id`),(0,r.jsx)(t,{to:`/chat/$threadId`,params:{threadId:i},replace:!0})):(0,r.jsx)(t,{to:`/chat`,replace:!0})}export{i as component}; \ No newline at end of file +import{mt as e}from"./brand-MzZ03bSa.js";import{l as t,n}from"./auth-B1VNekWU.js";var r=e();function i(){let{agent_available:e}=n();if(!e)return(0,r.jsx)(t,{to:`/dashboards`,replace:!0});let i=localStorage.getItem(`fanout.thread-id`);return i?(localStorage.removeItem(`fanout.thread-id`),(0,r.jsx)(t,{to:`/chat/$threadId`,params:{threadId:i},replace:!0})):(0,r.jsx)(t,{to:`/chat`,replace:!0})}export{i as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/settings-D20O7uBo.js b/internal/ui/dist/assets/settings-BTUR4pT4.js similarity index 97% rename from internal/ui/dist/assets/settings-D20O7uBo.js rename to internal/ui/dist/assets/settings-BTUR4pT4.js index 6068f047c..37cee591e 100644 --- a/internal/ui/dist/assets/settings-D20O7uBo.js +++ b/internal/ui/dist/assets/settings-BTUR4pT4.js @@ -1,4 +1,4 @@ -import{S as e,St as t,Y as n,_ as r,a as i,d as a,f as o,gt as s,h as c,i as l,j as u,mt as d,o as f,r as p,s as m,u as h,x as g,y as _}from"./brand-MzZ03bSa.js";import{i as v,r as y,s as b}from"./auth-BeUORN-q.js";import{t as x}from"./Tooltip-BJiO7C_G.js";import{O as S,i as C,k as w,n as T}from"./api-Be5Lq4YA.js";import{n as E,t as D}from"./WarningCircle.es-DDq2AFnK.js";import{r as O}from"./index-C8q_YUYV.js";var k=t(s(),1);function A(e={}){let t=e.timeout??2e3,[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(!1),o=(0,k.useRef)(null);(0,k.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]);let s=e=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>a(!1),t),a(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),s(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{a(!1),r(null),window.clearTimeout(o.current)},error:n,copied:i}}var j={root:`m_849cf0da`},M=d(),N={underline:`hover`},P=e(e=>{let{underline:t,className:r,unstyled:i,mod:o,...s}=u(`Anchor`,N,e);return(0,M.jsx)(a,{component:`a`,className:n({[j.root]:!i},r),...s,mod:[{underline:t},o],__staticSelector:`Anchor`,unstyled:i})});P.classes=j,P.displayName=`@mantine/core/Anchor`;var F={timeout:1e3};function I(e){let{children:t,timeout:n,value:r,...i}=u(`CopyButton`,F,e),a=A({timeout:n});return(0,M.jsx)(M.Fragment,{children:t({copy:()=>a.copy(r),copied:a.copied,...i})})}I.displayName=`@mantine/core/CopyButton`;var L=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),R=k.forwardRef((e,t)=>k.createElement(i,{ref:t,...e,weights:L}));R.displayName=`ArrowsClockwiseIcon`;var z=R,B=[`settings`,`ingest`];function V(e,t){let n=e.trim();return t||/^https:\/\//i.test(n)||/:443$/.test(n)}function H(e,t,n){return`exporters: +import{S as e,St as t,Y as n,_ as r,a as i,d as a,f as o,gt as s,h as c,i as l,j as u,mt as d,o as f,r as p,s as m,u as h,x as g,y as _}from"./brand-MzZ03bSa.js";import{i as v,r as y,s as b}from"./auth-B1VNekWU.js";import{t as x}from"./Tooltip-BJiO7C_G.js";import{O as S,i as C,k as w,n as T}from"./api-CB7Xlqes.js";import{n as E,t as D}from"./WarningCircle.es-BrGtHGYK.js";import{r as O}from"./index-BHeU96Kj.js";var k=t(s(),1);function A(e={}){let t=e.timeout??2e3,[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(!1),o=(0,k.useRef)(null);(0,k.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]);let s=e=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>a(!1),t),a(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),s(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{a(!1),r(null),window.clearTimeout(o.current)},error:n,copied:i}}var j={root:`m_849cf0da`},M=d(),N={underline:`hover`},P=e(e=>{let{underline:t,className:r,unstyled:i,mod:o,...s}=u(`Anchor`,N,e);return(0,M.jsx)(a,{component:`a`,className:n({[j.root]:!i},r),...s,mod:[{underline:t},o],__staticSelector:`Anchor`,unstyled:i})});P.classes=j,P.displayName=`@mantine/core/Anchor`;var F={timeout:1e3};function I(e){let{children:t,timeout:n,value:r,...i}=u(`CopyButton`,F,e),a=A({timeout:n});return(0,M.jsx)(M.Fragment,{children:t({copy:()=>a.copy(r),copied:a.copied,...i})})}I.displayName=`@mantine/core/CopyButton`;var L=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),R=k.forwardRef((e,t)=>k.createElement(i,{ref:t,...e,weights:L}));R.displayName=`ArrowsClockwiseIcon`;var z=R,B=[`settings`,`ingest`];function V(e,t){let n=e.trim();return t||/^https:\/\//i.test(n)||/:443$/.test(n)}function H(e,t,n){return`exporters: otlp/fanout: endpoint: "${e}" headers: diff --git a/internal/ui/dist/assets/tokens-DNprTSRA.js b/internal/ui/dist/assets/tokens-CPxx1QN7.js similarity index 99% rename from internal/ui/dist/assets/tokens-DNprTSRA.js rename to internal/ui/dist/assets/tokens-CPxx1QN7.js index a99d4eef4..7988c50eb 100644 --- a/internal/ui/dist/assets/tokens-DNprTSRA.js +++ b/internal/ui/dist/assets/tokens-CPxx1QN7.js @@ -1 +1 @@ -import{$ as e,A as t,C as n,G as r,J as i,K as a,N as o,S as s,St as c,X as l,Y as u,_t as d,a as f,at as p,b as m,dt as h,et as g,gt as _,j as v,k as y,m as b,mt as x,nt as S,ot as C,q as w,st as T,tt as E,v as D,x as O,z as k}from"./brand-MzZ03bSa.js";import{c as A,d as ee,h as te,m as j,p as ne,u as re}from"./auth-BeUORN-q.js";import{C as ie,S as ae,T as oe,_ as se,a as ce,b as M,c as N,d as le,f as P,g as F,h as ue,i as de,l as I,m as L,n as R,p as z,r as fe,s as pe,u as B,v as V,w as me,x as H,y as he}from"./Tooltip-BJiO7C_G.js";import{r as ge}from"./use-computed-color-scheme-6JIsge00.js";import{B as _e,O as ve,U as ye,i as be,n as xe,z as Se}from"./api-Be5Lq4YA.js";function Ce(e){return e[e.length-1]}function we(e,t){return typeof e==`function`?e(t):e}var Te=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable;function U(e){for(let t in e)if(Te.call(e,t))return!0;return!1}var De=()=>Object.create(null),Oe=(e,t)=>ke(e,t,De);function ke(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=Ne(e)&&Ne(i);if(!a&&!(je(e)&&je(i)))return i;let o=a?e:Ae(e);if(!o)return i;let s=a?i:Ae(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;ti||!Pe(e[o],t[o],n)))return!1;return i===a}return!1}function Fe(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}var Ie=/[\x00-\x1f\x7f"<>`{}]/g;function Le(e){return e.replace(Ie,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function Re(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Le(t)}var ze=[`http:`,`https:`,`mailto:`,`tel:`];function Be(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Ve(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=Re(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=Re(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function He(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Ue(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var W=4,Ke=5;function qe(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=a.indexOf(`{`),s;if(o!==-1&&o+1!e.parse&&e.caseSensitive===p&&e.prefix===t&&e.suffix===c);if(h)n=h;else{let e=Ze(f,r,p,t,c);n=e,e.parent=i,e.depth=a;let s;s=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],s.push(e),s.length===2&&o?.push(s)}break}}i=n}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=Xe(r);e.kind=Ke,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let f=(n.path||!n.children)&&!n.isRoot;if(f&&r.endsWith(`/`)){let e=Xe(r);e.kind=W,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=d??null,i.priority=s?.params?.priority??0,f&&!i.route&&(i.route=n,i.fullPath=r)}if(n.children)for(let r of n.children)Je(e,t,r,c,i,a,o,s)}function Ye(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Xe(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Ze(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function Qe(e,t){let n=Xe(`/`),r=new Uint16Array(6),i=[];for(let t of e)Je(!1,r,t,1,n,0,i);for(let e of i)e.sort(Ye);t.masksTree=n,t.flatCache=Ge(1e3)}function $e(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=it(e,t.masksTree);return t.flatCache.set(e,r),r}function et(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Xe(`/`),Je(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),it(r,o,n)}function tt(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=it(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=ot(a.route)),t.matchCache.set(r,a),a}function nt(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function rt(e,t=!1,n){let r=Xe(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;Je(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&We(),o[e.id]=e,c!==0&&e.path){let t=nt(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(Ye);return{processedTree:{segmentTree:r,singleCache:Ge(1e3),matchCache:Ge(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function it(e,t,n=!1){let r=e.split(`/`),i=ct(e,r,t,n);if(!i)return null;let[a]=at(e,r,i);return{route:i.node.route,rawParams:a}}function at(e,t,n){let r=st(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(a){if(_)continue;let e=t.slice(u).join(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;ee.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===W)>(e.node.kind===W)||t.node.kind===W==(e.node.kind===W)&&t.node.depth>e.node.depth)))}function pt(e){return mt(e.filter(e=>e!==void 0).join(`/`))}function mt(e){return e.replace(/\/{2,}/g,`/`)}function ht(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function gt(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function _t(e){return gt(ht(e))}function vt(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function yt(e,t,n){return vt(e,n)===vt(t,n)}function bt({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=mt(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=mt(e)),o=e.split(`/`);o.length>1&&Ce(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(Ce(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?mt(s):s)||`/`;return a&&r&&r.set(a,c),c}function xt(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function St(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>wt(e,n)).join(`/`):wt(r,n):r}function Ct({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Tt:this.parentRoute||We();let r=n?Tt:t?.path;r&&r!==`/`&&(r=ht(r));let i=t?.id||r,a=n?Tt:pt([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=pt([`/`,a]));let o=a===`__root__`?`/`:pt([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=gt(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=>Et({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.`)}},At=class extends kt{constructor(e){super(e)}},G=c(_(),1),K=x();function jt({children:e,fallback:t=null}){return(0,K.jsx)(G.Fragment,{children:Mt()?e:t})}function Mt(){return G.useSyncExternalStore(Nt,()=>!0,()=>!1)}function Nt(){return()=>{}}var Pt=G.createContext(void 0),Ft=G.createContext(void 0),It=d((e=>{var t=_();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Lt=d(((e,t)=>{t.exports=It()})),Rt=d((e=>{var t=_(),n=Lt();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.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),zt=d(((e,t)=>{t.exports=Rt()}))();function Bt(e,t){return e===t}function Vt(e,t,n=Bt){let r=(0,G.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,G.useCallback)(()=>e?.get(),[e]);return(0,zt.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Ht={};function Ut(e,t){let n=G.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=ke(n.current,i):i}}function q(e){let t=ee(),n=G.useContext(e.from?Ft:Pt),r=e.from??n,i=t.stores.getMatchStore(r),a=Ut(e,t),o=Vt(i,e=>e?a(e):Ht);if(o!==Ht)return o;(e.shouldThrow??!0)&&We()}function Wt(e){return q({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Gt(e){let{select:t,...n}=e;return q({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Kt(e){return q({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 qt(e){return q({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Jt(e){return q({...e,select:t=>e.select?e.select(t.context):t.context})}function Yt(e){let t=G.useRef(e);return Pe(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function Xt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Zt(e,t,n){if(e?.external)return Be(e.href,n)?void 0:e.href;if(!ln(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),Be(t,n)?void 0:t}catch{}}function Qt(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!yt(e.pathname,t.pathname,r))return!1}else{let n=vt(e.pathname,r),i=vt(t.pathname,r);if(!n.startsWith(i)||n.length!==i.length&&n[i.length]!==`/`)return!1}return(n?.includeSearch??!0)&&!Pe(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function $t(e,t){let n=ee(),r=j(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:k,hash:A,state:ne,mask:re,reloadDocument:ie,unsafeRelative:ae,from:oe,_fromLocation:se,...ce}=e,M=Mt(),N=Yt(e.search),le=Yt(e.params),P=Yt(o),F=G.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,N,le,e.state,e.mask,e.unsafeRelative]),ue=G.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...F}),r=cn(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,v),i=Zt(r,s,n.protocolAllowlist);return[r?.href,i,Qt(e,t,P,n.basepath,M,i!==void 0)]},[P,v,M,F,n,s]),[de,I,L]=Vt(n.stores.location,ue,Xt),R=L?we(i,{})??tn:en,z=L?en:we(a,{})??en,fe=[b,R.className,z.className].filter(Boolean).join(` `),pe=(y||R.style||z.style)&&{...y,...R.style,...z.style},B=G.useRef(!1),V=e.reloadDocument||I||v?!1:c??n.options.defaultPreload,me=l??n.options.defaultPreloadDelay??0,H=G.useCallback(()=>{n.preloadRoute(F).catch(e=>{console.warn(e),console.warn(Ot)})},[n,F]),he=G.useCallback(e=>{if(!e){on(r);return}if(!(e.isIntersecting??V===`intent`)){e.isIntersecting===!1&&on(r);return}if(!me){H();return}an.has(r)||an.set(r,setTimeout(()=>{an.delete(r),H()},me))},[H,r,V,me]);te(r,he,V!==`viewport`),G.useEffect(()=>{B.current||V===`render`&&(H(),B.current=!0)},[H,V]);let ge=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;!v&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0&&(e.preventDefault(),n.navigate({...F,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D}))};if(I)return{...ce,ref:r,href:I,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let _e=()=>{V===`intent`&&H()},ve=()=>{V===`intent`&&on(r)};return{...ce,...R,...z,href:de,ref:r,onClick:sn([x,ge]),onBlur:sn([S,ve]),onFocus:sn([C,he]),onMouseEnter:sn([w,he]),onMouseLeave:sn([T,ve]),onTouchStart:sn([E,_e]),disabled:!!v,target:_,...pe&&{style:pe},...fe&&{className:fe},...v&&nn,...L&&rn}}var en={},tn={className:`active`},nn={role:`link`,"aria-disabled":!0},rn={"data-status":`active`,"aria-current":`page`},an=new WeakMap,on=e=>{clearTimeout(an.get(e)),an.delete(e)},sn=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function cn(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function ln(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var un=G.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=$t(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return G.createElement(`a`,t,o)}return G.createElement(n,a,o)}),dn=class extends kt{constructor(e){super(e),this.useMatch=e=>q({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Jt({...e,from:this.id}),this.useSearch=e=>qt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Kt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Gt({...e,from:this.id}),this.useLoaderData=e=>Wt({...e,from:this.id}),this.useNavigate=()=>re({from:this.fullPath}),this.Link=G.forwardRef((e,t)=>(0,K.jsx)(un,{ref:t,from:this.fullPath,...e}))}};function fn(e){return new dn(e)}var pn=class extends At{constructor(e){super(e),this.useMatch=e=>q({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Jt({...e,from:this.id}),this.useSearch=e=>qt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Kt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Gt({...e,from:this.id}),this.useLoaderData=e=>Wt({...e,from:this.id}),this.useNavigate=()=>re({from:this.fullPath}),this.Link=G.forwardRef((e,t)=>(0,K.jsx)(un,{ref:t,from:this.fullPath,...e}))}};function mn(e){return new pn(e)}function hn(e){return e=>{let t=fn(e);return t.isRoot=!1,t}}function gn(e,t){let n,r,i,a=()=>(n||=(i=void 0,e().then(e=>{n=void 0,o.preload=void 0,r=e[t??`default`]}).catch(e=>{n=void 0,i=e})),n),o=function(e){if(i){if(Fe(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(ne)ne(a());else throw a()}return G.createElement(r,e)};return o.preload=a,o}function _n(e){return typeof e!=`string`||!e.includes(`var(--mantine-scale)`)?e:e.match(/^calc\((.*?)\)$/)?.[1].split(`*`)[0].trim()}function vn(e){let t=_n(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 yn(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function bn(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 xn(e,t,n){for(let n=e+1;n{n?.(s);let c=Array.from(yn(s.currentTarget,e)?.querySelectorAll(t)||[]).filter(t=>Sn(s.currentTarget,t,e)),l=c.findIndex(e=>s.currentTarget===e),u=xn(l,c,r),d=bn(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[xn(-1,c,!1)]?.focus();break;case`End`:s.stopPropagation(),s.preventDefault(),c[bn(c.length,c,!1)]?.focus()}}}function wn(e,t={active:!0}){return typeof e!=`function`||!t.active?t.onKeyDown||ge:n=>{n.key===`Escape`&&(e(n),t.onTrigger?.())}}function J(e,t){return n=>{e?.(n),t?.(n)}}function Tn(e,t){return e in t?vn(t[e]):vn(e)}function En(e,t){let n=e.map(e=>({value:e,px:Tn(e,t)}));return n.sort((e,t)=>e.px-t.px),n}function Dn(e,t,n){return n?Array.from(yn(n,t)?.querySelectorAll(e)||[]).findIndex(e=>e===n):null}var On=[`mousedown`,`touchstart`];function kn(e,t,n,r=!0){let i=(0,G.useRef)(null),a=t||On,o=(0,G.useEffectEvent)(t=>{let{target:r}=t??{};if(!document.body.contains(r)&&r?.tagName!==`HTML`)return;let a=t.composedPath();Array.isArray(n)?n.every(e=>!!e&&!a.includes(e))&&e(t):i.current&&!a.includes(i.current)&&e(t)}),s=a.join(`,`);return(0,G.useEffect)(()=>{if(!r)return;let e=s.split(`,`);return e.forEach(e=>document.addEventListener(e,o)),()=>{e.forEach(e=>document.removeEventListener(e,o))}},[s,r]),i}var An=[`mouse`,`touch`],jn=10;function Mn(e,t={}){let{threshold:n=400,events:r=An,cancelOnMove:i=!1,onStart:a,onFinish:o,onCancel:s}=t,c=(0,G.useRef)(!1),l=(0,G.useRef)(!1),u=(0,G.useRef)(-1),d=(0,G.useRef)(null);return(0,G.useEffect)(()=>()=>window.clearTimeout(u.current),[]),(0,G.useMemo)(()=>{if(typeof e!=`function`)return{};let t=i!==!1,f=i===!0?jn:i===!1?0:i,p=t=>{(Fn(t)||Pn(t))&&(a&&a(t),d.current=Nn(t),l.current=!0,u.current=window.setTimeout(()=>{e(t),c.current=!0},n))},m=e=>{(Fn(e)||Pn(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=Nn(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,r.join(`,`)])}function Nn(e){if(Pn(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 Pn(e){return window.TouchEvent?e.nativeEvent instanceof TouchEvent:`touches`in e.nativeEvent}function Fn(e){return e.nativeEvent instanceof MouseEvent}function In({color:e,theme:t,autoContrast:n,colorScheme:r}){return(typeof n==`boolean`?n:t.autoContrast)&&w({color:e||t.primaryColor,theme:t,colorScheme:r}).isLight?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function Ln(e,t,n){return In({color:n===`dark`?e.dark:e.light,theme:t,colorScheme:n,autoContrast:!0})}function Rn(e,t){let n=e.colors[e.primaryColor];return r(n)?e.autoContrast?Ln(n,e,t):`var(--mantine-color-white)`:In({color:n[i(e,t)],theme:e,autoContrast:null})}function zn({open:e,close:t,openDelay:n,closeDelay:r}){let i=(0,G.useRef)(-1),a=(0,G.useRef)(-1),o=()=>{window.clearTimeout(i.current),window.clearTimeout(a.current)};return(0,G.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[Bn,Vn]=me(`Popover component was not found in the tree`);function Hn({childProps:e,disabled:t,opened:n,longPressDelay:r=500,setReference:i,open:a}){let o=(0,G.useRef)(!1),s=(0,G.useRef)(!1),c=(0,G.useRef)(null),l=(0,G.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=J(e.onMouseDown,e=>{t||e.button===2&&e.stopPropagation()}),f=J(e.onContextMenu,e=>{t||e.defaultPrevented||(e.preventDefault(),!s.current&&(u(e.clientX,e.clientY,e.currentTarget),o.current&&(s.current=!0)))}),p=Mn(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:J(e.onTouchStart,p.onTouchStart),onTouchEnd:J(e.onTouchEnd,p.onTouchEnd),onTouchCancel:J(e.onTouchCancel,p.onTouchCancel),onTouchMove:J(e.onTouchMove,p.onTouchMove),style:t?e.style:{...e.style,WebkitTouchCallout:`none`,WebkitUserSelect:`none`,userSelect:`none`},"data-expanded":n?!0:void 0}}function Un(e){let{children:t,disabled:n,longPressDelay:r}=v(`PopoverContextMenu`,null,e),i=H(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 a=Vn();return(0,G.cloneElement)(i,Hn({childProps:i.props,disabled:n||a.disabled,opened:a.opened,longPressDelay:r,setReference:a.reference,open:()=>{a.opened||a.onToggle()}}))}Un.displayName=`@mantine/core/PopoverContextMenu`;var Wn={dropdown:`m_38a85659`,arrow:`m_a31dc6c1`,overlay:`m_3d7bc908`},Gn=n(t=>{let n=v(`PopoverDropdown`,null,t),{className:r,style:i,vars:a,children:o,onKeyDownCapture:s,variant:c,classNames:l,styles:u,ref:d,...f}=n,p=Vn(),{dir:m}=M(),g=p.arrowPosition===`merge`&&p.withArrow?ce({position:p.placement,dir:m}):void 0,_=ye({opened:p.opened,shouldReturnFocus:p.returnFocus}),y=p.withRoles?{"aria-labelledby":p.getTargetId(),id:p.getDropdownId(),role:`dialog`,tabIndex:-1}:{},b=e(d,p.floating);return p.disabled?null:(0,K.jsx)(R,{...p.portalProps,withinPortal:p.withinPortal,children:(0,K.jsx)(D,{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,K.jsx)(Se,{active:p.trapFocus&&p.opened,innerRef:b,children:(0,K.jsxs)(O,{...y,...f,variant:c,onKeyDownCapture:wn(()=>{p.onClose?.(),p.onDismiss?.()},{active:p.closeOnEscape,onTrigger:_,onKeyDown:s}),"data-position":p.placement,"data-fixed":p.floatingStrategy===`fixed`||void 0,...p.getStyles(`dropdown`,{className:r,props:n,classNames:l,styles:u,style:[{...e,...g,zIndex:p.zIndex,top:p.y??0,left:p.x??0,width:p.width===`target`?void 0:h(p.width),...p.referenceHidden?{display:`none`}:null},p.resolvedStyles?.dropdown,u?.dropdown,i]}),children:[o,(0,K.jsx)(de,{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:n,classNames:l,styles:u})})]})})})})});Gn.classes=Wn,Gn.displayName=`@mantine/core/PopoverDropdown`;var Kn={refProp:`ref`,popupType:`dialog`},qn=n(t=>{let{children:n,refProp:r,popupType:i,ref:a,...o}=v(`PopoverTarget`,Kn,t),s=H(n);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=Vn(),d=e(l.reference,ae(s),a),f=l.withRoles?{"aria-haspopup":i,"aria-expanded":l.opened,"aria-controls":l.opened?l.getDropdownId():void 0,id:l.getTargetId()}:{},p=s.props;return(0,G.cloneElement)(s,{...c,...f,...l.targetProps,className:u(l.targetProps.className,c.className,p.className),[r]:d,...l.controlled?null:{onClick:e=>{l.onToggle(),p.onClick?.(e)}}})});qn.displayName=`@mantine/core/PopoverTarget`;function Jn(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 Yn(e,t,n,r){let i=Jn(e.middlewares),a=[F(e.offset),z()];if(i.flip&&!n){let e=typeof i.flip==`boolean`?{}:i.flip,t=r?{fallbackStrategy:`initialPlacement`,...e}:e;a.push(P(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:ue(),padding:5,...e.width===`target`&&r?{mainAxis:!1}:null,...t}}))}return i.inline&&a.push(typeof i.inline==`boolean`?L():L(i.inline)),a.push(le({element:e.arrowRef,padding:e.arrowOffset})),(i.size||e.width===`target`)&&a.push(V({...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 Xn(e){let[t,n]=A({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=(0,G.useRef)(t),[i,a]=(0,G.useState)(null),o=e.preventPositionChangeWhenVisible!==!1,s=(0,G.useRef)(t);t!==s.current&&(s.current=t,t&&i!==null&&a(null));let c=(0,G.useCallback)(()=>a(null),[]),l=()=>{t&&!e.disabled&&n(!1)},u=()=>{e.disabled||n(!t)},d=N({open:t,strategy:e.strategy,placement:o?i??e.position:e.position,middleware:Yn(e,()=>d,o&&i!==null,o),whileElementsMounted:e.keepMounted?void 0:he});(0,G.useEffect)(()=>{if(!e.keepMounted)return;let n=d.refs.reference.current,r=d.refs.floating.current;if(t&&n&&r)return he(n,r,d.update)},[e.keepMounted,t,d.update,d.elements.reference,d.elements.floating]);let f=(0,G.useRef)(!1);S(()=>{if(!t){f.current=!1;return}if(!o||i!==null)return;let e=d.refs.floating.current;if(e&&e.offsetHeight!==0&&e.offsetWidth!==0){if(!f.current){f.current=!0,d.update();return}d.isPositioned&&a(d.placement)}},[o,t,d.isPositioned,d.placement,i,d.update]);let p=(0,G.useRef)(d.placement);return S(()=>{p.current!==d.placement&&(p.current=d.placement,e.onPositionChange?.(d.placement))},[d.placement]),E(()=>{t!==r.current&&(t?e.onOpen?.():e.onClose?.()),r.current=t},[t,e.onClose,e.onOpen]),{floating:d,controlled:typeof e.opened==`boolean`,opened:t,onClose:l,onToggle:u,resetLockedPlacement:c}}var Zn={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`],zIndex:ie(`popover`),__staticSelector:`Popover`,width:`max-content`},Qn=l((e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:p(t),"--popover-shadow":C(n)}}));function Y(e){let n=v(`Popover`,Zn,e),{children:r,position:i,offset:a,onPositionChange:o,opened:s,transitionProps:c,onExitTransitionEnd:l,onEnterTransitionEnd:u,width:d,middlewares:f,withArrow:p,arrowSize:m,arrowOffset:h,arrowRadius:_,arrowPosition:b,unstyled:x,classNames:S,styles:C,closeOnClickOutside:w,withinPortal:T,portalProps:E,closeOnEscape:O,clickOutsideEvents:A,trapFocus:ee,onClose:te,onDismiss:j,onOpen:ne,onChange:re,zIndex:ie,radius:ae,shadow:oe,id:se,defaultOpened:ce,__staticSelector:N,withRoles:le,disabled:P,returnFocus:F,variant:ue,keepMounted:de,keepMountedMode:I,vars:L,floatingStrategy:z,withOverlay:pe,overlayProps:B,hideDetached:V,attributes:me,preventPositionChangeWhenVisible:H,...he}=n,ge=y({name:N,props:n,classes:Wn,classNames:S,styles:C,unstyled:x,attributes:me,rootSelector:`dropdown`,vars:L,varsResolver:Qn}),{resolvedStyles:ve}=t({classNames:S,styles:C,props:n}),ye=(0,G.useRef)(null),[be,xe]=(0,G.useState)(null),[Se,Ce]=(0,G.useState)(null),{dir:we}=M(),Te=k(),Ee=g(se),U=Xn({middlewares:f,width:d,position:fe(we,i),offset:typeof a==`number`?a+(p?m/2:0):a,arrowRef:ye,arrowOffset:h,onPositionChange:o,opened:s,defaultOpened:ce,onChange:re,onOpen:ne,onClose:te,onDismiss:j,strategy:z,disabled:P,preventPositionChangeWhenVisible:H,keepMounted:de});kn(()=>{w&&(U.onClose(),j?.())},A,[be,Se]);let De=(0,G.useCallback)(e=>{xe(e),U.floating.refs.setReference(e)},[U.floating.refs.setReference]),Oe=(0,G.useCallback)(e=>{Ce(e),U.floating.refs.setFloating(e)},[U.floating.refs.setFloating]),ke=(0,G.useCallback)(()=>{c?.onExited?.(),l?.(),U.resetLockedPlacement()},[c?.onExited,l,U.resetLockedPlacement]),Ae=(0,G.useCallback)(()=>{c?.onEntered?.(),u?.()},[c?.onEntered,u]);return(0,K.jsxs)(Bn,{value:{returnFocus:F,disabled:P,controlled:U.controlled,reference:De,floating:Oe,x:U.floating.x,y:U.floating.y,arrowX:U.floating?.middlewareData?.arrow?.x,arrowY:U.floating?.middlewareData?.arrow?.y,opened:U.opened,arrowRef:ye,transitionProps:{...c,onExited:ke,onEntered:Ae},width:d,withArrow:p,arrowSize:m,arrowOffset:h,arrowRadius:_,arrowPosition:b,placement:U.floating.placement,trapFocus:ee,withinPortal:T,portalProps:E,zIndex:ie,radius:ae,shadow:oe,closeOnEscape:O,onDismiss:j,onClose:U.onClose,onToggle:U.onToggle,getTargetId:()=>Ee,getDropdownId:()=>`${Ee}-dropdown`,withRoles:le,targetProps:he,__staticSelector:N,classNames:S,styles:C,unstyled:x,variant:ue,keepMounted:de,keepMountedMode:I,getStyles:ge,resolvedStyles:ve,floatingStrategy:z,referenceHidden:V&&Te!==`test`?U.floating.middlewareData.hide?.referenceHidden:!1},children:[r,pe&&(0,K.jsx)(D,{transition:`fade`,mounted:U.opened,duration:c?.duration||250,exitDuration:c?.exitDuration||250,children:e=>(0,K.jsx)(R,{withinPortal:T,children:(0,K.jsx)(_e,{...B,...ge(`overlay`,{className:B?.className,style:[e,B?.style]})})})})]})}Y.Target=qn,Y.Dropdown=Gn,Y.ContextMenu=Un,Y.varsResolver=Qn,Y.displayName=`@mantine/core/Popover`,Y.extend=e=>e,Y.withProps=e=>{let t=t=>(0,K.jsx)(Y,{...e,...t});return t.extend=Y.extend,t.displayName=`WithProps(${Y.displayName})`,t};function $n({style:e,size:t=16,...n}){return(0,K.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,K.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`})})}$n.displayName=`@mantine/core/AccordionChevron`;function er({size:e,style:t,...n}){return(0,K.jsx)(`svg`,{viewBox:`0 0 10 7`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:e===void 0?t:{width:h(e),height:h(e),...t},"aria-hidden":!0,...n,children:(0,K.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 tr={root:`m_347db0ec`,"root--dot":`m_fbd81e3d`,label:`m_5add502a`,section:`m_91fdda9b`},nr=l((e,{radius:t,color:n,gradient:r,variant:i,size:o,autoContrast:s,circle:c})=>{let l=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||`filled`,autoContrast:s});return{root:{"--badge-height":T(o,`badge-height`),"--badge-padding-x":T(o,`badge-padding-x`),"--badge-fz":T(o,`badge-fz`),"--badge-radius":c||t===void 0?void 0:p(t),"--badge-bg":n||i?l.background:void 0,"--badge-color":n||i?l.color:void 0,"--badge-bd":n||i?l.border:void 0,"--badge-dot-color":i===`dot`?a(n,e):void 0}}}),rr=s(e=>{let t=v(`Badge`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,radius:c,color:l,gradient:u,leftSection:d,rightSection:f,children:p,variant:m,fullWidth:h,autoContrast:g,circle:_,mod:b,attributes:x,...S}=t,C=y({name:`Badge`,props:t,classes:tr,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:x,vars:s,varsResolver:nr});return(0,K.jsxs)(O,{variant:m,mod:[{block:h,circle:_,"with-right-section":!!f,"with-left-section":!!d},b],...C(`root`,{variant:m}),...S,children:[d&&(0,K.jsx)(`span`,{...C(`section`),"data-position":`left`,children:d}),(0,K.jsx)(`span`,{...C(`label`),children:p}),f&&(0,K.jsx)(`span`,{...C(`section`),"data-position":`right`,children:f})]})});rr.classes=tr,rr.varsResolver=nr,rr.displayName=`@mantine/core/Badge`;var[ir,X]=me(`Menu component was not found in the tree`),ar=(0,G.createContext)(null);function or(e){let{value:t,defaultValue:n,onChange:r,children:i}=v(`MenuCheckboxGroup`,null,e),[a,o]=A({value:t,defaultValue:n,finalValue:[],onChange:r});return(0,K.jsx)(ar,{value:{values:a,onChange:(0,G.useCallback)(e=>{o(a.includes(e)?a.filter(t=>t!==e):[...a,e])},[a,o])},children:i})}or.displayName=`@mantine/core/MenuCheckboxGroup`;var sr=(0,G.createContext)(null);function cr({role:t,checked:n,indicator:r,onSelect:i,color:a,closeMenuOnClick:s,rightSection:c,children:l,disabled:u,dataDisabled:d,className:f,style:p,styles:h,classNames:g,buttonRef:_,others:v}){let y=X(),b=(0,G.use)(sr),x=o(),{dir:S}=M(),C=(0,G.useRef)(null),T=J(v.onClick,()=>{d||(i(),s&&y.closeDropdownImmediately())}),E=J(v.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`)})}),D=J(v.onKeyDown,e=>{e.key===`ArrowLeft`&&b&&(b.close(),b.focusParentItem())}),O=a?x.variantColorResolver({color:a,theme:x,variant:`light`}):void 0,k=a?w({color:a,theme:x}):null,A=y.alignItemsLabels!==`none`||n;return(0,K.jsxs)(m,{onMouseDown:e=>e.preventDefault(),...v,unstyled:y.unstyled,tabIndex:y.menuItemTabIndex,...y.getStyles(`item`,{className:f,style:p,styles:h,classNames:g}),ref:e(C,_),role:t,"aria-checked":n,disabled:u,"data-menu-item":!0,"data-checked":n||void 0,"data-disabled":u||d||void 0,"data-mantine-stop-propagation":!0,onClick:T,onMouseMove:E,onKeyDown:Cn({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":k?.isThemeColor&&k?.shade===void 0?`var(--mantine-color-${k.color}-6)`:O?.color,"--menu-item-hover":O?.hover},children:[A&&(0,K.jsx)(`div`,{...y.getStyles(`itemIndicator`,{styles:h,classNames:g}),"data-checked":n||void 0,children:n?r:null}),l&&(0,K.jsx)(`div`,{...y.getStyles(`itemLabel`,{styles:h,classNames:g}),"data-menu-item-label":!0,children:l}),c&&(0,K.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:h,classNames:g}),"data-position":`right`,children:c})]})}var Z={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`},lr=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,color:o,closeMenuOnClick:s,rightSection:c,children:l,disabled:u,"data-disabled":d,value:f,checked:p,defaultChecked:m,onChange:h,checkIcon:g,ref:_,...y}=v(`MenuCheckboxItem`,null,e),b=X(),x=(0,G.use)(ar),S=x&&f!==void 0?x.values.includes(f):void 0,[C,w]=A({value:p??S,defaultValue:m,finalValue:!1,onChange:h});return(0,K.jsx)(cr,{role:`menuitemcheckbox`,checked:C,indicator:g??b.checkIcon??(0,K.jsx)(er,{size:10}),onSelect:()=>{h?w(!C):x&&f!==void 0?x.onChange(f):w(!C)},color:o,closeMenuOnClick:s,rightSection:c,disabled:u,dataDisabled:d,className:n,style:r,styles:i,classNames:t,buttonRef:_,others:y,children:l})});lr.classes=Z,lr.displayName=`@mantine/core/MenuCheckboxItem`;function ur(e){let{children:t,disabled:n,longPressDelay:r}=v(`MenuContextMenu`,null,e),i=H(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 a=X(),o=Vn();return(0,G.cloneElement)(i,Hn({childProps:i.props,disabled:n||o.disabled,opened:a.opened,longPressDelay:r,setReference:o.reference,open:()=>a.openDropdown()}))}ur.displayName=`@mantine/core/MenuContextMenu`;var dr=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=v(`MenuDivider`,null,e);return(0,K.jsx)(O,{...X().getStyles(`divider`,{className:n,style:r,styles:i,classNames:t}),...o})});dr.classes=Z,dr.displayName=`@mantine/core/MenuDivider`;var fr=500;function pr(e){return((e.querySelector(`[data-menu-item-label]`)??e).textContent??``).trim().toLowerCase()}function mr(e){return e.length>1&&e.split(``).every(t=>t===e[0])}function hr({enabled:e,opened:t,getDropdown:n}){let r=(0,G.useRef)({buffer:``,timeoutId:null});return(0,G.useEffect)(()=>{if(t&&e)return;let n=r.current;n.timeoutId!==null&&(window.clearTimeout(n.timeoutId),n.timeoutId=null),n.buffer=``},[t,e]),(0,G.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},fr);let c=document.activeElement,l=c?o.indexOf(c):-1,u=null;if(s.buffer.length===1||mr(s.buffer)){let e=s.buffer[0],t=l+1;for(let n=0;n{let{classNames:n,className:r,style:i,styles:a,vars:o,onMouseEnter:s,onMouseLeave:c,onKeyDown:l,children:u,ref:d,...f}=v(`MenuDropdown`,null,t),p=(0,G.useRef)(null),m=X(),h=hr({enabled:!m.hasSearch,opened:m.opened,getDropdown:()=>p.current}),g=J(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())}),_=J(s,()=>(m.trigger===`hover`||m.trigger===`click-hover`)&&m.openDropdown()),y=J(c,()=>(m.trigger===`hover`||m.trigger===`click-hover`)&&m.closeDropdown());return(0,K.jsxs)(Y.Dropdown,{...f,onMouseEnter:_,onMouseLeave:y,role:`menu`,"aria-orientation":`vertical`,ref:e(d,p),...m.getStyles(`dropdown`,{className:r,style:i,styles:a,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:g,children:[m.withInitialFocusPlaceholder&&!m.hasSearch&&(0,K.jsx)(`div`,{role:`presentation`,tabIndex:-1,"data-autofocus":!0,"data-mantine-stop-propagation":!0,style:{outline:0}}),u]})});gr.classes=Z,gr.displayName=`@mantine/core/MenuDropdown`;var _r=s(t=>{let{classNames:n,className:r,style:i,styles:a,vars:s,color:c,closeMenuOnClick:l,leftSection:u,rightSection:d,children:f,disabled:p,"data-disabled":h,ref:g,..._}=v(`MenuItem`,null,t),y=X(),b=(0,G.use)(sr),x=o(),{dir:S}=M(),C=(0,G.useRef)(null),T=_,E=J(T.onClick,()=>{h||(typeof l==`boolean`?l&&y.closeDropdownImmediately():y.closeOnItemClick&&y.closeDropdownImmediately())}),D=J(T.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`)})}),O=c?x.variantColorResolver({color:c,theme:x,variant:`light`}):void 0,k=c?w({color:c,theme:x}):null,A=J(T.onKeyDown,e=>{e.key===`ArrowLeft`&&b&&(b.close(),b.focusParentItem())});return(0,K.jsxs)(m,{onMouseDown:e=>e.preventDefault(),..._,unstyled:y.unstyled,tabIndex:y.menuItemTabIndex,...y.getStyles(`item`,{className:r,style:i,styles:a,classNames:n}),ref:e(C,g),role:`menuitem`,disabled:p,"data-menu-item":!0,"data-disabled":p||h||void 0,"data-mantine-stop-propagation":!0,onClick:E,onMouseMove:D,onKeyDown:Cn({siblingSelector:`[data-menu-item]:not([data-disabled])`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:y.loop,dir:S,orientation:`vertical`,onKeyDown:A}),__vars:{"--menu-item-color":k?.isThemeColor&&k?.shade===void 0?`var(--mantine-color-${k.color}-6)`:O?.color,"--menu-item-hover":O?.hover},children:[y.alignItemsLabels===`all`&&(0,K.jsx)(`div`,{...y.getStyles(`itemIndicator`,{styles:a,classNames:n}),"data-placeholder":!0}),u&&(0,K.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:a,classNames:n}),"data-position":`left`,children:u}),f&&(0,K.jsx)(`div`,{...y.getStyles(`itemLabel`,{styles:a,classNames:n}),"data-menu-item-label":!0,children:f}),d&&(0,K.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:a,classNames:n}),"data-position":`right`,children:d})]})});_r.classes=Z,_r.displayName=`@mantine/core/MenuItem`;var vr=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=v(`MenuLabel`,null,e);return(0,K.jsx)(O,{...X().getStyles(`label`,{className:n,style:r,styles:i,classNames:t}),...o})});vr.classes=Z,vr.displayName=`@mantine/core/MenuLabel`;var yr=(0,G.createContext)(null);function br(e){let{value:t,defaultValue:n,onChange:r,children:i}=v(`MenuRadioGroup`,null,e),[a,o]=A({value:t,defaultValue:n,finalValue:null,onChange:r});return(0,K.jsx)(yr,{value:{value:a,onChange:e=>o(e)},children:i})}br.displayName=`@mantine/core/MenuRadioGroup`;function xr({size:e,style:t,...n}){return(0,K.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 5 5`,style:{width:h(e),height:h(e),...t},"aria-hidden":!0,...n,children:(0,K.jsx)(`circle`,{cx:`2.5`,cy:`2.5`,r:`2.5`,fill:`currentColor`})})}var Sr=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,color:o,closeMenuOnClick:s,rightSection:c,children:l,disabled:u,"data-disabled":d,value:f,checked:p,onChange:m,checkIcon:h,ref:g,..._}=v(`MenuRadioItem`,null,e),y=X(),b=(0,G.use)(yr),x=p??(b?b.value===f:!1);return(0,K.jsx)(cr,{role:`menuitemradio`,checked:x,indicator:h??y.checkIcon??(0,K.jsx)(xr,{size:5}),onSelect:()=>{x||(m?m(f):b&&b.onChange(f))},color:o,closeMenuOnClick:s,rightSection:c,disabled:u,dataDisabled:d,className:n,style:r,styles:i,classNames:t,buttonRef:g,others:_,children:l})});Sr.classes=Z,Sr.displayName=`@mantine/core/MenuRadioItem`;var Cr=`[data-menu-item]:not([data-disabled])`,wr=`[data-menu-active]`;function Tr(e){return e?.closest(`[data-menu-dropdown]`)}function Er(e){return e?Array.from(e.querySelectorAll(Cr)).filter(t=>t.closest(`[data-menu-dropdown]`)===e):[]}function Dr(e){e&&e.querySelectorAll(wr).forEach(t=>{t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}function Or(e,t){Dr(t),e&&(e.setAttribute(`data-menu-active`,`true`),e.scrollIntoView({block:`nearest`}))}function kr(e){return e.findIndex(e=>e.hasAttribute(`data-menu-active`))}var Ar={clearSearchOnClose:!0},jr=n(t=>{let{classNames:n,styles:r,onKeyDown:i,onChange:a,size:o,clearSearchOnClose:s,ref:c,...l}=v(`MenuSearch`,Ar,t),u=X(),d=(0,G.useRef)(null),f=e(c,d),p=(0,G.useRef)(a);p.current=a,(0,G.useEffect)(()=>u.registerSearch(),[u.registerSearch]),(0,G.useEffect)(()=>{s?u.searchExitClearRef.current=()=>{p.current?.({currentTarget:{value:``}})}:u.searchExitClearRef.current=null},[s,u.searchExitClearRef]),(0,G.useEffect)(()=>{u.opened||Dr(Tr(d.current))},[u.opened]);let m=J(a,e=>{Dr(Tr(e.currentTarget))}),h=J(i,e=>{if(e.defaultPrevented)return;let t=Tr(e.currentTarget),n=Er(t);if(e.key===`ArrowDown`){if(e.preventDefault(),n.length===0)return;let r=kr(n);Or(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=kr(n);Or(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&&Or(n[0],t);else if(e.key===`End`)e.preventDefault(),n.length>0&&Or(n[n.length-1],t);else if(e.key===`Enter`){if(e.nativeEvent.isComposing||e.nativeEvent.keyCode===229)return;let t=n[kr(n)];t&&(e.preventDefault(),t.hasAttribute(`data-sub-menu-item`)?(t.focus(),t.dispatchEvent(new KeyboardEvent(`keydown`,{key:`ArrowRight`,bubbles:!0}))):t.click())}}),g=u.getStyles(`search`);return(0,K.jsx)(b,{"data-autofocus":!0,"data-mantine-stop-propagation":!0,type:`search`,size:o,...l,ref:f,classNames:[{input:g.className},n],styles:[{input:g.style},r],onKeyDown:h,onChange:m,__staticSelector:`Menu`})});jr.classes=Z,jr.displayName=`@mantine/core/MenuSearch`;var Mr=n(t=>{let{classNames:n,className:r,style:i,styles:a,vars:o,onMouseEnter:s,onMouseLeave:c,onPointerEnter:l,onPointerLeave:u,onKeyDown:d,children:f,ref:p,...m}=v(`MenuSubDropdown`,null,t),h=(0,G.useRef)(null),g=X(),_=(0,G.use)(sr),y=hr({enabled:!g.hasSearch,opened:_?.opened??!1,getDropdown:()=>h.current}),b=J(d,e=>{y(e),!e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.length===1&&e.key!==` `&&e.stopPropagation()}),x=_?.getFloatingProps({onMouseEnter:s,onMouseLeave:c,onPointerEnter:l,onPointerLeave:u});return(0,K.jsx)(Y.Dropdown,{...m,...x,role:`menu`,"aria-orientation":`vertical`,ref:e(p,h,_?.setFloating),...g.getStyles(`dropdown`,{className:r,style:i,styles:a,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:b,children:f})});Mr.classes=Z,Mr.displayName=`@mantine/core/MenuSubDropdown`;var Nr=s(t=>{let{classNames:n,className:r,style:i,styles:a,vars:s,color:c,leftSection:l,rightSection:u,children:d,disabled:f,"data-disabled":p,closeMenuOnClick:h,ref:g,..._}=v(`MenuSubItem`,null,t),y=X(),b=(0,G.use)(sr),x=o(),{dir:S}=M(),C=(0,G.useRef)(null),T=_,E=c?x.variantColorResolver({color:c,theme:x,variant:`light`}):void 0,D=c?w({color:c,theme:x}):null,O=J(T.onKeyDown,e=>{e.key===`ArrowRight`&&(b?.open(),b?.focusFirstItem()),e.key===`ArrowLeft`&&b?.parentContext&&(b.parentContext.close(),b.parentContext.focusParentItem())}),k=J(T.onClick,()=>{!p&&h&&y.closeDropdownImmediately()}),A=J(T.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`)})}),ee=b?.getReferenceProps({onMouseEnter:T.onMouseEnter,onMouseLeave:T.onMouseLeave,onPointerEnter:T.onPointerEnter,onPointerLeave:T.onPointerLeave});return(0,K.jsxs)(m,{onMouseDown:e=>e.preventDefault(),..._,...ee,unstyled:y.unstyled,tabIndex:y.menuItemTabIndex,...y.getStyles(`item`,{className:r,style:i,styles:a,classNames:n}),ref:e(C,g,b?.setReference),role:`menuitem`,disabled:f,"data-menu-item":!0,"data-sub-menu-item":!0,"data-disabled":f||p||void 0,"data-mantine-stop-propagation":!0,onClick:k,onMouseMove:A,onKeyDown:Cn({siblingSelector:`[data-menu-item]:not([data-disabled])`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:y.loop,dir:S,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:[y.alignItemsLabels===`all`&&(0,K.jsx)(`div`,{...y.getStyles(`itemIndicator`,{styles:a,classNames:n}),"data-placeholder":!0}),l&&(0,K.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:a,classNames:n}),"data-position":`left`,children:l}),d&&(0,K.jsx)(`div`,{...y.getStyles(`itemLabel`,{styles:a,classNames:n}),"data-menu-item-label":!0,children:d}),(0,K.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:a,classNames:n}),"data-position":`right`,children:u||(0,K.jsx)($n,{...y.getStyles(`chevron`),size:14})})]})});Nr.classes=Z,Nr.displayName=`@mantine/core/MenuSubItem`;function Pr({children:e,refProp:t}){if(!oe(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 X(),(0,K.jsx)(Y.Target,{refProp:t,popupType:`menu`,children:e})}Pr.displayName=`@mantine/core/MenuSubTarget`;var Fr={offset:0,position:`right-start`,safeAreaPolygon:!0,transitionProps:{duration:0},openDelay:0,middlewares:{shift:{crossAxis:!0}}};function Ir(e){let{children:t,closeDelay:n,openDelay:r,position:i,safeAreaPolygon:a,opened:o,onChange:s,...c}=v(`MenuSub`,Fr,e),l=g(),[u,d]=A({value:o,finalValue:!1,onChange:s}),f=(0,G.use)(sr),p=X(),{dir:m}=M(),h=fe(m,i),_=f?.registerOpenSub??p.registerOpenSub,y=(0,G.useRef)(null),b=(0,G.useCallback)(e=>{let t=y.current;return t&&t!==e&&t(),y.current=e,()=>{y.current===e&&(y.current=null)}},[]),x=(0,G.useRef)(d);x.current=d;let S=(0,G.useCallback)(()=>x.current(!0),[]),C=(0,G.useCallback)(()=>x.current(!1),[]);(0,G.useEffect)(()=>{if(u)return _(C)},[u,_,C]);let{context:w,refs:T}=N({placement:h,open:u,onOpenChange:e=>{e?S():C()}}),{getReferenceProps:E,getFloatingProps:D}=B([I(w,{handleClose:a?pe(typeof a==`object`?a:void 0):void 0,delay:{open:r,close:n}})]);return(0,K.jsx)(sr,{value:{opened:u,close:C,open:S,focusFirstItem:()=>window.setTimeout(()=>{document.getElementById(`${l}-dropdown`)?.querySelectorAll(`[data-menu-item]:not([data-disabled])`)[0]?.focus()},16),focusParentItem:()=>window.setTimeout(()=>{document.getElementById(`${l}-target`)?.focus()},16),parentContext:f,setReference:T.setReference,setFloating:T.setFloating,getReferenceProps:E,getFloatingProps:D,registerOpenSub:b},children:(0,K.jsx)(Y,{opened:u,onChange:e=>e?S():C(),withinPortal:!1,withArrow:!1,id:l,position:i,...c,children:t})})}Ir.extend=e=>e,Ir.displayName=`@mantine/core/MenuSub`,Ir.Target=Pr,Ir.Dropdown=Mr,Ir.Item=Nr;var Lr={refProp:`ref`};function Rr(e){let{children:t,refProp:n,...r}=v(`MenuTarget`,Lr,e),i=H(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 a=X(),o=i.props,s=J(o.onClick,()=>{a.trigger===`click`?a.toggleDropdown():a.trigger===`click-hover`&&(a.setOpenedViaClick(!0),a.opened||a.openDropdown())}),c=J(o.onMouseEnter,()=>(a.trigger===`hover`||a.trigger===`click-hover`)&&a.openDropdown()),l=J(o.onMouseLeave,()=>{(a.trigger===`hover`||a.trigger===`click-hover`&&!a.openedViaClick)&&a.closeDropdown()});return(0,K.jsx)(Y.Target,{refProp:n,popupType:`menu`,...r,children:(0,G.cloneElement)(i,{onClick:s,onMouseEnter:c,onMouseLeave:l,"data-expanded":a.opened?!0:void 0})})}Rr.displayName=`@mantine/core/MenuTarget`;var zr={trapFocus:!0,closeOnItemClick:!0,withInitialFocusPlaceholder:!0,clickOutsideEvents:[`mousedown`,`touchstart`,`keydown`],loop:!0,trigger:`click`,openDelay:0,closeDelay:100,menuItemTabIndex:-1,alignItemsLabels:`with-indicators`},Q=n(e=>{let n=v(`Menu`,zr,e),{children:r,onOpen:i,onClose:a,opened:o,defaultOpened:s,trapFocus:c,onChange:l,closeOnItemClick:u,loop:d,closeOnEscape:f,trigger:p,openDelay:m,closeDelay:h,classNames:g,styles:_,unstyled:b,variant:x,vars:S,menuItemTabIndex:C,keepMounted:w,withInitialFocusPlaceholder:T,attributes:E,onExitTransitionEnd:D,alignItemsLabels:O,checkIcon:k,...ee}=n,te=y({name:`Menu`,classes:Z,props:n,classNames:g,styles:_,unstyled:b,attributes:E}),[j,ne]=A({value:o,defaultValue:s,finalValue:!1,onChange:l}),[re,ie]=(0,G.useState)(!1),ae=()=>{ne(!1),ie(!1),j&&a?.()},oe=()=>{ne(!0),!j&&i?.()},se=()=>{j?ae():oe()},{openDropdown:ce,closeDropdown:M}=zn({open:oe,close:ae,closeDelay:h,openDelay:m}),N=(0,G.useRef)(null),le=(0,G.useCallback)(e=>{let t=N.current;return t&&t!==e&&t(),N.current=e,()=>{N.current===e&&(N.current=null)}},[]),P=(0,G.useRef)(0),[F,ue]=(0,G.useState)(!1),de=(0,G.useCallback)(()=>(P.current+=1,P.current===1&&ue(!0),()=>{--P.current,P.current===0&&ue(!1)}),[]),I=(0,G.useRef)(null),L=()=>{I.current?.(),D?.()},R=e=>Dn(`[data-menu-item]`,`[data-menu-dropdown]`,e),{resolvedClassNames:z,resolvedStyles:fe}=t({classNames:g,styles:_,props:n});return(0,K.jsx)(ir,{value:{getStyles:te,opened:j,toggleDropdown:se,getItemIndex:R,openedViaClick:re,setOpenedViaClick:ie,closeOnItemClick:u,closeDropdown:p===`click`?ae:M,openDropdown:p===`click`?oe:ce,closeDropdownImmediately:ae,loop:d,trigger:p,unstyled:b,menuItemTabIndex:C,withInitialFocusPlaceholder:T,registerOpenSub:le,hasSearch:F,registerSearch:de,searchExitClearRef:I,alignItemsLabels:O,checkIcon:k},children:(0,K.jsx)(Y,{returnFocus:!0,...ee,opened:j,onChange:se,defaultOpened:s,trapFocus:!w&&c,closeOnEscape:f,__staticSelector:`Menu`,classNames:z,styles:fe,unstyled:b,variant:x,keepMounted:w,onExitTransitionEnd:L,children:r})})});Q.displayName=`@mantine/core/Menu`,Q.classes=Z,Q.Item=_r,Q.Label=vr,Q.Dropdown=gr,Q.Target=Rr,Q.Divider=dr,Q.Search=jr,Q.Sub=Ir,Q.CheckboxItem=lr,Q.CheckboxGroup=or,Q.RadioItem=Sr,Q.RadioGroup=br,Q.ContextMenu=ur;var Br=new Map([[`bold`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}),G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}))]]),Vr=new Map([[`bold`,G.createElement(G.Fragment,null,G.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`,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`,opacity:`0.2`}),G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}))]]),Hr=new Map([[`bold`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}),G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}))]]),Ur=new Map([[`bold`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z`,opacity:`0.2`}),G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}))]]),Wr=G.forwardRef((e,t)=>G.createElement(f,{ref:t,...e,weights:Br}));Wr.displayName=`DotsThreeIcon`;var Gr=Wr,Kr=G.forwardRef((e,t)=>G.createElement(f,{ref:t,...e,weights:Vr}));Kr.displayName=`PlusIcon`;var qr=Kr,Jr=G.forwardRef((e,t)=>G.createElement(f,{ref:t,...e,weights:Hr}));Jr.displayName=`SparkleIcon`;var Yr=Jr,Xr=G.forwardRef((e,t)=>G.createElement(f,{ref:t,...e,weights:Ur}));Xr.displayName=`TrashIcon`;var Zr=Xr,$=[];for(let e=0;e<256;++e)$.push((e+256).toString(16).slice(1));function Qr(e,t=0){return($[e[t+0]]+$[e[t+1]]+$[e[t+2]]+$[e[t+3]]+`-`+$[e[t+4]]+$[e[t+5]]+`-`+$[e[t+6]]+$[e[t+7]]+`-`+$[e[t+8]]+$[e[t+9]]+`-`+$[e[t+10]]+$[e[t+11]]+$[e[t+12]]+$[e[t+13]]+$[e[t+14]]+$[e[t+15]]).toLowerCase()}var $r=new Uint8Array(16);function ei(){return crypto.getRandomValues($r)}var ti={};function ni(e,t,n){let r;if(e)r=ii(e.random??e.rng?.()??ei(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=ei();ri(ti,e,i),r=ii(i,ti.msecs,ti.seq,t,n)}return t??Qr(r)}function ri(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=ai(n),e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function ii(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??=ai(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 ai(e){return(e[6]&127)<<24|e[7]<<16|e[8]<<8|e[9]}function oi(){return ni()}var si=[{value:`15m`,label:`15 minutes`},{value:`1h`,label:`1 hour`},{value:`6h`,label:`6 hours`},{value:`24h`,label:`24 hours`},{value:`168h`,label:`7 days`},{value:`720h`,label:`30 days`}];function ci(e){return si.find(t=>t.value===e)?.label??e}function li(e,t){let n=e?.[t];return typeof n==`string`?n:``}function ui(e,t,n=[]){let r=new URLSearchParams({window:e.window,limit:`40`});e.namespace&&r.set(`namespace`,e.namespace);for(let e of n){let n=li(t,e);n&&r.set(e,n)}return r}function di(e,t){return[`observability`,e,t.toString()]}var fi=e=>e.state.status===`error`?15e3:3e4,pi=15e3;function mi(e,t,n=!0){return be({queryKey:di(e,t),queryFn:()=>xe(`/api/observability/${e}?${t}`),enabled:n,refetchInterval:fi,staleTime:pi})}function hi(e){return e.getQueryCache().findAll({queryKey:[`observability`]}).reduce((e,t)=>Math.max(e,t.state.dataUpdatedAt),0)||null}function gi(){let e=ve(),[t,n]=(0,G.useState)(()=>hi(e));return(0,G.useEffect)(()=>e.getQueryCache().subscribe(()=>n(hi(e))),[e]),t}function _i(e){let t={};return typeof e.window==`string`&&si.some(t=>t.value===e.window)&&(t.window=e.window),typeof e.namespace==`string`&&e.namespace.trim()&&(t.namespace=e.namespace.trim()),t}var vi=[`#fafafa`,`#e6e4de`,`#bfbdb6`,`#8b8e99`,`#565b69`,`#1d2433`,`#131721`,`#0b0e14`,`#080a10`,`#05070b`],yi=[`#f3ecfd`,`#ece3fb`,`#dcc9f7`,`#d2a6ff`,`#bf94ec`,`#a97ce0`,`#9163d6`,`#7c4dcc`,`#5b32a3`,`#40236f`],bi=[`#eefbe6`,`#dcf7cc`,`#c2f0a6`,`#a5e880`,`#8fe06c`,`#7fd962`,`#66c04b`,`#4f9c3a`,`#3b7a2c`,`#2a5a1f`],xi=[`#fff5e6`,`#ffe9c9`,`#ffd79b`,`#ffc571`,`#ffbc62`,`#ffb454`,`#ef9c33`,`#c87d21`,`#9c5f16`,`#74460f`],Si=[`#fdecee`,`#fbd9dc`,`#f8b6bc`,`#f59099`,`#f37d87`,`#f26d78`,`#e04d5a`,`#c03642`,`#96262f`,`#6f1a21`],Ci=[`#e8f6ff`,`#ccebff`,`#a3daff`,`#7dcbff`,`#66c5ff`,`#59c2ff`,`#33a7e6`,`#1e86bd`,`#146694`,`#0d4a6d`],wi={dark:{text:`#bfbdb6`,muted:`#8b8e99`,grid:`#1d2433`,surface:`#131721`,border:`#565b69`},light:{text:`#4a5058`,muted:`#6b7280`,grid:`#eceef0`,surface:`#fcfcfc`,border:`#a4abb4`}},Ti={dark:[`#66d0ee`,`#a97ce0`,`#5fe8ce`,`#cb55e8`,`#41b6f8`,`#d2a6ff`],light:[`#2b93b5`,`#7c4dcc`,`#1a9c86`,`#a12fbf`,`#2f7fd4`,`#9163d6`]},Ei={micro:11,small:12,body:14,title:16,section:22,page:32},Di={display:`"Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,body:`"Geist Variable", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`};export{et as $,Ln as A,Pt as B,Gr as C,Y as D,er as E,hn as F,Ct as G,Dt as H,mn as I,_t as J,pt as K,Kt as L,Tn as M,vn as N,In as O,gn as P,tt as Q,Ut as R,qr as S,rr as T,Tt as U,jt as V,xt as W,ot as X,gt as Y,$e as Z,ui as _,Di as a,Ve as at,Zr as b,Ti as c,we as ct,_i as d,Ce as dt,Qe as et,li as f,Oe as ft,mi as g,gi as h,wi as i,Ue as it,En as j,Rn as k,Ei as l,U as lt,pi as m,Si as n,Ge as nt,Ci as o,Pe as ot,si as p,ke as pt,bt as q,yi as r,ze as rt,bi as s,He as st,vi as t,rt as tt,xi as u,Be as ut,ci as v,Q as w,Yr as x,oi as y,Vt as z}; \ No newline at end of file +import{$ as e,A as t,C as n,G as r,J as i,K as a,N as o,S as s,St as c,X as l,Y as u,_t as d,a as f,at as p,b as m,dt as h,et as g,gt as _,j as v,k as y,m as b,mt as x,nt as S,ot as C,q as w,st as T,tt as E,v as D,x as O,z as k}from"./brand-MzZ03bSa.js";import{c as A,d as ee,h as te,m as j,p as ne,u as re}from"./auth-B1VNekWU.js";import{C as ie,S as ae,T as oe,_ as se,a as ce,b as M,c as N,d as le,f as P,g as F,h as ue,i as de,l as I,m as L,n as R,p as z,r as fe,s as pe,u as B,v as V,w as me,x as H,y as he}from"./Tooltip-BJiO7C_G.js";import{r as ge}from"./use-computed-color-scheme-6JIsge00.js";import{B as _e,O as ve,U as ye,i as be,n as xe,z as Se}from"./api-CB7Xlqes.js";function Ce(e){return e[e.length-1]}function we(e,t){return typeof e==`function`?e(t):e}var Te=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable;function U(e){for(let t in e)if(Te.call(e,t))return!0;return!1}var De=()=>Object.create(null),Oe=(e,t)=>ke(e,t,De);function ke(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=Ne(e)&&Ne(i);if(!a&&!(je(e)&&je(i)))return i;let o=a?e:Ae(e);if(!o)return i;let s=a?i:Ae(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;ti||!Pe(e[o],t[o],n)))return!1;return i===a}return!1}function Fe(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}var Ie=/[\x00-\x1f\x7f"<>`{}]/g;function Le(e){return e.replace(Ie,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function Re(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Le(t)}var ze=[`http:`,`https:`,`mailto:`,`tel:`];function Be(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Ve(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=Re(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=Re(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function He(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Ue(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var W=4,Ke=5;function qe(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=a.indexOf(`{`),s;if(o!==-1&&o+1!e.parse&&e.caseSensitive===p&&e.prefix===t&&e.suffix===c);if(h)n=h;else{let e=Ze(f,r,p,t,c);n=e,e.parent=i,e.depth=a;let s;s=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],s.push(e),s.length===2&&o?.push(s)}break}}i=n}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=Xe(r);e.kind=Ke,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let f=(n.path||!n.children)&&!n.isRoot;if(f&&r.endsWith(`/`)){let e=Xe(r);e.kind=W,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=d??null,i.priority=s?.params?.priority??0,f&&!i.route&&(i.route=n,i.fullPath=r)}if(n.children)for(let r of n.children)Je(e,t,r,c,i,a,o,s)}function Ye(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Xe(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Ze(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function Qe(e,t){let n=Xe(`/`),r=new Uint16Array(6),i=[];for(let t of e)Je(!1,r,t,1,n,0,i);for(let e of i)e.sort(Ye);t.masksTree=n,t.flatCache=Ge(1e3)}function $e(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=it(e,t.masksTree);return t.flatCache.set(e,r),r}function et(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Xe(`/`),Je(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),it(r,o,n)}function tt(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=it(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=ot(a.route)),t.matchCache.set(r,a),a}function nt(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function rt(e,t=!1,n){let r=Xe(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;Je(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&We(),o[e.id]=e,c!==0&&e.path){let t=nt(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(Ye);return{processedTree:{segmentTree:r,singleCache:Ge(1e3),matchCache:Ge(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function it(e,t,n=!1){let r=e.split(`/`),i=ct(e,r,t,n);if(!i)return null;let[a]=at(e,r,i);return{route:i.node.route,rawParams:a}}function at(e,t,n){let r=st(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(a){if(_)continue;let e=t.slice(u).join(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;ee.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===W)>(e.node.kind===W)||t.node.kind===W==(e.node.kind===W)&&t.node.depth>e.node.depth)))}function pt(e){return mt(e.filter(e=>e!==void 0).join(`/`))}function mt(e){return e.replace(/\/{2,}/g,`/`)}function ht(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function gt(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function _t(e){return gt(ht(e))}function vt(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function yt(e,t,n){return vt(e,n)===vt(t,n)}function bt({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=mt(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=mt(e)),o=e.split(`/`);o.length>1&&Ce(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(Ce(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?mt(s):s)||`/`;return a&&r&&r.set(a,c),c}function xt(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function St(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>wt(e,n)).join(`/`):wt(r,n):r}function Ct({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Tt:this.parentRoute||We();let r=n?Tt:t?.path;r&&r!==`/`&&(r=ht(r));let i=t?.id||r,a=n?Tt:pt([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=pt([`/`,a]));let o=a===`__root__`?`/`:pt([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=gt(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=>Et({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.`)}},At=class extends kt{constructor(e){super(e)}},G=c(_(),1),K=x();function jt({children:e,fallback:t=null}){return(0,K.jsx)(G.Fragment,{children:Mt()?e:t})}function Mt(){return G.useSyncExternalStore(Nt,()=>!0,()=>!1)}function Nt(){return()=>{}}var Pt=G.createContext(void 0),Ft=G.createContext(void 0),It=d((e=>{var t=_();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Lt=d(((e,t)=>{t.exports=It()})),Rt=d((e=>{var t=_(),n=Lt();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.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),zt=d(((e,t)=>{t.exports=Rt()}))();function Bt(e,t){return e===t}function Vt(e,t,n=Bt){let r=(0,G.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,G.useCallback)(()=>e?.get(),[e]);return(0,zt.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Ht={};function Ut(e,t){let n=G.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=ke(n.current,i):i}}function q(e){let t=ee(),n=G.useContext(e.from?Ft:Pt),r=e.from??n,i=t.stores.getMatchStore(r),a=Ut(e,t),o=Vt(i,e=>e?a(e):Ht);if(o!==Ht)return o;(e.shouldThrow??!0)&&We()}function Wt(e){return q({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Gt(e){let{select:t,...n}=e;return q({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Kt(e){return q({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 qt(e){return q({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Jt(e){return q({...e,select:t=>e.select?e.select(t.context):t.context})}function Yt(e){let t=G.useRef(e);return Pe(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function Xt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Zt(e,t,n){if(e?.external)return Be(e.href,n)?void 0:e.href;if(!ln(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),Be(t,n)?void 0:t}catch{}}function Qt(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!yt(e.pathname,t.pathname,r))return!1}else{let n=vt(e.pathname,r),i=vt(t.pathname,r);if(!n.startsWith(i)||n.length!==i.length&&n[i.length]!==`/`)return!1}return(n?.includeSearch??!0)&&!Pe(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function $t(e,t){let n=ee(),r=j(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:k,hash:A,state:ne,mask:re,reloadDocument:ie,unsafeRelative:ae,from:oe,_fromLocation:se,...ce}=e,M=Mt(),N=Yt(e.search),le=Yt(e.params),P=Yt(o),F=G.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,N,le,e.state,e.mask,e.unsafeRelative]),ue=G.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...F}),r=cn(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,v),i=Zt(r,s,n.protocolAllowlist);return[r?.href,i,Qt(e,t,P,n.basepath,M,i!==void 0)]},[P,v,M,F,n,s]),[de,I,L]=Vt(n.stores.location,ue,Xt),R=L?we(i,{})??tn:en,z=L?en:we(a,{})??en,fe=[b,R.className,z.className].filter(Boolean).join(` `),pe=(y||R.style||z.style)&&{...y,...R.style,...z.style},B=G.useRef(!1),V=e.reloadDocument||I||v?!1:c??n.options.defaultPreload,me=l??n.options.defaultPreloadDelay??0,H=G.useCallback(()=>{n.preloadRoute(F).catch(e=>{console.warn(e),console.warn(Ot)})},[n,F]),he=G.useCallback(e=>{if(!e){on(r);return}if(!(e.isIntersecting??V===`intent`)){e.isIntersecting===!1&&on(r);return}if(!me){H();return}an.has(r)||an.set(r,setTimeout(()=>{an.delete(r),H()},me))},[H,r,V,me]);te(r,he,V!==`viewport`),G.useEffect(()=>{B.current||V===`render`&&(H(),B.current=!0)},[H,V]);let ge=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;!v&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0&&(e.preventDefault(),n.navigate({...F,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D}))};if(I)return{...ce,ref:r,href:I,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let _e=()=>{V===`intent`&&H()},ve=()=>{V===`intent`&&on(r)};return{...ce,...R,...z,href:de,ref:r,onClick:sn([x,ge]),onBlur:sn([S,ve]),onFocus:sn([C,he]),onMouseEnter:sn([w,he]),onMouseLeave:sn([T,ve]),onTouchStart:sn([E,_e]),disabled:!!v,target:_,...pe&&{style:pe},...fe&&{className:fe},...v&&nn,...L&&rn}}var en={},tn={className:`active`},nn={role:`link`,"aria-disabled":!0},rn={"data-status":`active`,"aria-current":`page`},an=new WeakMap,on=e=>{clearTimeout(an.get(e)),an.delete(e)},sn=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function cn(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function ln(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var un=G.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=$t(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return G.createElement(`a`,t,o)}return G.createElement(n,a,o)}),dn=class extends kt{constructor(e){super(e),this.useMatch=e=>q({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Jt({...e,from:this.id}),this.useSearch=e=>qt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Kt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Gt({...e,from:this.id}),this.useLoaderData=e=>Wt({...e,from:this.id}),this.useNavigate=()=>re({from:this.fullPath}),this.Link=G.forwardRef((e,t)=>(0,K.jsx)(un,{ref:t,from:this.fullPath,...e}))}};function fn(e){return new dn(e)}var pn=class extends At{constructor(e){super(e),this.useMatch=e=>q({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Jt({...e,from:this.id}),this.useSearch=e=>qt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Kt({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Gt({...e,from:this.id}),this.useLoaderData=e=>Wt({...e,from:this.id}),this.useNavigate=()=>re({from:this.fullPath}),this.Link=G.forwardRef((e,t)=>(0,K.jsx)(un,{ref:t,from:this.fullPath,...e}))}};function mn(e){return new pn(e)}function hn(e){return e=>{let t=fn(e);return t.isRoot=!1,t}}function gn(e,t){let n,r,i,a=()=>(n||=(i=void 0,e().then(e=>{n=void 0,o.preload=void 0,r=e[t??`default`]}).catch(e=>{n=void 0,i=e})),n),o=function(e){if(i){if(Fe(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(ne)ne(a());else throw a()}return G.createElement(r,e)};return o.preload=a,o}function _n(e){return typeof e!=`string`||!e.includes(`var(--mantine-scale)`)?e:e.match(/^calc\((.*?)\)$/)?.[1].split(`*`)[0].trim()}function vn(e){let t=_n(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 yn(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function bn(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 xn(e,t,n){for(let n=e+1;n{n?.(s);let c=Array.from(yn(s.currentTarget,e)?.querySelectorAll(t)||[]).filter(t=>Sn(s.currentTarget,t,e)),l=c.findIndex(e=>s.currentTarget===e),u=xn(l,c,r),d=bn(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[xn(-1,c,!1)]?.focus();break;case`End`:s.stopPropagation(),s.preventDefault(),c[bn(c.length,c,!1)]?.focus()}}}function wn(e,t={active:!0}){return typeof e!=`function`||!t.active?t.onKeyDown||ge:n=>{n.key===`Escape`&&(e(n),t.onTrigger?.())}}function J(e,t){return n=>{e?.(n),t?.(n)}}function Tn(e,t){return e in t?vn(t[e]):vn(e)}function En(e,t){let n=e.map(e=>({value:e,px:Tn(e,t)}));return n.sort((e,t)=>e.px-t.px),n}function Dn(e,t,n){return n?Array.from(yn(n,t)?.querySelectorAll(e)||[]).findIndex(e=>e===n):null}var On=[`mousedown`,`touchstart`];function kn(e,t,n,r=!0){let i=(0,G.useRef)(null),a=t||On,o=(0,G.useEffectEvent)(t=>{let{target:r}=t??{};if(!document.body.contains(r)&&r?.tagName!==`HTML`)return;let a=t.composedPath();Array.isArray(n)?n.every(e=>!!e&&!a.includes(e))&&e(t):i.current&&!a.includes(i.current)&&e(t)}),s=a.join(`,`);return(0,G.useEffect)(()=>{if(!r)return;let e=s.split(`,`);return e.forEach(e=>document.addEventListener(e,o)),()=>{e.forEach(e=>document.removeEventListener(e,o))}},[s,r]),i}var An=[`mouse`,`touch`],jn=10;function Mn(e,t={}){let{threshold:n=400,events:r=An,cancelOnMove:i=!1,onStart:a,onFinish:o,onCancel:s}=t,c=(0,G.useRef)(!1),l=(0,G.useRef)(!1),u=(0,G.useRef)(-1),d=(0,G.useRef)(null);return(0,G.useEffect)(()=>()=>window.clearTimeout(u.current),[]),(0,G.useMemo)(()=>{if(typeof e!=`function`)return{};let t=i!==!1,f=i===!0?jn:i===!1?0:i,p=t=>{(Fn(t)||Pn(t))&&(a&&a(t),d.current=Nn(t),l.current=!0,u.current=window.setTimeout(()=>{e(t),c.current=!0},n))},m=e=>{(Fn(e)||Pn(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=Nn(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,r.join(`,`)])}function Nn(e){if(Pn(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 Pn(e){return window.TouchEvent?e.nativeEvent instanceof TouchEvent:`touches`in e.nativeEvent}function Fn(e){return e.nativeEvent instanceof MouseEvent}function In({color:e,theme:t,autoContrast:n,colorScheme:r}){return(typeof n==`boolean`?n:t.autoContrast)&&w({color:e||t.primaryColor,theme:t,colorScheme:r}).isLight?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function Ln(e,t,n){return In({color:n===`dark`?e.dark:e.light,theme:t,colorScheme:n,autoContrast:!0})}function Rn(e,t){let n=e.colors[e.primaryColor];return r(n)?e.autoContrast?Ln(n,e,t):`var(--mantine-color-white)`:In({color:n[i(e,t)],theme:e,autoContrast:null})}function zn({open:e,close:t,openDelay:n,closeDelay:r}){let i=(0,G.useRef)(-1),a=(0,G.useRef)(-1),o=()=>{window.clearTimeout(i.current),window.clearTimeout(a.current)};return(0,G.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[Bn,Vn]=me(`Popover component was not found in the tree`);function Hn({childProps:e,disabled:t,opened:n,longPressDelay:r=500,setReference:i,open:a}){let o=(0,G.useRef)(!1),s=(0,G.useRef)(!1),c=(0,G.useRef)(null),l=(0,G.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=J(e.onMouseDown,e=>{t||e.button===2&&e.stopPropagation()}),f=J(e.onContextMenu,e=>{t||e.defaultPrevented||(e.preventDefault(),!s.current&&(u(e.clientX,e.clientY,e.currentTarget),o.current&&(s.current=!0)))}),p=Mn(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:J(e.onTouchStart,p.onTouchStart),onTouchEnd:J(e.onTouchEnd,p.onTouchEnd),onTouchCancel:J(e.onTouchCancel,p.onTouchCancel),onTouchMove:J(e.onTouchMove,p.onTouchMove),style:t?e.style:{...e.style,WebkitTouchCallout:`none`,WebkitUserSelect:`none`,userSelect:`none`},"data-expanded":n?!0:void 0}}function Un(e){let{children:t,disabled:n,longPressDelay:r}=v(`PopoverContextMenu`,null,e),i=H(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 a=Vn();return(0,G.cloneElement)(i,Hn({childProps:i.props,disabled:n||a.disabled,opened:a.opened,longPressDelay:r,setReference:a.reference,open:()=>{a.opened||a.onToggle()}}))}Un.displayName=`@mantine/core/PopoverContextMenu`;var Wn={dropdown:`m_38a85659`,arrow:`m_a31dc6c1`,overlay:`m_3d7bc908`},Gn=n(t=>{let n=v(`PopoverDropdown`,null,t),{className:r,style:i,vars:a,children:o,onKeyDownCapture:s,variant:c,classNames:l,styles:u,ref:d,...f}=n,p=Vn(),{dir:m}=M(),g=p.arrowPosition===`merge`&&p.withArrow?ce({position:p.placement,dir:m}):void 0,_=ye({opened:p.opened,shouldReturnFocus:p.returnFocus}),y=p.withRoles?{"aria-labelledby":p.getTargetId(),id:p.getDropdownId(),role:`dialog`,tabIndex:-1}:{},b=e(d,p.floating);return p.disabled?null:(0,K.jsx)(R,{...p.portalProps,withinPortal:p.withinPortal,children:(0,K.jsx)(D,{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,K.jsx)(Se,{active:p.trapFocus&&p.opened,innerRef:b,children:(0,K.jsxs)(O,{...y,...f,variant:c,onKeyDownCapture:wn(()=>{p.onClose?.(),p.onDismiss?.()},{active:p.closeOnEscape,onTrigger:_,onKeyDown:s}),"data-position":p.placement,"data-fixed":p.floatingStrategy===`fixed`||void 0,...p.getStyles(`dropdown`,{className:r,props:n,classNames:l,styles:u,style:[{...e,...g,zIndex:p.zIndex,top:p.y??0,left:p.x??0,width:p.width===`target`?void 0:h(p.width),...p.referenceHidden?{display:`none`}:null},p.resolvedStyles?.dropdown,u?.dropdown,i]}),children:[o,(0,K.jsx)(de,{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:n,classNames:l,styles:u})})]})})})})});Gn.classes=Wn,Gn.displayName=`@mantine/core/PopoverDropdown`;var Kn={refProp:`ref`,popupType:`dialog`},qn=n(t=>{let{children:n,refProp:r,popupType:i,ref:a,...o}=v(`PopoverTarget`,Kn,t),s=H(n);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=Vn(),d=e(l.reference,ae(s),a),f=l.withRoles?{"aria-haspopup":i,"aria-expanded":l.opened,"aria-controls":l.opened?l.getDropdownId():void 0,id:l.getTargetId()}:{},p=s.props;return(0,G.cloneElement)(s,{...c,...f,...l.targetProps,className:u(l.targetProps.className,c.className,p.className),[r]:d,...l.controlled?null:{onClick:e=>{l.onToggle(),p.onClick?.(e)}}})});qn.displayName=`@mantine/core/PopoverTarget`;function Jn(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 Yn(e,t,n,r){let i=Jn(e.middlewares),a=[F(e.offset),z()];if(i.flip&&!n){let e=typeof i.flip==`boolean`?{}:i.flip,t=r?{fallbackStrategy:`initialPlacement`,...e}:e;a.push(P(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:ue(),padding:5,...e.width===`target`&&r?{mainAxis:!1}:null,...t}}))}return i.inline&&a.push(typeof i.inline==`boolean`?L():L(i.inline)),a.push(le({element:e.arrowRef,padding:e.arrowOffset})),(i.size||e.width===`target`)&&a.push(V({...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 Xn(e){let[t,n]=A({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=(0,G.useRef)(t),[i,a]=(0,G.useState)(null),o=e.preventPositionChangeWhenVisible!==!1,s=(0,G.useRef)(t);t!==s.current&&(s.current=t,t&&i!==null&&a(null));let c=(0,G.useCallback)(()=>a(null),[]),l=()=>{t&&!e.disabled&&n(!1)},u=()=>{e.disabled||n(!t)},d=N({open:t,strategy:e.strategy,placement:o?i??e.position:e.position,middleware:Yn(e,()=>d,o&&i!==null,o),whileElementsMounted:e.keepMounted?void 0:he});(0,G.useEffect)(()=>{if(!e.keepMounted)return;let n=d.refs.reference.current,r=d.refs.floating.current;if(t&&n&&r)return he(n,r,d.update)},[e.keepMounted,t,d.update,d.elements.reference,d.elements.floating]);let f=(0,G.useRef)(!1);S(()=>{if(!t){f.current=!1;return}if(!o||i!==null)return;let e=d.refs.floating.current;if(e&&e.offsetHeight!==0&&e.offsetWidth!==0){if(!f.current){f.current=!0,d.update();return}d.isPositioned&&a(d.placement)}},[o,t,d.isPositioned,d.placement,i,d.update]);let p=(0,G.useRef)(d.placement);return S(()=>{p.current!==d.placement&&(p.current=d.placement,e.onPositionChange?.(d.placement))},[d.placement]),E(()=>{t!==r.current&&(t?e.onOpen?.():e.onClose?.()),r.current=t},[t,e.onClose,e.onOpen]),{floating:d,controlled:typeof e.opened==`boolean`,opened:t,onClose:l,onToggle:u,resetLockedPlacement:c}}var Zn={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`],zIndex:ie(`popover`),__staticSelector:`Popover`,width:`max-content`},Qn=l((e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:p(t),"--popover-shadow":C(n)}}));function Y(e){let n=v(`Popover`,Zn,e),{children:r,position:i,offset:a,onPositionChange:o,opened:s,transitionProps:c,onExitTransitionEnd:l,onEnterTransitionEnd:u,width:d,middlewares:f,withArrow:p,arrowSize:m,arrowOffset:h,arrowRadius:_,arrowPosition:b,unstyled:x,classNames:S,styles:C,closeOnClickOutside:w,withinPortal:T,portalProps:E,closeOnEscape:O,clickOutsideEvents:A,trapFocus:ee,onClose:te,onDismiss:j,onOpen:ne,onChange:re,zIndex:ie,radius:ae,shadow:oe,id:se,defaultOpened:ce,__staticSelector:N,withRoles:le,disabled:P,returnFocus:F,variant:ue,keepMounted:de,keepMountedMode:I,vars:L,floatingStrategy:z,withOverlay:pe,overlayProps:B,hideDetached:V,attributes:me,preventPositionChangeWhenVisible:H,...he}=n,ge=y({name:N,props:n,classes:Wn,classNames:S,styles:C,unstyled:x,attributes:me,rootSelector:`dropdown`,vars:L,varsResolver:Qn}),{resolvedStyles:ve}=t({classNames:S,styles:C,props:n}),ye=(0,G.useRef)(null),[be,xe]=(0,G.useState)(null),[Se,Ce]=(0,G.useState)(null),{dir:we}=M(),Te=k(),Ee=g(se),U=Xn({middlewares:f,width:d,position:fe(we,i),offset:typeof a==`number`?a+(p?m/2:0):a,arrowRef:ye,arrowOffset:h,onPositionChange:o,opened:s,defaultOpened:ce,onChange:re,onOpen:ne,onClose:te,onDismiss:j,strategy:z,disabled:P,preventPositionChangeWhenVisible:H,keepMounted:de});kn(()=>{w&&(U.onClose(),j?.())},A,[be,Se]);let De=(0,G.useCallback)(e=>{xe(e),U.floating.refs.setReference(e)},[U.floating.refs.setReference]),Oe=(0,G.useCallback)(e=>{Ce(e),U.floating.refs.setFloating(e)},[U.floating.refs.setFloating]),ke=(0,G.useCallback)(()=>{c?.onExited?.(),l?.(),U.resetLockedPlacement()},[c?.onExited,l,U.resetLockedPlacement]),Ae=(0,G.useCallback)(()=>{c?.onEntered?.(),u?.()},[c?.onEntered,u]);return(0,K.jsxs)(Bn,{value:{returnFocus:F,disabled:P,controlled:U.controlled,reference:De,floating:Oe,x:U.floating.x,y:U.floating.y,arrowX:U.floating?.middlewareData?.arrow?.x,arrowY:U.floating?.middlewareData?.arrow?.y,opened:U.opened,arrowRef:ye,transitionProps:{...c,onExited:ke,onEntered:Ae},width:d,withArrow:p,arrowSize:m,arrowOffset:h,arrowRadius:_,arrowPosition:b,placement:U.floating.placement,trapFocus:ee,withinPortal:T,portalProps:E,zIndex:ie,radius:ae,shadow:oe,closeOnEscape:O,onDismiss:j,onClose:U.onClose,onToggle:U.onToggle,getTargetId:()=>Ee,getDropdownId:()=>`${Ee}-dropdown`,withRoles:le,targetProps:he,__staticSelector:N,classNames:S,styles:C,unstyled:x,variant:ue,keepMounted:de,keepMountedMode:I,getStyles:ge,resolvedStyles:ve,floatingStrategy:z,referenceHidden:V&&Te!==`test`?U.floating.middlewareData.hide?.referenceHidden:!1},children:[r,pe&&(0,K.jsx)(D,{transition:`fade`,mounted:U.opened,duration:c?.duration||250,exitDuration:c?.exitDuration||250,children:e=>(0,K.jsx)(R,{withinPortal:T,children:(0,K.jsx)(_e,{...B,...ge(`overlay`,{className:B?.className,style:[e,B?.style]})})})})]})}Y.Target=qn,Y.Dropdown=Gn,Y.ContextMenu=Un,Y.varsResolver=Qn,Y.displayName=`@mantine/core/Popover`,Y.extend=e=>e,Y.withProps=e=>{let t=t=>(0,K.jsx)(Y,{...e,...t});return t.extend=Y.extend,t.displayName=`WithProps(${Y.displayName})`,t};function $n({style:e,size:t=16,...n}){return(0,K.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,K.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`})})}$n.displayName=`@mantine/core/AccordionChevron`;function er({size:e,style:t,...n}){return(0,K.jsx)(`svg`,{viewBox:`0 0 10 7`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:e===void 0?t:{width:h(e),height:h(e),...t},"aria-hidden":!0,...n,children:(0,K.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 tr={root:`m_347db0ec`,"root--dot":`m_fbd81e3d`,label:`m_5add502a`,section:`m_91fdda9b`},nr=l((e,{radius:t,color:n,gradient:r,variant:i,size:o,autoContrast:s,circle:c})=>{let l=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:i||`filled`,autoContrast:s});return{root:{"--badge-height":T(o,`badge-height`),"--badge-padding-x":T(o,`badge-padding-x`),"--badge-fz":T(o,`badge-fz`),"--badge-radius":c||t===void 0?void 0:p(t),"--badge-bg":n||i?l.background:void 0,"--badge-color":n||i?l.color:void 0,"--badge-bd":n||i?l.border:void 0,"--badge-dot-color":i===`dot`?a(n,e):void 0}}}),rr=s(e=>{let t=v(`Badge`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,radius:c,color:l,gradient:u,leftSection:d,rightSection:f,children:p,variant:m,fullWidth:h,autoContrast:g,circle:_,mod:b,attributes:x,...S}=t,C=y({name:`Badge`,props:t,classes:tr,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:x,vars:s,varsResolver:nr});return(0,K.jsxs)(O,{variant:m,mod:[{block:h,circle:_,"with-right-section":!!f,"with-left-section":!!d},b],...C(`root`,{variant:m}),...S,children:[d&&(0,K.jsx)(`span`,{...C(`section`),"data-position":`left`,children:d}),(0,K.jsx)(`span`,{...C(`label`),children:p}),f&&(0,K.jsx)(`span`,{...C(`section`),"data-position":`right`,children:f})]})});rr.classes=tr,rr.varsResolver=nr,rr.displayName=`@mantine/core/Badge`;var[ir,X]=me(`Menu component was not found in the tree`),ar=(0,G.createContext)(null);function or(e){let{value:t,defaultValue:n,onChange:r,children:i}=v(`MenuCheckboxGroup`,null,e),[a,o]=A({value:t,defaultValue:n,finalValue:[],onChange:r});return(0,K.jsx)(ar,{value:{values:a,onChange:(0,G.useCallback)(e=>{o(a.includes(e)?a.filter(t=>t!==e):[...a,e])},[a,o])},children:i})}or.displayName=`@mantine/core/MenuCheckboxGroup`;var sr=(0,G.createContext)(null);function cr({role:t,checked:n,indicator:r,onSelect:i,color:a,closeMenuOnClick:s,rightSection:c,children:l,disabled:u,dataDisabled:d,className:f,style:p,styles:h,classNames:g,buttonRef:_,others:v}){let y=X(),b=(0,G.use)(sr),x=o(),{dir:S}=M(),C=(0,G.useRef)(null),T=J(v.onClick,()=>{d||(i(),s&&y.closeDropdownImmediately())}),E=J(v.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`)})}),D=J(v.onKeyDown,e=>{e.key===`ArrowLeft`&&b&&(b.close(),b.focusParentItem())}),O=a?x.variantColorResolver({color:a,theme:x,variant:`light`}):void 0,k=a?w({color:a,theme:x}):null,A=y.alignItemsLabels!==`none`||n;return(0,K.jsxs)(m,{onMouseDown:e=>e.preventDefault(),...v,unstyled:y.unstyled,tabIndex:y.menuItemTabIndex,...y.getStyles(`item`,{className:f,style:p,styles:h,classNames:g}),ref:e(C,_),role:t,"aria-checked":n,disabled:u,"data-menu-item":!0,"data-checked":n||void 0,"data-disabled":u||d||void 0,"data-mantine-stop-propagation":!0,onClick:T,onMouseMove:E,onKeyDown:Cn({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":k?.isThemeColor&&k?.shade===void 0?`var(--mantine-color-${k.color}-6)`:O?.color,"--menu-item-hover":O?.hover},children:[A&&(0,K.jsx)(`div`,{...y.getStyles(`itemIndicator`,{styles:h,classNames:g}),"data-checked":n||void 0,children:n?r:null}),l&&(0,K.jsx)(`div`,{...y.getStyles(`itemLabel`,{styles:h,classNames:g}),"data-menu-item-label":!0,children:l}),c&&(0,K.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:h,classNames:g}),"data-position":`right`,children:c})]})}var Z={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`},lr=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,color:o,closeMenuOnClick:s,rightSection:c,children:l,disabled:u,"data-disabled":d,value:f,checked:p,defaultChecked:m,onChange:h,checkIcon:g,ref:_,...y}=v(`MenuCheckboxItem`,null,e),b=X(),x=(0,G.use)(ar),S=x&&f!==void 0?x.values.includes(f):void 0,[C,w]=A({value:p??S,defaultValue:m,finalValue:!1,onChange:h});return(0,K.jsx)(cr,{role:`menuitemcheckbox`,checked:C,indicator:g??b.checkIcon??(0,K.jsx)(er,{size:10}),onSelect:()=>{h?w(!C):x&&f!==void 0?x.onChange(f):w(!C)},color:o,closeMenuOnClick:s,rightSection:c,disabled:u,dataDisabled:d,className:n,style:r,styles:i,classNames:t,buttonRef:_,others:y,children:l})});lr.classes=Z,lr.displayName=`@mantine/core/MenuCheckboxItem`;function ur(e){let{children:t,disabled:n,longPressDelay:r}=v(`MenuContextMenu`,null,e),i=H(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 a=X(),o=Vn();return(0,G.cloneElement)(i,Hn({childProps:i.props,disabled:n||o.disabled,opened:a.opened,longPressDelay:r,setReference:o.reference,open:()=>a.openDropdown()}))}ur.displayName=`@mantine/core/MenuContextMenu`;var dr=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=v(`MenuDivider`,null,e);return(0,K.jsx)(O,{...X().getStyles(`divider`,{className:n,style:r,styles:i,classNames:t}),...o})});dr.classes=Z,dr.displayName=`@mantine/core/MenuDivider`;var fr=500;function pr(e){return((e.querySelector(`[data-menu-item-label]`)??e).textContent??``).trim().toLowerCase()}function mr(e){return e.length>1&&e.split(``).every(t=>t===e[0])}function hr({enabled:e,opened:t,getDropdown:n}){let r=(0,G.useRef)({buffer:``,timeoutId:null});return(0,G.useEffect)(()=>{if(t&&e)return;let n=r.current;n.timeoutId!==null&&(window.clearTimeout(n.timeoutId),n.timeoutId=null),n.buffer=``},[t,e]),(0,G.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},fr);let c=document.activeElement,l=c?o.indexOf(c):-1,u=null;if(s.buffer.length===1||mr(s.buffer)){let e=s.buffer[0],t=l+1;for(let n=0;n{let{classNames:n,className:r,style:i,styles:a,vars:o,onMouseEnter:s,onMouseLeave:c,onKeyDown:l,children:u,ref:d,...f}=v(`MenuDropdown`,null,t),p=(0,G.useRef)(null),m=X(),h=hr({enabled:!m.hasSearch,opened:m.opened,getDropdown:()=>p.current}),g=J(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())}),_=J(s,()=>(m.trigger===`hover`||m.trigger===`click-hover`)&&m.openDropdown()),y=J(c,()=>(m.trigger===`hover`||m.trigger===`click-hover`)&&m.closeDropdown());return(0,K.jsxs)(Y.Dropdown,{...f,onMouseEnter:_,onMouseLeave:y,role:`menu`,"aria-orientation":`vertical`,ref:e(d,p),...m.getStyles(`dropdown`,{className:r,style:i,styles:a,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:g,children:[m.withInitialFocusPlaceholder&&!m.hasSearch&&(0,K.jsx)(`div`,{role:`presentation`,tabIndex:-1,"data-autofocus":!0,"data-mantine-stop-propagation":!0,style:{outline:0}}),u]})});gr.classes=Z,gr.displayName=`@mantine/core/MenuDropdown`;var _r=s(t=>{let{classNames:n,className:r,style:i,styles:a,vars:s,color:c,closeMenuOnClick:l,leftSection:u,rightSection:d,children:f,disabled:p,"data-disabled":h,ref:g,..._}=v(`MenuItem`,null,t),y=X(),b=(0,G.use)(sr),x=o(),{dir:S}=M(),C=(0,G.useRef)(null),T=_,E=J(T.onClick,()=>{h||(typeof l==`boolean`?l&&y.closeDropdownImmediately():y.closeOnItemClick&&y.closeDropdownImmediately())}),D=J(T.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`)})}),O=c?x.variantColorResolver({color:c,theme:x,variant:`light`}):void 0,k=c?w({color:c,theme:x}):null,A=J(T.onKeyDown,e=>{e.key===`ArrowLeft`&&b&&(b.close(),b.focusParentItem())});return(0,K.jsxs)(m,{onMouseDown:e=>e.preventDefault(),..._,unstyled:y.unstyled,tabIndex:y.menuItemTabIndex,...y.getStyles(`item`,{className:r,style:i,styles:a,classNames:n}),ref:e(C,g),role:`menuitem`,disabled:p,"data-menu-item":!0,"data-disabled":p||h||void 0,"data-mantine-stop-propagation":!0,onClick:E,onMouseMove:D,onKeyDown:Cn({siblingSelector:`[data-menu-item]:not([data-disabled])`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:y.loop,dir:S,orientation:`vertical`,onKeyDown:A}),__vars:{"--menu-item-color":k?.isThemeColor&&k?.shade===void 0?`var(--mantine-color-${k.color}-6)`:O?.color,"--menu-item-hover":O?.hover},children:[y.alignItemsLabels===`all`&&(0,K.jsx)(`div`,{...y.getStyles(`itemIndicator`,{styles:a,classNames:n}),"data-placeholder":!0}),u&&(0,K.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:a,classNames:n}),"data-position":`left`,children:u}),f&&(0,K.jsx)(`div`,{...y.getStyles(`itemLabel`,{styles:a,classNames:n}),"data-menu-item-label":!0,children:f}),d&&(0,K.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:a,classNames:n}),"data-position":`right`,children:d})]})});_r.classes=Z,_r.displayName=`@mantine/core/MenuItem`;var vr=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=v(`MenuLabel`,null,e);return(0,K.jsx)(O,{...X().getStyles(`label`,{className:n,style:r,styles:i,classNames:t}),...o})});vr.classes=Z,vr.displayName=`@mantine/core/MenuLabel`;var yr=(0,G.createContext)(null);function br(e){let{value:t,defaultValue:n,onChange:r,children:i}=v(`MenuRadioGroup`,null,e),[a,o]=A({value:t,defaultValue:n,finalValue:null,onChange:r});return(0,K.jsx)(yr,{value:{value:a,onChange:e=>o(e)},children:i})}br.displayName=`@mantine/core/MenuRadioGroup`;function xr({size:e,style:t,...n}){return(0,K.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 5 5`,style:{width:h(e),height:h(e),...t},"aria-hidden":!0,...n,children:(0,K.jsx)(`circle`,{cx:`2.5`,cy:`2.5`,r:`2.5`,fill:`currentColor`})})}var Sr=n(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,color:o,closeMenuOnClick:s,rightSection:c,children:l,disabled:u,"data-disabled":d,value:f,checked:p,onChange:m,checkIcon:h,ref:g,..._}=v(`MenuRadioItem`,null,e),y=X(),b=(0,G.use)(yr),x=p??(b?b.value===f:!1);return(0,K.jsx)(cr,{role:`menuitemradio`,checked:x,indicator:h??y.checkIcon??(0,K.jsx)(xr,{size:5}),onSelect:()=>{x||(m?m(f):b&&b.onChange(f))},color:o,closeMenuOnClick:s,rightSection:c,disabled:u,dataDisabled:d,className:n,style:r,styles:i,classNames:t,buttonRef:g,others:_,children:l})});Sr.classes=Z,Sr.displayName=`@mantine/core/MenuRadioItem`;var Cr=`[data-menu-item]:not([data-disabled])`,wr=`[data-menu-active]`;function Tr(e){return e?.closest(`[data-menu-dropdown]`)}function Er(e){return e?Array.from(e.querySelectorAll(Cr)).filter(t=>t.closest(`[data-menu-dropdown]`)===e):[]}function Dr(e){e&&e.querySelectorAll(wr).forEach(t=>{t.closest(`[data-menu-dropdown]`)===e&&t.removeAttribute(`data-menu-active`)})}function Or(e,t){Dr(t),e&&(e.setAttribute(`data-menu-active`,`true`),e.scrollIntoView({block:`nearest`}))}function kr(e){return e.findIndex(e=>e.hasAttribute(`data-menu-active`))}var Ar={clearSearchOnClose:!0},jr=n(t=>{let{classNames:n,styles:r,onKeyDown:i,onChange:a,size:o,clearSearchOnClose:s,ref:c,...l}=v(`MenuSearch`,Ar,t),u=X(),d=(0,G.useRef)(null),f=e(c,d),p=(0,G.useRef)(a);p.current=a,(0,G.useEffect)(()=>u.registerSearch(),[u.registerSearch]),(0,G.useEffect)(()=>{s?u.searchExitClearRef.current=()=>{p.current?.({currentTarget:{value:``}})}:u.searchExitClearRef.current=null},[s,u.searchExitClearRef]),(0,G.useEffect)(()=>{u.opened||Dr(Tr(d.current))},[u.opened]);let m=J(a,e=>{Dr(Tr(e.currentTarget))}),h=J(i,e=>{if(e.defaultPrevented)return;let t=Tr(e.currentTarget),n=Er(t);if(e.key===`ArrowDown`){if(e.preventDefault(),n.length===0)return;let r=kr(n);Or(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=kr(n);Or(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&&Or(n[0],t);else if(e.key===`End`)e.preventDefault(),n.length>0&&Or(n[n.length-1],t);else if(e.key===`Enter`){if(e.nativeEvent.isComposing||e.nativeEvent.keyCode===229)return;let t=n[kr(n)];t&&(e.preventDefault(),t.hasAttribute(`data-sub-menu-item`)?(t.focus(),t.dispatchEvent(new KeyboardEvent(`keydown`,{key:`ArrowRight`,bubbles:!0}))):t.click())}}),g=u.getStyles(`search`);return(0,K.jsx)(b,{"data-autofocus":!0,"data-mantine-stop-propagation":!0,type:`search`,size:o,...l,ref:f,classNames:[{input:g.className},n],styles:[{input:g.style},r],onKeyDown:h,onChange:m,__staticSelector:`Menu`})});jr.classes=Z,jr.displayName=`@mantine/core/MenuSearch`;var Mr=n(t=>{let{classNames:n,className:r,style:i,styles:a,vars:o,onMouseEnter:s,onMouseLeave:c,onPointerEnter:l,onPointerLeave:u,onKeyDown:d,children:f,ref:p,...m}=v(`MenuSubDropdown`,null,t),h=(0,G.useRef)(null),g=X(),_=(0,G.use)(sr),y=hr({enabled:!g.hasSearch,opened:_?.opened??!1,getDropdown:()=>h.current}),b=J(d,e=>{y(e),!e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.length===1&&e.key!==` `&&e.stopPropagation()}),x=_?.getFloatingProps({onMouseEnter:s,onMouseLeave:c,onPointerEnter:l,onPointerLeave:u});return(0,K.jsx)(Y.Dropdown,{...m,...x,role:`menu`,"aria-orientation":`vertical`,ref:e(p,h,_?.setFloating),...g.getStyles(`dropdown`,{className:r,style:i,styles:a,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:b,children:f})});Mr.classes=Z,Mr.displayName=`@mantine/core/MenuSubDropdown`;var Nr=s(t=>{let{classNames:n,className:r,style:i,styles:a,vars:s,color:c,leftSection:l,rightSection:u,children:d,disabled:f,"data-disabled":p,closeMenuOnClick:h,ref:g,..._}=v(`MenuSubItem`,null,t),y=X(),b=(0,G.use)(sr),x=o(),{dir:S}=M(),C=(0,G.useRef)(null),T=_,E=c?x.variantColorResolver({color:c,theme:x,variant:`light`}):void 0,D=c?w({color:c,theme:x}):null,O=J(T.onKeyDown,e=>{e.key===`ArrowRight`&&(b?.open(),b?.focusFirstItem()),e.key===`ArrowLeft`&&b?.parentContext&&(b.parentContext.close(),b.parentContext.focusParentItem())}),k=J(T.onClick,()=>{!p&&h&&y.closeDropdownImmediately()}),A=J(T.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`)})}),ee=b?.getReferenceProps({onMouseEnter:T.onMouseEnter,onMouseLeave:T.onMouseLeave,onPointerEnter:T.onPointerEnter,onPointerLeave:T.onPointerLeave});return(0,K.jsxs)(m,{onMouseDown:e=>e.preventDefault(),..._,...ee,unstyled:y.unstyled,tabIndex:y.menuItemTabIndex,...y.getStyles(`item`,{className:r,style:i,styles:a,classNames:n}),ref:e(C,g,b?.setReference),role:`menuitem`,disabled:f,"data-menu-item":!0,"data-sub-menu-item":!0,"data-disabled":f||p||void 0,"data-mantine-stop-propagation":!0,onClick:k,onMouseMove:A,onKeyDown:Cn({siblingSelector:`[data-menu-item]:not([data-disabled])`,parentSelector:`[data-menu-dropdown]`,activateOnFocus:!1,loop:y.loop,dir:S,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:[y.alignItemsLabels===`all`&&(0,K.jsx)(`div`,{...y.getStyles(`itemIndicator`,{styles:a,classNames:n}),"data-placeholder":!0}),l&&(0,K.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:a,classNames:n}),"data-position":`left`,children:l}),d&&(0,K.jsx)(`div`,{...y.getStyles(`itemLabel`,{styles:a,classNames:n}),"data-menu-item-label":!0,children:d}),(0,K.jsx)(`div`,{...y.getStyles(`itemSection`,{styles:a,classNames:n}),"data-position":`right`,children:u||(0,K.jsx)($n,{...y.getStyles(`chevron`),size:14})})]})});Nr.classes=Z,Nr.displayName=`@mantine/core/MenuSubItem`;function Pr({children:e,refProp:t}){if(!oe(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 X(),(0,K.jsx)(Y.Target,{refProp:t,popupType:`menu`,children:e})}Pr.displayName=`@mantine/core/MenuSubTarget`;var Fr={offset:0,position:`right-start`,safeAreaPolygon:!0,transitionProps:{duration:0},openDelay:0,middlewares:{shift:{crossAxis:!0}}};function Ir(e){let{children:t,closeDelay:n,openDelay:r,position:i,safeAreaPolygon:a,opened:o,onChange:s,...c}=v(`MenuSub`,Fr,e),l=g(),[u,d]=A({value:o,finalValue:!1,onChange:s}),f=(0,G.use)(sr),p=X(),{dir:m}=M(),h=fe(m,i),_=f?.registerOpenSub??p.registerOpenSub,y=(0,G.useRef)(null),b=(0,G.useCallback)(e=>{let t=y.current;return t&&t!==e&&t(),y.current=e,()=>{y.current===e&&(y.current=null)}},[]),x=(0,G.useRef)(d);x.current=d;let S=(0,G.useCallback)(()=>x.current(!0),[]),C=(0,G.useCallback)(()=>x.current(!1),[]);(0,G.useEffect)(()=>{if(u)return _(C)},[u,_,C]);let{context:w,refs:T}=N({placement:h,open:u,onOpenChange:e=>{e?S():C()}}),{getReferenceProps:E,getFloatingProps:D}=B([I(w,{handleClose:a?pe(typeof a==`object`?a:void 0):void 0,delay:{open:r,close:n}})]);return(0,K.jsx)(sr,{value:{opened:u,close:C,open:S,focusFirstItem:()=>window.setTimeout(()=>{document.getElementById(`${l}-dropdown`)?.querySelectorAll(`[data-menu-item]:not([data-disabled])`)[0]?.focus()},16),focusParentItem:()=>window.setTimeout(()=>{document.getElementById(`${l}-target`)?.focus()},16),parentContext:f,setReference:T.setReference,setFloating:T.setFloating,getReferenceProps:E,getFloatingProps:D,registerOpenSub:b},children:(0,K.jsx)(Y,{opened:u,onChange:e=>e?S():C(),withinPortal:!1,withArrow:!1,id:l,position:i,...c,children:t})})}Ir.extend=e=>e,Ir.displayName=`@mantine/core/MenuSub`,Ir.Target=Pr,Ir.Dropdown=Mr,Ir.Item=Nr;var Lr={refProp:`ref`};function Rr(e){let{children:t,refProp:n,...r}=v(`MenuTarget`,Lr,e),i=H(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 a=X(),o=i.props,s=J(o.onClick,()=>{a.trigger===`click`?a.toggleDropdown():a.trigger===`click-hover`&&(a.setOpenedViaClick(!0),a.opened||a.openDropdown())}),c=J(o.onMouseEnter,()=>(a.trigger===`hover`||a.trigger===`click-hover`)&&a.openDropdown()),l=J(o.onMouseLeave,()=>{(a.trigger===`hover`||a.trigger===`click-hover`&&!a.openedViaClick)&&a.closeDropdown()});return(0,K.jsx)(Y.Target,{refProp:n,popupType:`menu`,...r,children:(0,G.cloneElement)(i,{onClick:s,onMouseEnter:c,onMouseLeave:l,"data-expanded":a.opened?!0:void 0})})}Rr.displayName=`@mantine/core/MenuTarget`;var zr={trapFocus:!0,closeOnItemClick:!0,withInitialFocusPlaceholder:!0,clickOutsideEvents:[`mousedown`,`touchstart`,`keydown`],loop:!0,trigger:`click`,openDelay:0,closeDelay:100,menuItemTabIndex:-1,alignItemsLabels:`with-indicators`},Q=n(e=>{let n=v(`Menu`,zr,e),{children:r,onOpen:i,onClose:a,opened:o,defaultOpened:s,trapFocus:c,onChange:l,closeOnItemClick:u,loop:d,closeOnEscape:f,trigger:p,openDelay:m,closeDelay:h,classNames:g,styles:_,unstyled:b,variant:x,vars:S,menuItemTabIndex:C,keepMounted:w,withInitialFocusPlaceholder:T,attributes:E,onExitTransitionEnd:D,alignItemsLabels:O,checkIcon:k,...ee}=n,te=y({name:`Menu`,classes:Z,props:n,classNames:g,styles:_,unstyled:b,attributes:E}),[j,ne]=A({value:o,defaultValue:s,finalValue:!1,onChange:l}),[re,ie]=(0,G.useState)(!1),ae=()=>{ne(!1),ie(!1),j&&a?.()},oe=()=>{ne(!0),!j&&i?.()},se=()=>{j?ae():oe()},{openDropdown:ce,closeDropdown:M}=zn({open:oe,close:ae,closeDelay:h,openDelay:m}),N=(0,G.useRef)(null),le=(0,G.useCallback)(e=>{let t=N.current;return t&&t!==e&&t(),N.current=e,()=>{N.current===e&&(N.current=null)}},[]),P=(0,G.useRef)(0),[F,ue]=(0,G.useState)(!1),de=(0,G.useCallback)(()=>(P.current+=1,P.current===1&&ue(!0),()=>{--P.current,P.current===0&&ue(!1)}),[]),I=(0,G.useRef)(null),L=()=>{I.current?.(),D?.()},R=e=>Dn(`[data-menu-item]`,`[data-menu-dropdown]`,e),{resolvedClassNames:z,resolvedStyles:fe}=t({classNames:g,styles:_,props:n});return(0,K.jsx)(ir,{value:{getStyles:te,opened:j,toggleDropdown:se,getItemIndex:R,openedViaClick:re,setOpenedViaClick:ie,closeOnItemClick:u,closeDropdown:p===`click`?ae:M,openDropdown:p===`click`?oe:ce,closeDropdownImmediately:ae,loop:d,trigger:p,unstyled:b,menuItemTabIndex:C,withInitialFocusPlaceholder:T,registerOpenSub:le,hasSearch:F,registerSearch:de,searchExitClearRef:I,alignItemsLabels:O,checkIcon:k},children:(0,K.jsx)(Y,{returnFocus:!0,...ee,opened:j,onChange:se,defaultOpened:s,trapFocus:!w&&c,closeOnEscape:f,__staticSelector:`Menu`,classNames:z,styles:fe,unstyled:b,variant:x,keepMounted:w,onExitTransitionEnd:L,children:r})})});Q.displayName=`@mantine/core/Menu`,Q.classes=Z,Q.Item=_r,Q.Label=vr,Q.Dropdown=gr,Q.Target=Rr,Q.Divider=dr,Q.Search=jr,Q.Sub=Ir,Q.CheckboxItem=lr,Q.CheckboxGroup=or,Q.RadioItem=Sr,Q.RadioGroup=br,Q.ContextMenu=ur;var Br=new Map([[`bold`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}),G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}))]]),Vr=new Map([[`bold`,G.createElement(G.Fragment,null,G.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`,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`,opacity:`0.2`}),G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}))]]),Hr=new Map([[`bold`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}),G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}))]]),Ur=new Map([[`bold`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.createElement(`path`,{d:`M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z`,opacity:`0.2`}),G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`,G.createElement(G.Fragment,null,G.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`}))]]),Wr=G.forwardRef((e,t)=>G.createElement(f,{ref:t,...e,weights:Br}));Wr.displayName=`DotsThreeIcon`;var Gr=Wr,Kr=G.forwardRef((e,t)=>G.createElement(f,{ref:t,...e,weights:Vr}));Kr.displayName=`PlusIcon`;var qr=Kr,Jr=G.forwardRef((e,t)=>G.createElement(f,{ref:t,...e,weights:Hr}));Jr.displayName=`SparkleIcon`;var Yr=Jr,Xr=G.forwardRef((e,t)=>G.createElement(f,{ref:t,...e,weights:Ur}));Xr.displayName=`TrashIcon`;var Zr=Xr,$=[];for(let e=0;e<256;++e)$.push((e+256).toString(16).slice(1));function Qr(e,t=0){return($[e[t+0]]+$[e[t+1]]+$[e[t+2]]+$[e[t+3]]+`-`+$[e[t+4]]+$[e[t+5]]+`-`+$[e[t+6]]+$[e[t+7]]+`-`+$[e[t+8]]+$[e[t+9]]+`-`+$[e[t+10]]+$[e[t+11]]+$[e[t+12]]+$[e[t+13]]+$[e[t+14]]+$[e[t+15]]).toLowerCase()}var $r=new Uint8Array(16);function ei(){return crypto.getRandomValues($r)}var ti={};function ni(e,t,n){let r;if(e)r=ii(e.random??e.rng?.()??ei(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=ei();ri(ti,e,i),r=ii(i,ti.msecs,ti.seq,t,n)}return t??Qr(r)}function ri(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=ai(n),e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function ii(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??=ai(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 ai(e){return(e[6]&127)<<24|e[7]<<16|e[8]<<8|e[9]}function oi(){return ni()}var si=[{value:`15m`,label:`15 minutes`},{value:`1h`,label:`1 hour`},{value:`6h`,label:`6 hours`},{value:`24h`,label:`24 hours`},{value:`168h`,label:`7 days`},{value:`720h`,label:`30 days`}];function ci(e){return si.find(t=>t.value===e)?.label??e}function li(e,t){let n=e?.[t];return typeof n==`string`?n:``}function ui(e,t,n=[]){let r=new URLSearchParams({window:e.window,limit:`40`});e.namespace&&r.set(`namespace`,e.namespace);for(let e of n){let n=li(t,e);n&&r.set(e,n)}return r}function di(e,t){return[`observability`,e,t.toString()]}var fi=e=>e.state.status===`error`?15e3:3e4,pi=15e3;function mi(e,t,n=!0){return be({queryKey:di(e,t),queryFn:()=>xe(`/api/observability/${e}?${t}`),enabled:n,refetchInterval:fi,staleTime:pi})}function hi(e){return e.getQueryCache().findAll({queryKey:[`observability`]}).reduce((e,t)=>Math.max(e,t.state.dataUpdatedAt),0)||null}function gi(){let e=ve(),[t,n]=(0,G.useState)(()=>hi(e));return(0,G.useEffect)(()=>e.getQueryCache().subscribe(()=>n(hi(e))),[e]),t}function _i(e){let t={};return typeof e.window==`string`&&si.some(t=>t.value===e.window)&&(t.window=e.window),typeof e.namespace==`string`&&e.namespace.trim()&&(t.namespace=e.namespace.trim()),t}var vi=[`#fafafa`,`#e6e4de`,`#bfbdb6`,`#8b8e99`,`#565b69`,`#1d2433`,`#131721`,`#0b0e14`,`#080a10`,`#05070b`],yi=[`#f3ecfd`,`#ece3fb`,`#dcc9f7`,`#d2a6ff`,`#bf94ec`,`#a97ce0`,`#9163d6`,`#7c4dcc`,`#5b32a3`,`#40236f`],bi=[`#eefbe6`,`#dcf7cc`,`#c2f0a6`,`#a5e880`,`#8fe06c`,`#7fd962`,`#66c04b`,`#4f9c3a`,`#3b7a2c`,`#2a5a1f`],xi=[`#fff5e6`,`#ffe9c9`,`#ffd79b`,`#ffc571`,`#ffbc62`,`#ffb454`,`#ef9c33`,`#c87d21`,`#9c5f16`,`#74460f`],Si=[`#fdecee`,`#fbd9dc`,`#f8b6bc`,`#f59099`,`#f37d87`,`#f26d78`,`#e04d5a`,`#c03642`,`#96262f`,`#6f1a21`],Ci=[`#e8f6ff`,`#ccebff`,`#a3daff`,`#7dcbff`,`#66c5ff`,`#59c2ff`,`#33a7e6`,`#1e86bd`,`#146694`,`#0d4a6d`],wi={dark:{text:`#bfbdb6`,muted:`#8b8e99`,grid:`#1d2433`,surface:`#131721`,border:`#565b69`},light:{text:`#4a5058`,muted:`#6b7280`,grid:`#eceef0`,surface:`#fcfcfc`,border:`#a4abb4`}},Ti={dark:[`#66d0ee`,`#a97ce0`,`#5fe8ce`,`#cb55e8`,`#41b6f8`,`#d2a6ff`],light:[`#2b93b5`,`#7c4dcc`,`#1a9c86`,`#a12fbf`,`#2f7fd4`,`#9163d6`]},Ei={micro:11,small:12,body:14,title:16,section:22,page:32},Di={display:`"Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,body:`"Geist Variable", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`};export{et as $,Ln as A,Pt as B,Gr as C,Y as D,er as E,hn as F,Ct as G,Dt as H,mn as I,_t as J,pt as K,Kt as L,Tn as M,vn as N,In as O,gn as P,tt as Q,Ut as R,qr as S,rr as T,Tt as U,jt as V,xt as W,ot as X,gt as Y,$e as Z,ui as _,Di as a,Ve as at,Zr as b,Ti as c,we as ct,_i as d,Ce as dt,Qe as et,li as f,Oe as ft,mi as g,gi as h,wi as i,Ue as it,En as j,Rn as k,Ei as l,U as lt,pi as m,Si as n,Ge as nt,Ci as o,Pe as ot,si as p,ke as pt,bt as q,yi as r,ze as rt,bi as s,He as st,vi as t,rt as tt,xi as u,Be as ut,ci as v,Q as w,Yr as x,oi as y,Vt as z}; \ No newline at end of file diff --git a/internal/ui/dist/index.html b/internal/ui/dist/index.html index bb70b7973..e439e77ed 100644 --- a/internal/ui/dist/index.html +++ b/internal/ui/dist/index.html @@ -21,13 +21,13 @@ document.documentElement.setAttribute("data-mantine-color-scheme", computed); } catch (e) {} - + - + - - + + diff --git a/site/public/diagrams/architecture.svg b/site/public/diagrams/architecture.svg index 47ec18192..01633b3e2 100644 --- a/site/public/diagrams/architecture.svg +++ b/site/public/diagrams/architecture.svg @@ -1,24 +1,24 @@ -Clientsfanout — one Go processStorageAnthropic or OpenAIOTLP collector or SDKBrowserExternal MCP hostHTTP :7520routes + auth middlewareIngestOTLP gRPC :4317 + HTTP :4318Embedded React assetsAgent runtimemodel + tool loopMCP server5 typed + 4 dashboard toolsTyped observability contractTelemetry commit workersatomic Parquet batchesQuery kernelDuckDB + rollupsStorage maintenanceretention + native compactionAlert enginerule evaluation + webhooksParquet batches + trace indexesstorage.data_dir/telemetryDuckDB query statestorage.data_dir/queryControl SQLitestorage.data_dir/control serves embedded assetsAG-UI streamin-memory transporttyped HTTP APIevaluates rollupsOTLP/gRPC or OTLP/HTTPHTTPS/mcp — OAuthindexed traces + SQL scansatomic replacementusers, sessions, settings, dashboards, threadsrules and fired alertsHTTPS - - - - - - - - - - - - - - + .d2-625626608 .fill-N1{fill:#0A0F25;} + .d2-625626608 .fill-N2{fill:#676C7E;} + .d2-625626608 .fill-N3{fill:#9499AB;} + .d2-625626608 .fill-N4{fill:#CFD2DD;} + .d2-625626608 .fill-N5{fill:#DEE1EB;} + .d2-625626608 .fill-N6{fill:#EEF1F8;} + .d2-625626608 .fill-N7{fill:#FFFFFF;} + .d2-625626608 .fill-B1{fill:#000536;} + .d2-625626608 .fill-B2{fill:#0F66B7;} + .d2-625626608 .fill-B3{fill:#4393DD;} + .d2-625626608 .fill-B4{fill:#87BFF3;} + .d2-625626608 .fill-B5{fill:#BCDDFB;} + .d2-625626608 .fill-B6{fill:#E5F3FF;} + .d2-625626608 .fill-AA2{fill:#7639C5;} + .d2-625626608 .fill-AA4{fill:#C1A2F3;} + .d2-625626608 .fill-AA5{fill:#DACEFB;} + .d2-625626608 .fill-AB4{fill:#EA99C6;} + .d2-625626608 .fill-AB5{fill:#FFDEF1;} + .d2-625626608 .stroke-N1{stroke:#0A0F25;} + .d2-625626608 .stroke-N2{stroke:#676C7E;} + .d2-625626608 .stroke-N3{stroke:#9499AB;} + .d2-625626608 .stroke-N4{stroke:#CFD2DD;} + .d2-625626608 .stroke-N5{stroke:#DEE1EB;} + .d2-625626608 .stroke-N6{stroke:#EEF1F8;} + .d2-625626608 .stroke-N7{stroke:#FFFFFF;} + .d2-625626608 .stroke-B1{stroke:#000536;} + .d2-625626608 .stroke-B2{stroke:#0F66B7;} + .d2-625626608 .stroke-B3{stroke:#4393DD;} + .d2-625626608 .stroke-B4{stroke:#87BFF3;} + .d2-625626608 .stroke-B5{stroke:#BCDDFB;} + .d2-625626608 .stroke-B6{stroke:#E5F3FF;} + .d2-625626608 .stroke-AA2{stroke:#7639C5;} + .d2-625626608 .stroke-AA4{stroke:#C1A2F3;} + .d2-625626608 .stroke-AA5{stroke:#DACEFB;} + .d2-625626608 .stroke-AB4{stroke:#EA99C6;} + .d2-625626608 .stroke-AB5{stroke:#FFDEF1;} + .d2-625626608 .background-color-N1{background-color:#0A0F25;} + .d2-625626608 .background-color-N2{background-color:#676C7E;} + .d2-625626608 .background-color-N3{background-color:#9499AB;} + .d2-625626608 .background-color-N4{background-color:#CFD2DD;} + .d2-625626608 .background-color-N5{background-color:#DEE1EB;} + .d2-625626608 .background-color-N6{background-color:#EEF1F8;} + .d2-625626608 .background-color-N7{background-color:#FFFFFF;} + .d2-625626608 .background-color-B1{background-color:#000536;} + .d2-625626608 .background-color-B2{background-color:#0F66B7;} + .d2-625626608 .background-color-B3{background-color:#4393DD;} + .d2-625626608 .background-color-B4{background-color:#87BFF3;} + .d2-625626608 .background-color-B5{background-color:#BCDDFB;} + .d2-625626608 .background-color-B6{background-color:#E5F3FF;} + .d2-625626608 .background-color-AA2{background-color:#7639C5;} + .d2-625626608 .background-color-AA4{background-color:#C1A2F3;} + .d2-625626608 .background-color-AA5{background-color:#DACEFB;} + .d2-625626608 .background-color-AB4{background-color:#EA99C6;} + .d2-625626608 .background-color-AB5{background-color:#FFDEF1;} + .d2-625626608 .color-N1{color:#0A0F25;} + .d2-625626608 .color-N2{color:#676C7E;} + .d2-625626608 .color-N3{color:#9499AB;} + .d2-625626608 .color-N4{color:#CFD2DD;} + .d2-625626608 .color-N5{color:#DEE1EB;} + .d2-625626608 .color-N6{color:#EEF1F8;} + .d2-625626608 .color-N7{color:#FFFFFF;} + .d2-625626608 .color-B1{color:#000536;} + .d2-625626608 .color-B2{color:#0F66B7;} + .d2-625626608 .color-B3{color:#4393DD;} + .d2-625626608 .color-B4{color:#87BFF3;} + .d2-625626608 .color-B5{color:#BCDDFB;} + .d2-625626608 .color-B6{color:#E5F3FF;} + .d2-625626608 .color-AA2{color:#7639C5;} + .d2-625626608 .color-AA4{color:#C1A2F3;} + .d2-625626608 .color-AA5{color:#DACEFB;} + .d2-625626608 .color-AB4{color:#EA99C6;} + .d2-625626608 .color-AB5{color:#FFDEF1;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#000536;--color-border-muted:#0F66B7;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0F66B7;--color-accent-emphasis:#0F66B7;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker-d2-625626608);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-dark-d2-625626608);mix-blend-mode:overlay}.sketch-overlay-B3{fill:url(#streaks-dark-d2-625626608);mix-blend-mode:overlay}.sketch-overlay-B4{fill:url(#streaks-normal-d2-625626608);mix-blend-mode:color-burn}.sketch-overlay-B5{fill:url(#streaks-normal-d2-625626608);mix-blend-mode:color-burn}.sketch-overlay-B6{fill:url(#streaks-bright-d2-625626608);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark-d2-625626608);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-normal-d2-625626608);mix-blend-mode:color-burn}.sketch-overlay-AA5{fill:url(#streaks-normal-d2-625626608);mix-blend-mode:color-burn}.sketch-overlay-AB4{fill:url(#streaks-normal-d2-625626608);mix-blend-mode:color-burn}.sketch-overlay-AB5{fill:url(#streaks-bright-d2-625626608);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker-d2-625626608);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark-d2-625626608);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal-d2-625626608);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal-d2-625626608);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright-d2-625626608);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright-d2-625626608);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright-d2-625626608);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>Clientsfanout — one Go processStorageAnthropic or OpenAIOTLP collector or SDKBrowserExternal MCP hostHTTP :7520routes + auth middlewareIngestOTLP gRPC + HTTP :7520Embedded React assetsAgent runtimemodel + tool loopMCP server5 typed + 4 dashboard toolsTyped observability contractTelemetry commit workersatomic Parquet batchesQuery kernelDuckDB + rollupsStorage maintenanceretention + native compactionAlert enginerule evaluation + webhooksParquet batches + trace indexesstorage.data_dir/telemetryDuckDB query statestorage.data_dir/queryControl SQLitestorage.data_dir/control serves embedded assetsAG-UI streamin-memory transporttyped HTTP APIevaluates rollupsOTLP/gRPC or OTLP/HTTPHTTPS/mcp — OAuthindexed traces + SQL scansatomic replacementusers, sessions, settings, dashboards, threadsrules and fired alertsHTTPS + + + + + + + + + + + + + + diff --git a/site/src/content/docs/explanation/performance.mdx b/site/src/content/docs/explanation/performance.mdx index 9512674c0..a4c29483c 100644 --- a/site/src/content/docs/explanation/performance.mdx +++ b/site/src/content/docs/explanation/performance.mdx @@ -108,7 +108,7 @@ local run starts with: export FANOUT_BENCH_INGEST_TOKEN='…' export FANOUT_BENCH_METRICS_TOKEN='…' fanout-bench run \ - --endpoint localhost:4317 \ + --endpoint localhost:7520 \ --metrics-url http://localhost:7520/-/metrics \ --insecure \ --same-host diff --git a/site/src/content/docs/guides/back-up-and-restore.mdx b/site/src/content/docs/guides/back-up-and-restore.mdx index d8cae5bd3..ef257adf2 100644 --- a/site/src/content/docs/guides/back-up-and-restore.mdx +++ b/site/src/content/docs/guides/back-up-and-restore.mdx @@ -19,8 +19,8 @@ that looks like a backup and does not restore. 1. Record the running version and configuration, keeping secrets out of ordinary logs and tickets. -2. Stop Fanout cleanly and wait for the process to exit. Shutdown closes both - OTLP listeners before draining the telemetry commit workers, so a clean exit +2. Stop Fanout cleanly and wait for the process to exit. Shutdown closes the + shared listener before draining the telemetry commit workers, so a clean exit leaves no accepted request waiting for publication. 3. Copy or snapshot the complete data directory, preserving ownership and permissions. diff --git a/site/src/content/docs/guides/terminate-tls.mdx b/site/src/content/docs/guides/terminate-tls.mdx index 0f8443299..799cbe9aa 100644 --- a/site/src/content/docs/guides/terminate-tls.mdx +++ b/site/src/content/docs/guides/terminate-tls.mdx @@ -1,6 +1,6 @@ --- title: Terminate TLS -description: Serve Fanout over TLS directly, or behind a reverse proxy, without leaving an ingest listener in the clear. +description: Serve Fanout over TLS directly, or behind a reverse proxy, for both application traffic and ingest. summary: The two supported TLS patterns, and the proxy-trust setting that has to accompany the second one. read_when: - You are exposing an instance beyond a trusted network. @@ -8,9 +8,8 @@ read_when: status: preview --- -There are two supported patterns. The mistake both exist to prevent is the same -one: terminating TLS for the browser and forgetting that ingest is a separate -listener. +Fanout serves the browser, API, MCP and both OTLP transports on one listener. +Use direct TLS or terminate TLS at a reverse proxy. ## Direct TLS @@ -22,12 +21,12 @@ FANOUT_TLS_CERT_FILE=/etc/fanout/tls/cert.pem FANOUT_TLS_KEY_FILE=/etc/fanout/tls/key.pem ``` -That enables TLS 1.3 on all three listeners at once — the browser listener, OTLP -gRPC and OTLP HTTP. +That enables TLS 1.3 on the shared listener. Browser traffic and OTLP/HTTP +use HTTPS; gRPC uses HTTP/2 negotiated through ALPN. ## Behind a reverse proxy -Terminate at the proxy and forward to Fanout's listeners. Two settings have to +Terminate at the proxy and forward to Fanout's shared port (`7520` by default). Two settings have to come with it: ```sh @@ -46,13 +45,27 @@ Never `0.0.0.0/0`: audit records and rate limits both key on client address, and trusting every source means any caller can claim to be any address. Fanout warns when a public URL is set, TLS is not terminated locally, and this is empty. -:::caution[The proxy usually only covers the browser] -A reverse proxy is normally configured for the HTTP listener alone. That leaves -OTLP gRPC and OTLP HTTP exactly as they were. Either keep both on a trusted -private network, or terminate their protocols at the proxy too — an ingest -listener carrying a bearer token in the clear is the failure this page exists to -prevent. -::: +### HTTP/2 to the backend + +For gRPC, the proxy must forward HTTP/2 to Fanout. If Fanout has no local +certificate, use an h2c upstream (plaintext HTTP/2 with prior knowledge). +Forwarding HTTP/1.1 supports the UI, API and OTLP/HTTP, but breaks gRPC. +Preserve the original Host header for MCP, and allow long-lived SSE responses. + +For example, [Caddy’s h2c upstream](https://caddyserver.com/docs/caddyfile/directives/reverse_proxy) +can serve all surfaces with: + +```text +fanout.example.com { + reverse_proxy h2c://127.0.0.1:7520 +} +``` + +On a platform that supplies one port, set `FANOUT_ADDR` to that port +(for example `:8080`). For Cloud Run, [enable end-to-end HTTP/2](https://docs.cloud.google.com/run/docs/configuring/http2); Fanout accepts +its h2c backend connections. A dedicated ingest hostname can still point at the +same backend port, with `FANOUT_INGEST_ADVERTISED_ENDPOINT` overriding setup +instructions when needed. ## External MCP clients diff --git a/site/src/content/docs/guides/troubleshoot.mdx b/site/src/content/docs/guides/troubleshoot.mdx index 9c53221d7..08cb15159 100644 --- a/site/src/content/docs/guides/troubleshoot.mdx +++ b/site/src/content/docs/guides/troubleshoot.mdx @@ -118,14 +118,15 @@ Work down this list in order: 2. **Is it the right credential, in the right header?** The ingest token is `fo_`-prefixed and goes in `Authorization: Bearer`. Browser sessions and MCP tokens are not ingest credentials. -3. **Is the listener reachable?** The native binary binds ingest to loopback. - From another host, that is a connection failure rather than an auth one. -4. **Right port for the protocol?** gRPC on `4317`, HTTP on `4318`. An HTTP - exporter pointed at the gRPC port fails in a way that does not obviously say - so. +3. **Is the listener reachable?** Both OTLP transports use `FANOUT_ADDR` + (`:7520` by default). + Check container port mappings, bind address and firewall rules. +4. **Right protocol?** Both use port `7520`. gRPC requires HTTP/2 through + any proxy. Use `grpc` or `http/protobuf` consistently with the exporter + configuration; HTTP/1.1 proxy forwarding cannot carry gRPC. For OTLP/HTTP, set the exporter protocol to `http/protobuf` and give it the base -endpoint — `http://fanout:4318`. Exporters derive `/v1/traces`, `/v1/metrics` +endpoint — `http://fanout:7520`. Exporters derive `/v1/traces`, `/v1/metrics` and `/v1/logs` from it themselves. ## Someone cannot sign in and SMTP is not configured diff --git a/site/src/content/docs/reference/endpoints.mdx b/site/src/content/docs/reference/endpoints.mdx index 45e98edbf..a55c21c4e 100644 --- a/site/src/content/docs/reference/endpoints.mdx +++ b/site/src/content/docs/reference/endpoints.mdx @@ -9,7 +9,7 @@ status: preview --- Everything below is served by the same HTTP listener as the browser client, on -`FANOUT_HTTP_ADDR` (`:7520` by default). +`FANOUT_ADDR` (`:7520` by default). This page covers the operational endpoints and what they are for. For the complete surface — every route with the exact credential it requires, taken from @@ -54,14 +54,22 @@ behind `operations:read` rather than `telemetry:read`. ## Ingest -Telemetry does not arrive on this listener. OTLP has its own two: -`FANOUT_OTLP_GRPC_ADDR` (`:4317`) and `FANOUT_OTLP_HTTP_ADDR` (`:4318`), both -requiring the ingest token. See [send your first -telemetry](/start/send-telemetry). +Both OTLP transports share `FANOUT_ADDR` with the application and require +`Authorization: Bearer `. Browser sessions and MCP OAuth tokens +cannot authorize ingest, and an ingest token cannot authorize browser API calls. -For OTLP/HTTP, exporters derive `/v1/traces`, `/v1/metrics` and `/v1/logs` from -the base endpoint themselves — give the exporter `http://host:4318`, not a -signal path. +| Transport | Endpoint | +|---|---| +| OTLP/gRPC | Same host and port, using HTTP/2 | +| OTLP/HTTP | `POST /v1/traces`, `POST /v1/metrics`, `POST /v1/logs` | + +For OTLP/HTTP, give a general exporter endpoint the base URL +`http://host:7520`. Signal-specific endpoint settings include the full signal +path. Unknown `/v1/*` paths return 404 and unsupported methods return 405, +without falling through to the browser application. The HTTP handler accepts +protobuf and gzip, with a 64 MiB decompressed body limit. + +See [send your first telemetry](/start/send-telemetry). ## What to alert on diff --git a/site/src/content/docs/reference/http-routes.mdx b/site/src/content/docs/reference/http-routes.mdx index dd2bcaa71..3f772954d 100644 --- a/site/src/content/docs/reference/http-routes.mdx +++ b/site/src/content/docs/reference/http-routes.mdx @@ -11,8 +11,8 @@ generated: true {/* Generated by cmd/fanout-docgen from internal/api, internal/agent and cmd/fanout. Edit the generator, not this page. */} -Every route below is served on `FANOUT_HTTP_ADDR` (`:7520` by default). -Telemetry does not arrive here — OTLP has its own two listeners, described in +Every route below is served on `FANOUT_ADDR` (`:7520` by default). +OTLP shares this listener but uses its own handlers and ingest credential; see [send your first telemetry](/start/send-telemetry). :::note[What this table is, and what it is not] diff --git a/site/src/content/docs/reference/settings/ingest.mdx b/site/src/content/docs/reference/settings/ingest.mdx index 63d3cd641..710575c45 100644 --- a/site/src/content/docs/reference/settings/ingest.mdx +++ b/site/src/content/docs/reference/settings/ingest.mdx @@ -1,6 +1,6 @@ --- title: "Ingest settings" -description: "The OTLP listeners, the advertised endpoint, batching, and the default namespace." +description: "The advertised OTLP endpoint, batching, and the default namespace." summary: "Settings for how telemetry arrives and how it is batched before it is written." read_when: - "Exporters cannot reach the instance." @@ -21,11 +21,9 @@ as a refusal to start rather than as a default nobody chose. | `ingest.advertised_endpoint` | `FANOUT_INGEST_ADVERTISED_ENDPOINT` | string | — | | `ingest.batch_size` | `FANOUT_INGEST_BATCH_SIZE` | integer | `50000` | | `ingest.default_namespace` | `FANOUT_DEFAULT_NAMESPACE` | string | `default` | -| `ingest.otlp_grpc_addr` | `FANOUT_OTLP_GRPC_ADDR` | string | `127.0.0.1:4317` | -| `ingest.otlp_http_addr` | `FANOUT_OTLP_HTTP_ADDR` | string | `127.0.0.1:4318` | ## Notes ### `ingest.advertised_endpoint` -The OTLP endpoint shown in collector setup guidance (e.g. "https://ingest.example.com"). It is an operator hint for trusted services and collectors, not a public-client or mobile endpoint; unlike OTLPGRPCAddr, it does not control the bind/listen address. Empty means derive host:port from the browser request and OTLPGRPCAddr as a best effort. +The OTLP endpoint shown in collector setup guidance (e.g. "https://ingest.example.com"). It is an operator hint for trusted services and collectors, not a public-client or mobile endpoint; it does not control the bind address. Empty uses server.public_url, or the browser request origin when no public URL is configured. diff --git a/site/src/content/docs/reference/settings/server.mdx b/site/src/content/docs/reference/settings/server.mdx index bd8f4e176..3cbc4b5dd 100644 --- a/site/src/content/docs/reference/settings/server.mdx +++ b/site/src/content/docs/reference/settings/server.mdx @@ -1,7 +1,7 @@ --- title: "Server settings" -description: "The HTTP listener, the public URL, TLS, and proxy trust." -summary: "Settings for the listener that serves the browser client, the API, chat and MCP." +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." read_when: - "You are putting Fanout behind a reverse proxy." - "Browser sessions are not getting Secure cookies." @@ -18,7 +18,7 @@ as a refusal to start rather than as a default nobody chose. | Setting | Environment variable | Type | Default | |---|---|---|---| -| `server.http_addr` | `FANOUT_HTTP_ADDR` | string | `:7520` | +| `server.addr` | `FANOUT_ADDR` | string | `:7520` | | `server.pprof_enabled` | `FANOUT_PPROF_ENABLED` | boolean | `false` | | `server.public_url` | `FANOUT_PUBLIC_URL` | string | — | | `server.tls.cert_file` | `FANOUT_TLS_CERT_FILE` | string | — | @@ -27,6 +27,10 @@ as a refusal to start rather than as a default nobody chose. ## Notes +### `server.addr` + +Binds the browser, API, MCP, OTLP/gRPC and OTLP/HTTP listener. + ### `server.pprof_enabled` 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. diff --git a/site/src/content/docs/start/install.mdx b/site/src/content/docs/start/install.mdx index 201d5c6fa..600170d5f 100644 --- a/site/src/content/docs/start/install.mdx +++ b/site/src/content/docs/start/install.mdx @@ -19,7 +19,7 @@ collector to place first. ```sh docker run -d --name fanout \ - -p 7520:7520 -p 4317:4317 -p 4318:4318 \ + -p 7520:7520 \ -v fanout-data:/var/lib/fanout/data \ -e FANOUT_AUTH_CODE_SECRET=$(openssl rand -hex 32) \ labstack/fanout:latest @@ -43,8 +43,8 @@ is not: `-v "$PWD/data:/var/lib/fanout/data"` fails to open its data directory unless that directory is already writable by 65532. ::: -The image binds every listener on all interfaces so the published ports work. -The native binary does not — see the table below. +Both the image and native binary bind the shared listener on all interfaces. +Set `FANOUT_ADDR=127.0.0.1:7520` for a local-only instance. @@ -114,17 +114,19 @@ reasoning is in the repository's release contract. | Port or path | Purpose | Native default | |---|---|---| -| `7520` | Browser client, HTTP API, chat, and MCP | `:7520`, all interfaces | -| `4317` | OTLP ingest over gRPC | `127.0.0.1:4317`, loopback only | -| `4318` | OTLP ingest over HTTP | `127.0.0.1:4318`, loopback only | +| `7520` | Browser, API, chat, MCP, OTLP/gRPC and OTLP/HTTP | `:7520`, all interfaces | | `./data` | Telemetry, query state, users, sessions, dashboards, alerts and agent history | `./data` | -The two ingest listeners bind to loopback by default in the native binary. That -is deliberate: an ingest port reachable from the network before you have set a -token is worse than one you have to open on purpose. Set -`FANOUT_OTLP_GRPC_ADDR` and `FANOUT_OTLP_HTTP_ADDR` when you are ready to accept -telemetry from other hosts, and read [authenticate -exporters](/start/send-telemetry) first. +Every OTLP export requires the ingest token, including on the shared port. +Ingest rejects requests before setup completes. Read [authenticate +exporters](/start/send-telemetry) before pointing a service at the instance. + +Upgrading from separate ports? Remove `FANOUT_OTLP_GRPC_ADDR` and +`FANOUT_OTLP_HTTP_ADDR` (or YAML `ingest.otlp_grpc_addr` and +`ingest.otlp_http_addr`), update exporters to port `7520` or your public HTTPS +origin, and remove the old port mappings. Rename `FANOUT_HTTP_ADDR` to +`FANOUT_ADDR` (YAML `server.http_addr` to `server.addr`). Removed settings are +startup errors. ## Next diff --git a/site/src/content/docs/start/send-telemetry.mdx b/site/src/content/docs/start/send-telemetry.mdx index 7fa2d58a5..ca810098b 100644 --- a/site/src/content/docs/start/send-telemetry.mdx +++ b/site/src/content/docs/start/send-telemetry.mdx @@ -1,7 +1,7 @@ --- title: Send your first telemetry description: Authenticate an exporter and point an OpenTelemetry SDK or Collector at a Fanout instance. -summary: The ingest token, the two OTLP endpoints, and a working SDK and Collector configuration. +summary: The ingest token, one shared OTLP address, and a working SDK and Collector configuration. read_when: - You have a running instance and nothing in it yet. - An exporter is being rejected and you need to know which credential it wants. @@ -10,8 +10,8 @@ status: preview import { Tabs, TabItem } from "@astrojs/starlight/components"; -Fanout accepts traces, logs and metrics over OTLP on two listeners: gRPC on -`4317` and HTTP on `4318`. Both want the same credential. +Fanout accepts traces, logs and metrics over OTLP/gRPC and OTLP/HTTP on the +same port as the application: `7520` by default. Both require the ingest token. ## The ingest token @@ -37,23 +37,25 @@ Two things are worth knowing before you debug a rejection: ## Configure an SDK ```sh -export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 +export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:7520 export OTEL_EXPORTER_OTLP_PROTOCOL=grpc export OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer%20fo_" export OTEL_SERVICE_NAME=checkout export OTEL_RESOURCE_ATTRIBUTES=service.namespace=storefront ``` -For the HTTP listener, use port `4318` and +For OTLP/HTTP, keep the same endpoint and set `OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf`. Use `https://` when Fanout or a -proxy in front of it terminates TLS. +proxy terminates TLS. A general OTLP endpoint is a base URL; signal-specific +variables such as `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` must include their path +(`/v1/traces`, `/v1/metrics` or `/v1/logs`). ## Configure a Collector ```yaml exporters: otlp/fanout: - endpoint: fanout.example.com:4317 + endpoint: fanout.example.com:443 headers: Authorization: "Bearer ${env:INGEST_TOKEN}" @@ -92,15 +94,13 @@ They are not an authorisation boundary. A namespace is not a user, an organisation or a tenant, and anyone who can query the instance can query every namespace in it. An instance is the trust domain. -## Opening the listeners to other hosts +## One listener -The native binary binds both ingest ports to loopback. Once you have a token and -know how TLS is terminated, set the addresses explicitly: +`FANOUT_ADDR` (`:7520`) controls the shared listener in both the native +binary and container. Use `127.0.0.1:7520` to restrict it to local clients, or +publish `7520:7520` in Docker. There are no separate ingest address settings. -```sh -FANOUT_OTLP_GRPC_ADDR=:4317 -FANOUT_OTLP_HTTP_ADDR=:4318 -``` - -The container image already binds all interfaces, which is why its ports are -publishable as shipped. +When using a reverse proxy, enable HTTP/2 to the backend for gRPC. Plaintext +Fanout accepts prior-knowledge HTTP/2 (h2c); a TLS listener negotiates HTTP/2 +through ALPN. HTTP/1.1 forwarding works for OTLP/HTTP, but cannot carry gRPC. +See [terminate TLS](/guides/terminate-tls). diff --git a/site/src/content/docs/status/capabilities.mdx b/site/src/content/docs/status/capabilities.mdx index 1e9ac3499..a99c81ddc 100644 --- a/site/src/content/docs/status/capabilities.mdx +++ b/site/src/content/docs/status/capabilities.mdx @@ -41,7 +41,7 @@ directory. | Capability | Status | Notes | |---|---|---| -| OTLP ingest over gRPC and HTTP | shipped | Both listeners, one ingest token. | +| OTLP ingest over gRPC and HTTP | shipped | Both transports, one port and one ingest token. | | Parquet storage, trace indexes, and DuckDB analytics | shipped | Authoritative local Parquet; rebuildable DuckDB query state. | | Browser client | preview | Ships in the binary; surfaces still moving. | | Chat investigator | preview | Requires an AI provider key; disabled and logged without one. | diff --git a/site/src/pages/llms.txt.ts b/site/src/pages/llms.txt.ts index 4e9986576..961748798 100644 --- a/site/src/pages/llms.txt.ts +++ b/site/src/pages/llms.txt.ts @@ -66,7 +66,7 @@ export const GET: APIRoute = async ({ site }) => { "- Fanout is a server. Its whole command line is three forms: `fanout [flags]` to run it, `fanout version`, and `fanout [--config path] login-link ` — a local-auth-mode recovery path that needs shell access on the host. Everything else is done over HTTP or MCP; there are no operational subcommands to script.", "- MCP is the intended agent interface. The server exposes its tools at `/mcp`.", "- MCP and the HTTP API authenticate with an API key, which is not the same credential as the ingest token. Both are `fo_`-prefixed; the routes tell them apart by prefix.", - "- Telemetry goes in over OTLP only: gRPC on port 4317 and HTTP on port 4318, each its own listener. There is no bespoke ingest API to script against.", + "- Telemetry goes in over OTLP only: gRPC and HTTP on the same port as the application (7520 by default). There is no bespoke ingest API to script against.", "- Ingest always requires the ingest token, and rejects everything until the first administrator exists — a collector started before setup will fail until setup completes.", "- Configuration is environment-first, and every variable is `FANOUT_`-prefixed. An unrecognised `FANOUT_` variable is a startup error rather than a silently ignored one.", "", diff --git a/ui/host/src/auth.tsx b/ui/host/src/auth.tsx index d18efe2f5..079ccf81c 100644 --- a/ui/host/src/auth.tsx +++ b/ui/host/src/auth.tsx @@ -211,7 +211,7 @@ export default function AuthGate({ children }: { children: ReactNode }) {
Setup completeSave your ingest token
Fanout shows this token once. Store it with your collector secrets before continuing. - OTLP endpoint{setupResult.suggested_endpoint ?? `${window.location.hostname}:4317`} + OTLP endpoint{setupResult.suggested_endpoint ?? window.location.origin} Header{setupResult.ingest_header_name ?? "Authorization"}: Bearer {setupResult.ingest_token} {error && {error}} diff --git a/ui/host/src/settings.test.tsx b/ui/host/src/settings.test.tsx index 06db18fa4..26ad8d433 100644 --- a/ui/host/src/settings.test.tsx +++ b/ui/host/src/settings.test.tsx @@ -17,7 +17,7 @@ function json(body: unknown, status = 200) { return new Response(JSON.stringify(body), { status, headers: { "content-type": "application/json" } }); } -const connection = { token_required: true, suggested_endpoint: "ingest.example.com:4317", tls_configured: false, header_name: "Authorization" }; +const connection = { token_required: true, suggested_endpoint: "ingest.example.com:7520", tls_configured: false, header_name: "Authorization" }; let client: QueryClient; @@ -46,7 +46,7 @@ describe("connect telemetry", () => { await vi.waitFor(() => expect(document.body.textContent).toContain("Collector configuration")); const config = document.body.textContent ?? ""; // Quoted, because an advertised IPv6 endpoint is a YAML flow sequence bare. - expect(config).toContain('endpoint: "ingest.example.com:4317"'); + expect(config).toContain('endpoint: "ingest.example.com:7520"'); // A secret pasted into a config file is a secret in version control. expect(config).toContain("${env:INGEST_TOKEN}"); // This instance serves plaintext, so the exporter has to be told. diff --git a/ui/host/src/settings.tsx b/ui/host/src/settings.tsx index c9c6b6409..aaf589d5d 100644 --- a/ui/host/src/settings.tsx +++ b/ui/host/src/settings.tsx @@ -33,7 +33,7 @@ function overTLS(endpoint: string, tlsConfigured: boolean) { * connection; this is the thing that makes telemetry arrive. * * The endpoint is quoted because an advertised IPv6 address arrives as - * "[2001:db8::1]:4317", which unquoted YAML reads as a flow sequence. The + * "[2001:db8::1]:7520", which unquoted YAML reads as a flow sequence. The * token is referenced as ${env:INGEST_TOKEN}, the name and the form the * documentation and the README both use — the braced form alone is ambiguous * where a distribution sets its own default config scheme. */ From ff3ba1f439567973f2330e4745706cbbc823580d Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Tue, 8 Sep 2026 10:10:59 -0700 Subject: [PATCH 2/3] docs: explain single-port isolation tradeoff --- docs/operations.md | 17 +++++++++++++++++ internal/api/shared_listener_test.go | 2 ++ site/src/content/docs/start/install.mdx | 7 +++++++ 3 files changed, 26 insertions(+) diff --git a/docs/operations.md b/docs/operations.md index e555fc613..b7cd366b9 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -114,6 +114,23 @@ This is a breaking configuration change: Local comparison results are in [the single-port benchmark report](benchmarks/single-port-2026-09-08.md). +### Network isolation changes + +Ingest can no longer bind to a different interface from the application. +For an internet-facing dashboard with LAN-only ingest, keep the backend port +private and configure the public proxy to deny `/v1`, `/v1/*`, and the OTLP +gRPC service paths under `/opentelemetry.proto.collector.*`. Allow collectors +through the private network or an explicitly restricted proxy route. Verify +that both OTLP transports are inaccessible through the public origin; the +ingest token is still required on the private path. + +Single-port removes the need for a proxy solely to combine listeners. Splitting +public application access from private ingest still requires network-aware +routing. The mandatory default is deliberate for this pre-release product: +there is one existing operator, so keeping two listener topologies would add +configuration and testing costs without an installed compatibility base. The +address rename is a separate breaking change, bundled into this migration. + ## Upgrade and rollback 1. Read the release notes and pin the target image tag or binary version. diff --git a/internal/api/shared_listener_test.go b/internal/api/shared_listener_test.go index 073070a38..f7ca2f7c1 100644 --- a/internal/api/shared_listener_test.go +++ b/internal/api/shared_listener_test.go @@ -18,6 +18,8 @@ type discardExport struct{} func (discardExport) Submit(context.Context, telemetrystore.Batch) error { return nil } +// Sharing a listener makes credential isolation a handler responsibility. +// Preserve these cross-credential cases when changing routing or auth middleware. func TestSharedListenerCredentialBoundaries(t *testing.T) { s := newTestAuthServer(t) user, err := s.users.Create("listener@example.com", "", "admin") diff --git a/site/src/content/docs/start/install.mdx b/site/src/content/docs/start/install.mdx index 600170d5f..5bd393e24 100644 --- a/site/src/content/docs/start/install.mdx +++ b/site/src/content/docs/start/install.mdx @@ -128,6 +128,13 @@ origin, and remove the old port mappings. Rename `FANOUT_HTTP_ADDR` to `FANOUT_ADDR` (YAML `server.http_addr` to `server.addr`). Removed settings are startup errors. +Separate interface bindings are also removed. If the dashboard is public but +ingest must remain LAN-only, keep Fanout's backend port private and deny +`/v1`, `/v1/*`, and `/opentelemetry.proto.collector.*` on the public proxy. +Allow collectors through the private network or a restricted proxy route, +and verify that neither OTLP transport is reachable through the public origin. +One port simplifies deployment; it does not replace this access policy. + ## Next The process validates its whole configuration before it opens any listener, so a From fde25ff797a7b74c18583e1b73cde835eded4c29 Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Tue, 8 Sep 2026 10:30:29 -0700 Subject: [PATCH 3/3] fix: include ports in collector endpoints --- docs/benchmarks/single-port-2026-09-08.md | 4 ++-- ...js => dashboards._dashboardId-DzFNKi-i.js} | 2 +- ...SA6vFv.js => dashboards.index-CsiRflF3.js} | 2 +- .../{index-BHeU96Kj.js => index-CbsicD3g.js} | 4 ++-- ...tings-BTUR4pT4.js => settings-DTge_r9J.js} | 8 ++++---- internal/ui/dist/index.html | 2 +- ui/host/src/settings.test.tsx | 19 +++++++++++++++++++ ui/host/src/settings.tsx | 10 ++++++++++ 8 files changed, 40 insertions(+), 11 deletions(-) rename internal/ui/dist/assets/{dashboards._dashboardId-rFBmUOpC.js => dashboards._dashboardId-DzFNKi-i.js} (90%) rename internal/ui/dist/assets/{dashboards.index-D2SA6vFv.js => dashboards.index-CsiRflF3.js} (86%) rename internal/ui/dist/assets/{index-BHeU96Kj.js => index-CbsicD3g.js} (99%) rename internal/ui/dist/assets/{settings-BTUR4pT4.js => settings-DTge_r9J.js} (97%) diff --git a/docs/benchmarks/single-port-2026-09-08.md b/docs/benchmarks/single-port-2026-09-08.md index 20ab0e891..f653baada 100644 --- a/docs/benchmarks/single-port-2026-09-08.md +++ b/docs/benchmarks/single-port-2026-09-08.md @@ -18,7 +18,7 @@ Raw final evidence: [test log](single-port-stdlib-2026-09-08.log), [JSON measure Reproduce the final durable comparison: ```sh -rtk just test '-tags transportbench ./internal/ingest -run ^TestTransportComparison$/durable=true -v -count=1 -timeout=10m' +just test '-tags transportbench ./internal/ingest -run ^TestTransportComparison$/durable=true -v -count=1 -timeout=10m' ``` Functional validation also passed: full Go suite, 122 UI tests, 13 focused shared-listener tests under the race detector, lint, dependency notices, release-script tests, UI dependency audits, generated docs, diagram consistency and the documentation build. Those tests cover HTTP and gRPC on one port, plaintext and TLS, credential separation, invalid ingest routes, export draining and forced cancellation of long-lived HTTP/2 streams. @@ -81,7 +81,7 @@ The independent fanout-bench suite was inspected but not used: its managed path The experiment is build-tagged and excluded from normal tests: ```sh -rtk proxy env GOTOOLCHAIN=go1.27.0 go test -tags transportbench ./internal/ingest -run '^TestTransportComparison$' -v -count=1 -timeout=10m +GOTOOLCHAIN=go1.27.0 go test -tags transportbench ./internal/ingest -run '^TestTransportComparison$' -v -count=1 -timeout=10m ``` Raw evidence: [test log](single-port-2026-09-08.log), [JSON measurements](single-port-2026-09-08.json), [harness](../../internal/ingest/transport_bench_test.go). diff --git a/internal/ui/dist/assets/dashboards._dashboardId-rFBmUOpC.js b/internal/ui/dist/assets/dashboards._dashboardId-DzFNKi-i.js similarity index 90% rename from internal/ui/dist/assets/dashboards._dashboardId-rFBmUOpC.js rename to internal/ui/dist/assets/dashboards._dashboardId-DzFNKi-i.js index ec4576f97..0497c807d 100644 --- a/internal/ui/dist/assets/dashboards._dashboardId-rFBmUOpC.js +++ b/internal/ui/dist/assets/dashboards._dashboardId-DzFNKi-i.js @@ -1 +1 @@ -import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-B1VNekWU.js";import{t as n}from"./dashboard-yZ7oG_PO.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{t as i}from"./index-BHeU96Kj.js";var a=e();function o(){let{dashboardId:e}=i.useParams(),o=i.useSearch(),s=t(),{agentAvailable:c,openChat:l}=r();return(0,a.jsx)(n,{dashboardID:e,agentAvailable:c,onOpenChat:l,onDashboardChange:(e,t)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:o,replace:t}),urlFilters:o,onFiltersChange:t=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{window:t.window,namespace:t.namespace||void 0},replace:!0})})}export{o as component}; \ No newline at end of file +import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-B1VNekWU.js";import{t as n}from"./dashboard-yZ7oG_PO.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{t as i}from"./index-CbsicD3g.js";var a=e();function o(){let{dashboardId:e}=i.useParams(),o=i.useSearch(),s=t(),{agentAvailable:c,openChat:l}=r();return(0,a.jsx)(n,{dashboardID:e,agentAvailable:c,onOpenChat:l,onDashboardChange:(e,t)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:o,replace:t}),urlFilters:o,onFiltersChange:t=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{window:t.window,namespace:t.namespace||void 0},replace:!0})})}export{o as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboards.index-D2SA6vFv.js b/internal/ui/dist/assets/dashboards.index-CsiRflF3.js similarity index 86% rename from internal/ui/dist/assets/dashboards.index-D2SA6vFv.js rename to internal/ui/dist/assets/dashboards.index-CsiRflF3.js index 0e3f3315b..370dd9fc4 100644 --- a/internal/ui/dist/assets/dashboards.index-D2SA6vFv.js +++ b/internal/ui/dist/assets/dashboards.index-CsiRflF3.js @@ -1 +1 @@ -import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-B1VNekWU.js";import{t as n}from"./dashboard-yZ7oG_PO.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{n as i}from"./index-BHeU96Kj.js";var a=e();function o(){let e=i.useSearch(),o=t(),{agentAvailable:s,openChat:c}=r();return(0,a.jsx)(n,{agentAvailable:s,onOpenChat:c,onDashboardChange:t=>void o({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:e,replace:!0}),urlFilters:e})}export{o as component}; \ No newline at end of file +import{mt as e}from"./brand-MzZ03bSa.js";import{u as t}from"./auth-B1VNekWU.js";import{t as n}from"./dashboard-yZ7oG_PO.js";import{a as r}from"./preload-helper-BL3qEkUh.js";import{n as i}from"./index-CbsicD3g.js";var a=e();function o(){let e=i.useSearch(),o=t(),{agentAvailable:s,openChat:c}=r();return(0,a.jsx)(n,{agentAvailable:s,onOpenChat:c,onDashboardChange:t=>void o({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:e,replace:!0}),urlFilters:e})}export{o as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/index-BHeU96Kj.js b/internal/ui/dist/assets/index-CbsicD3g.js similarity index 99% rename from internal/ui/dist/assets/index-BHeU96Kj.js rename to internal/ui/dist/assets/index-CbsicD3g.js index ff72ad7b1..f852b80b5 100644 --- a/internal/ui/dist/assets/index-BHeU96Kj.js +++ b/internal/ui/dist/assets/index-CbsicD3g.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-VCBnBbPZ.js","assets/brand-MzZ03bSa.js","assets/auth-B1VNekWU.js","assets/settings-BTUR4pT4.js","assets/Tooltip-BJiO7C_G.js","assets/api-CB7Xlqes.js","assets/WarningCircle.es-BrGtHGYK.js","assets/chat.index-DYB6vKSb.js","assets/chat-B3ZKcKVO.js","assets/preload-helper-BL3qEkUh.js","assets/format-urrStEsn.js","assets/chat._threadId-DYB6vKSb.js","assets/dashboards.index-D2SA6vFv.js","assets/dashboard-yZ7oG_PO.js","assets/tokens-CPxx1QN7.js","assets/use-computed-color-scheme-6JIsge00.js","assets/dashboards._dashboardId-rFBmUOpC.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-VCBnBbPZ.js","assets/brand-MzZ03bSa.js","assets/auth-B1VNekWU.js","assets/settings-DTge_r9J.js","assets/Tooltip-BJiO7C_G.js","assets/api-CB7Xlqes.js","assets/WarningCircle.es-BrGtHGYK.js","assets/chat.index-DYB6vKSb.js","assets/chat-B3ZKcKVO.js","assets/preload-helper-BL3qEkUh.js","assets/format-urrStEsn.js","assets/chat._threadId-DYB6vKSb.js","assets/dashboards.index-CsiRflF3.js","assets/dashboard-yZ7oG_PO.js","assets/tokens-CPxx1QN7.js","assets/use-computed-color-scheme-6JIsge00.js","assets/dashboards._dashboardId-DzFNKi-i.js"])))=>i.map(i=>d[i]); import{B as e,C as t,F as n,G as r,H as i,I as a,J as o,K as s,L as c,M as l,N as u,O as d,P as f,S as p,St as m,V as h,W as g,X as _,Y as v,_ as y,_t as b,a as x,at as ee,b as te,ct as ne,d as re,dt as S,et as ie,f as ae,ft as oe,gt as se,h as ce,ht as le,j as ue,k as de,l as C,mt as fe,nt as pe,pt as me,rt as he,s as ge,st as _e,t as ve,u as ye,ut as be,x as xe,yt as Se}from"./brand-MzZ03bSa.js";import{a as Ce,d as we,f as Te,g as Ee,i as De,l as Oe,n as ke,o as Ae,r as je,t as Me,u as Ne}from"./auth-B1VNekWU.js";import{$ as Pe,A as Fe,B as Ie,C as Le,F as Re,G as ze,H as Be,I as Ve,J as He,K as Ue,L as We,M as Ge,N as Ke,P as qe,Q as Je,R as Ye,S as Xe,T as Ze,U as Qe,V as $e,W as et,X as tt,Y as nt,Z as rt,_ as it,a as at,at as ot,b as st,ct,d as lt,dt as ut,et as dt,ft,g as pt,i as mt,it as ht,j as gt,k as _t,l as vt,lt as yt,m as bt,n as xt,nt as St,o as Ct,ot as wt,pt as Tt,q as Et,r as Dt,rt as Ot,s as kt,st as At,t as jt,tt as Mt,u as Nt,ut as Pt,w as Ft,x as It,y as Lt,z as Rt}from"./tokens-CPxx1QN7.js";import{C as zt,b as Bt,o as Vt,t as Ht,w as Ut}from"./Tooltip-BJiO7C_G.js";import{n as Wt,t as Gt}from"./use-computed-color-scheme-6JIsge00.js";import{A as Kt,C as qt,D as Jt,E as Yt,F as Xt,H as Zt,I as Qt,L as $t,M as en,N as tn,O as nn,P as rn,R as an,S as on,_ as sn,a as cn,b as ln,c as un,d as dn,f as fn,g as pn,h as mn,i as hn,j as gn,k as _n,l as vn,m as yn,n as bn,o as xn,p as Sn,r as Cn,t as wn,u as Tn,v as En,x as Dn,y as On}from"./api-CB7Xlqes.js";import{a as kn,i as An,n as jn,o as Mn,r as Nn,t as Pn}from"./preload-helper-BL3qEkUh.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 Fn=b((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,ae());else{var t=n(l);t!==null&&ce(x,t.startTime-e)}}}var ee=!1,te=-1,ne=5,re=-1;function S(){return g?!0:!(e.unstable_now()-ret&&S());){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&&ce(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ae():ee=!1}}}var ae;if(typeof y==`function`)ae=function(){y(ie)};else if(typeof MessageChannel<`u`){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=ie,ae=function(){se.postMessage(null)}}else ae=function(){_(ie,0)};function ce(t,n){te=_(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(te),te=-1):h=!0,ce(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,ae()))),r},e.unstable_shouldYield=S,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),In=b(((e,t)=>{t.exports=Fn()})),Ln=b((e=>{var t=In(),n=se(),r=le();function i(e){var t=`https://react.dev/errors/`+e;if(1he||(e.current=me[he],me[he]=null,he--)}function ve(e,t){he++,me[he]=e.current,e.current=t}var ye=ge(null),be=ge(null),xe=ge(null),Se=ge(null);function Ce(e,t){switch(ve(xe,t),ve(be,e),ve(ye,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?$d(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=$d(t),e=ef(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}_e(ye),ve(ye,e)}function we(){_e(ye),_e(be),_e(xe)}function Te(e){e.memoizedState!==null&&ve(Se,e);var t=ye.current,n=ef(t,e.type);t!==n&&(ve(be,e),ve(ye,n))}function Ee(e){be.current===e&&(_e(ye),_e(be)),Se.current===e&&(_e(Se),sp._currentValue=pe)}var De,Oe;function ke(e){if(De===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);De=t&&t[1]||``,Oe=-1)`:-1=0}function Mf(e){for(var t=[`topLevel`],n=0,r,i,a,o=function(e){return t.push(e)},s=function(e){return t[t.length-1]=e},c=function(e){r??(r=n,i=t.length,a=e)},l=function(e){e===a&&(r=void 0,i=void 0,a=void 0)},u=function(){return t.pop()},d=function(){return n--},f=function(e){if(`0`<=e&&e<=`9`){o(`number`);return}switch(e){case`"`:o(`string`);return;case`-`:o(`numberNeedsDigit`);return;case`t`:o(`true`);return;case`f`:o(`false`);return;case`n`:o(`null`);return;case`[`:o(`arrayNeedsValue`);return;case`{`:o(`objectNeedsKey`);return}},p=e.length;n`9`)&&(d(),u());break;case`numberNeedsDigit`:s(`number`);break;case`numberNeedsExponent`:s(m===`+`||m===`-`?`numberNeedsDigit`:`number`);break;case`true`:case`false`:case`null`:(m<`a`||m>`z`)&&(d(),u());break;case`arrayNeedsValue`:m===`]`?u():jf(m)||(l(`collectionItem`),s(`arrayNeedsComma`),f(m));break;case`arrayNeedsComma`:m===`]`?u():m===`,`&&(c(`collectionItem`),s(`arrayNeedsValue`));break;case`objectNeedsKey`:m===`}`?u():m===`"`&&(c(`collectionItem`),s(`objectNeedsColon`),o(`string`));break;case`objectNeedsColon`:m===`:`&&s(`objectNeedsValue`);break;case`objectNeedsValue`:jf(m)||(l(`collectionItem`),s(`objectNeedsComma`),f(m));break;case`objectNeedsComma`:m===`}`?u():m===`,`&&(c(`collectionItem`),s(`objectNeedsKey`))}}i!=null&&(t.length=i);for(var h=[r==null?e:e.slice(0,r)],g=function(t){return h.push(t.slice(e.length-e.lastIndexOf(t[0])))},_=t.length-1;_>=0;_--)switch(t[_]){case`string`:h.push(`"`);break;case`numberNeedsDigit`:case`numberNeedsExponent`:h.push(`0`);break;case`true`:g(`true`);break;case`false`:g(`false`);break;case`null`:g(`null`);break;case`arrayNeedsValue`:case`arrayNeedsComma`:h.push(`]`);break;case`objectNeedsKey`:case`objectNeedsColon`:case`objectNeedsValue`:case`objectNeedsComma`:h.push(`}`)}return h.join(``)}function Nf(){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)<=Pf&&(i+=r/Pf|0,r%=Pf)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?Bf(r,i):zf(r,i)}function If(e,t){let n=zf(e,t),r=n.hi&2147483648;r&&(n=Bf(n.lo,n.hi));let i=Lf(n.lo,n.hi);return r?`-`+i:i}function Lf(e,t){if({lo:e,hi:t}=Rf(e,t),t<=2097151)return String(Pf*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()+Vf(o)+Vf(a)}function Rf(e,t){return{lo:e>>>0,hi:t>>>0}}function zf(e,t){return{lo:e|0,hi:t|0}}function Bf(e,t){return t=~t,e?e=~e+1:t+=1,zf(e,t)}var Vf=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function Hf(){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 Uf=Wf();function Wf(){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)),Jf(i)}return qf}function Xf(e){return(t,n)=>{let r=e(t);return n.set(r),{written:r.byteLength}}}var Zf;(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`})(Zf||={});var U=class{constructor(e){this.stackPos=[],this.encodeUtf8Into=e?Xf(e):Yf().encodeUtf8Into,this.buffer=ep,this.viewCache=tp,this.pos=0}ensureCapacity(e){let t=this.pos+e;if(t>this.buffer.length){let e=this.buffer.length||Qf;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($f),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-$f,n=rp(t);return n>$f&&(this.ensureCapacity(n-$f),this.buffer.copyWithin(e+n,e+$f,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(ap(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(ip(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<=np){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=rp(t),r=this.buffer,i=this.pos,{written:a}=this.encodeUtf8Into(e,r.subarray(i+n)),o=rp(a);return o!=n&&r.copyWithin(i+o,i+n,i+n+a),this.uint32(a),this.pos+=a,this}float(e){return op(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 ap(e),this.ensureCapacity(4),this.view().setUint32(this.pos,e,!0),this.pos+=4,this}sfixed32(e){return ip(e),this.ensureCapacity(4),this.view().setInt32(this.pos,e,!0),this.pos+=4,this}sint32(e){return ip(e),this.uint32((e<<1^e>>31)>>>0)}sfixed64(e){let t=Uf.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=Uf.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=Uf.enc(e);return this.writeVarint64(t.lo,t.hi)}sint64(e){let t=Uf.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=Uf.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}},Qf=128,$f=1,ep=new Uint8Array,tp=new DataView(ep.buffer),np=32;function rp(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var W=class{constructor(e,t=Yf().decodeUtf8){this.decodeUtf8=t,this.varint64Lo=0,this.varint64Hi=0,this.varint64=Nf,this.uint32=Hf,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 Zf.Varint:for(;this.buf[this.pos++]&128;);break;case Zf.Bit64:this.pos+=4;case Zf.Bit32:this.pos+=4;break;case Zf.LengthDelimited:let r=this.uint32();this.pos+=r;break;case Zf.StartGroup:if(n<=0)throw Error(`maximum recursion depth reached`);for(;;){let[e,r]=this.tag();if(r===Zf.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(),Uf.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Uf.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,Uf.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 Uf.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Uf.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<=np){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 ip(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 ap(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 op(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(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw Error(`invalid float32: `+e)}var sp=function(e){return e[e.NULL_VALUE=0]=`NULL_VALUE`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function cp(){return{fields:{}}}var lp={encode(e,t=new U){return Object.entries(e.fields).forEach(([e,n])=>{n!==void 0&&dp.encode({key:e,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=cp();for(;n.pos>>3){case 1:{if(e!==10)break;let t=dp.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 lp.fromPartial(e??{})},fromPartial(e){let t=cp();return t.fields=Object.entries(e.fields??{}).reduce((e,[t,n])=>(n!==void 0&&(e[t]=n),e),{}),t},wrap(e){let t=cp();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 up(){return{key:``,value:void 0}}var dp={encode(e,t=new U){return e.key!==``&&t.uint32(10).string(e.key),e.value!==void 0&&G.encode(G.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=up();for(;n.pos>>3){case 1:if(e!==10)break;i.key=n.string();continue;case 2:if(e!==18)break;i.value=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return dp.fromPartial(e??{})},fromPartial(e){let t=up();return t.key=e.key??``,t.value=e.value??void 0,t}};function fp(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var G={encode(e,t=new U){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&&lp.encode(lp.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&mp.encode(mp.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=fp();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=lp.unwrap(lp.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.listValue=mp.unwrap(mp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return G.fromPartial(e??{})},fromPartial(e){let t=fp();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=fp();if(e===null)t.nullValue=sp.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 pp(){return{values:[]}}var mp={encode(e,t=new U){for(let n of e.values)G.encode(G.wrap(n),t.uint32(10).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=pp();for(;n.pos>>3){case 1:if(e!==10)break;i.values.push(G.unwrap(G.decode(n,n.uint32())));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return mp.fromPartial(e??{})},fromPartial(e){let t=pp();return t.values=e.values?.map(e=>e)||[],t},wrap(e){let t=pp();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty(`values`)&&globalThis.Array.isArray(e.values)?e.values:e}},hp=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 gp(){return{op:0,path:``,from:void 0,value:void 0}}var _p={encode(e,t=new U){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&&G.encode(G.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=gp();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=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return _p.fromPartial(e??{})},fromPartial(e){let t=gp();return t.op=e.op??0,t.path=e.path??``,t.from=e.from??void 0,t.value=e.value??void 0,t}};function vp(){return{id:``,type:``,function:void 0,metadata:void 0}}var yp={encode(e,t=new U){return e.id!==``&&t.uint32(10).string(e.id),e.type!==``&&t.uint32(18).string(e.type),e.function!==void 0&&xp.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&lp.encode(lp.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=vp();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=xp.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.metadata=lp.unwrap(lp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return yp.fromPartial(e??{})},fromPartial(e){let t=vp();return t.id=e.id??``,t.type=e.type??``,t.function=e.function!==void 0&&e.function!==null?xp.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function bp(){return{name:``,arguments:``}}var xp={encode(e,t=new U){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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=bp();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 xp.fromPartial(e??{})},fromPartial(e){let t=bp();return t.name=e.name??``,t.arguments=e.arguments??``,t}};function Sp(){return{value:``,mimeType:``}}var Cp={encode(e,t=new U){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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Sp();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 Cp.fromPartial(e??{})},fromPartial(e){let t=Sp();return t.value=e.value??``,t.mimeType=e.mimeType??``,t}};function wp(){return{value:``,mimeType:void 0}}var Tp={encode(e,t=new U){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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=wp();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 Tp.fromPartial(e??{})},fromPartial(e){let t=wp();return t.value=e.value??``,t.mimeType=e.mimeType??void 0,t}};function Ep(){return{data:void 0,url:void 0}}var Dp={encode(e,t=new U){return e.data!==void 0&&Cp.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Tp.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Ep();for(;n.pos>>3){case 1:if(e!==10)break;i.data=Cp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.url=Tp.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Dp.fromPartial(e??{})},fromPartial(e){let t=Ep();return t.data=e.data!==void 0&&e.data!==null?Cp.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Tp.fromPartial(e.url):void 0,t}};function Op(){return{text:``}}var kp={encode(e,t=new U){return e.text!==``&&t.uint32(10).string(e.text),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Op();for(;n.pos>>3){case 1:if(e!==10)break;i.text=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return kp.fromPartial(e??{})},fromPartial(e){let t=Op();return t.text=e.text??``,t}};function Ap(){return{source:void 0,metadata:void 0}}var jp={encode(e,t=new U){return e.source!==void 0&&Dp.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Ap();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Dp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return jp.fromPartial(e??{})},fromPartial(e){let t=Ap();return t.source=e.source!==void 0&&e.source!==null?Dp.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Mp(){return{source:void 0,metadata:void 0}}var Np={encode(e,t=new U){return e.source!==void 0&&Dp.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Mp();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Dp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Np.fromPartial(e??{})},fromPartial(e){let t=Mp();return t.source=e.source!==void 0&&e.source!==null?Dp.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Pp(){return{source:void 0,metadata:void 0}}var Fp={encode(e,t=new U){return e.source!==void 0&&Dp.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Pp();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Dp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Fp.fromPartial(e??{})},fromPartial(e){let t=Pp();return t.source=e.source!==void 0&&e.source!==null?Dp.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Ip(){return{source:void 0,metadata:void 0}}var Lp={encode(e,t=new U){return e.source!==void 0&&Dp.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&G.encode(G.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Ip();for(;n.pos>>3){case 1:if(e!==10)break;i.source=Dp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.metadata=G.unwrap(G.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Lp.fromPartial(e??{})},fromPartial(e){let t=Ip();return t.source=e.source!==void 0&&e.source!==null?Dp.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function Rp(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var zp={encode(e,t=new U){return e.text!==void 0&&kp.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&jp.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Np.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Fp.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Lp.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Rp();for(;n.pos>>3){case 1:if(e!==10)break;i.text=kp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.image=jp.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.audio=Np.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.video=Fp.decode(n,n.uint32());continue;case 5:if(e!==42)break;i.document=Lp.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return zp.fromPartial(e??{})},fromPartial(e){let t=Rp();return t.text=e.text!==void 0&&e.text!==null?kp.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?jp.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Np.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Fp.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Lp.fromPartial(e.document):void 0,t}};function Bp(){return{id:``,role:``,content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var Vp={encode(e,t=new U){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)yp.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)zp.encode(n,t.uint32(66).fork()).join();return e.metadata!==void 0&&lp.encode(lp.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Bp();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(yp.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(zp.decode(n,n.uint32()));continue;case 9:if(e!==74)break;i.metadata=lp.unwrap(lp.decode(n,n.uint32()));continue;case 10:if(e!==82)break;i.subagentRunId=n.string();continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Vp.fromPartial(e??{})},fromPartial(e){let t=Bp();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=>yp.fromPartial(e))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(e=>zp.fromPartial(e))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function Hp(){return{id:``,reason:``,message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var Up={encode(e,t=new U){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&&G.encode(G.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&G.encode(G.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Hp();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=G.unwrap(G.decode(n,n.uint32()));continue;case 6:if(e!==50)break;i.expiresAt=n.string();continue;case 7:if(e!==58)break;i.metadata=G.unwrap(G.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 Up.fromPartial(e??{})},fromPartial(e){let t=Hp();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}},Wp=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.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({});function Gp(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var K={encode(e,t=new U){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&G.encode(G.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&lp.encode(lp.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Gp();for(;n.pos>>3){case 1:if(e!==8)break;i.type=n.int32();continue;case 2:if(e!==16)break;i.timestamp=Rm(n.int64());continue;case 3:if(e!==26)break;i.rawEvent=G.unwrap(G.decode(n,n.uint32()));continue;case 4:if(e!==34)break;i.metadata=lp.unwrap(lp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return K.fromPartial(e??{})},fromPartial(e){let t=Gp();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 Kp(){return{baseEvent:void 0,messageId:``,role:void 0,name:void 0,subagentRunId:void 0}}var qp={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Kp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 qp.fromPartial(e??{})},fromPartial(e){let t=Kp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.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 Jp(){return{baseEvent:void 0,messageId:``,delta:``,subagentRunId:void 0}}var Yp={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Jp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 Yp.fromPartial(e??{})},fromPartial(e){let t=Jp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.delta=e.delta??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Xp(){return{baseEvent:void 0,messageId:``,subagentRunId:void 0}}var Zp={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Xp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 Zp.fromPartial(e??{})},fromPartial(e){let t=Xp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Qp(){return{baseEvent:void 0,toolCallId:``,toolCallName:``,parentMessageId:void 0,subagentRunId:void 0}}var $p={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Qp();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 $p.fromPartial(e??{})},fromPartial(e){let t=Qp();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.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 em(){return{baseEvent:void 0,toolCallId:``,delta:``,subagentRunId:void 0}}var tm={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=em();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 tm.fromPartial(e??{})},fromPartial(e){let t=em();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.delta=e.delta??``,t.subagentRunId=e.subagentRunId??void 0,t}};function nm(){return{baseEvent:void 0,toolCallId:``,subagentRunId:void 0}}var rm={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=nm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 rm.fromPartial(e??{})},fromPartial(e){let t=nm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??``,t.subagentRunId=e.subagentRunId??void 0,t}};function im(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var am={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&G.encode(G.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=im();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.snapshot=G.unwrap(G.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 am.fromPartial(e??{})},fromPartial(e){let t=im();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function om(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var sm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.delta)_p.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=om();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.delta.push(_p.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 sm.fromPartial(e??{})},fromPartial(e){let t=om();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(e=>_p.fromPartial(e))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function cm(){return{baseEvent:void 0,messages:[]}}var lm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join();for(let n of e.messages)Vp.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=cm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.messages.push(Vp.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return lm.fromPartial(e??{})},fromPartial(e){let t=cm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(e=>Vp.fromPartial(e))||[],t}};function um(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var dm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&G.encode(G.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=um();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.event=G.unwrap(G.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 dm.fromPartial(e??{})},fromPartial(e){let t=um();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.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 fm(){return{baseEvent:void 0,name:``,value:void 0,subagentRunId:void 0}}var pm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==``&&t.uint32(18).string(e.name),e.value!==void 0&&G.encode(G.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=fm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.name=n.string();continue;case 3:if(e!==26)break;i.value=G.unwrap(G.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 pm.fromPartial(e??{})},fromPartial(e){let t=fm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.name=e.name??``,t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function mm(){return{baseEvent:void 0,threadId:``,runId:``}}var hm={encode(e,t=new U){return e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==``&&t.uint32(18).string(e.threadId),e.runId!==``&&t.uint32(26).string(e.runId),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=mm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return hm.fromPartial(e??{})},fromPartial(e){let t=mm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??``,t.runId=e.runId??``,t}};function gm(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var _m={encode(e,t=new U){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),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=gm();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=Rm(n.int64());continue;case 4:if(e!==32)break;i.outputTokens=Rm(n.int64());continue;case 5:if(e!==40)break;i.totalTokens=Rm(n.int64());continue;case 6:if(e!==48)break;i.reasoningTokens=Rm(n.int64());continue;case 7:if(e!==56)break;i.cachedInputTokens=Rm(n.int64());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return _m.fromPartial(e??{})},fromPartial(e){let t=gm();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}};function vm(){return{baseEvent:void 0,threadId:``,runId:``,result:void 0,outcome:``,interrupts:[],usage:[]}}var ym={encode(e,t=new U){e.baseEvent!==void 0&&K.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&&G.encode(G.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==``&&t.uint32(42).string(e.outcome);for(let n of e.interrupts)Up.encode(n,t.uint32(50).fork()).join();for(let n of e.usage)_m.encode(n,t.uint32(58).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=vm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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=G.unwrap(G.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(Up.decode(n,n.uint32()));continue;case 7:if(e!==58)break;i.usage.push(_m.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return ym.fromPartial(e??{})},fromPartial(e){let t=vm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.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=>Up.fromPartial(e))||[],t.usage=e.usage?.map(e=>_m.fromPartial(e))||[],t}};function bm(){return{baseEvent:void 0,code:void 0,message:``,usage:[]}}var xm={encode(e,t=new U){e.baseEvent!==void 0&&K.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)_m.encode(n,t.uint32(34).fork()).join();return t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=bm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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(_m.decode(n,n.uint32()));continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return xm.fromPartial(e??{})},fromPartial(e){let t=bm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??``,t.usage=e.usage?.map(e=>_m.fromPartial(e))||[],t}};function Sm(){return{baseEvent:void 0,stepName:``,subagentRunId:void 0}}var Cm={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Sm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 Cm.fromPartial(e??{})},fromPartial(e){let t=Sm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??``,t.subagentRunId=e.subagentRunId??void 0,t}};function wm(){return{baseEvent:void 0,stepName:``,subagentRunId:void 0}}var Tm={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=wm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 Tm.fromPartial(e??{})},fromPartial(e){let t=wm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??``,t.subagentRunId=e.subagentRunId??void 0,t}};function Em(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var Dm={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Em();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 Dm.fromPartial(e??{})},fromPartial(e){let t=Em();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.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 Om(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var km={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Om();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 km.fromPartial(e??{})},fromPartial(e){let t=Om();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.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 Am(){return{baseEvent:void 0,subagentRunId:``,name:``,description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var jm={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Am();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 jm.fromPartial(e??{})},fromPartial(e){let t=Am();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.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 Mm(){return{baseEvent:void 0,subagentRunId:``,result:void 0,outcome:``,interruptIds:[]}}var Nm={encode(e,t=new U){e.baseEvent!==void 0&&K.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==``&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&G.encode(G.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Mm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.subagentRunId=n.string();continue;case 3:if(e!==26)break;i.result=G.unwrap(G.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 Nm.fromPartial(e??{})},fromPartial(e){let t=Mm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.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 Pm(){return{baseEvent:void 0,subagentRunId:``,message:``,code:void 0}}var Fm={encode(e,t=new U){return e.baseEvent!==void 0&&K.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 W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Pm();for(;n.pos>>3){case 1:if(e!==10)break;i.baseEvent=K.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 Fm.fromPartial(e??{})},fromPartial(e){let t=Pm();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?K.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??``,t.message=e.message??``,t.code=e.code??void 0,t}};function Im(){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}}var Lm={encode(e,t=new U){return e.textMessageStart!==void 0&&qp.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Yp.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Zp.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&$p.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&tm.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&rm.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&am.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&sm.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&lm.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&dm.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&pm.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&hm.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&ym.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&xm.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Cm.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Tm.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Dm.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&km.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&jm.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&Nm.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&Fm.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let n=e instanceof W?e:new W(e),r=t===void 0?n.len:n.pos+t,i=Im();for(;n.pos>>3){case 1:if(e!==10)break;i.textMessageStart=qp.decode(n,n.uint32());continue;case 2:if(e!==18)break;i.textMessageContent=Yp.decode(n,n.uint32());continue;case 3:if(e!==26)break;i.textMessageEnd=Zp.decode(n,n.uint32());continue;case 4:if(e!==34)break;i.toolCallStart=$p.decode(n,n.uint32());continue;case 5:if(e!==42)break;i.toolCallArgs=tm.decode(n,n.uint32());continue;case 6:if(e!==50)break;i.toolCallEnd=rm.decode(n,n.uint32());continue;case 7:if(e!==58)break;i.stateSnapshot=am.decode(n,n.uint32());continue;case 8:if(e!==66)break;i.stateDelta=sm.decode(n,n.uint32());continue;case 9:if(e!==74)break;i.messagesSnapshot=lm.decode(n,n.uint32());continue;case 10:if(e!==82)break;i.raw=dm.decode(n,n.uint32());continue;case 11:if(e!==90)break;i.custom=pm.decode(n,n.uint32());continue;case 12:if(e!==98)break;i.runStarted=hm.decode(n,n.uint32());continue;case 13:if(e!==106)break;i.runFinished=ym.decode(n,n.uint32());continue;case 14:if(e!==114)break;i.runError=xm.decode(n,n.uint32());continue;case 15:if(e!==122)break;i.stepStarted=Cm.decode(n,n.uint32());continue;case 16:if(e!==130)break;i.stepFinished=Tm.decode(n,n.uint32());continue;case 17:if(e!==138)break;i.textMessageChunk=Dm.decode(n,n.uint32());continue;case 18:if(e!==146)break;i.toolCallChunk=km.decode(n,n.uint32());continue;case 19:if(e!==154)break;i.subagentStarted=jm.decode(n,n.uint32());continue;case 20:if(e!==162)break;i.subagentFinished=Nm.decode(n,n.uint32());continue;case 21:if(e!==170)break;i.subagentError=Fm.decode(n,n.uint32());continue}if((e&7)==4||e===0)break;n.skip(e&7)}return i},create(e){return Lm.fromPartial(e??{})},fromPartial(e){let t=Im();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?qp.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Yp.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Zp.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?$p.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?tm.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?rm.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?am.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?sm.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?lm.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?dm.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?pm.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?hm.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?ym.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?xm.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Cm.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Tm.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Dm.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?km.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?jm.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?Nm.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?Fm.fromPartial(e.subagentError):void 0,t}};function Rm(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,Bm=e=>{let t=zm(e);if(t){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}}}},Vm=e=>{let t=zm(e);if(t){if(t.text)return{type:`text`,text:t.text.text};if(t.image){let e=t.image;return{type:`image`,source:Bm(e.source),metadata:e.metadata}}if(t.audio){let e=t.audio;return{type:`audio`,source:Bm(e.source),metadata:e.metadata}}if(t.video){let e=t.video;return{type:`video`,source:Bm(e.source),metadata:e.metadata}}if(t.document){let e=t.document;return{type:`document`,source:Bm(e.source),metadata:e.metadata}}}};function Hm(e){let t=Lm.decode(e),n=Object.values(t).find(e=>e!==void 0);if(!n)throw Error(`Invalid event`);if(n.type=Wp[n.baseEvent.type],n.timestamp=n.baseEvent.timestamp,n.rawEvent=n.baseEvent.rawEvent,n.baseEvent.metadata!==void 0&&(n.metadata=n.baseEvent.metadata),delete n.baseEvent,n.type===B.MESSAGES_SNAPSHOT)for(let e of n.messages){let t=e;if(t.role===`user`&&Array.isArray(t.contentParts)){let e=t.contentParts.map(e=>Vm(e)).filter(e=>e!==void 0);e.length>0&&(t.content=e)}Array.isArray(t.contentParts)&&t.contentParts.length===0&&(t.contentParts=void 0),t.toolCalls?.length===0&&(t.toolCalls=void 0)}if(n.type===B.RUN_FINISHED){let e=n,t=typeof e.outcome==`string`&&e.outcome!==``?e.outcome:void 0,r=Array.isArray(e.interrupts)?e.interrupts:[];delete e.interrupts,t===`interrupt`?e.outcome={type:`interrupt`,interrupts:r}:t===`success`?e.outcome={type:`success`}:delete e.outcome}if(n.type===B.SUBAGENT_FINISHED){let e=n,t=typeof e.outcome==`string`&&e.outcome!==``?e.outcome:void 0,r=Array.isArray(e.interruptIds)?e.interruptIds:[];delete e.interruptIds,t===`suspended`?e.outcome={type:`suspended`,...r.length>0&&{interruptIds:r}}:t===`success`?e.outcome={type:`success`}:delete e.outcome}if((n.type===B.RUN_FINISHED||n.type===B.RUN_ERROR)&&Array.isArray(n.usage)&&n.usage.length===0&&delete n.usage,n.type===B.STATE_DELTA)for(let e of n.delta)e.op=hp[e.op].toLowerCase(),Object.keys(e).forEach(t=>{e[t]===void 0&&delete e[t]});return Object.keys(n).forEach(e=>{n[e]===void 0&&delete n[e]}),Zl.parse(n)}var Um;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(Um||={});var Wm;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Wm||={});var q=Um.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),Gm=e=>{switch(typeof e){case`undefined`:return q.undefined;case`string`:return q.string;case`number`:return Number.isNaN(e)?q.nan:q.number;case`boolean`:return q.boolean;case`function`:return q.function;case`bigint`:return q.bigint;case`symbol`:return q.symbol;case`object`:return Array.isArray(e)?q.array:e===null?q.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?q.promise:typeof Map<`u`&&e instanceof Map?q.map:typeof Set<`u`&&e instanceof Set?q.set:typeof Date<`u`&&e instanceof Date?q.date:q.object;default:return q.unknown}},J=Um.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),Km=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;re.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Km.create=e=>new Km(e);var qm=(e,t)=>{let n;switch(e.code){case J.invalid_type:n=e.received===q.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case J.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Um.jsonStringifyReplacer)}`;break;case J.unrecognized_keys:n=`Unrecognized key(s) in object: ${Um.joinValues(e.keys,`, `)}`;break;case J.invalid_union:n=`Invalid input`;break;case J.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Um.joinValues(e.options)}`;break;case J.invalid_enum_value:n=`Invalid enum value. Expected ${Um.joinValues(e.options)}, received '${e.received}'`;break;case J.invalid_arguments:n=`Invalid function arguments`;break;case J.invalid_return_type:n=`Invalid function return type`;break;case J.invalid_date:n=`Invalid date`;break;case J.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Um.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case J.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case J.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case J.custom:n=`Invalid input`;break;case J.invalid_intersection_types:n=`Intersection results could not be merged`;break;case J.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case J.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,Um.assertNever(e)}return{message:n}},Jm=qm;function Ym(){return Jm}var Xm=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function Y(e,t){let n=Ym(),r=Xm({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===qm?void 0:qm].filter(e=>!!e)});e.common.issues.push(r)}var Zm=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return X;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return X;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},X=Object.freeze({status:`aborted`}),Qm=e=>({status:`dirty`,value:e}),$m=e=>({status:`valid`,value:e}),eh=e=>e.status===`aborted`,th=e=>e.status===`dirty`,nh=e=>e.status===`valid`,rh=e=>typeof Promise<`u`&&e instanceof Promise,Z;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(Z||={});var ih=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ah=(e,t)=>{if(nh(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new Km(e.common.issues);return this._error=t,this._error}}};function Q(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var oh=class{get description(){return this._def.description}_getType(e){return Gm(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Gm(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Zm,ctx:{common:e.parent.common,data:e.data,parsedType:Gm(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(rh(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Gm(e)};return ah(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Gm(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return nh(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>nh(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Gm(e)},r=this._parse({data:e,path:n.path,parent:n});return ah(n,await(rh(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:J.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new lg({schema:this,typeName:$.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return ug.create(this,this._def)}nullable(){return dg.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Wh.create(this)}promise(){return cg.create(this,this._def)}or(e){return qh.create([this,e],this._def)}and(e){return Zh.create(this,e,this._def)}transform(e){return new lg({...Q(this._def),schema:this,typeName:$.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new fg({...Q(this._def),innerType:this,defaultValue:t,typeName:$.ZodDefault})}brand(){return new hg({typeName:$.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new pg({...Q(this._def),innerType:this,catchValue:t,typeName:$.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return gg.create(this,e)}readonly(){return _g.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},sh=/^c[^\s-]{8,}$/i,ch=/^[0-9a-z]+$/,lh=/^[0-9A-HJKMNP-TV-Z]{26}$/i,uh=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,dh=/^[a-z0-9_-]{21}$/i,fh=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ph=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,mh=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,hh=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,gh,_h=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,vh=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,yh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,bh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,xh=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Sh=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ch=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,wh=RegExp(`^${Ch}$`);function Th(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Eh(e){return RegExp(`^${Th(e)}$`)}function Dh(e){let t=`${Ch}T${Th(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function Oh(e,t){return!((t!==`v4`&&t||!_h.test(e))&&(t!==`v6`&&t||!yh.test(e)))}function kh(e,t){if(!fh.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function Ah(e,t){return!((t!==`v4`&&t||!vh.test(e))&&(t!==`v6`&&t||!bh.test(e)))}var jh=class e extends oh{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.string,received:t.parsedType}),X}let t=new Zm,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.lengthr.value&&(n=this._getOrReturnCtx(e,n),Y(n,{code:J.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.lengthe.test(t),{validation:t,code:J.invalid_string,...Z.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...Z.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...Z.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...Z.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...Z.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...Z.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...Z.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...Z.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...Z.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...Z.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...Z.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...Z.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...Z.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...Z.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Z.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...Z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...Z.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...Z.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...Z.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...Z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...Z.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...Z.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...Z.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...Z.errToObj(t)})}nonempty(e){return this.min(1,Z.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew jh({checks:[],typeName:$.ZodString,coerce:e?.coerce??!1,...Q(e)});function Mh(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Nh=class e extends oh{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==q.number){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.number,received:t.parsedType}),X}let t,n=new Zm;for(let r of this._def.checks)r.kind===`int`?Um.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Y(t,{code:J.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Mh(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Y(t,{code:J.not_finite,message:r.message}),n.dirty()):Um.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,Z.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Z.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Z.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Z.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Z.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:Z.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Z.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:Z.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:Z.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:Z.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuee.kind===`int`||e.kind===`multipleOf`&&Um.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.valuenew Nh({checks:[],typeName:$.ZodNumber,coerce:e?.coerce||!1,...Q(e)});var Ph=class e extends oh{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==q.bigint)return this._getInvalidInput(e);let t,n=new Zm;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Y(t,{code:J.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Um.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.bigint,received:t.parsedType}),X}gte(e,t){return this.setLimit(`min`,e,!0,Z.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Z.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Z.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Z.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Z.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Z.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Ph({checks:[],typeName:$.ZodBigInt,coerce:e?.coerce??!1,...Q(e)});var Fh=class extends oh{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.boolean){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.boolean,received:t.parsedType}),X}return $m(e.data)}};Fh.create=e=>new Fh({typeName:$.ZodBoolean,coerce:e?.coerce||!1,...Q(e)});var Ih=class e extends oh{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.date,received:t.parsedType}),X}if(Number.isNaN(e.data.getTime()))return Y(this._getOrReturnCtx(e),{code:J.invalid_date}),X;let t=new Zm,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()r.value&&(n=this._getOrReturnCtx(e,n),Y(n,{code:J.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):Um.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:Z.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:Z.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.valuenew Ih({checks:[],coerce:e?.coerce||!1,typeName:$.ZodDate,...Q(e)});var Lh=class extends oh{_parse(e){if(this._getType(e)!==q.symbol){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.symbol,received:t.parsedType}),X}return $m(e.data)}};Lh.create=e=>new Lh({typeName:$.ZodSymbol,...Q(e)});var Rh=class extends oh{_parse(e){if(this._getType(e)!==q.undefined){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.undefined,received:t.parsedType}),X}return $m(e.data)}};Rh.create=e=>new Rh({typeName:$.ZodUndefined,...Q(e)});var zh=class extends oh{_parse(e){if(this._getType(e)!==q.null){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.null,received:t.parsedType}),X}return $m(e.data)}};zh.create=e=>new zh({typeName:$.ZodNull,...Q(e)});var Bh=class extends oh{constructor(){super(...arguments),this._any=!0}_parse(e){return $m(e.data)}};Bh.create=e=>new Bh({typeName:$.ZodAny,...Q(e)});var Vh=class extends oh{constructor(){super(...arguments),this._unknown=!0}_parse(e){return $m(e.data)}};Vh.create=e=>new Vh({typeName:$.ZodUnknown,...Q(e)});var Hh=class extends oh{_parse(e){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.never,received:t.parsedType}),X}};Hh.create=e=>new Hh({typeName:$.ZodNever,...Q(e)});var Uh=class extends oh{_parse(e){if(this._getType(e)!==q.undefined){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.void,received:t.parsedType}),X}return $m(e.data)}};Uh.create=e=>new Uh({typeName:$.ZodVoid,...Q(e)});var Wh=class e extends oh{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==q.array)return Y(t,{code:J.invalid_type,expected:q.array,received:t.parsedType}),X;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.lengthr.maxLength.value&&(Y(t,{code:J.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new ih(t,e,t.path,n)))).then(e=>Zm.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new ih(t,e,t.path,n)));return Zm.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:Z.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:Z.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:Z.toString(n)}})}nonempty(e){return this.min(1,e)}};Wh.create=(e,t)=>new Wh({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$.ZodArray,...Q(t)});function Gh(e){if(e instanceof Kh){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=ug.create(Gh(r))}return new Kh({...e._def,shape:()=>t})}return e instanceof Wh?new Wh({...e._def,type:Gh(e.element)}):e instanceof ug?ug.create(Gh(e.unwrap())):e instanceof dg?dg.create(Gh(e.unwrap())):e instanceof Qh?Qh.create(e.items.map(e=>Gh(e))):e}var Kh=class e extends oh{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Um.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==q.object){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.object,received:t.parsedType}),X}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Hh&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new ih(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Hh){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(Y(n,{code:J.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new ih(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Zm.mergeObjectSync(t,e)):Zm.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return Z.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:Z.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:$.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of Um.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of Um.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Gh(this)}partial(t){let n={};for(let e of Um.objectKeys(this.shape)){let r=this.shape[e];n[e]=t&&!t[e]?r:r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of Um.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof ug;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return ag(Um.objectKeys(this.shape))}};Kh.create=(e,t)=>new Kh({shape:()=>e,unknownKeys:`strip`,catchall:Hh.create(),typeName:$.ZodObject,...Q(t)}),Kh.strictCreate=(e,t)=>new Kh({shape:()=>e,unknownKeys:`strict`,catchall:Hh.create(),typeName:$.ZodObject,...Q(t)}),Kh.lazycreate=(e,t)=>new Kh({shape:e,unknownKeys:`strip`,catchall:Hh.create(),typeName:$.ZodObject,...Q(t)});var qh=class extends oh{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Km(e.ctx.common.issues));return Y(t,{code:J.invalid_union,unionErrors:n}),X}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Km(e));return Y(t,{code:J.invalid_union,unionErrors:i}),X}}get options(){return this._def.options}};qh.create=(e,t)=>new qh({options:e,typeName:$.ZodUnion,...Q(t)});var Jh=e=>e instanceof rg?Jh(e.schema):e instanceof lg?Jh(e.innerType()):e instanceof ig?[e.value]:e instanceof og?e.options:e instanceof sg?Um.objectValues(e.enum):e instanceof fg?Jh(e._def.innerType):e instanceof Rh?[void 0]:e instanceof zh?[null]:e instanceof ug?[void 0,...Jh(e.unwrap())]:e instanceof dg?[null,...Jh(e.unwrap())]:e instanceof hg||e instanceof _g?Jh(e.unwrap()):e instanceof pg?Jh(e._def.innerType):[],Yh=class e extends oh{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.object)return Y(t,{code:J.invalid_type,expected:q.object,received:t.parsedType}),X;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(Y(t,{code:J.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),X)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=Jh(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:$.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Q(r)})}};function Xh(e,t){let n=Gm(e),r=Gm(t);if(e===t)return{valid:!0,data:e};if(n===q.object&&r===q.object){let n=Um.objectKeys(t),r=Um.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Xh(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===q.array&&r===q.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r{if(eh(e)||eh(r))return X;let i=Xh(e.value,r.value);return i.valid?((th(e)||th(r))&&t.dirty(),{status:t.value,value:i.data}):(Y(n,{code:J.invalid_intersection_types}),X)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Zh.create=(e,t,n)=>new Zh({left:e,right:t,typeName:$.ZodIntersection,...Q(n)});var Qh=class e extends oh{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.array)return Y(n,{code:J.invalid_type,expected:q.array,received:n.parsedType}),X;if(n.data.lengththis._def.items.length&&(Y(n,{code:J.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new ih(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>Zm.mergeArray(t,e)):Zm.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Qh.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new Qh({items:e,typeName:$.ZodTuple,rest:null,...Q(t)})};var $h=class e extends oh{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.object)return Y(n,{code:J.invalid_type,expected:q.object,received:n.parsedType}),X;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new ih(n,e,n.path,e)),value:a._parse(new ih(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Zm.mergeObjectAsync(t,r):Zm.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof oh?new e({keyType:t,valueType:n,typeName:$.ZodRecord,...Q(r)}):new e({keyType:jh.create(),valueType:t,typeName:$.ZodRecord,...Q(n)})}},eg=class extends oh{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.map)return Y(n,{code:J.invalid_type,expected:q.map,received:n.parsedType}),X;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new ih(n,e,n.path,[a,`key`])),value:i._parse(new ih(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return X;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return X;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};eg.create=(e,t,n)=>new eg({valueType:t,keyType:e,typeName:$.ZodMap,...Q(n)});var tg=class e extends oh{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.set)return Y(n,{code:J.invalid_type,expected:q.set,received:n.parsedType}),X;let r=this._def;r.minSize!==null&&n.data.sizer.maxSize.value&&(Y(n,{code:J.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return X;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new ih(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:Z.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:Z.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};tg.create=(e,t)=>new tg({valueType:e,minSize:null,maxSize:null,typeName:$.ZodSet,...Q(t)});var ng=class e extends oh{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.function)return Y(t,{code:J.invalid_type,expected:q.function,received:t.parsedType}),X;function n(e,n){return Xm({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ym(),qm].filter(e=>!!e),issueData:{code:J.invalid_arguments,argumentsError:n}})}function r(e,n){return Xm({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ym(),qm].filter(e=>!!e),issueData:{code:J.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof cg){let e=this;return $m(async function(...t){let o=new Km([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}{let e=this;return $m(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Km([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Km([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Qh.create(t).rest(Vh.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||Qh.create([]).rest(Vh.create()),returns:n||Vh.create(),typeName:$.ZodFunction,...Q(r)})}},rg=class extends oh{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};rg.create=(e,t)=>new rg({getter:e,typeName:$.ZodLazy,...Q(t)});var ig=class extends oh{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Y(t,{received:t.data,code:J.invalid_literal,expected:this._def.value}),X}return{status:`valid`,value:e.data}}get value(){return this._def.value}};ig.create=(e,t)=>new ig({value:e,typeName:$.ZodLiteral,...Q(t)});function ag(e,t){return new og({values:e,typeName:$.ZodEnum,...Q(t)})}var og=class e extends oh{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{expected:Um.joinValues(n),received:t.parsedType,code:J.invalid_type}),X}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{received:t.data,code:J.invalid_enum_value,options:n}),X}return $m(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};og.create=ag;var sg=class extends oh{_parse(e){let t=Um.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==q.string&&n.parsedType!==q.number){let e=Um.objectValues(t);return Y(n,{expected:Um.joinValues(e),received:n.parsedType,code:J.invalid_type}),X}if(this._cache||=new Set(Um.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=Um.objectValues(t);return Y(n,{received:n.data,code:J.invalid_enum_value,options:e}),X}return $m(e.data)}get enum(){return this._def.values}};sg.create=(e,t)=>new sg({values:e,typeName:$.ZodNativeEnum,...Q(t)});var cg=class extends oh{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==q.promise&&t.common.async===!1?(Y(t,{code:J.invalid_type,expected:q.promise,received:t.parsedType}),X):$m((t.parsedType===q.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};cg.create=(e,t)=>new cg({type:e,typeName:$.ZodPromise,...Q(t)});var lg=class extends oh{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{Y(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return X;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?X:r.status===`dirty`||t.value===`dirty`?Qm(r.value):r});{if(t.value===`aborted`)return X;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?X:r.status===`dirty`||t.value===`dirty`?Qm(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?X:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?X:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!nh(e))return X;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>nh(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):X)}Um.assertNever(r)}};lg.create=(e,t,n)=>new lg({schema:e,typeName:$.ZodEffects,effect:t,...Q(n)}),lg.createWithPreprocess=(e,t,n)=>new lg({schema:t,effect:{type:`preprocess`,transform:e},typeName:$.ZodEffects,...Q(n)});var ug=class extends oh{_parse(e){return this._getType(e)===q.undefined?$m(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ug.create=(e,t)=>new ug({innerType:e,typeName:$.ZodOptional,...Q(t)});var dg=class extends oh{_parse(e){return this._getType(e)===q.null?$m(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};dg.create=(e,t)=>new dg({innerType:e,typeName:$.ZodNullable,...Q(t)});var fg=class extends oh{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===q.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};fg.create=(e,t)=>new fg({innerType:e,typeName:$.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...Q(t)});var pg=class extends oh{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return rh(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Km(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Km(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};pg.create=(e,t)=>new pg({innerType:e,typeName:$.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...Q(t)});var mg=class extends oh{_parse(e){if(this._getType(e)!==q.nan){let t=this._getOrReturnCtx(e);return Y(t,{code:J.invalid_type,expected:q.nan,received:t.parsedType}),X}return{status:`valid`,value:e.data}}};mg.create=e=>new mg({typeName:$.ZodNaN,...Q(e)});var hg=class extends oh{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},gg=class e extends oh{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?X:e.status===`dirty`?(t.dirty(),Qm(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?X:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:$.ZodPipeline})}},_g=class extends oh{_parse(e){let t=this._def.innerType._parse(e),n=e=>(nh(e)&&(e.value=Object.freeze(e.value)),e);return rh(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};_g.create=(e,t)=>new _g({innerType:e,typeName:$.ZodReadonly,...Q(t)}),Kh.lazycreate;var $;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})($||={});var vg=jh.create;Nh.create,mg.create,Ph.create;var yg=Fh.create;Ih.create,Lh.create,Rh.create,zh.create;var bg=Bh.create;Vh.create,Hh.create,Uh.create,Wh.create;var xg=Kh.create;Kh.strictCreate,qh.create;var Sg=Yh.create;Zh.create,Qh.create,$h.create,eg.create,tg.create,ng.create,rg.create;var Cg=ig.create,wg=og.create;sg.create,cg.create,lg.create,ug.create,dg.create,lg.createWithPreprocess,gg.create;var Tg=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Eg=e=>{if(typeof e!=`string`)throw TypeError(`Invalid argument expected string`);let t=e.match(Tg);if(!t)throw Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Dg=e=>e===`*`||e===`x`||e===`X`,Og=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},kg=(e,t)=>typeof e==typeof t?[e,t]:[String(e),String(t)],Ag=(e,t)=>{if(Dg(e)||Dg(t))return 0;let[n,r]=kg(Og(e),Og(t));return n>r?1:n{for(let n=0;n{let n=Eg(e),r=Eg(t),i=n.pop(),a=r.pop(),o=jg(n,r);return o===0?i&&a?jg(i.split(`.`),a.split(`.`)):i||a?i?-1:1:0:o},Ng=e=>{if(typeof structuredClone==`function`)return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Pg(){return Go()}function Fg(e){if(Object.freeze(e),typeof e==`object`&&e)for(let t of Object.values(e))typeof t==`object`&&t&&!Object.isFrozen(t)&&Fg(t);return e}var Ig=524288;function Lg(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 Rg(e,t,n,r){let i=typeof process<`u`&&!0,a=i&&!!{}.VITEST_WORKER_ID,o=i&&!!{}.VITEST_WORKER_ID,s=o&&!Lg(t,n,Ig),c=s?Ng(t):t,l=s?Ng(n):n,u=!1,d=!1,f;for(let t of e)try{s&&(Fg(c),Fg(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=Ng(e.messages),u=!0,n=!0),e.state!==void 0&&e.state!==l&&(l=Ng(e.state),d=!0,n=!0),s&&n&&Lg(c,l,Ig)&&(s=!1),f=e.stopPropagation,f===!0)break}catch(e){if(o&&e instanceof TypeError){if(a)throw e;console.error(`AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.`,e)}else a||console.error(`Subscriber error:`,e);continue}return{...u?{messages:Object.isFrozen(c)?Ng(c):c}:{},...d?{state:Object.isFrozen(l)?Ng(l):l}:{},...f===void 0?{}:{stopPropagation:f}}}function zg(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 Bg(e){if(e instanceof Vg)return e;if(e===!0)return new Vg(zg(!0))}var Vg=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 Hg(e){return e.enabled?new Vg(e):void 0}function Ug(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 Wg(e,t){return!e||t.metadata===void 0?!1:(e.metadata=Mc(e.metadata,Ng(t.metadata)),!0)}var Gg=(e,t,n,r,i)=>{let a=Bg(i),o=Ng(n.messages),s=Ng(e.state),c={},l=e=>{e.messages!==void 0&&(o=e.messages,c.messages=e.messages),e.state!==void 0&&(s=e.state,c.state=e.state)},u=()=>{let e=Ng(c);return c={},e.messages!==void 0||e.state!==void 0?hf(e):Fd};return t.pipe(Tf(async t=>{let i=await Rg(r,o,s,(r,i,a)=>r.onEvent?.({event:t,agent:n,input:e,messages:i,state:a}));if(l(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 u();switch(t.type){case B.TEXT_MESSAGE_START:{let i=await Rg(r,o,s,(r,i,a)=>r.onTextMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(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`),u();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=Wg(s,t);(!a||c)&&l({messages:o})}return u()}case B.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}'`),u();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`),u();let d=await Rg(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 l(d),d.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,Wg(c,t),l({messages:o})),u()}case B.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}'`),u();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`),u();let c=await Rg(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 l(c),c.stopPropagation!==!0&&Wg(a,t)&&l({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),u()}case B.TOOL_CALL_START:{let i=await Rg(r,o,s,(r,i,a)=>r.onToolCallStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{toolCallId:e,toolCallName:n,parentMessageId:r,subagentRunId:i}=t,a=o.find(t=>t.toolCalls?.some(t=>t.id===e))?.toolCalls?.find(t=>t.id===e);if(a){let r=a.function.name!==n;return r&&(console.warn(`TOOL_CALL_START: tool call '${e}' already exists with name '${a.function.name}' — updating it to '${n}'`),a.function.name=n),(Wg(a,t)||r)&&l({messages:o}),u()}let s=new Set(o.map(e=>e.id)),c=Ug(o,r,e);!s.has(c.id)&&i!=null&&c.subagentRunId===void 0&&(c.subagentRunId=i),c.toolCalls??=[];let d={id:e,type:`function`,function:{name:n,arguments:``}};c.toolCalls.push(d),Wg(d,t),l({messages:o})}return u()}case B.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}'`),u();let d=c.toolCalls?.find(e=>e.id===i);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${i}'`),u();let f=await Rg(r,o,s,(r,i,a)=>{let o=d.function.arguments,s=d.function.name,c={};try{c=Mf(o)}catch{}return r.onToolCallArgsEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallBuffer:o,toolCallName:s,partialToolCallArgs:c})});return l(f),f.stopPropagation!==!0&&(d.function.arguments+=a,Wg(d,t),l({messages:o})),u()}case B.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}'`),u();let c=a.toolCalls?.find(e=>e.id===i);if(!c)return console.warn(`TOOL_CALL_END: No tool call found with ID '${i}'`),u();let d=await Rg(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 l(d),d.stopPropagation!==!0&&Wg(c,t)&&l({messages:o}),await Promise.all(r.map(t=>{t.onNewToolCall?.({toolCall:c,messages:o,state:s,agent:n,input:e})})),u()}case B.TOOL_CALL_RESULT:{let i=await Rg(r,o,s,(r,i,a)=>r.onToolCallResultEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messageId:i,toolCallId:a,content:c,role:u,subagentRunId:d}=t,f={id:i,toolCallId:a,role:u||`tool`,content:c,...d!=null&&{subagentRunId:d}};Wg(f,t);let p=o.findIndex(e=>e.role===`assistant`&&e.toolCalls?.some(e=>e.id===a));if(p===-1)o.push(f);else{let e=p+1;for(;e{t.onNewMessage?.({message:f,messages:o,state:s,agent:n,input:e})})),l({messages:o})}return u()}case B.STATE_SNAPSHOT:{let i=await Rg(r,o,s,(r,i,a)=>r.onStateSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{snapshot:e}=t;s=e,l({state:s})}return u()}case B.STATE_DELTA:{let i=await Rg(r,o,s,(r,i,a)=>r.onStateDeltaEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{delta:e}=t;try{s=Nu.applyPatch(s,e,!0,!1).newDocument,l({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 u()}case B.MESSAGES_SNAPSHOT:{let i=await Rg(r,o,s,(r,i,a)=>r.onMessagesSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messages:e}=t,n=e.map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}),r=new Map(n.map(e=>[e.id,e])),i=n.some(e=>e.role===`activity`),a=n.some(e=>e.role===`reasoning`),s=e=>e.role===`activity`&&!i||e.role===`reasoning`&&!a;o=o.filter(e=>s(e)||r.has(e.id)).map(e=>s(e)?e:r.get(e.id));let c=new Set(o.map(e=>e.id));for(let e of n)c.has(e.id)||o.push(e);l({messages:o})}return u()}case B.ACTIVITY_SNAPSHOT:{let i=t,a=o.findIndex(e=>e.id===i.messageId),c=a>=0?o[a]:void 0,d=c?.role===`activity`?c:void 0,f=i.replace??!0,p=await Rg(r,o,s,(t,r,a)=>t.onActivitySnapshotEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:d,existingMessage:c}));if(l(p),p.stopPropagation!==!0){let t={id:i.messageId,role:`activity`,activityType:i.activityType,content:Ng(i.content),...i.subagentRunId!=null&&{subagentRunId:i.subagentRunId}},c,u;a===-1?(o.push(t),c=t,u=t):d?(f&&(o[a]={...d,activityType:i.activityType,content:Ng(i.content),subagentRunId:i.subagentRunId},i.subagentRunId??delete o[a].subagentRunId),u=o[a]):f&&(o[a]=t,c=t,u=t),Wg(u,i),l({messages:o}),c&&await Promise.all(r.map(t=>t.onNewMessage?.({message:c,messages:o,state:s,agent:n,input:e})))}return u()}case B.ACTIVITY_DELTA:{let i=t,a=o.findIndex(e=>e.id===i.messageId);if(a===-1)return u();let c=o[a];if(c.role!==`activity`)return console.warn(`ACTIVITY_DELTA: Message '${i.messageId}' is not an activity message`),u();let d=c,f=await Rg(r,o,s,(t,r,a)=>t.onActivityDeltaEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:d}));if(l(f),f.stopPropagation!==!0)try{Wg(d,i)&&l({messages:o});let e=Ng(d.content??{}),t=Nu.applyPatch(e,i.patch??[],!0,!1).newDocument;o[a]={...d,content:Ng(t),activityType:i.activityType},l({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 u()}case B.RAW:return l(await Rg(r,o,s,(r,i,a)=>r.onRawEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.CUSTOM:return l(await Rg(r,o,s,(r,i,a)=>r.onCustomEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.RUN_STARTED:{let i=await Rg(r,o,s,(r,i,a)=>r.onRunStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let e=t;if(e.input?.messages){for(let t of e.input.messages){let e=t;if(t.subagentRunId===null){let n={...t};delete n.subagentRunId,e=n}o.find(t=>t.id===e.id)||o.push(e)}l({messages:o})}}return u()}case B.RUN_FINISHED:{let i=t,a=i.outcome?.type===`interrupt`?{event:i,outcome:`interrupt`,interrupts:i.outcome.interrupts}:{event:i,outcome:`success`,result:i.result},c=await Rg(r,o,s,(t,r,i)=>t.onRunFinishedEvent?.({...a,messages:r,state:i,agent:n,input:e}));return l(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}):[]),u()}case B.RUN_ERROR:return l(await Rg(r,o,s,(r,i,a)=>r.onRunErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.STEP_STARTED:return l(await Rg(r,o,s,(r,i,a)=>r.onStepStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.STEP_FINISHED:return l(await Rg(r,o,s,(r,i,a)=>r.onStepFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.TEXT_MESSAGE_CHUNK:throw Error(`TEXT_MESSAGE_CHUNK must be transformed before being applied`);case B.TOOL_CALL_CHUNK:throw Error(`TOOL_CALL_CHUNK must be transformed before being applied`);case B.THINKING_START:return u();case B.THINKING_END:return u();case B.THINKING_TEXT_MESSAGE_START:return u();case B.THINKING_TEXT_MESSAGE_CONTENT:return u();case B.THINKING_TEXT_MESSAGE_END:return u();case B.REASONING_START:return l(await Rg(r,o,s,(r,i,a)=>r.onReasoningStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.REASONING_MESSAGE_START:{let i=await Rg(r,o,s,(r,i,a)=>r.onReasoningMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(i),i.stopPropagation!==!0){let{messageId:e,subagentRunId:n}=t,r=o.find(t=>t.id===e),i=r;if(!i){let t={id:e,role:`reasoning`,content:``,...n!=null&&{subagentRunId:n}};o.push(t),i=t}let a=Wg(i,t);(!r||a)&&l({messages:o})}return u()}case B.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}'`),u();let d=await Rg(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 l(d),d.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,Wg(c,t),l({messages:o})),u()}case B.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}'`),u();let c=await Rg(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 l(c),c.stopPropagation!==!0&&Wg(a,t)&&l({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),u()}case B.REASONING_MESSAGE_CHUNK:throw Error(`REASONING_MESSAGE_CHUNK must be transformed before being applied`);case B.REASONING_END:return l(await Rg(r,o,s,(r,i,a)=>r.onReasoningEndEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.REASONING_ENCRYPTED_VALUE:{let{subtype:i,entityId:a,encryptedValue:d}=t,f=await Rg(r,o,s,(r,i,a)=>r.onReasoningEncryptedValueEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(l(f),f.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=d,e=!0;break}}}else{let t=o.find(e=>e.id===a);t?.role!==`activity`&&t&&(t.encryptedValue=d,e=!0)}e&&(c.messages=o)}return u()}case B.SUBAGENT_STARTED:return l(await Rg(r,o,s,(r,i,a)=>r.onSubagentStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.SUBAGENT_FINISHED:return l(await Rg(r,o,s,(r,i,a)=>r.onSubagentFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u();case B.SUBAGENT_ERROR:return l(await Rg(r,o,s,(r,i,a)=>r.onSubagentErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),u()}return t.type,u()}),xf(),r.length>0?Ef({}):e=>e)},Kg=e=>t=>{let n=Bg(e),r=new Set,i=new Set,a=new Set,o={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},s=!1,c=!1,l=!1,u=new Map,d=e=>{let t=u.get(e);return t||(t=new Map,u.set(e,t)),t},f=()=>{for(let e of u.values())if(e.size>0)return!0;return!1},p=new Map,m=new Set,h=!1,g=!1,_=!1,v=()=>{r.clear(),i.clear(),a.clear(),o.message.clear(),o.toolCall.clear(),o.activity.clear(),o.reasoning.clear(),u.clear(),p.clear(),m.clear(),h=!1,g=!1,s=!1,c=!1,_=!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 z(`Cannot send a message (id '${e.id}') with 'subagentRunId: null'. The field is optional — omit it entirely.`);let n=e.role===`reasoning`?o.reasoning:e.role===`activity`?o.activity:o.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||!o.toolCall.has(n.id))&&o.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 z(`Cannot send '${e}': subagentRunId '${t}' does not match the ${r} '${i}' opener's subagent '${n.subagentRunId??`(the parent agent)`}'.`)};return t.pipe(bf(e=>{let t=e.type;if(n?.event(`VERIFY`,`Event:`,e,{type:e.type}),c&&t!==B.RUN_STARTED)return H(()=>new z(`Cannot send event type '${t}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(s&&t!==B.RUN_ERROR&&t!==B.RUN_STARTED)return H(()=>new z(`Cannot send event type '${t}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(!l){if(l=!0,t!==B.RUN_STARTED&&t!==B.RUN_ERROR)return H(()=>new z(`First event must be 'RUN_STARTED'`))}else if(t===B.RUN_STARTED){if(_&&!s&&!c)return H(()=>new z(`Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run.`));(s||c)&&v()}if(e.subagentRunId===null)return H(()=>new z(`Cannot send '${t}' with 'subagentRunId: null'. The field is optional — omit it entirely.`));if(t===B.SUBAGENT_STARTED||t===B.SUBAGENT_FINISHED||t===B.SUBAGENT_ERROR){let n=t===B.SUBAGENT_STARTED?[`description`,`parentSubagentRunId`,`parentToolCallId`,`parentMessageId`]:t===B.SUBAGENT_FINISHED?[`outcome`]:[`code`];for(let r of n)if(e[r]===null)return H(()=>new z(`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 H(()=>new z(`Cannot send '${t}' with outcome type '${String(r.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(r&&r.interruptIds===null)return H(()=>new z(`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 H(()=>new z(`Cannot send '${t}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(t===B.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 H(()=>new z(`Cannot send 'RUN_FINISHED' with an interrupt (id '${e.id}') carrying 'subagentRunId: null'. The field is optional — omit it entirely.`))}}switch(t){case B.TEXT_MESSAGE_START:{let n=e.messageId;if(r.has(n))return H(()=>new z(`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=o.message.get(n);if(i){let r=b(t,e.subagentRunId,i,`message`,n);if(r)return H(()=>r)}return r.add(n),i||o.message.set(n,{subagentRunId:e.subagentRunId}),hf(e)}case B.TEXT_MESSAGE_CONTENT:{let n=e.messageId;if(!r.has(n))return H(()=>new z(`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,o.message.get(n),`message`,n);return i?H(()=>i):hf(e)}case B.TEXT_MESSAGE_END:{let n=e.messageId;if(!r.has(n))return H(()=>new z(`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,o.message.get(n),`message`,n);return i?H(()=>i):(r.delete(n),hf(e))}case B.TOOL_CALL_START:{let n=e.toolCallId;if(i.has(n))return H(()=>new z(`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,s;if(r!==void 0){let e=o.message.get(r);if(e){if(a!==void 0&&a!==e.subagentRunId)return H(()=>new z(`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.`));s=e}}let c=o.toolCall.get(n);if(c){let e=b(t,a,c,`tool call`,n);if(e)return H(()=>e);if(a===void 0&&s&&s.subagentRunId!==c.subagentRunId)return H(()=>new z(`Cannot send 'TOOL_CALL_START': tool call '${n}' is owned by '${c.subagentRunId??`(the parent agent)`}' but its parent message '${r}' is owned by '${s.subagentRunId??`(the parent agent)`}'. A tool call belongs to the message that carries it.`))}return i.add(n),c||o.toolCall.set(n,a===void 0?s??{subagentRunId:void 0}:{subagentRunId:a}),hf(e)}case B.TOOL_CALL_ARGS:{let n=e.toolCallId;if(!i.has(n))return H(()=>new z(`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,o.toolCall.get(n),`tool call`,n);return r?H(()=>r):hf(e)}case B.TOOL_CALL_END:{let n=e.toolCallId;if(!i.has(n))return H(()=>new z(`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,o.toolCall.get(n),`tool call`,n);return r?H(()=>r):(i.delete(n),hf(e))}case B.STEP_STARTED:{let t=e.stepName,n=e.subagentRunId;return d(n).has(t)?H(()=>new z(`Step "${t}" is already active for 'STEP_STARTED'${n===void 0?``:` in subagent '${n}'`}`)):(d(n).set(t,!0),hf(e))}case B.STEP_FINISHED:{let t=e.stepName,n=e.subagentRunId;if(!d(n).has(t)){let e,r=!1;for(let[i,a]of u)if(i!==n&&a.has(t)){e=i,r=!0;break}return H(r?()=>new z(`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 z(`Cannot send 'STEP_FINISHED' for step "${t}" that was not started`))}return d(n).delete(t),hf(e)}case B.ACTIVITY_SNAPSHOT:{let t=e.messageId;return(!o.activity.has(t)||e.replace!==!1)&&o.activity.set(t,{subagentRunId:e.subagentRunId}),hf(e)}case B.TOOL_CALL_RESULT:{let t=e.messageId;return typeof t==`string`&&o.message.set(t,{subagentRunId:e.subagentRunId}),hf(e)}case B.REASONING_START:case B.REASONING_MESSAGE_START:{let n=e.messageId,r=o.reasoning.get(n);if(r){let i=b(t,e.subagentRunId,r,`reasoning message`,n);if(i)return H(()=>i)}return a.add(n),r||o.reasoning.set(n,{subagentRunId:e.subagentRunId}),hf(e)}case B.REASONING_MESSAGE_CONTENT:case B.REASONING_MESSAGE_END:case B.REASONING_END:{let n=e.messageId,r=b(t,e.subagentRunId,o.reasoning.get(n),`reasoning message`,n);return r?H(()=>r):(t===B.REASONING_END&&a.delete(n),hf(e))}case B.REASONING_ENCRYPTED_VALUE:{let n=e.entityId,r=e.subtype,i=r===`tool-call`?o.toolCall.get(n):r===`message`?o.message.get(n)??o.reasoning.get(n):o.reasoning.get(n),a=r===`tool-call`?`tool call`:r===`message`?`message`:`reasoning message`,s=b(t,e.subagentRunId,i,a,n);return s?H(()=>s):hf(e)}case B.ACTIVITY_DELTA:{let n=e.messageId,r=b(t,e.subagentRunId,o.activity.get(n),`activity`,n);return r?H(()=>r):hf(e)}case B.SUBAGENT_STARTED:{if(typeof e.subagentRunId!=`string`)return H(()=>new z(`Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'.`));if(typeof e.name!=`string`)return H(()=>new z(`Cannot send 'SUBAGENT_STARTED' without a 'name'.`));let t=e.subagentRunId,n=e.parentSubagentRunId;return p.has(t)?H(()=>new z(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):m.has(t)?H(()=>new z(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):n!==void 0&&!p.has(n)&&!m.has(n)?H(()=>new z(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${n}' has not been started in this run.`)):(p.set(t,!0),hf(e))}case B.SUBAGENT_FINISHED:case B.SUBAGENT_ERROR:{if(typeof e.subagentRunId!=`string`)return H(()=>new z(`Cannot send '${t}' without a 'subagentRunId'.`));if(t===B.SUBAGENT_ERROR&&typeof e.message!=`string`)return H(()=>new z(`Cannot send 'SUBAGENT_ERROR' without a 'message'.`));let n=e.subagentRunId;return p.has(n)?(p.delete(n),m.add(n),hf(e)):H(()=>new z(`Cannot send '${t}': no active subagent found with ID '${n}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case B.MESSAGES_SNAPSHOT:{let t=y(e.messages,!0);if(t)return H(()=>t)}return hf(e);case B.RUN_STARTED:_=!0;{let t=y((e.input??{}).messages,!1);if(t)return H(()=>t)}return hf(e);case B.RUN_FINISHED:if(f()){let e=[];for(let[t,n]of u)for(let r of n.keys())e.push(t===void 0?r:`${r} (subagent '${t}')`);let t=e.join(`, `);return H(()=>new z(`Cannot send 'RUN_FINISHED' while steps are still active: ${t}`))}if(r.size>0){let e=Array.from(r.keys()).join(`, `);return H(()=>new z(`Cannot send 'RUN_FINISHED' while text messages are still active: ${e}`))}if(i.size>0){let e=Array.from(i.keys()).join(`, `);return H(()=>new z(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${e}`))}if(p.size>0){let e=Array.from(p.keys()).join(`, `);return H(()=>new z(`Cannot send 'RUN_FINISHED' while subagents are still active: ${e}`))}return s=!0,hf(e);case B.RUN_ERROR:return c=!0,hf(e);case B.CUSTOM:return hf(e);case B.THINKING_TEXT_MESSAGE_START:return h?g?H(()=>new z(`Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.`)):(g=!0,hf(e)):H(()=>new z(`Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first.`));case B.THINKING_TEXT_MESSAGE_CONTENT:return g?hf(e):H(()=>new z(`Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first.`));case B.THINKING_TEXT_MESSAGE_END:return g?(g=!1,hf(e)):H(()=>new z(`Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first.`));case B.THINKING_START:return h?H(()=>new z(`Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.`)):(h=!0,hf(e));case B.THINKING_END:return h?(h=!1,hf(e)):H(()=>new z(`Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first.`));default:return hf(e)}}))},qg=function(e){return e.HEADERS=`headers`,e.DATA=`data`,e}({}),Jg=e=>Sf(()=>mf(e())).pipe(Of(e=>{if(!e.ok){let t=e.headers.get(`content-type`)||``;return mf(e.text()).pipe(bf(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,H(()=>i)}))}let t={type:qg.HEADERS,status:e.status,headers:e.headers},n=e.body?.getReader();return n?new Sd(e=>(e.next(t),(async()=>{try{for(;;){let{done:t,value:r}=await n.read();if(t)break;let i={type:qg.DATA,data:r};e.next(i)}e.complete()}catch(t){e.error(t)}})(),()=>{n.cancel().catch(e=>{if(e?.name!==`AbortError`)throw e})})):H(()=>Error(`Failed to getReader() from response`))})),Yg=(e,t)=>{let n=Bg(t),r=new jd,i=new TextDecoder(`utf-8`,{fatal:!1}),a=``;e.subscribe({next:e=>{if(e.type!==qg.HEADERS&&e.type===qg.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)}},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()},Xg=e=>{let t=new jd,n=new Uint8Array;e.subscribe({next:e=>{if(e.type!==qg.HEADERS&&e.type===qg.DATA&&e.data){let t=new Uint8Array(n.length+e.data.length);t.set(n,0),t.set(e.data,n.length),n=t,r()}},error:e=>t.error(e),complete:()=>{if(n.length>0)try{r()}catch{console.warn(`Incomplete or invalid protocol buffer data at stream end`)}t.complete()}});function r(){for(;n.length>=4;){let e=4+new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(n.length{let n=Bg(t),r=new jd,i=new Pd,a=!1;return e.subscribe({next:e=>{if(i.next(e),e.type===qg.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`?Xg(i).subscribe({next:e=>r.next(e),error:e=>r.error(e),complete:()=>r.complete()}):Yg(i,n).subscribe({next:e=>{try{let t=Zl.parse(e);n?.event(`HTTP`,`Event validated:`,t,{type:t.type,valid:!0}),r.next(t)}catch(t){n?.event(`HTTP`,`Event invalid:`,{json:e,error:String(t)}),r.error(t)}},error:e=>{if(e?.name===`AbortError`){r.next({type:B.RUN_ERROR,message:e.message||`Request aborted`,code:`abort`,rawEvent:e}),r.complete();return}return r.error(e)},complete:()=>r.complete()})}else a||r.error(Error(`No headers event received before data events`))},error:e=>{i.error(e),r.error(e)},complete:()=>{i.complete()}}),r.asObservable()},Qg=wg([`TextMessageStart`,`TextMessageContent`,`TextMessageEnd`,`ActionExecutionStart`,`ActionExecutionArgs`,`ActionExecutionEnd`,`ActionExecutionResult`,`AgentStateMessage`,`MetaEvent`,`RunStarted`,`RunFinished`,`RunError`,`NodeStarted`,`NodeFinished`]),$g=wg([`LangGraphInterruptEvent`,`PredictState`,`Exit`]);Sg(`type`,[xg({type:Cg(Qg.enum.TextMessageStart),messageId:vg(),parentMessageId:vg().optional(),role:vg().optional()}),xg({type:Cg(Qg.enum.TextMessageContent),messageId:vg(),content:vg()}),xg({type:Cg(Qg.enum.TextMessageEnd),messageId:vg()}),xg({type:Cg(Qg.enum.ActionExecutionStart),actionExecutionId:vg(),actionName:vg(),parentMessageId:vg().optional()}),xg({type:Cg(Qg.enum.ActionExecutionArgs),actionExecutionId:vg(),args:vg()}),xg({type:Cg(Qg.enum.ActionExecutionEnd),actionExecutionId:vg()}),xg({type:Cg(Qg.enum.ActionExecutionResult),actionName:vg(),actionExecutionId:vg(),result:vg()}),xg({type:Cg(Qg.enum.AgentStateMessage),threadId:vg(),agentName:vg(),nodeName:vg(),runId:vg(),active:yg(),role:vg(),state:vg(),running:yg()}),xg({type:Cg(Qg.enum.MetaEvent),name:$g,value:bg()}),xg({type:Cg(Qg.enum.RunError),message:vg(),code:vg().optional()})]),xg({id:vg(),role:vg(),content:vg(),parentMessageId:vg().optional()}),xg({id:vg(),name:vg(),arguments:bg(),parentMessageId:vg().optional()}),xg({id:vg(),result:bg(),actionExecutionId:vg(),actionName:vg()});var e_=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(` -`)},t_=(e,t,n)=>r=>{let i={},a=!0,o=!0,s=``,c=null,l=null,u=[],d={},f=e=>{typeof e==`object`&&e&&(`messages`in e&&delete e.messages,i=e)};return r.pipe(bf(r=>{switch(r.type){case B.TEXT_MESSAGE_START:{let e=r;return[{type:Qg.enum.TextMessageStart,messageId:e.messageId,role:e.role}]}case B.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:Qg.enum.TextMessageContent,messageId:e.messageId,content:e.delta}]}case B.TEXT_MESSAGE_END:{let e=r;return[{type:Qg.enum.TextMessageEnd,messageId:e.messageId}]}case B.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:Qg.enum.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case B.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let p=!1;if(l){let e=l.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(Mf(d.function.arguments));e.tool_argument&&e.tool_argument in t?(f({...i,[e.state_key]:t[e.tool_argument]}),p=!0):e.tool_argument||(f({...i,[e.state_key]:t}),p=!0)}catch{}}return[{type:Qg.enum.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...p?[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case B.TOOL_CALL_END:{let e=r;return[{type:Qg.enum.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case B.TOOL_CALL_RESULT:{let e=r;return[{type:Qg.enum.ActionExecutionResult,actionExecutionId:e.toolCallId,result:e.content,actionName:d[e.toolCallId]||`unknown`}]}case B.RAW:return[];case B.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:Qg.enum.MetaEvent,name:e.name,value:e.value}]}case B.STATE_SNAPSHOT:return f(r.snapshot),[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case B.STATE_DELTA:{let c=r,l=Nu.applyPatch(i,c.delta,!0,!1);return l?(f(l.newDocument),[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]):[]}case B.MESSAGES_SNAPSHOT:return c=r.messages,[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case B.RUN_STARTED:return[];case B.RUN_FINISHED:return c&&(i.messages=c),Object.keys(i).length===0?[]:[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:n_(c)}:{}}),active:!1}];case B.RUN_ERROR:{let e=r;return[{type:Qg.enum.RunError,message:e.message,code:e.code}]}case B.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case B.STEP_FINISHED:return u=[],l=null,[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function n_(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=e_(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={id:e.id,name:e.function.name,arguments:JSON.parse(e.function.arguments),parentMessageId:n.id};t.push(r)}}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:n.content,actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var r_=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,i_=e=>e===`tool`?`toolCallId`:`messageId`,a_=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},o_=e=>t=>{let n=Bg(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:B.TEXT_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TEXT_MESSAGE_END`,e,{messageId:e.messageId}),[e]}case`tool`:{let e={type:B.TOOL_CALL_END,toolCallId:t.fields.toolCallId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TOOL_CALL_END`,e,{toolCallId:e.toolCallId}),[e]}case`reasoning`:{let e={type:B.REASONING_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{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&&r_(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 ${i_(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(bf(e=>{switch(e.type){case B.TEXT_MESSAGE_START:case B.TEXT_MESSAGE_CONTENT:case B.TEXT_MESSAGE_END:case B.TOOL_CALL_START:case B.TOOL_CALL_ARGS:case B.TOOL_CALL_END:case B.TOOL_CALL_RESULT:case B.STATE_SNAPSHOT:case B.STATE_DELTA:case B.CUSTOM:case B.STEP_STARTED:case B.STEP_FINISHED:case B.THINKING_START:case B.THINKING_END:case B.THINKING_TEXT_MESSAGE_START:case B.THINKING_TEXT_MESSAGE_CONTENT:case B.THINKING_TEXT_MESSAGE_END:case B.REASONING_START:case B.REASONING_MESSAGE_START:case B.REASONING_MESSAGE_CONTENT:case B.REASONING_MESSAGE_END:case B.REASONING_END:return[...i(e.subagentRunId??void 0),e];case B.RUN_STARTED:case B.RUN_FINISHED:case B.RUN_ERROR:case B.MESSAGES_SNAPSHOT:return[...a(),e];case B.RAW:case B.ACTIVITY_SNAPSHOT:case B.ACTIVITY_DELTA:case B.REASONING_ENCRYPTED_VALUE:case B.SUBAGENT_STARTED:return[e];case B.SUBAGENT_FINISHED:case B.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case B.TEXT_MESSAGE_CHUNK:{let t=e,a=s(`text`,t.messageId,t.subagentRunId??void 0,`TEXT_MESSAGE_CHUNK`,`text message`),o=r.get(a),c=[],l;if(o?.kind===`text`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First TEXT_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,name:t.name,subagentRunId:t.subagentRunId},r.set(a,{kind:`text`,fields:l});let e=a_({type:B.TEXT_MESSAGE_START,messageId:t.messageId,role:t.role||`assistant`,...t.name!==void 0&&{name:t.name},...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TEXT_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=a_({type:B.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TEXT_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:B.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case B.TOOL_CALL_CHUNK:{let t=e,a=s(`tool`,t.toolCallId,t.subagentRunId??void 0,`TOOL_CALL_CHUNK`,`tool call`),o=r.get(a),c=[],l;if(o?.kind===`tool`&&(t.toolCallId===void 0||t.toolCallId===o.fields.toolCallId))l=o.fields;else{if(c.push(...i(a)),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`);l={toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`tool`,fields:l});let e=a_({type:B.TOOL_CALL_START,toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TOOL_CALL_START`,e,{toolCallId:t.toolCallId,toolCallName:t.toolCallName})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=a_({type:B.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TOOL_CALL_ARGS`,r,{toolCallId:l.toolCallId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:B.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case B.REASONING_MESSAGE_CHUNK:{let t=e,a=s(`reasoning`,t.messageId,t.subagentRunId??void 0,`REASONING_MESSAGE_CHUNK`,`reasoning message`),o=r.get(a),c=[],l;if(o?.kind===`reasoning`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First REASONING_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`reasoning`,fields:l});let e=a_({type:B.REASONING_MESSAGE_START,messageId:t.messageId,role:`reasoning`,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`REASONING_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=a_({type:B.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`REASONING_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:B.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}}return e.type,[]}),Df(()=>{a()}))};function s_(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}var c_=class{runNext(e,t){return t.run(e).pipe(o_(!1))}runNextWithState(e,t){let n=Ng(e.messages||[]),r=Ng(e.state||{}),i=new Pd;return Gg(e,i,t,[]).subscribe(e=>{e.messages!==void 0&&(n=e.messages),e.state!==void 0&&(r=e.state)}),this.runNext(e,t).pipe(Tf(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:Ng(n),state:Ng(r)})))}},l_=class extends c_{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function u_(e){let t=e.content;if(Array.isArray(t)){let n=t.filter(e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``);return{...e,content:n}}return typeof t==`string`?e:{...e,content:``}}var d_=class extends c_{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(u_)};return this.runNext(i,t)}},f_=`THINKING_START`,p_=`THINKING_END`,m_=`THINKING_TEXT_MESSAGE_START`,h_=`THINKING_TEXT_MESSAGE_CONTENT`,g_=`THINKING_TEXT_MESSAGE_END`,__=class extends c_{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(vf(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case f_:{this.currentReasoningId=Pg();let{title:t,...n}=e;return this.warnAboutTransformation(f_,B.REASONING_START),{...n,type:B.REASONING_START,messageId:this.currentReasoningId}}case m_:return this.currentMessageId=Pg(),this.warnAboutTransformation(m_,B.REASONING_MESSAGE_START),{...e,type:B.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`assistant`};case h_:{let{delta:t,...n}=e;return this.warnAboutTransformation(h_,B.REASONING_MESSAGE_CONTENT),{...n,type:B.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Pg(),delta:t}}case g_:{let t=this.currentMessageId??Pg();return this.warnAboutTransformation(g_,B.REASONING_MESSAGE_END),{...e,type:B.REASONING_MESSAGE_END,messageId:t}}case p_:{let t=this.currentReasoningId??Pg();return this.warnAboutTransformation(p_,B.REASONING_END),{...e,type:B.REASONING_END,messageId:t}}default:return e}}};function v_(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function y_(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function b_(e){let t=v_(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}}:{}}:e}function x_(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>y_(e)?b_(e):e);return{...e,content:n}}var S_=class extends c_{run(e,t){let n={...e,messages:e.messages.map(x_)};return this.runNext(n,t)}},C_=`SUBAGENT_STARTED`,w_=`SUBAGENT_FINISHED`,T_=`SUBAGENT_ERROR`;function E_(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function D_(e){return e.map(e=>E_(e))}var O_=class extends c_{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=>E_(e))};return this.runNext(n,t).pipe(Af(e=>{let t=e.type;(t===C_||t===w_||t===T_)&&this.warnDroppedLifecycleEvent(t)}),Cf(e=>{let t=e.type;return t!==C_&&t!==w_&&t!==T_}),vf(e=>{let t=E_(e);if(t.type===B.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:D_(e.messages)}}if(t.type===B.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>E_(e))}}}if(t.type===B.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:D_(e.input.messages)}}}return t}))}},k_=`0.0.59`,A_=class{get maxVersion(){return k_}get debug(){return this._debug}set debug(e){this._debug=zg(e),this._debugLogger=Hg(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?Hg(zg(!0)):void 0:e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??``,this.threadId=n??Go(),this.messages=Ng(r??[]),this.state=Ng(i??{}),this._debug=zg(a),this._debugLogger=Hg(this._debug),Mg(this.maxVersion,`0.0.39`)<=0&&this.middlewares.unshift(new d_),Mg(this.maxVersion,`0.0.45`)<=0&&this.middlewares.unshift(new __),Mg(this.maxVersion,`0.0.47`)<=0&&this.middlewares.unshift(new S_),Mg(this.maxVersion,`0.0.57`)<=0&&this.middlewares.unshift(new O_)}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 l_(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();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=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new jd;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await _f(bd(()=>this.middlewares.length===0?this.run(n):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),o_(this.debugLogger),Kg(this.debugLogger),e=>e.pipe(kf(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),wf(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))),Df(()=>{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}))(hf(null)));let s=Ng(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new Qc}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new jd;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await _f(bd(()=>Sf(()=>this.connect(n)),o_(this.debugLogger),Kg(this.debugLogger),e=>e.pipe(kf(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),wf(e=>(this.isRunning=!1,e instanceof Qc?Fd:this.onError(n,e,a))),Df(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(hf(null)),{defaultValue:void 0});let s=Ng(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}apply(e,t,n){return Gg(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(Af(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Ng(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=t.filter(e=>e.role!==`activity`);return{threadId:this.threadId,runId:e?.runId||Go(),tools:Ng(e?.tools??[]),context:Ng(e?.context??[]),forwardedProps:Ng(e?.forwardedProps??{}),state:Ng(this.state),messages:n,...e?.resume===void 0?{}:{resume:Ng(e.resume)}}}async onInitialize(e,t){if(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 z(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let e of this.pendingInterrupts)if(s_(e))throw new z(`Interrupt ${e.id} expired at ${e.expiresAt}`)}let n=await Rg(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){this.messages=n.messages;for(let e of n.messages)e.subagentRunId===null&&delete e.subagentRunId;e.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})}n.state&&(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 mf(Rg(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(vf(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 Rg(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=Ng(this.messages),e.state=Ng(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Ng(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=Ng(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=Ng(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??Go();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t)).pipe(o_(this.debugLogger),Kg(this.debugLogger),t_(this.threadId,t.runId,this.agentId),e=>e.pipe(vf(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function j_(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 M_=class extends A_{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(j_(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=Ng(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return Zg(Jg(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Ng(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}},N_=class extends un{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:Tn(t,n.data),hasPreviousPage:dn(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},P_=class extends mn{#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 xn({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=F_(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=F_(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=F_(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=F_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Sn.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=>On(t,e))}findAll(e={}){return this.getAll().filter(t=>On(e,t))}notify(e){Sn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Sn.batch(()=>Promise.all(e.map(e=>e.continue().catch(Dn))))}};function F_(e){return e.options.scope?.id}var I_=class extends mn{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??En(r,t),a=this.get(i);return a||(a=new vn({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){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Sn.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=>ln(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ln(e,t)):t}notify(e){Sn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Sn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Sn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},L_=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new I_,this.#t=e.mutationCache||new P_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=yn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=fn.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(qt(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=pn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Sn.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;Sn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Sn.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=Sn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Dn).catch(Dn)}invalidateQueries(e,t={}){return Sn.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=Sn.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(Dn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Dn)}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(qt(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(qt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Dn).catch(Dn)}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(Dn).catch(Dn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return fn.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(sn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{on(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(sn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{on(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||=En(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===Yt&&(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 R_(e,t){return cn(e,N_,t)}var z_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),B_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),V_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),H_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),U_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),W_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),G_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),K_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:z_}));K_.displayName=`BookOpenIcon`;var q_=K_,J_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:B_}));J_.displayName=`MagnifyingGlassIcon`;var Y_=J_,X_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:V_}));X_.displayName=`MoonIcon`;var Z_=X_,Q_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:H_}));Q_.displayName=`PencilSimpleIcon`;var $_=Q_,ev=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:U_}));ev.displayName=`PlugsConnectedIcon`;var tv=ev,nv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:W_}));nv.displayName=`SignOutIcon`;var rv=nv,iv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:G_}));iv.displayName=`SunIcon`;var av=iv,ov={home:`https://fanout.run/start/what-fanout-is`,ingest:`https://fanout.run/start/send-telemetry`};async function sv(e,t){let n=new URLSearchParams({limit:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await De(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function cv({agentAvailable:e,activeThreadID:t,activeDashboardID:n,autoFocusSearch:r=!1,onNewChat:i,onSelectThread:a,onDeletedThread:o,onSelectDashboard:s,onCreateDashboard:c,onInvestigateService:l,ref:u}){let d=nn(),[f,p]=(0,w.useState)(``),[m]=fa(f.trim(),250),[h,g]=(0,w.useState)(null),[_,v]=(0,w.useState)(null),[b,x]=(0,w.useState)(``),[ee,ne]=(0,w.useState)(``),[S,ie]=(0,w.useState)(!1),oe=(0,w.useRef)(null);(0,w.useImperativeHandle)(u,()=>({focusSearch:()=>oe.current?.focus()}),[]),(0,w.useEffect)(()=>{r&&requestAnimationFrame(()=>oe.current?.focus())},[r]);let se=R_({queryKey:[...Cn,m],queryFn:({pageParam:e})=>sv(m,e),initialPageParam:``,getNextPageParam:e=>e.nextCursor||void 0,enabled:e}),le=hn({queryKey:wn,queryFn:()=>bn(`/api/dashboards`),refetchInterval:3e4,staleTime:bt}),ue=(0,w.useMemo)(()=>se.data?.pages.flatMap(e=>e.threads)??[],[se.data]),de=(0,w.useMemo)(()=>mv(ue),[ue]),fe=pt(`overview`,it({window:`1h`,namespace:``}),!!m&&!!l),pe=(0,w.useMemo)(()=>{if(!m)return[];let e=m.toLowerCase();return(fe.data?.data.services??[]).map(e=>e.service).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[fe.data,m]),me=(0,w.useMemo)(()=>{let e=le.data?.dashboards??[],t=m.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[le.data,m]);function he(e){ne(``),x(e.title),g(e)}async function _e(){if(h&&b.trim()){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(h.threadId)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:b.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await d.invalidateQueries({queryKey:Cn}),g(null)}catch(e){ne(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{ie(!1)}}}async function ve(){if(_){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(_.threadId)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=_.threadId;v(null),await d.invalidateQueries({queryKey:Cn}),o(t)}catch(e){ne(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{ie(!1)}}}return(0,T.jsxs)(ge,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[e&&(0,T.jsx)(ye,{leftSection:(0,T.jsx)(Xe,{size:16,weight:`bold`}),onClick:i,children:`New chat`}),(0,T.jsx)(Vt,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,T.jsxs)(ge,{gap:`lg`,pb:`sm`,children:[e&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(lv,{children:`Chats`}),se.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),se.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Chats could not be loaded.`}),!se.isLoading&&!se.isError&&ue.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:m?`No matching chats`:`No chats yet`}),de.map(e=>(0,T.jsxs)(ge,{gap:2,children:[de.length>1&&(0,T.jsx)(re,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,T.jsx)(uv,{thread:e,active:e.threadId===t,onSelect:()=>a(e.threadId),onRename:()=>he(e),onDelete:()=>{ne(``),v(e)}},e.threadId))]},e.label)),se.hasNextPage&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:se.isFetchingNextPage,onClick:()=>void se.fetchNextPage(),children:`See all`})]}),pe.length>0&&l&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(lv,{children:`Services`}),pe.map(e=>(0,T.jsx)(te,{className:`rail-row`,p:`sm`,onClick:()=>l(e),children:(0,T.jsx)(re,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(lv,{children:`Dashboards`}),le.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),le.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Dashboards could not be loaded.`}),!le.isLoading&&!le.isError&&m&&me.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:`No matching dashboards`}),me.map(e=>{let t=e.id===n;return(0,T.jsx)(te,{className:`rail-row`,"data-active":t||void 0,"aria-current":t?`page`:void 0,p:`sm`,onClick:()=>s(e.id),children:(0,T.jsxs)(ce,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.name}),e.is_default&&(0,T.jsx)(Ze,{size:`xs`,variant:`light`,color:`gray`,children:`Default`})]})},e.id)}),e&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,justify:`flex-start`,leftSection:(0,T.jsx)(It,{size:14,weight:`fill`}),onClick:c,children:`Create with AI`})]})]})}),(0,T.jsx)(Ae,{ref:oe,value:f,onChange:e=>p(e.currentTarget.value),leftSection:(0,T.jsx)(Y_,{size:15}),rightSection:(0,T.jsx)(Ro,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,T.jsx)(_n,{opened:h!==null,onClose:()=>!S&&g(null),title:`Rename chat`,centered:!0,children:(0,T.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),_e()},children:(0,T.jsxs)(ge,{children:[(0,T.jsx)(Ae,{label:`Name`,value:b,onChange:e=>x(e.currentTarget.value),maxLength:120,autoFocus:!0}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>g(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{type:`submit`,loading:S,disabled:!b.trim(),children:`Save`})]})]})})}),(0,T.jsx)(_n,{opened:_!==null,onClose:()=>!S&&v(null),title:`Delete chat?`,centered:!0,children:(0,T.jsxs)(ge,{children:[(0,T.jsxs)(re,{size:`sm`,children:[`This permanently removes `,(0,T.jsx)(re,{span:!0,fw:650,children:_?.title}),` and its saved messages.`]}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>v(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{color:`bad`,loading:S,onClick:()=>void ve(),children:`Delete`})]})]})})]})}function lv({children:e}){return(0,T.jsx)(re,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function uv({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,T.jsx)(xe,{"data-active":t||void 0,className:`rail-row`,children:(0,T.jsxs)(ce,{gap:2,wrap:`nowrap`,children:[(0,T.jsx)(te,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,T.jsxs)(ge,{gap:0,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.title}),(0,T.jsx)(re,{c:`dimmed`,size:`xs`,children:hv(e.updatedAt)})]})}),(0,T.jsxs)(Ft,{position:`bottom-end`,withinPortal:!0,children:[(0,T.jsx)(Ft.Target,{children:(0,T.jsx)(Mn,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,T.jsx)(Le,{size:18,weight:`bold`})})}),(0,T.jsxs)(Ft.Dropdown,{children:[(0,T.jsx)(Ft.Item,{leftSection:(0,T.jsx)($_,{size:15}),onClick:r,children:`Rename`}),(0,T.jsx)(Ft.Item,{color:`bad`,leftSection:(0,T.jsx)(st,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function dv(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function fv(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var pv=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function mv(e){let t=fv(new Date),n=new Map;for(let r of e){let e=Math.floor((t-fv(dv(r.updatedAt)))/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 pv.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function hv(e){let t=dv(e),n=fv(new Date);return Math.floor((n-fv(t))/864e5)<=1?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t):new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function gv({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=kn(),s=Ne(),c=da({select:e=>e.location.pathname}),{dashboardId:l}=We({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=pa(!1),[p,m]=(0,w.useState)(!1),[h,g]=(0,w.useState)(``),_=(0,w.useRef)(null),v=he(`(max-width: 62em)`),y=(0,w.useRef)(v);y.current=v,(0,w.useEffect)(()=>{f.close()},[c]),(0,w.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),y.current?(m(!0),f.open()):_.current?.focusSearch())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let b={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e}}),onCreateDashboard:()=>o(An),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)};return(0,T.jsxs)(to,{header:{height:52},navbar:{width:256,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,T.jsx)(to.Header,{children:(0,T.jsxs)(ce,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,T.jsxs)(ce,{gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(go,{hiddenFrom:`md`,opened:d,onClick:()=>{m(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,T.jsx)(ve,{size:`small`})]}),(0,T.jsxs)(ce,{gap:`xs`,wrap:`nowrap`,children:[(0,T.jsx)(Ht,{label:`Documentation`,children:(0,T.jsx)(Mn,{component:`a`,href:ov.home,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,"aria-label":`Documentation`,children:(0,T.jsx)(q_,{size:17,weight:`bold`})})}),(0,T.jsx)(_v,{}),(0,T.jsx)(vv,{onError:g})]})]})}),(0,T.jsx)(to.Navbar,{p:`sm`,children:(0,T.jsx)(cv,{ref:_,...b})}),(0,T.jsx)(Fo,{opened:d,onClose:f.close,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,T.jsx)(ve,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,T.jsx)(cv,{...b,autoFocusSearch:d&&p})}),(0,T.jsxs)(to.Main,{children:[h&&(0,T.jsx)(ae,{color:`bad`,m:`md`,withCloseButton:!0,onClose:()=>g(``),children:h}),e]})]})}function _v(){let{setColorScheme:e}=Wt(),t=Gt(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`,[r,i]=(0,w.useState)(!1);return(0,T.jsx)(Ht,{label:`Switch to ${n} theme`,opened:r,children:(0,T.jsx)(Mn,{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,T.jsx)(av,{size:17,weight:`bold`}):(0,T.jsx)(Z_,{size:17,weight:`bold`})})})}function vv({onError:e}){let t=Ne(),n=je(),r=(n.name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,T.jsxs)(Ft,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,T.jsx)(Ft.Target,{children:(0,T.jsx)(Mn,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`Account menu`,children:(0,T.jsx)(po,{size:26,radius:`xl`,color:`brand`,children:r})})}),(0,T.jsxs)(Ft.Dropdown,{children:[(0,T.jsx)(Ft.Label,{children:n.email||`Signed in`}),(0,T.jsx)(Ft.Item,{leftSection:(0,T.jsx)(tv,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,T.jsx)(Ft.Divider,{}),(0,T.jsx)(Ft.Item,{leftSection:(0,T.jsx)(rv,{size:15}),onClick:()=>void Ce().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function yv(){let{agent_available:e}=ke(),t=Ne(),n=nn(),{threadId:r}=We({strict:!1}),[i,a]=(0,w.useState)(Lt),o=(0,w.useRef)(new Set),s=r??i,[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)({}),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(``),[b,x]=(0,w.useState)(``),[ee,te]=(0,w.useState)(``),[ne,re]=(0,w.useState)(0),S=(0,w.useRef)(``),ie=(0,w.useRef)(null),ae=(0,w.useRef)(0),oe=(0,w.useMemo)(()=>new M_({url:`/api/agent`,threadId:s,fetch:(e,t)=>De(e,t)}),[s]),se=!e||f===s;function ce(){ae.current=0,y(``)}(0,w.useEffect)(()=>{let t=!0;if(l([]),d({}),p(``),h(!1),_(!1),ce(),te(``),!e){p(s);return}!r||o.current.has(s)?(oe.setMessages([]),p(s)):De(`/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}oe.setMessages(e.messages??[]),l([...e.messages??[]]),p(s)}}).catch(()=>{t&&(S.current=``,te(`This chat could not be restored. Start a new chat or try again.`))});let i=oe.subscribe({onEvent:({messages:e})=>l([...e]),onRunInitialized:()=>{_(!0),te(``)},onToolCallStartEvent:({event:e})=>{ae.current+=1,y(Nn(e.toolCallName))},onToolCallEndEvent:()=>{ae.current=Math.max(0,ae.current-1),ae.current===0&&y(``)},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),ce(),o.current.delete(s),n.invalidateQueries({queryKey:Cn})},onRunFailed:e=>{console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),ce(),o.current.delete(s),n.invalidateQueries({queryKey:Cn})}});return()=>{t=!1,i.unsubscribe(),oe.abortRun()}},[oe,e,n,ne,s]),(0,w.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(()=>ie.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>ie.current?.focus()))),e.key===`Escape`&&n===ie.current&&(x(``),ie.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function le(){_(!0),te(``);try{await oe.runAgent()}catch(e){console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),ce(),o.current.delete(s)}}async function ue(n){let i=n.trim();if(!e||!i||g||!se||m)return;r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let a={id:Lt(),role:`user`,content:i};oe.addMessage(a),l([...oe.messages]),d(e=>({...e,[a.id]:Date.now()})),x(``),await le()}(0,w.useEffect)(()=>{let e=S.current;se&&r&&e&&(S.current=``,ue(e))},[se,r,s]);function de(e){e.preventDefault(),ue(b)}function C(){oe.abortRun(),_(!1),ce(),o.current.delete(s)}function fe(){!g&&oe.messages.some(e=>e.role===`user`)&&le()}function pe(n){if(!e)return;let r=Lt();o.current.add(r),S.current=n??``,t({to:`/chat/$threadId`,params:{threadId:r}})}function me(){oe.abortRun(),S.current=``,a(Lt()),t({to:`/chat`})}function he(e){t({to:`/chat/$threadId`,params:{threadId:e}})}function ge(){re(e=>e+1)}return(0,T.jsx)(jn.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:se,running:g,activity:v,input:b,setInput:x,error:ee,inputRef:ie,send:ue,submit:de,stop:C,retry:fe,reloadThread:ge,openChat:pe,newThread:me,selectThread:he},children:(0,T.jsx)(gv,{children:(0,T.jsx)(ta,{})})})}function bv(){let e=(0,w.useMemo)(()=>new L_,[]);return(0,T.jsx)(Jt,{client:e,children:(0,T.jsx)(Me,{children:(0,T.jsx)(yv,{})})})}var xv=Ve({component:bv,notFoundComponent:()=>(0,T.jsx)(Oe,{to:`/`,replace:!0})}),Sv=Re(`/`)({component:qe(()=>Pn(()=>import(`./routes-VCBnBbPZ.js`),__vite__mapDeps([0,1,2])),`component`)}),Cv=Re(`/settings`)({component:qe(()=>Pn(()=>import(`./settings-BTUR4pT4.js`),__vite__mapDeps([3,1,2,4,5,6])),`component`)}),wv=Re(`/chat/`)({component:qe(()=>Pn(()=>import(`./chat.index-DYB6vKSb.js`),__vite__mapDeps([7,8,1,4,9,10])),`component`)}),Tv=Re(`/chat/$threadId`)({component:qe(()=>Pn(()=>import(`./chat._threadId-DYB6vKSb.js`),__vite__mapDeps([11,8,1,4,9,10])),`component`)}),Ev=Re(`/dashboards/`)({component:qe(()=>Pn(()=>import(`./dashboards.index-D2SA6vFv.js`),__vite__mapDeps([12,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:lt}),Dv=Re(`/dashboards/$dashboardId`)({component:qe(()=>Pn(()=>import(`./dashboards._dashboardId-rFBmUOpC.js`),__vite__mapDeps([16,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:lt}),Ov=Sv.update({id:`/`,path:`/`,getParentRoute:()=>xv}),kv=Cv.update({id:`/settings`,path:`/settings`,getParentRoute:()=>xv}),Av=wv.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>xv}),jv=Tv.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>xv}),Mv=Ev.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>xv}),Nv={IndexRoute:Ov,SettingsRoute:kv,ChatThreadIdRoute:jv,DashboardsDashboardIdRoute:Dv.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>xv}),ChatIndexRoute:Av,DashboardsIndexRoute:Mv},Pv=sa({routeTree:xv._addFileChildren(Nv)._addFileTypes(),defaultPreload:`intent`,scrollRestoration:!0}),Fv={brand:Dt,ok:kt,warn:Nt,bad:xt,info:Ct},Iv={light:7,dark:5};function Lv(e){let t=e.replace(`#`,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=e=>{let t=parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(2)+.0722*r(4)}function Rv(e){let t=Lv(e),n=1.05/(t+.05);return(t+.05)/.05>n?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function zv(e){return Object.fromEntries(Object.entries(Fv).map(([t,n])=>[`--fanout-color-${t}-contrast`,Rv(n[Iv[e]])]))}function Bv(e){return t=>{let n=t.color??Uv.primaryColor,r=e({...t,color:n}),i=t.variant===`filled`||t.variant===void 0;return t.autoContrast===!1||!i||!Object.hasOwn(Fv,n)?r:{...r,color:`var(--fanout-color-${n}-contrast)`}}}var Vv=.25,Hv={xs:9,sm:10,md:11,lg:13,xl:16},Uv={primaryColor:`brand`,primaryShade:Iv,autoContrast:!0,luminanceThreshold:Vv,colors:{dark:jt,brand:Dt,ok:kt,warn:Nt,bad:xt,info:Ct},defaultRadius:`md`,fontFamily:at.body,fontFamilyMonospace:at.display,headings:{fontFamily:at.body,fontWeight:`600`},cursorType:`pointer`,components:{Tabs:{styles:(e,t)=>({tab:Kv(t.color,`--tabs-text-color`)})},Pagination:{styles:(e,t)=>({control:Kv(t.color,`--pagination-active-color`)})},Badge:{vars:(e,t)=>({root:Gv(t.size)})}}},Wv=()=>({variables:{"--mantine-color-error":`var(--mantine-color-bad-filled)`},light:{"--mantine-color-dimmed":mt.light.muted,...zv(`light`)},dark:zv(`dark`)});function Gv(e){let t=Hv[e??`md`];return t===void 0||t>=vt.micro?{}:{"--badge-fz":`${vt.micro/16}rem`}}function Kv(e,t){return!e||e===Uv.primaryColor?{[t]:`var(--fanout-color-${Uv.primaryColor}-contrast)`}:{}}var qv=Bv(h),Jv=ja({...Uv,variantColorResolver:qv});(0,Ac.createRoot)(document.getElementById(`root`)).render((0,T.jsx)(w.StrictMode,{children:(0,T.jsx)(Aa,{theme:Jv,defaultColorScheme:`auto`,cssVariablesResolver:Wv,children:(0,T.jsx)(ua,{router:Pv})})}));export{Ev as n,ov as r,Dv as t}; \ No newline at end of file +`)},t_=(e,t,n)=>r=>{let i={},a=!0,o=!0,s=``,c=null,l=null,u=[],d={},f=e=>{typeof e==`object`&&e&&(`messages`in e&&delete e.messages,i=e)};return r.pipe(bf(r=>{switch(r.type){case B.TEXT_MESSAGE_START:{let e=r;return[{type:Qg.enum.TextMessageStart,messageId:e.messageId,role:e.role}]}case B.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:Qg.enum.TextMessageContent,messageId:e.messageId,content:e.delta}]}case B.TEXT_MESSAGE_END:{let e=r;return[{type:Qg.enum.TextMessageEnd,messageId:e.messageId}]}case B.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:Qg.enum.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case B.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let p=!1;if(l){let e=l.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(Mf(d.function.arguments));e.tool_argument&&e.tool_argument in t?(f({...i,[e.state_key]:t[e.tool_argument]}),p=!0):e.tool_argument||(f({...i,[e.state_key]:t}),p=!0)}catch{}}return[{type:Qg.enum.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...p?[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case B.TOOL_CALL_END:{let e=r;return[{type:Qg.enum.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case B.TOOL_CALL_RESULT:{let e=r;return[{type:Qg.enum.ActionExecutionResult,actionExecutionId:e.toolCallId,result:e.content,actionName:d[e.toolCallId]||`unknown`}]}case B.RAW:return[];case B.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:Qg.enum.MetaEvent,name:e.name,value:e.value}]}case B.STATE_SNAPSHOT:return f(r.snapshot),[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case B.STATE_DELTA:{let c=r,l=Nu.applyPatch(i,c.delta,!0,!1);return l?(f(l.newDocument),[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]):[]}case B.MESSAGES_SNAPSHOT:return c=r.messages,[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case B.RUN_STARTED:return[];case B.RUN_FINISHED:return c&&(i.messages=c),Object.keys(i).length===0?[]:[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:n_(c)}:{}}),active:!1}];case B.RUN_ERROR:{let e=r;return[{type:Qg.enum.RunError,message:e.message,code:e.code}]}case B.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case B.STEP_FINISHED:return u=[],l=null,[{type:Qg.enum.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function n_(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=e_(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={id:e.id,name:e.function.name,arguments:JSON.parse(e.function.arguments),parentMessageId:n.id};t.push(r)}}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:n.content,actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var r_=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,i_=e=>e===`tool`?`toolCallId`:`messageId`,a_=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},o_=e=>t=>{let n=Bg(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:B.TEXT_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TEXT_MESSAGE_END`,e,{messageId:e.messageId}),[e]}case`tool`:{let e={type:B.TOOL_CALL_END,toolCallId:t.fields.toolCallId,...t.fields.subagentRunId!=null&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TOOL_CALL_END`,e,{toolCallId:e.toolCallId}),[e]}case`reasoning`:{let e={type:B.REASONING_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!=null&&{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&&r_(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 ${i_(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(bf(e=>{switch(e.type){case B.TEXT_MESSAGE_START:case B.TEXT_MESSAGE_CONTENT:case B.TEXT_MESSAGE_END:case B.TOOL_CALL_START:case B.TOOL_CALL_ARGS:case B.TOOL_CALL_END:case B.TOOL_CALL_RESULT:case B.STATE_SNAPSHOT:case B.STATE_DELTA:case B.CUSTOM:case B.STEP_STARTED:case B.STEP_FINISHED:case B.THINKING_START:case B.THINKING_END:case B.THINKING_TEXT_MESSAGE_START:case B.THINKING_TEXT_MESSAGE_CONTENT:case B.THINKING_TEXT_MESSAGE_END:case B.REASONING_START:case B.REASONING_MESSAGE_START:case B.REASONING_MESSAGE_CONTENT:case B.REASONING_MESSAGE_END:case B.REASONING_END:return[...i(e.subagentRunId??void 0),e];case B.RUN_STARTED:case B.RUN_FINISHED:case B.RUN_ERROR:case B.MESSAGES_SNAPSHOT:return[...a(),e];case B.RAW:case B.ACTIVITY_SNAPSHOT:case B.ACTIVITY_DELTA:case B.REASONING_ENCRYPTED_VALUE:case B.SUBAGENT_STARTED:return[e];case B.SUBAGENT_FINISHED:case B.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case B.TEXT_MESSAGE_CHUNK:{let t=e,a=s(`text`,t.messageId,t.subagentRunId??void 0,`TEXT_MESSAGE_CHUNK`,`text message`),o=r.get(a),c=[],l;if(o?.kind===`text`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First TEXT_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,name:t.name,subagentRunId:t.subagentRunId},r.set(a,{kind:`text`,fields:l});let e=a_({type:B.TEXT_MESSAGE_START,messageId:t.messageId,role:t.role||`assistant`,...t.name!==void 0&&{name:t.name},...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TEXT_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=a_({type:B.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TEXT_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:B.TEXT_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case B.TOOL_CALL_CHUNK:{let t=e,a=s(`tool`,t.toolCallId,t.subagentRunId??void 0,`TOOL_CALL_CHUNK`,`tool call`),o=r.get(a),c=[],l;if(o?.kind===`tool`&&(t.toolCallId===void 0||t.toolCallId===o.fields.toolCallId))l=o.fields;else{if(c.push(...i(a)),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`);l={toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`tool`,fields:l});let e=a_({type:B.TOOL_CALL_START,toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`TOOL_CALL_START`,e,{toolCallId:t.toolCallId,toolCallName:t.toolCallName})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=a_({type:B.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`TOOL_CALL_ARGS`,r,{toolCallId:l.toolCallId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:B.TOOL_CALL_ARGS,toolCallId:l.toolCallId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}case B.REASONING_MESSAGE_CHUNK:{let t=e,a=s(`reasoning`,t.messageId,t.subagentRunId??void 0,`REASONING_MESSAGE_CHUNK`,`reasoning message`),o=r.get(a),c=[],l;if(o?.kind===`reasoning`&&(t.messageId===void 0||t.messageId===o.fields.messageId))l=o.fields;else{if(c.push(...i(a)),t.messageId===void 0)throw Error(`First REASONING_MESSAGE_CHUNK must have a messageId`);l={messageId:t.messageId,subagentRunId:t.subagentRunId},r.set(a,{kind:`reasoning`,fields:l});let e=a_({type:B.REASONING_MESSAGE_START,messageId:t.messageId,role:`reasoning`,...t.subagentRunId!=null&&{subagentRunId:t.subagentRunId}},t);c.push(e),n?.event(`TRANSFORM`,`REASONING_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0){let e=t.subagentRunId??l.subagentRunId,r=a_({type:B.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:t.delta,...e!=null&&{subagentRunId:e}},t);c.push(r),n?.event(`TRANSFORM`,`REASONING_MESSAGE_CONTENT`,r,{messageId:l.messageId})}if(c.length===0&&t.metadata!==void 0){let e=t.subagentRunId??l.subagentRunId;c.push({type:B.REASONING_MESSAGE_CONTENT,messageId:l.messageId,delta:``,metadata:t.metadata,...e!=null&&{subagentRunId:e}})}return c}}return e.type,[]}),Df(()=>{a()}))};function s_(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}var c_=class{runNext(e,t){return t.run(e).pipe(o_(!1))}runNextWithState(e,t){let n=Ng(e.messages||[]),r=Ng(e.state||{}),i=new Pd;return Gg(e,i,t,[]).subscribe(e=>{e.messages!==void 0&&(n=e.messages),e.state!==void 0&&(r=e.state)}),this.runNext(e,t).pipe(Tf(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:Ng(n),state:Ng(r)})))}},l_=class extends c_{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function u_(e){let t=e.content;if(Array.isArray(t)){let n=t.filter(e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``);return{...e,content:n}}return typeof t==`string`?e:{...e,content:``}}var d_=class extends c_{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(u_)};return this.runNext(i,t)}},f_=`THINKING_START`,p_=`THINKING_END`,m_=`THINKING_TEXT_MESSAGE_START`,h_=`THINKING_TEXT_MESSAGE_CONTENT`,g_=`THINKING_TEXT_MESSAGE_END`,__=class extends c_{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(vf(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case f_:{this.currentReasoningId=Pg();let{title:t,...n}=e;return this.warnAboutTransformation(f_,B.REASONING_START),{...n,type:B.REASONING_START,messageId:this.currentReasoningId}}case m_:return this.currentMessageId=Pg(),this.warnAboutTransformation(m_,B.REASONING_MESSAGE_START),{...e,type:B.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`assistant`};case h_:{let{delta:t,...n}=e;return this.warnAboutTransformation(h_,B.REASONING_MESSAGE_CONTENT),{...n,type:B.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Pg(),delta:t}}case g_:{let t=this.currentMessageId??Pg();return this.warnAboutTransformation(g_,B.REASONING_MESSAGE_END),{...e,type:B.REASONING_MESSAGE_END,messageId:t}}case p_:{let t=this.currentReasoningId??Pg();return this.warnAboutTransformation(p_,B.REASONING_END),{...e,type:B.REASONING_END,messageId:t}}default:return e}}};function v_(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function y_(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function b_(e){let t=v_(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}}:{}}:e}function x_(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>y_(e)?b_(e):e);return{...e,content:n}}var S_=class extends c_{run(e,t){let n={...e,messages:e.messages.map(x_)};return this.runNext(n,t)}},C_=`SUBAGENT_STARTED`,w_=`SUBAGENT_FINISHED`,T_=`SUBAGENT_ERROR`;function E_(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function D_(e){return e.map(e=>E_(e))}var O_=class extends c_{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=>E_(e))};return this.runNext(n,t).pipe(Af(e=>{let t=e.type;(t===C_||t===w_||t===T_)&&this.warnDroppedLifecycleEvent(t)}),Cf(e=>{let t=e.type;return t!==C_&&t!==w_&&t!==T_}),vf(e=>{let t=E_(e);if(t.type===B.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:D_(e.messages)}}if(t.type===B.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>E_(e))}}}if(t.type===B.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:D_(e.input.messages)}}}return t}))}},k_=`0.0.59`,A_=class{get maxVersion(){return k_}get debug(){return this._debug}set debug(e){this._debug=zg(e),this._debugLogger=Hg(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?Hg(zg(!0)):void 0:e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??``,this.threadId=n??Go(),this.messages=Ng(r??[]),this.state=Ng(i??{}),this._debug=zg(a),this._debugLogger=Hg(this._debug),Mg(this.maxVersion,`0.0.39`)<=0&&this.middlewares.unshift(new d_),Mg(this.maxVersion,`0.0.45`)<=0&&this.middlewares.unshift(new __),Mg(this.maxVersion,`0.0.47`)<=0&&this.middlewares.unshift(new S_),Mg(this.maxVersion,`0.0.57`)<=0&&this.middlewares.unshift(new O_)}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 l_(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();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=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new jd;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await _f(bd(()=>this.middlewares.length===0?this.run(n):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),o_(this.debugLogger),Kg(this.debugLogger),e=>e.pipe(kf(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),wf(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))),Df(()=>{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}))(hf(null)));let s=Ng(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new Qc}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Go();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new jd;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await _f(bd(()=>Sf(()=>this.connect(n)),o_(this.debugLogger),Kg(this.debugLogger),e=>e.pipe(kf(this.activeRunDetach$)),e=>this.apply(n,e,a),e=>this.processApplyEvents(n,e,a),wf(e=>(this.isRunning=!1,e instanceof Qc?Fd:this.onError(n,e,a))),Df(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(hf(null)),{defaultValue:void 0});let s=Ng(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}apply(e,t,n){return Gg(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(Af(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Ng(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=t.filter(e=>e.role!==`activity`);return{threadId:this.threadId,runId:e?.runId||Go(),tools:Ng(e?.tools??[]),context:Ng(e?.context??[]),forwardedProps:Ng(e?.forwardedProps??{}),state:Ng(this.state),messages:n,...e?.resume===void 0?{}:{resume:Ng(e.resume)}}}async onInitialize(e,t){if(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 z(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let e of this.pendingInterrupts)if(s_(e))throw new z(`Interrupt ${e.id} expired at ${e.expiresAt}`)}let n=await Rg(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){this.messages=n.messages;for(let e of n.messages)e.subagentRunId===null&&delete e.subagentRunId;e.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})}n.state&&(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 mf(Rg(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(vf(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 Rg(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=Ng(this.messages),e.state=Ng(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Ng(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=Ng(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=Ng(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??Go();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t)).pipe(o_(this.debugLogger),Kg(this.debugLogger),t_(this.threadId,t.runId,this.agentId),e=>e.pipe(vf(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function j_(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 M_=class extends A_{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(j_(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=Ng(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return Zg(Jg(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Ng(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}},N_=class extends un{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:Tn(t,n.data),hasPreviousPage:dn(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},P_=class extends mn{#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 xn({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=F_(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=F_(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=F_(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=F_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Sn.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=>On(t,e))}findAll(e={}){return this.getAll().filter(t=>On(e,t))}notify(e){Sn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Sn.batch(()=>Promise.all(e.map(e=>e.continue().catch(Dn))))}};function F_(e){return e.options.scope?.id}var I_=class extends mn{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??En(r,t),a=this.get(i);return a||(a=new vn({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){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Sn.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=>ln(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ln(e,t)):t}notify(e){Sn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Sn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Sn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},L_=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new I_,this.#t=e.mutationCache||new P_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=yn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=fn.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(qt(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=pn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Sn.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;Sn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Sn.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=Sn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Dn).catch(Dn)}invalidateQueries(e,t={}){return Sn.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=Sn.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(Dn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Dn)}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(qt(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(qt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Dn).catch(Dn)}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(Dn).catch(Dn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return fn.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(sn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{on(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(sn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{on(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||=En(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===Yt&&(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 R_(e,t){return cn(e,N_,t)}var z_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),B_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),V_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),H_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),U_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),W_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),G_=new Map([[`bold`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`,w.createElement(w.Fragment,null,w.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`}))]]),K_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:z_}));K_.displayName=`BookOpenIcon`;var q_=K_,J_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:B_}));J_.displayName=`MagnifyingGlassIcon`;var Y_=J_,X_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:V_}));X_.displayName=`MoonIcon`;var Z_=X_,Q_=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:H_}));Q_.displayName=`PencilSimpleIcon`;var $_=Q_,ev=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:U_}));ev.displayName=`PlugsConnectedIcon`;var tv=ev,nv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:W_}));nv.displayName=`SignOutIcon`;var rv=nv,iv=w.forwardRef((e,t)=>w.createElement(x,{ref:t,...e,weights:G_}));iv.displayName=`SunIcon`;var av=iv,ov={home:`https://fanout.run/start/what-fanout-is`,ingest:`https://fanout.run/start/send-telemetry`};async function sv(e,t){let n=new URLSearchParams({limit:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await De(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function cv({agentAvailable:e,activeThreadID:t,activeDashboardID:n,autoFocusSearch:r=!1,onNewChat:i,onSelectThread:a,onDeletedThread:o,onSelectDashboard:s,onCreateDashboard:c,onInvestigateService:l,ref:u}){let d=nn(),[f,p]=(0,w.useState)(``),[m]=fa(f.trim(),250),[h,g]=(0,w.useState)(null),[_,v]=(0,w.useState)(null),[b,x]=(0,w.useState)(``),[ee,ne]=(0,w.useState)(``),[S,ie]=(0,w.useState)(!1),oe=(0,w.useRef)(null);(0,w.useImperativeHandle)(u,()=>({focusSearch:()=>oe.current?.focus()}),[]),(0,w.useEffect)(()=>{r&&requestAnimationFrame(()=>oe.current?.focus())},[r]);let se=R_({queryKey:[...Cn,m],queryFn:({pageParam:e})=>sv(m,e),initialPageParam:``,getNextPageParam:e=>e.nextCursor||void 0,enabled:e}),le=hn({queryKey:wn,queryFn:()=>bn(`/api/dashboards`),refetchInterval:3e4,staleTime:bt}),ue=(0,w.useMemo)(()=>se.data?.pages.flatMap(e=>e.threads)??[],[se.data]),de=(0,w.useMemo)(()=>mv(ue),[ue]),fe=pt(`overview`,it({window:`1h`,namespace:``}),!!m&&!!l),pe=(0,w.useMemo)(()=>{if(!m)return[];let e=m.toLowerCase();return(fe.data?.data.services??[]).map(e=>e.service).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[fe.data,m]),me=(0,w.useMemo)(()=>{let e=le.data?.dashboards??[],t=m.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[le.data,m]);function he(e){ne(``),x(e.title),g(e)}async function _e(){if(h&&b.trim()){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(h.threadId)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:b.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await d.invalidateQueries({queryKey:Cn}),g(null)}catch(e){ne(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{ie(!1)}}}async function ve(){if(_){ie(!0),ne(``);try{let e=await De(`/api/agent/threads/${encodeURIComponent(_.threadId)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=_.threadId;v(null),await d.invalidateQueries({queryKey:Cn}),o(t)}catch(e){ne(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{ie(!1)}}}return(0,T.jsxs)(ge,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[e&&(0,T.jsx)(ye,{leftSection:(0,T.jsx)(Xe,{size:16,weight:`bold`}),onClick:i,children:`New chat`}),(0,T.jsx)(Vt,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,T.jsxs)(ge,{gap:`lg`,pb:`sm`,children:[e&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(lv,{children:`Chats`}),se.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),se.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Chats could not be loaded.`}),!se.isLoading&&!se.isError&&ue.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:m?`No matching chats`:`No chats yet`}),de.map(e=>(0,T.jsxs)(ge,{gap:2,children:[de.length>1&&(0,T.jsx)(re,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,T.jsx)(uv,{thread:e,active:e.threadId===t,onSelect:()=>a(e.threadId),onRename:()=>he(e),onDelete:()=>{ne(``),v(e)}},e.threadId))]},e.label)),se.hasNextPage&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:se.isFetchingNextPage,onClick:()=>void se.fetchNextPage(),children:`See all`})]}),pe.length>0&&l&&(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(lv,{children:`Services`}),pe.map(e=>(0,T.jsx)(te,{className:`rail-row`,p:`sm`,onClick:()=>l(e),children:(0,T.jsx)(re,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,T.jsxs)(ge,{gap:4,children:[(0,T.jsx)(lv,{children:`Dashboards`}),le.isLoading&&(0,T.jsx)(C,{py:`md`,children:(0,T.jsx)(y,{size:`xs`})}),le.isError&&(0,T.jsx)(ae,{color:`bad`,radius:`md`,p:`xs`,children:`Dashboards could not be loaded.`}),!le.isLoading&&!le.isError&&m&&me.length===0&&(0,T.jsx)(re,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:`No matching dashboards`}),me.map(e=>{let t=e.id===n;return(0,T.jsx)(te,{className:`rail-row`,"data-active":t||void 0,"aria-current":t?`page`:void 0,p:`sm`,onClick:()=>s(e.id),children:(0,T.jsxs)(ce,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.name}),e.is_default&&(0,T.jsx)(Ze,{size:`xs`,variant:`light`,color:`gray`,children:`Default`})]})},e.id)}),e&&(0,T.jsx)(ye,{variant:`subtle`,color:`gray`,size:`compact-sm`,justify:`flex-start`,leftSection:(0,T.jsx)(It,{size:14,weight:`fill`}),onClick:c,children:`Create with AI`})]})]})}),(0,T.jsx)(Ae,{ref:oe,value:f,onChange:e=>p(e.currentTarget.value),leftSection:(0,T.jsx)(Y_,{size:15}),rightSection:(0,T.jsx)(Ro,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,T.jsx)(_n,{opened:h!==null,onClose:()=>!S&&g(null),title:`Rename chat`,centered:!0,children:(0,T.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),_e()},children:(0,T.jsxs)(ge,{children:[(0,T.jsx)(Ae,{label:`Name`,value:b,onChange:e=>x(e.currentTarget.value),maxLength:120,autoFocus:!0}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>g(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{type:`submit`,loading:S,disabled:!b.trim(),children:`Save`})]})]})})}),(0,T.jsx)(_n,{opened:_!==null,onClose:()=>!S&&v(null),title:`Delete chat?`,centered:!0,children:(0,T.jsxs)(ge,{children:[(0,T.jsxs)(re,{size:`sm`,children:[`This permanently removes `,(0,T.jsx)(re,{span:!0,fw:650,children:_?.title}),` and its saved messages.`]}),ee&&(0,T.jsx)(ae,{color:`bad`,children:ee}),(0,T.jsxs)(ce,{justify:`flex-end`,children:[(0,T.jsx)(ye,{variant:`default`,onClick:()=>v(null),disabled:S,children:`Cancel`}),(0,T.jsx)(ye,{color:`bad`,loading:S,onClick:()=>void ve(),children:`Delete`})]})]})})]})}function lv({children:e}){return(0,T.jsx)(re,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function uv({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,T.jsx)(xe,{"data-active":t||void 0,className:`rail-row`,children:(0,T.jsxs)(ce,{gap:2,wrap:`nowrap`,children:[(0,T.jsx)(te,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,T.jsxs)(ge,{gap:0,children:[(0,T.jsx)(re,{size:`sm`,fw:t?600:500,truncate:!0,children:e.title}),(0,T.jsx)(re,{c:`dimmed`,size:`xs`,children:hv(e.updatedAt)})]})}),(0,T.jsxs)(Ft,{position:`bottom-end`,withinPortal:!0,children:[(0,T.jsx)(Ft.Target,{children:(0,T.jsx)(Mn,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,T.jsx)(Le,{size:18,weight:`bold`})})}),(0,T.jsxs)(Ft.Dropdown,{children:[(0,T.jsx)(Ft.Item,{leftSection:(0,T.jsx)($_,{size:15}),onClick:r,children:`Rename`}),(0,T.jsx)(Ft.Item,{color:`bad`,leftSection:(0,T.jsx)(st,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function dv(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function fv(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var pv=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function mv(e){let t=fv(new Date),n=new Map;for(let r of e){let e=Math.floor((t-fv(dv(r.updatedAt)))/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 pv.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function hv(e){let t=dv(e),n=fv(new Date);return Math.floor((n-fv(t))/864e5)<=1?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t):new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function gv({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=kn(),s=Ne(),c=da({select:e=>e.location.pathname}),{dashboardId:l}=We({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=pa(!1),[p,m]=(0,w.useState)(!1),[h,g]=(0,w.useState)(``),_=(0,w.useRef)(null),v=he(`(max-width: 62em)`),y=(0,w.useRef)(v);y.current=v,(0,w.useEffect)(()=>{f.close()},[c]),(0,w.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),y.current?(m(!0),f.open()):_.current?.focusSearch())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let b={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e}}),onCreateDashboard:()=>o(An),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)};return(0,T.jsxs)(to,{header:{height:52},navbar:{width:256,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,T.jsx)(to.Header,{children:(0,T.jsxs)(ce,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,T.jsxs)(ce,{gap:`sm`,wrap:`nowrap`,children:[(0,T.jsx)(go,{hiddenFrom:`md`,opened:d,onClick:()=>{m(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,T.jsx)(ve,{size:`small`})]}),(0,T.jsxs)(ce,{gap:`xs`,wrap:`nowrap`,children:[(0,T.jsx)(Ht,{label:`Documentation`,children:(0,T.jsx)(Mn,{component:`a`,href:ov.home,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,"aria-label":`Documentation`,children:(0,T.jsx)(q_,{size:17,weight:`bold`})})}),(0,T.jsx)(_v,{}),(0,T.jsx)(vv,{onError:g})]})]})}),(0,T.jsx)(to.Navbar,{p:`sm`,children:(0,T.jsx)(cv,{ref:_,...b})}),(0,T.jsx)(Fo,{opened:d,onClose:f.close,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,T.jsx)(ve,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,T.jsx)(cv,{...b,autoFocusSearch:d&&p})}),(0,T.jsxs)(to.Main,{children:[h&&(0,T.jsx)(ae,{color:`bad`,m:`md`,withCloseButton:!0,onClose:()=>g(``),children:h}),e]})]})}function _v(){let{setColorScheme:e}=Wt(),t=Gt(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`,[r,i]=(0,w.useState)(!1);return(0,T.jsx)(Ht,{label:`Switch to ${n} theme`,opened:r,children:(0,T.jsx)(Mn,{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,T.jsx)(av,{size:17,weight:`bold`}):(0,T.jsx)(Z_,{size:17,weight:`bold`})})})}function vv({onError:e}){let t=Ne(),n=je(),r=(n.name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,T.jsxs)(Ft,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,T.jsx)(Ft.Target,{children:(0,T.jsx)(Mn,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`Account menu`,children:(0,T.jsx)(po,{size:26,radius:`xl`,color:`brand`,children:r})})}),(0,T.jsxs)(Ft.Dropdown,{children:[(0,T.jsx)(Ft.Label,{children:n.email||`Signed in`}),(0,T.jsx)(Ft.Item,{leftSection:(0,T.jsx)(tv,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,T.jsx)(Ft.Divider,{}),(0,T.jsx)(Ft.Item,{leftSection:(0,T.jsx)(rv,{size:15}),onClick:()=>void Ce().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function yv(){let{agent_available:e}=ke(),t=Ne(),n=nn(),{threadId:r}=We({strict:!1}),[i,a]=(0,w.useState)(Lt),o=(0,w.useRef)(new Set),s=r??i,[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)({}),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(``),[b,x]=(0,w.useState)(``),[ee,te]=(0,w.useState)(``),[ne,re]=(0,w.useState)(0),S=(0,w.useRef)(``),ie=(0,w.useRef)(null),ae=(0,w.useRef)(0),oe=(0,w.useMemo)(()=>new M_({url:`/api/agent`,threadId:s,fetch:(e,t)=>De(e,t)}),[s]),se=!e||f===s;function ce(){ae.current=0,y(``)}(0,w.useEffect)(()=>{let t=!0;if(l([]),d({}),p(``),h(!1),_(!1),ce(),te(``),!e){p(s);return}!r||o.current.has(s)?(oe.setMessages([]),p(s)):De(`/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}oe.setMessages(e.messages??[]),l([...e.messages??[]]),p(s)}}).catch(()=>{t&&(S.current=``,te(`This chat could not be restored. Start a new chat or try again.`))});let i=oe.subscribe({onEvent:({messages:e})=>l([...e]),onRunInitialized:()=>{_(!0),te(``)},onToolCallStartEvent:({event:e})=>{ae.current+=1,y(Nn(e.toolCallName))},onToolCallEndEvent:()=>{ae.current=Math.max(0,ae.current-1),ae.current===0&&y(``)},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),ce(),o.current.delete(s),n.invalidateQueries({queryKey:Cn})},onRunFailed:e=>{console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),ce(),o.current.delete(s),n.invalidateQueries({queryKey:Cn})}});return()=>{t=!1,i.unsubscribe(),oe.abortRun()}},[oe,e,n,ne,s]),(0,w.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(()=>ie.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>ie.current?.focus()))),e.key===`Escape`&&n===ie.current&&(x(``),ie.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function le(){_(!0),te(``);try{await oe.runAgent()}catch(e){console.error(`Agent run failed`,e),te(`Fanout could not complete this analysis.`),_(!1),ce(),o.current.delete(s)}}async function ue(n){let i=n.trim();if(!e||!i||g||!se||m)return;r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let a={id:Lt(),role:`user`,content:i};oe.addMessage(a),l([...oe.messages]),d(e=>({...e,[a.id]:Date.now()})),x(``),await le()}(0,w.useEffect)(()=>{let e=S.current;se&&r&&e&&(S.current=``,ue(e))},[se,r,s]);function de(e){e.preventDefault(),ue(b)}function C(){oe.abortRun(),_(!1),ce(),o.current.delete(s)}function fe(){!g&&oe.messages.some(e=>e.role===`user`)&&le()}function pe(n){if(!e)return;let r=Lt();o.current.add(r),S.current=n??``,t({to:`/chat/$threadId`,params:{threadId:r}})}function me(){oe.abortRun(),S.current=``,a(Lt()),t({to:`/chat`})}function he(e){t({to:`/chat/$threadId`,params:{threadId:e}})}function ge(){re(e=>e+1)}return(0,T.jsx)(jn.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:se,running:g,activity:v,input:b,setInput:x,error:ee,inputRef:ie,send:ue,submit:de,stop:C,retry:fe,reloadThread:ge,openChat:pe,newThread:me,selectThread:he},children:(0,T.jsx)(gv,{children:(0,T.jsx)(ta,{})})})}function bv(){let e=(0,w.useMemo)(()=>new L_,[]);return(0,T.jsx)(Jt,{client:e,children:(0,T.jsx)(Me,{children:(0,T.jsx)(yv,{})})})}var xv=Ve({component:bv,notFoundComponent:()=>(0,T.jsx)(Oe,{to:`/`,replace:!0})}),Sv=Re(`/`)({component:qe(()=>Pn(()=>import(`./routes-VCBnBbPZ.js`),__vite__mapDeps([0,1,2])),`component`)}),Cv=Re(`/settings`)({component:qe(()=>Pn(()=>import(`./settings-DTge_r9J.js`),__vite__mapDeps([3,1,2,4,5,6])),`component`)}),wv=Re(`/chat/`)({component:qe(()=>Pn(()=>import(`./chat.index-DYB6vKSb.js`),__vite__mapDeps([7,8,1,4,9,10])),`component`)}),Tv=Re(`/chat/$threadId`)({component:qe(()=>Pn(()=>import(`./chat._threadId-DYB6vKSb.js`),__vite__mapDeps([11,8,1,4,9,10])),`component`)}),Ev=Re(`/dashboards/`)({component:qe(()=>Pn(()=>import(`./dashboards.index-CsiRflF3.js`),__vite__mapDeps([12,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:lt}),Dv=Re(`/dashboards/$dashboardId`)({component:qe(()=>Pn(()=>import(`./dashboards._dashboardId-DzFNKi-i.js`),__vite__mapDeps([16,1,2,13,14,4,15,5,9,10,6])),`component`),validateSearch:lt}),Ov=Sv.update({id:`/`,path:`/`,getParentRoute:()=>xv}),kv=Cv.update({id:`/settings`,path:`/settings`,getParentRoute:()=>xv}),Av=wv.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>xv}),jv=Tv.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>xv}),Mv=Ev.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>xv}),Nv={IndexRoute:Ov,SettingsRoute:kv,ChatThreadIdRoute:jv,DashboardsDashboardIdRoute:Dv.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>xv}),ChatIndexRoute:Av,DashboardsIndexRoute:Mv},Pv=sa({routeTree:xv._addFileChildren(Nv)._addFileTypes(),defaultPreload:`intent`,scrollRestoration:!0}),Fv={brand:Dt,ok:kt,warn:Nt,bad:xt,info:Ct},Iv={light:7,dark:5};function Lv(e){let t=e.replace(`#`,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=e=>{let t=parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(2)+.0722*r(4)}function Rv(e){let t=Lv(e),n=1.05/(t+.05);return(t+.05)/.05>n?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function zv(e){return Object.fromEntries(Object.entries(Fv).map(([t,n])=>[`--fanout-color-${t}-contrast`,Rv(n[Iv[e]])]))}function Bv(e){return t=>{let n=t.color??Uv.primaryColor,r=e({...t,color:n}),i=t.variant===`filled`||t.variant===void 0;return t.autoContrast===!1||!i||!Object.hasOwn(Fv,n)?r:{...r,color:`var(--fanout-color-${n}-contrast)`}}}var Vv=.25,Hv={xs:9,sm:10,md:11,lg:13,xl:16},Uv={primaryColor:`brand`,primaryShade:Iv,autoContrast:!0,luminanceThreshold:Vv,colors:{dark:jt,brand:Dt,ok:kt,warn:Nt,bad:xt,info:Ct},defaultRadius:`md`,fontFamily:at.body,fontFamilyMonospace:at.display,headings:{fontFamily:at.body,fontWeight:`600`},cursorType:`pointer`,components:{Tabs:{styles:(e,t)=>({tab:Kv(t.color,`--tabs-text-color`)})},Pagination:{styles:(e,t)=>({control:Kv(t.color,`--pagination-active-color`)})},Badge:{vars:(e,t)=>({root:Gv(t.size)})}}},Wv=()=>({variables:{"--mantine-color-error":`var(--mantine-color-bad-filled)`},light:{"--mantine-color-dimmed":mt.light.muted,...zv(`light`)},dark:zv(`dark`)});function Gv(e){let t=Hv[e??`md`];return t===void 0||t>=vt.micro?{}:{"--badge-fz":`${vt.micro/16}rem`}}function Kv(e,t){return!e||e===Uv.primaryColor?{[t]:`var(--fanout-color-${Uv.primaryColor}-contrast)`}:{}}var qv=Bv(h),Jv=ja({...Uv,variantColorResolver:qv});(0,Ac.createRoot)(document.getElementById(`root`)).render((0,T.jsx)(w.StrictMode,{children:(0,T.jsx)(Aa,{theme:Jv,defaultColorScheme:`auto`,cssVariablesResolver:Wv,children:(0,T.jsx)(ua,{router:Pv})})}));export{Ev as n,ov as r,Dv as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/settings-BTUR4pT4.js b/internal/ui/dist/assets/settings-DTge_r9J.js similarity index 97% rename from internal/ui/dist/assets/settings-BTUR4pT4.js rename to internal/ui/dist/assets/settings-DTge_r9J.js index 37cee591e..8c5c63f83 100644 --- a/internal/ui/dist/assets/settings-BTUR4pT4.js +++ b/internal/ui/dist/assets/settings-DTge_r9J.js @@ -1,10 +1,10 @@ -import{S as e,St as t,Y as n,_ as r,a as i,d as a,f as o,gt as s,h as c,i as l,j as u,mt as d,o as f,r as p,s as m,u as h,x as g,y as _}from"./brand-MzZ03bSa.js";import{i as v,r as y,s as b}from"./auth-B1VNekWU.js";import{t as x}from"./Tooltip-BJiO7C_G.js";import{O as S,i as C,k as w,n as T}from"./api-CB7Xlqes.js";import{n as E,t as D}from"./WarningCircle.es-BrGtHGYK.js";import{r as O}from"./index-BHeU96Kj.js";var k=t(s(),1);function A(e={}){let t=e.timeout??2e3,[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(!1),o=(0,k.useRef)(null);(0,k.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]);let s=e=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>a(!1),t),a(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),s(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{a(!1),r(null),window.clearTimeout(o.current)},error:n,copied:i}}var j={root:`m_849cf0da`},M=d(),N={underline:`hover`},P=e(e=>{let{underline:t,className:r,unstyled:i,mod:o,...s}=u(`Anchor`,N,e);return(0,M.jsx)(a,{component:`a`,className:n({[j.root]:!i},r),...s,mod:[{underline:t},o],__staticSelector:`Anchor`,unstyled:i})});P.classes=j,P.displayName=`@mantine/core/Anchor`;var F={timeout:1e3};function I(e){let{children:t,timeout:n,value:r,...i}=u(`CopyButton`,F,e),a=A({timeout:n});return(0,M.jsx)(M.Fragment,{children:t({copy:()=>a.copy(r),copied:a.copied,...i})})}I.displayName=`@mantine/core/CopyButton`;var L=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),R=k.forwardRef((e,t)=>k.createElement(i,{ref:t,...e,weights:L}));R.displayName=`ArrowsClockwiseIcon`;var z=R,B=[`settings`,`ingest`];function V(e,t){let n=e.trim();return t||/^https:\/\//i.test(n)||/:443$/.test(n)}function H(e,t,n){return`exporters: +import{S as e,St as t,Y as n,_ as r,a as i,d as a,f as o,gt as s,h as c,i as l,j as u,mt as d,o as f,r as p,s as m,u as h,x as g,y as _}from"./brand-MzZ03bSa.js";import{i as v,r as y,s as b}from"./auth-B1VNekWU.js";import{t as x}from"./Tooltip-BJiO7C_G.js";import{O as S,i as C,k as w,n as T}from"./api-CB7Xlqes.js";import{n as E,t as D}from"./WarningCircle.es-BrGtHGYK.js";import{r as O}from"./index-CbsicD3g.js";var k=t(s(),1);function A(e={}){let t=e.timeout??2e3,[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(!1),o=(0,k.useRef)(null);(0,k.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]);let s=e=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>a(!1),t),a(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),s(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{a(!1),r(null),window.clearTimeout(o.current)},error:n,copied:i}}var j={root:`m_849cf0da`},M=d(),N={underline:`hover`},P=e(e=>{let{underline:t,className:r,unstyled:i,mod:o,...s}=u(`Anchor`,N,e);return(0,M.jsx)(a,{component:`a`,className:n({[j.root]:!i},r),...s,mod:[{underline:t},o],__staticSelector:`Anchor`,unstyled:i})});P.classes=j,P.displayName=`@mantine/core/Anchor`;var F={timeout:1e3};function I(e){let{children:t,timeout:n,value:r,...i}=u(`CopyButton`,F,e),a=A({timeout:n});return(0,M.jsx)(M.Fragment,{children:t({copy:()=>a.copy(r),copied:a.copied,...i})})}I.displayName=`@mantine/core/CopyButton`;var L=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),R=k.forwardRef((e,t)=>k.createElement(i,{ref:t,...e,weights:L}));R.displayName=`ArrowsClockwiseIcon`;var z=R,B=[`settings`,`ingest`];function V(e,t){let n=e.trim();return t||/^https:\/\//i.test(n)||/:443$/.test(n)}function H(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=V(e,n)?``:` + tls: + insecure: true`;return`exporters: otlp/fanout: endpoint: "${e}" headers: - ${t}: "Bearer \${env:INGEST_TOKEN}"${V(e,n)?``:` - tls: - insecure: true`} + ${t}: "Bearer \${env:INGEST_TOKEN}"${r} service: pipelines: diff --git a/internal/ui/dist/index.html b/internal/ui/dist/index.html index e439e77ed..f297d41d9 100644 --- a/internal/ui/dist/index.html +++ b/internal/ui/dist/index.html @@ -21,7 +21,7 @@ document.documentElement.setAttribute("data-mantine-color-scheme", computed); } catch (e) {} - + diff --git a/ui/host/src/settings.test.tsx b/ui/host/src/settings.test.tsx index 26ad8d433..c841631bc 100644 --- a/ui/host/src/settings.test.tsx +++ b/ui/host/src/settings.test.tsx @@ -89,6 +89,25 @@ describe("connect telemetry", () => { await act(async () => root.unmount()); }); + it.each([ + ["https://ingest.example.com", "https://ingest.example.com:443", false], + ["http://ingest.example.com", "http://ingest.example.com:80", true], + ["https://ingest.example.com:443/", "https://ingest.example.com:443", false], + ["https://ingest.example.com:7520", "https://ingest.example.com:7520", false], + ["http://localhost:7520", "http://localhost:7520", true], + ["https://[2001:db8::1]/", "https://[2001:db8::1]:443", false], + ["http://[::1]:7520", "http://[::1]:7520", true], + ["[::1]:7520", "[::1]:7520", true], + ])("generates a Collector endpoint with an explicit port for %s", async (endpoint, expected, insecure) => { + fetchMock.mockImplementation(async () => json({ ...connection, suggested_endpoint: endpoint })); + const root = await mount(); + await vi.waitFor(() => expect(document.body.textContent).toContain("Collector configuration")); + const config = document.body.textContent ?? ""; + expect(config).toContain(`endpoint: "${expected}"`); + expect(config.includes("insecure: true")).toBe(insecure); + await act(async () => root.unmount()); + }); + it("treats an endpoint on port 443 as TLS even without a scheme", async () => { // An operator naming a TLS-terminating proxy usually writes the port and // not the scheme, and tls.insecure against it fails with a gRPC error that diff --git a/ui/host/src/settings.tsx b/ui/host/src/settings.tsx index aaf589d5d..e7de49bda 100644 --- a/ui/host/src/settings.tsx +++ b/ui/host/src/settings.tsx @@ -38,6 +38,16 @@ function overTLS(endpoint: string, tlsConfigured: boolean) { * documentation and the README both use — the braced form alone is ambiguous * where a distribution sets its own default config scheme. */ function collectorConfig(endpoint: string, header: string, tlsConfigured: boolean) { + // Collector's gRPC exporter requires an explicit port even with an HTTP(S) + // scheme. Keep the scheme so its TLS semantics survive normalization. + if (/^https?:\/\//i.test(endpoint.trim())) { + try { + const url = new URL(endpoint); + endpoint = `${url.protocol}//${url.hostname}:${url.port || (url.protocol === "https:" ? "443" : "80")}`; + } catch { + // Leave an invalid advertised override visible without breaking the page. + } + } const insecure = overTLS(endpoint, tlsConfigured) ? "" : "\n tls:\n insecure: true"; return `exporters: otlp/fanout: