diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2422f58..81fe7ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,7 +83,7 @@ jobs: - name: Install Go toolchain uses: actions/setup-go@v7 with: - go-version-file: go/go.work + go-version-file: go.work cache-dependency-path: "**/go.sum" - name: Install pnpm diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 282b464..6b67be4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,7 +48,7 @@ jobs: - name: Install Go toolchain uses: actions/setup-go@v7 with: - go-version-file: go/go.work + go-version-file: go.work cache-dependency-path: "**/go.sum" - name: Install GoReleaser diff --git a/Cargo.lock b/Cargo.lock index 328200b..04fb1eb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -79,6 +79,23 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" +[[package]] +name = "antlr4rust" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "093d520274bfff7278d776f7ea12981a0a0a6f96db90964658e0f38fc6e9a6a6" +dependencies = [ + "better_any", + "bit-set", + "byteorder", + "lazy_static", + "murmur3", + "once_cell", + "parking_lot", + "typed-arena", + "uuid", +] + [[package]] name = "anyhow" version = "1.0.104" @@ -184,6 +201,27 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "better_any" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4372b9543397a4b86050cc5e7ee36953edf4bac9518e8a774c2da694977fb6e4" + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + [[package]] name = "bitflags" version = "2.13.1" @@ -253,6 +291,22 @@ dependencies = [ "shlex", ] +[[package]] +name = "cel" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f93082a93da8fd78394852602ced1e2e7754ed8c29dc813fa80b01a1baf9032" +dependencies = [ + "antlr4rust", + "chrono", + "lazy_static", + "nom", + "pastey", + "regex", + "serde", + "thiserror 2.0.20", +] + [[package]] name = "cfg-if" version = "1.0.4" @@ -278,6 +332,7 @@ checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" dependencies = [ "iana-time-zone", "num-traits", + "serde", "windows-link", ] @@ -916,6 +971,7 @@ dependencies = [ "headgate-postgres", "headgate-redis", "headgate-ui", + "headgate-workflow", "http-body-util", "serde", "serde_json", @@ -1090,10 +1146,15 @@ dependencies = [ name = "headgate-workflow" version = "0.1.7" dependencies = [ + "cel", "futures-util", "headgate", "headgate-core", + "headgate-mysql", "headgate-postgres", + "headgate-redis", + "headgate-testkit", + "redis", "serde", "serde_json", "tokio", @@ -1533,6 +1594,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -1554,6 +1621,15 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "murmur3" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a198f9589efc03f544388dfc4a19fe8af4323662b62f598b8dcfdac62c14771c" +dependencies = [ + "byteorder", +] + [[package]] name = "mysql_async" version = "0.35.1" @@ -1614,6 +1690,16 @@ dependencies = [ "zstd", ] +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "num-bigint" version = "0.4.8" @@ -1742,6 +1828,12 @@ dependencies = [ "windows-link", ] +[[package]] +name = "pastey" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4" + [[package]] name = "pem" version = "3.0.6" @@ -2645,6 +2737,12 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8464ec13c3691491391d9fce00f6416c9a48e46972f72d7865688be2080192c9" +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + [[package]] name = "typenum" version = "1.20.1" diff --git a/Cargo.toml b/Cargo.toml index 92125ea..c901e36 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,3 +30,4 @@ headgate-sql = { version = "0.1.7", path = "crates/headgate-sql" } headgate-testkit = { version = "0.1.7", path = "crates/headgate-testkit" } headgate-ui = { version = "0.1.7", path = "crates/headgate-ui" } headgate-otel = { version = "0.1.7", path = "crates/headgate-otel" } +headgate-workflow = { version = "0.1.7", path = "crates/headgate-workflow" } diff --git a/api/headgate.openapi.yaml b/api/headgate.openapi.yaml index e105afa..59e24ba 100644 --- a/api/headgate.openapi.yaml +++ b/api/headgate.openapi.yaml @@ -803,6 +803,193 @@ paths: reason: {type: string, maxLength: 64} recorded_at_ms: {type: integer} + /workflows: + get: + summary: List workflow coordinators without loading their graphs + parameters: + - {$ref: '#/components/parameters/ControlLimit'} + - {name: cursor, in: query, schema: {type: string}} + responses: + '200': + description: Bounded workflow page. + content: + application/json: + schema: + type: object + required: [workflows, next_cursor] + properties: + workflows: {type: array, maxItems: 200, items: {$ref: '#/components/schemas/WorkflowSummary'}} + next_cursor: {type: [string, "null"]} + /workflows/{id}: + get: + summary: Inspect a workflow's accepted graph and live execution state + description: Returns the base graph plus accepted additive grafts. Task payloads are never returned. + parameters: [{$ref: '#/components/parameters/Id'}] + responses: + '200': + description: Bounded workflow graph snapshot. + content: {application/json: {schema: {$ref: '#/components/schemas/WorkflowSnapshot'}}} + '404': {description: Workflow not found} + /workflows/{id}/events: + get: + summary: Read bounded durable workflow history + parameters: [{$ref: '#/components/parameters/Id'}] + responses: {'200': {description: At most 256 ordered events from the fenced coordinator checkpoint.}, '404': {description: Workflow not found}} + /workflows/{id}/nodes/{node}: + get: + summary: Inspect one workflow node + parameters: + - {$ref: '#/components/parameters/Id'} + - {name: node, in: path, required: true, schema: {type: string}} + responses: + '200': {description: Node topology and live job state, content: {application/json: {schema: {$ref: '#/components/schemas/WorkflowNode'}}}} + '404': {description: Workflow or node not found} + /workflows/{id}/nodes/{node}/dependencies: + get: + summary: List a workflow node's immediate prerequisites + parameters: + - {$ref: '#/components/parameters/Id'} + - {name: node, in: path, required: true, schema: {type: string}} + responses: + '200': + description: Immediate dependency nodes. + content: + application/json: + schema: + type: object + required: [dependencies] + properties: {dependencies: {type: array, items: {$ref: '#/components/schemas/WorkflowNode'}}} + '404': {description: Workflow or node not found} + /workflows/{id}/nodes/{node}/dependents: + get: + summary: List nodes that immediately depend on a workflow node + parameters: + - {$ref: '#/components/parameters/Id'} + - {name: node, in: path, required: true, schema: {type: string}} + responses: + '200': + description: Immediate dependent nodes. + content: + application/json: + schema: + type: object + required: [dependents] + properties: {dependents: {type: array, items: {$ref: '#/components/schemas/WorkflowNode'}}} + '404': {description: Workflow or node not found} + /workflows/{id}/signals: + get: + summary: List bounded durable workflow signal history + parameters: + - {$ref: '#/components/parameters/Id'} + - {$ref: '#/components/parameters/ControlLimit'} + - {name: cursor, in: query, schema: {type: integer, minimum: 1}} + responses: + '200': + description: Newest-first signal emissions, at most 100 retained per workflow. + content: + application/json: + schema: + type: object + required: [signals, next_cursor] + properties: + signals: {type: array, maxItems: 100, items: {$ref: '#/components/schemas/WorkflowSignal'}} + next_cursor: {type: [integer, "null"]} + post: + summary: Emit a durable buffered workflow signal + parameters: [{$ref: '#/components/parameters/Id'}, {$ref: '#/components/parameters/IdempotencyKey'}] + requestBody: + required: true + content: + application/json: + schema: + type: object + required: [signal] + properties: + signal: {type: string, minLength: 1} + payload: {description: Arbitrary JSON value delivered with the signal.} + source: {description: Caller-supplied JSON describing the emitter or calling system; authenticate and populate it at a trusted upstream boundary.} + responses: + '200': + description: Idempotent signal receipt including the original durable emission. + content: + application/json: + schema: + type: object + required: [matched, promoted, inserted, emission] + properties: + matched: {type: integer, minimum: 1} + promoted: {type: integer, minimum: 0} + inserted: {type: boolean, description: False when this idempotency key replayed an existing emission.} + emission: {$ref: '#/components/schemas/WorkflowSignal'} + /workflows/{id}/grafts: + post: + summary: Atomically submit a revision-checked additive graph graft + parameters: [{$ref: '#/components/parameters/Id'}, {$ref: '#/components/parameters/IdempotencyKey'}] + requestBody: + required: true + content: + application/json: + schema: + type: object + required: [expected_revision, tasks] + properties: + expected_revision: {type: integer, minimum: 1} + queue: {type: string} + tasks: + type: array + minItems: 1 + maxItems: 999 + items: + type: object + required: [name, kind, payload] + properties: + name: {type: string, minLength: 1, maxLength: 128} + deps: {type: array, items: {type: string}} + id: {type: string} + kind: {type: string, minLength: 1} + payload: {type: string, contentEncoding: base64} + queue: {type: string} + schema_version: {type: integer, minimum: 1} + responses: {'202': {description: Graft receipt and task batch accepted atomically}, '409': {description: Revision conflict}} + /workflows/{id}/retry: + post: + summary: Retry only a workflow's failed subgraph + parameters: [{$ref: '#/components/parameters/Id'}, {$ref: '#/components/parameters/IdempotencyKey'}] + requestBody: + required: true + content: + application/json: + schema: + type: object + required: [expected_revision] + properties: + expected_revision: {type: integer, minimum: 1} + recoveries: + type: array + maxItems: 999 + description: Explicit repair instructions for failed nodes that cannot be retried as-is. + items: + type: object + required: [node] + properties: + node: {type: string, minLength: 1, maxLength: 128} + payload: {type: string, contentEncoding: base64, description: Required when repairing an undecodable node.} + schema_version: {type: integer, minimum: 1, description: Required when repairing an undecodable node.} + release_quarantine: {type: boolean, default: false, description: Must be true to release a quarantined fingerprint.} + responses: {'200': {description: Accepted revision and generation}, '409': {description: Revision conflict}} + /workflows/{id}/cancel: + post: + summary: Cancel active workflow work and optionally linked children + parameters: [{$ref: '#/components/parameters/Id'}, {$ref: '#/components/parameters/IdempotencyKey'}] + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: {propagate_children: {type: boolean, default: true}} + responses: {'200': {description: Bounded cancellation receipt}} + /healthz: get: summary: Liveness. Never touches the store. @@ -836,6 +1023,61 @@ components: POST, must not enqueue the job twice. Keys are retained long enough to cover a client retry window and the response is replayed verbatim. schemas: + WorkflowSummary: + type: object + required: [workflow_id, coordinator_job_id, state, enqueued_at_ms, scheduled_at_ms] + properties: + workflow_id: {type: string} + coordinator_job_id: {type: string} + state: {type: string} + enqueued_at_ms: {type: integer} + scheduled_at_ms: {type: integer} + finalized_at_ms: {type: integer} + WorkflowNode: + type: object + required: [name, job_id, kind, job_kind, state, dependencies, dependents] + properties: + name: {type: string} + job_id: {type: string} + kind: {type: string, enum: [task, signal, timer, child_workflow, condition]} + job_kind: {type: string} + state: {type: string, description: May be `missing` when retention removed an unfinished node before inspection.} + dependencies: {type: array, items: {type: string}} + dependents: {type: array, items: {type: string}} + signal: {type: string} + wake_at_ms: {type: integer} + delay_ms: {type: integer} + child_workflow_id: {type: string} + condition: {type: string} + completed_at_ms: {type: integer} + WorkflowSnapshot: + type: object + required: [workflow_id, coordinator_job_id, coordinator_state, revision, generation, failed, failed_subgraph_retry, nodes] + properties: + workflow_id: {type: string} + coordinator_job_id: {type: string} + coordinator_state: {type: string} + revision: {type: integer, minimum: 1} + generation: {type: integer, minimum: 1} + failed: {type: boolean} + failed_subgraph_retry: {type: boolean} + retry_policy: + type: object + required: [max_generations, backoff_ms] + properties: + max_generations: {type: integer, minimum: 1} + backoff_ms: {type: integer, minimum: 1} + nodes: {type: array, maxItems: 999, items: {$ref: '#/components/schemas/WorkflowNode'}} + WorkflowSignal: + type: object + required: [id, signal, idempotency_key, payload, source, recorded_at_ms] + properties: + id: {type: integer, minimum: 1} + signal: {type: string} + idempotency_key: {type: string} + payload: {description: Arbitrary JSON value supplied by the emitter, limited to 64 KiB after canonical serialization.} + source: {description: Caller-supplied JSON describing the emitter or calling system, limited to 16 KiB; it is not proof of identity by itself.} + recorded_at_ms: {type: integer, description: Timestamp assigned by the backing store.} State: type: string enum: [pending, scheduled, available, running, retryable, completed, archived, cancelled, quarantined, undecodable] diff --git a/conformance/CAPABILITY_REGISTER.md b/conformance/CAPABILITY_REGISTER.md index 3e58eed..e5492ce 100644 --- a/conformance/CAPABILITY_REGISTER.md +++ b/conformance/CAPABILITY_REGISTER.md @@ -120,7 +120,14 @@ not think to name. | Long-running task tracking | ✅ | **Round 32ab: futures/goroutines explicitly attached inside a handler are now owned by that attempt rather than detached from it.** Rust exposes `JobCtx::spawn_tracked` over an attempt-owned `JoinSet`; Go exposes `Track(ctx, func(context.Context) error)` over a context-bound, race-safe task group. Handler success closes registration and waits for every child BEFORE the success ack. The first child error fails the attempt and cancels siblings; handler error, timeout, and recovered panic cancel and join children before their outcome is acknowledged. Graceful shutdown therefore waits even after the user handler has returned. Lease loss calls `JobCtx::cancel` + `abort_all` in Rust and cancels the exact handler context in Go; the lost holder never acks. Rust's synchronous abort deliberately breaks the possible `JobCtx -> tracker -> future -> JobCtx` ownership cycle. Go is language-honest: cancellation is cooperative and code that ignores `ctx.Done()` cannot be killed, while fencing still blocks stale writes; gap 19 owns reporting that future stuck case. Late/outside registration returns `TrackedTaskClosed` / `ErrTaskTrackerClosed` / `ErrTaskTrackerUnavailable`, never a global fallback. Real live-loop tests hold tracked work behind a barrier, request shutdown, prove the runner CANNOT finish, then release it and require completion. Separate forced-renew-loss tests require child cancellation/drop, no post-cancel side effect, no ack, and the old row still `running`; error tests require retry rather than false success. **Mutation teeth:** deleting Rust's success join acknowledged a failed child as `success`; rebinding Go's tracker to `context.Background()` made the lease-loss cancellation witness time out. Focused Go tests pass `-race`. See `docs/tracked-tasks.md`. | | Task-local typed data (non-persisted) | ✅ | **Round 32y: implemented in both runtimes as two deliberately separate, process-local type maps.** Rust `Extensions` is keyed by `TypeId` and returns `Arc`; `WorkerConfig.extensions` is shared across the worker while every `JobCtx::from_claim` creates a fresh job map. `JobCtx::data` applies job-then-worker shadowing, with explicit `worker_data`, `job_data`, and `insert_data` APIs. Go mirrors this with a `reflect.Type`-keyed `Extensions`, generic `SetExtension`/`Extension`, `Config.Extensions`, and handler-context `Data[T]` / `WorkerData[T]` / `JobData[T]` / `SetJobData`; typed boxes preserve typed nils and a mutex covers every map access. Both real worker-loop tests force two concurrent jobs to insert the SAME concrete type before either reads it, then require each job's own value, the unchanged worker default, a wrong-type miss, terminal completion, and an envelope snapshot with no local marker. Container tests separately pin type replacement/removal and the Go outside-handler error. **Mutation teeth:** making the job map reuse the worker map failed both concurrency tests (and Go ran under `-race`). `docs/task-data.md` records attempt lifetime, shadowing, type-identity/newtype guidance, and that this is storage only—not the still-❌ handler-extractor API. | | Task aggregation / batch handlers | ✅ | **Typed execution chunks in both runtimes.** Rust `Registry::register_batch` and Go `RegisterBatchFunc` coalesce same-kind claims from one atomic admission call until a maximum size or absolute maximum delay, then invoke one handler. Each member keeps its own context, fence, lease, timeout, checkpoint, logs, rate weight and durable outcome; positional results allow partial success/retry and a result-count mismatch fails every member rather than silently dropping one. Panics are isolated and wake every waiter. Direct Store callers keep singleton units for compatibility; worker and test-drain paths form deterministic bounded units and run them concurrently. This is River/Oban-style execution batching, not Sidekiq workflow batches or asynq's synthetic aggregate-task replacement. See `docs/batch-handlers.md`. | -| **Workflows / DAG dependencies** | ✅ | **Round 32u: durable DAG dependency gating is implemented as the separate opt-in `headgate-workflow` crate and Go `workflow` package—fulfilling the architecture boundary without adding orchestration to core or changing admission.** Builders reject empty/duplicate names, missing/repeated dependencies and cycles before enqueue, then return one batch containing a durable coordinator and every application task in `pending`. The coordinator uses bounded point reads only, promotes roots, then fan-out/fan-in nodes only when every dependency is `completed`; it snoozes without consuming attempts while work is live. Failed or unrecorded missing upstream jobs cause still-pending descendants to be deleted before execution and archive the coordinator as the workflow-level failure record. **Workflow-aware retention hardening:** every child is retained for at least the workflow retention, and each observed completion is copied into the coordinator's fenced cursor before descendants are promoted. An early job row may therefore expire during a long retry without erasing the durable fact that it completed. Both languages prove short-retention clamping and missing-row recovery from recorded evidence. A live Postgres runtime test executes `extract -> {left,right} -> join` through the real worker/Store path and asserts the join is last. Go's independent coordinator test drives the same fan-out/fan-in state machine and proves an archived branch removes the pending join and settles failed. This row claims durable static DAG dependencies, not River Pro's signals, timers, CEL waits, retry, dynamic grafting/nesting, or graph UI; those remain explicitly outside this slice. See `docs/workflows.md`. | +| **Workflows / DAG dependencies** | ✅ | **Round 32u: durable DAG dependency gating is implemented as the separate opt-in `headgate-workflow` crate and Go package—fulfilling the architecture boundary without adding orchestration to core or changing admission.** Builders reject empty/duplicate names, missing/repeated dependencies and cycles before enqueue, then return one batch containing a durable coordinator and every application task in `pending`. The coordinator uses bounded point reads only, promotes roots, then fan-out/fan-in nodes only when every dependency is `completed`; it snoozes without consuming an attempt while work is live. By default, failed or unrecorded missing upstream jobs remove still-pending descendants and archive the coordinator. Workflow retention clamps child retention, and store-stamped completion evidence is copied into the fenced cursor before descendants are promoted. The existing live PostgreSQL proof requires `extract -> {left,right} -> join` in order. This ✅ remains only the immutable base-DAG claim; dynamic features and CEL waits are tracked by the adjacent 🔶 experiment rows and documentation. See `docs/workflows.md`. | +| Workflow signals | ✅ | Durable buffered/idempotent signal jobs exist in Rust and Go. Rich SDK and `POST /workflows/{id}/signals` emissions durably retain the signal name, store timestamp, idempotency key, bounded JSON payload, and caller-supplied source metadata before unblocking work; replay returns the original record and conflicting key reuse fails. `GET /workflows/{id}/signals` and the workflow console expose the newest 100 records on PostgreSQL, Redis, and MySQL. Source identity is descriptive unless a deployment derives it at its authenticated upstream boundary. UI mutation controls are a separate deferred surface. | +| Workflow timers | ✅ | Absolute timers use ordinary scheduled jobs. Relative timers record dependency `finalized_at_ms` from store-stamped completion evidence and atomically schedule at the latest timestamp plus the delay; coordinator polling latency and worker clocks cannot move the anchor. The complete runtime path passed the six live backend/language cells. | +| Workflow conditional waits (CEL) | ✅ | Both SDKs compile bounded CEL boolean expressions before enqueue and evaluate them over typed `revision`, `generation`, `states`, and `completed` values. Conditions are ordinary pending internal jobs and cannot perform I/O. The CEL path passed inside all six live workflow matrix cells. | +| Workflow graph mutation | ✅ | Additive revision-checked grafts use one atomic deterministic receipt/task batch, validate the combined DAG, fence accepted nodes into the coordinator cursor, and record acceptance in bounded history. Authenticated/idempotency-key HTTP mutation routes exist. Accepted nodes and dependency edges remain immutable across revisions: grafts append ordinary tasks but never replace, rename, remove, or rewire existing work, and the coordinator must remain live. Grafts cannot add signals, timers, CEL conditions, or child-workflow links; those control-flow nodes must be declared in the initial graph because their delivery, store-clock, evaluation, cycle, cancellation, and retry rules need a separate versioned mutation contract. A materially different graph requires a new workflow ID. Once terminal, the execution's graph and recorded outcome are permanently immutable; explicitly preconfigured failed-subgraph retry advances a generation over the unchanged graph rather than mutating it. UI mutation controls are separate. | +| Workflow graph inspection | ✅ | Rust `list_workflows` / Go `ListWorkflows` provide bounded cursor pages without loading every graph. Rust `inspect_workflow` and Go `InspectWorkflow` return one bounded payload-free snapshot containing the accepted base graph plus grafts, coordinator/node execution state, revision, generation, retry policy, dependencies, reverse dependents, virtual-node configuration, and retained completion evidence. Both libraries provide snapshot methods and fresh-read node/dependency/dependent helpers. Matching authenticated GET routes expose the same list and topology without requiring console code or coordinator-payload parsing. | +| Nested workflows | ✅ | Child links support atomic `prepare_bundle` / `PrepareBundle`, complete-bundle cross-workflow cycle detection, bounded parent cancellation across all live branches, and failed-child retry propagation. Separately enqueued children remain supported without global cycle proof. | +| Workflow-level retry | ✅ | Manual and store-timed automatic failed-subgraph retry exist in both SDKs. Retry preserves successful ancestors, records generation/revision history, repairs quarantined nodes only after explicit fingerprint-wide release, repairs undecodable nodes only with replacement payload/schema, and propagates through failed child links. Authenticated/idempotency-key retry and cancellation routes exist; the combined retry path passed all six live cells. See `docs/workflow-experiments.md`. | ## Failure diff --git a/conformance/EVIDENCE.md b/conformance/EVIDENCE.md index af742ab..78e9609 100644 --- a/conformance/EVIDENCE.md +++ b/conformance/EVIDENCE.md @@ -696,6 +696,82 @@ NOTE: round 32ab. The graceful tests drive the real admission loop, hold a child - go: headgateworkflow/workflow_test.go::TestCoordinatorUsesDurableCompletionEvidenceAfterRetention NOTE: round 32u plus workflow-aware retention hardening. Both builders pin the durable batch shape and reject missing dependencies and cycles. They clamp short child retention to the workflow retention. The coordinator records observed completions in a fenced cursor before promoting descendants; both languages prove retained evidence still resolves a dependency after its ordinary job row disappears, while an unrecorded missing dependency remains a failure. The Rust live test enqueues one real coordinator plus four pending application jobs into Postgres, repeatedly runs the ordinary worker runtime, and requires `extract` first, `join` last, and both fan-out branches exactly once between them. Go independently drives the resolver through root promotion, two-way fan-out, and an archived branch; the still-pending join is deleted before execution and the workflow settles failed. The graph is static and bounded by coordinator payload size. Signals, timers, CEL waits, dynamic graph mutation, workflow retry, and graph UI are not claimed. +### Workflow signals +- rust: crates/headgate-api/tests/api.rs::workflow_control_routes_share_the_idempotency_boundary +- go: headgateapi/api_test.go::TestWorkflowMutationRoutesRequireIdempotencyKey +- rust: crates/headgate-workflow/src/lib.rs::signal_is_pending_work_and_early_completion_waits_for_dependencies +- rust: crates/headgate-workflow/tests/live.rs::live_postgres_buffers_and_idempotently_replays_workflow_signal +- rust: crates/headgate-workflow/tests/live.rs::workflow_experiments_postgres_matrix_cell +- rust: crates/headgate-workflow/tests/live.rs::workflow_experiments_redis_matrix_cell +- rust-mysql: crates/headgate-workflow/tests/live_mysql.rs::workflow_experiments_mysql_matrix_cell +- go: headgateworkflow/workflow_test.go::TestSignalEmissionIsDurableBufferedAndIdempotent +- go: headgateworkflow/live_matrix_test.go::TestWorkflowExperimentsPostgresMatrixCell +- go: headgateworkflow/live_matrix_test.go::TestWorkflowExperimentsRedisMatrixCell +- go-mysql: headgateworkflow/live_mysql_test.go::TestWorkflowExperimentsMySQLMatrixCell +NOTE: both SDKs use a retained pending signal job, buffer early delivery, and make replay idempotent. `TestSignalEmissionIsDurableBufferedAndIdempotent` and the two API boundary tests require a store-timestamped emission containing the idempotency key, JSON payload, and caller-supplied JSON source; replay returns the original record, conflicting content is rejected, and the bounded newest-first list reads it back. The shared matrix scenario combines early signal delivery with CEL, a relative timer, automatic retry, and durable history. On 2026-09-04 all six PostgreSQL/Redis/MySQL × Rust/Go cells ran live and passed; migration v13 adds the portable signal event store used by the richer contract. Payload is bounded to 64 KiB, source to 16 KiB, and each workflow retains 100 emissions. + +### Workflow timers +- rust: crates/headgate-workflow/src/lib.rs::timer_uses_absolute_schedule_and_buffers_until_dependencies_complete +- go: headgateworkflow/workflow_test.go::TestTimerUsesStoreScheduleAndBuffersUntilDependenciesComplete +- go: headgateworkflow/workflow_test.go::TestRelativeTimerCheckpointsBeforeStoreTimeSnooze +- rust: crates/headgate-workflow/src/lib.rs::relative_timer_anchors_to_dependency_completion +- rust: crates/headgate-workflow/tests/live.rs::workflow_experiments_postgres_matrix_cell +- rust: crates/headgate-workflow/tests/live.rs::workflow_experiments_redis_matrix_cell +- rust-mysql: crates/headgate-workflow/tests/live_mysql.rs::workflow_experiments_mysql_matrix_cell +- go: headgateworkflow/live_matrix_test.go::TestWorkflowExperimentsPostgresMatrixCell +- go: headgateworkflow/live_matrix_test.go::TestWorkflowExperimentsRedisMatrixCell +- go-mysql: headgateworkflow/live_mysql_test.go::TestWorkflowExperimentsMySQLMatrixCell +NOTE: relative timers anchor to the latest dependency's store-stamped finalization and use the narrow pending-to-scheduled store operation. The six-cell scenario covers the complete runtime path and passed live on 2026-09-04. Its first Redis runs failed because the new Lua branch read ARGV[3]/ARGV[4] instead of ARGV[2]/ARGV[3], then omitted the future-score admission route; both failures are now regression-covered by the matrix. + +### Workflow conditional waits (CEL) +- rust: crates/headgate-workflow/src/lib.rs::automatic_retry_policy_and_cel_condition_are_validated +- rust: crates/headgate-workflow/tests/live.rs::workflow_experiments_postgres_matrix_cell +- rust: crates/headgate-workflow/tests/live.rs::workflow_experiments_redis_matrix_cell +- rust-mysql: crates/headgate-workflow/tests/live_mysql.rs::workflow_experiments_mysql_matrix_cell +- go: headgateworkflow/workflow_test.go::TestAutomaticRetryPolicyAndCELConditionAreValidated +- go: headgateworkflow/live_matrix_test.go::TestWorkflowExperimentsPostgresMatrixCell +- go: headgateworkflow/live_matrix_test.go::TestWorkflowExperimentsRedisMatrixCell +- go-mysql: headgateworkflow/live_mysql_test.go::TestWorkflowExperimentsMySQLMatrixCell +NOTE: both implementations reject malformed or oversized expressions before enqueue, expose the same four typed variables, require a boolean result, and promote a condition as an ordinary pending internal job. The condition path passed in every live matrix cell on 2026-09-04. + +### Workflow graph mutation +- rust: crates/headgate-api/tests/api.rs::workflow_control_routes_share_the_idempotency_boundary +- go: headgateapi/api_test.go::TestWorkflowMutationRoutesRequireIdempotencyKey +- rust: crates/headgate-workflow/src/lib.rs::revisioned_graft_prepares_one_atomic_receipt_and_pending_tasks +- rust: crates/headgate-workflow/tests/live.rs::live_postgres_accepts_one_revisioned_workflow_graft_atomically +- go: headgateworkflow/workflow_test.go::TestRevisionedGraftPersistsGraphBeforePromotingReceipt +- go: headgateworkflow/workflow_test.go::TestInvalidCombinedGraftIsRemovedWithoutAdvancingRevision +NOTE: both SDKs derive the same deterministic next-revision receipt, atomically enqueue it with pending tasks, validate the combined DAG, and persist acceptance before promotion. The authenticated/idempotency-key HTTP route exists and acceptance enters bounded history. Grafts remain additive ordinary-task mutations on a live coordinator; that is the claimed boundary, not missing evidence. + +### Workflow graph inspection +- rust: crates/headgate-workflow/src/lib.rs::workflow_snapshot_answers_topology_queries +- rust: crates/headgate-api/tests/api.rs::workflow_control_routes_share_the_idempotency_boundary +- go: headgateworkflow/workflow_test.go::TestInspectWorkflowReturnsTopologyAndExecutionState +- go: headgateapi/api_test.go::TestWorkflowInspectionRoutesAreReadOnlyAndBoundedToKnownNodes +- go: headgateapi/api_test.go::TestWorkflowInspectionRoutesReturnTopologyWithoutPayloads +NOTE: both workflow libraries expose the accepted graph and reverse topology without payloads, and their dependency/dependent lookups fail explicitly for unknown nodes. The Rust live API proof reads an enqueued graph and its dependency route; the Go route proofs pin read-only access, 404 behavior, graph/node/dependency/dependent response shapes, while the package test checks revision, generation, completion time, state, dependencies, and dependents. + +### Workflow-level retry +- rust: crates/headgate-workflow/src/lib.rs::failed_subgraph_retry_is_explicit_in_the_coordinator_payload +- rust: crates/headgate-workflow/tests/live.rs::live_postgres_retries_only_the_failed_workflow_subgraph +- go: headgateworkflow/workflow_test.go::TestFailedSubgraphRetryPreservesSuccessAndReopensOnlyFailure +- go: headgateworkflow/workflow_test.go::TestFailedSubgraphRetryRequiresExplicitTerminalRecovery +- go: headgateapi/api_test.go::TestWorkflowMutationRoutesRequireIdempotencyKey +- rust: crates/headgate-workflow/src/lib.rs::automatic_retry_policy_and_cel_condition_are_validated +- rust: crates/headgate-workflow/tests/live.rs::workflow_experiments_postgres_matrix_cell +- go: headgateworkflow/workflow_test.go::TestAutomaticRetryPolicyAndCELConditionAreValidated +- go: headgateworkflow/live_matrix_test.go::TestWorkflowExperimentsPostgresMatrixCell +NOTE: manual and automatic retries preserve completed ancestors, advance revision/generation, and use deterministic receipts. Recovery requires explicit quarantine release or a replacement undecodable payload/schema, and child-link retries propagate. The route and bounded history exist. The automatic retry path passed all six live cells on 2026-09-04, including terminal history surviving cursor-step completion. + +### Nested workflows +- rust: crates/headgate-workflow/src/lib.rs::child_workflow_is_an_explicit_pending_node +- rust: crates/headgate-workflow/tests/live.rs::live_postgres_parent_waits_for_child_workflow +- go: headgateworkflow/workflow_test.go::TestChildWorkflowNodeMirrorsCoordinatorTerminalState +- rust: crates/headgate-workflow/src/lib.rs::atomic_bundle_rejects_cross_workflow_cycles +- go: headgateworkflow/workflow_test.go::TestAtomicBundleRejectsCrossWorkflowCycles +- go: headgateworkflow/workflow_test.go::TestCancelWorkflowPropagatesToChildrenAndAllLiveBranches +NOTE: explicit child-link jobs mirror the child coordinator. Atomic bundles require every child, reject cross-workflow cycles, and return one enqueue batch. Cancellation traverses all live parent branches and linked children by default; failed-link retry requests child retry first. These SDK/runtime semantics are the claimed capability; UI controls are tracked separately. + ### Death handler - rust: crates/headgate/tests/death_handler.rs::death_handler_runs_once_only_after_the_archive_is_durable - go: death_handler_test.go::TestDeathHandlerRunsOnceOnlyAfterArchiveIsDurable diff --git a/conformance/TEST_INVENTORY.tsv b/conformance/TEST_INVENTORY.tsv index 41d17ec..a8d8d60 100644 --- a/conformance/TEST_INVENTORY.tsv +++ b/conformance/TEST_INVENTORY.tsv @@ -5,7 +5,7 @@ # deliberate hand-edit, because that is what deleting a test is. scenario conformance/scenarios/admission.yaml 9 rust crates/headgate-api/src/lib.rs 2 -rust crates/headgate-api/tests/api.rs 10 +rust crates/headgate-api/tests/api.rs 11 rust crates/headgate-core/src/lib.rs 26 rust crates/headgate-crypto/src/lib.rs 3 rust crates/headgate-crypto/tests/live.rs 1 @@ -28,6 +28,7 @@ rust crates/headgate-postgres/tests/multi_instance.rs 1 rust crates/headgate-postgres/tests/orm_interop.rs 3 rust crates/headgate-postgres/tests/outage.rs 1 rust crates/headgate-postgres/tests/store.rs 7 +rust crates/headgate-redis/src/inspect.rs 1 rust crates/headgate-redis/src/lib.rs 3 rust crates/headgate-redis/tests/backpressure.rs 1 rust crates/headgate-redis/tests/inspect.rs 5 @@ -42,8 +43,9 @@ rust crates/headgate-testkit/tests/database_postgres.rs 1 rust crates/headgate-testkit/tests/database_redis.rs 1 rust crates/headgate-testkit/tests/memstore.rs 10 rust crates/headgate-ui/tests/ui.rs 4 -rust crates/headgate-workflow/src/lib.rs 5 -rust crates/headgate-workflow/tests/live.rs 1 +rust crates/headgate-workflow/src/lib.rs 15 +rust crates/headgate-workflow/tests/live.rs 7 +rust crates/headgate-workflow/tests/live_mysql.rs 1 rust crates/headgate/src/circuit_breaker.rs 5 rust crates/headgate/src/client.rs 2 rust crates/headgate/src/isolated.rs 6 @@ -91,11 +93,11 @@ go go/driver/headgatepgx/runtime_test.go 7 go go/driver/headgatepgx/scheduler_test.go 3 go go/driver/headgatepgx/store_test.go 12 go go/driver/headgatepgx/tracesignal_test.go 1 -go go/driver/headgateredis/inspect_test.go 2 +go go/driver/headgateredis/inspect_test.go 3 go go/driver/headgateredis/store_test.go 8 go go/enqueue_middleware_test.go 4 go go/fingerprint_test.go 2 -go go/headgateapi/api_test.go 18 +go go/headgateapi/api_test.go 22 go go/headgatecrypto/crypto_test.go 3 go go/headgatectl/main_test.go 1 go go/headgatemigrate/cmd/hg-migrate/main_test.go 5 @@ -116,7 +118,9 @@ go go/headgatetest/memstore_test.go 11 go go/headgatetest/task_data_test.go 1 go go/headgatetest/tracked_tasks_test.go 5 go go/headgateui/ui_test.go 5 -go go/headgateworkflow/workflow_test.go 6 +go go/headgateworkflow/live_matrix_test.go 2 +go go/headgateworkflow/live_mysql_test.go 1 +go go/headgateworkflow/workflow_test.go 19 go go/insert_hook_test.go 4 go go/log_test.go 4 go go/output_test.go 2 diff --git a/conformance/state_machine.yaml b/conformance/state_machine.yaml index 1ad9d63..e0582b5 100644 --- a/conformance/state_machine.yaml +++ b/conformance/state_machine.yaml @@ -29,10 +29,12 @@ transitions: - {from: running, on: checkpoint_stale, to: undecodable} - {from: archived, on: operator_retry, to: available} - {from: cancelled, on: operator_retry, to: available} + - {from: undecodable, on: operator_retry, to: available} - {from: quarantined, on: operator_release, to: available} - {from: available, on: operator_cancel, to: cancelled} - {from: scheduled, on: operator_cancel, to: cancelled} - {from: pending, on: operator_cancel, to: cancelled} + - {from: retryable, on: operator_cancel, to: cancelled} - {from: running, on: operator_cancel, to: cancelled} invariants: diff --git a/crates/headgate-api/Cargo.toml b/crates/headgate-api/Cargo.toml index e949e34..da935b6 100644 --- a/crates/headgate-api/Cargo.toml +++ b/crates/headgate-api/Cargo.toml @@ -18,6 +18,7 @@ license.workspace = true headgate-core = { workspace = true } # schedule_spec: the API validates specs and computes a schedule's first next_run. headgate = { workspace = true } +headgate-workflow = { workspace = true } axum = "0.8" futures-util = { version = "0.3", default-features = false, features = ["std"] } tokio = { version = "1", features = ["time", "rt-multi-thread", "macros", "net"] } diff --git a/crates/headgate-api/src/lib.rs b/crates/headgate-api/src/lib.rs index f237ae7..70a1248 100644 --- a/crates/headgate-api/src/lib.rs +++ b/crates/headgate-api/src/lib.rs @@ -15,7 +15,7 @@ use std::sync::atomic::{AtomicU64, Ordering}; use axum::extract::DefaultBodyLimit; use axum::extract::rejection::{JsonRejection, QueryRejection}; use axum::extract::{FromRequest, FromRequestParts, Path, Query, State}; -use axum::http::{HeaderValue, Method, StatusCode}; +use axum::http::{HeaderMap, HeaderValue, Method, StatusCode}; use axum::response::{IntoResponse, Response}; use axum::routing::{delete, get, post, put}; use axum::{Extension, Json, Router}; @@ -130,6 +130,25 @@ pub fn router(store: Arc, cfg: ApiConfig) -> Router { .route("/workers", get(workers)) .route("/cluster", get(cluster)) .route("/workers/{worker_id}/signal", post(signal_worker)) + .route("/workflows", get(workflow_list)) + .route("/workflows/{id}", get(workflow_detail)) + .route("/workflows/{id}/events", get(workflow_events)) + .route("/workflows/{id}/nodes/{node}", get(workflow_node)) + .route( + "/workflows/{id}/nodes/{node}/dependencies", + get(workflow_dependencies), + ) + .route( + "/workflows/{id}/nodes/{node}/dependents", + get(workflow_dependents), + ) + .route( + "/workflows/{id}/signals", + get(workflow_signals).post(workflow_signal), + ) + .route("/workflows/{id}/grafts", post(workflow_graft)) + .route("/workflows/{id}/retry", post(workflow_retry)) + .route("/workflows/{id}/cancel", post(workflow_cancel)) .route("/events", get(events)) .route("/rate-classes", get(rate_classes)) .route("/rate-classes/{name}", put(put_rate_class)) @@ -398,6 +417,7 @@ fn client_error(error: headgate::ClientError) -> Response { } } +#[allow(clippy::result_large_err)] // Axum handlers use a concrete Response as the uniform API error. fn authorize_http_enqueue( state: &ApiState, identity: Option>, @@ -410,6 +430,285 @@ fn authorize_http_enqueue( type ApiResult = Result; +fn workflow_err(error: headgate_workflow::WorkflowError) -> Response { + let message = error.to_string(); + let status = if message.contains("was not found") { + StatusCode::NOT_FOUND + } else if message.contains("revision conflict") { + StatusCode::CONFLICT + } else { + StatusCode::BAD_REQUEST + }; + err_response(status, &message) +} + +#[derive(Deserialize)] +struct WorkflowSignalBody { + signal: String, + #[serde(default)] + payload: serde_json::Value, + #[serde(default = "default_signal_source")] + source: serde_json::Value, +} + +fn default_signal_source() -> serde_json::Value { + serde_json::json!({}) +} + +async fn workflow_signal( + State(s): State, + Path(id): Path, + headers: HeaderMap, + ApiJson(body): ApiJson, +) -> ApiResult { + let key = headers + .get("idempotency-key") + .and_then(|v| v.to_str().ok()) + .unwrap_or_default(); + let receipt = headgate_workflow::emit_signal_with( + s.store.as_ref(), + &id, + headgate_workflow::SignalEmission { + signal: body.signal, + idempotency_key: key.into(), + payload: body.payload, + source: body.source, + }, + ) + .await + .map_err(workflow_err)?; + Ok(Json(json!({ "matched": receipt.matched, "promoted": receipt.promoted, "inserted": receipt.inserted, "emission": receipt.emission })).into_response()) +} + +#[derive(Deserialize)] +struct WorkflowSignalsQuery { + cursor: Option, + limit: Option, +} + +async fn workflow_signals( + State(s): State, + Path(id): Path, + Query(query): Query, +) -> ApiResult { + let limit = query.limit.unwrap_or(100); + let signals = headgate_workflow::list_signals(s.store.as_ref(), &id, query.cursor, limit) + .await + .map_err(workflow_err)?; + let next_cursor = (signals.len() == limit as usize) + .then(|| signals.last().map(|signal| signal.id)) + .flatten(); + Ok(Json(json!({"signals": signals, "next_cursor": next_cursor})).into_response()) +} + +#[derive(Deserialize)] +struct WorkflowRetryBody { + expected_revision: u64, + #[serde(default)] + recoveries: Vec, +} + +#[derive(Deserialize)] +struct WorkflowRecoveryBody { + node: String, + #[serde(default)] + payload: Option, + #[serde(default)] + schema_version: Option, + #[serde(default)] + release_quarantine: bool, +} + +#[allow(clippy::result_large_err)] // Keeps base64 validation on the same concrete API error path. +async fn workflow_retry( + State(s): State, + Path(id): Path, + ApiJson(body): ApiJson, +) -> ApiResult { + let b64 = base64::engine::general_purpose::STANDARD; + let recoveries = body + .recoveries + .into_iter() + .map(|recovery| { + let payload = recovery + .payload + .map(|payload| { + b64.decode(payload).map_err(|_| { + err_response(StatusCode::BAD_REQUEST, "recovery payload must be base64") + }) + }) + .transpose()?; + Ok(headgate_workflow::WorkflowRecovery { + node: recovery.node, + payload, + schema_version: recovery.schema_version, + release_quarantine: recovery.release_quarantine, + }) + }) + .collect::, Response>>()?; + let receipt = headgate_workflow::request_failed_subgraph_retry_with_recovery( + s.store.as_ref(), + &id, + body.expected_revision, + &recoveries, + ) + .await + .map_err(workflow_err)?; + Ok( + Json(json!({ "revision": receipt.revision, "generation": receipt.generation })) + .into_response(), + ) +} + +#[derive(Deserialize)] +struct WorkflowCancelBody { + #[serde(default = "default_true")] + propagate_children: bool, +} + +const fn default_true() -> bool { + true +} + +async fn workflow_cancel( + State(s): State, + Path(id): Path, + ApiJson(body): ApiJson, +) -> ApiResult { + let receipt = + headgate_workflow::cancel_workflow(s.store.as_ref(), &id, body.propagate_children) + .await + .map_err(workflow_err)?; + Ok(Json(json!({ "workflows": receipt.workflows, "jobs": receipt.jobs })).into_response()) +} + +async fn workflow_events(State(s): State, Path(id): Path) -> ApiResult { + let events = headgate_workflow::workflow_events(s.store.as_ref(), &id) + .await + .map_err(workflow_err)?; + Ok(Json(json!({ "events": events })).into_response()) +} + +async fn workflow_detail(State(s): State, Path(id): Path) -> ApiResult { + let snapshot = headgate_workflow::inspect_workflow(s.store.as_ref(), &id) + .await + .map_err(workflow_err)?; + Ok(Json(snapshot).into_response()) +} + +#[derive(Deserialize)] +struct WorkflowListParams { + cursor: Option, + limit: Option, +} + +async fn workflow_list( + State(s): State, + ApiQuery(params): ApiQuery, +) -> ApiResult { + let page = headgate_workflow::list_workflows( + s.store.as_ref(), + params.cursor.as_deref(), + params.limit.unwrap_or(50), + ) + .await + .map_err(workflow_err)?; + Ok(Json(page).into_response()) +} + +async fn workflow_node( + State(s): State, + Path((id, node)): Path<(String, String)>, +) -> ApiResult { + let node = headgate_workflow::workflow_node(s.store.as_ref(), &id, &node) + .await + .map_err(workflow_err)?; + Ok(Json(node).into_response()) +} + +async fn workflow_dependencies( + State(s): State, + Path((id, node)): Path<(String, String)>, +) -> ApiResult { + let dependencies = headgate_workflow::workflow_dependencies(s.store.as_ref(), &id, &node) + .await + .map_err(workflow_err)?; + Ok(Json(json!({ "dependencies": dependencies })).into_response()) +} + +async fn workflow_dependents( + State(s): State, + Path((id, node)): Path<(String, String)>, +) -> ApiResult { + let dependents = headgate_workflow::workflow_dependents(s.store.as_ref(), &id, &node) + .await + .map_err(workflow_err)?; + Ok(Json(json!({ "dependents": dependents })).into_response()) +} + +#[derive(Deserialize)] +struct WorkflowGraftBody { + expected_revision: u64, + #[serde(default)] + queue: Option, + tasks: Vec, +} + +#[derive(Deserialize)] +struct WorkflowGraftTaskBody { + name: String, + #[serde(default)] + deps: Vec, + kind: String, + payload: String, + #[serde(default)] + id: Option, + #[serde(default)] + queue: Option, + #[serde(default)] + schema_version: Option, +} + +async fn workflow_graft( + State(s): State, + identity: Option>, + Path(id): Path, + ApiJson(body): ApiJson, +) -> ApiResult { + let mut graft = headgate_workflow::WorkflowGraft::new(&id, body.expected_revision); + if let Some(queue) = body.queue { + graft = graft.queue(queue); + } + let b64 = base64::engine::general_purpose::STANDARD; + for task in body.tasks { + let payload = b64 + .decode(task.payload) + .map_err(|_| err_response(StatusCode::BAD_REQUEST, "payload must be base64"))?; + let kind = task.kind; + let envelope = Envelope { + id: task.id.unwrap_or_default(), + fingerprint: fingerprint(&kind, &payload), + kind, + payload, + queue: task.queue.unwrap_or_default(), + schema_version: task.schema_version.unwrap_or(1), + ..Default::default() + }; + graft = graft.add(task.name, envelope, task.deps); + } + let batch = graft.prepare().map_err(workflow_err)?; + let context = headgate::EnqueueContext::http(identity.map(|Extension(value)| value)); + s.producer + .enqueue_with_context(&context, &batch) + .await + .map_err(client_error)?; + Ok(( + StatusCode::ACCEPTED, + Json(json!({ "receipt_id": batch[0].id })), + ) + .into_response()) +} + // ---------- handlers ---------- async fn readyz(State(s): State) -> ApiResult { @@ -454,6 +753,7 @@ fn default_control_page_limit() -> usize { 200 } +#[allow(clippy::result_large_err)] // Axum handlers consume this concrete response directly. fn control_page(length: usize, query: &ControlPageQuery) -> Result<(usize, usize), Response> { if query.limit == 0 || query.limit > 200 { return Err(err_response( @@ -1190,7 +1490,7 @@ async fn put_concurrency_limit( )); } let on_saturated = - SaturationStrategy::try_from(body.on_saturated.as_str()).map_err(|e| store_err(e))?; + SaturationStrategy::try_from(body.on_saturated.as_str()).map_err(store_err)?; s.store .upsert_concurrency_limit(&ConcurrencyLimitConfig { name, diff --git a/crates/headgate-api/tests/api.rs b/crates/headgate-api/tests/api.rs index cc95dba..88664c0 100644 --- a/crates/headgate-api/tests/api.rs +++ b/crates/headgate-api/tests/api.rs @@ -11,10 +11,165 @@ use headgate_core::{ ProgressStore, ProgressUpdate, Schedule, Store, }; use headgate_postgres::PgStore; +use headgate_workflow::Workflow; use http_body_util::BodyExt; use serde_json::{Value, json}; use tower::ServiceExt; +#[tokio::test] +async fn workflow_control_routes_share_the_idempotency_boundary() { + let Ok(conninfo) = std::env::var("HG_TEST_PG") else { + eprintln!("HG_TEST_PG not set; skipping workflow control API proof"); + return; + }; + let store = Arc::new(PgStore::connect(&conninfo, 2).expect("connect")); + let suffix = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_nanos(); + let workflow_id = format!("api-workflow-{suffix}"); + let queue = format!("api-workflow-{suffix}"); + let batch = Workflow::new(&workflow_id) + .coordinator_queue(&queue) + .add( + "prepare", + Envelope { + kind: "api.workflow.prepare".into(), + payload: br#"{"secret":"not-in-graph-response"}"#.to_vec(), + queue: queue.clone(), + ..Default::default() + }, + Vec::::new(), + ) + .add_signal("approval", "approved", ["prepare"]) + .prepare() + .unwrap(); + store.enqueue(&batch).await.unwrap(); + let app = router(store as Arc, ApiConfig::default()); + + let (status, workflows) = call_with_key( + &app, + Method::GET, + "/api/v1/workflows?limit=50", + None, + "unused-on-read", + ) + .await; + assert_eq!(status, StatusCode::OK); + assert!( + workflows["workflows"] + .as_array() + .unwrap() + .iter() + .any(|workflow| workflow["workflow_id"] == workflow_id) + ); + + let (status, snapshot) = call_with_key( + &app, + Method::GET, + &format!("/api/v1/workflows/{workflow_id}"), + None, + "unused-on-read", + ) + .await; + assert_eq!(status, StatusCode::OK); + assert_eq!(snapshot["nodes"].as_array().unwrap().len(), 2); + assert!(!snapshot.to_string().contains("not-in-graph-response")); + let (status, dependencies) = call_with_key( + &app, + Method::GET, + &format!("/api/v1/workflows/{workflow_id}/nodes/approval/dependencies"), + None, + "unused-on-read", + ) + .await; + assert_eq!(status, StatusCode::OK); + assert_eq!(dependencies["dependencies"][0]["name"], "prepare"); + + let request = Request::builder() + .method(Method::POST) + .uri(format!("/api/v1/workflows/{workflow_id}/signals")) + .header(header::CONTENT_TYPE, "application/json") + .body(Body::from(json!({"signal": "approved"}).to_string())) + .unwrap(); + assert_eq!( + app.clone().oneshot(request).await.unwrap().status(), + StatusCode::BAD_REQUEST + ); + + let (status, receipt) = call_with_key( + &app, + Method::POST, + &format!("/api/v1/workflows/{workflow_id}/signals"), + Some(json!({ + "signal": "approved", + "payload": {"approved": true, "reviewer": "Ada"}, + "source": {"emitter": "admin-console", "actor": "operator-42"} + })), + "workflow-signal-1", + ) + .await; + assert_eq!(status, StatusCode::OK); + assert_eq!(receipt["matched"], 1); + assert_eq!(receipt["inserted"], true); + assert_eq!(receipt["emission"]["idempotency_key"], "workflow-signal-1"); + assert_eq!(receipt["emission"]["payload"]["reviewer"], "Ada"); + assert_eq!(receipt["emission"]["source"]["actor"], "operator-42"); + + let (status, history) = call_with_key( + &app, + Method::GET, + &format!("/api/v1/workflows/{workflow_id}/signals?limit=100"), + None, + "unused-on-read", + ) + .await; + assert_eq!(status, StatusCode::OK); + assert_eq!(history["signals"].as_array().unwrap().len(), 1); + assert_eq!(history["signals"][0], receipt["emission"]); + + let (status, replay) = call_with_key( + &app, + Method::POST, + &format!("/api/v1/workflows/{workflow_id}/signals"), + Some(json!({ + "signal": "approved", + "payload": {"approved": true, "reviewer": "Ada"}, + "source": {"emitter": "admin-console", "actor": "operator-42"} + })), + "workflow-signal-1", + ) + .await; + assert_eq!(status, StatusCode::OK); + assert_eq!(replay["inserted"], false); + assert_eq!(replay["emission"], receipt["emission"]); + + let (status, graft) = call_with_key( + &app, + Method::POST, + &format!("/api/v1/workflows/{workflow_id}/grafts"), + Some(json!({ + "expected_revision": 1, + "queue": queue, + "tasks": [{"name": "audit", "kind": "api.workflow.audit", "payload": "e30="}] + })), + "workflow-graft-1", + ) + .await; + assert_eq!(status, StatusCode::ACCEPTED); + assert_eq!(graft["receipt_id"], format!("{workflow_id}:graft:2")); + + let (status, _) = call_with_key( + &app, + Method::POST, + &format!("/api/v1/workflows/{workflow_id}/cancel"), + Some(json!({"propagate_children": true})), + "workflow-cancel-1", + ) + .await; + assert_eq!(status, StatusCode::OK); +} + async fn call_with_key( app: &axum::Router, method: Method, @@ -335,8 +490,10 @@ async fn enqueue_outage_is_service_unavailable_not_a_bad_request() { }) .unwrap(), ); - let mut config = ApiConfig::default(); - config.enqueue_circuit_breaker = Some(breaker.clone()); + let config = ApiConfig { + enqueue_circuit_breaker: Some(breaker.clone()), + ..ApiConfig::default() + }; let app = router(inspect, config); let (status, body) = call_with_key( &app, @@ -403,8 +560,10 @@ async fn enqueue_authorization_guards_http_and_periodic_paths() { }, ); let inspect: Arc = store.clone(); - let mut config = ApiConfig::default(); - config.enqueue_authorizer = authorizer; + let config = ApiConfig { + enqueue_authorizer: authorizer, + ..ApiConfig::default() + }; let app = router(inspect, config).layer(axum::Extension(headgate::EnqueueIdentity::new( "service:mailer", ))); @@ -1349,10 +1508,10 @@ async fn a_real_workers_polling_is_the_number_that_reaches_cluster() { let deadline = tokio::time::Instant::now() + std::time::Duration::from_secs(secs); loop { let ws = store.list_workers(900_000).await.unwrap(); - if let Some(w) = ws.into_iter().find(|w| w.worker_id == wid) { - if cond(&w) { - return w; - } + if let Some(w) = ws.into_iter().find(|w| w.worker_id == wid) + && cond(&w) + { + return w; } assert!( tokio::time::Instant::now() < deadline, diff --git a/crates/headgate-core/src/lib.rs b/crates/headgate-core/src/lib.rs index 0acd771..702234b 100644 --- a/crates/headgate-core/src/lib.rs +++ b/crates/headgate-core/src/lib.rs @@ -298,12 +298,17 @@ pub fn lifecycle_transition(from: State, ev: LifecycleEvent) -> Option { (State::Retryable, LifecycleEvent::BackoffDue) => Some(State::Available), // step replay a resumed job whose step set changed under it must NOT silently restart (State::Running, LifecycleEvent::CheckpointStale) => Some(State::Undecodable), - (State::Archived | State::Cancelled, LifecycleEvent::OperatorRetry) => { - Some(State::Available) - } + ( + State::Archived | State::Cancelled | State::Undecodable, + LifecycleEvent::OperatorRetry, + ) => Some(State::Available), (State::Quarantined, LifecycleEvent::OperatorRelease) => Some(State::Available), ( - State::Pending | State::Available | State::Scheduled | State::Running, + State::Pending + | State::Available + | State::Scheduled + | State::Running + | State::Retryable, LifecycleEvent::OperatorCancel, ) => Some(State::Cancelled), _ => None, @@ -1200,6 +1205,15 @@ pub fn validate_schedule_event_limit(limit: u32) -> Result<(), StoreError> { } } +pub fn validate_durable_event_limit(limit: u32) -> Result<(), StoreError> { + if limit == 0 || limit > DURABLE_EVENT_LIMIT { + return Err(StoreError::Invalid( + "durable event limit must be between 1 and 100".into(), + )); + } + Ok(()) +} + pub struct RateClassState { pub name: String, pub tokens_available: i64, @@ -1359,6 +1373,23 @@ pub struct ScheduleEvent { pub recorded_at_ms: i64, } +pub const DURABLE_EVENT_LIMIT: u32 = 100; +pub const MAX_DURABLE_EVENT_PAYLOAD_BYTES: usize = 64 * 1024; +pub const MAX_DURABLE_EVENT_SOURCE_BYTES: usize = 16 * 1024; + +/// One bounded, store-timestamped fact attached to an application scope. Payload and +/// source contain valid JSON so every backend preserves the same value. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct DurableEvent { + pub event_id: u64, + pub scope: String, + pub topic: String, + pub idempotency_key: String, + pub payload: Vec, + pub source: Vec, + pub recorded_at_ms: i64, +} + #[derive(Clone, Debug, Default)] pub struct WorkerMeta { pub worker_id: String, @@ -1522,7 +1553,8 @@ pub trait Inspect: Store { /// available (`operator_release`) and new enqueues are accepted again. Returns how /// many jobs were released. A released job re-quarantines on its next crash. async fn quarantine_release(&self, fingerprint: &str) -> Result; - /// `archived|cancelled → available` (`operator_retry`). Any other state is an + /// `archived|cancelled|undecodable → available` (`operator_retry`). Undecodable + /// jobs must have their payload/schema repaired before this call. Any other state is an /// error — the transition table defines exactly which rows exist. async fn operator_retry(&self, id: &str) -> Result<(), StoreError>; /// `scheduled|available|running → cancelled` (`operator_cancel`). Cancelling a @@ -1531,6 +1563,16 @@ pub trait Inspect: Store { async fn operator_cancel(&self, id: &str) -> Result<(), StoreError>; /// `pending -> available`. No timer or dependency watcher may perform this change. async fn promote_job(&self, id: &str) -> Result<(), StoreError>; + /// `pending -> scheduled` at an absolute store-clock timestamp. Workflow-relative + /// timers use this after reading the store-stamped completion time of every + /// dependency; implementations must perform the state and timestamp change as one + /// operation. The default keeps third-party inspection adapters source-compatible + /// while making lack of this capability explicit at runtime. + async fn schedule_pending_job(&self, _id: &str, _at_ms: i64) -> Result<(), StoreError> { + Err(StoreError::Invalid( + "scheduling a pending job is not supported by this backend".into(), + )) + } /// Delete a non-running job. Deleting mid-flight is refused (asynq's rule). async fn delete_job(&self, id: &str) -> Result<(), StoreError>; async fn explain_admission(&self, id: &str) -> Result, StoreError>; @@ -1589,6 +1631,29 @@ pub trait Inspect: Store { limit: u32, ) -> Result, StoreError>; + /// Append one idempotent event and retain at most [`DURABLE_EVENT_LIMIT`] events + /// per scope. The bool is true only when this call inserted the returned record. + async fn append_durable_event( + &self, + _event: &DurableEvent, + ) -> Result<(DurableEvent, bool), StoreError> { + Err(StoreError::Invalid( + "durable events are not supported by this backend".into(), + )) + } + + /// Newest first. `limit` must be in `1..=DURABLE_EVENT_LIMIT`. + async fn list_durable_events( + &self, + _scope: &str, + _before_event_id: Option, + _limit: u32, + ) -> Result, StoreError> { + Err(StoreError::Invalid( + "durable events are not supported by this backend".into(), + )) + } + // ----- worker registry + surveyed policy behavior server->worker control channel ----- /// Upsert the worker row and return any pending operator COMMAND for it — the @@ -2661,7 +2726,7 @@ mod tests { // Pinned on purpose: adding or removing a transition must be deliberate — the // yaml's own invariant requires a conformance scenario per new row. assert_eq!( - rows, 23, + rows, 25, "state_machine.yaml row count changed; update the table AND its scenarios" ); } diff --git a/crates/headgate-crypto/tests/live.rs b/crates/headgate-crypto/tests/live.rs index 8511ff9..d3dc5e7 100644 --- a/crates/headgate-crypto/tests/live.rs +++ b/crates/headgate-crypto/tests/live.rs @@ -51,7 +51,10 @@ async fn live_store_holds_ciphertext_while_handler_receives_plaintext() { .windows(plaintext.len()) .any(|w| w == plaintext) ); - store.enqueue(&[encrypted.clone()]).await.unwrap(); + store + .enqueue(std::slice::from_ref(&encrypted)) + .await + .unwrap(); let stored = store .get_job(&id, true) .await diff --git a/crates/headgate-migrate/migrations/mysql/0013_durable_events.down.sql b/crates/headgate-migrate/migrations/mysql/0013_durable_events.down.sql new file mode 100644 index 0000000..106c075 --- /dev/null +++ b/crates/headgate-migrate/migrations/mysql/0013_durable_events.down.sql @@ -0,0 +1,2 @@ +DROP TABLE headgate_durable_event; +DROP TABLE headgate_durable_event_scope; diff --git a/crates/headgate-migrate/migrations/mysql/0013_durable_events.up.sql b/crates/headgate-migrate/migrations/mysql/0013_durable_events.up.sql new file mode 100644 index 0000000..4eceb1d --- /dev/null +++ b/crates/headgate-migrate/migrations/mysql/0013_durable_events.up.sql @@ -0,0 +1,17 @@ +CREATE TABLE headgate_durable_event_scope ( + scope VARCHAR(512) NOT NULL PRIMARY KEY +); + +CREATE TABLE headgate_durable_event ( + id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + scope VARCHAR(512) NOT NULL, + topic VARCHAR(255) NOT NULL, + idempotency_key VARCHAR(255) NOT NULL, + payload LONGBLOB NOT NULL, + source LONGBLOB NOT NULL, + recorded_at_ms BIGINT NOT NULL, + UNIQUE KEY headgate_durable_event_idempotency (scope, idempotency_key), + KEY headgate_durable_event_recent (scope, id DESC), + CONSTRAINT headgate_durable_event_scope_fk FOREIGN KEY (scope) + REFERENCES headgate_durable_event_scope(scope) ON DELETE CASCADE +); diff --git a/crates/headgate-migrate/migrations/postgres/0013_durable_events.down.sql b/crates/headgate-migrate/migrations/postgres/0013_durable_events.down.sql new file mode 100644 index 0000000..106c075 --- /dev/null +++ b/crates/headgate-migrate/migrations/postgres/0013_durable_events.down.sql @@ -0,0 +1,2 @@ +DROP TABLE headgate_durable_event; +DROP TABLE headgate_durable_event_scope; diff --git a/crates/headgate-migrate/migrations/postgres/0013_durable_events.up.sql b/crates/headgate-migrate/migrations/postgres/0013_durable_events.up.sql new file mode 100644 index 0000000..308f8d2 --- /dev/null +++ b/crates/headgate-migrate/migrations/postgres/0013_durable_events.up.sql @@ -0,0 +1,17 @@ +CREATE TABLE headgate_durable_event_scope ( + scope text PRIMARY KEY +); + +CREATE TABLE headgate_durable_event ( + id bigserial PRIMARY KEY, + scope text NOT NULL REFERENCES headgate_durable_event_scope(scope) ON DELETE CASCADE, + topic text NOT NULL, + idempotency_key text NOT NULL, + payload bytea NOT NULL, + source bytea NOT NULL, + recorded_at_ms bigint NOT NULL, + UNIQUE (scope, idempotency_key) +); + +CREATE INDEX headgate_durable_event_recent + ON headgate_durable_event (scope, id DESC); diff --git a/crates/headgate-migrate/src/bin/hg_migrate.rs b/crates/headgate-migrate/src/bin/hg_migrate.rs index 66a7a22..afb5121 100644 --- a/crates/headgate-migrate/src/bin/hg_migrate.rs +++ b/crates/headgate-migrate/src/bin/hg_migrate.rs @@ -242,7 +242,7 @@ fn print_steps(result: &headgate_migrate::MigrateResult) { async fn run_postgres(cli: &Cli, url: &str) -> Result<(), MigrationError> { let (mut client, connection) = tokio_postgres::connect(url, NoTls).await?; - let driver = tokio::spawn(async move { connection.await }); + let driver = tokio::spawn(connection); match cli.command { Command::Up => { let result = match cli.schema.as_deref() { diff --git a/crates/headgate-migrate/src/lib.rs b/crates/headgate-migrate/src/lib.rs index 4fcecc3..f4cbbe9 100644 --- a/crates/headgate-migrate/src/lib.rs +++ b/crates/headgate-migrate/src/lib.rs @@ -177,6 +177,13 @@ const POSTGRES_MIGRATIONS: &[Migration] = &[ down_sql: include_str!("../migrations/postgres/0012_worker_control_state.down.sql"), online_safe: true, }, + Migration { + version: 13, + name: "durable_events", + up_sql: include_str!("../migrations/postgres/0013_durable_events.up.sql"), + down_sql: include_str!("../migrations/postgres/0013_durable_events.down.sql"), + online_safe: true, + }, ]; const MYSQL_MIGRATIONS: &[Migration] = &[ @@ -264,6 +271,13 @@ const MYSQL_MIGRATIONS: &[Migration] = &[ down_sql: include_str!("../migrations/mysql/0012_worker_control_state.down.sql"), online_safe: false, }, + Migration { + version: 13, + name: "durable_events", + up_sql: include_str!("../migrations/mysql/0013_durable_events.up.sql"), + down_sql: include_str!("../migrations/mysql/0013_durable_events.down.sql"), + online_safe: true, + }, ]; pub const fn migrations(backend: Backend) -> &'static [Migration] { @@ -512,7 +526,7 @@ mod tests { .unwrap(); assert_eq!( up.iter().map(|s| s.migration.version).collect::>(), - [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] ); let current = [ @@ -528,6 +542,7 @@ mod tests { applied(10), applied(11), applied(12), + applied(13), ]; assert!( plan( @@ -548,7 +563,7 @@ mod tests { .unwrap(); assert_eq!( down.iter().map(|s| s.migration.version).collect::>(), - [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1] + [13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1] ); } @@ -602,7 +617,7 @@ mod tests { &[], Direction::Up, MigrateOptions { - target_version: Some(13), + target_version: Some(14), ..MigrateOptions::default() } ), diff --git a/crates/headgate-migrate/src/mysql.rs b/crates/headgate-migrate/src/mysql.rs index 1a330ff..86b7392 100644 --- a/crates/headgate-migrate/src/mysql.rs +++ b/crates/headgate-migrate/src/mysql.rs @@ -528,8 +528,10 @@ fn split_statements(sql: &str) -> Result, MigrationError> { Mode::Backtick => '`', _ => unreachable!(), }; - if ch == '\\' && next.is_some() { - statement.push(next.unwrap()); + if ch == '\\' + && let Some(next) = next + { + statement.push(next); i += 2; continue; } diff --git a/crates/headgate-migrate/src/schema.rs b/crates/headgate-migrate/src/schema.rs index c15d227..6898df4 100644 --- a/crates/headgate-migrate/src/schema.rs +++ b/crates/headgate-migrate/src/schema.rs @@ -35,6 +35,8 @@ pub(crate) const TABLES: &[&str] = &[ "headgate_duty", "headgate_schedule", "headgate_schedule_event", + "headgate_durable_event_scope", + "headgate_durable_event", "headgate_worker", "headgate_effect", "headgate_operation", @@ -94,6 +96,8 @@ required_columns!(POSTGRES_COLUMNS { "headgate_schedule_event" => [ "id", "schedule_id", "tick_ms", "job_id", "outcome", "reason", "recorded_at_ms" ], + "headgate_durable_event_scope" => ["scope"], + "headgate_durable_event" => ["id", "scope", "topic", "idempotency_key", "payload", "source", "recorded_at_ms"], "headgate_worker" => [ "worker_id", "host", "pid", "queues", "concurrency", "started_at_ms", "heartbeat_at_ms", "command", "inflight", "polls", "empty_polls", "status", @@ -164,6 +168,8 @@ required_columns!(MYSQL_COLUMNS { "headgate_schedule_event" => [ "id", "schedule_id", "tick_ms", "job_id", "outcome", "reason", "recorded_at_ms" ], + "headgate_durable_event_scope" => ["scope"], + "headgate_durable_event" => ["id", "scope", "topic", "idempotency_key", "payload", "source", "recorded_at_ms"], "headgate_worker" => [ "worker_id", "host", "pid", "queues", "concurrency", "started_at_ms", "heartbeat_at_ms", "command", "inflight", "polls", "empty_polls" @@ -203,6 +209,7 @@ pub(crate) const POSTGRES_INDEXES: &[&str] = &[ "headgate_partition_counter_recent", "headgate_schedule_due", "headgate_schedule_event_recent", + "headgate_durable_event_recent", "headgate_job_archive_queue_time", ]; @@ -225,6 +232,7 @@ pub(crate) const MYSQL_INDEXES: &[&str] = &[ "headgate_partition_counter_recent", "headgate_schedule_due", "headgate_schedule_event_recent", + "headgate_durable_event_recent", "headgate_job_archive_queue_time", ]; diff --git a/crates/headgate-migrate/tests/live.rs b/crates/headgate-migrate/tests/live.rs index 221d69f..ea9067e 100644 --- a/crates/headgate-migrate/tests/live.rs +++ b/crates/headgate-migrate/tests/live.rs @@ -20,7 +20,7 @@ async fn live_postgres_migration_lifecycle_and_drift_rejection() { let (admin, admin_driver) = tokio_postgres::connect(&conninfo, tokio_postgres::NoTls) .await .expect("admin connect"); - let admin_task = tokio::spawn(async move { admin_driver.await }); + let admin_task = tokio::spawn(admin_driver); let exists: i64 = admin .query_one( "SELECT count(*) FROM information_schema.schemata WHERE schema_name = $1", @@ -38,7 +38,7 @@ async fn live_postgres_migration_lifecycle_and_drift_rejection() { let (mut client, driver) = tokio_postgres::connect(&conninfo, tokio_postgres::NoTls) .await .expect("test connect"); - let driver_task = tokio::spawn(async move { driver.await }); + let driver_task = tokio::spawn(driver); client .batch_execute(&format!("SET search_path TO {schema}")) .await @@ -46,14 +46,14 @@ async fn live_postgres_migration_lifecycle_and_drift_rejection() { let result: Result<(), Box> = async { let up = migrate_postgres(&mut client, Direction::Up, MigrateOptions::default()).await?; - if up.steps.len() != 12 + if up.steps.len() != 13 || up.steps[0].migration.version != 1 - || up.steps[11].migration.version != 12 + || up.steps[12].migration.version != 13 { return Err(test_error(format!("fresh up steps = {:?}", up.steps))); } let validation = validate_postgres(&client).await?; - if !validation.is_ok() || validation.current_version != 12 { + if !validation.is_ok() || validation.current_version != 13 { return Err(test_error(format!("fresh validation = {validation:?}"))); } let dry = migrate_postgres( @@ -65,12 +65,12 @@ async fn live_postgres_migration_lifecycle_and_drift_rejection() { }, ) .await?; - if !dry.dry_run || dry.steps.len() != 12 { + if !dry.dry_run || dry.steps.len() != 13 { return Err(test_error(format!("down dry run = {:?}", dry.steps))); } let down = migrate_postgres(&mut client, Direction::Down, MigrateOptions::default()).await?; - if down.steps.len() != 12 { + if down.steps.len() != 13 { return Err(test_error(format!("down steps = {:?}", down.steps))); } let row = client @@ -119,7 +119,7 @@ async fn live_postgres_migration_lifecycle_and_drift_rejection() { )); } let adopted = adopt_postgres(&mut client).await?; - if adopted.last().map(|row| row.version) != Some(12) { + if adopted.last().map(|row| row.version) != Some(13) { return Err(test_error(format!("adopted history = {adopted:?}"))); } if !validate_postgres(&client).await?.is_ok() { @@ -203,14 +203,14 @@ async fn live_mysql_migration_lifecycle_and_drift_rejection() { let mut conn = pool.get_conn().await.expect("test connect"); let result: Result<(), Box> = async { let up = migrate_mysql(&mut conn, Direction::Up, MigrateOptions::default()).await?; - if up.steps.len() != 12 + if up.steps.len() != 13 || up.steps[0].migration.version != 1 - || up.steps[11].migration.version != 12 + || up.steps[12].migration.version != 13 { return Err(test_error(format!("fresh up steps = {:?}", up.steps))); } let validation = validate_mysql(&mut conn).await?; - if !validation.is_ok() || validation.current_version != 12 { + if !validation.is_ok() || validation.current_version != 13 { return Err(test_error(format!("fresh validation = {validation:?}"))); } let dry = migrate_mysql( @@ -222,11 +222,11 @@ async fn live_mysql_migration_lifecycle_and_drift_rejection() { }, ) .await?; - if !dry.dry_run || dry.steps.len() != 12 { + if !dry.dry_run || dry.steps.len() != 13 { return Err(test_error(format!("down dry run = {:?}", dry.steps))); } let down = migrate_mysql(&mut conn, Direction::Down, MigrateOptions::default()).await?; - if down.steps.len() != 12 { + if down.steps.len() != 13 { return Err(test_error(format!("down steps = {:?}", down.steps))); } let job_exists: Option = conn @@ -270,7 +270,7 @@ async fn live_mysql_migration_lifecycle_and_drift_rejection() { return Err(test_error("unversioned MySQL schema was migrated as fresh")); } let adopted = adopt_mysql(&mut conn).await?; - if adopted.last().map(|row| row.version) != Some(12) { + if adopted.last().map(|row| row.version) != Some(13) { return Err(test_error(format!("adopted history = {adopted:?}"))); } if !validate_mysql(&mut conn).await?.is_ok() { @@ -393,7 +393,7 @@ async fn live_mysql_configured_lock_namespace_avoids_an_application_lock() { let migrated = tokio::time::timeout(Duration::from_secs(30), &mut migration) .await .map_err(|_| test_error("migration still blocked after configured lock release"))??; - if migrated.steps.len() != 12 { + if migrated.steps.len() != 13 { return Err(test_error(format!( "configured migration steps = {:?}", migrated.steps diff --git a/crates/headgate-mysql/migrations/0013_durable_events.sql b/crates/headgate-mysql/migrations/0013_durable_events.sql new file mode 100644 index 0000000..4eceb1d --- /dev/null +++ b/crates/headgate-mysql/migrations/0013_durable_events.sql @@ -0,0 +1,17 @@ +CREATE TABLE headgate_durable_event_scope ( + scope VARCHAR(512) NOT NULL PRIMARY KEY +); + +CREATE TABLE headgate_durable_event ( + id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + scope VARCHAR(512) NOT NULL, + topic VARCHAR(255) NOT NULL, + idempotency_key VARCHAR(255) NOT NULL, + payload LONGBLOB NOT NULL, + source LONGBLOB NOT NULL, + recorded_at_ms BIGINT NOT NULL, + UNIQUE KEY headgate_durable_event_idempotency (scope, idempotency_key), + KEY headgate_durable_event_recent (scope, id DESC), + CONSTRAINT headgate_durable_event_scope_fk FOREIGN KEY (scope) + REFERENCES headgate_durable_event_scope(scope) ON DELETE CASCADE +); diff --git a/crates/headgate-mysql/src/inspect.rs b/crates/headgate-mysql/src/inspect.rs index cfcd792..fbe8c65 100644 --- a/crates/headgate-mysql/src/inspect.rs +++ b/crates/headgate-mysql/src/inspect.rs @@ -8,11 +8,12 @@ use headgate_core::{ AdmissionExplain, BulkRequest, Checkpoint, CheckpointInspect, ConcurrencyLimitConfig, - HistoryBucket, Inspect, JobFilter, JobOutput, JobPage, JobProgress, JobResult, JobSummary, - MissedPolicy, OperationStatus, OutputInspect, PartitionState, ProgressInspect, QuarantineEntry, - QueueStats, QuietGroupMetrics, RateClassConfig, RateClassState, ResultInspect, - SCHEDULE_EVENT_LIMIT, SaturationStrategy, Schedule, ScheduleEvent, ScheduleEventOutcome, - StateCounts, StoreError, WorkerMeta, noisy_partition_keys, + DURABLE_EVENT_LIMIT, DurableEvent, HistoryBucket, Inspect, JobFilter, JobOutput, JobPage, + JobProgress, JobResult, JobSummary, MissedPolicy, OperationStatus, OutputInspect, + PartitionState, ProgressInspect, QuarantineEntry, QueueStats, QuietGroupMetrics, + RateClassConfig, RateClassState, ResultInspect, SCHEDULE_EVENT_LIMIT, SaturationStrategy, + Schedule, ScheduleEvent, ScheduleEventOutcome, StateCounts, StoreError, WorkerMeta, + noisy_partition_keys, }; use mysql_async::prelude::*; use mysql_async::{Params, Row, TxOpts, Value}; @@ -26,8 +27,6 @@ use headgate_shared::inspection::{ }; const QUIET_PARTITION_LIMIT: usize = SHARED_QUIET_PARTITION_LIMIT as usize; -/// Queue-position lookups cap here; "position >= 1000" is answer enough. - const JOB_COLS: &str = "j.ulid, j.kind, j.queue, CAST(j.state AS CHAR) AS state_text, \ j.schema_version, j.priority, j.attempt, j.crash_attempt, j.max_attempts, \ j.partition_key, j.rate_class, j.sticky_worker, j.weight, j.fingerprint, j.enqueued_at_ms, j.scheduled_at_ms, j.claimed_at_ms, \ @@ -732,7 +731,7 @@ impl Inspect for MysqlStore { tx.exec_drop( "INSERT INTO headgate_active_partition (queue, partition_key) SELECT queue, partition_key FROM headgate_job - WHERE ulid = ? AND state IN ('archived', 'cancelled') + WHERE ulid = ? AND state IN ('archived', 'cancelled', 'undecodable') ON DUPLICATE KEY UPDATE queue = VALUES(queue)", (id,), ) @@ -742,7 +741,7 @@ impl Inspect for MysqlStore { format!( "UPDATE headgate_job SET state = 'available', scheduled_at_ms = {NOW_MS}, finalized_at_ms = NULL - WHERE ulid = ? AND state IN ('archived', 'cancelled')" + WHERE ulid = ? AND state IN ('archived', 'cancelled', 'undecodable')" ), (id,), ) @@ -756,7 +755,7 @@ impl Inspect for MysqlStore { match self.job_state(id).await? { None => Err(StoreError::NotFound(format!("job {id}"))), Some(state) => Err(StoreError::Invalid(format!( - "operator_retry is only defined from archived or cancelled; job {id} is {state}" + "operator_retry is only defined from archived, cancelled, or undecodable; job {id} is {state}" ))), } } @@ -785,7 +784,7 @@ impl Inspect for MysqlStore { "UPDATE headgate_job SET state = 'cancelled', lease_id = NULL, lease_expires_at_ms = NULL, claimed_by = NULL, finalized_at_ms = {NOW_MS} - WHERE ulid = ? AND state IN ('pending', 'scheduled', 'available', 'running')" + WHERE ulid = ? AND state IN ('pending', 'scheduled', 'available', 'running', 'retryable')" ), (id,), ) @@ -1187,6 +1186,99 @@ impl Inspect for MysqlStore { .collect() } + async fn append_durable_event( + &self, + event: &DurableEvent, + ) -> Result<(DurableEvent, bool), StoreError> { + validate_durable_event(event)?; + let mut c = self.raw_conn().await?; + let mut tx = c + .start_transaction(TxOpts::default()) + .await + .map_err(map_err)?; + tx.exec_drop( + "INSERT IGNORE INTO headgate_durable_event_scope(scope) VALUES(?)", + (&event.scope,), + ) + .await + .map_err(map_err)?; + let _: String = tx + .exec_first( + "SELECT scope FROM headgate_durable_event_scope WHERE scope=? FOR UPDATE", + (&event.scope,), + ) + .await + .map_err(map_err)? + .ok_or_else(|| StoreError::Invalid("durable event scope was not created".into()))?; + let existing: Option = tx.exec_first( + "SELECT id,topic,payload,source,recorded_at_ms FROM headgate_durable_event WHERE scope=? AND idempotency_key=?", + (&event.scope, &event.idempotency_key), + ).await.map_err(map_err)?; + let inserted = existing.is_none(); + if inserted { + tx.exec_drop( + format!("INSERT INTO headgate_durable_event(scope,topic,idempotency_key,payload,source,recorded_at_ms) VALUES(?,?,?,?,?,{NOW_MS})"), + (&event.scope, &event.topic, &event.idempotency_key, &event.payload, &event.source), + ).await.map_err(map_err)?; + } + let row: Row = tx.exec_first( + "SELECT id,topic,payload,source,recorded_at_ms FROM headgate_durable_event WHERE scope=? AND idempotency_key=?", + (&event.scope, &event.idempotency_key), + ).await.map_err(map_err)?.ok_or_else(|| StoreError::Invalid("durable event was not stored".into()))?; + let topic: String = row.get("topic").unwrap_or_default(); + let payload: Vec = row.get("payload").unwrap_or_default(); + let source: Vec = row.get("source").unwrap_or_default(); + if topic != event.topic || payload != event.payload || source != event.source { + return Err(StoreError::Invalid( + "durable event idempotency key was reused with different content".into(), + )); + } + let id: u64 = row.get("id").unwrap_or_default(); + let recorded_at_ms: i64 = row.get("recorded_at_ms").unwrap_or_default(); + tx.exec_drop( + "DELETE e FROM headgate_durable_event e LEFT JOIN + (SELECT id FROM headgate_durable_event WHERE scope=? ORDER BY id DESC LIMIT ?) keep ON keep.id=e.id + WHERE e.scope=? AND keep.id IS NULL", + (&event.scope, DURABLE_EVENT_LIMIT, &event.scope), + ).await.map_err(map_err)?; + tx.commit().await.map_err(map_err)?; + Ok(( + DurableEvent { + event_id: id, + recorded_at_ms, + ..event.clone() + }, + inserted, + )) + } + + async fn list_durable_events( + &self, + scope: &str, + before_event_id: Option, + limit: u32, + ) -> Result, StoreError> { + headgate_core::validate_durable_event_limit(limit)?; + let mut c = self.raw_conn().await?; + let rows: Vec = c.exec( + "SELECT id,scope,topic,idempotency_key,payload,source,recorded_at_ms FROM headgate_durable_event + WHERE scope=? AND (?=0 OR id Result, StoreError> { let mut c = self.raw_conn().await?; let queues = serde_json::to_string(&w.queues).unwrap_or_else(|_| "[]".into()); @@ -1285,12 +1377,12 @@ impl Inspect for MysqlStore { worker_id: &str, command: Option<&str>, ) -> Result<(), StoreError> { - if let Some(cmd) = command { - if !headgate_core::valid_worker_command(cmd) { - return Err(StoreError::Invalid( - "command must be quiet, resume, restart, terminate, or resign".into(), - )); - } + if let Some(cmd) = command + && !headgate_core::valid_worker_command(cmd) + { + return Err(StoreError::Invalid( + "command must be quiet, resume, restart, terminate, or resign".into(), + )); } let mut c = self.raw_conn().await?; // CLIENT_FOUND_ROWS (crate contract): matched-rows semantics, so clearing an @@ -1473,6 +1565,29 @@ impl Inspect for MysqlStore { Ok(()) } + async fn schedule_pending_job(&self, id: &str, at_ms: i64) -> Result<(), StoreError> { + if at_ms <= 0 { + return Err(StoreError::Invalid( + "pending schedule timestamp must be positive".into(), + )); + } + let mut c = self.raw_conn().await?; + c.exec_drop( + "UPDATE headgate_job SET state='scheduled', scheduled_at_ms=? + WHERE ulid=? AND state='pending'", + (at_ms, id), + ) + .await + .map_err(map_err)?; + if c.affected_rows() == 1 { + Ok(()) + } else { + Err(StoreError::Invalid( + "workflow_schedule is defined only from pending".into(), + )) + } + } + async fn delete_queue(&self, queue: &str, force: bool) -> Result, StoreError> { let mut c = self.raw_conn().await?; let mut tx = c @@ -1566,6 +1681,35 @@ impl Inspect for MysqlStore { } } +fn validate_durable_event(event: &DurableEvent) -> Result<(), StoreError> { + if event.scope.is_empty() + || event.scope.len() > 512 + || event.topic.is_empty() + || event.topic.len() > 255 + || event.idempotency_key.is_empty() + || event.idempotency_key.len() > 255 + { + return Err(StoreError::Invalid( + "durable event scope, topic, or idempotency key is invalid".into(), + )); + } + if event.payload.len() > headgate_core::MAX_DURABLE_EVENT_PAYLOAD_BYTES + || serde_json::from_slice::(&event.payload).is_err() + { + return Err(StoreError::Invalid( + "durable event payload must be valid JSON of at most 65536 bytes".into(), + )); + } + if event.source.len() > headgate_core::MAX_DURABLE_EVENT_SOURCE_BYTES + || serde_json::from_slice::(&event.source).is_err() + { + return Err(StoreError::Invalid( + "durable event source must be valid JSON of at most 16384 bytes".into(), + )); + } + Ok(()) +} + #[async_trait::async_trait] impl ResultInspect for MysqlStore { async fn get_job_result(&self, id: &str) -> Result, StoreError> { diff --git a/crates/headgate-mysql/src/lib.rs b/crates/headgate-mysql/src/lib.rs index 20e9398..ddddc46 100644 --- a/crates/headgate-mysql/src/lib.rs +++ b/crates/headgate-mysql/src/lib.rs @@ -356,32 +356,6 @@ fn archive_partition(value: &str) -> Result<(String, String), StoreError> { Ok((format!("p_{value}"), format!("{year:04}-{month:02}-01"))) } -#[cfg(test)] -mod sql_shape_tests { - use super::{enqueue_backpressure_depth_sql, lazy_unique_release_sql, unique_holder_sql}; - - #[test] - fn unique_conflict_queries_stay_on_generated_indexes() { - let release = lazy_unique_release_sql(2); - assert!(release.contains("WHERE unique_throttle IN (?, ?)")); - assert!(!release.contains("WHERE unique_key IN")); - - let holder = unique_holder_sql(2); - assert!(holder.contains("unique_active IN (?, ?)")); - assert!(holder.contains("unique_throttle IN (?, ?)")); - assert!(!holder.contains("WHERE unique_key IN")); - } - - #[test] - fn enqueue_backpressure_hot_path_uses_constant_size_counters() { - let sql = enqueue_backpressure_depth_sql(2).to_ascii_lowercase(); - assert!(sql.contains("headgate_enqueue_policy")); - assert_eq!(sql.matches("headgate_enqueue_counter").count(), 2); - assert!(!sql.contains("headgate_job")); - assert!(!sql.contains("count(")); - } -} - fn map_err(e: mysql_async::Error) -> StoreError { match &e { mysql_async::Error::Io(_) | mysql_async::Error::Driver(_) => { @@ -1898,7 +1872,7 @@ async fn reclaim_tx( .map_err(map_err)? .unwrap_or(0); // lease fencing an expired lease is LeaseLost, NEVER Retry: crash_attempt++, attempt stays. - let rows: Vec<( + type ReclaimRow = ( i64, String, String, @@ -1907,7 +1881,8 @@ async fn reclaim_tx( Option, Option, i64, - )> = tx + ); + let rows: Vec = tx .exec( "SELECT id, ulid, fingerprint, crash_attempt, kind, checkpoint, unique_key, unique_window_ms @@ -2708,3 +2683,29 @@ impl MysqlStore { self.conn().await } } + +#[cfg(test)] +mod sql_shape_tests { + use super::{enqueue_backpressure_depth_sql, lazy_unique_release_sql, unique_holder_sql}; + + #[test] + fn unique_conflict_queries_stay_on_generated_indexes() { + let release = lazy_unique_release_sql(2); + assert!(release.contains("WHERE unique_throttle IN (?, ?)")); + assert!(!release.contains("WHERE unique_key IN")); + + let holder = unique_holder_sql(2); + assert!(holder.contains("unique_active IN (?, ?)")); + assert!(holder.contains("unique_throttle IN (?, ?)")); + assert!(!holder.contains("WHERE unique_key IN")); + } + + #[test] + fn enqueue_backpressure_hot_path_uses_constant_size_counters() { + let sql = enqueue_backpressure_depth_sql(2).to_ascii_lowercase(); + assert!(sql.contains("headgate_enqueue_policy")); + assert_eq!(sql.matches("headgate_enqueue_counter").count(), 2); + assert!(!sql.contains("headgate_job")); + assert!(!sql.contains("count(")); + } +} diff --git a/crates/headgate-mysql/tests/bounded_pool.rs b/crates/headgate-mysql/tests/bounded_pool.rs index 9f1f66a..1e586d8 100644 --- a/crates/headgate-mysql/tests/bounded_pool.rs +++ b/crates/headgate-mysql/tests/bounded_pool.rs @@ -268,7 +268,7 @@ async fn connection_budget_keeps_renewal_acks_and_duties_live_behind_held_transa sampler.await.expect("pool sampler"); let peak = peak_connections.load(Ordering::Relaxed); assert!( - peak >= HELD_TRANSACTIONS && peak <= POOL_BUDGET, + (HELD_TRANSACTIONS..=POOL_BUDGET).contains(&peak), "peak physical MySQL connections={peak}, want {HELD_TRANSACTIONS}..{POOL_BUDGET}" ); // A zero is allowed: the pool can schedule the short transient calls without a diff --git a/crates/headgate-mysql/tests/unique.rs b/crates/headgate-mysql/tests/unique.rs index a4bcdfb..bb6eefb 100644 --- a/crates/headgate-mysql/tests/unique.rs +++ b/crates/headgate-mysql/tests/unique.rs @@ -119,7 +119,8 @@ async fn field(id: &str, col: &str) -> String { async fn generated(id: &str) -> (bool, bool) { use mysql_async::prelude::*; let mut c = raw().await; - let row: Option<(Option>, Option>)> = c + type GeneratedUniqueKeys = (Option>, Option>); + let row: Option = c .exec_first( "SELECT unique_active, unique_throttle FROM headgate_job WHERE ulid = ?", (id,), diff --git a/crates/headgate-postgres/migrations/0013_durable_events.sql b/crates/headgate-postgres/migrations/0013_durable_events.sql new file mode 100644 index 0000000..308f8d2 --- /dev/null +++ b/crates/headgate-postgres/migrations/0013_durable_events.sql @@ -0,0 +1,17 @@ +CREATE TABLE headgate_durable_event_scope ( + scope text PRIMARY KEY +); + +CREATE TABLE headgate_durable_event ( + id bigserial PRIMARY KEY, + scope text NOT NULL REFERENCES headgate_durable_event_scope(scope) ON DELETE CASCADE, + topic text NOT NULL, + idempotency_key text NOT NULL, + payload bytea NOT NULL, + source bytea NOT NULL, + recorded_at_ms bigint NOT NULL, + UNIQUE (scope, idempotency_key) +); + +CREATE INDEX headgate_durable_event_recent + ON headgate_durable_event (scope, id DESC); diff --git a/crates/headgate-postgres/src/inspect.rs b/crates/headgate-postgres/src/inspect.rs index d325e7d..b5dec16 100644 --- a/crates/headgate-postgres/src/inspect.rs +++ b/crates/headgate-postgres/src/inspect.rs @@ -6,11 +6,12 @@ use headgate_core::{ AdmissionExplain, BulkRequest, Checkpoint, CheckpointInspect, ConcurrencyLimitConfig, - HistoryBucket, Inspect, JobFilter, JobOutput, JobPage, JobProgress, JobResult, JobSummary, - MissedPolicy, OperationStatus, OutputInspect, PartitionState, ProgressInspect, QuarantineEntry, - QueueStats, QuietGroupMetrics, RateClassConfig, RateClassState, ResultInspect, - SCHEDULE_EVENT_LIMIT, SaturationStrategy, Schedule, ScheduleEvent, ScheduleEventOutcome, - StateCounts, StoreError, WorkerMeta, noisy_partition_keys, + DURABLE_EVENT_LIMIT, DurableEvent, HistoryBucket, Inspect, JobFilter, JobOutput, JobPage, + JobProgress, JobResult, JobSummary, MissedPolicy, OperationStatus, OutputInspect, + PartitionState, ProgressInspect, QuarantineEntry, QueueStats, QuietGroupMetrics, + RateClassConfig, RateClassState, ResultInspect, SCHEDULE_EVENT_LIMIT, SaturationStrategy, + Schedule, ScheduleEvent, ScheduleEventOutcome, StateCounts, StoreError, WorkerMeta, + noisy_partition_keys, }; use tokio_postgres::types::ToSql; @@ -20,8 +21,6 @@ use crate::{NOW_MS, PgStore, decode_headers, map_pg_err}; use headgate_shared::inspection::{ MAX_PAGE, MEMORY_SAMPLE_LIMIT, POSITION_LIMIT, QUIET_PARTITION_LIMIT, SAMPLE_LIMIT, }; -/// Queue-position lookups cap here; "position >= 1000" is answer enough. - fn job_from_row(row: &tokio_postgres::Row, include_payload: bool) -> JobSummary { JobSummary { id: row.get("ulid"), @@ -271,8 +270,7 @@ impl Inspect for PgStore { // partial index. A noisy tenant's depth therefore cannot become admin work. let part_rows = c .query( - &format!( - r#" + r#" WITH names AS ( SELECT partition_key FROM headgate_active_partition WHERE queue = $1 UNION SELECT partition_key FROM headgate_inflight @@ -298,8 +296,7 @@ impl Inspect for PgStore { ON i.queue = $1 AND i.partition_key = n.partition_key LEFT JOIN rates r ON r.partition_key = n.partition_key ORDER BY n.partition_key - "# - ), + "#, &[ &queue, &(now_ms / 60000 * 60000 - 60000), @@ -671,7 +668,7 @@ impl Inspect for PgStore { WITH upd AS ( UPDATE headgate_job SET state = 'available', scheduled_at_ms = {NOW_MS}, finalized_at_ms = NULL - WHERE ulid = $1 AND state IN ('archived', 'cancelled') + WHERE ulid = $1 AND state IN ('archived', 'cancelled', 'undecodable') RETURNING queue, partition_key ), -- tenant fairness/adaptive admission retry-now makes the row available; list its partition here. @@ -690,7 +687,7 @@ impl Inspect for PgStore { match self.job_state(&c, id).await? { None => Err(StoreError::NotFound(format!("job {id}"))), Some(state) => Err(StoreError::Invalid(format!( - "operator_retry is only defined from archived or cancelled; job {id} is {state}" + "operator_retry is only defined from archived, cancelled, or undecodable; job {id} is {state}" ))), } } @@ -706,7 +703,7 @@ impl Inspect for PgStore { "WITH pick AS ( SELECT j.id, j.queue, j.partition_key, (j.state = 'running') AS was_running FROM headgate_job j - WHERE j.ulid = $1 AND j.state IN ('pending', 'scheduled', 'available', 'running') + WHERE j.ulid = $1 AND j.state IN ('pending', 'scheduled', 'available', 'running', 'retryable') FOR UPDATE ), upd AS ( @@ -1119,6 +1116,107 @@ impl Inspect for PgStore { .collect() } + async fn append_durable_event( + &self, + event: &DurableEvent, + ) -> Result<(DurableEvent, bool), StoreError> { + validate_durable_event(event)?; + let mut c = self.client().await?; + let tx = c.transaction().await.map_err(map_pg_err)?; + tx.execute( + "INSERT INTO headgate_durable_event_scope(scope) VALUES($1) ON CONFLICT DO NOTHING", + &[&event.scope], + ) + .await + .map_err(map_pg_err)?; + tx.query_one( + "SELECT scope FROM headgate_durable_event_scope WHERE scope=$1 FOR UPDATE", + &[&event.scope], + ) + .await + .map_err(map_pg_err)?; + let sql = format!( + "INSERT INTO headgate_durable_event(scope,topic,idempotency_key,payload,source,recorded_at_ms) + VALUES($1,$2,$3,$4,$5,{NOW_MS}) ON CONFLICT(scope,idempotency_key) DO NOTHING + RETURNING id,recorded_at_ms" + ); + let inserted = tx + .query( + &sql, + &[ + &event.scope as &(dyn ToSql + Sync), + &event.topic, + &event.idempotency_key, + &event.payload, + &event.source, + ], + ) + .await + .map_err(map_pg_err)? + .into_iter() + .next(); + let (id, recorded_at_ms, was_inserted) = if let Some(row) = inserted { + (row.get::<_, i64>(0) as u64, row.get(1), true) + } else { + let row = tx.query_one( + "SELECT id,topic,payload,source,recorded_at_ms FROM headgate_durable_event WHERE scope=$1 AND idempotency_key=$2", + &[&event.scope, &event.idempotency_key], + ).await.map_err(map_pg_err)?; + let topic: String = row.get(1); + let payload: Vec = row.get(2); + let source: Vec = row.get(3); + if topic != event.topic || payload != event.payload || source != event.source { + return Err(StoreError::Invalid( + "durable event idempotency key was reused with different content".into(), + )); + } + (row.get::<_, i64>(0) as u64, row.get(4), false) + }; + tx.execute( + "DELETE FROM headgate_durable_event WHERE scope=$1 AND id NOT IN + (SELECT id FROM headgate_durable_event WHERE scope=$1 ORDER BY id DESC LIMIT $2)", + &[&event.scope, &(DURABLE_EVENT_LIMIT as i64)], + ) + .await + .map_err(map_pg_err)?; + tx.commit().await.map_err(map_pg_err)?; + Ok(( + DurableEvent { + event_id: id, + recorded_at_ms, + ..event.clone() + }, + was_inserted, + )) + } + + async fn list_durable_events( + &self, + scope: &str, + before_event_id: Option, + limit: u32, + ) -> Result, StoreError> { + headgate_core::validate_durable_event_limit(limit)?; + let c = self.client().await?; + let rows = c.query( + "SELECT id,scope,topic,idempotency_key,payload,source,recorded_at_ms FROM headgate_durable_event + WHERE scope=$1 AND ($2::bigint IS NULL OR id<$2) ORDER BY id DESC LIMIT $3", + &[&scope, &before_event_id.map(|id| id as i64), &(limit as i64)], + ).await.map_err(map_pg_err)?; + Ok(rows + .into_iter() + .map(|row| DurableEvent { + event_id: row.get::<_, i64>("id") as u64, + scope: row.get("scope"), + topic: row.get("topic"), + idempotency_key: row.get("idempotency_key"), + payload: row.get("payload"), + source: row.get("source"), + recorded_at_ms: row.get("recorded_at_ms"), + }) + .collect()) + } + async fn heartbeat_worker(&self, w: &WorkerMeta) -> Result, StoreError> { let c = self.client().await?; let status = if w.status.is_empty() { @@ -1171,12 +1269,12 @@ impl Inspect for PgStore { worker_id: &str, command: Option<&str>, ) -> Result<(), StoreError> { - if let Some(cmd) = command { - if !headgate_core::valid_worker_command(cmd) { - return Err(StoreError::Invalid( - "command must be quiet, resume, restart, terminate, or resign".into(), - )); - } + if let Some(cmd) = command + && !headgate_core::valid_worker_command(cmd) + { + return Err(StoreError::Invalid( + "command must be quiet, resume, restart, terminate, or resign".into(), + )); } let c = self.client().await?; let n = c @@ -1394,6 +1492,30 @@ impl Inspect for PgStore { Ok(()) } + async fn schedule_pending_job(&self, id: &str, at_ms: i64) -> Result<(), StoreError> { + if at_ms <= 0 { + return Err(StoreError::Invalid( + "pending schedule timestamp must be positive".into(), + )); + } + let c = self.client().await?; + let n = c + .execute( + "UPDATE headgate_job SET state = 'scheduled', scheduled_at_ms = $2 + WHERE ulid = $1 AND state = 'pending'", + &[&id, &at_ms], + ) + .await + .map_err(map_pg_err)?; + if n == 1 { + Ok(()) + } else { + Err(StoreError::Invalid( + "workflow_schedule is defined only from pending".into(), + )) + } + } + async fn delete_queue(&self, queue: &str, force: bool) -> Result, StoreError> { let mut c = self.client().await?; let tx = c.transaction().await.map_err(map_pg_err)?; @@ -1486,6 +1608,35 @@ impl Inspect for PgStore { } } +fn validate_durable_event(event: &DurableEvent) -> Result<(), StoreError> { + if event.scope.is_empty() + || event.scope.len() > 512 + || event.topic.is_empty() + || event.topic.len() > 255 + || event.idempotency_key.is_empty() + || event.idempotency_key.len() > 255 + { + return Err(StoreError::Invalid( + "durable event scope, topic, or idempotency key is invalid".into(), + )); + } + if event.payload.len() > headgate_core::MAX_DURABLE_EVENT_PAYLOAD_BYTES + || serde_json::from_slice::(&event.payload).is_err() + { + return Err(StoreError::Invalid( + "durable event payload must be valid JSON of at most 65536 bytes".into(), + )); + } + if event.source.len() > headgate_core::MAX_DURABLE_EVENT_SOURCE_BYTES + || serde_json::from_slice::(&event.source).is_err() + { + return Err(StoreError::Invalid( + "durable event source must be valid JSON of at most 16384 bytes".into(), + )); + } + Ok(()) +} + #[async_trait::async_trait] impl ResultInspect for PgStore { async fn get_job_result(&self, id: &str) -> Result, StoreError> { diff --git a/crates/headgate-postgres/src/lib.rs b/crates/headgate-postgres/src/lib.rs index f3994fb..2a49677 100644 --- a/crates/headgate-postgres/src/lib.rs +++ b/crates/headgate-postgres/src/lib.rs @@ -895,6 +895,7 @@ impl PgStore { /// block a producer, never deadlock with a concurrent pruner); /// 2. in a SECOND statement, which under READ COMMITTED takes a FRESH snapshot, /// delete only those with no available job left. + /// /// One statement cannot do this. All CTEs in a statement share one snapshot, so a /// producer that committed after that snapshot is invisible, and the delete would /// strand its job — the one direction of staleness that is a correctness bug. With @@ -1416,6 +1417,7 @@ impl PgStore { /// lifecycle state machine apply the transition table on an explicit client/transaction. Every /// statement re-checks `(ulid, lease_id, fence, state='running')`, so a superseded /// holder gets `LeaseRejected` — an error the worker must handle, never a no-op. + #[allow(clippy::too_many_arguments)] // Keeps every ack policy inside the caller's transaction. async fn ack_on( &self, c: &C, @@ -2191,7 +2193,7 @@ impl headgate_core::Notifying for PgStore { match tokio::time::timeout_at(deadline, rx.recv()).await { Err(_) => return Ok(None), // timeout: the poll fallback takes it Ok(Ok(queue)) => { - if queues.is_empty() || queues.iter().any(|q| *q == queue) { + if queues.is_empty() || queues.contains(&queue) { return Ok(Some(queue)); } } @@ -2487,12 +2489,12 @@ impl PgTx { impl Drop for PgTx { fn drop(&mut self) { - if !self.done { - if let Some(client) = self.conn.take() { - // Take the connection out of the pool for good; closing it makes the - // server abort the open transaction. - let _ = Object::take(client.inner); - } + if !self.done + && let Some(client) = self.conn.take() + { + // Take the connection out of the pool for good; closing it makes the + // server abort the open transaction. + let _ = Object::take(client.inner); } } } diff --git a/crates/headgate-postgres/tests/bounded_pool.rs b/crates/headgate-postgres/tests/bounded_pool.rs index 5be7372..2b18019 100644 --- a/crates/headgate-postgres/tests/bounded_pool.rs +++ b/crates/headgate-postgres/tests/bounded_pool.rs @@ -184,7 +184,7 @@ async fn connection_budget_keeps_renewal_acks_and_duties_live_behind_held_transa let (admin, admin_driver) = tokio_postgres::connect(&conninfo, NoTls) .await .expect("admin connect"); - let admin_task = tokio::spawn(async move { admin_driver.await }); + let admin_task = tokio::spawn(admin_driver); let queue = format!("cb-rust-pg-{}", std::process::id()); let worker_id = format!("cb-rust-pg-w-{}", std::process::id()); admin diff --git a/crates/headgate-redis/lua/admin.lua b/crates/headgate-redis/lua/admin.lua index fed1cca..2311bc7 100644 --- a/crates/headgate-redis/lua/admin.lua +++ b/crates/headgate-redis/lua/admin.lua @@ -95,7 +95,7 @@ local function do_cancel(id, h) if ret > 0 then redis.call('ZADD', p .. ':ret', now + ret, id) end end --- archived|cancelled -> available (operator_retry). +-- archived|cancelled|undecodable -> available (operator_retry). local function do_retry(id, h) local st, q, part, fp = h[1], h[2], h[3], h[4] local uk, uw = h[5], tonumber(h[6] or '0') or 0 @@ -141,7 +141,7 @@ if op == 'cancel' then local id = ARGV[2] local h = job_head(id) if not h[1] then return {'NF'} end - if h[1] ~= 'pending' and h[1] ~= 'scheduled' and h[1] ~= 'available' and h[1] ~= 'running' then + if h[1] ~= 'pending' and h[1] ~= 'scheduled' and h[1] ~= 'available' and h[1] ~= 'running' and h[1] ~= 'retryable' then return {'ERR', h[1]} end do_cancel(id, h) @@ -159,6 +159,17 @@ elseif op == 'promote' then redis.call('ZADD', p .. ':avail:' .. h[2] .. ':' .. h[3], now, id) redis.call('ZADD', p .. ':metricparts:' .. h[2], now, h[3]) return {'OK'} +elseif op == 'schedule_pending' then + local id, at = ARGV[2], tonumber(ARGV[3]) + local h = job_head(id) + if not h[1] then return {'NF'} end + if h[1] ~= 'pending' or not at or at <= 0 then return {'ERR', h[1]} end + redis.call('ZREM', idx(h[2], 'pending'), id) + redis.call('ZADD', idx(h[2], 'scheduled'), at, id) + redis.call('ZADD', p .. ':sched', at, id) + add_waiting(id, h[2], h[3], h[8], at) + redis.call('HSET', jk(id), 'state', 'scheduled', 'scheduled_at_ms', at) + return {'OK'} elseif op == 'queue_delete' then local q, force, opid = ARGV[2], ARGV[3] == '1', ARGV[4] @@ -187,7 +198,7 @@ elseif op == 'retry' then local id = ARGV[2] local h = job_head(id) if not h[1] then return {'NF'} end - if h[1] ~= 'archived' and h[1] ~= 'cancelled' then return {'ERR', h[1]} end + if h[1] ~= 'archived' and h[1] ~= 'cancelled' and h[1] ~= 'undecodable' then return {'ERR', h[1]} end local holder = do_retry(id, h) if holder then return {'DUP', holder} end return {'OK'} diff --git a/crates/headgate-redis/src/inspect.rs b/crates/headgate-redis/src/inspect.rs index e2f2a65..60e68ac 100644 --- a/crates/headgate-redis/src/inspect.rs +++ b/crates/headgate-redis/src/inspect.rs @@ -9,11 +9,12 @@ use headgate_core::{ AdmissionExplain, BulkRequest, Checkpoint, CheckpointInspect, ConcurrencyLimitConfig, - HistoryBucket, Inspect, JobFilter, JobOutput, JobPage, JobProgress, JobResult, JobSummary, - MissedPolicy, OperationStatus, OutputInspect, PartitionState, ProgressInspect, QuarantineEntry, - QueueStats, QuietGroupMetrics, RateClassConfig, RateClassState, ResultInspect, - SCHEDULE_EVENT_LIMIT, SaturationStrategy, Schedule, ScheduleEvent, ScheduleEventOutcome, - StateCounts, StoreError, WorkerMeta, noisy_partition_keys, + DURABLE_EVENT_LIMIT, DurableEvent, HistoryBucket, Inspect, JobFilter, JobOutput, JobPage, + JobProgress, JobResult, JobSummary, MissedPolicy, OperationStatus, OutputInspect, + PartitionState, ProgressInspect, QuarantineEntry, QueueStats, QuietGroupMetrics, + RateClassConfig, RateClassState, ResultInspect, SCHEDULE_EVENT_LIMIT, SaturationStrategy, + Schedule, ScheduleEvent, ScheduleEventOutcome, StateCounts, StoreError, WorkerMeta, + noisy_partition_keys, }; use crate::{JobHash, RedisStore, decode_headers, hn, hs, map_redis_err}; @@ -171,35 +172,35 @@ fn matches_filter(h: &JobHash, f: &JobFilter) -> bool { if !f.tags_any.is_empty() && !f.tags_any.iter().any(|tag| tags.contains(tag)) { return false; } - if let Some(k) = &f.kind { - if hs(h, "kind") != k { - return false; - } + if let Some(k) = &f.kind + && hs(h, "kind") != k + { + return false; } - if let Some(kp) = &f.kind_prefix { - if !hs(h, "kind").starts_with(kp.as_str()) { - return false; - } + if let Some(kp) = &f.kind_prefix + && !hs(h, "kind").starts_with(kp.as_str()) + { + return false; } - if let Some(p) = &f.partition_key { - if hs(h, "partition_key") != p { - return false; - } + if let Some(p) = &f.partition_key + && hs(h, "partition_key") != p + { + return false; } - if let Some(fp) = &f.fingerprint { - if hs(h, "fingerprint") != fp { - return false; - } + if let Some(fp) = &f.fingerprint + && hs(h, "fingerprint") != fp + { + return false; } - if let Some(rc) = &f.rate_class { - if hs(h, "rate_class") != rc { - return false; - } + if let Some(rc) = &f.rate_class + && hs(h, "rate_class") != rc + { + return false; } - if let Some(pr) = f.priority { - if hn(h, "priority") as i32 != pr { - return false; - } + if let Some(pr) = f.priority + && hn(h, "priority") as i32 != pr + { + return false; } true } @@ -870,7 +871,7 @@ impl Inspect for RedisStore { reason: hs(m, "reason").to_string(), }) .collect(); - out.sort_by(|a, b| b.quarantined_at_ms.cmp(&a.quarantined_at_ms)); + out.sort_by_key(|entry| std::cmp::Reverse(entry.quarantined_at_ms)); Ok(out) } @@ -894,7 +895,7 @@ impl Inspect for RedisStore { replaced: false, }), _ => Err(StoreError::Invalid(format!( - "operator_retry is only defined from archived or cancelled; job {id} is {}", + "operator_retry is only defined from archived, cancelled, or undecodable; job {id} is {}", res.get(1).map(String::as_str).unwrap_or("?") ))), } @@ -1241,6 +1242,91 @@ impl Inspect for RedisStore { .collect() } + async fn append_durable_event( + &self, + event: &DurableEvent, + ) -> Result<(DurableEvent, bool), StoreError> { + validate_durable_event(event)?; + let payload = std::str::from_utf8(&event.payload) + .map_err(|_| StoreError::Invalid("durable event payload must be UTF-8 JSON".into()))?; + let source = std::str::from_utf8(&event.source) + .map_err(|_| StoreError::Invalid("durable event source must be UTF-8 JSON".into()))?; + serde_json::from_str::(payload) + .map_err(|_| StoreError::Invalid("durable event payload must be valid JSON".into()))?; + serde_json::from_str::(source) + .map_err(|_| StoreError::Invalid("durable event source must be valid JSON".into()))?; + let now = self.store_now_ms().await?; + let mut conn = self.conn.clone(); + let script = redis::Script::new( + "local old=redis.call('HGET',KEYS[2],ARGV[2])\n\ + if old then return {'0',old} end\n\ + local id=redis.call('INCR',KEYS[3])\n\ + local value=cjson.encode({event_id=id,scope=ARGV[1],topic=ARGV[3],idempotency_key=ARGV[2],payload=ARGV[4],source=ARGV[5],recorded_at_ms=tonumber(ARGV[6])})\n\ + redis.call('HSET',KEYS[2],ARGV[2],value)\n\ + redis.call('ZADD',KEYS[1],id,value)\n\ + local excess=redis.call('ZCARD',KEYS[1])-tonumber(ARGV[7])\n\ + if excess>0 then local gone=redis.call('ZRANGE',KEYS[1],0,excess-1) for _,v in ipairs(gone) do local e=cjson.decode(v) redis.call('HDEL',KEYS[2],e.idempotency_key) end redis.call('ZREMRANGEBYRANK',KEYS[1],0,excess-1) end\n\ + return {'1',value}", + ); + let values: Vec> = script + .key(format!("{}:durable-events:{}", self.prefix, event.scope)) + .key(format!( + "{}:durable-event-idem:{}", + self.prefix, event.scope + )) + .key(format!("{}:durable-event-seq", self.prefix)) + .arg(&event.scope) + .arg(&event.idempotency_key) + .arg(&event.topic) + .arg(payload) + .arg(source) + .arg(now) + .arg(DURABLE_EVENT_LIMIT) + .invoke_async(&mut conn) + .await + .map_err(map_redis_err)?; + let inserted = values.first().is_some_and(|v| v.as_slice() == b"1"); + let stored = decode_durable_event(values.get(1).ok_or_else(|| { + StoreError::Invalid("durable event append returned no record".into()) + })?)?; + if stored.topic != event.topic + || stored.payload != event.payload + || stored.source != event.source + { + return Err(StoreError::Invalid( + "durable event idempotency key was reused with different content".into(), + )); + } + Ok((stored, inserted)) + } + + async fn list_durable_events( + &self, + scope: &str, + before_event_id: Option, + limit: u32, + ) -> Result, StoreError> { + headgate_core::validate_durable_event_limit(limit)?; + let mut conn = self.conn.clone(); + let max = before_event_id + .map(|id| format!("({id}")) + .unwrap_or_else(|| "+inf".into()); + let values: Vec> = redis::cmd("ZREVRANGEBYSCORE") + .arg(format!("{}:durable-events:{scope}", self.prefix)) + .arg(max) + .arg("-inf") + .arg("LIMIT") + .arg(0) + .arg(limit) + .query_async(&mut conn) + .await + .map_err(map_redis_err)?; + values + .iter() + .map(|value| decode_durable_event(value)) + .collect() + } + async fn heartbeat_worker(&self, w: &WorkerMeta) -> Result, StoreError> { let mut conn = self.conn.clone(); let status = if w.status.is_empty() { @@ -1330,12 +1416,12 @@ impl Inspect for RedisStore { worker_id: &str, command: Option<&str>, ) -> Result<(), StoreError> { - if let Some(cmd) = command { - if !headgate_core::valid_worker_command(cmd) { - return Err(StoreError::Invalid( - "command must be quiet, resume, restart, terminate, or resign".into(), - )); - } + if let Some(cmd) = command + && !headgate_core::valid_worker_command(cmd) + { + return Err(StoreError::Invalid( + "command must be quiet, resume, restart, terminate, or resign".into(), + )); } let mut conn = self.conn.clone(); let n: i64 = self @@ -1516,7 +1602,7 @@ impl Inspect for RedisStore { let mut total = 0u64; for id in &ids { let ok = format!("{}:op:{id}", self.prefix); - let h = &self.hashes(&[ok.clone()]).await?[0]; + let h = &self.hashes(std::slice::from_ref(&ok)).await?[0]; let action = hs(h, "action").to_string(); let done_with = |status: &str| { let mut pipe = redis::pipe(); @@ -1613,6 +1699,27 @@ impl Inspect for RedisStore { } } + async fn schedule_pending_job(&self, id: &str, at_ms: i64) -> Result<(), StoreError> { + if at_ms <= 0 { + return Err(StoreError::Invalid( + "pending schedule timestamp must be positive".into(), + )); + } + let res = self + .admin_job_op(&["schedule_pending", id, &at_ms.to_string()]) + .await?; + match res.first().map(String::as_str) { + Some("OK") => Ok(()), + Some("NF") => Err(StoreError::NotFound(id.into())), + Some("ERR") => Err(StoreError::Invalid( + "workflow_schedule is defined only from pending".into(), + )), + _ => Err(StoreError::Backend( + "invalid schedule_pending response".into(), + )), + } + } + async fn delete_queue(&self, queue: &str, force: bool) -> Result, StoreError> { let now = self.store_now_ms().await?; let id = format!( @@ -1702,6 +1809,86 @@ impl Inspect for RedisStore { } } +fn validate_durable_event(event: &DurableEvent) -> Result<(), StoreError> { + if event.scope.is_empty() + || event.scope.len() > 512 + || event.topic.is_empty() + || event.topic.len() > 255 + || event.idempotency_key.is_empty() + || event.idempotency_key.len() > 255 + { + return Err(StoreError::Invalid( + "durable event scope, topic, or idempotency key is invalid".into(), + )); + } + if event.payload.len() > headgate_core::MAX_DURABLE_EVENT_PAYLOAD_BYTES + || serde_json::from_slice::(&event.payload).is_err() + { + return Err(StoreError::Invalid( + "durable event payload must be valid JSON of at most 65536 bytes".into(), + )); + } + if event.source.len() > headgate_core::MAX_DURABLE_EVENT_SOURCE_BYTES + || serde_json::from_slice::(&event.source).is_err() + { + return Err(StoreError::Invalid( + "durable event source must be valid JSON of at most 16384 bytes".into(), + )); + } + Ok(()) +} + +fn decode_durable_event(bytes: &[u8]) -> Result { + let value: serde_json::Value = serde_json::from_slice(bytes) + .map_err(|e| StoreError::Invalid(format!("invalid stored durable event: {e}")))?; + let recorded_at_ms = value["recorded_at_ms"] + .as_i64() + .or_else(|| value["recorded_at_ms"].as_str()?.parse().ok()) + .ok_or_else(|| StoreError::Invalid("invalid stored durable event recorded_at_ms".into()))?; + let stored_json = |field: &str| -> Result, StoreError> { + if let Some(encoded) = value[field].as_str() { + serde_json::from_str::(encoded).map_err(|e| { + StoreError::Invalid(format!("invalid stored durable event {field}: {e}")) + })?; + Ok(encoded.as_bytes().to_vec()) + } else { + serde_json::to_vec(&value[field]).map_err(|e| { + StoreError::Invalid(format!("invalid stored durable event {field}: {e}")) + }) + } + }; + Ok(DurableEvent { + event_id: value["event_id"].as_u64().unwrap_or_default(), + scope: value["scope"].as_str().unwrap_or_default().into(), + topic: value["topic"].as_str().unwrap_or_default().into(), + idempotency_key: value["idempotency_key"].as_str().unwrap_or_default().into(), + payload: stored_json("payload")?, + source: stored_json("source")?, + recorded_at_ms, + }) +} + +#[cfg(test)] +mod durable_event_tests { + use super::decode_durable_event; + + #[test] + fn current_and_legacy_redis_timestamps_decode() { + let fixtures = [ + r#"{"event_id":7,"scope":"workflow:w1","topic":"approved","idempotency_key":"signal:1","payload":"{\"approved\": true}","source":"{\"emitter\": \"api\"}","recorded_at_ms":1720000000123}"#, + r#"{"event_id":7,"scope":"workflow:w1","topic":"approved","idempotency_key":"signal:1","payload":{"approved":true},"source":{"emitter":"api"},"recorded_at_ms":"1720000000123"}"#, + ]; + for encoded in fixtures { + let event = decode_durable_event(encoded.as_bytes()).unwrap(); + assert_eq!(event.event_id, 7); + assert_eq!(event.recorded_at_ms, 1_720_000_000_123); + } + let current = decode_durable_event(fixtures[0].as_bytes()).unwrap(); + assert_eq!(current.payload, br#"{"approved": true}"#); + assert_eq!(current.source, br#"{"emitter": "api"}"#); + } +} + #[async_trait::async_trait] impl ResultInspect for RedisStore { async fn get_job_result(&self, id: &str) -> Result, StoreError> { diff --git a/crates/headgate-redis/src/lib.rs b/crates/headgate-redis/src/lib.rs index a9957e7..70dfdde 100644 --- a/crates/headgate-redis/src/lib.rs +++ b/crates/headgate-redis/src/lib.rs @@ -943,7 +943,7 @@ impl headgate_core::Notifying for RedisStore { match tokio::time::timeout_at(deadline, rx.recv()).await { Err(_) => return Ok(None), // timeout: the poll fallback takes it Ok(Ok(queue)) => { - if queues.is_empty() || queues.iter().any(|q| *q == queue) { + if queues.is_empty() || queues.contains(&queue) { return Ok(Some(queue)); } } diff --git a/crates/headgate-shared/src/log.rs b/crates/headgate-shared/src/log.rs index ac93382..e8517b3 100644 --- a/crates/headgate-shared/src/log.rs +++ b/crates/headgate-shared/src/log.rs @@ -125,44 +125,42 @@ impl LogEntry { fields: Map::new(), truncated: false, }; - if line.len() <= MAX_LOG_BYTES { - if let Some(body) = line.strip_prefix(LOG_PREFIX) { - if let Ok(value) = serde_json::from_str::(body) { - if let (Some(level), Some(message)) = ( - value - .get("level") - .and_then(Value::as_str) - .and_then(LogLevel::parse), - value.get("message").and_then(Value::as_str), - ) { - let fields_valid = value.get("fields").is_none_or(|fields| { - fields.as_object().is_some_and(|fields| { - fields.values().all(|v| !v.is_array() && !v.is_object()) - }) - }); - if !fields_valid - || value.get("at_ms").is_some_and(|at| !at.is_i64()) - || value.get("truncated").is_some_and(|v| !v.is_boolean()) - { - return plain(); - } - return Self { - level, - at_ms: value.get("at_ms").and_then(Value::as_i64), - message: message.to_owned(), - fields: value - .get("fields") - .and_then(Value::as_object) - .cloned() - .unwrap_or_default(), - truncated: value - .get("truncated") - .and_then(Value::as_bool) - .unwrap_or(false), - }; - } - } + if line.len() <= MAX_LOG_BYTES + && let Some(body) = line.strip_prefix(LOG_PREFIX) + && let Ok(value) = serde_json::from_str::(body) + && let (Some(level), Some(message)) = ( + value + .get("level") + .and_then(Value::as_str) + .and_then(LogLevel::parse), + value.get("message").and_then(Value::as_str), + ) + { + let fields_valid = value.get("fields").is_none_or(|fields| { + fields + .as_object() + .is_some_and(|fields| fields.values().all(|v| !v.is_array() && !v.is_object())) + }); + if !fields_valid + || value.get("at_ms").is_some_and(|at| !at.is_i64()) + || value.get("truncated").is_some_and(|v| !v.is_boolean()) + { + return plain(); } + return Self { + level, + at_ms: value.get("at_ms").and_then(Value::as_i64), + message: message.to_owned(), + fields: value + .get("fields") + .and_then(Value::as_object) + .cloned() + .unwrap_or_default(), + truncated: value + .get("truncated") + .and_then(Value::as_bool) + .unwrap_or(false), + }; } plain() } diff --git a/crates/headgate-sql/src/lib.rs b/crates/headgate-sql/src/lib.rs index 453d547..c413ce3 100644 --- a/crates/headgate-sql/src/lib.rs +++ b/crates/headgate-sql/src/lib.rs @@ -27,6 +27,8 @@ const OBJECTS: &[&str] = &[ "headgate_enqueue_counter", "headgate_job_tag", "headgate_queue_sample", + "headgate_durable_event_scope", + "headgate_durable_event", "headgate_archive_policy", "headgate_job_archive", "headgate_job_archive_before_2025", @@ -125,6 +127,7 @@ const INDEXES: &[&str] = &[ "headgate_job_sticky_available", "headgate_job_avail_sticky", "headgate_job_archive_queue_time", + "headgate_durable_event_recent", ]; #[derive(Clone, Debug, Default)] @@ -393,13 +396,17 @@ mod tests { } #[test] - fn migration_indexes_and_new_metric_tables_stay_inside_the_explicit_schema() { + fn migration_indexes_and_new_tables_stay_inside_the_explicit_schema() { let namespace = PostgresNamespace::explicit("tenant").unwrap(); let rendered = namespace.render( "DROP INDEX headgate_job_unique;\n\ CREATE UNIQUE INDEX headgate_job_unique ON headgate_job (unique_key);\n\ CREATE TABLE headgate_job_tag (job_id bigint);\n\ - CREATE TABLE headgate_queue_sample (queue text);", + CREATE TABLE headgate_queue_sample (queue text);\n\ + CREATE TABLE headgate_durable_event_scope (scope text);\n\ + CREATE TABLE headgate_durable_event (scope text REFERENCES headgate_durable_event_scope(scope));\n\ + CREATE INDEX headgate_durable_event_recent ON headgate_durable_event (scope);\n\ + DROP INDEX headgate_durable_event_recent;", ); assert!(rendered.contains("DROP INDEX \"tenant\".headgate_job_unique")); assert!( @@ -407,5 +414,12 @@ mod tests { ); assert!(rendered.contains("CREATE TABLE \"tenant\".headgate_job_tag")); assert!(rendered.contains("CREATE TABLE \"tenant\".headgate_queue_sample")); + assert!(rendered.contains("CREATE TABLE \"tenant\".headgate_durable_event_scope")); + assert!(rendered.contains("CREATE TABLE \"tenant\".headgate_durable_event")); + assert!(rendered.contains("REFERENCES \"tenant\".headgate_durable_event_scope")); + assert!(rendered.contains( + "CREATE INDEX headgate_durable_event_recent ON \"tenant\".headgate_durable_event" + )); + assert!(rendered.contains("DROP INDEX \"tenant\".headgate_durable_event_recent")); } } diff --git a/crates/headgate-testkit/src/database.rs b/crates/headgate-testkit/src/database.rs index e7c7422..9427d50 100644 --- a/crates/headgate-testkit/src/database.rs +++ b/crates/headgate-testkit/src/database.rs @@ -75,7 +75,7 @@ impl PostgresTestDatabase { .map_err(|error| TestDatabaseError::new(format!("create schema {schema}: {error}")))?; let mut test_config = admin_config.clone(); - test_config.options(&format!("-c search_path={schema}")); + test_config.options(format!("-c search_path={schema}")); let migrated = migrate_postgres_in_schema( &mut admin, &schema, diff --git a/crates/headgate-testkit/src/lib.rs b/crates/headgate-testkit/src/lib.rs index 51deeb6..a90fe3f 100644 --- a/crates/headgate-testkit/src/lib.rs +++ b/crates/headgate-testkit/src/lib.rs @@ -571,10 +571,11 @@ fn default_backoff(attempt: i64, base: i64, cap: i64) -> i64 { fn release_unique(inner: &mut Inner, id: &str) { let Some(j) = inner.jobs.get(id) else { return }; - if let Some(k) = headgate_core::effective_unique_key(&j.env) { - if j.env.unique_window_ms == 0 && inner.unique.get(&k).map(String::as_str) == Some(id) { - inner.unique.remove(&k); - } + if let Some(k) = headgate_core::effective_unique_key(&j.env) + && j.env.unique_window_ms == 0 + && inner.unique.get(&k).map(String::as_str) == Some(id) + { + inner.unique.remove(&k); } } @@ -641,57 +642,55 @@ impl Store for MemStore { }; if let Some(id) = holder { let mut replaced = false; - if e.unique_replace != 0 || e.unique_debounce_ms > 0 { - if let Some(job) = inner.jobs.get_mut(&id) { - if matches!(job.state.as_str(), "scheduled" | "available" | "retryable") - { - let mask = e.unique_replace; - if e.unique_debounce_ms > 0 { - job.env.schema_version = if e.schema_version == 0 { - 1 - } else { - e.schema_version - }; - job.env.payload.clone_from(&e.payload); - job.env.fingerprint.clone_from(&e.fingerprint); - job.env.tags = headgate_core::canonical_tags(&e.tags); - job.env.scheduled_at_ms = now + e.unique_debounce_ms; - job.state = "scheduled".into(); - replaced = true; - } - if mask & headgate_core::UNIQUE_REPLACE_PAYLOAD != 0 { - job.env.schema_version = if e.schema_version == 0 { - 1 - } else { - e.schema_version - }; - job.env.payload.clone_from(&e.payload); - job.env.fingerprint.clone_from(&e.fingerprint); - replaced = true; - } - if mask & headgate_core::UNIQUE_REPLACE_SCHEDULED_AT != 0 - && job.state == "scheduled" - { - job.env.scheduled_at_ms = if e.scheduled_at_ms == 0 { - now - } else { - e.scheduled_at_ms - }; - replaced = true; - } - if mask & headgate_core::UNIQUE_REPLACE_PRIORITY != 0 { - job.env.priority = e.priority; - replaced = true; - } - if mask & headgate_core::UNIQUE_REPLACE_MAX_ATTEMPTS != 0 { - job.env.max_attempts = if e.max_attempts == 0 { - 25 - } else { - e.max_attempts - }; - replaced = true; - } - } + if (e.unique_replace != 0 || e.unique_debounce_ms > 0) + && let Some(job) = inner.jobs.get_mut(&id) + && matches!(job.state.as_str(), "scheduled" | "available" | "retryable") + { + let mask = e.unique_replace; + if e.unique_debounce_ms > 0 { + job.env.schema_version = if e.schema_version == 0 { + 1 + } else { + e.schema_version + }; + job.env.payload.clone_from(&e.payload); + job.env.fingerprint.clone_from(&e.fingerprint); + job.env.tags = headgate_core::canonical_tags(&e.tags); + job.env.scheduled_at_ms = now + e.unique_debounce_ms; + job.state = "scheduled".into(); + replaced = true; + } + if mask & headgate_core::UNIQUE_REPLACE_PAYLOAD != 0 { + job.env.schema_version = if e.schema_version == 0 { + 1 + } else { + e.schema_version + }; + job.env.payload.clone_from(&e.payload); + job.env.fingerprint.clone_from(&e.fingerprint); + replaced = true; + } + if mask & headgate_core::UNIQUE_REPLACE_SCHEDULED_AT != 0 + && job.state == "scheduled" + { + job.env.scheduled_at_ms = if e.scheduled_at_ms == 0 { + now + } else { + e.scheduled_at_ms + }; + replaced = true; + } + if mask & headgate_core::UNIQUE_REPLACE_PRIORITY != 0 { + job.env.priority = e.priority; + replaced = true; + } + if mask & headgate_core::UNIQUE_REPLACE_MAX_ATTEMPTS != 0 { + job.env.max_attempts = if e.max_attempts == 0 { + 25 + } else { + e.max_attempts + }; + replaced = true; } } return Err(StoreError::Duplicate { @@ -882,17 +881,17 @@ impl Store for MemStore { let j = &inner.jobs[&id]; (j.env.rate_class.clone(), j.rate_charge) }; - if charge > 0 { - if let Some(b) = inner.rate.get_mut(&rc) { - let gained = if b.limit > 0 && b.window > 0 { - (now - b.refilled).max(0) * b.limit / b.window - } else { - 0 - }; - let avail = b.burst.min(b.tokens + gained); - b.tokens = b.burst.min(avail + charge - actual as i64); - b.refilled = now; - } + if charge > 0 + && let Some(b) = inner.rate.get_mut(&rc) + { + let gained = if b.limit > 0 && b.window > 0 { + (now - b.refilled).max(0) * b.limit / b.window + } else { + 0 + }; + let avail = b.burst.min(b.tokens + gained); + b.tokens = b.burst.min(avail + charge - actual as i64); + b.refilled = now; } inner.jobs.get_mut(&id).unwrap().rate_charge = 0; } @@ -1134,10 +1133,11 @@ impl Store for MemStore { } let now = self.now(); let mut inner = self.inner.lock().unwrap(); - if let Some((h, expires)) = inner.duties.get(name) { - if *expires > now && h != holder { - return Ok(false); - } + if let Some((h, expires)) = inner.duties.get(name) + && *expires > now + && h != holder + { + return Ok(false); } inner .duties @@ -1213,17 +1213,17 @@ impl headgate_core::ResultStore for MemStore { let job = &inner.jobs[&id]; (job.env.rate_class.clone(), job.rate_charge) }; - if charge > 0 { - if let Some(bucket) = inner.rate.get_mut(&rc) { - let gained = if bucket.limit > 0 && bucket.window > 0 { - (now - bucket.refilled).max(0) * bucket.limit / bucket.window - } else { - 0 - }; - let available = bucket.burst.min(bucket.tokens + gained); - bucket.tokens = bucket.burst.min(available + charge - actual as i64); - bucket.refilled = now; - } + if charge > 0 + && let Some(bucket) = inner.rate.get_mut(&rc) + { + let gained = if bucket.limit > 0 && bucket.window > 0 { + (now - bucket.refilled).max(0) * bucket.limit / bucket.window + } else { + 0 + }; + let available = bucket.burst.min(bucket.tokens + gained); + bucket.tokens = bucket.burst.min(available + charge - actual as i64); + bucket.refilled = now; } inner.jobs.get_mut(&id).unwrap().rate_charge = 0; } diff --git a/crates/headgate-workflow/Cargo.toml b/crates/headgate-workflow/Cargo.toml index 395271d..08bbb4a 100644 --- a/crates/headgate-workflow/Cargo.toml +++ b/crates/headgate-workflow/Cargo.toml @@ -18,7 +18,12 @@ headgate-core = { workspace = true } futures-util = "0.3" serde = { version = "1", features = ["derive"] } serde_json = "1" +cel = "0.14.4" [dev-dependencies] +headgate-mysql = { workspace = true } headgate-postgres = { workspace = true } +headgate-redis = { workspace = true } +headgate-testkit = { workspace = true } +redis = { version = "0.27", features = ["tokio-comp", "connection-manager"] } tokio = { version = "1", features = ["rt-multi-thread", "macros", "time"] } diff --git a/crates/headgate-workflow/src/lib.rs b/crates/headgate-workflow/src/lib.rs index c1613a5..9252d24 100644 --- a/crates/headgate-workflow/src/lib.rs +++ b/crates/headgate-workflow/src/lib.rs @@ -8,13 +8,18 @@ use std::{ use futures_util::{StreamExt, TryStreamExt, stream}; use headgate::{CodecError, Control, Envelope, JobCtx, JobError, Registry, Task}; -use headgate_core::{Inspect, MAX_ENQUEUE_BATCH_SIZE, MAX_JOB_IDENTIFIER_LEN}; +use headgate_core::{ + DurableEvent, Inspect, JobFilter, MAX_ENQUEUE_BATCH_SIZE, MAX_JOB_IDENTIFIER_LEN, +}; use serde::{Deserialize, Serialize}; const DEFAULT_RETENTION_MS: i64 = 7 * 24 * 60 * 60 * 1000; const MAX_WORKFLOW_NODES: usize = MAX_ENQUEUE_BATCH_SIZE - 1; const MAX_WORKFLOW_EDGES: usize = 10_000; +const MAX_WORKFLOW_EVENTS: usize = 256; const WORKFLOW_CONCURRENCY: usize = 16; +const MAX_SIGNAL_PAYLOAD_BYTES: usize = 64 * 1024; +const MAX_SIGNAL_SOURCE_BYTES: usize = 16 * 1024; #[derive(Debug)] pub struct WorkflowError(String); @@ -29,10 +34,20 @@ impl std::error::Error for WorkflowError {} #[derive(Clone)] struct DraftNode { name: String, - envelope: Envelope, + kind: DraftNodeKind, deps: Vec, } +#[derive(Clone)] +enum DraftNodeKind { + Task(Box), + Signal { signal: String }, + TimerAt { wake_at_ms: i64 }, + TimerAfter { delay_ms: i64 }, + ChildWorkflow { workflow_id: String }, + Condition { expression: String }, +} + /// A validated DAG builder. `prepare` returns one atomic enqueue batch containing the /// durable coordinator plus every child in `pending` state. pub struct Workflow { @@ -40,6 +55,280 @@ pub struct Workflow { nodes: Vec, coordinator_queue: String, retention_ms: i64, + failed_subgraph_retry: bool, + retry_policy: Option, +} + +#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub struct WorkflowRetryPolicy { + pub max_generations: u32, + pub backoff_ms: i64, +} + +/// A revision-checked set of tasks to graft onto a running workflow. +/// +/// Enqueue the returned batch atomically. The receipt and its pending tasks then either +/// all exist or none do; the coordinator accepts only the receipt for its next revision. +pub struct WorkflowGraft { + workflow_id: String, + expected_revision: u64, + nodes: Vec, + queue: String, + retention_ms: i64, +} + +/// Prepare parent and child workflows as one atomic store enqueue. Every child link in +/// the bundle must name another member, which makes the complete cross-workflow graph +/// available for cycle detection before any row is written. +pub fn prepare_bundle(workflows: Vec) -> Result, WorkflowError> { + if workflows.is_empty() { + return Err(WorkflowError( + "workflow bundle must contain at least one workflow".into(), + )); + } + let ids: HashSet<&str> = workflows + .iter() + .map(|workflow| workflow.id.as_str()) + .collect(); + if ids.len() != workflows.len() || ids.contains("") { + return Err(WorkflowError( + "workflow bundle ids must be non-empty and unique".into(), + )); + } + let mut indegree: HashMap<&str, usize> = ids.iter().map(|id| (*id, 0)).collect(); + let mut outgoing: HashMap<&str, Vec<&str>> = HashMap::new(); + for workflow in &workflows { + let mut children = HashSet::new(); + for child in workflow.nodes.iter().filter_map(|node| match &node.kind { + DraftNodeKind::ChildWorkflow { workflow_id } => Some(workflow_id.as_str()), + _ => None, + }) { + if !ids.contains(child) { + return Err(WorkflowError(format!( + "atomic workflow bundle is missing child `{child}`" + ))); + } + if children.insert(child) { + *indegree.get_mut(child).expect("bundle child exists") += 1; + outgoing + .entry(workflow.id.as_str()) + .or_default() + .push(child); + } + } + } + let mut ready: VecDeque<&str> = indegree + .iter() + .filter_map(|(id, degree)| (*degree == 0).then_some(*id)) + .collect(); + let mut visited = 0; + while let Some(id) = ready.pop_front() { + visited += 1; + for child in outgoing.get(id).into_iter().flatten() { + let degree = indegree.get_mut(child).expect("bundle child exists"); + *degree -= 1; + if *degree == 0 { + ready.push_back(child); + } + } + } + if visited != workflows.len() { + return Err(WorkflowError( + "cross-workflow child graph contains a cycle".into(), + )); + } + let mut batch = Vec::new(); + for workflow in workflows { + batch.extend(workflow.prepare()?); + if batch.len() > MAX_ENQUEUE_BATCH_SIZE { + return Err(WorkflowError(format!( + "workflow bundle must contain at most {MAX_ENQUEUE_BATCH_SIZE} jobs" + ))); + } + } + Ok(batch) +} + +impl WorkflowGraft { + pub fn new(workflow_id: impl Into, expected_revision: u64) -> Self { + Self { + workflow_id: workflow_id.into(), + expected_revision, + nodes: Vec::new(), + queue: "headgate-workflow".into(), + retention_ms: DEFAULT_RETENTION_MS, + } + } + + pub fn queue(mut self, queue: impl Into) -> Self { + self.queue = queue.into(); + self + } + + pub fn retention(mut self, duration: Duration) -> Result { + let ms = i64::try_from(duration.as_millis()) + .map_err(|_| WorkflowError("workflow graft retention is too large".into()))?; + if ms <= 0 { + return Err(WorkflowError( + "workflow graft retention must be at least 1ms".into(), + )); + } + self.retention_ms = ms; + Ok(self) + } + + pub fn add( + mut self, + name: impl Into, + envelope: Envelope, + deps: impl IntoIterator>, + ) -> Self { + self.nodes.push(DraftNode { + name: name.into(), + kind: DraftNodeKind::Task(Box::new(envelope)), + deps: deps.into_iter().map(Into::into).collect(), + }); + self + } + + pub fn prepare(self) -> Result, WorkflowError> { + if self.workflow_id.is_empty() { + return Err(WorkflowError("workflow id must not be empty".into())); + } + if self.expected_revision == 0 { + return Err(WorkflowError( + "workflow graft expected revision must be at least 1".into(), + )); + } + if self.nodes.is_empty() || self.nodes.len() > MAX_WORKFLOW_NODES { + return Err(WorkflowError(format!( + "workflow graft must contain 1-{MAX_WORKFLOW_NODES} tasks" + ))); + } + let next_revision = self + .expected_revision + .checked_add(1) + .ok_or_else(|| WorkflowError("workflow graft revision would overflow".into()))?; + let mut names = HashSet::with_capacity(self.nodes.len()); + let mut specs = Vec::with_capacity(self.nodes.len()); + let mut children = Vec::with_capacity(self.nodes.len()); + for node in self.nodes { + if node.name.is_empty() || node.name.len() > 128 || !names.insert(node.name.clone()) { + return Err(WorkflowError( + "workflow graft task names must be non-empty and unique".into(), + )); + } + let DraftNodeKind::Task(envelope) = node.kind else { + return Err(WorkflowError( + "workflow graft currently accepts ordinary tasks only".into(), + )); + }; + let mut envelope = *envelope; + if envelope.id.is_empty() { + envelope.id = format!("{}:g{}:{}", self.workflow_id, next_revision, node.name); + } + envelope.pending = true; + envelope.scheduled_at_ms = 0; + if envelope.retention_ms < self.retention_ms { + envelope.retention_ms = self.retention_ms; + } + envelope = headgate::prepare_envelope(envelope) + .map_err(|error| WorkflowError(error.to_string()))?; + specs.push(NodeSpec { + name: node.name, + job_id: envelope.id.clone(), + deps: node.deps, + kind: NodeType::Task, + signal: None, + wake_at_ms: None, + delay_ms: None, + child_workflow_id: None, + condition: None, + }); + children.push(envelope); + } + validate_graft_nodes(&specs)?; + let graft = GraftTask { + workflow_id: self.workflow_id.clone(), + expected_revision: self.expected_revision, + nodes: specs, + }; + let payload = graft + .encode() + .map_err(|error| WorkflowError(error.to_string()))?; + let receipt = headgate::prepare_envelope(Envelope { + id: graft_receipt_id(&self.workflow_id, next_revision), + kind: GraftTask::TYPE.into(), + schema_version: GraftTask::VERSION, + fingerprint: headgate::fingerprint(GraftTask::TYPE, &payload), + payload, + queue: self.queue, + pending: true, + retention_ms: self.retention_ms, + ..Default::default() + }) + .map_err(|error| WorkflowError(error.to_string()))?; + let mut batch = Vec::with_capacity(children.len() + 1); + batch.push(receipt); + batch.extend(children); + Ok(batch) + } +} + +fn validate_graft_nodes(nodes: &[NodeSpec]) -> Result<(), WorkflowError> { + let names: HashSet<&str> = nodes.iter().map(|node| node.name.as_str()).collect(); + let mut indegree: HashMap<&str, usize> = + nodes.iter().map(|node| (node.name.as_str(), 0)).collect(); + let mut outgoing: HashMap<&str, Vec<&str>> = HashMap::new(); + let mut edges = 0usize; + for node in nodes { + let mut unique = HashSet::new(); + for dep in &node.deps { + edges = edges.saturating_add(1); + if !unique.insert(dep.as_str()) { + return Err(WorkflowError(format!( + "workflow graft task `{}` repeats dependency `{dep}`", + node.name + ))); + } + if dep == &node.name { + return Err(WorkflowError(format!( + "workflow graft task `{}` depends on itself", + node.name + ))); + } + if names.contains(dep.as_str()) { + *indegree.get_mut(node.name.as_str()).expect("known node") += 1; + outgoing.entry(dep).or_default().push(&node.name); + } + } + } + if edges > MAX_WORKFLOW_EDGES { + return Err(WorkflowError(format!( + "workflow graft must contain at most {MAX_WORKFLOW_EDGES} dependency edges" + ))); + } + let mut ready: VecDeque<&str> = indegree + .iter() + .filter_map(|(name, degree)| (*degree == 0).then_some(*name)) + .collect(); + let mut visited = 0; + while let Some(name) = ready.pop_front() { + visited += 1; + for child in outgoing.get(name).into_iter().flatten() { + let degree = indegree.get_mut(child).expect("known child"); + *degree -= 1; + if *degree == 0 { + ready.push_back(child); + } + } + } + if visited != nodes.len() { + return Err(WorkflowError( + "workflow graft dependency graph contains a cycle".into(), + )); + } + Ok(()) } impl Workflow { @@ -49,6 +338,8 @@ impl Workflow { nodes: Vec::new(), coordinator_queue: "headgate-workflow".into(), retention_ms: DEFAULT_RETENTION_MS, + failed_subgraph_retry: false, + retry_policy: None, } } @@ -69,6 +360,35 @@ impl Workflow { Ok(self) } + /// Retain dependency-blocked pending jobs so a failed generation can be retried + /// without rerunning successful ancestors. + pub fn failed_subgraph_retry(mut self) -> Self { + self.failed_subgraph_retry = true; + self + } + + /// Automatically retry the failed subgraph after a store-timed snooze. The limit + /// includes the initial generation, so `max_generations = 3` permits two retries. + pub fn automatic_retry( + mut self, + max_generations: u32, + backoff: Duration, + ) -> Result { + let backoff_ms = i64::try_from(backoff.as_millis()) + .map_err(|_| WorkflowError("workflow retry backoff is too large".into()))?; + if max_generations < 2 || backoff_ms <= 0 { + return Err(WorkflowError( + "automatic workflow retry requires at least 2 generations and 1ms backoff".into(), + )); + } + self.failed_subgraph_retry = true; + self.retry_policy = Some(WorkflowRetryPolicy { + max_generations, + backoff_ms, + }); + Ok(self) + } + pub fn add( mut self, name: impl Into, @@ -77,7 +397,101 @@ impl Workflow { ) -> Self { self.nodes.push(DraftNode { name: name.into(), - envelope, + kind: DraftNodeKind::Task(Box::new(envelope)), + deps: deps.into_iter().map(Into::into).collect(), + }); + self + } + + /// Add a durable workflow signal. Emission may happen before its dependencies + /// complete; the coordinator buffers that fact and consumes it once the node is + /// eligible. + pub fn add_signal( + mut self, + name: impl Into, + signal: impl Into, + deps: impl IntoIterator>, + ) -> Self { + self.nodes.push(DraftNode { + name: name.into(), + kind: DraftNodeKind::Signal { + signal: signal.into(), + }, + deps: deps.into_iter().map(Into::into).collect(), + }); + self + } + + /// Add an absolute store-time timer. The ordinary scheduled-job promoter supplies + /// the clock, so worker clock skew cannot fire the timer early or late. + pub fn add_timer_at( + mut self, + name: impl Into, + wake_at_ms: i64, + deps: impl IntoIterator>, + ) -> Self { + self.nodes.push(DraftNode { + name: name.into(), + kind: DraftNodeKind::TimerAt { wake_at_ms }, + deps: deps.into_iter().map(Into::into).collect(), + }); + self + } + + /// Add a relative timer anchored to the latest dependency finalization timestamp. + /// The coordinator durably records that store timestamp before scheduling the timer. + pub fn add_timer_after( + mut self, + name: impl Into, + delay: Duration, + deps: impl IntoIterator>, + ) -> Result { + let delay_ms = i64::try_from(delay.as_millis()) + .map_err(|_| WorkflowError("workflow timer delay is too large".into()))?; + if delay_ms <= 0 { + return Err(WorkflowError( + "workflow timer delay must be at least 1ms".into(), + )); + } + self.nodes.push(DraftNode { + name: name.into(), + kind: DraftNodeKind::TimerAfter { delay_ms }, + deps: deps.into_iter().map(Into::into).collect(), + }); + Ok(self) + } + + /// Add an explicit child-workflow link. The child workflow is enqueued separately; + /// this node mirrors its coordinator's terminal state into the parent. + pub fn add_child( + mut self, + name: impl Into, + workflow_id: impl Into, + deps: impl IntoIterator>, + ) -> Self { + self.nodes.push(DraftNode { + name: name.into(), + kind: DraftNodeKind::ChildWorkflow { + workflow_id: workflow_id.into(), + }, + deps: deps.into_iter().map(Into::into).collect(), + }); + self + } + + /// Wait until a CEL expression over `revision`, `generation`, `completed`, and + /// `states` evaluates to true. + pub fn add_condition( + mut self, + name: impl Into, + expression: impl Into, + deps: impl IntoIterator>, + ) -> Self { + self.nodes.push(DraftNode { + name: name.into(), + kind: DraftNodeKind::Condition { + expression: expression.into(), + }, deps: deps.into_iter().map(Into::into).collect(), }); self @@ -97,21 +511,172 @@ impl Workflow { let mut specs = Vec::with_capacity(self.nodes.len()); let mut children = Vec::with_capacity(self.nodes.len()); for node in self.nodes { - let mut envelope = node.envelope; + let (mut envelope, kind, signal, wake_at_ms, delay_ms, child_workflow_id, condition) = + match node.kind { + DraftNodeKind::Task(envelope) => { + (*envelope, NodeType::Task, None, None, None, None, None) + } + DraftNodeKind::Signal { signal } => { + let task = SignalTask { + workflow_id: self.id.clone(), + signal: signal.clone(), + }; + let payload = task + .encode() + .map_err(|error| WorkflowError(error.to_string()))?; + ( + Envelope { + kind: SignalTask::TYPE.into(), + schema_version: SignalTask::VERSION, + fingerprint: headgate::fingerprint(SignalTask::TYPE, &payload), + payload, + queue: self.coordinator_queue.clone(), + ..Default::default() + }, + NodeType::Signal, + Some(signal), + None, + None, + None, + None, + ) + } + DraftNodeKind::TimerAt { wake_at_ms } => { + let task = TimerTask { + workflow_id: self.id.clone(), + wake_at_ms: Some(wake_at_ms), + delay_ms: None, + }; + let payload = task + .encode() + .map_err(|error| WorkflowError(error.to_string()))?; + ( + Envelope { + kind: TimerTask::TYPE.into(), + schema_version: TimerTask::VERSION, + fingerprint: headgate::fingerprint(TimerTask::TYPE, &payload), + payload, + queue: self.coordinator_queue.clone(), + scheduled_at_ms: wake_at_ms, + ..Default::default() + }, + NodeType::Timer, + None, + Some(wake_at_ms), + None, + None, + None, + ) + } + DraftNodeKind::TimerAfter { delay_ms } => { + let task = TimerTask { + workflow_id: self.id.clone(), + wake_at_ms: None, + delay_ms: Some(delay_ms), + }; + let payload = task + .encode() + .map_err(|error| WorkflowError(error.to_string()))?; + ( + Envelope { + kind: TimerTask::TYPE.into(), + schema_version: TimerTask::VERSION, + fingerprint: headgate::fingerprint(TimerTask::TYPE, &payload), + payload, + queue: self.coordinator_queue.clone(), + ..Default::default() + }, + NodeType::Timer, + None, + None, + Some(delay_ms), + None, + None, + ) + } + DraftNodeKind::ChildWorkflow { workflow_id } => { + if workflow_id == self.id { + return Err(WorkflowError( + "workflow cannot contain itself as a child".into(), + )); + } + let task = ChildWorkflowTask { + parent_workflow_id: self.id.clone(), + child_workflow_id: workflow_id.clone(), + }; + let payload = task + .encode() + .map_err(|error| WorkflowError(error.to_string()))?; + ( + Envelope { + kind: ChildWorkflowTask::TYPE.into(), + schema_version: ChildWorkflowTask::VERSION, + fingerprint: headgate::fingerprint( + ChildWorkflowTask::TYPE, + &payload, + ), + payload, + queue: self.coordinator_queue.clone(), + ..Default::default() + }, + NodeType::ChildWorkflow, + None, + None, + None, + Some(workflow_id), + None, + ) + } + DraftNodeKind::Condition { expression } => { + let task = ConditionTask { + workflow_id: self.id.clone(), + expression: expression.clone(), + }; + let payload = task + .encode() + .map_err(|error| WorkflowError(error.to_string()))?; + ( + Envelope { + kind: ConditionTask::TYPE.into(), + schema_version: ConditionTask::VERSION, + fingerprint: headgate::fingerprint(ConditionTask::TYPE, &payload), + payload, + queue: self.coordinator_queue.clone(), + ..Default::default() + }, + NodeType::Condition, + None, + None, + None, + None, + Some(expression), + ) + } + }; if envelope.id.is_empty() { envelope.id = format!("{}:{}", self.id, node.name); } if envelope.retention_ms < self.retention_ms { envelope.retention_ms = self.retention_ms; } - envelope.pending = true; - envelope.scheduled_at_ms = 0; + if kind == NodeType::Timer && wake_at_ms.is_some() { + envelope.pending = false; + } else { + envelope.pending = true; + envelope.scheduled_at_ms = 0; + } envelope = headgate::prepare_envelope(envelope).map_err(|e| WorkflowError(e.to_string()))?; specs.push(NodeSpec { name: node.name, job_id: envelope.id.clone(), deps: node.deps, + kind, + signal, + wake_at_ms, + delay_ms, + child_workflow_id, + condition, }); children.push(envelope); } @@ -119,6 +684,8 @@ impl Workflow { let task = CoordinatorTask { workflow_id: self.id.clone(), nodes: specs, + failed_subgraph_retry: self.failed_subgraph_retry, + retry_policy: self.retry_policy, }; let payload = task.encode().map_err(|e| WorkflowError(e.to_string()))?; let coordinator = headgate::prepare_envelope(Envelope { @@ -161,6 +728,34 @@ fn validate_graph(nodes: &[DraftNode]) -> Result<(), WorkflowError> { node.name ))); } + if matches!(&node.kind, DraftNodeKind::Signal { signal } if signal.is_empty()) { + return Err(WorkflowError(format!( + "workflow signal node `{}` has an empty signal", + node.name + ))); + } + if matches!(&node.kind, DraftNodeKind::TimerAt { wake_at_ms } if *wake_at_ms <= 0) { + return Err(WorkflowError(format!( + "workflow timer node `{}` must have a positive absolute wake time", + node.name + ))); + } + if matches!(node.kind, DraftNodeKind::TimerAfter { .. }) && node.deps.is_empty() { + return Err(WorkflowError(format!( + "relative workflow timer `{}` requires at least one dependency", + node.name + ))); + } + if matches!(&node.kind, DraftNodeKind::ChildWorkflow { workflow_id } if workflow_id.is_empty()) + { + return Err(WorkflowError(format!( + "workflow child node `{}` has an empty workflow id", + node.name + ))); + } + if let DraftNodeKind::Condition { expression } = &node.kind { + validate_condition(expression)?; + } edges = edges.saturating_add(node.deps.len()); let mut unique = HashSet::new(); for dep in &node.deps { @@ -208,23 +803,1120 @@ fn validate_graph(nodes: &[DraftNode]) -> Result<(), WorkflowError> { Ok(()) } +fn validate_condition(expression: &str) -> Result<(), WorkflowError> { + if expression.is_empty() || expression.len() > 1_024 { + return Err(WorkflowError( + "workflow CEL condition must contain 1-1024 bytes".into(), + )); + } + cel::Program::compile(expression) + .map(|_| ()) + .map_err(|error| WorkflowError(format!("invalid workflow CEL condition: {error}"))) +} + #[derive(Clone, Debug, Serialize, Deserialize)] struct NodeSpec { name: String, job_id: String, deps: Vec, + #[serde(default)] + kind: NodeType, + #[serde(default, skip_serializing_if = "Option::is_none")] + signal: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + wake_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + delay_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + child_workflow_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + condition: Option, +} + +#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +enum NodeType { + #[default] + Task, + Signal, + Timer, + ChildWorkflow, + Condition, } #[derive(Clone, Debug, Serialize, Deserialize)] pub struct CoordinatorTask { pub workflow_id: String, nodes: Vec, + #[serde(default)] + failed_subgraph_retry: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + retry_policy: Option, } -#[derive(Default, Serialize, Deserialize)] -struct WorkflowCursor { - completed: Vec, -} +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct SignalTask { + pub workflow_id: String, + pub signal: String, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct TimerTask { + pub workflow_id: String, + pub wake_at_ms: Option, + pub delay_ms: Option, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct ChildWorkflowTask { + pub parent_workflow_id: String, + pub child_workflow_id: String, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct ConditionTask { + pub workflow_id: String, + pub expression: String, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct GraftTask { + pub workflow_id: String, + pub expected_revision: u64, + nodes: Vec, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct RetryTask { + pub workflow_id: String, + pub expected_revision: u64, +} + +impl Task for SignalTask { + const TYPE: &'static str = "headgate:workflow-signal"; + + fn encode(&self) -> Result, CodecError> { + serde_json::to_vec(self).map_err(|error| CodecError::Malformed(error.to_string())) + } + + fn decode(bytes: &[u8]) -> Result { + serde_json::from_slice(bytes).map_err(|error| CodecError::Malformed(error.to_string())) + } +} + +impl Task for TimerTask { + const TYPE: &'static str = "headgate:workflow-timer"; + + fn encode(&self) -> Result, CodecError> { + serde_json::to_vec(self).map_err(|error| CodecError::Malformed(error.to_string())) + } + + fn decode(bytes: &[u8]) -> Result { + serde_json::from_slice(bytes).map_err(|error| CodecError::Malformed(error.to_string())) + } +} + +impl Task for ChildWorkflowTask { + const TYPE: &'static str = "headgate:workflow-child"; + + fn encode(&self) -> Result, CodecError> { + serde_json::to_vec(self).map_err(|error| CodecError::Malformed(error.to_string())) + } + + fn decode(bytes: &[u8]) -> Result { + serde_json::from_slice(bytes).map_err(|error| CodecError::Malformed(error.to_string())) + } +} + +impl Task for ConditionTask { + const TYPE: &'static str = "headgate:workflow-condition"; + + fn encode(&self) -> Result, CodecError> { + serde_json::to_vec(self).map_err(|error| CodecError::Malformed(error.to_string())) + } + + fn decode(bytes: &[u8]) -> Result { + serde_json::from_slice(bytes).map_err(|error| CodecError::Malformed(error.to_string())) + } +} + +impl Task for GraftTask { + const TYPE: &'static str = "headgate:workflow-graft"; + + fn encode(&self) -> Result, CodecError> { + serde_json::to_vec(self).map_err(|error| CodecError::Malformed(error.to_string())) + } + + fn decode(bytes: &[u8]) -> Result { + serde_json::from_slice(bytes).map_err(|error| CodecError::Malformed(error.to_string())) + } +} + +impl Task for RetryTask { + const TYPE: &'static str = "headgate:workflow-retry"; + + fn encode(&self) -> Result, CodecError> { + serde_json::to_vec(self).map_err(|error| CodecError::Malformed(error.to_string())) + } + + fn decode(bytes: &[u8]) -> Result { + serde_json::from_slice(bytes).map_err(|error| CodecError::Malformed(error.to_string())) + } +} + +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct SignalReceipt { + pub matched: usize, + pub promoted: usize, + pub inserted: bool, + pub emission: WorkflowSignal, +} + +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct SignalEmission { + pub signal: String, + pub idempotency_key: String, + pub payload: serde_json::Value, + pub source: serde_json::Value, +} + +#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +pub struct WorkflowSignal { + pub id: u64, + pub signal: String, + pub idempotency_key: String, + pub payload: serde_json::Value, + pub source: serde_json::Value, + pub recorded_at_ms: i64, +} + +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub struct RetryReceipt { + pub revision: u64, + pub generation: u32, +} + +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct WorkflowRecovery { + pub node: String, + pub payload: Option>, + pub schema_version: Option, + pub release_quarantine: bool, +} + +#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize)] +pub struct CancelReceipt { + pub workflows: usize, + pub jobs: usize, +} + +/// Cancel a workflow and, by default, every linked child workflow. Traversal is +/// iterative and bounded by the same node cap as creation; running jobs lose their +/// lease through the ordinary operator-cancel path. +pub async fn cancel_workflow( + inspect: &dyn Inspect, + workflow_id: &str, + propagate_children: bool, +) -> Result { + if workflow_id.is_empty() { + return Err(WorkflowError("workflow id must not be empty".into())); + } + let mut pending = VecDeque::from([workflow_id.to_string()]); + let mut visited = HashSet::new(); + let mut jobs = 0; + while let Some(current) = pending.pop_front() { + if !visited.insert(current.clone()) { + continue; + } + if visited.len() > MAX_WORKFLOW_NODES { + return Err(WorkflowError( + "workflow cancellation exceeds the bounded nested-workflow limit".into(), + )); + } + let coordinator_id = format!("{current}:coordinator"); + let coordinator = inspect + .get_job(&coordinator_id, true) + .await + .map_err(|error| WorkflowError(error.to_string()))? + .ok_or_else(|| WorkflowError(format!("workflow `{current}` was not found")))?; + let payload = coordinator + .payload + .as_deref() + .ok_or_else(|| WorkflowError("workflow coordinator payload was not returned".into()))?; + let task = CoordinatorTask::decode(payload) + .map_err(|error| WorkflowError(format!("invalid workflow coordinator: {error}")))?; + if propagate_children { + pending.extend( + task.nodes + .iter() + .filter_map(|node| node.child_workflow_id.clone()), + ); + } + for job_id in task + .nodes + .iter() + .map(|node| node.job_id.as_str()) + .chain(std::iter::once(coordinator_id.as_str())) + { + let Some(job) = inspect + .get_job(job_id, false) + .await + .map_err(|error| WorkflowError(error.to_string()))? + else { + continue; + }; + if matches!( + job.state.as_str(), + "pending" | "scheduled" | "available" | "running" | "retryable" + ) { + inspect + .operator_cancel(job_id) + .await + .map_err(|error| WorkflowError(error.to_string()))?; + jobs += 1; + } + } + } + Ok(CancelReceipt { + workflows: visited.len(), + jobs, + }) +} + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub struct WorkflowEvent { + pub sequence: u64, + pub event: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub node: Option, + pub revision: u64, + pub generation: u32, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub at_ms: Option, +} + +/// The durable role a node plays in a workflow graph. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum WorkflowNodeKind { + Task, + Signal, + Timer, + ChildWorkflow, + Condition, +} + +/// One node in an inspected workflow graph. Dependencies and dependents contain node +/// names, while `job_id` is the underlying Headgate job to inspect or control. +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub struct WorkflowNode { + pub name: String, + pub job_id: String, + pub kind: WorkflowNodeKind, + pub job_kind: String, + pub state: String, + pub dependencies: Vec, + pub dependents: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub signal: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub wake_at_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub delay_ms: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub child_workflow_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub condition: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub completed_at_ms: Option, +} + +/// A bounded point-in-time view of a workflow and its complete accepted graph, +/// including additive grafts accepted in later revisions. +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub struct WorkflowSnapshot { + pub workflow_id: String, + pub coordinator_job_id: String, + pub coordinator_state: String, + pub revision: u64, + pub generation: u32, + pub failed: bool, + pub failed_subgraph_retry: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub retry_policy: Option, + pub nodes: Vec, +} + +/// One coordinator entry returned by [`list_workflows`]. Fetch its graph with +/// [`inspect_workflow`] only when node-level detail is needed. +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub struct WorkflowSummary { + pub workflow_id: String, + pub coordinator_job_id: String, + pub state: String, + pub enqueued_at_ms: i64, + pub scheduled_at_ms: i64, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub finalized_at_ms: Option, +} + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub struct WorkflowPage { + pub workflows: Vec, + #[serde(default)] + pub next_cursor: Option, +} + +impl WorkflowSnapshot { + pub fn node(&self, name: &str) -> Option<&WorkflowNode> { + self.nodes.iter().find(|node| node.name == name) + } + + pub fn dependencies(&self, name: &str) -> Option> { + let node = self.node(name)?; + Some( + node.dependencies + .iter() + .filter_map(|dependency| self.node(dependency)) + .collect(), + ) + } + + pub fn dependents(&self, name: &str) -> Option> { + let node = self.node(name)?; + Some( + node.dependents + .iter() + .filter_map(|dependent| self.node(dependent)) + .collect(), + ) + } +} + +/// List workflow coordinators without loading every graph. The page is capped at 200; +/// use [`inspect_workflow`] for a selected workflow. +pub async fn list_workflows( + inspect: &dyn Inspect, + cursor: Option<&str>, + limit: u32, +) -> Result { + if !(1..=200).contains(&limit) { + return Err(WorkflowError( + "workflow list limit must be between 1 and 200".into(), + )); + } + let page = inspect + .list_jobs( + &JobFilter { + kind: Some(CoordinatorTask::TYPE.into()), + ..Default::default() + }, + cursor, + limit, + ) + .await + .map_err(|error| WorkflowError(error.to_string()))?; + Ok(WorkflowPage { + workflows: page + .jobs + .into_iter() + .map(|job| WorkflowSummary { + workflow_id: job + .id + .strip_suffix(":coordinator") + .unwrap_or(&job.id) + .to_string(), + coordinator_job_id: job.id, + state: job.state, + enqueued_at_ms: job.enqueued_at_ms, + scheduled_at_ms: job.scheduled_at_ms, + finalized_at_ms: job.finalized_at_ms, + }) + .collect(), + next_cursor: page.next_cursor, + }) +} + +/// Inspect the accepted graph and live execution state without exposing task payloads. +pub async fn inspect_workflow( + inspect: &dyn Inspect, + workflow_id: &str, +) -> Result { + if workflow_id.is_empty() { + return Err(WorkflowError("workflow id must not be empty".into())); + } + let coordinator_job_id = format!("{workflow_id}:coordinator"); + let coordinator = inspect + .get_job(&coordinator_job_id, true) + .await + .map_err(|error| WorkflowError(error.to_string()))? + .ok_or_else(|| WorkflowError(format!("workflow `{workflow_id}` was not found")))?; + let payload = coordinator + .payload + .as_deref() + .ok_or_else(|| WorkflowError("workflow coordinator payload was not returned".into()))?; + let base = CoordinatorTask::decode(payload) + .map_err(|error| WorkflowError(format!("invalid workflow coordinator: {error}")))?; + let cursor = load_workflow_cursor(inspect, &coordinator_job_id, &coordinator.state).await?; + let effective = effective_workflow(&base, &cursor); + let mut dependents: HashMap> = HashMap::new(); + for node in &effective.nodes { + for dependency in &node.deps { + dependents + .entry(dependency.clone()) + .or_default() + .push(node.name.clone()); + } + } + let completed: HashSet<&str> = cursor.completed.iter().map(String::as_str).collect(); + let mut indexed_nodes = stream::iter(effective.nodes.into_iter().enumerate().map( + |(index, node)| { + let recorded_completion = completed.contains(node.name.as_str()); + let completed_at_ms = cursor.completed_at_ms.get(&node.name).copied(); + let node_dependents = dependents.get(&node.name).cloned().unwrap_or_default(); + async move { + let job = inspect + .get_job(&node.job_id, false) + .await + .map_err(|error| WorkflowError(error.to_string()))?; + let (state, job_kind) = job.map_or_else( + || { + ( + if recorded_completion { + "completed" + } else { + "missing" + } + .to_string(), + String::new(), + ) + }, + |job| (job.state, job.kind), + ); + Ok::<_, WorkflowError>(( + index, + WorkflowNode { + name: node.name, + job_id: node.job_id, + kind: match node.kind { + NodeType::Task => WorkflowNodeKind::Task, + NodeType::Signal => WorkflowNodeKind::Signal, + NodeType::Timer => WorkflowNodeKind::Timer, + NodeType::ChildWorkflow => WorkflowNodeKind::ChildWorkflow, + NodeType::Condition => WorkflowNodeKind::Condition, + }, + job_kind, + state, + dependencies: node.deps, + dependents: node_dependents, + signal: node.signal, + wake_at_ms: node.wake_at_ms, + delay_ms: node.delay_ms, + child_workflow_id: node.child_workflow_id, + condition: node.condition, + completed_at_ms, + }, + )) + } + }, + )) + .buffer_unordered(WORKFLOW_CONCURRENCY) + .try_collect::>() + .await?; + indexed_nodes.sort_unstable_by_key(|(index, _)| *index); + let nodes = indexed_nodes.into_iter().map(|(_, node)| node).collect(); + Ok(WorkflowSnapshot { + workflow_id: workflow_id.to_string(), + coordinator_job_id, + coordinator_state: coordinator.state, + revision: cursor.revision, + generation: cursor.generation, + failed: cursor.failed, + failed_subgraph_retry: base.failed_subgraph_retry, + retry_policy: base.retry_policy, + nodes, + }) +} + +pub async fn workflow_node( + inspect: &dyn Inspect, + workflow_id: &str, + node: &str, +) -> Result { + inspect_workflow(inspect, workflow_id) + .await? + .node(node) + .cloned() + .ok_or_else(|| WorkflowError(format!("workflow node `{node}` was not found"))) +} + +pub async fn workflow_dependencies( + inspect: &dyn Inspect, + workflow_id: &str, + node: &str, +) -> Result, WorkflowError> { + let snapshot = inspect_workflow(inspect, workflow_id).await?; + snapshot + .dependencies(node) + .map(|nodes| nodes.into_iter().cloned().collect()) + .ok_or_else(|| WorkflowError(format!("workflow node `{node}` was not found"))) +} + +pub async fn workflow_dependents( + inspect: &dyn Inspect, + workflow_id: &str, + node: &str, +) -> Result, WorkflowError> { + let snapshot = inspect_workflow(inspect, workflow_id).await?; + snapshot + .dependents(node) + .map(|nodes| nodes.into_iter().cloned().collect()) + .ok_or_else(|| WorkflowError(format!("workflow node `{node}` was not found"))) +} + +async fn load_workflow_cursor( + inspect: &dyn Inspect, + coordinator_job_id: &str, + coordinator_state: &str, +) -> Result { + let checkpoint_inspect = inspect.as_checkpoint_inspect().ok_or_else(|| { + WorkflowError("workflow inspection requires checkpoint inspection support".into()) + })?; + let Some(checkpoint) = checkpoint_inspect + .get_job_checkpoint(coordinator_job_id) + .await + .map_err(|error| WorkflowError(error.to_string()))? + else { + return Ok(WorkflowCursor::default()); + }; + if checkpoint + .cursor_step + .as_deref() + .is_some_and(|step| step != "headgate:workflow-state") + { + return Err(WorkflowError( + "workflow coordinator has no workflow-state checkpoint".into(), + )); + } + let bytes = if let Some(cursor) = checkpoint.cursor { + Some(cursor) + } else if let Some(outputs) = inspect.as_output_inspect() { + outputs + .get_job_output(coordinator_job_id) + .await + .map_err(|error| WorkflowError(error.to_string()))? + .map(|output| output.bytes) + } else { + None + }; + if bytes.is_none() + && matches!( + coordinator_state, + "completed" | "archived" | "cancelled" | "quarantined" | "undecodable" + ) + { + return Err(WorkflowError( + "terminal workflow has no durable coordinator output".into(), + )); + } + bytes.map_or_else( + || Ok(WorkflowCursor::default()), + |bytes| { + serde_json::from_slice(&bytes) + .map_err(|error| WorkflowError(format!("invalid workflow cursor: {error}"))) + }, + ) +} + +/// Read the bounded durable event history kept in the fenced coordinator checkpoint. +pub async fn workflow_events( + inspect: &dyn Inspect, + workflow_id: &str, +) -> Result, WorkflowError> { + let checkpoint_inspect = inspect.as_checkpoint_inspect().ok_or_else(|| { + WorkflowError("workflow history requires checkpoint inspection support".into()) + })?; + let checkpoint = checkpoint_inspect + .get_job_checkpoint(&format!("{workflow_id}:coordinator")) + .await + .map_err(|error| WorkflowError(error.to_string()))? + .ok_or_else(|| WorkflowError(format!("workflow `{workflow_id}` was not found")))?; + if checkpoint + .cursor_step + .as_deref() + .is_some_and(|step| step != "headgate:workflow-state") + { + return Err(WorkflowError( + "workflow coordinator has no workflow-state checkpoint".into(), + )); + } + let bytes = if let Some(cursor) = checkpoint.cursor { + cursor + } else { + inspect + .as_output_inspect() + .ok_or_else(|| { + WorkflowError("workflow history requires output inspection support".into()) + })? + .get_job_output(&format!("{workflow_id}:coordinator")) + .await + .map_err(|error| WorkflowError(error.to_string()))? + .ok_or_else(|| WorkflowError("workflow has no durable history".into()))? + .bytes + }; + let cursor = serde_json::from_slice::(&bytes) + .map_err(|error| WorkflowError(format!("invalid workflow cursor: {error}")))?; + Ok(cursor.events) +} + +/// Request retry of only the failed and dependency-blocked portion of a retry-enabled +/// workflow. The receipt enqueue happens before the archived coordinator is reopened, +/// so interruption can be retried without losing the request. +pub async fn request_failed_subgraph_retry( + inspect: &dyn Inspect, + workflow_id: &str, + expected_revision: u64, +) -> Result { + request_failed_subgraph_retry_with_recovery(inspect, workflow_id, expected_revision, &[]).await +} + +pub async fn request_failed_subgraph_retry_with_recovery( + inspect: &dyn Inspect, + workflow_id: &str, + expected_revision: u64, + recoveries: &[WorkflowRecovery], +) -> Result { + if workflow_id.is_empty() || expected_revision == 0 { + return Err(WorkflowError( + "workflow id and expected revision must be set".into(), + )); + } + let coordinator_id = format!("{workflow_id}:coordinator"); + let coordinator = inspect + .get_job(&coordinator_id, true) + .await + .map_err(|error| WorkflowError(error.to_string()))? + .ok_or_else(|| WorkflowError(format!("workflow `{workflow_id}` was not found")))?; + let payload = coordinator + .payload + .ok_or_else(|| WorkflowError("workflow coordinator payload was not returned".into()))?; + let task = CoordinatorTask::decode(&payload) + .map_err(|error| WorkflowError(format!("invalid workflow coordinator: {error}")))?; + if !task.failed_subgraph_retry { + return Err(WorkflowError( + "workflow was not created with failed-subgraph retry enabled".into(), + )); + } + if coordinator.state != "archived" { + return Err(WorkflowError(format!( + "workflow retry requires an archived coordinator, found `{}`", + coordinator.state + ))); + } + let nodes: HashMap<&str, &NodeSpec> = task + .nodes + .iter() + .map(|node| (node.name.as_str(), node)) + .collect(); + let mut recovered = HashSet::new(); + for recovery in recoveries { + if !recovered.insert(recovery.node.as_str()) { + return Err(WorkflowError(format!( + "workflow recovery repeats node `{}`", + recovery.node + ))); + } + let node = nodes.get(recovery.node.as_str()).ok_or_else(|| { + WorkflowError(format!( + "workflow recovery names unknown node `{}`", + recovery.node + )) + })?; + let job = inspect + .get_job(&node.job_id, true) + .await + .map_err(|error| WorkflowError(error.to_string()))? + .ok_or_else(|| WorkflowError(format!("workflow node `{}` is missing", node.job_id)))?; + match job.state.as_str() { + "quarantined" if recovery.release_quarantine => { + inspect + .quarantine_release(&job.fingerprint) + .await + .map_err(|error| WorkflowError(error.to_string()))?; + } + "quarantined" => { + return Err(WorkflowError(format!( + "workflow node `{}` requires explicit quarantine release", + recovery.node + ))); + } + "undecodable" => { + let replacement = recovery.payload.as_deref().ok_or_else(|| { + WorkflowError(format!( + "undecodable workflow node `{}` requires replacement payload", + recovery.node + )) + })?; + let version = recovery.schema_version.ok_or_else(|| { + WorkflowError(format!( + "undecodable workflow node `{}` requires schema_version", + recovery.node + )) + })?; + inspect + .edit_payload( + &node.job_id, + replacement, + version, + &headgate::fingerprint(&job.kind, replacement), + ) + .await + .map_err(|error| WorkflowError(error.to_string()))?; + inspect + .operator_retry(&node.job_id) + .await + .map_err(|error| WorkflowError(error.to_string()))?; + } + "archived" | "cancelled" => {} + // A retry request may be replayed after its recovery mutation completed but + // before the coordinator was reopened. Treat that boundary as idempotent. + "available" => {} + state => { + return Err(WorkflowError(format!( + "workflow node `{}` does not require recovery from `{state}`", + recovery.node + ))); + } + } + } + for node in &task.nodes { + let job = inspect + .get_job(&node.job_id, false) + .await + .map_err(|error| WorkflowError(error.to_string()))?; + if let Some(job) = job + && matches!(job.state.as_str(), "quarantined" | "undecodable") + { + return Err(WorkflowError(format!( + "workflow node `{}` requires recovery from `{}`", + node.name, job.state + ))); + } + } + let checkpoint_inspect = inspect.as_checkpoint_inspect().ok_or_else(|| { + WorkflowError("workflow retry requires checkpoint inspection support".into()) + })?; + let checkpoint = checkpoint_inspect + .get_job_checkpoint(&coordinator_id) + .await + .map_err(|error| WorkflowError(error.to_string()))? + .ok_or_else(|| WorkflowError("workflow coordinator checkpoint is missing".into()))?; + if checkpoint.cursor_step.as_deref() != Some("headgate:workflow-state") { + return Err(WorkflowError( + "workflow coordinator has no workflow-state checkpoint".into(), + )); + } + let bytes = checkpoint + .cursor + .ok_or_else(|| WorkflowError("workflow coordinator cursor is missing".into()))?; + let cursor: WorkflowCursor = serde_json::from_slice(&bytes) + .map_err(|error| WorkflowError(format!("invalid workflow cursor: {error}")))?; + if !cursor.failed || cursor.revision != expected_revision { + return Err(WorkflowError(format!( + "workflow retry revision conflict: expected {expected_revision}, current {}", + cursor.revision + ))); + } + let next_revision = expected_revision + .checked_add(1) + .ok_or_else(|| WorkflowError("workflow retry revision would overflow".into()))?; + let generation = cursor + .generation + .checked_add(1) + .ok_or_else(|| WorkflowError("workflow generation would overflow".into()))?; + let retry = RetryTask { + workflow_id: workflow_id.into(), + expected_revision, + }; + let payload = retry + .encode() + .map_err(|error| WorkflowError(error.to_string()))?; + let receipt = headgate::prepare_envelope(Envelope { + id: retry_receipt_id(workflow_id, next_revision), + kind: RetryTask::TYPE.into(), + schema_version: RetryTask::VERSION, + fingerprint: headgate::fingerprint(RetryTask::TYPE, &payload), + payload, + queue: coordinator.queue, + pending: true, + retention_ms: DEFAULT_RETENTION_MS, + ..Default::default() + }) + .map_err(|error| WorkflowError(error.to_string()))?; + inspect + .enqueue(&[receipt]) + .await + .map_err(|error| WorkflowError(error.to_string()))?; + if let Err(error) = inspect.operator_retry(&coordinator_id).await { + let current = inspect + .get_job(&coordinator_id, false) + .await + .map_err(|read_error| WorkflowError(read_error.to_string()))?; + if !current + .as_ref() + .is_some_and(|job| matches!(job.state.as_str(), "available" | "running")) + { + return Err(WorkflowError(error.to_string())); + } + } + Ok(RetryReceipt { + revision: next_revision, + generation, + }) +} + +/// Durably emit a named signal for an existing workflow. Repeating an emission after +/// its signal jobs become available, running, or completed is an idempotent success. +pub async fn emit_signal( + inspect: &dyn Inspect, + workflow_id: &str, + signal: &str, +) -> Result { + emit_signal_with( + inspect, + workflow_id, + SignalEmission { + signal: signal.into(), + idempotency_key: format!("legacy:{signal}"), + payload: serde_json::Value::Null, + source: serde_json::json!({}), + }, + ) + .await +} + +/// Record payload and emitter metadata before releasing matching signal nodes. Replays +/// return the original record and may safely retry promotion. +pub async fn emit_signal_with( + inspect: &dyn Inspect, + workflow_id: &str, + emission: SignalEmission, +) -> Result { + let signal = emission.signal.as_str(); + if workflow_id.is_empty() || signal.is_empty() { + return Err(WorkflowError( + "workflow id and signal must not be empty".into(), + )); + } + let coordinator_id = format!("{workflow_id}:coordinator"); + let coordinator = inspect + .get_job(&coordinator_id, true) + .await + .map_err(|error| WorkflowError(error.to_string()))? + .ok_or_else(|| WorkflowError(format!("workflow `{workflow_id}` was not found")))?; + let payload = coordinator + .payload + .ok_or_else(|| WorkflowError("workflow coordinator payload was not returned".into()))?; + let task = CoordinatorTask::decode(&payload) + .map_err(|error| WorkflowError(format!("invalid workflow coordinator: {error}")))?; + let jobs: Vec<&str> = task + .nodes + .iter() + .filter(|node| node.kind == NodeType::Signal && node.signal.as_deref() == Some(signal)) + .map(|node| node.job_id.as_str()) + .collect(); + if jobs.is_empty() { + return Err(WorkflowError(format!( + "workflow `{workflow_id}` has no signal `{signal}`" + ))); + } + if emission.idempotency_key.is_empty() { + return Err(WorkflowError( + "signal idempotency key must not be empty".into(), + )); + } + let payload = + serde_json::to_vec(&emission.payload).map_err(|e| WorkflowError(e.to_string()))?; + let source = serde_json::to_vec(&emission.source).map_err(|e| WorkflowError(e.to_string()))?; + if payload.len() > MAX_SIGNAL_PAYLOAD_BYTES { + return Err(WorkflowError( + "signal payload must be at most 65536 bytes".into(), + )); + } + if source.len() > MAX_SIGNAL_SOURCE_BYTES { + return Err(WorkflowError( + "signal source must be at most 16384 bytes".into(), + )); + } + let (stored, inserted) = inspect + .append_durable_event(&DurableEvent { + event_id: 0, + scope: workflow_signal_scope(workflow_id), + topic: signal.into(), + idempotency_key: emission.idempotency_key, + payload, + source, + recorded_at_ms: 0, + }) + .await + .map_err(|e| WorkflowError(e.to_string()))?; + let mut promoted = 0; + for job_id in &jobs { + let job = inspect + .get_job(job_id, false) + .await + .map_err(|error| WorkflowError(error.to_string()))? + .ok_or_else(|| WorkflowError(format!("signal job `{job_id}` was not found")))?; + match job.state.as_str() { + "pending" => match inspect.promote_job(job_id).await { + Ok(()) => promoted += 1, + Err(error) => { + let current = inspect + .get_job(job_id, false) + .await + .map_err(|read_error| WorkflowError(read_error.to_string()))?; + if !current.as_ref().is_some_and(|job| { + matches!(job.state.as_str(), "available" | "running" | "completed") + }) { + return Err(WorkflowError(error.to_string())); + } + } + }, + "available" | "running" | "completed" => {} + state => { + return Err(WorkflowError(format!( + "signal job `{job_id}` cannot be emitted from state `{state}`" + ))); + } + } + } + Ok(SignalReceipt { + matched: jobs.len(), + promoted, + inserted, + emission: workflow_signal(stored)?, + }) +} + +pub async fn list_signals( + inspect: &dyn Inspect, + workflow_id: &str, + before_id: Option, + limit: u32, +) -> Result, WorkflowError> { + if workflow_id.is_empty() { + return Err(WorkflowError("workflow id must not be empty".into())); + } + inspect + .list_durable_events(&workflow_signal_scope(workflow_id), before_id, limit) + .await + .map_err(|e| WorkflowError(e.to_string()))? + .into_iter() + .map(workflow_signal) + .collect() +} + +fn workflow_signal_scope(workflow_id: &str) -> String { + format!("workflow:{workflow_id}:signals") +} + +fn workflow_signal(event: DurableEvent) -> Result { + Ok(WorkflowSignal { + id: event.event_id, + signal: event.topic, + idempotency_key: event.idempotency_key, + payload: serde_json::from_slice(&event.payload) + .map_err(|e| WorkflowError(format!("invalid signal payload: {e}")))?, + source: serde_json::from_slice(&event.source) + .map_err(|e| WorkflowError(format!("invalid signal source: {e}")))?, + recorded_at_ms: event.recorded_at_ms, + }) +} + +#[derive(Serialize, Deserialize)] +struct WorkflowCursor { + #[serde(default = "initial_workflow_revision")] + revision: u64, + #[serde(default)] + completed: Vec, + #[serde(default)] + completed_at_ms: HashMap, + #[serde(default)] + grafts: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pending_graft_receipt: Option, + #[serde(default = "initial_workflow_generation")] + generation: u32, + #[serde(default)] + failed: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pending_retry_receipt: Option, + #[serde(default)] + automatic_retry_pending: bool, + #[serde(default)] + events: Vec, +} + +impl Default for WorkflowCursor { + fn default() -> Self { + Self { + revision: initial_workflow_revision(), + completed: Vec::new(), + completed_at_ms: HashMap::new(), + grafts: Vec::new(), + pending_graft_receipt: None, + generation: initial_workflow_generation(), + failed: false, + pending_retry_receipt: None, + automatic_retry_pending: false, + events: Vec::new(), + } + } +} + +const fn initial_workflow_revision() -> u64 { + 1 +} + +const fn initial_workflow_generation() -> u32 { + 1 +} + +fn graft_receipt_id(workflow_id: &str, revision: u64) -> String { + format!("{workflow_id}:graft:{revision}") +} + +fn retry_receipt_id(workflow_id: &str, revision: u64) -> String { + format!("{workflow_id}:retry:{revision}") +} + +fn record_event( + cursor: &mut WorkflowCursor, + event: &str, + node: Option, + at_ms: Option, +) -> Result<(), WorkflowError> { + let sequence = cursor + .events + .last() + .map_or(1, |entry| entry.sequence.saturating_add(1)); + if sequence == u64::MAX && cursor.events.last().is_some() { + return Err(WorkflowError("workflow event sequence overflow".into())); + } + cursor.events.push(WorkflowEvent { + sequence, + event: event.into(), + node, + revision: cursor.revision, + generation: cursor.generation, + at_ms, + }); + if cursor.events.len() > MAX_WORKFLOW_EVENTS { + let excess = cursor.events.len() - MAX_WORKFLOW_EVENTS; + cursor.events.drain(..excess); + } + Ok(()) +} impl Task for CoordinatorTask { const TYPE: &'static str = "headgate:workflow"; @@ -246,44 +1938,521 @@ pub fn register_coordinator( if poll_interval.as_millis() == 0 { return Err("workflow poll interval must be at least 1ms".into()); } + register_virtual_handlers(registry)?; + let child_inspect = inspect.clone(); + registry.register::( + move |_ctx: JobCtx, task: ChildWorkflowTask| { + let inspect = child_inspect.clone(); + async move { + if task.child_workflow_id.is_empty() + || task.child_workflow_id == task.parent_workflow_id + { + return Err::<(), JobError>(Box::new(WorkflowError( + "invalid child workflow link".into(), + ))); + } + let child_id = format!("{}:coordinator", task.child_workflow_id); + let child = inspect.get_job(&child_id, false).await?.ok_or_else(|| { + WorkflowError(format!("child workflow `{child_id}` was not found")) + })?; + match child.state.as_str() { + "completed" => Ok(()), + "archived" | "cancelled" | "quarantined" | "undecodable" => { + Err(Control::Skip.into()) + } + _ => Err(Control::Snooze(poll_interval).into()), + } + } + }, + )?; registry.register::(move |ctx: JobCtx, task: CoordinatorTask| { let inspect = inspect.clone(); async move { let cursor_ctx = ctx.clone(); ctx.step_cursor("headgate:workflow-state", move |cursor| async move { - let cursor = cursor + let mut cursor = cursor .map(|bytes| serde_json::from_slice::(&bytes)) .transpose() .map_err(|error| -> JobError { Box::new(error) })? .unwrap_or_default(); - let mut completed = completed_set(&task, &cursor.completed); - match tick_with_evidence(inspect.as_ref(), &task, &mut completed, Some(&cursor_ctx)) - .await? + if cursor.events.is_empty() { + record_event(&mut cursor, "workflow_started", None, None)?; + persist_workflow_cursor(&cursor_ctx, &cursor).await?; + } + if cursor.automatic_retry_pending { + enqueue_automatic_retry( + inspect.as_ref(), + &task, + &mut cursor, + &cursor_ctx, + cursor_ctx.queue(), + ) + .await?; + } + if let Some(result) = + reconcile_retry(inspect.as_ref(), &task, &mut cursor, &cursor_ctx).await? + { + return match result { + Tick::Waiting => Err(Control::Snooze(poll_interval).into()), + Tick::Succeeded => Ok(()), + Tick::Failed => Err(Control::Skip.into()), + }; + } + if let Some(result) = + reconcile_graft(inspect.as_ref(), &task, &mut cursor, &cursor_ctx).await? + { + return match result { + Tick::Waiting => Err(Control::Snooze(poll_interval).into()), + Tick::Succeeded => Ok(()), + Tick::Failed => Err(Control::Skip.into()), + }; + } + let effective = effective_workflow(&task, &cursor); + match tick_with_evidence( + inspect.as_ref(), + &effective, + &mut cursor, + Some(&cursor_ctx), + ) + .await? { Tick::Waiting => Err(Control::Snooze(poll_interval).into()), - Tick::Succeeded => Ok(()), - Tick::Failed => Err(Control::Skip.into()), + Tick::Succeeded => { + record_event(&mut cursor, "workflow_succeeded", None, None)?; + persist_workflow_cursor(&cursor_ctx, &cursor).await?; + Ok(()) + } + Tick::Failed => { + if task.failed_subgraph_retry { + cursor.failed = true; + if task + .retry_policy + .is_some_and(|policy| cursor.generation < policy.max_generations) + { + cursor.automatic_retry_pending = true; + record_event(&mut cursor, "automatic_retry_scheduled", None, None)?; + } else { + record_event(&mut cursor, "workflow_failed", None, None)?; + } + persist_workflow_cursor(&cursor_ctx, &cursor).await?; + } else { + record_event(&mut cursor, "workflow_failed", None, None)?; + persist_workflow_cursor(&cursor_ctx, &cursor).await?; + } + if cursor.automatic_retry_pending { + let policy = task.retry_policy.expect("automatic retry policy"); + return Err(Control::Snooze(Duration::from_millis( + u64::try_from(policy.backoff_ms) + .map_err(|_| "invalid workflow retry backoff")?, + )) + .into()); + } + Err(Control::Skip.into()) + } } }) .await } - }) + }) +} + +fn register_virtual_handlers(registry: &mut Registry) -> Result<(), String> { + registry.register::(|_ctx: JobCtx, _task: SignalTask| async move { + Ok::<(), JobError>(()) + })?; + registry.register::(|_ctx: JobCtx, _task: TimerTask| async move { + Ok::<(), JobError>(()) + })?; + registry.register::(|_ctx: JobCtx, _task: ConditionTask| async move { + Ok::<(), JobError>(()) + })?; + registry.register::(|_ctx: JobCtx, _task: GraftTask| async move { + Ok::<(), JobError>(()) + })?; + registry.register::(|_ctx: JobCtx, _task: RetryTask| async move { + Ok::<(), JobError>(()) + })?; + Ok(()) +} + +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +enum Tick { + Waiting, + Succeeded, + Failed, +} + +fn effective_workflow(base: &CoordinatorTask, cursor: &WorkflowCursor) -> CoordinatorTask { + let mut nodes = Vec::with_capacity(base.nodes.len() + cursor.grafts.len()); + nodes.extend(base.nodes.iter().cloned()); + nodes.extend(cursor.grafts.iter().cloned()); + CoordinatorTask { + workflow_id: base.workflow_id.clone(), + nodes, + failed_subgraph_retry: base.failed_subgraph_retry, + retry_policy: base.retry_policy, + } +} + +async fn enqueue_automatic_retry( + inspect: &dyn Inspect, + base: &CoordinatorTask, + cursor: &mut WorkflowCursor, + ctx: &JobCtx, + queue: &str, +) -> Result<(), JobError> { + if !cursor.failed { + return Err(Box::new(WorkflowError( + "automatic retry is pending for a non-failed workflow".into(), + ))); + } + let next_revision = cursor + .revision + .checked_add(1) + .ok_or_else(|| WorkflowError("workflow retry revision would overflow".into()))?; + let retry = RetryTask { + workflow_id: base.workflow_id.clone(), + expected_revision: cursor.revision, + }; + let payload = retry.encode()?; + let receipt = headgate::prepare_envelope(Envelope { + id: retry_receipt_id(&base.workflow_id, next_revision), + kind: RetryTask::TYPE.into(), + schema_version: RetryTask::VERSION, + fingerprint: headgate::fingerprint(RetryTask::TYPE, &payload), + payload, + queue: queue.into(), + pending: true, + retention_ms: DEFAULT_RETENTION_MS, + ..Default::default() + })?; + inspect.enqueue(&[receipt]).await?; + cursor.automatic_retry_pending = false; + persist_workflow_cursor(ctx, cursor).await +} + +async fn persist_workflow_cursor(ctx: &JobCtx, cursor: &WorkflowCursor) -> Result<(), JobError> { + let bytes = serde_json::to_vec(cursor).map_err(|error| -> JobError { Box::new(error) })?; + ctx.set_cursor(bytes.clone()).await?; + ctx.persist_output(1, bytes).await?; + Ok(()) +} + +async fn reject_graft( + inspect: &dyn Inspect, + receipt_id: &str, + nodes: &[NodeSpec], +) -> Result<(), JobError> { + for job_id in nodes + .iter() + .map(|node| node.job_id.as_str()) + .chain(std::iter::once(receipt_id)) + { + let Some(job) = inspect.get_job(job_id, false).await? else { + continue; + }; + if matches!( + job.state.as_str(), + "pending" | "scheduled" | "available" | "retryable" + ) { + inspect.delete_job(job_id).await?; + } else { + return Err(Box::new(WorkflowError(format!( + "rejected workflow graft job `{job_id}` is already `{}`", + job.state + )))); + } + } + Ok(()) +} + +async fn failed_nodes_to_retry( + inspect: &dyn Inspect, + workflow: &CoordinatorTask, +) -> Result, JobError> { + let mut retry = Vec::new(); + for node in &workflow.nodes { + let job = inspect.get_job(&node.job_id, false).await?.ok_or_else(|| { + WorkflowError(format!( + "retry-enabled workflow node `{}` is missing", + node.job_id + )) + })?; + match job.state.as_str() { + "archived" | "cancelled" => retry.push(node.job_id.clone()), + "pending" | "scheduled" | "retryable" | "available" | "running" | "completed" => {} + state => { + return Err(Box::new(WorkflowError(format!( + "workflow node `{}` cannot be retried from `{state}`", + node.job_id + )))); + } + } + } + Ok(retry) +} + +async fn retry_failed_children( + inspect: &dyn Inspect, + workflow: &CoordinatorTask, +) -> Result<(), JobError> { + let checkpoint_inspect = inspect.as_checkpoint_inspect().ok_or_else(|| { + WorkflowError("child retry propagation requires checkpoint inspection support".into()) + })?; + for node in workflow + .nodes + .iter() + .filter(|node| node.kind == NodeType::ChildWorkflow) + { + let Some(child_workflow_id) = node.child_workflow_id.as_deref() else { + continue; + }; + let Some(link) = inspect.get_job(&node.job_id, false).await? else { + continue; + }; + if !matches!(link.state.as_str(), "archived" | "cancelled") { + continue; + } + let child_id = format!("{child_workflow_id}:coordinator"); + let Some(child) = inspect.get_job(&child_id, false).await? else { + return Err(Box::new(WorkflowError(format!( + "child workflow `{child_workflow_id}` is missing" + )))); + }; + if child.state != "archived" { + continue; + } + let checkpoint = checkpoint_inspect + .get_job_checkpoint(&child_id) + .await? + .ok_or_else(|| { + WorkflowError(format!( + "child workflow `{child_workflow_id}` has no checkpoint" + )) + })?; + let cursor: WorkflowCursor = serde_json::from_slice( + checkpoint + .cursor + .as_deref() + .ok_or_else(|| WorkflowError("child workflow cursor is missing".into()))?, + )?; + request_failed_subgraph_retry(inspect, child_workflow_id, cursor.revision).await?; + } + Ok(()) +} + +async fn reopen_failed_nodes(inspect: &dyn Inspect, jobs: &[String]) -> Result<(), JobError> { + for job_id in jobs { + inspect.operator_retry(job_id).await?; + } + Ok(()) +} + +async fn reconcile_retry( + inspect: &dyn Inspect, + base: &CoordinatorTask, + cursor: &mut WorkflowCursor, + ctx: &JobCtx, +) -> Result, JobError> { + if let Some(receipt_id) = cursor.pending_retry_receipt.clone() { + let receipt = inspect.get_job(&receipt_id, false).await?.ok_or_else(|| { + WorkflowError(format!( + "accepted workflow retry receipt `{receipt_id}` is missing" + )) + })?; + let workflow = effective_workflow(base, cursor); + match receipt.state.as_str() { + "pending" => { + let jobs = failed_nodes_to_retry(inspect, &workflow).await?; + reopen_failed_nodes(inspect, &jobs).await?; + inspect.promote_job(&receipt_id).await?; + return Ok(Some(Tick::Waiting)); + } + "available" | "running" => return Ok(Some(Tick::Waiting)), + "completed" => { + cursor.pending_retry_receipt = None; + persist_workflow_cursor(ctx, cursor).await?; + } + state => { + return Err(Box::new(WorkflowError(format!( + "accepted workflow retry receipt `{receipt_id}` entered `{state}`" + )))); + } + } + } + + let next_revision = cursor + .revision + .checked_add(1) + .ok_or_else(|| WorkflowError("workflow revision would overflow".into()))?; + let receipt_id = retry_receipt_id(&base.workflow_id, next_revision); + let Some(receipt) = inspect.get_job(&receipt_id, true).await? else { + return Ok(None); + }; + if receipt.state != "pending" { + return Err(Box::new(WorkflowError(format!( + "unaccepted workflow retry receipt `{receipt_id}` entered `{}`", + receipt.state + )))); + } + let payload = receipt.payload.ok_or_else(|| { + WorkflowError(format!( + "workflow retry receipt `{receipt_id}` did not return its payload" + )) + })?; + let retry = match RetryTask::decode(&payload) { + Ok(retry) => retry, + Err(_) => { + reject_graft(inspect, &receipt_id, &[]).await?; + return Ok(Some(Tick::Failed)); + } + }; + if !base.failed_subgraph_retry + || !cursor.failed + || retry.workflow_id != base.workflow_id + || retry.expected_revision != cursor.revision + { + reject_graft(inspect, &receipt_id, &[]).await?; + return Ok(Some(if cursor.failed { + Tick::Failed + } else { + Tick::Waiting + })); + } + let competing_graft_id = graft_receipt_id(&base.workflow_id, next_revision); + if let Some(competing) = inspect.get_job(&competing_graft_id, true).await? { + if competing.state != "pending" { + return Err(Box::new(WorkflowError(format!( + "competing workflow graft receipt `{competing_graft_id}` entered `{}`", + competing.state + )))); + } + let nodes = competing + .payload + .as_deref() + .and_then(|payload| GraftTask::decode(payload).ok()) + .map(|graft| graft.nodes) + .unwrap_or_default(); + reject_graft(inspect, &competing_graft_id, &nodes).await?; + } + let workflow = effective_workflow(base, cursor); + retry_failed_children(inspect, &workflow).await?; + let jobs = match failed_nodes_to_retry(inspect, &workflow).await { + Ok(jobs) => jobs, + Err(_) => { + reject_graft(inspect, &receipt_id, &[]).await?; + return Ok(Some(Tick::Failed)); + } + }; + cursor.generation = cursor + .generation + .checked_add(1) + .ok_or_else(|| WorkflowError("workflow generation would overflow".into()))?; + cursor.revision = next_revision; + cursor.failed = false; + record_event(cursor, "workflow_retry_accepted", None, None)?; + cursor.pending_retry_receipt = Some(receipt_id.clone()); + persist_workflow_cursor(ctx, cursor).await?; + reopen_failed_nodes(inspect, &jobs).await?; + inspect.promote_job(&receipt_id).await?; + Ok(Some(Tick::Waiting)) } -#[derive(Clone, Copy, Debug, Eq, PartialEq)] -enum Tick { - Waiting, - Succeeded, - Failed, +/// Reconcile at most one revision per tick. The cursor is persisted before the receipt +/// is promoted, so a crash can only replay an accepted revision, never lose it. +async fn reconcile_graft( + inspect: &dyn Inspect, + base: &CoordinatorTask, + cursor: &mut WorkflowCursor, + ctx: &JobCtx, +) -> Result, JobError> { + if cursor.revision == 0 { + return Err(Box::new(WorkflowError( + "workflow cursor contains revision zero".into(), + ))); + } + if let Some(receipt_id) = cursor.pending_graft_receipt.clone() { + let receipt = inspect.get_job(&receipt_id, false).await?.ok_or_else(|| { + WorkflowError(format!( + "accepted workflow graft receipt `{receipt_id}` is missing" + )) + })?; + match receipt.state.as_str() { + "pending" => { + inspect.promote_job(&receipt_id).await?; + return Ok(Some(Tick::Waiting)); + } + "available" | "running" => return Ok(Some(Tick::Waiting)), + "completed" => { + cursor.pending_graft_receipt = None; + persist_workflow_cursor(ctx, cursor).await?; + } + state => { + return Err(Box::new(WorkflowError(format!( + "accepted workflow graft receipt `{receipt_id}` entered `{state}`" + )))); + } + } + } + + let next_revision = cursor + .revision + .checked_add(1) + .ok_or_else(|| WorkflowError("workflow revision would overflow".into()))?; + let receipt_id = graft_receipt_id(&base.workflow_id, next_revision); + let Some(receipt) = inspect.get_job(&receipt_id, true).await? else { + return Ok(None); + }; + if receipt.state != "pending" { + return Err(Box::new(WorkflowError(format!( + "unaccepted workflow graft receipt `{receipt_id}` entered `{}`", + receipt.state + )))); + } + let payload = receipt.payload.ok_or_else(|| { + WorkflowError(format!( + "workflow graft receipt `{receipt_id}` did not return its payload" + )) + })?; + let graft = match GraftTask::decode(&payload) { + Ok(graft) => graft, + Err(_) => { + reject_graft(inspect, &receipt_id, &[]).await?; + return Ok(Some(Tick::Waiting)); + } + }; + if graft.workflow_id != base.workflow_id + || graft.expected_revision != cursor.revision + || graft.nodes.is_empty() + || cursor.failed + { + reject_graft(inspect, &receipt_id, &graft.nodes).await?; + return Ok(Some(Tick::Waiting)); + } + let mut candidate = effective_workflow(base, cursor); + candidate.nodes.extend(graft.nodes.iter().cloned()); + if validate_coordinator(&candidate).is_err() { + reject_graft(inspect, &receipt_id, &graft.nodes).await?; + return Ok(Some(Tick::Waiting)); + } + + cursor.revision = next_revision; + cursor.grafts.extend(graft.nodes); + record_event(cursor, "workflow_graft_accepted", None, None)?; + cursor.pending_graft_receipt = Some(receipt_id.clone()); + persist_workflow_cursor(ctx, cursor).await?; + inspect.promote_job(&receipt_id).await?; + Ok(Some(Tick::Waiting)) } async fn tick_with_evidence( inspect: &dyn Inspect, workflow: &CoordinatorTask, - completed: &mut HashSet, + cursor: &mut WorkflowCursor, persist_ctx: Option<&JobCtx>, ) -> Result { validate_coordinator(workflow).map_err(|error| -> JobError { Box::new(error) })?; + let mut completed = completed_set(workflow, &cursor.completed); let reads: Vec<(String, String)> = workflow .nodes .iter() @@ -297,58 +2466,76 @@ async fn tick_with_evidence( .try_collect() .await?; let state: HashMap> = entries.into_iter().collect(); - let mut changed = false; + let before = completed.clone(); + let changed = record_completion_evidence( + workflow, + &state, + &mut completed, + &mut cursor.completed_at_ms, + ); for node in &workflow.nodes { - if state - .get(node.name.as_str()) - .and_then(Option::as_ref) - .is_some_and(|job| job.state == "completed") - && completed.insert(node.name.clone()) - { - changed = true; + if !before.contains(node.name.as_str()) && completed.contains(node.name.as_str()) { + record_event( + cursor, + "node_completed", + Some(node.name.clone()), + cursor.completed_at_ms.get(&node.name).copied(), + )?; } } if changed && let Some(ctx) = persist_ctx { - let cursor = WorkflowCursor { - completed: completed_names(workflow, completed), - }; - let bytes = serde_json::to_vec(&cursor).map_err(|error| -> JobError { Box::new(error) })?; - ctx.set_cursor(bytes).await?; + cursor.completed = completed_names(workflow, &completed); + persist_workflow_cursor(ctx, cursor).await?; } + let failed_nodes = failed_set(workflow, &state, &completed); let mut mutations = Vec::new(); for node in &workflow.nodes { - if effective_state( + let current = effective_state( + node, state.get(node.name.as_str()).and_then(Option::as_ref), - node.name.as_str(), - completed, - ) != Some("pending") - { - continue; - } - let dep_failed = node.deps.iter().any(|dep| { - matches!( - effective_state( - state.get(dep.as_str()).and_then(Option::as_ref), - dep, - completed, - ), - None | Some("archived" | "cancelled" | "quarantined" | "undecodable") - ) - }); + &completed, + ); + let dep_failed = failed_nodes.contains(node.name.as_str()); if dep_failed { - mutations.push((node.job_id.clone(), true)); + if !workflow.failed_subgraph_retry + && matches!( + current, + Some("pending" | "scheduled" | "available" | "retryable") + ) + { + mutations.push((node.job_id.clone(), true)); + } continue; } - let deps_complete = node.deps.iter().all(|dep| { - effective_state( - state.get(dep.as_str()).and_then(Option::as_ref), - dep, - completed, - ) == Some("completed") - }); - if deps_complete { + if matches!(node.kind, NodeType::Task | NodeType::ChildWorkflow) + && current == Some("pending") + && dependencies_complete(workflow, node, &state, &completed) + { mutations.push((node.job_id.clone(), false)); } + if node.kind == NodeType::Condition + && current == Some("pending") + && dependencies_complete(workflow, node, &state, &completed) + && evaluate_condition(node, cursor, workflow, &state, &completed)? + { + mutations.push((node.job_id.clone(), false)); + } + if node.kind == NodeType::Timer + && node.delay_ms.is_some() + && current == Some("pending") + && dependencies_complete(workflow, node, &state, &completed) + { + let anchor = dependency_completion_anchor(node, &cursor.completed_at_ms)?; + let wake_at_ms = anchor + .checked_add(node.delay_ms.unwrap_or_default()) + .ok_or_else(|| { + WorkflowError(format!("workflow timer `{}` deadline overflow", node.name)) + })?; + inspect + .schedule_pending_job(&node.job_id, wake_at_ms) + .await?; + return Ok(Tick::Waiting); + } } if !mutations.is_empty() { stream::iter(mutations) @@ -366,10 +2553,14 @@ async fn tick_with_evidence( } let mut failed = false; for node in &workflow.nodes { + if failed_nodes.contains(node.name.as_str()) { + failed = true; + continue; + } match effective_state( + node, state.get(node.name.as_str()).and_then(Option::as_ref), - node.name.as_str(), - completed, + &completed, ) { Some("completed") => {} None | Some("archived" | "cancelled" | "quarantined" | "undecodable") => failed = true, @@ -383,6 +2574,213 @@ async fn tick_with_evidence( }) } +fn record_completion_evidence( + workflow: &CoordinatorTask, + state: &HashMap>, + completed: &mut HashSet, + completed_at_ms: &mut HashMap, +) -> bool { + let mut changed = false; + for node in &workflow.nodes { + if matches!(node.kind, NodeType::Task | NodeType::ChildWorkflow) + && let Some(job) = state + .get(node.name.as_str()) + .and_then(Option::as_ref) + .filter(|job| job.state == "completed") + { + changed |= completed.insert(node.name.clone()); + if let Some(at_ms) = job.finalized_at_ms { + changed |= completed_at_ms.insert(node.name.clone(), at_ms) != Some(at_ms); + } + } + } + loop { + let eligible: Vec = workflow + .nodes + .iter() + .filter(|node| { + matches!( + node.kind, + NodeType::Signal | NodeType::Timer | NodeType::Condition + ) + }) + .filter(|node| !completed.contains(node.name.as_str())) + .filter(|node| node.deps.iter().all(|dep| completed.contains(dep))) + .filter(|node| { + state + .get(node.name.as_str()) + .and_then(Option::as_ref) + .is_some_and(|job| job.state == "completed") + }) + .map(|node| node.name.clone()) + .collect(); + if eligible.is_empty() { + break; + } + changed = true; + for name in &eligible { + if let Some(at_ms) = state + .get(name.as_str()) + .and_then(Option::as_ref) + .and_then(|job| job.finalized_at_ms) + { + completed_at_ms.insert(name.clone(), at_ms); + } + } + completed.extend(eligible); + } + changed +} + +fn dependency_completion_anchor( + node: &NodeSpec, + completed_at_ms: &HashMap, +) -> Result { + let mut anchor = None; + for dependency in &node.deps { + let completed_at = completed_at_ms.get(dependency).copied().ok_or_else(|| { + Box::new(WorkflowError(format!( + "workflow timer `{}` has no durable completion timestamp for `{dependency}`", + node.name + ))) as JobError + })?; + anchor = Some(anchor.map_or(completed_at, |current: i64| current.max(completed_at))); + } + anchor.ok_or_else(|| { + Box::new(WorkflowError(format!( + "relative workflow timer `{}` requires at least one dependency", + node.name + ))) as JobError + }) +} + +fn evaluate_condition( + node: &NodeSpec, + cursor: &WorkflowCursor, + workflow: &CoordinatorTask, + state: &HashMap>, + completed: &HashSet, +) -> Result { + let expression = node.condition.as_deref().ok_or_else(|| { + Box::new(WorkflowError(format!( + "workflow condition `{}` has no expression", + node.name + ))) as JobError + })?; + let program = cel::Program::compile(expression).map_err(|error| { + Box::new(WorkflowError(format!( + "invalid workflow CEL condition `{}`: {error}", + node.name + ))) as JobError + })?; + let states: HashMap = workflow + .nodes + .iter() + .map(|candidate| { + let state = effective_state( + candidate, + state.get(candidate.name.as_str()).and_then(Option::as_ref), + completed, + ) + .unwrap_or("missing") + .to_string(); + (candidate.name.clone(), state) + }) + .collect(); + let completion: HashMap = workflow + .nodes + .iter() + .map(|candidate| { + ( + candidate.name.clone(), + completed.contains(candidate.name.as_str()), + ) + }) + .collect(); + let mut context = cel::Context::default(); + context.add_variable_from_value("revision", cursor.revision); + context.add_variable_from_value("generation", u64::from(cursor.generation)); + context.add_variable_from_value("states", states); + context.add_variable_from_value("completed", completion); + match program.execute(&context).map_err(|error| { + Box::new(WorkflowError(format!( + "workflow CEL condition `{}` failed: {error}", + node.name + ))) as JobError + })? { + cel::Value::Bool(value) => Ok(value), + _ => Err(Box::new(WorkflowError(format!( + "workflow CEL condition `{}` must return bool", + node.name + )))), + } +} + +fn dependencies_complete( + workflow: &CoordinatorTask, + node: &NodeSpec, + state: &HashMap>, + completed: &HashSet, +) -> bool { + node.deps.iter().all(|dep| { + let upstream = workflow + .nodes + .iter() + .find(|node| node.name == *dep) + .expect("validated dependency"); + effective_state( + upstream, + state.get(dep.as_str()).and_then(Option::as_ref), + completed, + ) == Some("completed") + }) +} + +#[cfg(test)] +fn dependency_failed( + workflow: &CoordinatorTask, + node: &NodeSpec, + state: &HashMap>, + completed: &HashSet, +) -> bool { + node.deps + .iter() + .any(|dep| failed_set(workflow, state, completed).contains(dep)) +} + +fn failed_set( + workflow: &CoordinatorTask, + state: &HashMap>, + completed: &HashSet, +) -> HashSet { + let mut failed: HashSet = workflow + .nodes + .iter() + .filter(|node| { + matches!( + effective_state( + node, + state.get(node.name.as_str()).and_then(Option::as_ref), + completed, + ), + None | Some("archived" | "cancelled" | "quarantined" | "undecodable") + ) + }) + .map(|node| node.name.clone()) + .collect(); + loop { + let before = failed.len(); + for node in &workflow.nodes { + if node.deps.iter().any(|dep| failed.contains(dep)) { + failed.insert(node.name.clone()); + } + } + if failed.len() == before { + return failed; + } + } +} + fn completed_set(workflow: &CoordinatorTask, names: &[String]) -> HashSet { let valid: HashSet<&str> = workflow .nodes @@ -406,12 +2804,21 @@ fn completed_names(workflow: &CoordinatorTask, completed: &HashSet) -> V } fn effective_state<'a>( + node: &NodeSpec, job: Option<&'a headgate_core::JobSummary>, - name: &str, completed: &HashSet, ) -> Option<&'a str> { - job.map(|job| job.state.as_str()) - .or_else(|| completed.contains(name).then_some("completed")) + if completed.contains(node.name.as_str()) { + return Some("completed"); + } + match (node.kind, job.map(|job| job.state.as_str())) { + // An early signal is durable evidence, but it is not consumed until all of the + // signal node's dependencies have completed. + (NodeType::Signal | NodeType::Timer | NodeType::Condition, Some("completed")) => { + Some("pending") + } + (_, state) => state, + } } fn validate_coordinator(workflow: &CoordinatorTask) -> Result<(), WorkflowError> { @@ -425,6 +2832,13 @@ fn validate_coordinator(workflow: &CoordinatorTask) -> Result<(), WorkflowError> "workflow coordinator must contain 1-{MAX_WORKFLOW_NODES} tasks" ))); } + if workflow.retry_policy.is_some_and(|policy| { + policy.max_generations < 2 || policy.backoff_ms <= 0 || !workflow.failed_subgraph_retry + }) { + return Err(WorkflowError( + "workflow coordinator contains an invalid retry policy".into(), + )); + } let mut names = HashSet::with_capacity(workflow.nodes.len()); let mut edges = 0usize; for node in &workflow.nodes { @@ -433,6 +2847,25 @@ fn validate_coordinator(workflow: &CoordinatorTask) -> Result<(), WorkflowError> || node.job_id.is_empty() || node.job_id.len() > MAX_JOB_IDENTIFIER_LEN || !names.insert(node.name.as_str()) + || (node.kind == NodeType::Signal && node.signal.as_deref().is_none_or(str::is_empty)) + || (node.kind == NodeType::Timer + && match (node.wake_at_ms, node.delay_ms) { + (Some(at), None) => at <= 0, + (None, Some(delay)) => delay <= 0 || node.deps.is_empty(), + _ => true, + }) + || (node.kind != NodeType::Signal && node.signal.is_some()) + || (node.kind != NodeType::Timer + && (node.wake_at_ms.is_some() || node.delay_ms.is_some())) + || (node.kind == NodeType::ChildWorkflow + && node.child_workflow_id.as_deref().is_none_or(str::is_empty)) + || (node.kind != NodeType::ChildWorkflow && node.child_workflow_id.is_some()) + || (node.kind == NodeType::Condition + && node + .condition + .as_deref() + .is_none_or(|condition| validate_condition(condition).is_err())) + || (node.kind != NodeType::Condition && node.condition.is_some()) { return Err(WorkflowError( "workflow coordinator contains an invalid task".into(), @@ -445,14 +2878,47 @@ fn validate_coordinator(workflow: &CoordinatorTask) -> Result<(), WorkflowError> "workflow coordinator must contain at most {MAX_WORKFLOW_EDGES} dependency edges" ))); } - if workflow + let mut indegree: HashMap<&str, usize> = workflow .nodes .iter() - .flat_map(|node| &node.deps) - .any(|dep| !names.contains(dep.as_str())) - { + .map(|node| (node.name.as_str(), 0)) + .collect(); + let mut outgoing: HashMap<&str, Vec<&str>> = HashMap::new(); + for node in &workflow.nodes { + let mut unique = HashSet::new(); + for dep in &node.deps { + if !names.contains(dep.as_str()) { + return Err(WorkflowError( + "workflow coordinator contains a missing dependency".into(), + )); + } + if !unique.insert(dep.as_str()) { + return Err(WorkflowError( + "workflow coordinator repeats a dependency".into(), + )); + } + *indegree.get_mut(node.name.as_str()).expect("known node") += 1; + outgoing.entry(dep).or_default().push(&node.name); + } + } + let mut ready: VecDeque<&str> = indegree + .iter() + .filter_map(|(name, degree)| (*degree == 0).then_some(*name)) + .collect(); + let mut visited = 0; + while let Some(name) = ready.pop_front() { + visited += 1; + for child in outgoing.get(name).into_iter().flatten() { + let degree = indegree.get_mut(child).expect("known child"); + *degree -= 1; + if *degree == 0 { + ready.push_back(child); + } + } + } + if visited != workflow.nodes.len() { return Err(WorkflowError( - "workflow coordinator contains a missing dependency".into(), + "workflow coordinator dependency graph contains a cycle".into(), )); } Ok(()) @@ -462,6 +2928,81 @@ fn validate_coordinator(workflow: &CoordinatorTask) -> Result<(), WorkflowError> mod tests { use super::*; + #[derive(Clone)] + struct GraftStep(String); + + impl Task for GraftStep { + const TYPE: &'static str = "workflow:test-graft-step"; + + fn encode(&self) -> Result, CodecError> { + Ok(self.0.as_bytes().to_vec()) + } + + fn decode(bytes: &[u8]) -> Result { + Ok(Self(String::from_utf8_lossy(bytes).into_owned())) + } + } + + fn graft_env(value: &str) -> Envelope { + let task = GraftStep(value.into()); + Envelope { + kind: GraftStep::TYPE.into(), + payload: task.encode().unwrap(), + queue: "headgate-workflow".into(), + ..Default::default() + } + } + + #[test] + fn workflow_snapshot_answers_topology_queries() { + let snapshot = WorkflowSnapshot { + workflow_id: "wf".into(), + coordinator_job_id: "wf:coordinator".into(), + coordinator_state: "running".into(), + revision: 2, + generation: 1, + failed: false, + failed_subgraph_retry: true, + retry_policy: None, + nodes: vec![ + WorkflowNode { + name: "prepare".into(), + job_id: "wf:prepare".into(), + kind: WorkflowNodeKind::Task, + job_kind: "task:prepare".into(), + state: "completed".into(), + dependencies: vec![], + dependents: vec!["publish".into()], + signal: None, + wake_at_ms: None, + delay_ms: None, + child_workflow_id: None, + condition: None, + completed_at_ms: Some(42), + }, + WorkflowNode { + name: "publish".into(), + job_id: "wf:publish".into(), + kind: WorkflowNodeKind::Task, + job_kind: "task:publish".into(), + state: "pending".into(), + dependencies: vec!["prepare".into()], + dependents: vec![], + signal: None, + wake_at_ms: None, + delay_ms: None, + child_workflow_id: None, + condition: None, + completed_at_ms: None, + }, + ], + }; + assert_eq!(snapshot.node("prepare").unwrap().state, "completed"); + assert_eq!(snapshot.dependencies("publish").unwrap()[0].name, "prepare"); + assert_eq!(snapshot.dependents("prepare").unwrap()[0].name, "publish"); + assert!(snapshot.dependencies("missing").is_none()); + } + fn env(kind: &str) -> Envelope { Envelope { kind: kind.into(), @@ -471,6 +3012,35 @@ mod tests { } } + fn summary(id: &str, state: &str) -> headgate_core::JobSummary { + headgate_core::JobSummary { + id: id.into(), + kind: "test".into(), + queue: "default".into(), + state: state.into(), + schema_version: 1, + priority: 0, + attempt: 0, + crash_attempt: 0, + max_attempts: 1, + partition_key: String::new(), + rate_class: String::new(), + sticky_worker: String::new(), + weight: 1, + fingerprint: "fp".into(), + enqueued_at_ms: 0, + scheduled_at_ms: 0, + claimed_at_ms: None, + periodic_schedule_id: String::new(), + periodic_tick_ms: 0, + finalized_at_ms: None, + payload: None, + headers: Default::default(), + errors_json: "[]".into(), + tags: Vec::new(), + } + } + #[test] fn prepare_builds_one_coordinator_and_pending_fan_out_fan_in() { let batch = Workflow::new("wf1") @@ -501,6 +3071,127 @@ mod tests { assert_eq!(batch[1].retention_ms, 3 * 60 * 60 * 1000); } + #[test] + fn signal_is_pending_work_and_early_completion_waits_for_dependencies() { + let batch = Workflow::new("wf-signals") + .add("prepare", env("task:prepare"), Vec::::new()) + .add_signal("approval", "approved", ["prepare"]) + .add("publish", env("task:publish"), ["approval"]) + .prepare() + .unwrap(); + assert_eq!(batch[2].kind, SignalTask::TYPE); + assert!(batch[2].pending); + let task = CoordinatorTask::decode(&batch[0].payload).unwrap(); + assert_eq!(task.nodes[1].kind, NodeType::Signal); + assert_eq!(task.nodes[1].signal.as_deref(), Some("approved")); + + let mut state = HashMap::from([ + ("prepare".into(), Some(summary("prepare", "available"))), + ("approval".into(), Some(summary("approval", "completed"))), + ("publish".into(), Some(summary("publish", "pending"))), + ]); + let mut completed = HashSet::new(); + let mut completed_at_ms = HashMap::new(); + assert!(!record_completion_evidence( + &task, + &state, + &mut completed, + &mut completed_at_ms + )); + assert!(!completed.contains("approval")); + + state.insert("prepare".into(), Some(summary("prepare", "completed"))); + assert!(record_completion_evidence( + &task, + &state, + &mut completed, + &mut completed_at_ms + )); + assert!(completed.contains("prepare")); + assert!(completed.contains("approval")); + } + + #[test] + fn timer_uses_absolute_schedule_and_buffers_until_dependencies_complete() { + let batch = Workflow::new("wf-timer") + .add("prepare", env("task:prepare"), Vec::::new()) + .add_timer_at("release", 1_500, ["prepare"]) + .add("publish", env("task:publish"), ["release"]) + .prepare() + .unwrap(); + assert_eq!(batch[2].kind, TimerTask::TYPE); + assert!(!batch[2].pending); + assert_eq!(batch[2].scheduled_at_ms, 1_500); + let task = CoordinatorTask::decode(&batch[0].payload).unwrap(); + assert_eq!(task.nodes[1].kind, NodeType::Timer); + assert_eq!(task.nodes[1].wake_at_ms, Some(1_500)); + + let mut state = HashMap::from([ + ("prepare".into(), Some(summary("prepare", "available"))), + ("release".into(), Some(summary("release", "completed"))), + ("publish".into(), Some(summary("publish", "pending"))), + ]); + let mut completed = HashSet::new(); + let mut completed_at_ms = HashMap::new(); + assert!(!record_completion_evidence( + &task, + &state, + &mut completed, + &mut completed_at_ms + )); + assert!(!completed.contains("release")); + + state.insert("prepare".into(), Some(summary("prepare", "completed"))); + assert!(record_completion_evidence( + &task, + &state, + &mut completed, + &mut completed_at_ms + )); + assert!(completed.contains("release")); + + completed.clear(); + state.insert("prepare".into(), Some(summary("prepare", "archived"))); + assert!(dependency_failed(&task, &task.nodes[1], &state, &completed)); + } + + #[test] + fn relative_timer_anchors_to_dependency_completion() { + let workflow = Workflow::new("wf-relative") + .add("prepare", env("task:prepare"), Vec::::new()) + .add_timer_after("wait", Duration::from_millis(250), ["prepare"]) + .unwrap(); + let batch = workflow.prepare().unwrap(); + let task = CoordinatorTask::decode(&batch[0].payload).unwrap(); + let timer = &task.nodes[1]; + assert_eq!( + dependency_completion_anchor(timer, &HashMap::from([("prepare".into(), 1_000)])) + .unwrap() + + timer.delay_ms.unwrap(), + 1_250 + ); + } + + #[test] + fn child_workflow_is_an_explicit_pending_node() { + let batch = Workflow::new("parent") + .add_child("billing", "billing-child", Vec::::new()) + .add("finish", env("task:finish"), ["billing"]) + .prepare() + .unwrap(); + assert_eq!(batch[1].kind, ChildWorkflowTask::TYPE); + assert!(batch[1].pending); + let child = ChildWorkflowTask::decode(&batch[1].payload).unwrap(); + assert_eq!(child.parent_workflow_id, "parent"); + assert_eq!(child.child_workflow_id, "billing-child"); + let coordinator = CoordinatorTask::decode(&batch[0].payload).unwrap(); + assert_eq!(coordinator.nodes[0].kind, NodeType::ChildWorkflow); + assert_eq!( + coordinator.nodes[0].child_workflow_id.as_deref(), + Some("billing-child") + ); + } + #[test] fn retained_completion_survives_a_missing_job_row() { let task = CoordinatorTask { @@ -509,14 +3200,20 @@ mod tests { name: "prepare".into(), job_id: "prepare".into(), deps: Vec::new(), + kind: NodeType::Task, + signal: None, + wake_at_ms: None, + delay_ms: None, + child_workflow_id: None, + condition: None, }], + failed_subgraph_retry: false, + retry_policy: None, }; let completed = completed_set(&task, &["prepare".into()]); - assert_eq!( - effective_state(None, "prepare", &completed), - Some("completed") - ); - assert_eq!(effective_state(None, "unknown", &completed), None); + let node = &task.nodes[0]; + assert_eq!(effective_state(node, None, &completed), Some("completed")); + assert_eq!(effective_state(node, None, &HashSet::new()), None); } #[test] @@ -534,6 +3231,116 @@ mod tests { assert!(cycle.to_string().contains("cycle")); } + #[test] + fn revisioned_graft_prepares_one_atomic_receipt_and_pending_tasks() { + let graft = WorkflowGraft::new("wf-graft", 1) + .add("after", graft_env("after"), ["root"]) + .prepare() + .unwrap(); + assert_eq!(graft[0].id, "wf-graft:graft:2"); + assert_eq!(graft[1].id, "wf-graft:g2:after"); + assert!(graft.iter().all(|job| job.pending)); + let receipt = GraftTask::decode(&graft[0].payload).unwrap(); + assert_eq!(receipt.workflow_id, "wf-graft"); + assert_eq!(receipt.expected_revision, 1); + assert_eq!(receipt.nodes[0].deps, ["root"]); + + let cycle = WorkflowGraft::new("wf-graft", 1) + .add("a", graft_env("a"), ["b"]) + .add("b", graft_env("b"), ["a"]) + .prepare() + .unwrap_err(); + assert!(cycle.to_string().contains("cycle")); + } + + #[test] + fn failed_subgraph_retry_is_explicit_in_the_coordinator_payload() { + let batch = Workflow::new("wf-retry") + .failed_subgraph_retry() + .add("prepare", graft_env("prepare"), Vec::::new()) + .add("finish", graft_env("finish"), ["prepare"]) + .prepare() + .unwrap(); + let coordinator = CoordinatorTask::decode(&batch[0].payload).unwrap(); + assert!(coordinator.failed_subgraph_retry); + assert!(batch[1..].iter().all(|job| job.pending)); + } + + #[test] + fn automatic_retry_policy_and_cel_condition_are_validated() { + let batch = Workflow::new("wf-auto") + .automatic_retry(3, Duration::from_millis(25)) + .unwrap() + .add("prepare", env("task:prepare"), Vec::::new()) + .add_condition( + "ready", + "completed.prepare && states.prepare == 'completed' && generation == 1u", + ["prepare"], + ) + .prepare() + .unwrap(); + let coordinator = CoordinatorTask::decode(&batch[0].payload).unwrap(); + assert_eq!( + coordinator.retry_policy, + Some(WorkflowRetryPolicy { + max_generations: 3, + backoff_ms: 25, + }) + ); + let mut cursor = WorkflowCursor::default(); + cursor.completed.push("prepare".into()); + let completed = completed_set(&coordinator, &cursor.completed); + let states = HashMap::from([( + "prepare".into(), + Some(summary("wf-auto:prepare", "completed")), + )]); + assert!( + evaluate_condition( + &coordinator.nodes[1], + &cursor, + &coordinator, + &states, + &completed, + ) + .unwrap() + ); + + assert!( + Workflow::new("bad-cel") + .add_condition("ready", "completed[", Vec::::new()) + .prepare() + .is_err() + ); + } + + #[test] + fn atomic_bundle_rejects_cross_workflow_cycles() { + let parent = Workflow::new("parent").add_child("child", "child", Vec::::new()); + let child = Workflow::new("child").add("work", env("task:child"), Vec::::new()); + let batch = prepare_bundle(vec![parent, child]).unwrap(); + assert_eq!(batch.len(), 4); + + let left = Workflow::new("left").add_child("right", "right", Vec::::new()); + let right = Workflow::new("right").add_child("left", "left", Vec::::new()); + assert!( + prepare_bundle(vec![left, right]) + .unwrap_err() + .to_string() + .contains("cycle") + ); + } + + #[test] + fn workflow_history_is_bounded_and_monotonic() { + let mut cursor = WorkflowCursor::default(); + for index in 0..(MAX_WORKFLOW_EVENTS + 7) { + record_event(&mut cursor, "tick", Some(index.to_string()), None).unwrap(); + } + assert_eq!(cursor.events.len(), MAX_WORKFLOW_EVENTS); + assert_eq!(cursor.events.first().unwrap().sequence, 8); + assert_eq!(cursor.events.last().unwrap().sequence, 263); + } + #[test] fn workflow_and_coordinator_resource_bounds_are_enforced() { let mut workflow = Workflow::new("too-large"); @@ -559,8 +3366,16 @@ mod tests { name: format!("node-{index}"), job_id: format!("job-{index}"), deps: Vec::new(), + kind: NodeType::Task, + signal: None, + wake_at_ms: None, + delay_ms: None, + child_workflow_id: None, + condition: None, }) .collect(), + failed_subgraph_retry: false, + retry_policy: None, }; assert!(validate_coordinator(&forged).is_err()); } diff --git a/crates/headgate-workflow/tests/live.rs b/crates/headgate-workflow/tests/live.rs index 6f1d6f2..8953896 100644 --- a/crates/headgate-workflow/tests/live.rs +++ b/crates/headgate-workflow/tests/live.rs @@ -1,12 +1,19 @@ use std::{ - sync::{Arc, Mutex}, + sync::{ + Arc, Mutex, + atomic::{AtomicUsize, Ordering}, + }, time::Duration, }; use headgate::{CodecError, Envelope, JobCtx, Registry, Store, Task, WorkerConfig, testing}; use headgate_core::Inspect; use headgate_postgres::PgStore; -use headgate_workflow::{Workflow, register_coordinator}; +use headgate_redis::{RedisStore, RedisStoreOptions}; +use headgate_workflow::{ + SignalEmission, Workflow, WorkflowGraft, emit_signal, emit_signal_with, list_signals, + register_coordinator, request_failed_subgraph_retry, workflow_events, +}; #[derive(Clone)] struct Step(String); @@ -31,6 +38,157 @@ fn envelope(queue: &str, step: &str) -> Envelope { } } +async fn run_experimental_matrix_cell(store: Arc, backend: &str) +where + S: Store + Inspect + Send + Sync + 'static, +{ + let suffix = format!( + "{}-{}-{}", + std::process::id(), + backend, + std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_nanos() + ); + let workflow_id = format!("workflow-matrix-{suffix}"); + let queue = format!("workflow-matrix-{suffix}"); + let mut unstable = envelope(&queue, "unstable"); + unstable.max_attempts = 1; + let batch = Workflow::new(&workflow_id) + .coordinator_queue(&queue) + .automatic_retry(2, Duration::from_millis(2)) + .unwrap() + .add("prepare", envelope(&queue, "prepare"), Vec::::new()) + .add("unstable", unstable, ["prepare"]) + .add_condition( + "ready", + "completed.unstable && states.unstable == 'completed'", + ["unstable"], + ) + .add_timer_after("pause", Duration::from_millis(2), ["ready"]) + .unwrap() + .add_signal("approval", "approved", ["pause"]) + .add("finish", envelope(&queue, "finish"), ["approval"]) + .prepare() + .unwrap(); + store.enqueue(&batch).await.unwrap(); + let signal = SignalEmission { + signal: "approved".into(), + idempotency_key: format!("matrix-approval:{workflow_id}"), + payload: serde_json::json!({"approved": true, "backend": backend}), + source: serde_json::json!({"emitter": "workflow-matrix"}), + }; + let receipt = emit_signal_with(store.as_ref(), &workflow_id, signal.clone()) + .await + .unwrap(); + assert_eq!(receipt.matched, 1); + assert!(receipt.inserted); + let replay = emit_signal_with(store.as_ref(), &workflow_id, signal) + .await + .unwrap(); + assert!(!replay.inserted); + assert_eq!(replay.emission, receipt.emission); + let signals = list_signals(store.as_ref(), &workflow_id, None, 100) + .await + .unwrap(); + assert_eq!(signals, [receipt.emission]); + + let failures = Arc::new(AtomicUsize::new(1)); + let order = Arc::new(Mutex::new(Vec::new())); + let mut registry = Registry::new(); + register_coordinator( + &mut registry, + store.clone() as Arc, + Duration::from_millis(2), + ) + .unwrap(); + let seen = order.clone(); + let remaining = failures.clone(); + registry + .register::(move |_ctx: JobCtx, step: Step| { + let seen = seen.clone(); + let remaining = remaining.clone(); + async move { + seen.lock().unwrap().push(step.0.clone()); + if step.0 == "unstable" && remaining.fetch_sub(1, Ordering::SeqCst) == 1 { + return Err::<(), headgate::JobError>("planned workflow failure".into()); + } + Ok(()) + } + }) + .unwrap(); + let registry = Arc::new(registry); + let cfg = WorkerConfig { + queues: vec![queue], + ..Default::default() + }; + for _ in 0..100 { + let _ = testing::drain(&store, ®istry, &cfg, 32).await; + if store + .get_job(&format!("{workflow_id}:coordinator"), false) + .await + .unwrap() + .is_some_and(|job| job.state == "completed") + { + break; + } + tokio::time::sleep(Duration::from_millis(3)).await; + } + assert_eq!( + store + .get_job(&format!("{workflow_id}:coordinator"), false) + .await + .unwrap() + .unwrap() + .state, + "completed" + ); + assert_eq!( + order.lock().unwrap().as_slice(), + &["prepare", "unstable", "unstable", "finish"] + ); + let events = workflow_events(store.as_ref(), &workflow_id).await.unwrap(); + assert!( + events + .iter() + .any(|event| event.event == "automatic_retry_scheduled") + ); + assert!( + events + .iter() + .any(|event| event.event == "workflow_succeeded") + ); +} + +#[tokio::test] +async fn workflow_experiments_postgres_matrix_cell() { + let Ok(conninfo) = std::env::var("HG_TEST_PG") else { + eprintln!("HG_TEST_PG not set; skipping Rust/Postgres workflow matrix cell"); + return; + }; + run_experimental_matrix_cell(Arc::new(PgStore::connect(&conninfo, 4).unwrap()), "pg").await; +} + +#[tokio::test] +async fn workflow_experiments_redis_matrix_cell() { + let Ok(url) = std::env::var("HG_TEST_REDIS") else { + eprintln!("HG_TEST_REDIS not set; skipping Rust/Redis workflow matrix cell"); + return; + }; + let client = redis::Client::open(url).unwrap(); + let conn = client.get_connection_manager().await.unwrap(); + let prefix = format!( + "workflow-matrix-rust-{}", + std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_nanos() + ); + let store = RedisStore::with_options(conn, prefix, RedisStoreOptions::default()); + run_experimental_matrix_cell(Arc::new(store), "redis").await; +} + #[tokio::test] async fn live_postgres_dag_promotes_fan_out_then_fan_in() { let Ok(conninfo) = std::env::var("HG_TEST_PG") else { @@ -102,3 +260,354 @@ async fn live_postgres_dag_promotes_fan_out_then_fan_in() { assert!(order[1..3].contains(&"left".to_string())); assert!(order[1..3].contains(&"right".to_string())); } + +#[tokio::test] +async fn live_postgres_buffers_and_idempotently_replays_workflow_signal() { + let Ok(conninfo) = std::env::var("HG_TEST_PG") else { + eprintln!("HG_TEST_PG not set; skipping workflow signal proof"); + return; + }; + let store = Arc::new(PgStore::connect(&conninfo, 4).expect("connect")); + let suffix = std::process::id(); + let workflow_id = format!("workflow-signal-live-{suffix}"); + let queue = format!("workflow-signal-live-{suffix}"); + let batch = Workflow::new(&workflow_id) + .coordinator_queue(&queue) + .add("prepare", envelope(&queue, "prepare"), Vec::::new()) + .add_signal("approval", "approved", ["prepare"]) + .add("publish", envelope(&queue, "publish"), ["approval"]) + .prepare() + .unwrap(); + store.enqueue(&batch).await.unwrap(); + + let first = emit_signal(store.as_ref(), &workflow_id, "approved") + .await + .unwrap(); + assert_eq!(first.matched, 1); + assert_eq!(first.promoted, 1); + + let order = Arc::new(Mutex::new(Vec::new())); + let mut registry = Registry::new(); + register_coordinator( + &mut registry, + store.clone() as Arc, + Duration::from_millis(2), + ) + .unwrap(); + let seen = order.clone(); + registry + .register::(move |_ctx: JobCtx, step: Step| { + let seen = seen.clone(); + async move { + seen.lock().unwrap().push(step.0); + Ok(()) + } + }) + .unwrap(); + let registry = Arc::new(registry); + let cfg = WorkerConfig { + queues: vec![queue], + ..Default::default() + }; + + for _ in 0..30 { + let _ = testing::drain(&store, ®istry, &cfg, 16).await; + let state = store + .get_job(&format!("{workflow_id}:coordinator"), false) + .await + .unwrap() + .unwrap() + .state; + if state == "completed" { + break; + } + tokio::time::sleep(Duration::from_millis(3)).await; + } + assert_eq!( + order.lock().unwrap().as_slice(), + &["prepare".to_string(), "publish".to_string()] + ); + let repeated = emit_signal(store.as_ref(), &workflow_id, "approved") + .await + .unwrap(); + assert_eq!(repeated.matched, 1); + assert_eq!(repeated.promoted, 0); +} + +#[tokio::test] +async fn live_postgres_parent_waits_for_child_workflow() { + let Ok(conninfo) = std::env::var("HG_TEST_PG") else { + eprintln!("HG_TEST_PG not set; skipping nested workflow proof"); + return; + }; + let store = Arc::new(PgStore::connect(&conninfo, 4).expect("connect")); + let suffix = std::process::id(); + let child_id = format!("workflow-child-live-{suffix}"); + let parent_id = format!("workflow-parent-live-{suffix}"); + let queue = format!("workflow-nested-live-{suffix}"); + let child = Workflow::new(&child_id) + .coordinator_queue(&queue) + .add( + "child-work", + envelope(&queue, "child-work"), + Vec::::new(), + ) + .prepare() + .unwrap(); + let parent = Workflow::new(&parent_id) + .coordinator_queue(&queue) + .add_child("child", &child_id, Vec::::new()) + .add( + "parent-finish", + envelope(&queue, "parent-finish"), + ["child"], + ) + .prepare() + .unwrap(); + store.enqueue(&child).await.unwrap(); + store.enqueue(&parent).await.unwrap(); + + let order = Arc::new(Mutex::new(Vec::new())); + let mut registry = Registry::new(); + register_coordinator( + &mut registry, + store.clone() as Arc, + Duration::from_millis(2), + ) + .unwrap(); + let seen = order.clone(); + registry + .register::(move |_ctx: JobCtx, step: Step| { + let seen = seen.clone(); + async move { + seen.lock().unwrap().push(step.0); + Ok(()) + } + }) + .unwrap(); + let registry = Arc::new(registry); + let cfg = WorkerConfig { + queues: vec![queue], + ..Default::default() + }; + for _ in 0..40 { + let _ = testing::drain(&store, ®istry, &cfg, 16).await; + let state = store + .get_job(&format!("{parent_id}:coordinator"), false) + .await + .unwrap() + .unwrap() + .state; + if state == "completed" { + break; + } + tokio::time::sleep(Duration::from_millis(3)).await; + } + assert_eq!( + order.lock().unwrap().as_slice(), + &["child-work".to_string(), "parent-finish".to_string()] + ); +} + +#[tokio::test] +async fn live_postgres_accepts_one_revisioned_workflow_graft_atomically() { + let Ok(conninfo) = std::env::var("HG_TEST_PG") else { + eprintln!("HG_TEST_PG not set; skipping workflow graft proof"); + return; + }; + let store = Arc::new(PgStore::connect(&conninfo, 4).expect("connect")); + let suffix = std::process::id(); + let workflow_id = format!("workflow-graft-live-{suffix}"); + let queue = format!("workflow-graft-live-{suffix}"); + let base = Workflow::new(&workflow_id) + .coordinator_queue(&queue) + .add("root", envelope(&queue, "root"), Vec::::new()) + .prepare() + .unwrap(); + let graft = WorkflowGraft::new(&workflow_id, 1) + .queue(&queue) + .add("after", envelope(&queue, "after"), ["root"]) + .prepare() + .unwrap(); + store.enqueue(&base).await.unwrap(); + store.enqueue(&graft).await.unwrap(); + + let conflict = WorkflowGraft::new(&workflow_id, 1) + .queue(&queue) + .add("loser", envelope(&queue, "loser"), ["root"]) + .prepare() + .unwrap(); + assert!(store.enqueue(&conflict).await.is_err()); + assert!( + store + .get_job(&format!("{workflow_id}:g2:loser"), false) + .await + .unwrap() + .is_none() + ); + + let order = Arc::new(Mutex::new(Vec::new())); + let mut registry = Registry::new(); + register_coordinator( + &mut registry, + store.clone() as Arc, + Duration::from_millis(2), + ) + .unwrap(); + let seen = order.clone(); + registry + .register::(move |_ctx: JobCtx, step: Step| { + let seen = seen.clone(); + async move { + seen.lock().unwrap().push(step.0); + Ok(()) + } + }) + .unwrap(); + let registry = Arc::new(registry); + let cfg = WorkerConfig { + queues: vec![queue], + ..Default::default() + }; + for _ in 0..40 { + let _ = testing::drain(&store, ®istry, &cfg, 16).await; + let state = store + .get_job(&format!("{workflow_id}:coordinator"), false) + .await + .unwrap() + .unwrap() + .state; + if state == "completed" { + break; + } + tokio::time::sleep(Duration::from_millis(3)).await; + } + assert_eq!( + order.lock().unwrap().as_slice(), + &["root".to_string(), "after".to_string()] + ); + assert_eq!( + store + .get_job(&format!("{workflow_id}:graft:2"), false) + .await + .unwrap() + .unwrap() + .state, + "completed" + ); +} + +#[tokio::test] +async fn live_postgres_retries_only_the_failed_workflow_subgraph() { + let Ok(conninfo) = std::env::var("HG_TEST_PG") else { + eprintln!("HG_TEST_PG not set; skipping workflow retry proof"); + return; + }; + let store = Arc::new(PgStore::connect(&conninfo, 4).expect("connect")); + let suffix = std::process::id(); + let workflow_id = format!("workflow-retry-live-{suffix}"); + let queue = format!("workflow-retry-live-{suffix}"); + let mut unstable = envelope(&queue, "unstable"); + unstable.max_attempts = 1; + let batch = Workflow::new(&workflow_id) + .coordinator_queue(&queue) + .failed_subgraph_retry() + .add("prepare", envelope(&queue, "prepare"), Vec::::new()) + .add("unstable", unstable, ["prepare"]) + .add("finish", envelope(&queue, "finish"), ["unstable"]) + .prepare() + .unwrap(); + store.enqueue(&batch).await.unwrap(); + + let order = Arc::new(Mutex::new(Vec::new())); + let unstable_attempts = Arc::new(AtomicUsize::new(0)); + let mut registry = Registry::new(); + register_coordinator( + &mut registry, + store.clone() as Arc, + Duration::from_millis(2), + ) + .unwrap(); + let seen = order.clone(); + let attempts = unstable_attempts.clone(); + registry + .register::(move |_ctx: JobCtx, step: Step| { + let seen = seen.clone(); + let attempts = attempts.clone(); + async move { + seen.lock().unwrap().push(step.0.clone()); + if step.0 == "unstable" && attempts.fetch_add(1, Ordering::SeqCst) == 0 { + return Err::<(), headgate::JobError>( + std::io::Error::other("planned workflow failure").into(), + ); + } + Ok(()) + } + }) + .unwrap(); + let registry = Arc::new(registry); + let cfg = WorkerConfig { + queues: vec![queue], + ..Default::default() + }; + + for _ in 0..40 { + let _ = testing::drain(&store, ®istry, &cfg, 16).await; + let state = store + .get_job(&format!("{workflow_id}:coordinator"), false) + .await + .unwrap() + .unwrap() + .state; + if state == "archived" { + break; + } + tokio::time::sleep(Duration::from_millis(3)).await; + } + assert_eq!( + store + .get_job(&format!("{workflow_id}:finish"), false) + .await + .unwrap() + .unwrap() + .state, + "pending" + ); + let receipt = request_failed_subgraph_retry(store.as_ref(), &workflow_id, 1) + .await + .unwrap(); + assert_eq!(receipt.revision, 2); + assert_eq!(receipt.generation, 2); + + for _ in 0..60 { + let _ = testing::drain(&store, ®istry, &cfg, 16).await; + let state = store + .get_job(&format!("{workflow_id}:coordinator"), false) + .await + .unwrap() + .unwrap() + .state; + if state == "completed" { + break; + } + tokio::time::sleep(Duration::from_millis(3)).await; + } + assert_eq!( + order.lock().unwrap().as_slice(), + &[ + "prepare".to_string(), + "unstable".to_string(), + "unstable".to_string(), + "finish".to_string(), + ] + ); + assert_eq!( + store + .get_job(&format!("{workflow_id}:retry:2"), false) + .await + .unwrap() + .unwrap() + .state, + "completed" + ); +} diff --git a/crates/headgate-workflow/tests/live_mysql.rs b/crates/headgate-workflow/tests/live_mysql.rs new file mode 100644 index 0000000..ff58d13 --- /dev/null +++ b/crates/headgate-workflow/tests/live_mysql.rs @@ -0,0 +1,136 @@ +use std::{ + sync::{ + Arc, Mutex, + atomic::{AtomicUsize, Ordering}, + }, + time::Duration, +}; + +use headgate::{CodecError, Envelope, JobCtx, Registry, Store, Task, WorkerConfig, testing}; +use headgate_core::Inspect; +use headgate_mysql::MysqlStore; +use headgate_workflow::{Workflow, emit_signal, register_coordinator, workflow_events}; + +#[derive(Clone)] +struct MatrixStep(String); + +impl Task for MatrixStep { + const TYPE: &'static str = "workflow:mysql-matrix-step"; + + fn encode(&self) -> Result, CodecError> { + Ok(self.0.as_bytes().to_vec()) + } + + fn decode(bytes: &[u8]) -> Result { + Ok(Self(String::from_utf8_lossy(bytes).into_owned())) + } +} + +fn envelope(queue: &str, step: &str) -> Envelope { + let task = MatrixStep(step.into()); + Envelope { + kind: MatrixStep::TYPE.into(), + payload: task.encode().unwrap(), + queue: queue.into(), + ..Default::default() + } +} + +#[tokio::test] +async fn workflow_experiments_mysql_matrix_cell() { + let Ok(url) = std::env::var("HG_TEST_MYSQL") else { + eprintln!("HG_TEST_MYSQL not set; skipping Rust/MySQL workflow matrix cell"); + return; + }; + let store = Arc::new(MysqlStore::connect(&url).unwrap()); + let suffix = format!( + "{}-{}", + std::process::id(), + std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_nanos() + ); + let workflow_id = format!("workflow-matrix-mysql-{suffix}"); + let queue = format!("workflow-matrix-mysql-{suffix}"); + let mut unstable = envelope(&queue, "unstable"); + unstable.max_attempts = 1; + let batch = Workflow::new(&workflow_id) + .coordinator_queue(&queue) + .automatic_retry(2, Duration::from_millis(2)) + .unwrap() + .add("prepare", envelope(&queue, "prepare"), Vec::::new()) + .add("unstable", unstable, ["prepare"]) + .add_condition( + "ready", + "completed.unstable && states.unstable == 'completed'", + ["unstable"], + ) + .add_timer_after("pause", Duration::from_millis(2), ["ready"]) + .unwrap() + .add_signal("approval", "approved", ["pause"]) + .add("finish", envelope(&queue, "finish"), ["approval"]) + .prepare() + .unwrap(); + store.enqueue(&batch).await.unwrap(); + emit_signal(store.as_ref(), &workflow_id, "approved") + .await + .unwrap(); + + let remaining = Arc::new(AtomicUsize::new(1)); + let order = Arc::new(Mutex::new(Vec::new())); + let mut registry = Registry::new(); + register_coordinator( + &mut registry, + store.clone() as Arc, + Duration::from_millis(2), + ) + .unwrap(); + let seen = order.clone(); + let failures = remaining.clone(); + registry + .register::(move |_ctx: JobCtx, step: MatrixStep| { + let seen = seen.clone(); + let failures = failures.clone(); + async move { + seen.lock().unwrap().push(step.0.clone()); + if step.0 == "unstable" && failures.fetch_sub(1, Ordering::SeqCst) == 1 { + return Err::<(), headgate::JobError>("planned workflow failure".into()); + } + Ok(()) + } + }) + .unwrap(); + let registry = Arc::new(registry); + let cfg = WorkerConfig { + queues: vec![queue], + ..Default::default() + }; + for _ in 0..100 { + let _ = testing::drain(&store, ®istry, &cfg, 32).await; + if store + .get_job(&format!("{workflow_id}:coordinator"), false) + .await + .unwrap() + .is_some_and(|job| job.state == "completed") + { + break; + } + tokio::time::sleep(Duration::from_millis(3)).await; + } + assert_eq!( + order.lock().unwrap().as_slice(), + &["prepare", "unstable", "unstable", "finish"] + ); + let events = workflow_events(store.as_ref(), &workflow_id).await.unwrap(); + assert!( + events + .iter() + .any(|event| event.event == "automatic_retry_scheduled") + ); + assert!( + events + .iter() + .any(|event| event.event == "workflow_succeeded") + ); +} diff --git a/crates/headgate/src/isolated.rs b/crates/headgate/src/isolated.rs index 2e70f7a..c15c9ef 100644 --- a/crates/headgate/src/isolated.rs +++ b/crates/headgate/src/isolated.rs @@ -181,10 +181,10 @@ async fn execute_request( read_bounded(stderr, max), child.wait(), ); - if let Err(error) = write_result { - if error.kind() != std::io::ErrorKind::BrokenPipe { - return Err(Box::new(error)); - } + if let Err(error) = write_result + && error.kind() != std::io::ErrorKind::BrokenPipe + { + return Err(Box::new(error)); } let (stdout, stdout_overflow) = stdout_result?; let (stderr, stderr_overflow) = stderr_result?; diff --git a/crates/headgate/src/tracked.rs b/crates/headgate/src/tracked.rs index 8360e9b..75396bc 100644 --- a/crates/headgate/src/tracked.rs +++ b/crates/headgate/src/tracked.rs @@ -93,12 +93,12 @@ impl TaskTracker { format!("tracked task was cancelled unexpectedly: {error}").into(), )), }; - if first.is_none() { - if let Some(failure) = failure { - first = Some(failure); - aborting = true; - tasks.abort_all(); - } + if first.is_none() + && let Some(failure) = failure + { + first = Some(failure); + aborting = true; + tasks.abort_all(); } } match first { @@ -137,10 +137,10 @@ impl TaskTracker { impl Drop for TaskTracker { fn drop(&mut self) { - if let Ok(state) = self.state.get_mut() { - if let Some(tasks) = state.tasks.as_mut() { - tasks.abort_all(); - } + if let Ok(state) = self.state.get_mut() + && let Some(tasks) = state.tasks.as_mut() + { + tasks.abort_all(); } } } diff --git a/crates/headgate/src/worker.rs b/crates/headgate/src/worker.rs index 9b00d2a..0f33423 100644 --- a/crates/headgate/src/worker.rs +++ b/crates/headgate/src/worker.rs @@ -152,12 +152,12 @@ impl Worker { // typed dispatch startup validation: warn on kinds waiting in the store that no // registered handler (or alias) answers — before they fail one at a time. - if let Some(insp) = self.store.as_inspect() { - if let Ok(kinds) = insp.distinct_kinds(1_000).await { - for kind in kinds { - if self.registry.get(&kind).is_none() { - tracing::warn!(%kind, "jobs of this kind are waiting but no handler is registered"); - } + if let Some(insp) = self.store.as_inspect() + && let Ok(kinds) = insp.distinct_kinds(1_000).await + { + for kind in kinds { + if self.registry.get(&kind).is_none() { + tracing::warn!(%kind, "jobs of this kind are waiting but no handler is registered"); } } } @@ -486,10 +486,10 @@ fn finish_task( // Aborted (lease lost / shutdown) or panicked with catch_panics=false. In // both cases the reclaimer owns the job's fate — an uncaught panic IS a // crash and is counted as one. - if let Some(i) = inflight.remove(&join_err.id()) { - if join_err.is_panic() { - tracing::error!(job = %i.job_id, "handler panicked (catch_panics=false); job left to the reclaimer as a crash"); - } + if let Some(i) = inflight.remove(&join_err.id()) + && join_err.is_panic() + { + tracing::error!(job = %i.job_id, "handler panicked (catch_panics=false); job left to the reclaimer as a crash"); } } } @@ -502,6 +502,7 @@ fn finish_task( /// carries. it used to return `()`, which is why the "execute a worker" testing /// row had nothing behind it: a helper that runs one job but cannot say what happened to it /// is `drain` with extra steps. +#[allow(clippy::too_many_arguments)] // The shared execution boundary mirrors independently optional runtime policies. pub(crate) async fn process_one( store: Arc, registry: Arc, @@ -1571,8 +1572,7 @@ mod the_runtime_loop_without_a_database { let cap = Arc::new(Capture::default()); let tel: Arc = cap.clone(); run_duty(&store, "retention", &tel, &[]).await; - let v = cap.0.lock().unwrap().clone(); - v + cap.0.lock().unwrap().clone() } // ----------------------------------------------------------------------- diff --git a/crates/headgate/tests/runtime.rs b/crates/headgate/tests/runtime.rs index 9f9bbc2..9c012f9 100644 --- a/crates/headgate/tests/runtime.rs +++ b/crates/headgate/tests/runtime.rs @@ -1174,7 +1174,8 @@ async fn trace_context_and_the_autoscaling_signal_reach_the_facade() { const TP: &str = "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"; // What the handler SAW, so the ctx accessor is asserted from inside a real dispatch. - let seen: Arc)>>> = Default::default(); + type SeenTraceContexts = Arc)>>>; + let seen: SeenTraceContexts = Default::default(); let release = Arc::new(tokio::sync::Notify::new()); let mut reg = Registry::new(); diff --git a/docs/guides/workflows.mdx b/docs/guides/workflows.mdx index f3a296b..ffec3a1 100644 --- a/docs/guides/workflows.mdx +++ b/docs/guides/workflows.mdx @@ -131,9 +131,398 @@ Cursor persistence is fence-verified. If the lease has already been reclaimed, t fails and the stale attempt must stop; the new attempt resumes from the last cursor that the store accepted. +## Inspect graph state + +Graph reads are available directly from both workflow libraries; they do not depend on +the console. A snapshot includes the accepted base graph plus additive grafts, current +node and coordinator states, revision, retry generation, dependency edges, reverse +dependent edges, and virtual-node configuration. Application payloads are excluded. + + +```rust Rust +let graph = headgate_workflow::inspect_workflow(store.as_ref(), "daily-import").await?; +let index = graph.node("index").ok_or("index node missing")?; +let prerequisites = graph.dependencies("index").unwrap(); + +let downstream = headgate_workflow::workflow_dependents( + store.as_ref(), + "daily-import", + "extract", +).await?; +let page = headgate_workflow::list_workflows(store.as_ref(), None, 50).await?; +``` + +```go Go +graph, err := headgateworkflow.InspectWorkflow(ctx, store, "daily-import") +if err != nil { return err } +index := graph.Node("index") +prerequisites, ok := graph.Dependencies("index") + +downstream, err := headgateworkflow.WorkflowDependents(ctx, store, "daily-import", "extract") +page, err := headgateworkflow.ListWorkflows(ctx, store, "", 50) +``` + + +Use `workflow_node` / `GetWorkflowNode`, `workflow_dependencies` / +`WorkflowDependencies`, and `workflow_dependents` / `WorkflowDependents` for convenient +single-relation reads. When several questions are needed, fetch one snapshot and use its +in-memory methods so the graph is internally consistent and the store is read only once. + +The same reads are available over HTTP. `GET /api/v1/workflows` returns a bounded, +cursor-paginated coordinator list; `GET /api/v1/workflows/{id}` and the +`/nodes/{node}`, `/dependencies`, and `/dependents` subresources. A retained completion +remains `completed` after its job row expires; an unrecorded absent row is explicitly +reported as `missing`. + +## Durable signals, payloads, and source history + +A signal is declared as a workflow node and stored as a retained pending internal job, so +delivery survives worker restarts on PostgreSQL, Redis, and MySQL. Emitting before +`prepare` completes is safe: Headgate records the emission first and releases the signal +job second. The coordinator consumes the completed signal only after its dependencies are +complete. + +Use the rich emission API when the event carries business data. `payload` is the fact the +workflow is waiting for; `source` describes who or what emitted it. Both are arbitrary JSON +values. The `Idempotency-Key` (or SDK `idempotency_key`) identifies one emission: replaying +the same key and content returns the original record, while reusing the key with different +content is rejected. + + +```rust Rust +use headgate_workflow::{Workflow, SignalEmission, emit_signal_with, list_signals}; + +let batch = Workflow::new("onboarding:42") + .add("prepare", prepare_job, Vec::::new()) + .add_signal("approval", "approved", ["prepare"]) + .add("welcome", welcome_job, ["approval"]) + .prepare()?; +store.enqueue(&batch).await?; + +// Safe before or after `prepare` completes. +let receipt = emit_signal_with( + store.as_ref(), + "onboarding:42", + SignalEmission { + signal: "approved".into(), + idempotency_key: "approval:ticket-1842".into(), + payload: serde_json::json!({"approved": true, "reviewer": "Ada"}), + source: serde_json::json!({"emitter": "admin-api", "actor": "operator-42"}), + }, +).await?; +assert_eq!(receipt.matched, 1); +assert!(receipt.inserted); + +let history = list_signals(store.as_ref(), "onboarding:42", None, 100).await?; +assert_eq!(history[0].payload["reviewer"], "Ada"); +``` + +```go Go +workflow := headgateworkflow.New("onboarding:42") +workflow.Add("prepare", prepareJob) +workflow.AddSignal("approval", "approved", "prepare") +workflow.Add("welcome", welcomeJob, "approval") + +batch, err := workflow.Prepare() +if err != nil { + return err +} +if err := store.Enqueue(ctx, batch); err != nil { + return err +} + +// Safe before or after prepare completes. +receipt, err := headgateworkflow.EmitSignalWith(ctx, store, "onboarding:42", headgateworkflow.SignalEmission{ + Signal: "approved", + IdempotencyKey: "approval:ticket-1842", + Payload: json.RawMessage(`{"approved":true,"reviewer":"Ada"}`), + Source: json.RawMessage(`{"emitter":"admin-api","actor":"operator-42"}`), +}) +if err != nil { + return err +} +history, err := headgateworkflow.ListSignals(ctx, store, "onboarding:42", 0, 100) +``` + + +The control API exposes the same contract: + +```bash +curl -X POST "$HEADGATE_URL/api/v1/workflows/onboarding%3A42/signals" \ + -H 'Content-Type: application/json' \ + -H 'Idempotency-Key: approval:ticket-1842' \ + -d '{ + "signal": "approved", + "payload": {"approved": true, "reviewer": "Ada"}, + "source": {"emitter": "admin-api", "actor": "operator-42"} + }' + +curl "$HEADGATE_URL/api/v1/workflows/onboarding%3A42/signals?limit=100" +``` + +Signal history is newest-first and retains the latest 100 emissions per workflow. That is +also the idempotency horizon: once an old record is trimmed, its key may be accepted again. +Payload is limited to 64 KiB and source metadata to 16 KiB. The store assigns the timestamp; +worker clocks are not trusted. `source` is caller-supplied metadata, not proof of identity— +authenticate the control API upstream and populate it from that trusted identity rather +than accepting arbitrary end-user values. The console shows matching signal history when +you inspect a signal node or a task directly waiting on one. + +The short `emit_signal` / `EmitSignal` helpers remain for name-only events. They store a +`null` payload and empty source object, and use one legacy key per signal name; use the rich +API whenever multiple emissions or audit context matter. + +Absolute timers use the backend's store clock and scheduled-job promoter: + + +```rust Rust +let batch = Workflow::new("release:42") + .add("prepare", prepare_job, Vec::::new()) + .add_timer_at("release-window", release_at_ms, ["prepare"]) + .add("publish", publish_job, ["release-window"]) + .prepare()?; + +let delayed = Workflow::new("follow-up:42") + .add("prepare", prepare_job, Vec::::new()) + .add_timer_after("cooldown", Duration::from_secs(30 * 60), ["prepare"])? + .add("notify", notify_job, ["cooldown"]) + .prepare()?; +``` + +```go Go +workflow := headgateworkflow.New("release:42") +workflow.Add("prepare", prepareJob) +workflow.AddTimerAt("release-window", releaseAtMs, "prepare") +workflow.Add("publish", publishJob, "release-window") + +delayed := headgateworkflow.New("follow-up:42") +delayed.Add("prepare", prepareJob) +if err := delayed.AddTimerAfter("cooldown", 30*time.Minute, "prepare"); err != nil { + return err +} +delayed.Add("notify", notifyJob, "cooldown") +``` + + +Absolute deadlines are Unix milliseconds. A relative timer is anchored to the latest +dependency's store-stamped `finalized_at_ms`. The coordinator durably records that evidence +before atomically changing the timer from `pending` to `scheduled` at `anchor + delay`, so +worker clock skew and coordinator polling latency do not move the deadline. + +### CEL waits + +Use a condition node for a bounded boolean decision over workflow state. Available +variables are `revision` and `generation` (unsigned integers), `states` (node name to +state), and `completed` (node name to boolean). + + +```rust Rust +let workflow = Workflow::new("approval:42") + .add("prepare", prepare_job, Vec::::new()) + .add_condition( + "eligible", + "completed.prepare && states.prepare == 'completed'", + ["prepare"], + ); +``` + +```go Go +workflow := headgateworkflow.New("approval:42") +workflow.Add("prepare", prepareJob) +workflow.AddCondition("eligible", `completed.prepare && states.prepare == "completed"`, "prepare") +``` + + +Expressions are limited to 1,024 bytes, compile during `prepare`, cannot perform I/O, and +must return a boolean. + +### Experimental graph grafts + +Add ordinary tasks to a workflow that is still running by preparing a batch against the +current graph revision. Enqueue the returned receipt and tasks together in one atomic +store call. + + +```rust Rust +let graft = WorkflowGraft::new("onboarding:42", 1) + .queue("workflows") + .add("send-survey", survey_job, ["send-welcome"]) + .prepare()?; + +store.enqueue(&graft).await?; +``` + +```go Go +graft := headgateworkflow.NewGraft("onboarding:42", 1).Queue("workflows") +graft.Add("send-survey", surveyJob, "send-welcome") +batch, err := graft.Prepare() +if err != nil { return err } + +if err := store.Enqueue(ctx, batch); err != nil { return err } +``` + + +Revision `1` is the initial graph, so this batch requests revision `2`. The receipt id is +deterministic (`onboarding:42:graft:2`): concurrent writers using the same expected +revision collide at atomic enqueue instead of both changing the graph. The coordinator +validates the combined DAG, checkpoints the new revision and nodes, and only then releases +the receipt handler. A crash in between replays the same accepted receipt. + +Grafts are additive and currently accept ordinary tasks only. They cannot replace or +delete an existing node or revive a completed coordinator. Accepted grafts enter the +bounded workflow history. `POST /api/v1/workflows/{id}/grafts` provides the authenticated, +idempotency-key-protected control route. The console remains read-only while its mutation +controls are reviewed. + +#### Non-task nodes cannot be grafted + +Signals, absolute or relative timers, CEL conditions, and child-workflow links must be +declared when the initial workflow is prepared. Neither `WorkflowGraft::add` / +`WorkflowGraft.Add` nor `POST /api/v1/workflows/{id}/grafts` accepts those node types. +Attempting to represent one as an ordinary task does not give it signal, timer, +condition, or child-workflow semantics. + +This boundary is deliberate. An ordinary task graft only adds a pending job and dependency +edges. Each non-task node needs additional durable rules: + +- a signal needs a stable buffered-delivery identity and idempotent emission lookup; +- a relative timer needs a store-stamped dependency-completion anchor; +- a condition must be compiled, bounded, and evaluated against a defined workflow state; +- a child link changes the cross-workflow graph and therefore needs cycle detection, + creation atomicity, cancellation propagation, and retry propagation. + +Adding any of these after execution has started therefore requires more than accepting a +different payload in the graft receipt. It needs a versioned mutation contract, combined +graph validation, deterministic replay, history records, and matching behavior across all +stores and both language implementations. Headgate does not claim that contract yet. + +Plan control-flow nodes up front, then graft ordinary work whose dependencies can point to +those existing nodes. If an unforeseen signal, timer, condition, or child workflow changes +the orchestration itself, create a new workflow ID with the new graph. A separately +enqueued workflow remains a separate execution; it is not retroactively part of the +original graph. + + +An accepted node and its dependency edges are immutable, including while the workflow is +active. A graft can append new ordinary tasks that depend on existing nodes, but cannot +replace, rename, remove, or rewire accepted work. Use a new workflow ID when a change +requires a different interpretation of the existing graph. + + + +Once the coordinator records a terminal workflow outcome, that execution's graph and +history are immutable. Signals and grafts cannot revive it, and operators cannot append, +replace, remove, rename, or rewire its nodes. Start different work with a new workflow ID. +Failed-subgraph retry is the narrow exception: when enabled before enqueue, it advances to +a new generation of the same unchanged graph and preserves completed ancestors. + + +### Experimental failed-subgraph retry + +Enable retry before the workflow is enqueued. This retains dependency-blocked pending +jobs when a node exhausts rather than deleting them. + + +```rust Rust +let batch = Workflow::new("onboarding:42") + .failed_subgraph_retry() + .add("create-account", account_job, Vec::::new()) + .add("send-welcome", email_job, ["create-account"]) + .prepare()?; +store.enqueue(&batch).await?; + +// The failed coordinator checkpoint currently says revision 1. +let retry = request_failed_subgraph_retry(&store, "onboarding:42", 1).await?; +assert_eq!(retry.generation, 2); +``` + +```go Go +workflow := headgateworkflow.New("onboarding:42").EnableFailedSubgraphRetry() +workflow.Add("create-account", accountJob) +workflow.Add("send-welcome", emailJob, "create-account") +batch, err := workflow.Prepare() +if err != nil { return err } +if err := store.Enqueue(ctx, batch); err != nil { return err } + +retry, err := headgateworkflow.RequestFailedSubgraphRetry(ctx, store, "onboarding:42", 1) +if err != nil { return err } +``` + + +The request requires an archived coordinator, checkpoint inspection, and the exact graph +revision. It enqueues the deterministic retry receipt before reopening the coordinator. +The coordinator checkpoints generation 2 and revision 2 before applying operator retry +to failed archived/cancelled nodes. Completed ancestors remain completed, while their +pending descendants resume only after the retried node succeeds. + +For automatic retry, use `automatic_retry(max_generations, backoff)` in Rust or +`AutomaticRetry(maxGenerations, backoff)` in Go. The generation limit includes the first +run and the backoff uses the ordinary store-timed snooze path. + +`POST /api/v1/workflows/{id}/retry` can also repair states that are unsafe to reopen +blindly. A quarantined node requires `release_quarantine: true` (the release applies to its +fingerprint). An undecodable node requires a replacement base64 payload and positive +`schema_version`. Completed ancestors remain untouched. A failed child link requests the +child coordinator's failed-subgraph retry before the parent link is reopened. + +```bash +curl -X POST http://127.0.0.1:8080/api/v1/workflows/onboarding:42/retry \ + -H 'Content-Type: application/json' \ + -H 'Idempotency-Key: onboarding-42-retry-1' \ + -d '{ + "expected_revision": 1, + "recoveries": [ + {"node": "send-welcome", "payload": "eyJlbWFpbCI6Im5ld0BleGFtcGxlLmNvbSJ9", "schema_version": 2} + ] + }' +``` + +The server checks every workflow node after applying the requested repairs. It will not +reopen the coordinator while any node remains quarantined or undecodable. + +### Experimental child workflows + +Create the child and parent builders, link the child coordinator as a parent node, and use +one atomic bundle: + + +```rust Rust +let child = Workflow::new("billing:42") + .add("charge", charge_job, Vec::::new()); + +let parent = Workflow::new("checkout:42") + .add_child("billing", "billing:42", Vec::::new()) + .add("receipt", receipt_job, ["billing"]); +store.enqueue(&prepare_bundle(vec![parent, child])?).await?; +``` + +```go Go +child := headgateworkflow.New("billing:42") +child.Add("charge", chargeJob) +parent := headgateworkflow.New("checkout:42") +parent.AddChild("billing", "billing:42") +parent.Add("receipt", receiptJob, "billing") +bundle, err := headgateworkflow.PrepareBundle(parent, child) +if err != nil { return err } +if err := store.Enqueue(ctx, bundle); err != nil { return err } +``` + + +The bundle verifies that every child is present, rejects cross-workflow cycles, and makes +parent/child creation atomic. A completed child releases downstream parent work; a failed +child archives the link and invokes ordinary parent failure propagation. Workflow cancel +propagates to linked children by default and visits all active parallel branches; callers +may explicitly disable child propagation. + +`register_coordinator` / `RegisterCoordinator` installs the coordinator and all internal +workflow handlers. The mutation API requires `Idempotency-Key` and uses the same upstream +authentication boundary as the rest of the control API. + -This first workflow slice is immutable. Signals, timers, graph mutation, nested workflows, -and workflow-level retry are not claimed yet. +The experiment now has durable signals, dependency-anchored timers, CEL waits, additive +grafts, atomic child bundles, retry/repair, cancellation propagation, authenticated API +routes, and a bounded 256-event workflow history. The console remains intentionally +read-only while its mutation controls are reviewed. diff --git a/docs/workflow-experiments.md b/docs/workflow-experiments.md new file mode 100644 index 0000000..13a3f3a --- /dev/null +++ b/docs/workflow-experiments.md @@ -0,0 +1,284 @@ +# Dynamic workflow experiments + +This branch extends the immutable workflow layer without moving orchestration into +`headgate-core` or changing admission. Rust exposes the features from +`headgate-workflow`; Go exposes the same contract from `headgateworkflow`. + +## What is implemented + +- durable, buffered, idempotent signals; +- absolute timers and relative timers anchored to the latest dependency's store-stamped + `finalized_at_ms`; +- additive revision-checked graph grafts; +- CEL boolean waits over `revision`, `generation`, `states`, and `completed`; +- child workflows, atomic parent/child bundles, and cross-workflow cycle rejection; +- manual and automatic failed-subgraph retry while preserving successful ancestors; +- explicit repair of quarantined and undecodable nodes; +- bounded parent-to-child cancellation and failed-child retry propagation; +- a bounded durable event history; and +- package and HTTP graph inspection for nodes, dependencies, dependents, revision, + generation, and execution state; and +- HTTP routes for graph inspection, history, signal, graft, retry, and cancellation. Every mutation uses + the API's existing upstream-authentication boundary and requires `Idempotency-Key`. + +The console remains read-only while its mutation controls are reviewed. + +## Signals and conditions + +A signal declaration creates a retained pending internal job. The rich emission API first +appends a store-timestamped record containing the signal name, idempotency key, JSON +payload, and caller-supplied JSON source, then promotes that job. Delivery before its +dependencies finish is buffered, and replay with the same key and content returns the +original emission. Reusing a key with different content is rejected. A condition is also a +pending internal job, but the coordinator only promotes it when its CEL expression +evaluates to `true`. + +```rust +let batch = Workflow::new("approval:42") + .add("prepare", prepare_job, Vec::::new()) + .add_condition( + "eligible", + "completed.prepare && states.prepare == 'completed'", + ["prepare"], + ) + .add_signal("approval", "approved", ["eligible"]) + .add("publish", publish_job, ["approval"]) + .prepare()?; +store.enqueue(&batch).await?; +emit_signal_with(store.as_ref(), "approval:42", SignalEmission { + signal: "approved".into(), + idempotency_key: "approval:ticket-1842".into(), + payload: serde_json::json!({"approved": true}), + source: serde_json::json!({"emitter": "admin-api", "actor": "operator-42"}), +}).await?; +``` + +```go +workflow := headgateworkflow.New("approval:42") +workflow.Add("prepare", prepareJob) +workflow.AddCondition("eligible", `completed.prepare && states.prepare == "completed"`, "prepare") +workflow.AddSignal("approval", "approved", "eligible") +workflow.Add("publish", publishJob, "approval") +batch, err := workflow.Prepare() +if err != nil { return err } +if err := store.Enqueue(ctx, batch); err != nil { return err } +_, err = headgateworkflow.EmitSignalWith(ctx, store, "approval:42", headgateworkflow.SignalEmission{ + Signal: "approved", IdempotencyKey: "approval:ticket-1842", + Payload: json.RawMessage(`{"approved":true}`), + Source: json.RawMessage(`{"emitter":"admin-api","actor":"operator-42"}`), +}) +``` + +`list_signals` / `ListSignals` and `GET /api/v1/workflows/{id}/signals` return the newest +100 emissions. Payload is capped at 64 KiB and source at 16 KiB. Trimming also ends the +idempotency guarantee for the removed key. `source` is descriptive, not independently +authenticated; deployments should derive it at their trusted API boundary. + +Expressions are limited to 1,024 bytes and must compile before enqueue. They cannot make +network or store calls. Evaluation is bounded by the workflow's node/edge limits and the +CEL implementation; the expression result must be boolean. + +## Timers + +Absolute timers are ordinary scheduled jobs. Relative timers remain pending until all +dependencies complete. The coordinator records their store-stamped finalization times, +uses the latest timestamp as the anchor, and atomically changes the timer from `pending` +to `scheduled` at `anchor + delay`. A worker clock is never used. + +```rust +let workflow = Workflow::new("follow-up:42") + .add("prepare", prepare_job, Vec::::new()) + .add_timer_after("cooldown", Duration::from_secs(1800), ["prepare"])? + .add("notify", notify_job, ["cooldown"]); +``` + +```go +workflow := headgateworkflow.New("follow-up:42") +workflow.Add("prepare", prepareJob) +if err := workflow.AddTimerAfter("cooldown", 30*time.Minute, "prepare"); err != nil { return err } +workflow.Add("notify", notifyJob, "cooldown") +``` + +## Graph grafts + +`WorkflowGraft::new(id, expected_revision)` and `NewGraft(id, expectedRevision)` return +one atomic batch: `{workflow}:graft:{next_revision}` plus the new pending jobs. The +coordinator validates the combined graph, fences it into its checkpoint, and only then +releases the receipt. Competing writers for the same revision collide on the deterministic +receipt ID. Grafts are additive, accept ordinary tasks only, and cannot revive a terminal +coordinator. + +### Why grafts cannot add control-flow nodes + +Signals, timers, CEL conditions, and child-workflow links can be part of the initial graph, +but cannot currently be appended through a graft. Rust exposes only +`WorkflowGraft::add`; Go exposes only `WorkflowGraft.Add`; and the HTTP graft schema accepts +ordinary task envelopes. Encoding an internal node kind manually is invalid and is not a +supported escape hatch. + +The distinction is behavioral rather than cosmetic. A task graft adds a pending job and +dependency edges. A signal additionally needs durable buffered-delivery identity; a +relative timer needs a store-clock completion anchor; a condition needs bounded CEL +compilation and evaluation; and a child link changes the cross-workflow graph, including +cycle detection, atomic creation, cancellation, and retry propagation. Those rules must be +validated against the combined graph, replay safely after interruption, enter workflow +history, and behave identically in Rust and Go across PostgreSQL, Redis, and MySQL. + +Until that versioned mutation contract exists, declare every control-flow node in the +initial workflow and use grafts only for ordinary tasks that depend on existing nodes. If +execution discovers that it needs a new signal, timer, condition, or child workflow link, +start the revised graph under a new workflow ID. Enqueuing another workflow separately does +not mutate or attach it to the original execution. + +## Accepted graph immutability + +Once a workflow revision is accepted, its existing nodes and dependency edges are +immutable—even while the coordinator is active. Operators cannot replace a node's job, +rename or remove a node, add or remove one of its dependencies, or insert a task by +rewiring an existing edge. A node may already be running or completed, so rewriting it +would make the durable history disagree with the execution that actually occurred. + +The supported extension is an additive, revision-checked graft. A graft may append new +ordinary task nodes and connect them to existing nodes, but it does not alter the existing +subgraph. If the desired change requires replacing or rewiring accepted work, create a new +workflow ID with the new graph. Headgate does not plan to infer downstream invalidation, +rollback completed side effects, or silently reinterpret an in-flight execution. + +## Terminal workflow immutability + +A workflow's accepted graph becomes permanently immutable when its coordinator reaches a +terminal outcome. Operators cannot append, replace, remove, rename, or rewire nodes on that +workflow, and a signal or graft cannot turn the terminal execution back into a live one. +This preserves the meaning of its terminal result and keeps its event history auditable. + +Failed-subgraph retry is a deliberately separate operation, not a graph mutation. It is +available only when retry was enabled before enqueue, requires the failed revision, advances +the workflow generation, and reuses the same graph while preserving completed ancestors. +Starting different work from a terminal workflow requires a new workflow ID; a future fork +operation, if added, would likewise create a distinct execution rather than rewrite history. + +## Parent and child workflows + +Use `prepare_bundle` / `PrepareBundle` when creating related workflows. It requires every +child link to resolve inside the bundle, rejects cycles across workflow boundaries, and +returns one batch for one atomic `enqueue` call. Separately enqueued children remain +supported, but only a complete bundle can prove global acyclicity and atomic creation. + +Cancellation visits live jobs in every active parallel branch. Child propagation defaults +to `true` in the HTTP API and can be explicitly disabled. Traversal is iterative and +bounded; a retry of a failed child-link also requests the child's failed-subgraph retry +before reopening the parent link. + +## Retry and repair + +Manual retry must be enabled with `failed_subgraph_retry`. Automatic retry also enables +that behavior and declares a generation limit plus store-timed backoff: + +```rust +let workflow = Workflow::new("import:42") + .automatic_retry(3, Duration::from_secs(30))? + .add("download", download_job, Vec::::new()) + .add("index", index_job, ["download"]); +``` + +```go +workflow := headgateworkflow.New("import:42") +if err := workflow.AutomaticRetry(3, 30*time.Second); err != nil { return err } +workflow.Add("download", downloadJob) +workflow.Add("index", indexJob, "download") +``` + +The generation limit includes the first run. Retry increments graph revision and +generation, reopens only the failed subgraph, and never reruns completed ancestors. +Quarantined nodes require `release_quarantine: true`; release is fingerprint-wide because +that is the underlying quarantine contract. Undecodable nodes require replacement payload +bytes and a positive schema version before operator retry. Recovery is replay-safe if a +request stops between repair and coordinator reopening. + +## Control API and history + +The Rust crate and Go package expose graph inspection independently of the console. One +snapshot reads the accepted base graph plus grafts and joins each node to its current job +state without returning application payloads. Query the snapshot repeatedly when several +topology questions are needed; the convenience functions perform a fresh snapshot read. + +```rust +let graph = headgate_workflow::inspect_workflow(store.as_ref(), "import:42").await?; +let publish = graph.node("publish").ok_or("publish node missing")?; +let prerequisites = graph.dependencies("publish").unwrap(); + +// Convenience point reads are useful when only one relation is needed. +let downstream = headgate_workflow::workflow_dependents( + store.as_ref(), + "import:42", + "download", +).await?; + +let page = headgate_workflow::list_workflows(store.as_ref(), None, 50).await?; +``` + +```go +graph, err := headgateworkflow.InspectWorkflow(ctx, store, "import:42") +if err != nil { return err } +publish := graph.Node("publish") +prerequisites, ok := graph.Dependencies("publish") + +// Convenience point reads are useful when only one relation is needed. +downstream, err := headgateworkflow.WorkflowDependents(ctx, store, "import:42", "download") + +page, err := headgateworkflow.ListWorkflows(ctx, store, "", 50) +``` + +Each node reports its workflow-local name, underlying job ID and kind, durable role, +current state, immediate dependencies and dependents, virtual-node configuration, and +recorded completion time. The snapshot also reports coordinator state, graph revision, +retry generation, failure status, and configured retry policy. A retained completion is +reported as completed even if retention has removed its job row; an unrecorded missing row +is reported as `missing`. + +The following routes share the normal API authorization boundary. Mutations require a +non-empty `Idempotency-Key`: + +```text +GET /api/v1/workflows +GET /api/v1/workflows/{id} +GET /api/v1/workflows/{id}/events +GET /api/v1/workflows/{id}/signals +GET /api/v1/workflows/{id}/nodes/{node} +GET /api/v1/workflows/{id}/nodes/{node}/dependencies +GET /api/v1/workflows/{id}/nodes/{node}/dependents +POST /api/v1/workflows/{id}/signals +POST /api/v1/workflows/{id}/grafts +POST /api/v1/workflows/{id}/retry +POST /api/v1/workflows/{id}/cancel +``` + +While the coordinator is active, history lives in its fence-verified checkpoint and is +mirrored through the same fence-gated output write. Terminal completion clears the active +cursor, so history reads fall back to that durable output copy. It records starts, node +completions, graft/retry decisions, automatic retry scheduling, and terminal outcome. Only +the newest 256 events are retained; sequence numbers remain monotonic after trimming. + +## Resource and behavior limits + +- 999 nodes and 10,000 dependency edges per workflow; +- 1,000 jobs per atomic workflow bundle; +- 1,024 bytes per CEL expression; +- newest 256 workflow events; +- newest 100 signal emissions per workflow, including 64 KiB payload and 16 KiB source; +- cancellation/child traversal is bounded by the workflow node limit; +- active cancellation targets all live branches, not only the coordinator; +- grafts do not replace/delete nodes and currently contain ordinary tasks only; +- accepted nodes and dependency edges are immutable across revisions; and +- terminal workflow graphs and their recorded outcomes are immutable. + +The six-cell integration scenario is defined for PostgreSQL, Redis, and MySQL in both +Rust and Go. It exercises an early signal, CEL wait, dependency-anchored relative timer, +automatic failed-subgraph retry, preserved execution order, and durable history. Cells +run when their `HG_TEST_PG`, `HG_TEST_REDIS`, or `HG_TEST_MYSQL` environment is present. + +## Still intentionally excluded + +The dynamic backend is implemented, but UI mutation controls are deliberately deferred +for review. Grafting signals, timers, conditions, or child workflows; in-place mutation of +accepted nodes; and unbounded/full-lifetime event history are not supported. diff --git a/docs/workflows.md b/docs/workflows.md index 7e32e97..48852c6 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -1,66 +1,54 @@ # Workflows and DAG dependencies -Workflows are an opt-in layer, not part of `headgate-core`. Rust uses the -`headgate-workflow` crate; Go uses `github.com/mujhtech/headgate/go/headgateworkflow`. - -A workflow builder validates unique task names, missing dependencies, repeated edges, -and cycles before anything is enqueued. `prepare` returns one batch containing: - -- one ordinary `headgate:workflow` coordinator job; and -- every application job in the durable `pending` state. - -Enqueue that batch through the normal client/store path. Workers serving the coordinator -queue must install `register_coordinator` / `RegisterCoordinator` and also register the -application task handlers. - -Runnable fan-out/fan-in construction examples are available for -[Rust](../examples/rust/src/bin/workflow.rs) and [Go](../examples/go/workflow/main.go). -They validate the graph and print the atomic coordinator-plus-children batch without -requiring a database. The live coordinator execution proof is -[`crates/headgate-workflow/tests/live.rs`](../crates/headgate-workflow/tests/live.rs). - -The coordinator performs bounded point reads—one per graph node. Roots are promoted -first. A node is promoted only after every dependency is `completed`; fan-out and fan-in -therefore use the same mechanism. While work is active the coordinator snoozes without -consuming an attempt. When all nodes complete it completes normally. If an upstream job -archives, is cancelled, quarantined, becomes undecodable, is revoked, or disappears, any -still-pending descendants are deleted before they can run and the coordinator archives. - -Every child's retention is raised to at least the workflow retention (seven days by -default). The coordinator also records observed completions in its own fenced checkpoint -before promoting descendants. That completion evidence survives an early child's retention -expiry, so a long retry cannot turn work that already succeeded into a missing dependency. -An unrecorded missing child still fails the workflow because the coordinator has no durable -proof that it completed. - -Retention is measured from each child's own finalization time, not from workflow completion. -To keep every child detail visible after a long workflow finishes, configure at least the -expected maximum workflow runtime plus the desired post-completion inspection window. The -checkpoint evidence protects dependency correctness; it is not a replacement for the -expired child's payload, logs, result, or attempt history. - -The runner renews the lease of a long-running child, but it cannot renew while its host is -suspended or disconnected. Reclaiming that expired lease and incrementing the crash count -is expected. Long stages should use `JobCtx::step_cursor` / `headgate.StepCursor` and save -their cursor after each safely repeatable unit. Cursor writes are fence-verified, so the -expired holder stops and the replacement attempt resumes from the last accepted cursor -instead of restarting the full stage. - -## Deliberate boundaries - -The topology is immutable after the atomic enqueue. This first slice supports durable -DAG dependencies, fan-out/fan-in, failure propagation, and read-only graph inspection. -It does not claim River Pro's signals, timers, CEL wait expressions, dynamic -grafting/appending, nested workflows, or workflow retry. Those can layer on later -without moving policy evaluation into workers or changing the admission gate. - -The embedded operations console now provides read-only graph inspection at `/workflows`. -It decodes the immutable coordinator payload and reads each child through the ordinary -bounded job-detail API. This is an operator view, not a new workflow control surface: -signals, timers, graph mutation, workflow-level retry, and workflow-level cancellation -remain outside this slice. - -Pending jobs cannot be operator-cancelled by the current core transition table. Failed -dependency propagation therefore deletes descendants that have never run rather than -inventing a new transition. The archived coordinator remains the durable workflow-level -failure record. +Workflows are an opt-in orchestration layer: Rust uses `headgate-workflow`, and Go uses +`github.com/mujhtech/headgate/go/headgateworkflow`. Core admission remains responsible only +for deciding which ordinary jobs may run. + +`prepare` validates names, dependencies, edges, and cycles, then returns one atomic batch +containing a coordinator and pending application jobs. Install `register_coordinator` / +`RegisterCoordinator` on workers that serve the coordinator queue. + +The coordinator performs bounded point reads. Roots are promoted first; fan-out and +fan-in follow only after durable completion evidence exists. It copies each child's +store-stamped `finalized_at_ms` into its fenced cursor before promoting descendants, so +retention of an old child row cannot erase dependency correctness. + +Every child is retained for at least the workflow retention (seven days by default). +Retention still begins at that child's finalization. If operators need payload, logs, and +attempt history after a long workflow completes, configure expected maximum workflow +duration plus the desired inspection window. + +Long-running jobs need normal lease renewal. A sleeping laptop or disconnected host cannot +renew; reclaim then cancels the stale handler and increments its crash count. Use resumable +steps and persist a cursor after each safely repeatable unit. Fence verification prevents +an expired attempt from advancing the cursor or acknowledging success. + +The dynamic feature contract—signals, timers, CEL waits, grafts, nested workflow bundles, +retry/repair, cancellation, API routes, event history, limits, and examples—is documented +in [Dynamic workflow experiments](workflow-experiments.md). The embedded console currently +inspects the merged graph, revision, generation, and task details but intentionally exposes +no workflow mutation controls while that interaction is reviewed. + +Inspection is also a first-class library and HTTP capability, not a console-only feature. +`list_workflows` / `ListWorkflows` pages coordinators, while `inspect_workflow` / +`InspectWorkflow` returns the accepted graph and current execution state; node, +dependency, and dependent helpers answer topology questions without parsing coordinator +payloads. HTTP clients can use `GET /api/v1/workflows`, `GET /api/v1/workflows/{id}`, and its +`nodes/{node}` relationship subresources. These reads never expose application payloads. + +Terminal workflow executions are immutable. Their accepted graph and recorded outcome +cannot be rewritten or extended; new work requires a new workflow ID. An explicitly +preconfigured failed-subgraph retry advances the generation of the unchanged graph and is +not treated as graph mutation. + +Existing nodes and edges are also immutable while a workflow is active. Dynamic extension +means appending ordinary tasks through a revision-checked graft, not replacing, renaming, +removing, or rewiring work already accepted by the store. Changes that require a different +existing graph belong to a new workflow ID. + +Grafts cannot currently add signals, timers, CEL conditions, or child-workflow links. +Those nodes carry durable orchestration rules beyond an ordinary pending job—buffered +delivery, store-clock anchoring, expression evaluation, or cross-workflow cycle and +propagation behavior—and must be present in the initial graph. Plan control-flow nodes up +front and graft only ordinary tasks that depend on them. If execution needs an unforeseen +control-flow node, start the revised graph with a new workflow ID. diff --git a/examples/go/go.mod b/examples/go/go.mod index 772559e..e0e12de 100644 --- a/examples/go/go.mod +++ b/examples/go/go.mod @@ -11,16 +11,25 @@ require ( ) require ( + cel.dev/cel-go v0.32.0 // indirect + cel.dev/expr v0.25.1 // indirect filippo.io/edwards25519 v1.2.0 // indirect + github.com/antlr4-go/antlr/v4 v4.13.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/go-sql-driver/mysql v1.9.3 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/pgx/v5 v5.9.2 // indirect + github.com/kr/text v0.2.0 // indirect github.com/mujhtech/headgate/go/headgatemigrate v0.1.7 // indirect github.com/redis/go-redis/v9 v9.7.3 // indirect - golang.org/x/text v0.39.0 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect + golang.org/x/text v0.40.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 // indirect + google.golang.org/protobuf v1.36.12 // indirect ) replace github.com/mujhtech/headgate/go => ../../go diff --git a/examples/go/go.sum b/examples/go/go.sum index b43e5b1..f9897a2 100644 --- a/examples/go/go.sum +++ b/examples/go/go.sum @@ -1,11 +1,18 @@ +cel.dev/cel-go v0.32.0 h1:irvpFKr5EuGPyxeME03ERh0rii1TX+BDAnB9eL3IvNk= +cel.dev/cel-go v0.32.0/go.mod h1:DnVip7tpJSsgZymwfT+m1tnEVy3ivAjSMXPx12YrMkU= +cel.dev/expr v0.25.1 h1:1KrZg61W6TWSxuNZ37Xy49ps13NUovb66QLprthtwi4= +cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= +github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= +github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -13,6 +20,8 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo= github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= @@ -21,20 +30,44 @@ github.com/jackc/pgx/v5 v5.9.2 h1:3ZhOzMWnR4yJ+RW1XImIPsD1aNSz4T4fyP7zlQb56hw= github.com/jackc/pgx/v5 v5.9.2/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mujhtech/headgate/go/driver/headgatemysql v0.1.7 h1:hae/xf5o6uhkQYiWOPP2/ipsMD23da1IepWqy9RFNsw= +github.com/mujhtech/headgate/go/driver/headgatemysql v0.1.7/go.mod h1:FV8xIHDnuzKBppuBpGR1ieLh0gAZq1jiXUTg+Si8jwc= +github.com/mujhtech/headgate/go/driver/headgatepgx v0.1.7 h1:Ba5yywQX338FOgod53qpA5ATcPS4SR6Fa4hks+j0a28= +github.com/mujhtech/headgate/go/driver/headgatepgx v0.1.7/go.mod h1:RHpyo2uWKS/HCbZtnT7V4YmSWbE+oBmcXQSZ20tHjjw= +github.com/mujhtech/headgate/go/driver/headgateredis v0.1.7 h1:Y75BERPC+bNceM7qRB0irCNuiIBX5oAWsMBBBfhuChE= +github.com/mujhtech/headgate/go/driver/headgateredis v0.1.7/go.mod h1:pUOfSEhWxCsluKaCMe5ArLkZThzTZzPbKYWIZ+CKmB8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/redis/go-redis/v9 v9.7.3 h1:YpPyAayJV+XErNsatSElgRZZVCwXX9QzkKYNvO7x0wM= github.com/redis/go-redis/v9 v9.7.3/go.mod h1:bGUrSggJ9X9GUmZpZNEOQKaANxSGgOEBRltRTZHSvrA= +github.com/rogpeppe/go-internal v1.16.0 h1:O9DK+vNMDVGLr2BeZqmpLeMjiMNkuXfcqntWbZV6S5g= +github.com/rogpeppe/go-internal v1.16.0/go.mod h1:DrUVZyrJU+txYW5/1kwtXQSMFio52ZOxX7yM1VHvnxs= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM= -golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/text v0.39.0 h1:UbZz4pLOvn600D6Oh6GGEI6VAmndrEBLv8/6BEXzyus= -golang.org/x/text v0.39.0/go.mod h1:3UwRclnC2g0TU9x8PZiyfOajCd1zaUNHF9cvqcQZ+ZM= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA= +golang.org/x/exp v0.0.0-20240823005443-9b4947da3948/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= +golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= +google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 h1:YcyjlL1PRr2Q17/I0dPk2JmYS5CDXfcdb2Z3YRioEbw= +google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7/go.mod h1:OCdP9MfskevB/rbYvHTsXTtKC+3bHWajPdoKgjcYkfo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 h1:2035KHhUv+EpyB+hWgJnaWKJOdX1E95w2S8Rr4uWKTs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= +google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/go.work b/go.work new file mode 100644 index 0000000..96968a2 --- /dev/null +++ b/go.work @@ -0,0 +1,16 @@ +go 1.25.0 + +use ( + ./go + ./go/driver/headgatemysql + ./go/driver/headgatepgx + ./go/driver/headgateredis + ./go/headgateapi + ./go/headgatecrypto + ./go/headgatectl + ./go/headgatemigrate + ./go/headgateotel + ./go/headgatetest + ./go/headgateui + ./go/headgateworkflow +) diff --git a/go/go.work.sum b/go.work.sum similarity index 88% rename from go/go.work.sum rename to go.work.sum index db9b3e8..6f87f59 100644 --- a/go/go.work.sum +++ b/go.work.sum @@ -1,6 +1,5 @@ filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-sql-driver/mysql v1.10.1 h1:arlSnNLq6a5yxGxV7qg9lF4j0C+KwD6NbQyKr9QL6ME= @@ -12,18 +11,12 @@ github.com/jackc/pgx/v5 v5.10.0/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QII github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/redis/go-redis/v9 v9.22.0 h1:laDvpYXTJtZLloinw1fA5Kqd6HAEH2XKxOkG/PDq2F0= github.com/redis/go-redis/v9 v9.22.0/go.mod h1:y2g0Wj8rQvuK0ELM+oxSudcLtC09JScs98I/X9gRWY4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= @@ -72,35 +65,39 @@ go.opentelemetry.io/otel/trace v1.46.0 h1:OULy7ccdJnZtJ0UDYFOIGaCmiWzJ8Vi2G/Rsu6 go.opentelemetry.io/otel/trace v1.46.0/go.mod h1:J7GAXweO77XSFkB/rmAqk9D6ihszhFjLU+d9WuUxDLI= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/crypto v0.53.0/go.mod h1:DNLU434OwVakk9PzuwV8w62mAJpRJL3vsgcfp4Qnsio= +golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/mod v0.37.0/go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0= golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40= +golang.org/x/mod v0.39.0/go.mod h1:bvIbwjQ0HUFFf5AKukeeYQG4ZBUG9yxQbR9aEweIwYY= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww= golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec= golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= +golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= -golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= -golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw= +golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/telemetry v0.0.0-20260625142307-59b4966ccb57/go.mod h1:3AWMyWHS+caVoiEXpiq6+tzKA40J4vQT3MYr80ZtQpc= golang.org/x/telemetry v0.0.0-20260708182218-49f421fb7959/go.mod h1:LV7u5Oco+Z/g6XI7PqN+EUUUGGkEcmB1uj2ceI0fOVg= +golang.org/x/telemetry v0.0.0-20260811182544-a038080d80e5/go.mod h1:LVehoXe41cL5SCVQilsV7Gg6BNG+Js6P9PhSbYTIUkQ= golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/term v0.44.0/go.mod h1:7ze4MdzUzLXpSAoFP1H0bOI9aXDqveSvatT5vKcFh2Y= golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= golang.org/x/text v0.38.0/go.mod h1:YXZt3QhHUKYT53r2lLKFIVi6Ao1jdzrTR/KQ09qyxF4= +golang.org/x/text v0.39.0/go.mod h1:3UwRclnC2g0TU9x8PZiyfOajCd1zaUNHF9cvqcQZ+ZM= golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= @@ -108,7 +105,10 @@ golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0 golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0= golang.org/x/tools v0.47.0/go.mod h1:dFHnyTvFWY212G+h7ZY4Vsp/K3U4/7W9TyVaAul8uCA= golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk= +golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo= +golang.org/x/tools/go/expect v0.1.1-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY= +golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGNv1ib0J382/DPCRS/BPnsGebyM1Gj5VSDpG8= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.83.1/go.mod h1:kDyl6SKsiHKt0uylY5gtn5cEjkrIOhQOGDgIc4JGwzQ= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= diff --git a/go/driver/headgatemysql/go.mod b/go/driver/headgatemysql/go.mod index ff5012f..36c6e25 100644 --- a/go/driver/headgatemysql/go.mod +++ b/go/driver/headgatemysql/go.mod @@ -17,7 +17,7 @@ require ( github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/pgx/v5 v5.9.2 // indirect github.com/redis/go-redis/v9 v9.7.3 // indirect - golang.org/x/text v0.39.0 // indirect + golang.org/x/text v0.40.0 // indirect ) replace github.com/mujhtech/headgate/go => ../.. diff --git a/go/driver/headgatemysql/go.sum b/go/driver/headgatemysql/go.sum index b43e5b1..4563525 100644 --- a/go/driver/headgatemysql/go.sum +++ b/go/driver/headgatemysql/go.sum @@ -30,10 +30,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM= -golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/text v0.39.0 h1:UbZz4pLOvn600D6Oh6GGEI6VAmndrEBLv8/6BEXzyus= -golang.org/x/text v0.39.0/go.mod h1:3UwRclnC2g0TU9x8PZiyfOajCd1zaUNHF9cvqcQZ+ZM= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/go/driver/headgatemysql/inspect.go b/go/driver/headgatemysql/inspect.go index 7334244..6d084f3 100644 --- a/go/driver/headgatemysql/inspect.go +++ b/go/driver/headgatemysql/inspect.go @@ -23,6 +23,7 @@ package headgatemysql // so "0 rows" unambiguously means "no such row". import ( + "bytes" "context" "database/sql" "encoding/json" @@ -782,14 +783,14 @@ func (s *MysqlStore) OperatorRetry(ctx context.Context, id string) error { if _, err := tx.ExecContext(ctx, ` INSERT INTO headgate_active_partition (queue, partition_key) SELECT queue, partition_key FROM headgate_job - WHERE ulid = ? AND state IN ('archived', 'cancelled') + WHERE ulid = ? AND state IN ('archived', 'cancelled', 'undecodable') ON DUPLICATE KEY UPDATE queue = VALUES(queue)`, id); err != nil { return 0, err } res, err := tx.ExecContext(ctx, ` UPDATE headgate_job SET state = 'available', scheduled_at_ms = `+nowMS+`, finalized_at_ms = NULL - WHERE ulid = ? AND state IN ('archived', 'cancelled')`, id) + WHERE ulid = ? AND state IN ('archived', 'cancelled', 'undecodable')`, id) if err != nil { return 0, err } @@ -812,7 +813,7 @@ func (s *MysqlStore) OperatorRetry(ctx context.Context, id string) error { if !found { return headgate.NotFoundf("job %s", id) } - return headgate.Invalidf("operator_retry is only defined from archived or cancelled; job %s is %s", id, st) + return headgate.Invalidf("operator_retry is only defined from archived, cancelled, or undecodable; job %s is %s", id, st) } func (s *MysqlStore) OperatorCancel(ctx context.Context, id string) error { @@ -838,7 +839,7 @@ func (s *MysqlStore) OperatorCancel(ctx context.Context, id string) error { UPDATE headgate_job SET state = 'cancelled', lease_id = NULL, lease_expires_at_ms = NULL, claimed_by = NULL, finalized_at_ms = `+nowMS+` - WHERE ulid = ? AND state IN ('pending', 'scheduled', 'available', 'running')`, id) + WHERE ulid = ? AND state IN ('pending', 'scheduled', 'available', 'running', 'retryable')`, id) if err != nil { return 0, err } @@ -1287,6 +1288,83 @@ func (s *MysqlStore) ListScheduleEvents(ctx context.Context, scheduleID string, return out, rows.Err() } +func (s *MysqlStore) AppendDurableEvent(ctx context.Context, event headgate.DurableEvent) (headgate.DurableEvent, bool, error) { + if err := validateDurableEvent(event); err != nil { + return headgate.DurableEvent{}, false, err + } + tx, err := s.db.BeginTx(ctx, nil) + if err != nil { + return headgate.DurableEvent{}, false, err + } + defer func() { _ = tx.Rollback() }() + if _, err = tx.ExecContext(ctx, `INSERT IGNORE INTO headgate_durable_event_scope(scope) VALUES(?)`, event.Scope); err != nil { + return headgate.DurableEvent{}, false, err + } + var locked string + if err = tx.QueryRowContext(ctx, `SELECT scope FROM headgate_durable_event_scope WHERE scope=? FOR UPDATE`, event.Scope).Scan(&locked); err != nil { + return headgate.DurableEvent{}, false, err + } + var existingID uint64 + err = tx.QueryRowContext(ctx, `SELECT id FROM headgate_durable_event WHERE scope=? AND idempotency_key=?`, event.Scope, event.IdempotencyKey).Scan(&existingID) + inserted := errors.Is(err, sql.ErrNoRows) + if err != nil && !inserted { + return headgate.DurableEvent{}, false, err + } + if inserted { + if _, err = tx.ExecContext(ctx, `INSERT INTO headgate_durable_event(scope,topic,idempotency_key,payload,source,recorded_at_ms) VALUES(?,?,?,?,?,`+nowMS+`)`, event.Scope, event.Topic, event.IdempotencyKey, event.Payload, event.Source); err != nil { + return headgate.DurableEvent{}, false, err + } + } + var topic string + var payload, source []byte + if err = tx.QueryRowContext(ctx, `SELECT id,topic,payload,source,recorded_at_ms FROM headgate_durable_event WHERE scope=? AND idempotency_key=?`, event.Scope, event.IdempotencyKey).Scan(&event.EventID, &topic, &payload, &source, &event.RecordedAtMs); err != nil { + return headgate.DurableEvent{}, false, err + } + if topic != event.Topic || !bytes.Equal(payload, event.Payload) || !bytes.Equal(source, event.Source) { + return headgate.DurableEvent{}, false, &headgate.InvalidError{Msg: "durable event idempotency key was reused with different content"} + } + if _, err = tx.ExecContext(ctx, `DELETE e FROM headgate_durable_event e LEFT JOIN (SELECT id FROM headgate_durable_event WHERE scope=? ORDER BY id DESC LIMIT ?) keep ON keep.id=e.id WHERE e.scope=? AND keep.id IS NULL`, event.Scope, headgate.DurableEventLimit, event.Scope); err != nil { + return headgate.DurableEvent{}, false, err + } + if err = tx.Commit(); err != nil { + return headgate.DurableEvent{}, false, err + } + return event, inserted, nil +} + +func (s *MysqlStore) ListDurableEvents(ctx context.Context, scope string, beforeEventID uint64, limit uint32) ([]headgate.DurableEvent, error) { + if err := headgate.ValidateDurableEventLimit(limit); err != nil { + return nil, err + } + rows, err := s.db.QueryContext(ctx, `SELECT id,scope,topic,idempotency_key,payload,source,recorded_at_ms FROM headgate_durable_event WHERE scope=? AND (?=0 OR id 512 || event.Topic == "" || len(event.Topic) > 255 || event.IdempotencyKey == "" || len(event.IdempotencyKey) > 255 { + return &headgate.InvalidError{Msg: "durable event scope, topic, or idempotency key is invalid"} + } + if len(event.Payload) > headgate.MaxDurableEventPayloadBytes || !json.Valid(event.Payload) { + return &headgate.InvalidError{Msg: "durable event payload must be valid JSON of at most 65536 bytes"} + } + if len(event.Source) > headgate.MaxDurableEventSourceBytes || !json.Valid(event.Source) { + return &headgate.InvalidError{Msg: "durable event source must be valid JSON of at most 16384 bytes"} + } + return nil +} + // ---------- worker registry + surveyed policy behavior control channel ---------- func (s *MysqlStore) HeartbeatWorker(ctx context.Context, w headgate.WorkerMeta) (string, error) { @@ -1592,6 +1670,25 @@ func (s *MysqlStore) PromoteJob(ctx context.Context, id string) error { return tx.Commit() } +func (s *MysqlStore) SchedulePendingJob(ctx context.Context, id string, atMs int64) error { + if atMs <= 0 { + return headgate.Invalidf("pending schedule timestamp must be positive") + } + result, err := s.db.ExecContext(ctx, `UPDATE headgate_job SET state='scheduled', scheduled_at_ms=? + WHERE ulid=? AND state='pending'`, atMs, id) + if err != nil { + return err + } + n, err := result.RowsAffected() + if err != nil { + return err + } + if n != 1 { + return headgate.Invalidf("workflow_schedule is defined only from pending") + } + return nil +} + func (s *MysqlStore) DeleteQueue(ctx context.Context, queue string, force bool) (string, error) { tx, err := s.db.BeginTx(ctx, nil) if err != nil { diff --git a/go/driver/headgatepgx/go.mod b/go/driver/headgatepgx/go.mod index 633fcd2..f65beae 100644 --- a/go/driver/headgatepgx/go.mod +++ b/go/driver/headgatepgx/go.mod @@ -18,8 +18,8 @@ require ( github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect github.com/redis/go-redis/v9 v9.7.3 // indirect - golang.org/x/sync v0.21.0 // indirect - golang.org/x/text v0.39.0 // indirect + golang.org/x/sync v0.22.0 // indirect + golang.org/x/text v0.40.0 // indirect ) replace github.com/mujhtech/headgate/go => ../.. diff --git a/go/driver/headgatepgx/go.sum b/go/driver/headgatepgx/go.sum index b43e5b1..4563525 100644 --- a/go/driver/headgatepgx/go.sum +++ b/go/driver/headgatepgx/go.sum @@ -30,10 +30,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM= -golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/text v0.39.0 h1:UbZz4pLOvn600D6Oh6GGEI6VAmndrEBLv8/6BEXzyus= -golang.org/x/text v0.39.0/go.mod h1:3UwRclnC2g0TU9x8PZiyfOajCd1zaUNHF9cvqcQZ+ZM= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/go/driver/headgatepgx/inspect.go b/go/driver/headgatepgx/inspect.go index 69148fc..c139484 100644 --- a/go/driver/headgatepgx/inspect.go +++ b/go/driver/headgatepgx/inspect.go @@ -7,6 +7,7 @@ package headgatepgx // exactness. import ( + "bytes" "context" "encoding/json" "errors" @@ -746,7 +747,7 @@ func (s *PgxStore) OperatorRetry(ctx context.Context, id string) error { WITH upd AS ( UPDATE headgate_job SET state = 'available', scheduled_at_ms = `+nowMS+`, finalized_at_ms = NULL - WHERE ulid = $1 AND state IN ('archived', 'cancelled') + WHERE ulid = $1 AND state IN ('archived', 'cancelled', 'undecodable') RETURNING queue, partition_key ), -- tenant fairness/adaptive admission retry-now makes the row available; list its partition here. @@ -769,7 +770,7 @@ func (s *PgxStore) OperatorRetry(ctx context.Context, id string) error { if !found { return headgate.NotFoundf("job %s", id) } - return headgate.Invalidf("operator_retry is only defined from archived or cancelled; job %s is %s", id, st) + return headgate.Invalidf("operator_retry is only defined from archived, cancelled, or undecodable; job %s is %s", id, st) } func (s *PgxStore) OperatorCancel(ctx context.Context, id string) error { @@ -783,7 +784,7 @@ func (s *PgxStore) OperatorCancel(ctx context.Context, id string) error { WITH pick AS ( SELECT j.id, j.queue, j.partition_key, (j.state = 'running') AS was_running FROM headgate_job j - WHERE j.ulid = $1 AND j.state IN ('pending', 'scheduled', 'available', 'running') + WHERE j.ulid = $1 AND j.state IN ('pending', 'scheduled', 'available', 'running', 'retryable') FOR UPDATE ), upd AS ( @@ -1211,6 +1212,81 @@ func (s *PgxStore) ListScheduleEvents(ctx context.Context, scheduleID string, be return out, rows.Err() } +func (s *PgxStore) AppendDurableEvent(ctx context.Context, event headgate.DurableEvent) (headgate.DurableEvent, bool, error) { + if err := validateDurableEvent(event); err != nil { + return headgate.DurableEvent{}, false, err + } + tx, err := s.pool.Begin(ctx) + if err != nil { + return headgate.DurableEvent{}, false, err + } + defer func() { _ = tx.Rollback(ctx) }() + if _, err = tx.Exec(ctx, `INSERT INTO headgate_durable_event_scope(scope) VALUES($1) ON CONFLICT DO NOTHING`, event.Scope); err != nil { + return headgate.DurableEvent{}, false, err + } + var locked string + if err = tx.QueryRow(ctx, `SELECT scope FROM headgate_durable_event_scope WHERE scope=$1 FOR UPDATE`, event.Scope).Scan(&locked); err != nil { + return headgate.DurableEvent{}, false, err + } + var id uint64 + var recorded int64 + err = tx.QueryRow(ctx, `INSERT INTO headgate_durable_event(scope,topic,idempotency_key,payload,source,recorded_at_ms) VALUES($1,$2,$3,$4,$5,`+nowMS+`) ON CONFLICT(scope,idempotency_key) DO NOTHING RETURNING id,recorded_at_ms`, event.Scope, event.Topic, event.IdempotencyKey, event.Payload, event.Source).Scan(&id, &recorded) + inserted := err == nil + if errors.Is(err, pgx.ErrNoRows) { + var topic string + var payload, source []byte + if err = tx.QueryRow(ctx, `SELECT id,topic,payload,source,recorded_at_ms FROM headgate_durable_event WHERE scope=$1 AND idempotency_key=$2`, event.Scope, event.IdempotencyKey).Scan(&id, &topic, &payload, &source, &recorded); err != nil { + return headgate.DurableEvent{}, false, err + } + if topic != event.Topic || !bytes.Equal(payload, event.Payload) || !bytes.Equal(source, event.Source) { + return headgate.DurableEvent{}, false, &headgate.InvalidError{Msg: "durable event idempotency key was reused with different content"} + } + } else if err != nil { + return headgate.DurableEvent{}, false, err + } + if _, err = tx.Exec(ctx, `DELETE FROM headgate_durable_event WHERE scope=$1 AND id NOT IN (SELECT id FROM headgate_durable_event WHERE scope=$1 ORDER BY id DESC LIMIT $2)`, event.Scope, headgate.DurableEventLimit); err != nil { + return headgate.DurableEvent{}, false, err + } + if err = tx.Commit(ctx); err != nil { + return headgate.DurableEvent{}, false, err + } + event.EventID, event.RecordedAtMs = id, recorded + return event, inserted, nil +} + +func (s *PgxStore) ListDurableEvents(ctx context.Context, scope string, beforeEventID uint64, limit uint32) ([]headgate.DurableEvent, error) { + if err := headgate.ValidateDurableEventLimit(limit); err != nil { + return nil, err + } + rows, err := s.pool.Query(ctx, `SELECT id,scope,topic,idempotency_key,payload,source,recorded_at_ms FROM headgate_durable_event WHERE scope=$1 AND ($2=0 OR id<$2) ORDER BY id DESC LIMIT $3`, scope, beforeEventID, limit) + if err != nil { + return nil, err + } + defer rows.Close() + out := make([]headgate.DurableEvent, 0, limit) + for rows.Next() { + var event headgate.DurableEvent + if err := rows.Scan(&event.EventID, &event.Scope, &event.Topic, &event.IdempotencyKey, &event.Payload, &event.Source, &event.RecordedAtMs); err != nil { + return nil, err + } + out = append(out, event) + } + return out, rows.Err() +} + +func validateDurableEvent(event headgate.DurableEvent) error { + if event.Scope == "" || len(event.Scope) > 512 || event.Topic == "" || len(event.Topic) > 255 || event.IdempotencyKey == "" || len(event.IdempotencyKey) > 255 { + return &headgate.InvalidError{Msg: "durable event scope, topic, or idempotency key is invalid"} + } + if len(event.Payload) > headgate.MaxDurableEventPayloadBytes || !json.Valid(event.Payload) { + return &headgate.InvalidError{Msg: "durable event payload must be valid JSON of at most 65536 bytes"} + } + if len(event.Source) > headgate.MaxDurableEventSourceBytes || !json.Valid(event.Source) { + return &headgate.InvalidError{Msg: "durable event source must be valid JSON of at most 16384 bytes"} + } + return nil +} + // ---------- worker registry + surveyed policy behavior control channel ---------- func (s *PgxStore) HeartbeatWorker(ctx context.Context, w headgate.WorkerMeta) (string, error) { @@ -1487,6 +1563,21 @@ func (s *PgxStore) PromoteJob(ctx context.Context, id string) error { return nil } +func (s *PgxStore) SchedulePendingJob(ctx context.Context, id string, atMs int64) error { + if atMs <= 0 { + return headgate.Invalidf("pending schedule timestamp must be positive") + } + result, err := s.pool.Exec(ctx, `UPDATE headgate_job SET state='scheduled', scheduled_at_ms=$2 + WHERE ulid=$1 AND state='pending'`, id, atMs) + if err != nil { + return err + } + if result.RowsAffected() != 1 { + return headgate.Invalidf("workflow_schedule is defined only from pending") + } + return nil +} + func queueDeleteID(now int64, queue string) string { clean := strings.Map(func(r rune) rune { if r >= 'a' && r <= 'z' || r >= 'A' && r <= 'Z' || r >= '0' && r <= '9' { diff --git a/go/driver/headgateredis/go.mod b/go/driver/headgateredis/go.mod index 1743f3b..9a422cf 100644 --- a/go/driver/headgateredis/go.mod +++ b/go/driver/headgateredis/go.mod @@ -17,7 +17,7 @@ require ( github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/pgx/v5 v5.9.2 // indirect github.com/mujhtech/headgate/go/headgatemigrate v0.1.7 // indirect - golang.org/x/text v0.39.0 // indirect + golang.org/x/text v0.40.0 // indirect ) replace github.com/mujhtech/headgate/go => ../.. diff --git a/go/driver/headgateredis/go.sum b/go/driver/headgateredis/go.sum index b43e5b1..4563525 100644 --- a/go/driver/headgateredis/go.sum +++ b/go/driver/headgateredis/go.sum @@ -30,10 +30,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM= -golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/text v0.39.0 h1:UbZz4pLOvn600D6Oh6GGEI6VAmndrEBLv8/6BEXzyus= -golang.org/x/text v0.39.0/go.mod h1:3UwRclnC2g0TU9x8PZiyfOajCd1zaUNHF9cvqcQZ+ZM= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/go/driver/headgateredis/inspect.go b/go/driver/headgateredis/inspect.go index 2e7aafd..b0d2eed 100644 --- a/go/driver/headgateredis/inspect.go +++ b/go/driver/headgateredis/inspect.go @@ -9,6 +9,7 @@ package headgateredis // match the other backends word-for-word (the mutation-diff discipline). import ( + "bytes" "context" "encoding/json" "errors" @@ -972,7 +973,7 @@ func (s *RedisStore) OperatorRetry(ctx context.Context, id string) error { case "DUP": return &headgate.DuplicateError{ExistingID: second(res)} default: - return headgate.Invalidf("operator_retry is only defined from archived or cancelled; job %s is %s", + return headgate.Invalidf("operator_retry is only defined from archived, cancelled, or undecodable; job %s is %s", id, second(res)) } } @@ -1327,6 +1328,130 @@ func (s *RedisStore) ListScheduleEvents(ctx context.Context, scheduleID string, return out, nil } +func (s *RedisStore) AppendDurableEvent(ctx context.Context, event headgate.DurableEvent) (headgate.DurableEvent, bool, error) { + if err := validateDurableEvent(event); err != nil { + return headgate.DurableEvent{}, false, err + } + now, err := s.storeNowMs(ctx) + if err != nil { + return headgate.DurableEvent{}, false, err + } + const script = `local old=redis.call('HGET',KEYS[2],ARGV[2]) +if old then return {'0',old} end +local id=redis.call('INCR',KEYS[3]) +local value=cjson.encode({event_id=id,scope=ARGV[1],topic=ARGV[3],idempotency_key=ARGV[2],payload=ARGV[4],source=ARGV[5],recorded_at_ms=tonumber(ARGV[6])}) +redis.call('HSET',KEYS[2],ARGV[2],value) +redis.call('ZADD',KEYS[1],id,value) +local excess=redis.call('ZCARD',KEYS[1])-tonumber(ARGV[7]) +if excess>0 then local gone=redis.call('ZRANGE',KEYS[1],0,excess-1) for _,v in ipairs(gone) do local e=cjson.decode(v) redis.call('HDEL',KEYS[2],e.idempotency_key) end redis.call('ZREMRANGEBYRANK',KEYS[1],0,excess-1) end +return {'1',value}` + values, err := redis.NewScript(script).Run(ctx, s.rdb, []string{s.key("durable-events", event.Scope), s.key("durable-event-idem", event.Scope), s.key("durable-event-seq")}, event.Scope, event.IdempotencyKey, event.Topic, string(event.Payload), string(event.Source), now, headgate.DurableEventLimit).StringSlice() + if err != nil { + return headgate.DurableEvent{}, false, err + } + if len(values) != 2 { + return headgate.DurableEvent{}, false, fmt.Errorf("headgate: unexpected durable event reply") + } + stored, err := decodeDurableEvent([]byte(values[1])) + if err != nil { + return headgate.DurableEvent{}, false, err + } + if stored.Topic != event.Topic || !bytes.Equal(stored.Payload, event.Payload) || !bytes.Equal(stored.Source, event.Source) { + return headgate.DurableEvent{}, false, &headgate.InvalidError{Msg: "durable event idempotency key was reused with different content"} + } + return stored, values[0] == "1", nil +} + +func (s *RedisStore) ListDurableEvents(ctx context.Context, scope string, beforeEventID uint64, limit uint32) ([]headgate.DurableEvent, error) { + if err := headgate.ValidateDurableEventLimit(limit); err != nil { + return nil, err + } + max := "+inf" + if beforeEventID != 0 { + max = "(" + strconv.FormatUint(beforeEventID, 10) + } + values, err := s.rdb.ZRevRangeByScore(ctx, s.key("durable-events", scope), &redis.ZRangeBy{Max: max, Min: "-inf", Offset: 0, Count: int64(limit)}).Result() + if err != nil { + return nil, err + } + out := make([]headgate.DurableEvent, 0, len(values)) + for _, value := range values { + event, err := decodeDurableEvent([]byte(value)) + if err != nil { + return nil, err + } + out = append(out, event) + } + return out, nil +} + +func validateDurableEvent(event headgate.DurableEvent) error { + if event.Scope == "" || len(event.Scope) > 512 || event.Topic == "" || len(event.Topic) > 255 || event.IdempotencyKey == "" || len(event.IdempotencyKey) > 255 { + return &headgate.InvalidError{Msg: "durable event scope, topic, or idempotency key is invalid"} + } + if len(event.Payload) > headgate.MaxDurableEventPayloadBytes || !json.Valid(event.Payload) { + return &headgate.InvalidError{Msg: "durable event payload must be valid JSON of at most 65536 bytes"} + } + if len(event.Source) > headgate.MaxDurableEventSourceBytes || !json.Valid(event.Source) { + return &headgate.InvalidError{Msg: "durable event source must be valid JSON of at most 16384 bytes"} + } + return nil +} + +func decodeDurableEvent(data []byte) (headgate.DurableEvent, error) { + var raw struct { + EventID uint64 `json:"event_id"` + Scope string `json:"scope"` + Topic string `json:"topic"` + IdempotencyKey string `json:"idempotency_key"` + Payload json.RawMessage `json:"payload"` + Source json.RawMessage `json:"source"` + RecordedAtMs json.RawMessage `json:"recorded_at_ms"` + } + if err := json.Unmarshal(data, &raw); err != nil { + return headgate.DurableEvent{}, fmt.Errorf("decoding stored durable event: %w", err) + } + payload, err := decodeStoredJSON(raw.Payload) + if err != nil { + return headgate.DurableEvent{}, fmt.Errorf("decoding stored durable event: payload: %w", err) + } + source, err := decodeStoredJSON(raw.Source) + if err != nil { + return headgate.DurableEvent{}, fmt.Errorf("decoding stored durable event: source: %w", err) + } + recordedAtMs, err := decodeJSONInt64(raw.RecordedAtMs) + if err != nil { + return headgate.DurableEvent{}, fmt.Errorf("decoding stored durable event: recorded_at_ms: %w", err) + } + return headgate.DurableEvent{EventID: raw.EventID, Scope: raw.Scope, Topic: raw.Topic, IdempotencyKey: raw.IdempotencyKey, Payload: payload, Source: source, RecordedAtMs: recordedAtMs}, nil +} + +func decodeStoredJSON(data []byte) (json.RawMessage, error) { + if len(data) > 0 && data[0] == '"' { + var encoded string + if err := json.Unmarshal(data, &encoded); err != nil { + return nil, err + } + data = []byte(encoded) + } + if !json.Valid(data) { + return nil, errors.New("invalid JSON") + } + return json.RawMessage(bytes.Clone(data)), nil +} + +func decodeJSONInt64(data []byte) (int64, error) { + var value int64 + if err := json.Unmarshal(data, &value); err == nil { + return value, nil + } + var encoded string + if err := json.Unmarshal(data, &encoded); err != nil { + return 0, err + } + return strconv.ParseInt(encoded, 10, 64) +} + func (s *RedisStore) HeartbeatWorker(ctx context.Context, w headgate.WorkerMeta) (string, error) { status := w.Status if status == "" { @@ -1671,6 +1796,29 @@ func (s *RedisStore) PromoteJob(ctx context.Context, id string) error { } } +func (s *RedisStore) SchedulePendingJob(ctx context.Context, id string, atMs int64) error { + if atMs <= 0 { + return headgate.Invalidf("pending schedule timestamp must be positive") + } + res, err := s.adminJobOp(ctx, "schedule_pending", id, atMs) + if err != nil { + return err + } + if len(res) == 0 { + return errors.New("invalid schedule_pending response") + } + switch res[0] { + case "OK": + return nil + case "NF": + return headgate.NotFoundf("job %s", id) + case "ERR": + return headgate.Invalidf("workflow_schedule is defined only from pending") + default: + return errors.New("invalid schedule_pending response") + } +} + func (s *RedisStore) DeleteQueue(ctx context.Context, queue string, force bool) (string, error) { now, err := s.storeNowMs(ctx) if err != nil { diff --git a/go/driver/headgateredis/inspect_test.go b/go/driver/headgateredis/inspect_test.go index 6d7d358..334326b 100644 --- a/go/driver/headgateredis/inspect_test.go +++ b/go/driver/headgateredis/inspect_test.go @@ -13,6 +13,26 @@ import ( headgate "github.com/mujhtech/headgate/go" ) +func TestDecodeDurableEventAcceptsCurrentAndLegacyRedisTimestamps(t *testing.T) { + fixtures := []string{ + `{"event_id":7,"scope":"workflow:w1","topic":"approved","idempotency_key":"signal:1","payload":"{\"approved\": true}","source":"{\"emitter\": \"api\"}","recorded_at_ms":1720000000123}`, + `{"event_id":7,"scope":"workflow:w1","topic":"approved","idempotency_key":"signal:1","payload":{"approved":true},"source":{"emitter":"api"},"recorded_at_ms":"1720000000123"}`, + } + for index, fixture := range fixtures { + event, err := decodeDurableEvent([]byte(fixture)) + if err != nil { + t.Fatalf("fixture %d: %v", index, err) + } + if event.EventID != 7 || event.RecordedAtMs != 1720000000123 { + t.Fatalf("fixture %d decoded as %#v", index, event) + } + } + current, err := decodeDurableEvent([]byte(fixtures[0])) + if err != nil || string(current.Payload) != `{"approved": true}` || string(current.Source) != `{"emitter": "api"}` { + t.Fatalf("current payload/source bytes were not preserved: %#v, %v", current, err) + } +} + func TestSchedulerEnqueueEventsAreDurableAndBoundedOnGoRedis(t *testing.T) { s, _, ctx := testStore(t, "gri-audit") for tick := int64(1); tick <= 105; tick++ { diff --git a/go/driver/headgateredis/lua/admin.lua b/go/driver/headgateredis/lua/admin.lua index fed1cca..2311bc7 100644 --- a/go/driver/headgateredis/lua/admin.lua +++ b/go/driver/headgateredis/lua/admin.lua @@ -95,7 +95,7 @@ local function do_cancel(id, h) if ret > 0 then redis.call('ZADD', p .. ':ret', now + ret, id) end end --- archived|cancelled -> available (operator_retry). +-- archived|cancelled|undecodable -> available (operator_retry). local function do_retry(id, h) local st, q, part, fp = h[1], h[2], h[3], h[4] local uk, uw = h[5], tonumber(h[6] or '0') or 0 @@ -141,7 +141,7 @@ if op == 'cancel' then local id = ARGV[2] local h = job_head(id) if not h[1] then return {'NF'} end - if h[1] ~= 'pending' and h[1] ~= 'scheduled' and h[1] ~= 'available' and h[1] ~= 'running' then + if h[1] ~= 'pending' and h[1] ~= 'scheduled' and h[1] ~= 'available' and h[1] ~= 'running' and h[1] ~= 'retryable' then return {'ERR', h[1]} end do_cancel(id, h) @@ -159,6 +159,17 @@ elseif op == 'promote' then redis.call('ZADD', p .. ':avail:' .. h[2] .. ':' .. h[3], now, id) redis.call('ZADD', p .. ':metricparts:' .. h[2], now, h[3]) return {'OK'} +elseif op == 'schedule_pending' then + local id, at = ARGV[2], tonumber(ARGV[3]) + local h = job_head(id) + if not h[1] then return {'NF'} end + if h[1] ~= 'pending' or not at or at <= 0 then return {'ERR', h[1]} end + redis.call('ZREM', idx(h[2], 'pending'), id) + redis.call('ZADD', idx(h[2], 'scheduled'), at, id) + redis.call('ZADD', p .. ':sched', at, id) + add_waiting(id, h[2], h[3], h[8], at) + redis.call('HSET', jk(id), 'state', 'scheduled', 'scheduled_at_ms', at) + return {'OK'} elseif op == 'queue_delete' then local q, force, opid = ARGV[2], ARGV[3] == '1', ARGV[4] @@ -187,7 +198,7 @@ elseif op == 'retry' then local id = ARGV[2] local h = job_head(id) if not h[1] then return {'NF'} end - if h[1] ~= 'archived' and h[1] ~= 'cancelled' then return {'ERR', h[1]} end + if h[1] ~= 'archived' and h[1] ~= 'cancelled' and h[1] ~= 'undecodable' then return {'ERR', h[1]} end local holder = do_retry(id, h) if holder then return {'DUP', holder} end return {'OK'} diff --git a/go/go.work b/go/go.work deleted file mode 100644 index dd1de5a..0000000 --- a/go/go.work +++ /dev/null @@ -1,16 +0,0 @@ -go 1.25.0 - -use ( - . - ./driver/headgatemysql - ./driver/headgatepgx - ./driver/headgateredis - ./headgateapi - ./headgatecrypto - ./headgatectl - ./headgatemigrate - ./headgateotel - ./headgatetest - ./headgateui - ./headgateworkflow -) diff --git a/go/headgate.go b/go/headgate.go index c361113..3dfa346 100644 --- a/go/headgate.go +++ b/go/headgate.go @@ -143,6 +143,30 @@ const ( OutcomeRateLimited = headgateshared.OutcomeRateLimited ) +const DurableEventLimit = uint32(100) +const MaxDurableEventPayloadBytes = 64 * 1024 +const MaxDurableEventSourceBytes = 16 * 1024 + +// DurableEvent is one bounded, store-timestamped fact attached to an application scope. +// Payload and Source contain valid JSON so every backend preserves the same value. +type DurableEvent struct { + EventID uint64 + Scope string + Topic string + IdempotencyKey string + Payload []byte + Source []byte + RecordedAtMs int64 +} + +// DurableEventStore is an optional inspection capability used by layered packages such +// as headgateworkflow. It stays separate from InspectStore so core inspection adapters +// do not falsely claim durable event support. +type DurableEventStore interface { + AppendDurableEvent(ctx context.Context, event DurableEvent) (stored DurableEvent, inserted bool, err error) + ListDurableEvents(ctx context.Context, scope string, beforeEventID uint64, limit uint32) ([]DurableEvent, error) +} + func ParseOutcome(value string) (Outcome, bool) { return headgateshared.ParseOutcome(value) } @@ -1027,6 +1051,14 @@ type CheckpointInspectStore interface { GetJobCheckpoint(ctx context.Context, id string) (*Checkpoint, error) } +// PendingScheduleStore is the narrow optional capability workflow-relative timers use +// to atomically move pending work to an absolute store-clock deadline. Keeping it +// separate from InspectStore does not force unrelated third-party inspection adapters +// to claim support they do not have. +type PendingScheduleStore interface { + SchedulePendingJob(ctx context.Context, id string, atMs int64) error +} + // Tx is a caller-owned store transaction. Drivers wrap their concrete handle and // recover it via Unwrap — the Go mirror of Rust's TxHandle::as_any (transactional API): the // compile-time path is typed, the dyn path downcasts, and a foreign handle is a hard @@ -1702,6 +1734,13 @@ func ValidateScheduleEventLimit(limit uint32) error { return nil } +func ValidateDurableEventLimit(limit uint32) error { + if limit == 0 || limit > DurableEventLimit { + return &InvalidError{Msg: "durable event limit must be between 1 and 100"} + } + return nil +} + // SaturationStrategy is the wire/storage spelling read by every atomic gate. type SaturationStrategy = headgateshared.SaturationStrategy diff --git a/go/headgateapi/api.go b/go/headgateapi/api.go index addfa8d..5cdbdef 100644 --- a/go/headgateapi/api.go +++ b/go/headgateapi/api.go @@ -23,6 +23,7 @@ import ( "time" headgate "github.com/mujhtech/headgate/go" + headgateworkflow "github.com/mujhtech/headgate/go/headgateworkflow" ) type api struct { @@ -174,10 +175,251 @@ func handler( mux.HandleFunc("GET /api/v1/workers", a.workers) mux.HandleFunc("GET /api/v1/cluster", a.cluster) mux.HandleFunc("POST /api/v1/workers/{worker_id}/signal", a.signalWorker) + mux.HandleFunc("GET /api/v1/workflows", a.workflowList) + mux.HandleFunc("GET /api/v1/workflows/{id}", a.workflowDetail) + mux.HandleFunc("GET /api/v1/workflows/{id}/events", a.workflowEvents) + mux.HandleFunc("GET /api/v1/workflows/{id}/nodes/{node}", a.workflowNode) + mux.HandleFunc("GET /api/v1/workflows/{id}/nodes/{node}/dependencies", a.workflowDependencies) + mux.HandleFunc("GET /api/v1/workflows/{id}/nodes/{node}/dependents", a.workflowDependents) + mux.HandleFunc("POST /api/v1/workflows/{id}/signals", a.workflowSignal) + mux.HandleFunc("GET /api/v1/workflows/{id}/signals", a.workflowSignals) + mux.HandleFunc("POST /api/v1/workflows/{id}/grafts", a.workflowGraft) + mux.HandleFunc("POST /api/v1/workflows/{id}/retry", a.workflowRetry) + mux.HandleFunc("POST /api/v1/workflows/{id}/cancel", a.workflowCancel) mux.HandleFunc("GET /api/v1/events", a.events) return routeParity(mux) } +func workflowErr(w http.ResponseWriter, err error) { + message := err.Error() + status := http.StatusBadRequest + if strings.Contains(message, "was not found") { + status = http.StatusNotFound + } else if strings.Contains(message, "revision conflict") { + status = http.StatusConflict + } + errJSON(w, status, message) +} + +func (a *api) workflowEvents(w http.ResponseWriter, r *http.Request) { + events, err := headgateworkflow.WorkflowEvents(r.Context(), a.store, r.PathValue("id")) + if err != nil { + workflowErr(w, err) + return + } + writeJSON(w, http.StatusOK, map[string]any{"events": events}) +} + +func (a *api) workflowDetail(w http.ResponseWriter, r *http.Request) { + snapshot, err := headgateworkflow.InspectWorkflow(r.Context(), a.store, r.PathValue("id")) + if err != nil { + workflowErr(w, err) + return + } + writeJSON(w, http.StatusOK, snapshot) +} + +func (a *api) workflowList(w http.ResponseWriter, r *http.Request) { + limit, ok := queryUint32(w, r, "limit", 50) + if !ok { + return + } + if r.URL.Query().Has("cursor") && r.URL.Query().Get("cursor") == "" { + errJSON(w, http.StatusBadRequest, "bad cursor") + return + } + page, err := headgateworkflow.ListWorkflows(r.Context(), a.store, r.URL.Query().Get("cursor"), limit) + if err != nil { + workflowErr(w, err) + return + } + var cursor any + if page.NextCursor != "" { + cursor = page.NextCursor + } + writeJSON(w, http.StatusOK, map[string]any{"workflows": page.Workflows, "next_cursor": cursor}) +} + +func (a *api) workflowNode(w http.ResponseWriter, r *http.Request) { + node, err := headgateworkflow.GetWorkflowNode(r.Context(), a.store, r.PathValue("id"), r.PathValue("node")) + if err != nil { + workflowErr(w, err) + return + } + writeJSON(w, http.StatusOK, node) +} + +func (a *api) workflowDependencies(w http.ResponseWriter, r *http.Request) { + dependencies, err := headgateworkflow.WorkflowDependencies(r.Context(), a.store, r.PathValue("id"), r.PathValue("node")) + if err != nil { + workflowErr(w, err) + return + } + writeJSON(w, http.StatusOK, map[string]any{"dependencies": dependencies}) +} + +func (a *api) workflowDependents(w http.ResponseWriter, r *http.Request) { + dependents, err := headgateworkflow.WorkflowDependents(r.Context(), a.store, r.PathValue("id"), r.PathValue("node")) + if err != nil { + workflowErr(w, err) + return + } + writeJSON(w, http.StatusOK, map[string]any{"dependents": dependents}) +} + +func (a *api) workflowSignal(w http.ResponseWriter, r *http.Request) { + var body struct { + Signal *string `json:"signal"` + Payload json.RawMessage `json:"payload"` + Source json.RawMessage `json:"source"` + } + raw, ok := decodeJSON(w, r, &body) + if !ok || !requireFields(w, raw, "signal") { + return + } + receipt, err := headgateworkflow.EmitSignalWith(r.Context(), a.store, r.PathValue("id"), headgateworkflow.SignalEmission{ + Signal: *body.Signal, IdempotencyKey: r.Header.Get("Idempotency-Key"), Payload: body.Payload, Source: body.Source, + }) + if err != nil { + workflowErr(w, err) + return + } + writeJSON(w, http.StatusOK, receipt) +} + +func (a *api) workflowSignals(w http.ResponseWriter, r *http.Request) { + limit, ok := queryUint32(w, r, "limit", 100) + if !ok { + return + } + before, ok := queryUint64(w, r, "cursor", 0) + if !ok { + return + } + signals, err := headgateworkflow.ListSignals(r.Context(), a.store, r.PathValue("id"), before, limit) + if err != nil { + workflowErr(w, err) + return + } + var next any + if len(signals) == int(limit) { + next = signals[len(signals)-1].ID + } + writeJSON(w, http.StatusOK, map[string]any{"signals": signals, "next_cursor": next}) +} + +func (a *api) workflowRetry(w http.ResponseWriter, r *http.Request) { + var body struct { + ExpectedRevision *uint64 `json:"expected_revision"` + Recoveries []struct { + Node string `json:"node"` + Payload *string `json:"payload"` + SchemaVersion uint32 `json:"schema_version"` + ReleaseQuarantine bool `json:"release_quarantine"` + } `json:"recoveries"` + } + raw, ok := decodeJSON(w, r, &body) + if !ok || !requireFields(w, raw, "expected_revision") { + return + } + recoveries := make([]headgateworkflow.WorkflowRecovery, 0, len(body.Recoveries)) + for _, recovery := range body.Recoveries { + var payload []byte + if recovery.Payload != nil { + var err error + payload, err = base64.StdEncoding.DecodeString(*recovery.Payload) + if err != nil { + errJSON(w, http.StatusBadRequest, "recovery payload must be base64") + return + } + } + recoveries = append(recoveries, headgateworkflow.WorkflowRecovery{ + Node: recovery.Node, Payload: payload, SchemaVersion: recovery.SchemaVersion, + ReleaseQuarantine: recovery.ReleaseQuarantine, + }) + } + receipt, err := headgateworkflow.RequestFailedSubgraphRetryWithRecovery( + r.Context(), a.store, r.PathValue("id"), *body.ExpectedRevision, recoveries, + ) + if err != nil { + workflowErr(w, err) + return + } + writeJSON(w, http.StatusOK, map[string]any{"revision": receipt.Revision, "generation": receipt.Generation}) +} + +func (a *api) workflowCancel(w http.ResponseWriter, r *http.Request) { + var body struct { + PropagateChildren *bool `json:"propagate_children"` + } + if _, ok := decodeJSON(w, r, &body); !ok { + return + } + propagate := true + if body.PropagateChildren != nil { + propagate = *body.PropagateChildren + } + receipt, err := headgateworkflow.CancelWorkflow(r.Context(), a.store, r.PathValue("id"), propagate) + if err != nil { + workflowErr(w, err) + return + } + writeJSON(w, http.StatusOK, receipt) +} + +type workflowGraftBody struct { + ExpectedRevision *uint64 `json:"expected_revision"` + Queue string `json:"queue"` + Tasks []workflowGraftTask `json:"tasks"` +} + +type workflowGraftTask struct { + Name string `json:"name"` + Deps []string `json:"deps"` + Kind string `json:"kind"` + Payload string `json:"payload"` + ID string `json:"id"` + Queue string `json:"queue"` + SchemaVersion uint32 `json:"schema_version"` +} + +func (a *api) workflowGraft(w http.ResponseWriter, r *http.Request) { + var body workflowGraftBody + raw, ok := decodeJSON(w, r, &body) + if !ok || !requireFields(w, raw, "expected_revision", "tasks") { + return + } + graft := headgateworkflow.NewGraft(r.PathValue("id"), *body.ExpectedRevision) + if body.Queue != "" { + graft.Queue(body.Queue) + } + for _, task := range body.Tasks { + payload, err := base64.StdEncoding.DecodeString(task.Payload) + if err != nil { + errJSON(w, http.StatusBadRequest, "payload must be base64") + return + } + version := task.SchemaVersion + if version == 0 { + version = 1 + } + graft.Add(task.Name, headgate.Envelope{ + ID: task.ID, Kind: task.Kind, Payload: payload, Queue: task.Queue, + SchemaVersion: version, Fingerprint: headgate.Fingerprint(task.Kind, payload), + }, task.Deps...) + } + batch, err := graft.Prepare() + if err != nil { + workflowErr(w, err) + return + } + if err := a.producer.EnqueueWithSource(r.Context(), headgate.EnqueueSourceHTTP, batch); err != nil { + enqueueClientErr(w, err) + return + } + writeJSON(w, http.StatusAccepted, map[string]any{"receipt_id": batch[0].ID}) +} + // routeParity makes an unrouted path or a wrong method answer the way axum's Router // does, and runs the Idempotency-Key check only AFTER a route has matched. // diff --git a/go/headgateapi/api_test.go b/go/headgateapi/api_test.go index e3a3702..22eb8a2 100644 --- a/go/headgateapi/api_test.go +++ b/go/headgateapi/api_test.go @@ -50,6 +50,93 @@ type outputAPIStore struct { type queuePageStore struct{ errStore } +type workflowAPIStore struct{ errStore } + +type workflowSignalAPIStore struct { + workflowAPIStore + events []headgate.DurableEvent +} + +func (s *workflowSignalAPIStore) GetJob(_ context.Context, id string, includePayload bool) (*headgate.JobSummary, error) { + jobs := map[string]headgate.JobSummary{ + "wf:coordinator": {ID: "wf:coordinator", Kind: "headgate:workflow", State: "running"}, + "wf:approval": {ID: "wf:approval", Kind: "headgate:workflow-signal", State: "pending"}, + } + job, ok := jobs[id] + if !ok { + return nil, nil + } + if includePayload && id == "wf:coordinator" { + job.Payload = []byte(`{"workflow_id":"wf","nodes":[{"name":"approval","job_id":"wf:approval","deps":[],"kind":"signal","signal":"approved"}]}`) + } + return &job, nil +} + +func (s *workflowSignalAPIStore) PromoteJob(context.Context, string) error { return nil } + +func (s *workflowSignalAPIStore) AppendDurableEvent(_ context.Context, event headgate.DurableEvent) (headgate.DurableEvent, bool, error) { + for _, existing := range s.events { + if existing.IdempotencyKey == event.IdempotencyKey { + if existing.Topic != event.Topic || string(existing.Payload) != string(event.Payload) || string(existing.Source) != string(event.Source) { + return headgate.DurableEvent{}, false, headgate.Invalidf("durable event idempotency key was reused with different content") + } + return existing, false, nil + } + } + event.EventID = uint64(len(s.events) + 1) + event.RecordedAtMs = int64(event.EventID) + s.events = append([]headgate.DurableEvent{event}, s.events...) + return event, true, nil +} + +func (s *workflowSignalAPIStore) ListDurableEvents(_ context.Context, _ string, before uint64, limit uint32) ([]headgate.DurableEvent, error) { + out := make([]headgate.DurableEvent, 0, limit) + for _, event := range s.events { + if before == 0 || event.EventID < before { + out = append(out, event) + if len(out) == int(limit) { + break + } + } + } + return out, nil +} + +func (s *workflowAPIStore) GetJob(_ context.Context, id string, includePayload bool) (*headgate.JobSummary, error) { + jobs := map[string]headgate.JobSummary{ + "wf:coordinator": {ID: "wf:coordinator", Kind: "headgate:workflow", State: "running"}, + "wf:prepare": {ID: "wf:prepare", Kind: "task:prepare", State: "completed"}, + "wf:publish": {ID: "wf:publish", Kind: "task:publish", State: "pending"}, + } + job, ok := jobs[id] + if !ok { + return nil, nil + } + if includePayload && id == "wf:coordinator" { + job.Payload = []byte(`{"workflow_id":"wf","nodes":[{"name":"prepare","job_id":"wf:prepare","deps":[],"kind":"task"},{"name":"publish","job_id":"wf:publish","deps":["prepare"],"kind":"task"}]}`) + } + return &job, nil +} + +func (s *workflowAPIStore) GetJobCheckpoint(_ context.Context, id string) (*headgate.Checkpoint, error) { + if id != "wf:coordinator" { + return nil, nil + } + return &headgate.Checkpoint{ + CursorStep: "headgate:workflow-state", + Cursor: []byte(`{"revision":2,"generation":1,"completed":["prepare"],"completed_at_ms":{"prepare":42}}`), + }, nil +} + +func (s *workflowAPIStore) ListJobs(_ context.Context, filter headgate.JobFilter, _ string, _ uint32) (headgate.JobPage, error) { + if filter.Kind == nil || *filter.Kind != "headgate:workflow" { + return headgate.JobPage{}, errors.New("workflow list did not use the coordinator kind") + } + return headgate.JobPage{Jobs: []headgate.JobSummary{{ + ID: "wf:coordinator", Kind: "headgate:workflow", State: "running", + }}}, nil +} + func (s *queuePageStore) QueueStats(context.Context) ([]headgate.QueueStatsView, error) { stats := make([]headgate.QueueStatsView, 205) for i := range stats { @@ -706,6 +793,127 @@ func TestRouteParity(t *testing.T) { } } +func TestWorkflowMutationRoutesRequireIdempotencyKey(t *testing.T) { + h := Handler(&errStore{err: errors.New("unused")}) + for _, path := range []string{ + "/api/v1/workflows/wf/signals", + "/api/v1/workflows/wf/grafts", + "/api/v1/workflows/wf/retry", + "/api/v1/workflows/wf/cancel", + } { + w := httptest.NewRecorder() + r := httptest.NewRequest(http.MethodPost, path, strings.NewReader(`{}`)) + r.Header.Set("Content-Type", "application/json") + h.ServeHTTP(w, r) + if w.Code != http.StatusBadRequest || !strings.Contains(w.Body.String(), "Idempotency-Key") { + t.Fatalf("POST %s without key = %d %s", path, w.Code, w.Body.String()) + } + } +} + +func TestWorkflowSignalRoutePersistsPayloadSourceAndReplay(t *testing.T) { + store := &workflowSignalAPIStore{} + h := Handler(store) + body := `{"signal":"approved","payload":{"approved":true,"reviewer":"Ada"},"source":{"emitter":"admin-console","actor":"operator-42"}}` + + post := func() map[string]any { + w := httptest.NewRecorder() + r := httptest.NewRequest(http.MethodPost, "/api/v1/workflows/wf/signals", strings.NewReader(body)) + r.Header.Set("Content-Type", "application/json") + r.Header.Set("Idempotency-Key", "workflow-signal-1") + h.ServeHTTP(w, r) + if w.Code != http.StatusOK { + t.Fatalf("POST signal = %d %s", w.Code, w.Body.String()) + } + var response map[string]any + if err := json.Unmarshal(w.Body.Bytes(), &response); err != nil { + t.Fatal(err) + } + return response + } + + first := post() + if first["inserted"] != true { + t.Fatalf("first signal receipt = %#v", first) + } + emission := first["emission"].(map[string]any) + if emission["idempotency_key"] != "workflow-signal-1" || emission["payload"].(map[string]any)["reviewer"] != "Ada" || emission["source"].(map[string]any)["actor"] != "operator-42" { + t.Fatalf("signal emission = %#v", emission) + } + + replay := post() + if replay["inserted"] != false || !reflect.DeepEqual(replay["emission"], first["emission"]) { + t.Fatalf("signal replay = %#v", replay) + } + + w := httptest.NewRecorder() + h.ServeHTTP(w, httptest.NewRequest(http.MethodGet, "/api/v1/workflows/wf/signals?limit=100", nil)) + if w.Code != http.StatusOK { + t.Fatalf("GET signal history = %d %s", w.Code, w.Body.String()) + } + var history map[string]any + if err := json.Unmarshal(w.Body.Bytes(), &history); err != nil { + t.Fatal(err) + } + signals := history["signals"].([]any) + if len(signals) != 1 || !reflect.DeepEqual(signals[0], first["emission"]) { + t.Fatalf("signal history = %#v", history) + } +} + +func TestWorkflowInspectionRoutesAreReadOnlyAndBoundedToKnownNodes(t *testing.T) { + h := Handler(&errStore{}) + for _, path := range []string{ + "/api/v1/workflows/missing", + "/api/v1/workflows/missing/nodes/task", + "/api/v1/workflows/missing/nodes/task/dependencies", + "/api/v1/workflows/missing/nodes/task/dependents", + } { + w := httptest.NewRecorder() + h.ServeHTTP(w, httptest.NewRequest(http.MethodGet, path, nil)) + if w.Code != http.StatusNotFound { + t.Fatalf("GET %s = %d %s, want 404", path, w.Code, w.Body.String()) + } + } +} + +func TestWorkflowInspectionRoutesReturnTopologyWithoutPayloads(t *testing.T) { + h := Handler(&workflowAPIStore{}) + for _, test := range []struct { + path, field, name string + }{ + {"/api/v1/workflows", "workflows", "wf"}, + {"/api/v1/workflows/wf", "nodes", "prepare"}, + {"/api/v1/workflows/wf/nodes/publish", "", "publish"}, + {"/api/v1/workflows/wf/nodes/publish/dependencies", "dependencies", "prepare"}, + {"/api/v1/workflows/wf/nodes/prepare/dependents", "dependents", "publish"}, + } { + w := httptest.NewRecorder() + h.ServeHTTP(w, httptest.NewRequest(http.MethodGet, test.path, nil)) + if w.Code != http.StatusOK || strings.Contains(w.Body.String(), "Payload") { + t.Fatalf("GET %s = %d %s", test.path, w.Code, w.Body.String()) + } + var body map[string]any + if err := json.Unmarshal(w.Body.Bytes(), &body); err != nil { + t.Fatal(err) + } + if test.field == "" { + if body["name"] != test.name { + t.Fatalf("GET %s name = %#v", test.path, body["name"]) + } + continue + } + items, ok := body[test.field].([]any) + itemKey := "name" + if test.field == "workflows" { + itemKey = "workflow_id" + } + if !ok || len(items) == 0 || items[0].(map[string]any)[itemKey] != test.name { + t.Fatalf("GET %s %s = %#v", test.path, test.field, body[test.field]) + } + } +} + // TestRequiredFieldsRejected is the teeth on the tier-1 data-corruption fixes. Each of // these bodies used to reach the store and mutate a job. func TestRequiredFieldsRejected(t *testing.T) { diff --git a/go/headgateapi/go.mod b/go/headgateapi/go.mod index 64ed3c5..8e19947 100644 --- a/go/headgateapi/go.mod +++ b/go/headgateapi/go.mod @@ -4,8 +4,12 @@ go 1.25.0 require github.com/mujhtech/headgate/go v0.1.7 +require github.com/mujhtech/headgate/go/headgateworkflow v0.1.7 + replace github.com/mujhtech/headgate/go => ../ +replace github.com/mujhtech/headgate/go/headgateworkflow => ../headgateworkflow + require github.com/mujhtech/headgate/go/driver/headgatepgx v0.1.7 require github.com/mujhtech/headgate/go/driver/headgateredis v0.1.7 @@ -15,7 +19,10 @@ require github.com/mujhtech/headgate/go/driver/headgatemysql v0.1.7 require github.com/mujhtech/headgate/go/headgateui v0.1.7 require ( + cel.dev/cel-go v0.32.0 // indirect + cel.dev/expr v0.25.1 // indirect filippo.io/edwards25519 v1.2.0 // indirect + github.com/antlr4-go/antlr/v4 v4.13.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/go-sql-driver/mysql v1.9.3 // indirect @@ -23,9 +30,15 @@ require ( github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/pgx/v5 v5.9.2 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect + github.com/kr/text v0.2.0 // indirect github.com/redis/go-redis/v9 v9.7.3 // indirect - golang.org/x/sync v0.21.0 // indirect - golang.org/x/text v0.39.0 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect + golang.org/x/sync v0.22.0 // indirect + golang.org/x/text v0.40.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 // indirect + google.golang.org/protobuf v1.36.12 // indirect ) replace github.com/mujhtech/headgate/go/driver/headgatepgx => ../driver/headgatepgx diff --git a/go/headgateapi/go.sum b/go/headgateapi/go.sum index b43e5b1..62da5e0 100644 --- a/go/headgateapi/go.sum +++ b/go/headgateapi/go.sum @@ -1,11 +1,18 @@ +cel.dev/cel-go v0.32.0 h1:irvpFKr5EuGPyxeME03ERh0rii1TX+BDAnB9eL3IvNk= +cel.dev/cel-go v0.32.0/go.mod h1:DnVip7tpJSsgZymwfT+m1tnEVy3ivAjSMXPx12YrMkU= +cel.dev/expr v0.25.1 h1:1KrZg61W6TWSxuNZ37Xy49ps13NUovb66QLprthtwi4= +cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= +github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= +github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -13,6 +20,8 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo= github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= @@ -21,20 +30,38 @@ github.com/jackc/pgx/v5 v5.9.2 h1:3ZhOzMWnR4yJ+RW1XImIPsD1aNSz4T4fyP7zlQb56hw= github.com/jackc/pgx/v5 v5.9.2/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/redis/go-redis/v9 v9.7.3 h1:YpPyAayJV+XErNsatSElgRZZVCwXX9QzkKYNvO7x0wM= github.com/redis/go-redis/v9 v9.7.3/go.mod h1:bGUrSggJ9X9GUmZpZNEOQKaANxSGgOEBRltRTZHSvrA= +github.com/rogpeppe/go-internal v1.16.0 h1:O9DK+vNMDVGLr2BeZqmpLeMjiMNkuXfcqntWbZV6S5g= +github.com/rogpeppe/go-internal v1.16.0/go.mod h1:DrUVZyrJU+txYW5/1kwtXQSMFio52ZOxX7yM1VHvnxs= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM= -golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/text v0.39.0 h1:UbZz4pLOvn600D6Oh6GGEI6VAmndrEBLv8/6BEXzyus= -golang.org/x/text v0.39.0/go.mod h1:3UwRclnC2g0TU9x8PZiyfOajCd1zaUNHF9cvqcQZ+ZM= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA= +golang.org/x/exp v0.0.0-20240823005443-9b4947da3948/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= +golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= +google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 h1:YcyjlL1PRr2Q17/I0dPk2JmYS5CDXfcdb2Z3YRioEbw= +google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7/go.mod h1:OCdP9MfskevB/rbYvHTsXTtKC+3bHWajPdoKgjcYkfo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 h1:2035KHhUv+EpyB+hWgJnaWKJOdX1E95w2S8Rr4uWKTs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= +google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/go/headgatecrypto/go.mod b/go/headgatecrypto/go.mod index c10a462..ebd22f5 100644 --- a/go/headgatecrypto/go.mod +++ b/go/headgatecrypto/go.mod @@ -4,7 +4,10 @@ go 1.25.0 require github.com/mujhtech/headgate/go v0.1.7 -require github.com/mujhtech/headgate/go/headgatetest v0.1.7 // indirect +require ( + github.com/mujhtech/headgate/go/headgatetest v0.1.7 // indirect + golang.org/x/text v0.40.0 // indirect +) replace github.com/mujhtech/headgate/go => .. diff --git a/go/headgatecrypto/go.sum b/go/headgatecrypto/go.sum index 55d9045..9ccf788 100644 --- a/go/headgatecrypto/go.sum +++ b/go/headgatecrypto/go.sum @@ -14,5 +14,4 @@ github.com/jackc/pgx/v5 v5.9.2 h1:3ZhOzMWnR4yJ+RW1XImIPsD1aNSz4T4fyP7zlQb56hw= github.com/jackc/pgx/v5 v5.9.2/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= github.com/redis/go-redis/v9 v9.7.3 h1:YpPyAayJV+XErNsatSElgRZZVCwXX9QzkKYNvO7x0wM= github.com/redis/go-redis/v9 v9.7.3/go.mod h1:bGUrSggJ9X9GUmZpZNEOQKaANxSGgOEBRltRTZHSvrA= -golang.org/x/text v0.39.0 h1:UbZz4pLOvn600D6Oh6GGEI6VAmndrEBLv8/6BEXzyus= -golang.org/x/text v0.39.0/go.mod h1:3UwRclnC2g0TU9x8PZiyfOajCd1zaUNHF9cvqcQZ+ZM= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= diff --git a/go/headgatemigrate/go.mod b/go/headgatemigrate/go.mod index 517b90d..df96e19 100644 --- a/go/headgatemigrate/go.mod +++ b/go/headgatemigrate/go.mod @@ -12,7 +12,7 @@ require ( filippo.io/edwards25519 v1.2.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect - golang.org/x/text v0.39.0 // indirect + golang.org/x/text v0.40.0 // indirect ) replace github.com/mujhtech/headgate/go => .. diff --git a/go/headgatemigrate/go.sum b/go/headgatemigrate/go.sum index a4d75fc..581c13b 100644 --- a/go/headgatemigrate/go.sum +++ b/go/headgatemigrate/go.sum @@ -20,10 +20,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM= -golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/text v0.39.0 h1:UbZz4pLOvn600D6Oh6GGEI6VAmndrEBLv8/6BEXzyus= -golang.org/x/text v0.39.0/go.mod h1:3UwRclnC2g0TU9x8PZiyfOajCd1zaUNHF9cvqcQZ+ZM= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/go/headgatemigrate/live_mysql_test.go b/go/headgatemigrate/live_mysql_test.go index d01e6cc..f74e116 100644 --- a/go/headgatemigrate/live_mysql_test.go +++ b/go/headgatemigrate/live_mysql_test.go @@ -78,19 +78,19 @@ SELECT count(*) FROM information_schema.schemata WHERE schema_name = ?`, databas } result, err := MigrateMySQL(ctx, db, Up, Options{}) - if err != nil || len(result.Steps) != 12 || result.Steps[0].Migration.Version != 1 || result.Steps[11].Migration.Version != 12 { + if err != nil || len(result.Steps) != 13 || result.Steps[0].Migration.Version != 1 || result.Steps[12].Migration.Version != 13 { t.Fatalf("fresh up = %#v, %v", result, err) } validation, err := ValidateMySQL(ctx, db) - if err != nil || !validation.OK() || validation.CurrentVersion != 12 { + if err != nil || !validation.OK() || validation.CurrentVersion != 13 { t.Fatalf("fresh validation = %#v, %v", validation, err) } dry, err := MigrateMySQL(ctx, db, Down, Options{DryRun: true}) - if err != nil || !dry.DryRun || len(dry.Steps) != 12 { + if err != nil || !dry.DryRun || len(dry.Steps) != 13 { t.Fatalf("down dry-run = %#v, %v", dry, err) } downResult, err := MigrateMySQL(ctx, db, Down, Options{}) - if err != nil || len(downResult.Steps) != 12 { + if err != nil || len(downResult.Steps) != 13 { t.Fatalf("down = %#v, %v", downResult, err) } var jobExists, historyRows int @@ -125,7 +125,7 @@ UPDATE headgate_schema_migration SET checksum = 'tampered' WHERE version = 1`); t.Fatalf("unversioned up error = %v", err) } adopted, err := AdoptMySQL(ctx, db) - if err != nil || len(adopted) != 12 || adopted[11].Version != 12 { + if err != nil || len(adopted) != 13 || adopted[12].Version != 13 { t.Fatalf("adopted = %#v, %v", adopted, err) } validation, err = ValidateMySQL(ctx, db) @@ -259,7 +259,7 @@ SELECT count(*) FROM information_schema.schemata WHERE schema_name = ?`, databas } select { case migrated := <-done: - if migrated.err != nil || len(migrated.result.Steps) != 12 { + if migrated.err != nil || len(migrated.result.Steps) != 13 { t.Fatalf("configured migration = %#v, %v", migrated.result, migrated.err) } case <-time.After(20 * time.Second): diff --git a/go/headgatemigrate/live_postgres_test.go b/go/headgatemigrate/live_postgres_test.go index 4301d14..5503d69 100644 --- a/go/headgatemigrate/live_postgres_test.go +++ b/go/headgatemigrate/live_postgres_test.go @@ -50,19 +50,19 @@ SELECT count(*) FROM information_schema.schemata WHERE schema_name = $1`, schema } result, err := MigratePostgres(ctx, conn, Up, Options{}) - if err != nil || len(result.Steps) != 12 || result.Steps[0].Migration.Version != 1 || result.Steps[11].Migration.Version != 12 { + if err != nil || len(result.Steps) != 13 || result.Steps[0].Migration.Version != 1 || result.Steps[12].Migration.Version != 13 { t.Fatalf("fresh up = %#v, %v", result, err) } validation, err := ValidatePostgres(ctx, conn) - if err != nil || !validation.OK() || validation.CurrentVersion != 12 { + if err != nil || !validation.OK() || validation.CurrentVersion != 13 { t.Fatalf("fresh validation = %#v, %v", validation, err) } dry, err := MigratePostgres(ctx, conn, Down, Options{DryRun: true}) - if err != nil || !dry.DryRun || len(dry.Steps) != 12 { + if err != nil || !dry.DryRun || len(dry.Steps) != 13 { t.Fatalf("down dry-run = %#v, %v", dry, err) } downResult, err := MigratePostgres(ctx, conn, Down, Options{}) - if err != nil || len(downResult.Steps) != 12 { + if err != nil || len(downResult.Steps) != 13 { t.Fatalf("down = %#v, %v", downResult, err) } var jobExists bool @@ -95,7 +95,7 @@ UPDATE headgate_schema_migration SET checksum = 'tampered' WHERE version = 1`); t.Fatalf("unversioned up error = %v", err) } adopted, err := AdoptPostgres(ctx, conn) - if err != nil || len(adopted) != 12 || adopted[11].Version != 12 { + if err != nil || len(adopted) != 13 || adopted[12].Version != 13 { t.Fatalf("adopted = %#v, %v", adopted, err) } validation, err = ValidatePostgres(ctx, conn) diff --git a/go/headgatemigrate/migrate.go b/go/headgatemigrate/migrate.go index 2995892..3cf315c 100644 --- a/go/headgatemigrate/migrate.go +++ b/go/headgatemigrate/migrate.go @@ -108,6 +108,12 @@ var postgresWorkerControlStateUp string //go:embed migrations/postgres/0012_worker_control_state.down.sql var postgresWorkerControlStateDown string +//go:embed migrations/postgres/0013_durable_events.up.sql +var postgresDurableEventsUp string + +//go:embed migrations/postgres/0013_durable_events.down.sql +var postgresDurableEventsDown string + //go:embed migrations/mysql/0001_init.up.sql var mysqlInitialUp string @@ -180,6 +186,12 @@ var mysqlWorkerControlStateUp string //go:embed migrations/mysql/0012_worker_control_state.down.sql var mysqlWorkerControlStateDown string +//go:embed migrations/mysql/0013_durable_events.up.sql +var mysqlDurableEventsUp string + +//go:embed migrations/mysql/0013_durable_events.down.sql +var mysqlDurableEventsDown string + var byBackend = map[Backend][]Migration{ Postgres: { {Version: 1, Name: "initial_schema", UpSQL: postgresInitialUp, DownSQL: postgresInitialDown, OnlineSafe: false}, @@ -194,6 +206,7 @@ var byBackend = map[Backend][]Migration{ {Version: 10, Name: "sticky_routing", UpSQL: postgresStickyRoutingUp, DownSQL: postgresStickyRoutingDown, OnlineSafe: false}, {Version: 11, Name: "partitioned_archive", UpSQL: postgresPartitionedArchiveUp, DownSQL: postgresPartitionedArchiveDown, OnlineSafe: true}, {Version: 12, Name: "worker_control_state", UpSQL: postgresWorkerControlStateUp, DownSQL: postgresWorkerControlStateDown, OnlineSafe: true}, + {Version: 13, Name: "durable_events", UpSQL: postgresDurableEventsUp, DownSQL: postgresDurableEventsDown, OnlineSafe: true}, }, MySQL: { {Version: 1, Name: "initial_schema", UpSQL: mysqlInitialUp, DownSQL: mysqlInitialDown, OnlineSafe: false}, @@ -208,6 +221,7 @@ var byBackend = map[Backend][]Migration{ {Version: 10, Name: "sticky_routing", UpSQL: mysqlStickyRoutingUp, DownSQL: mysqlStickyRoutingDown, OnlineSafe: false}, {Version: 11, Name: "partitioned_archive", UpSQL: mysqlPartitionedArchiveUp, DownSQL: mysqlPartitionedArchiveDown, OnlineSafe: false}, {Version: 12, Name: "worker_control_state", UpSQL: mysqlWorkerControlStateUp, DownSQL: mysqlWorkerControlStateDown, OnlineSafe: false}, + {Version: 13, Name: "durable_events", UpSQL: mysqlDurableEventsUp, DownSQL: mysqlDurableEventsDown, OnlineSafe: true}, }, } diff --git a/go/headgatemigrate/migrate_test.go b/go/headgatemigrate/migrate_test.go index 0256ff1..e9af07a 100644 --- a/go/headgatemigrate/migrate_test.go +++ b/go/headgatemigrate/migrate_test.go @@ -13,16 +13,16 @@ func applied(backend Backend, version int) AppliedMigration { func TestPlanUpDownAndCurrentNoop(t *testing.T) { steps, err := Plan(Postgres, nil, Up, Options{}) - if err != nil || len(steps) != 12 || steps[0].Migration.Version != 1 || steps[11].Migration.Version != 12 { + if err != nil || len(steps) != 13 || steps[0].Migration.Version != 1 || steps[12].Migration.Version != 13 { t.Fatalf("up plan = %#v, %v", steps, err) } - current := []AppliedMigration{applied(Postgres, 1), applied(Postgres, 2), applied(Postgres, 3), applied(Postgres, 4), applied(Postgres, 5), applied(Postgres, 6), applied(Postgres, 7), applied(Postgres, 8), applied(Postgres, 9), applied(Postgres, 10), applied(Postgres, 11), applied(Postgres, 12)} + current := []AppliedMigration{applied(Postgres, 1), applied(Postgres, 2), applied(Postgres, 3), applied(Postgres, 4), applied(Postgres, 5), applied(Postgres, 6), applied(Postgres, 7), applied(Postgres, 8), applied(Postgres, 9), applied(Postgres, 10), applied(Postgres, 11), applied(Postgres, 12), applied(Postgres, 13)} steps, err = Plan(Postgres, current, Up, Options{}) if err != nil || len(steps) != 0 { t.Fatalf("current plan = %#v, %v", steps, err) } steps, err = Plan(Postgres, current, Down, Options{}) - if err != nil || len(steps) != 12 || steps[0].Direction != Down || steps[0].Migration.Version != 12 { + if err != nil || len(steps) != 13 || steps[0].Direction != Down || steps[0].Migration.Version != 13 { t.Fatalf("down plan = %#v, %v", steps, err) } } @@ -38,15 +38,15 @@ func TestChecksumAndHistoryGapFailPlanning(t *testing.T) { t.Fatalf("error = %T %v", err, err) } } - future := AppliedMigration{Version: 12, Name: "future", Checksum: "x", AppliedAtMS: 1} + future := AppliedMigration{Version: 13, Name: "future", Checksum: "x", AppliedAtMS: 1} if err := ValidateHistory(Postgres, []AppliedMigration{future}); err == nil { t.Fatal("history gap accepted") } } func TestTargetsAndMaxStepsAreBounded(t *testing.T) { - thirteen := 13 - if _, err := Plan(Postgres, nil, Up, Options{TargetVersion: &thirteen}); err == nil { + fourteen := 14 + if _, err := Plan(Postgres, nil, Up, Options{TargetVersion: &fourteen}); err == nil { t.Fatal("future target accepted") } zero := 0 diff --git a/go/headgatemigrate/migrations/mysql/0013_durable_events.down.sql b/go/headgatemigrate/migrations/mysql/0013_durable_events.down.sql new file mode 100644 index 0000000..106c075 --- /dev/null +++ b/go/headgatemigrate/migrations/mysql/0013_durable_events.down.sql @@ -0,0 +1,2 @@ +DROP TABLE headgate_durable_event; +DROP TABLE headgate_durable_event_scope; diff --git a/go/headgatemigrate/migrations/mysql/0013_durable_events.up.sql b/go/headgatemigrate/migrations/mysql/0013_durable_events.up.sql new file mode 100644 index 0000000..4eceb1d --- /dev/null +++ b/go/headgatemigrate/migrations/mysql/0013_durable_events.up.sql @@ -0,0 +1,17 @@ +CREATE TABLE headgate_durable_event_scope ( + scope VARCHAR(512) NOT NULL PRIMARY KEY +); + +CREATE TABLE headgate_durable_event ( + id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + scope VARCHAR(512) NOT NULL, + topic VARCHAR(255) NOT NULL, + idempotency_key VARCHAR(255) NOT NULL, + payload LONGBLOB NOT NULL, + source LONGBLOB NOT NULL, + recorded_at_ms BIGINT NOT NULL, + UNIQUE KEY headgate_durable_event_idempotency (scope, idempotency_key), + KEY headgate_durable_event_recent (scope, id DESC), + CONSTRAINT headgate_durable_event_scope_fk FOREIGN KEY (scope) + REFERENCES headgate_durable_event_scope(scope) ON DELETE CASCADE +); diff --git a/go/headgatemigrate/migrations/postgres/0013_durable_events.down.sql b/go/headgatemigrate/migrations/postgres/0013_durable_events.down.sql new file mode 100644 index 0000000..106c075 --- /dev/null +++ b/go/headgatemigrate/migrations/postgres/0013_durable_events.down.sql @@ -0,0 +1,2 @@ +DROP TABLE headgate_durable_event; +DROP TABLE headgate_durable_event_scope; diff --git a/go/headgatemigrate/migrations/postgres/0013_durable_events.up.sql b/go/headgatemigrate/migrations/postgres/0013_durable_events.up.sql new file mode 100644 index 0000000..308f8d2 --- /dev/null +++ b/go/headgatemigrate/migrations/postgres/0013_durable_events.up.sql @@ -0,0 +1,17 @@ +CREATE TABLE headgate_durable_event_scope ( + scope text PRIMARY KEY +); + +CREATE TABLE headgate_durable_event ( + id bigserial PRIMARY KEY, + scope text NOT NULL REFERENCES headgate_durable_event_scope(scope) ON DELETE CASCADE, + topic text NOT NULL, + idempotency_key text NOT NULL, + payload bytea NOT NULL, + source bytea NOT NULL, + recorded_at_ms bigint NOT NULL, + UNIQUE (scope, idempotency_key) +); + +CREATE INDEX headgate_durable_event_recent + ON headgate_durable_event (scope, id DESC); diff --git a/go/headgateotel/go.mod b/go/headgateotel/go.mod index 77b1e13..8ca4591 100644 --- a/go/headgateotel/go.mod +++ b/go/headgateotel/go.mod @@ -20,7 +20,10 @@ require ( go.opentelemetry.io/auto/sdk v1.2.1 // indirect ) -require golang.org/x/sys v0.41.0 // indirect +require ( + golang.org/x/sys v0.46.0 // indirect + golang.org/x/text v0.40.0 // indirect +) replace github.com/mujhtech/headgate/go => .. diff --git a/go/headgateotel/go.sum b/go/headgateotel/go.sum index 48258e5..b5c8f76 100644 --- a/go/headgateotel/go.sum +++ b/go/headgateotel/go.sum @@ -43,9 +43,7 @@ go.opentelemetry.io/otel/trace v1.41.0 h1:Vbk2co6bhj8L59ZJ6/xFTskY+tGAbOnCtQGVVa go.opentelemetry.io/otel/trace v1.41.0/go.mod h1:U1NU4ULCoxeDKc09yCWdWe+3QoyweJcISEVa1RBzOis= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= -golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/text v0.39.0 h1:UbZz4pLOvn600D6Oh6GGEI6VAmndrEBLv8/6BEXzyus= -golang.org/x/text v0.39.0/go.mod h1:3UwRclnC2g0TU9x8PZiyfOajCd1zaUNHF9cvqcQZ+ZM= +golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/go/headgatetest/go.mod b/go/headgatetest/go.mod index 57b5fbe..e1498f0 100644 --- a/go/headgatetest/go.mod +++ b/go/headgatetest/go.mod @@ -16,7 +16,7 @@ require ( github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect - golang.org/x/text v0.39.0 // indirect + golang.org/x/text v0.40.0 // indirect ) replace github.com/mujhtech/headgate/go => .. diff --git a/go/headgatetest/go.sum b/go/headgatetest/go.sum index b43e5b1..4563525 100644 --- a/go/headgatetest/go.sum +++ b/go/headgatetest/go.sum @@ -30,10 +30,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM= -golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= -golang.org/x/text v0.39.0 h1:UbZz4pLOvn600D6Oh6GGEI6VAmndrEBLv8/6BEXzyus= -golang.org/x/text v0.39.0/go.mod h1:3UwRclnC2g0TU9x8PZiyfOajCd1zaUNHF9cvqcQZ+ZM= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/go/headgateui/dist/assets/_console-0Rv7Ejka.js b/go/headgateui/dist/assets/_console-0Rv7Ejka.js new file mode 100644 index 0000000..823c550 --- /dev/null +++ b/go/headgateui/dist/assets/_console-0Rv7Ejka.js @@ -0,0 +1 @@ +import{t as e}from"./console-COYwGlau.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console-Cx1B6VV3.js b/go/headgateui/dist/assets/_console-Cx1B6VV3.js deleted file mode 100644 index ce9e812..0000000 --- a/go/headgateui/dist/assets/_console-Cx1B6VV3.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./console-C2t3Lr2f.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.jobs-CcQsOwUN.js b/go/headgateui/dist/assets/_console.jobs-CcQsOwUN.js new file mode 100644 index 0000000..8f36217 --- /dev/null +++ b/go/headgateui/dist/assets/_console.jobs-CcQsOwUN.js @@ -0,0 +1 @@ +import{a as e}from"./with-selector-hO0TNhHE.js";import{Kn as t}from"./theme-CN9-NrCi.js";import{s as n}from"./console-COYwGlau.js";import{o as r}from"./index-D8-0FUBj.js";import{n as i}from"./jobs-DEyFN2Bl.js";var a=e();function o(){let e=r.useSearch();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i,{...n()},`${e.q??``}:${e.queue??``}:${e.state??``}:${e.cursor??``}`),(0,a.jsx)(t,{})]})}export{o as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.jobs-CgmGFIqK.js b/go/headgateui/dist/assets/_console.jobs-CgmGFIqK.js deleted file mode 100644 index 1a723f6..0000000 --- a/go/headgateui/dist/assets/_console.jobs-CgmGFIqK.js +++ /dev/null @@ -1 +0,0 @@ -import{o as e}from"./utils-o8v-URZ_.js";import{Gn as t}from"./theme-6NkSfuJL.js";import{s as n}from"./console-C2t3Lr2f.js";import{o as r}from"./index-B8M4ltzK.js";import{n as i}from"./jobs-CWBl3QlV.js";var a=e();function o(){let e=r.useSearch();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i,{...n()},`${e.q??``}:${e.queue??``}:${e.state??``}:${e.cursor??``}`),(0,a.jsx)(t,{})]})}export{o as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.jobs._jobId-C0SN-qBR.js b/go/headgateui/dist/assets/_console.jobs._jobId-C0SN-qBR.js deleted file mode 100644 index 5c36db6..0000000 --- a/go/headgateui/dist/assets/_console.jobs._jobId-C0SN-qBR.js +++ /dev/null @@ -1 +0,0 @@ -import{o as e}from"./utils-o8v-URZ_.js";import{s as t}from"./console-C2t3Lr2f.js";import{n}from"./index-B8M4ltzK.js";import{t as r}from"./jobs-CWBl3QlV.js";var i=e();function a(){let{jobId:e}=n.useParams(),a=n.useNavigate(),o=t();return(0,i.jsx)(r,{id:e,notify:o.notify,open:!0,setOpen:e=>{e||a({to:`/jobs`,search:e=>e,replace:!0})}})}export{a as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.jobs._jobId-w2X4oppA.js b/go/headgateui/dist/assets/_console.jobs._jobId-w2X4oppA.js new file mode 100644 index 0000000..1fa3b00 --- /dev/null +++ b/go/headgateui/dist/assets/_console.jobs._jobId-w2X4oppA.js @@ -0,0 +1 @@ +import{a as e}from"./with-selector-hO0TNhHE.js";import{s as t}from"./console-COYwGlau.js";import{n}from"./index-D8-0FUBj.js";import{t as r}from"./jobs-DEyFN2Bl.js";var i=e();function a(){let{jobId:e}=n.useParams(),a=n.useNavigate(),o=t();return(0,i.jsx)(r,{id:e,notify:o.notify,open:!0,setOpen:e=>{e||a({to:`/jobs`,search:e=>e,replace:!0})}})}export{a as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.overview-M0AniEMF.js b/go/headgateui/dist/assets/_console.overview-M0AniEMF.js deleted file mode 100644 index 19e2d80..0000000 --- a/go/headgateui/dist/assets/_console.overview-M0AniEMF.js +++ /dev/null @@ -1 +0,0 @@ -import{c as e,d as t,o as n}from"./utils-o8v-URZ_.js";import{Jn as r}from"./theme-6NkSfuJL.js";import{G as i,K as a,U as o,W as s,X as c,Y as l,c as u,d,f,h as p,i as m,l as h,m as g,n as _,p as v,r as y,u as b,w as x}from"./console-C2t3Lr2f.js";import{a as S}from"./index-B8M4ltzK.js";import{$ as C,A as w,At as T,B as E,Bt as D,C as O,Ct as k,D as A,Dt as j,E as ee,Et as M,F as N,Ft as P,G as te,H as F,Ht as I,I as ne,It as L,J as re,K as ie,L as ae,Lt as oe,M as se,Mt as ce,N as le,Nt as R,O as ue,Ot as de,P as fe,Pt as pe,Q as me,R as he,Rt as ge,S as _e,St as ve,T as ye,Tt as be,U as xe,Ut as Se,V as Ce,Vt as we,W as Te,Wt as Ee,X as De,Y as Oe,Z as ke,_ as Ae,_t as je,a as Me,at as Ne,b as Pe,bt as Fe,c as Ie,ct as Le,d as Re,dt as ze,et as Be,f as Ve,ft as He,g as Ue,gt as We,h as Ge,ht as Ke,i as qe,it as Je,j as Ye,jt as Xe,k as Ze,kt as Qe,l as $e,lt as et,m as tt,mt as nt,n as rt,nt as it,o as at,ot,p as st,pt as ct,q as lt,r as ut,rt as dt,s as ft,st as pt,t as mt,tt as ht,u as gt,ut as _t,v as vt,vt as yt,w as bt,wt as xt,x as St,xt as Ct,y as wt,yt as Tt,z,zt as Et}from"./chart-CAYbmpTK.js";import{t as Dt}from"./clock-3-CrAcdu0a.js";import{a as Ot,c as kt,d as At,i as B,l as jt,m as Mt,n as Nt,o as Pt,p as Ft,r as V,s as It,t as Lt,u as Rt}from"./table-BngtkqYs.js";var zt=c(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Bt=c(`circle-gauge`,[[`path`,{d:`M15.6 2.7a10 10 0 1 0 5.7 5.7`,key:`1e0p6d`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M13.4 10.6 19 5`,key:`1kr7tw`}]]),Vt=c(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]);function Ht(e){return e&&typeof e==`object`&&`className`in e&&typeof e.className==`string`?e.className:``}function Ut(e){return(e%180+180)%180}var Wt=function(e){var{width:t,height:n}=e,r=Ut(arguments.length>1&&arguments[1]!==void 0?arguments[1]:0)*Math.PI/180,i=Math.atan(n/t),a=r>i&&re*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function Jt(e,t){return Gt(e,t+1)}function Yt(e,t,n,r,i){for(var a=(r||[]).slice(),{start:o,end:s}=t,c=0,l=1,u=o,d=function(){var t=r?.[c];if(t===void 0)return{v:Gt(r,l)};var a=c,d,f=()=>(d===void 0&&(d=n(t,a)),d),p=t.coordinate,m=c===0||H(e,p,f,u,s);m||(c=0,u=o,l+=1),m&&(u=p+e*(f()/2+i),c+=l)},f;l<=a.length;)if(f=d(),f)return f.v;return[]}function Xt(e,t,n,r,i){var a=(r||[]).slice().length;if(a===0)return[];for(var{start:o,end:s}=t,c=1;c<=a;c++){for(var l=(a-1)%c,u=o,d=!0,f=function(){var t=r[m];if(t==null)return 0;var a=m,o,c=()=>(o===void 0&&(o=n(t,a)),o),f=t.coordinate,p=m===l||H(e,f,c,u,s);if(!p)return d=!1,1;p&&(u=f+e*(c()/2+i))},p,m=l;m(u===void 0&&(u=n(r,t)),u);if(t===o-1){var f=e*(l.coordinate+e*d()/2-c);a[t]=l=U(U({},l),{},{tickCoord:f>0?l.coordinate-f*e:l.coordinate})}else a[t]=l=U(U({},l),{},{tickCoord:l.coordinate});l.tickCoord!=null&&H(e,l.tickCoord,d,s,c)&&(c=l.tickCoord-e*(d()/2+i),a[t]=U(U({},l),{},{isShow:!0}))},u=o-1;u>=0;u--)if(l(u))continue;return a}function nn(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,{start:c,end:l}=t;if(a){var u=r[s-1];if(u!=null){var d=n(u,s-1),f=e*(u.coordinate+e*d/2-l);o[s-1]=u=U(U({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),u.tickCoord!=null&&H(e,u.tickCoord,()=>d,c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=U(U({},u),{},{isShow:!0}))}}for(var p=a?s-1:s,m=function(t){var r=o[t];if(r==null)return 1;var a=r,s,u=()=>(s===void 0&&(s=n(r,t)),s);if(t===0){var d=e*(a.coordinate-e*u()/2-c);o[t]=a=U(U({},a),{},{tickCoord:d<0?a.coordinate-d*e:a.coordinate})}else o[t]=a=U(U({},a),{},{tickCoord:a.coordinate});a.tickCoord!=null&&H(e,a.tickCoord,u,c,l)&&(c=a.tickCoord+e*(u()/2+i),o[t]=U(U({},a),{},{isShow:!0}))},h=0;h{var i=typeof l==`function`?l(e.value,r):e.value;return p===`width`?Kt(N(i,{fontSize:t,letterSpacing:n}),m,d):N(i,{fontSize:t,letterSpacing:n})[p]},g=i[0],_=i[1],v=i.length>=2&&g!=null&&_!=null?oe(_.coordinate-g.coordinate):1,y=qt(a,v,p);return c===`equidistantPreserveStart`?Yt(v,y,h,i,o):c===`equidistantPreserveEnd`?Xt(v,y,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?nn(v,y,h,i,o,c===`preserveStartEnd`):tn(v,y,h,i,o),f.filter(e=>e.isShow))}var an=e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:a=0}=e,o=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>o&&(o=t.width)}});var s=n?n.getBoundingClientRect().width:0,c=i+a,l=o+c+s+(n?r:0);return Math.round(l)}return 0},W=t(e()),on=[`axisLine`,`width`,`height`,`className`,`hide`,`ticks`,`axisType`,`axisId`];function sn(e,t){if(e==null)return{};var n,r,i=cn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{if(r==null||n==null)return ge;var e=t.map(e=>({value:e.value,coordinate:e.coordinate,offset:e.offset,index:e.index}));return i(Ve({ticks:e,axisId:r,axisType:n})),()=>{i(Re({axisId:r,axisType:n}))}},[i,t,r,n]),null}var yn=(0,W.forwardRef)((e,t)=>{var{ticks:n=[],tick:r,tickLine:i,stroke:a,tickFormatter:o,unit:c,padding:l,tickTextProps:u,orientation:d,mirror:f,x:p,y:m,width:h,height:g,tickSize:_,tickMargin:v,fontSize:y,letterSpacing:b,getTicksConfig:x,events:S,axisType:C,axisId:w}=e,T=rn(K(K({},x),{},{ticks:n}),y,b),E=I(x),O=Se(r),k=fe(E.textAnchor)?E.textAnchor:hn(d,f),A=gn(d,f),j={};typeof i==`object`&&(j=i);var ee=K(K({},E),{},{fill:`none`},j),M=T.map(e=>K({entry:e},mn(e,p,m,h,g,d,_,f,v))),N=M.map(e=>{var{entry:t,line:n}=e;return W.createElement(D,{className:`recharts-cartesian-axis-tick`,key:`tick-${t.value}-${t.coordinate}-${t.tickCoord}`},i&&W.createElement(`line`,G({},ee,n,{className:s(`recharts-cartesian-axis-tick-line`,Et(i,`className`))})))}),P=M.map((e,t)=>{var{entry:n,tick:i}=e,s=K(K({},K(K(K(K({verticalAnchor:A},E),{},{textAnchor:k,stroke:`none`,fill:a},i),{},{index:t,payload:n,visibleTicksCount:T.length,tickFormatter:o,padding:l},u),{},{angle:u?.angle??E.angle??0})),O);return W.createElement(D,G({className:`recharts-cartesian-axis-tick-label`,key:`tick-label-${n.value}-${n.coordinate}-${n.tickCoord}`},ce(S,n,t)),r&&W.createElement(_n,{option:r,tickProps:s,value:`${typeof o==`function`?o(n.value,t):n.value}${c||``}`}))});return W.createElement(`g`,{className:`recharts-cartesian-axis-ticks recharts-${C}-ticks`},W.createElement(vn,{ticks:T,axisId:w,axisType:C}),P.length>0&&W.createElement(ae,{zIndex:ht.label},W.createElement(`g`,{className:`recharts-cartesian-axis-tick-labels recharts-${C}-tick-labels`,ref:t},P)),N.length>0&&W.createElement(`g`,{className:`recharts-cartesian-axis-tick-lines recharts-${C}-tick-lines`},N))}),bn=(0,W.forwardRef)((e,t)=>{var{axisLine:n,width:r,height:i,className:a,hide:o,ticks:c,axisType:l,axisId:u}=e,d=sn(e,on),[f,p]=(0,W.useState)(``),[m,h]=(0,W.useState)(``),g=(0,W.useRef)(null);(0,W.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>an({ticks:g.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}));var _=(0,W.useCallback)(e=>{if(e){var t=e.getElementsByClassName(`recharts-cartesian-axis-tick-value`);g.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==f||a!==m)&&(p(i),h(a))}}},[f,m]);return o||r!=null&&r<=0||i!=null&&i<=0?null:W.createElement(ae,{zIndex:e.zIndex},W.createElement(D,{className:s(`recharts-cartesian-axis`,a)},W.createElement(pn,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:I(e)}),W.createElement(yn,{ref:_,axisType:l,events:d,fontSize:f,getTicksConfig:e,height:e.height,letterSpacing:m,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:c,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:u}),W.createElement(w,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},W.createElement(Ye,{label:e.label,labelRef:e.labelRef}),e.children)))}),xn=W.forwardRef((e,t)=>{var n=Xe(e,q);return W.createElement(bn,G({},n,{ref:t}))});xn.displayName=`CartesianAxis`;var Sn=[`x1`,`y1`,`x2`,`y2`,`key`],Cn=[`offset`],wn=[`xAxisId`,`yAxisId`],Tn=[`xAxisId`,`yAxisId`];function En(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;t{var{fill:t}=e;if(!t||t===`none`)return null;var{fillOpacity:n,x:r,y:i,width:a,height:o,ry:s}=e;return W.createElement(`rect`,{x:r,y:i,ry:s,width:a,height:o,stroke:`none`,fill:t,fillOpacity:n,className:`recharts-cartesian-grid-bg`})};function Nn(e){var{option:t,lineItemProps:n}=e,r;if(W.isValidElement(t))r=W.cloneElement(t,n);else if(typeof t==`function`)r=t(n);else{var{x1:i,y1:a,x2:o,y2:s,key:c}=n,l=An(n,Sn),u=I(l)??{},{offset:d}=u,f=An(u,Cn);r=W.createElement(`line`,Y({},f,{x1:i,y1:a,x2:o,y2:s,fill:`none`,key:c}))}return r}function Pn(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=An(e,wn),c=i.map((e,i)=>{var a=J(J({},s),{},{x1:t,y1:e,x2:t+n,y2:e,key:`line-${i}`,index:i});return W.createElement(Nn,{key:`line-${i}`,option:r,lineItemProps:a})});return W.createElement(`g`,{className:`recharts-cartesian-grid-horizontal`},c)}function Fn(e){var{y:t,height:n,vertical:r=!0,verticalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=An(e,Tn),c=i.map((e,i)=>{var a=J(J({},s),{},{x1:e,y1:t,x2:e,y2:t+n,key:`line-${i}`,index:i});return W.createElement(Nn,{option:r,lineItemProps:a,key:`line-${i}`})});return W.createElement(`g`,{className:`recharts-cartesian-grid-vertical`},c)}function In(e){var{horizontalFill:t,fillOpacity:n,x:r,y:i,width:a,height:o,horizontalPoints:s,horizontal:c=!0}=e;if(!c||!t||!t.length||s==null)return null;var l=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==l[0]&&l.unshift(0);var u=l.map((e,s)=>{var c=l[s+1],u=c==null?i+o-e:c-e;if(u<=0)return null;var d=s%t.length;return W.createElement(`rect`,{key:`react-${s}`,y:e,x:r,height:u,width:a,stroke:`none`,fill:t[d],fillOpacity:n,className:`recharts-cartesian-grid-bg`})});return W.createElement(`g`,{className:`recharts-cartesian-gridstripes-horizontal`},u)}function Ln(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:i,y:a,width:o,height:s,verticalPoints:c}=e;if(!t||!n||!n.length)return null;var l=c.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==l[0]&&l.unshift(0);var u=l.map((e,t)=>{var c=l[t+1],u=c==null?i+o-e:c-e;if(u<=0)return null;var d=t%n.length;return W.createElement(`rect`,{key:`react-${t}`,x:e,y:a,width:u,height:s,stroke:`none`,fill:n[d],fillOpacity:r,className:`recharts-cartesian-grid-bg`})});return W.createElement(`g`,{className:`recharts-cartesian-gridstripes-vertical`},u)}var Rn=(e,t)=>{var{xAxis:n,width:r,height:i,offset:a}=e;return Fe(rn(J(J(J({},q),n),{},{ticks:ve(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},zn=(e,t)=>{var{yAxis:n,width:r,height:i,offset:a}=e;return Fe(rn(J(J(J({},q),n),{},{ticks:ve(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},Bn={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:`#ccc`,fill:`none`,verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:ht.grid};function Vn(e){var t=ct(),n=ze(),r=nt(),i=J(J({},Xe(e,Bn)),{},{x:L(e.x)?e.x:r.left,y:L(e.y)?e.y:r.top,width:L(e.width)?e.width:r.width,height:L(e.height)?e.height:r.height}),{xAxisId:a,yAxisId:o,x:s,y:c,width:l,height:u,syncWithTicks:d,horizontalValues:f,verticalValues:p}=i,m=We(),h=T(e=>Ce(e,`xAxis`,a,m)),g=T(e=>Ce(e,`yAxis`,o,m));if(!M(l)||!M(u)||!L(s)||!L(c))return null;var _=i.verticalCoordinatesGenerator||Rn,v=i.horizontalCoordinatesGenerator||zn,{horizontalPoints:y,verticalPoints:b}=i;if((!y||!y.length)&&typeof v==`function`){var x=f&&f.length,S=v({yAxis:g?J(J({},g),{},{ticks:x?f:g.ticks}):void 0,width:t??l,height:n??u,offset:r},x?!0:d);Ke(Array.isArray(S),`horizontalCoordinatesGenerator should return Array but instead it returned [${typeof S}]`),Array.isArray(S)&&(y=S)}if((!b||!b.length)&&typeof _==`function`){var C=p&&p.length,w=_({xAxis:h?J(J({},h),{},{ticks:C?p:h.ticks}):void 0,width:t??l,height:n??u,offset:r},C?!0:d);Ke(Array.isArray(w),`verticalCoordinatesGenerator should return Array but instead it returned [${typeof w}]`),Array.isArray(w)&&(b=w)}return W.createElement(ae,{zIndex:i.zIndex},W.createElement(`g`,{className:`recharts-cartesian-grid`},W.createElement(Mn,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),W.createElement(In,Y({},i,{horizontalPoints:y})),W.createElement(Ln,Y({},i,{verticalPoints:b})),W.createElement(Pn,Y({},i,{offset:r,horizontalPoints:y,xAxis:h,yAxis:g})),W.createElement(Fn,Y({},i,{offset:r,verticalPoints:b,xAxis:h,yAxis:g}))))}Vn.displayName=`CartesianGrid`;function Hn(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function Un(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var Wn=(e,t,n)=>F(e,`xAxis`,Hn(e,t),n),Gn=(e,t,n)=>te(e,`xAxis`,Hn(e,t),n),Kn=(e,t,n)=>F(e,`yAxis`,Un(e,t),n),qn=(e,t,n)=>te(e,`yAxis`,Un(e,t),n),Jn=de([et,Wn,Kn,Gn,qn],(e,t,n,r,i)=>be(e,`xAxis`)?yt(t,r,!1):yt(n,i,!1)),Yn=de([ie,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`area`).find(e=>e.id===t)),Xn=e=>{var t=et(e);return be(t,`xAxis`)?`yAxis`:`xAxis`},Zn=(e,t)=>Xn(e)===`yAxis`?Un(e,t):Hn(e,t),Qn=de([Yn,(e,t,n)=>xe(e,Xn(e),Zn(e,t),n)],(e,t)=>{if(e!=null&&t!=null){var{stackId:n}=e,r=C(e);if(n!=null&&r!=null){var i=(t[n]?.stackedData)?.find(e=>e.key===r);if(i!=null)return i.map(e=>[e[0],e[1]])}}}),$n=de([et,Wn,Kn,Gn,qn,Qn,dt,Jn,Yn,it],(e,t,n,r,i,a,o,s,c,l)=>{var{chartData:u,dataStartIndex:d,dataEndIndex:f}=o;if(!(c==null||e!==`horizontal`&&e!==`vertical`||t==null||n==null||r==null||i==null||r.length===0||i.length===0||s==null)){var{data:p}=c,m=p&&p.length>0?p:u?.slice(d,f+1);if(m!=null)return Cr({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:d,areaSettings:c,stackedData:a,displayedData:m,chartBaseValue:l,bandSize:s})}}),er=[`id`],tr=[`activeDot`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`fill`,`fillOpacity`,`hide`,`isAnimationActive`,`legendType`,`stroke`,`xAxisId`,`yAxisId`];function X(){return X=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:cr(r,i),value:k(n,t),payload:e}]},ur=W.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:c,tooltipType:l,id:u}=e,d={dataDefinedOnItem:n,getPosition:ge,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:k(o,t),hide:s,type:l,color:cr(r,a),unit:c,graphicalItemId:u}};return W.createElement(ee,{tooltipEntrySettings:d})});function dr(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:a,dataKey:o}=r,s=I(r);return W.createElement(_e,{points:n,dot:a,className:`recharts-area-dots`,dotClassName:`recharts-area-dot`,dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function fr(e){var{showLabels:t,children:n,points:r}=e,i=r.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Z(Z({},t),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:t,fill:void 0})});return W.createElement(ue,{value:t?i:void 0},n)}function pr(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:a}=e,{layout:o,type:s,stroke:c,connectNulls:l,isRange:u}=a,{id:d}=a,f=nr(a,er),p=I(f),m=we(f);return W.createElement(W.Fragment,null,t?.length>1&&W.createElement(D,{clipPath:r?`url(#clipPath-${i})`:void 0},W.createElement(ot,X({},m,{id:d,points:t,connectNulls:l,type:s,baseLine:n,layout:o,stroke:`none`,className:`recharts-area-area`})),c!==`none`&&W.createElement(ot,X({},p,{className:`recharts-area-curve`,layout:o,type:s,connectNulls:l,fill:`none`,points:t})),c!==`none`&&u&&Array.isArray(n)&&W.createElement(ot,X({},p,{className:`recharts-area-curve`,layout:o,type:s,connectNulls:l,fill:`none`,points:n}))),W.createElement(dr,{points:t,props:f,clipPathId:i}))}function mr(e){var{alpha:t,baseLine:n,points:r,strokeWidth:i}=e,a=r[0]?.y,o=r[r.length-1]?.y;if(!j(a)||!j(o))return null;var s=t*Math.abs(a-o),c=Math.max(...r.map(e=>e.x||0));return L(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.x||0),c)),L(c)?W.createElement(`rect`,{x:0,y:ae.y||0));return L(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.y||0),c)),L(c)?W.createElement(`rect`,{x:a({points:o,baseLine:s}),[o,s]),h=Je(m,`recharts-area-`),g=_t(),[_,v]=(0,W.useState)(!1),y=!_,b=(0,W.useCallback)(()=>{typeof p==`function`&&p(),v(!1)},[p]),x=(0,W.useCallback)(()=>{typeof f==`function`&&f(),v(!0)},[f]);if(g==null)return null;var S=i.current,C=a.current;return W.createElement(fr,{showLabels:y,points:o},r.children,W.createElement(Ne,{animationId:h,begin:l,duration:u,isActive:c,easing:d,onAnimationEnd:b,onAnimationStart:x,key:h},e=>{if(S){var l=S.length/o.length,u=e===1?o:o.map((t,n)=>{var r=Math.floor(n*l);if(S[r]){var i=S[r];return Z(Z({},t),{},{x:R(i.x,t.x,e),y:R(i.y,t.y,e)})}return t}),d=L(s)?R(C,s,e):P(s)||pe(s)?R(C,0,e):s.map((t,n)=>{var r=Math.floor(n*l);if(Array.isArray(C)&&C[r]){var i=C[r];return Z(Z({},t),{},{x:R(i.x,t.x,e),y:R(i.y,t.y,e)})}return t});return e>0&&(i.current=u,a.current=d),W.createElement(pr,{points:u,baseLine:d,needClip:t,clipPathId:n,props:r})}return e>0&&(i.current=o,a.current=s),W.createElement(D,null,c&&W.createElement(`defs`,null,W.createElement(`clipPath`,{id:`animationClipPath-${n}`},W.createElement(gr,{alpha:e,points:o,baseLine:s,layout:g,strokeWidth:r.strokeWidth}))),W.createElement(D,{clipPath:`url(#animationClipPath-${n})`},W.createElement(pr,{points:o,baseLine:s,needClip:t,clipPathId:n,props:r})))}),W.createElement(Ze,{label:r.label}))}function vr(e){var{needClip:t,clipPathId:n,props:r}=e,i=(0,W.useRef)(null),a=(0,W.useRef)();return W.createElement(_r,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}var yr=class extends W.PureComponent{render(){var{hide:e,dot:t,points:n,className:r,top:i,left:a,needClip:o,xAxisId:c,yAxisId:l,width:u,height:d,id:f,baseLine:p,zIndex:m}=this.props;if(e)return null;var h=s(`recharts-area`,r),g=f,{r:_,strokeWidth:v}=Ie(t),y=A(t),b=_*2+v,x=o?`url(#clipPath-${y?``:`dots-`}${g})`:void 0;return W.createElement(ae,{zIndex:m},W.createElement(D,{className:h},o&&W.createElement(`defs`,null,W.createElement($e,{clipPathId:g,xAxisId:c,yAxisId:l}),!y&&W.createElement(`clipPath`,{id:`clipPath-dots-${g}`},W.createElement(`rect`,{x:a-b/2,y:i-b/2,width:u+b,height:d+b}))),W.createElement(vr,{needClip:o,clipPathId:g,props:this.props})),W.createElement(st,{points:n,mainColor:cr(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:x}),this.props.isRange&&Array.isArray(p)&&W.createElement(st,{points:p,mainColor:cr(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:x}))}},br={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,connectNulls:!1,dot:!1,fill:`#3182bd`,fillOpacity:.6,hide:!1,isAnimationActive:`auto`,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,type:`linear`,label:!1,xAxisId:0,yAxisId:0,zIndex:ht.area};function xr(e){var{activeDot:t,animationBegin:n,animationDuration:r,animationEasing:i,connectNulls:a,dot:o,fill:s,fillOpacity:c,hide:l,isAnimationActive:u,legendType:d,stroke:f,xAxisId:p,yAxisId:m}=e,h=nr(e,tr),g=He(),_=he(),{needClip:v}=gt(p,m),y=We(),{points:b,isRange:x,baseLine:S}=T(t=>$n(t,e.id,y))??{},C=tt();if(g!==`horizontal`&&g!==`vertical`||C==null||_!==`AreaChart`&&_!==`ComposedChart`)return null;var{height:w,width:E,x:D,y:O}=C;return!b||!b.length?null:W.createElement(yr,X({},h,{activeDot:t,animationBegin:n,animationDuration:r,animationEasing:i,baseLine:S,connectNulls:a,dot:o,fill:s,fillOpacity:c,height:w,hide:l,layout:g,isAnimationActive:u,isRange:x,legendType:d,needClip:v,points:b,stroke:f,width:E,left:D,top:O,xAxisId:p,yAxisId:m}))}var Sr=(e,t,n,r,i)=>{var a=n??t;if(L(a))return a;var o=e===`horizontal`?i:r,s=o.scale.domain();if(o.type===`number`){var c=Math.max(s[0],s[1]),l=Math.min(s[0],s[1]);return a===`dataMin`?l:a===`dataMax`||c<0?c:Math.max(Math.min(s[0],s[1]),0)}return a===`dataMin`?s[0]:a===`dataMax`?s[1]:s[0]};function Cr(e){var{areaSettings:{connectNulls:t,baseValue:n,dataKey:r},stackedData:i,layout:a,chartBaseValue:o,xAxis:s,yAxis:c,displayedData:l,dataStartIndex:u,xAxisTicks:d,yAxisTicks:f,bandSize:p}=e,m=i&&i.length,h=Sr(a,o,n,s,c),g=a===`horizontal`,_=!1,v=l.map((e,n)=>{var a;if(m)a=i[u+n];else{var o=xt(e,r);Array.isArray(o)?(a=o,_=!0):a=[h,o]}var l=a?.[1]??null,v=l==null||m&&!t&&xt(e,r)==null;return g?{x:Tt({axis:s,ticks:d,bandSize:p,entry:e,index:n}),y:v?null:c.scale.map(l)??null,value:a,payload:e}:{x:v?null:s.scale.map(l)??null,y:Tt({axis:c,ticks:f,bandSize:p,entry:e,index:n}),value:a,payload:e}});return{points:v,baseLine:(m||_?v.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return g?{x:e.x,y:t!=null&&e.y!=null?c.scale.map(t)??null:null,payload:e.payload}:{x:t==null?null:s.scale.map(t)??null,y:e.y,payload:e.payload}}):g?c.scale.map(h):s.scale.map(h))??0,isRange:_}}function wr(e){var t=Xe(e,br),n=We();return W.createElement(bt,{id:t.id,type:`area`},e=>W.createElement(W.Fragment,null,W.createElement(ye,{legendPayload:lr(t)}),W.createElement(ur,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),W.createElement(O,{type:`area`,id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:Ct(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),W.createElement(xr,X({},t,{id:e}))))}var Tr=W.memo(wr,Le);Tr.displayName=`Area`;var Er=[`domain`,`range`],Dr=[`domain`,`range`];function Or(e,t){if(e==null)return{};var n,r,i=kr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{if(o!=null)return Lr(Lr({},a),{},{type:o})},[a,o]);return(0,W.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(Ge(s)):n.current!==s&&t(wt({prev:n.current,next:s})),n.current=s)},[s,t]),(0,W.useLayoutEffect)(()=>()=>{n.current&&=(t(Ae(n.current)),null)},[t]),null}var Wr=e=>{var{xAxisId:t,className:n}=e,r=T(je),i=We(),a=`xAxis`,o=T(e=>Te(e,a,t,i)),c=T(e=>Oe(e,t)),l=T(e=>lt(e,t)),u=T(e=>re(e,t));if(c==null||l==null||u==null)return null;var{dangerouslySetInnerHTML:d,ticks:f,scale:p}=e,m=Vr(e,Nr),{id:h,scale:g}=u,_=Vr(u,Pr);return W.createElement(xn,Fr({},m,_,{x:l.x,y:l.y,width:c.width,height:c.height,className:s(`recharts-${a} ${a}`,n),viewBox:r,ticks:o,axisType:a,axisId:t}))},Gr={allowDataOverflow:z.allowDataOverflow,allowDecimals:z.allowDecimals,allowDuplicatedCategory:z.allowDuplicatedCategory,angle:z.angle,axisLine:q.axisLine,height:z.height,hide:!1,includeHidden:z.includeHidden,interval:z.interval,label:!1,minTickGap:z.minTickGap,mirror:z.mirror,orientation:z.orientation,padding:z.padding,reversed:z.reversed,scale:z.scale,tick:z.tick,tickCount:z.tickCount,tickLine:q.tickLine,tickSize:q.tickSize,type:z.type,niceTicks:z.niceTicks,xAxisId:0},Kr=W.memo(e=>{var t=Xe(e,Gr);return W.createElement(W.Fragment,null,W.createElement(Ur,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),W.createElement(Wr,t))},jr);Kr.displayName=`XAxis`;var qr=[`type`],Jr=[`dangerouslySetInnerHTML`,`ticks`,`scale`],Yr=[`id`,`scale`];function Xr(){return Xr=Object.assign?Object.assign.bind():function(e){for(var t=1;t{if(o!=null)return Qr(Qr({},a),{},{type:o})},[o,a]);return(0,W.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(Ue(s)):n.current!==s&&t(Pe({prev:n.current,next:s})),n.current=s)},[s,t]),(0,W.useLayoutEffect)(()=>()=>{n.current&&=(t(vt(n.current)),null)},[t]),null}function ai(e){var{yAxisId:t,className:n,width:r,label:i}=e,a=(0,W.useRef)(null),o=(0,W.useRef)(null),c=T(je),l=We(),u=Qe(),d=`yAxis`,f=T(e=>me(e,t)),p=T(e=>De(e,t)),m=T(e=>Te(e,d,t,l)),h=T(e=>ke(e,t));if((0,W.useLayoutEffect)(()=>{if(!(r!==`auto`||!f||se(i)||(0,W.isValidElement)(i)||h==null)){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(f.width)!==Math.round(n)&&u(St({id:t,width:n}))}}},[m,f,u,i,t,r,h]),f==null||p==null||h==null)return null;var{dangerouslySetInnerHTML:g,ticks:_,scale:v}=e,y=ni(e,Jr),{id:b,scale:x}=h,S=ni(h,Yr);return W.createElement(xn,Xr({},y,S,{ref:a,labelRef:o,x:p.x,y:p.y,tickTextProps:r===`auto`?{width:void 0}:{width:r},width:f.width,height:f.height,className:s(`recharts-${d} ${d}`,n),viewBox:c,ticks:m,axisType:d,axisId:t}))}var oi={allowDataOverflow:E.allowDataOverflow,allowDecimals:E.allowDecimals,allowDuplicatedCategory:E.allowDuplicatedCategory,angle:E.angle,axisLine:q.axisLine,hide:!1,includeHidden:E.includeHidden,interval:E.interval,label:!1,minTickGap:E.minTickGap,mirror:E.mirror,orientation:E.orientation,padding:E.padding,reversed:E.reversed,scale:E.scale,tick:E.tick,tickCount:E.tickCount,tickLine:q.tickLine,tickSize:q.tickSize,type:E.type,niceTicks:E.niceTicks,width:E.width,yAxisId:0},si=W.memo(e=>{var t=Xe(e,oi);return W.createElement(W.Fragment,null,W.createElement(ii,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),W.createElement(ai,t))},jr);si.displayName=`YAxis`;var ci=[`axis`],li=(0,W.forwardRef)((e,t)=>W.createElement(at,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:ci,tooltipPayloadSearcher:ne,categoricalChartProps:e,ref:t}));function ui(e,t){return e&&t.some(t=>t.queue===e)?e:t.length?`all`:void 0}function di(e){let t=0,n=0,r=0,i=null,a=null,o=!1,s={};for(let c of e){t+=c.unfinished_jobs,n+=c.arrival_rate,r+=c.drain_rate;for(let[e,t]of Object.entries(c.by_state??{}))s[e]=(s[e]??0)+t;c.oldest_available_ms!=null&&(i?.oldest_available_ms==null||c.oldest_available_ms>i.oldest_available_ms)&&(i=c),!(c.unfinished_jobs<=0)&&(c.time_to_drain_ms==null?((!o||c.unfinished_jobs>(a?.unfinished_jobs??-1))&&(a=c),o=!0):!o&&c.time_to_drain_ms>(a?.time_to_drain_ms??-1)&&(a=c))}return{arrivalRate:n,drainRate:r,infiniteDrain:o,oldest:i,slowestDrain:a,states:s,unfinished:t}}function fi(e){let t={},n=0,r=0,i=0;for(let a of e){n+=a.arrived,r+=a.completed,i+=a.failed??0;for(let[e,n]of Object.entries(a.admission_rejections??{}))t[e]=(t[e]??0)+n}return{arrived:n,completed:r,failed:i,rejections:t}}function pi(e){let t=new Map;for(let n of e)for(let e of n){let n=t.get(e.at_ms)??{admission_rejections:{},arrived:0,at_ms:e.at_ms,completed:0,depth:0,failed:0};n.arrived+=e.arrived,n.completed+=e.completed,n.failed=(n.failed??0)+(e.failed??0),n.depth=(n.depth??0)+(e.depth??0);let r=n.admission_rejections??{};for(let[t,n]of Object.entries(e.admission_rejections??{}))r[t]=(r[t]??0)+n;n.admission_rejections=r,t.set(e.at_ms,n)}return[...t.values()].sort((e,t)=>e.at_ms-t.at_ms)}var Q=n(),mi=[{bucket:6e4,duration:36e5,label:`Last hour`,value:`1h`},{bucket:3e5,duration:216e5,label:`Last 6 hours`,value:`6h`},{bucket:9e5,duration:864e5,label:`Last 24 hours`,value:`24h`},{bucket:72e5,duration:6048e5,label:`Last 7 days`,value:`7d`},{bucket:864e5,duration:2592e6,label:`Last 30 days`,value:`30d`}],$=new Intl.NumberFormat,hi=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}),gi=new Intl.NumberFormat(void 0,{maximumFractionDigits:1,notation:`compact`}),_i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),vi=new Intl.DateTimeFormat(void 0,{day:`numeric`,hour:`numeric`,month:`short`}),yi={arrived:{color:`var(--warning)`,label:`Arrived`},completed:{color:`var(--success)`,label:`Completed`},depth:{color:`var(--primary)`,label:`Queue depth`},failed:{color:`var(--destructive)`,label:`Failed`}};function bi({title:e,value:t,detail:n,icon:i,tone:a=`normal`,to:o,search:s}){return(0,Q.jsx)(r,{className:`group rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,search:s,to:o,children:(0,Q.jsxs)(It,{className:`h-full transition-[border-color,box-shadow,transform] duration-150 group-hover:-translate-y-0.5 group-hover:border-primary/35 group-hover:shadow-sm motion-reduce:transform-none motion-reduce:transition-none`,children:[(0,Q.jsxs)(Rt,{children:[(0,Q.jsx)(`div`,{className:`rounded-lg p-2 ${a===`warning`?`bg-destructive/10 text-destructive`:`bg-primary/10 text-primary`}`,children:(0,Q.jsx)(i,{"aria-hidden":!0,className:`size-4`})}),(0,Q.jsx)(At,{className:`min-w-0 flex-1 text-muted-foreground`,children:e}),(0,Q.jsx)(zt,{"aria-hidden":!0,className:`size-4 text-muted-foreground transition-transform group-hover:translate-x-0.5 motion-reduce:transition-none`})]}),(0,Q.jsxs)(kt,{children:[(0,Q.jsx)(`div`,{className:`font-semibold text-2xl tabular-nums ${a===`warning`?`text-destructive`:``}`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 truncate text-muted-foreground text-xs`,title:n,children:n})]})]})})}function xi({buckets:e,queue:t,range:n}){if(!e.length)return(0,Q.jsx)(_,{children:`No traffic recorded for this queue in the selected range.`});let r=e.map(e=>({...e,depth:e.depth??0,failed:e.failed??0}));return(0,Q.jsxs)(`figure`,{"aria-label":`${t} arrived, completed, failed, and queue depth over ${n}`,children:[(0,Q.jsx)(mt,{className:`aspect-auto h-72 w-full`,config:yi,children:(0,Q.jsxs)(li,{accessibilityLayer:!0,data:r,margin:{bottom:0,left:4,right:4,top:10},children:[(0,Q.jsx)(`defs`,{children:(0,Q.jsxs)(`linearGradient`,{id:`queue-depth-fill`,x1:`0`,x2:`0`,y1:`0`,y2:`1`,children:[(0,Q.jsx)(`stop`,{offset:`5%`,stopColor:`var(--color-depth)`,stopOpacity:.28}),(0,Q.jsx)(`stop`,{offset:`95%`,stopColor:`var(--color-depth)`,stopOpacity:.02})]})}),(0,Q.jsx)(Vn,{strokeDasharray:`3 5`,vertical:!1}),(0,Q.jsx)(Kr,{axisLine:!1,dataKey:`at_ms`,minTickGap:32,tickFormatter:e=>(n===`7d`||n===`30d`?vi:_i).format(new Date(e)),tickLine:!1,tickMargin:10}),(0,Q.jsx)(si,{axisLine:!1,tickFormatter:e=>gi.format(e),tickLine:!1,width:38,yAxisId:`traffic`}),(0,Q.jsx)(si,{axisLine:!1,orientation:`right`,tickFormatter:e=>gi.format(e),tickLine:!1,width:38,yAxisId:`depth`}),(0,Q.jsx)(qe,{content:(0,Q.jsx)(Me,{indicator:`line`,labelFormatter:(e,t)=>{let n=t?.[0]?.payload?.at_ms;return typeof n==`number`?vi.format(new Date(n)):``}}),cursor:{stroke:`var(--border)`,strokeDasharray:`3 4`}}),(0,Q.jsx)(rt,{content:(0,Q.jsx)(ut,{})}),(0,Q.jsx)(Tr,{dataKey:`depth`,fill:`url(#queue-depth-fill)`,stroke:`var(--color-depth)`,strokeWidth:2,type:`monotone`,yAxisId:`depth`}),(0,Q.jsx)(ft,{dataKey:`arrived`,dot:!1,stroke:`var(--color-arrived)`,strokeWidth:2,type:`monotone`,yAxisId:`traffic`}),(0,Q.jsx)(ft,{dataKey:`completed`,dot:!1,stroke:`var(--color-completed)`,strokeWidth:2,type:`monotone`,yAxisId:`traffic`}),(0,Q.jsx)(ft,{dataKey:`failed`,dot:!1,stroke:`var(--color-failed)`,strokeWidth:2,type:`monotone`,yAxisId:`traffic`})]})}),(0,Q.jsx)(`figcaption`,{className:`sr-only`,children:`Traffic uses the left axis. Queue depth uses the right axis. Focus the chart to inspect individual buckets.`})]})}function Si({queue:e,range:t,setSearch:n}){let s=h([`api`,`overview`,`queues`],e=>x(`/queues`,{signal:e})),c=h([`api`,`overview`,`cluster`],e=>x(`/cluster`,{signal:e})),S=Array.isArray(s.data)?s.data:s.data?.queues??[],C=di(S),w=ui(e,S),T=mi.find(e=>e.value===t)??mi[1],E=Date.now()-T.duration,D=w===`all`?S.map(e=>e.queue):w?[w]:[],O=u(D.map(e=>({queryFn:t=>x(`/queues/${encodeURIComponent(e)}/history?since_ms=${E}&bucket_ms=${T.bucket}`,{signal:t}),queryKey:[`api`,`overview`,`history`,e,t]})));if((s.isPending||c.isPending)&&!(s.data&&c.data))return(0,Q.jsx)(m,{});if(s.error)return(0,Q.jsx)(y,{message:s.error instanceof Error?s.error.message:String(s.error)});if(c.error)return(0,Q.jsx)(y,{message:c.error instanceof Error?c.error.message:String(c.error)});let k=c.data??{},A=(k.queues??[]).filter(e=>e.live_workers===0),j=O.find(e=>e.error)?.error,ee=O.some(e=>e.isPending),M=w===`all`?pi(O.map(e=>e.data??[])):O[0]?.data??[],N=fi(M),P=Object.values(N.rejections).reduce((e,t)=>e+t,0),te=[...S].sort((e,t)=>{let n=e.unfinished_jobs>0&&e.time_to_drain_ms==null;return n===(t.unfinished_jobs>0&&t.time_to_drain_ms==null)?(t.time_to_drain_ms??0)-(e.time_to_drain_ms??0)||t.unfinished_jobs-e.unfinished_jobs:n?-1:1}).slice(0,8),{oldest:F,slowestDrain:I}=C;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-end justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-balance font-semibold text-lg`,children:`Overview`}),(0,Q.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Fleet health, queue pressure, and the policies affecting admission.`})]}),(0,Q.jsxs)(o,{className:`tabular-nums`,variant:`outline`,children:[`in `,hi.format(C.arrivalRate),`/s · out`,` `,hi.format(C.drainRate),`/s`]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:[(0,Q.jsx)(bi,{detail:`${$.format(C.states.available)} available · ${$.format(C.states.retryable)} retryable`,icon:Vt,title:`Unfinished Work`,to:`/jobs`,value:$.format(C.unfinished)}),(0,Q.jsx)(bi,{detail:F?`Waiting in ${F.queue}`:`No available jobs are waiting`,icon:Dt,search:F?{queue:F.queue,state:`available`}:void 0,title:`Oldest Available`,to:`/jobs`,tone:F?`warning`:`normal`,value:F?Ft(F.oldest_available_ms):`None`}),(0,Q.jsx)(bi,{detail:I?`${I.queue} · ${$.format(I.unfinished_jobs)} unfinished`:`Every queue is clear`,icon:l,title:`Worst Time to Drain`,to:`/queues`,tone:C.infiniteDrain?`warning`:`normal`,value:I?C.infiniteDrain?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(Ee,{"aria-hidden":!0,className:`size-6`}),` Growing`]}):Ft(I.time_to_drain_ms):`Clear`}),(0,Q.jsx)(bi,{detail:`${$.format(k.inflight_total??0)} of ${$.format(k.capacity_total??0)} slots · ${k.workers?.live??0} live`,icon:Bt,title:`Fleet Utilization`,to:`/workers`,tone:(k.workers?.stale??0)>0?`warning`:`normal`,value:Mt(k.utilization)})]}),(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 xl:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]`,children:[(0,Q.jsxs)(It,{children:[(0,Q.jsxs)(Rt,{className:`flex-wrap`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(At,{children:`Queue Traffic`}),(0,Q.jsx)(jt,{children:`Arrivals, completions, failures, and depth from maintained history buckets.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(b,{onValueChange:e=>e&&n({queue:e}),value:w,children:[(0,Q.jsx)(g,{"aria-label":`Queue shown in traffic chart`,className:`w-44`,children:(0,Q.jsx)(p,{placeholder:`Choose queue…`})}),(0,Q.jsx)(d,{children:(0,Q.jsxs)(f,{children:[(0,Q.jsx)(v,{value:`all`,children:`All queues`}),S.map(e=>(0,Q.jsx)(v,{value:e.queue,children:(0,Q.jsx)(`span`,{translate:`no`,children:e.queue})},e.queue))]})})]}),(0,Q.jsxs)(b,{onValueChange:e=>e&&n({range:e}),value:t,children:[(0,Q.jsx)(g,{"aria-label":`Traffic chart time range`,className:`w-36`,children:(0,Q.jsx)(p,{})}),(0,Q.jsx)(d,{children:(0,Q.jsx)(f,{children:mi.map(e=>(0,Q.jsx)(v,{value:e.value,children:e.label},e.value))})})]})]})]}),(0,Q.jsxs)(kt,{children:[j?(0,Q.jsx)(y,{message:j instanceof Error?j.message:String(j)}):ee?(0,Q.jsx)(m,{}):w?(0,Q.jsx)(xi,{buckets:M,queue:w===`all`?`All queues`:w,range:t}):(0,Q.jsx)(_,{children:`No queue traffic is available.`}),w&&M.length?(0,Q.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 border-t pt-3 text-sm sm:grid-cols-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Arrived`}),(0,Q.jsx)(`p`,{className:`font-medium tabular-nums`,children:$.format(N.arrived)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Completed`}),(0,Q.jsx)(`p`,{className:`font-medium tabular-nums`,children:$.format(N.completed)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Failed`}),(0,Q.jsx)(`p`,{className:N.failed?`font-medium text-destructive tabular-nums`:`font-medium tabular-nums`,children:$.format(N.failed)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Policy Rejections`}),(0,Q.jsx)(`p`,{className:P?`font-medium text-destructive tabular-nums`:`font-medium tabular-nums`,children:$.format(P)})]})]}):null]})]}),(0,Q.jsxs)(It,{children:[(0,Q.jsx)(Rt,{children:(0,Q.jsx)(At,{children:`Attention Needed`})}),(0,Q.jsxs)(kt,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Q.jsx)(a,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 ${A.length?`text-destructive`:`text-success`}`}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`font-medium text-sm`,children:`Worker Coverage`}),(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:A.length?`${A.length} queue${A.length===1?` has`:`s have`} no live worker.`:`Every known queue has a live worker.`}),A.length?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:A.map(e=>(0,Q.jsx)(o,{variant:`destructive`,children:(0,Q.jsx)(`span`,{translate:`no`,children:e.queue})},e.queue))}),(0,Q.jsxs)(r,{className:`mt-2 inline-block text-primary text-xs hover:underline`,to:`/workers`,children:[`Inspect workers `,(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`→`})]})]}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Q.jsx)(i,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 ${P?`text-destructive`:`text-success`}`}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`font-medium text-sm`,children:`Admission Policies`}),(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:P?`${$.format(P)} rejection${P===1?``:`s`} ${w===`all`?`across all queues`:`for ${w}`} in this range.`:`No policy rejections ${w===`all`?`across all queues`:`for ${w??`known queues`}`} in this range.`}),Object.keys(N.rejections).length?(0,Q.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:Object.entries(N.rejections).sort((e,t)=>t[1]-e[1]).map(([e,t])=>(0,Q.jsxs)(o,{variant:`outline`,children:[e,` `,$.format(t)]},e))}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Q.jsx)(Bt,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 ${(k.empty_poll_ratio??0)>.8?`text-warning`:`text-muted-foreground`}`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`font-medium text-sm`,children:`Polling Efficiency`}),(0,Q.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[Mt(k.empty_poll_ratio),` of admissions returned no work.`]})]})]})]})]})]}),(0,Q.jsxs)(It,{className:`mt-4`,children:[(0,Q.jsxs)(Rt,{children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(At,{children:`Queue Pressure`}),(0,Q.jsx)(jt,{children:`Backlogged queues ordered by their ability to catch up.`})]}),(0,Q.jsxs)(r,{className:`text-primary text-sm hover:underline`,to:`/queues`,children:[`All queues `,(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`→`})]})]}),(0,Q.jsx)(kt,{children:te.length?(0,Q.jsxs)(Lt,{children:[(0,Q.jsx)(Ot,{children:(0,Q.jsxs)(Pt,{children:[(0,Q.jsx)(B,{children:`Queue`}),(0,Q.jsx)(B,{children:`Unfinished`}),(0,Q.jsx)(B,{children:`Oldest`}),(0,Q.jsx)(B,{children:`In / Out`}),(0,Q.jsx)(B,{children:`Time to Drain`}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Open jobs`})})]})}),(0,Q.jsx)(Nt,{children:te.map(e=>{let t=e.unfinished_jobs>0&&e.time_to_drain_ms==null;return(0,Q.jsxs)(Pt,{children:[(0,Q.jsxs)(V,{children:[(0,Q.jsx)(`span`,{className:`font-medium`,translate:`no`,children:e.queue}),e.paused?(0,Q.jsx)(o,{className:`ml-2`,variant:`destructive`,children:`paused`}):null]}),(0,Q.jsx)(V,{className:`tabular-nums`,children:$.format(e.unfinished_jobs)}),(0,Q.jsx)(V,{className:`tabular-nums`,children:Ft(e.oldest_available_ms)}),(0,Q.jsxs)(V,{className:`tabular-nums`,children:[hi.format(e.arrival_rate),` /`,` `,hi.format(e.drain_rate)]}),(0,Q.jsx)(V,{className:t?`font-medium text-destructive`:`tabular-nums`,children:t?`Growing`:Ft(e.time_to_drain_ms)}),(0,Q.jsx)(V,{children:(0,Q.jsxs)(r,{className:`text-primary text-sm hover:underline`,search:{queue:e.queue},to:`/jobs`,children:[`Jobs `,(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`→`})]})})]},e.queue)})})]}):(0,Q.jsx)(_,{children:`No queues reported.`})})]})]})}function Ci(){let e=S.useSearch(),t=S.useNavigate();return(0,Q.jsx)(Si,{queue:e.queue,range:e.range??`6h`,setSearch:e=>void t({search:t=>({...t,...e}),replace:!0})})}export{Ci as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.overview-Q11CjhGH.js b/go/headgateui/dist/assets/_console.overview-Q11CjhGH.js new file mode 100644 index 0000000..15e7670 --- /dev/null +++ b/go/headgateui/dist/assets/_console.overview-Q11CjhGH.js @@ -0,0 +1 @@ +import{a as e,s as t,u as n}from"./with-selector-hO0TNhHE.js";import{Yn as r}from"./theme-CN9-NrCi.js";import{C as i,G as a,K as o,T as s,W as c,X as l,Y as u,c as d,d as f,f as p,h as m,i as h,l as g,m as _,n as v,p as y,r as b,u as x}from"./console-COYwGlau.js";import{a as S}from"./index-D8-0FUBj.js";import{$ as C,A as w,At as T,B as E,Bt as D,C as O,Ct as k,D as A,Dt as j,E as ee,Et as M,F as N,Ft as P,G as te,H as F,Ht as I,I as ne,It as L,J as re,K as ie,L as ae,Lt as oe,M as se,Mt as ce,N as le,Nt as R,O as ue,Ot as de,P as fe,Pt as pe,Q as me,R as he,Rt as ge,S as _e,St as ve,T as ye,Tt as be,U as xe,Ut as Se,V as Ce,Vt as we,W as Te,Wt as Ee,X as De,Y as Oe,Z as ke,_ as Ae,_t as je,a as Me,at as Ne,b as Pe,bt as Fe,c as Ie,ct as Le,d as Re,dt as ze,et as Be,f as Ve,ft as He,g as Ue,gt as We,h as Ge,ht as Ke,i as qe,it as Je,j as Ye,jt as Xe,k as Ze,kt as Qe,l as $e,lt as et,m as tt,mt as nt,n as rt,nt as it,o as at,ot,p as st,pt as ct,q as lt,r as ut,rt as dt,s as ft,st as pt,t as mt,tt as ht,u as gt,ut as _t,v as vt,vt as yt,w as bt,wt as xt,x as St,xt as Ct,y as wt,yt as Tt,z,zt as Et}from"./chart-QZj6B7U2.js";import{t as Dt}from"./clock-3-CBdsf5xL.js";import{a as Ot,c as kt,d as At,i as B,l as jt,m as Mt,n as Nt,o as Pt,p as Ft,r as V,s as It,t as Lt,u as Rt}from"./table-DtWJ0yY1.js";var zt=l(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Bt=l(`circle-gauge`,[[`path`,{d:`M15.6 2.7a10 10 0 1 0 5.7 5.7`,key:`1e0p6d`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M13.4 10.6 19 5`,key:`1kr7tw`}]]),Vt=l(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]);function Ht(e){return e&&typeof e==`object`&&`className`in e&&typeof e.className==`string`?e.className:``}function Ut(e){return(e%180+180)%180}var Wt=function(e){var{width:t,height:n}=e,r=Ut(arguments.length>1&&arguments[1]!==void 0?arguments[1]:0)*Math.PI/180,i=Math.atan(n/t),a=r>i&&re*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function Jt(e,t){return Gt(e,t+1)}function Yt(e,t,n,r,i){for(var a=(r||[]).slice(),{start:o,end:s}=t,c=0,l=1,u=o,d=function(){var t=r?.[c];if(t===void 0)return{v:Gt(r,l)};var a=c,d,f=()=>(d===void 0&&(d=n(t,a)),d),p=t.coordinate,m=c===0||H(e,p,f,u,s);m||(c=0,u=o,l+=1),m&&(u=p+e*(f()/2+i),c+=l)},f;l<=a.length;)if(f=d(),f)return f.v;return[]}function Xt(e,t,n,r,i){var a=(r||[]).slice().length;if(a===0)return[];for(var{start:o,end:s}=t,c=1;c<=a;c++){for(var l=(a-1)%c,u=o,d=!0,f=function(){var t=r[m];if(t==null)return 0;var a=m,o,c=()=>(o===void 0&&(o=n(t,a)),o),f=t.coordinate,p=m===l||H(e,f,c,u,s);if(!p)return d=!1,1;p&&(u=f+e*(c()/2+i))},p,m=l;m(u===void 0&&(u=n(r,t)),u);if(t===o-1){var f=e*(l.coordinate+e*d()/2-c);a[t]=l=U(U({},l),{},{tickCoord:f>0?l.coordinate-f*e:l.coordinate})}else a[t]=l=U(U({},l),{},{tickCoord:l.coordinate});l.tickCoord!=null&&H(e,l.tickCoord,d,s,c)&&(c=l.tickCoord-e*(d()/2+i),a[t]=U(U({},l),{},{isShow:!0}))},u=o-1;u>=0;u--)if(l(u))continue;return a}function nn(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,{start:c,end:l}=t;if(a){var u=r[s-1];if(u!=null){var d=n(u,s-1),f=e*(u.coordinate+e*d/2-l);o[s-1]=u=U(U({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),u.tickCoord!=null&&H(e,u.tickCoord,()=>d,c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=U(U({},u),{},{isShow:!0}))}}for(var p=a?s-1:s,m=function(t){var r=o[t];if(r==null)return 1;var a=r,s,u=()=>(s===void 0&&(s=n(r,t)),s);if(t===0){var d=e*(a.coordinate-e*u()/2-c);o[t]=a=U(U({},a),{},{tickCoord:d<0?a.coordinate-d*e:a.coordinate})}else o[t]=a=U(U({},a),{},{tickCoord:a.coordinate});a.tickCoord!=null&&H(e,a.tickCoord,u,c,l)&&(c=a.tickCoord+e*(u()/2+i),o[t]=U(U({},a),{},{isShow:!0}))},h=0;h{var i=typeof l==`function`?l(e.value,r):e.value;return p===`width`?Kt(N(i,{fontSize:t,letterSpacing:n}),m,d):N(i,{fontSize:t,letterSpacing:n})[p]},g=i[0],_=i[1],v=i.length>=2&&g!=null&&_!=null?oe(_.coordinate-g.coordinate):1,y=qt(a,v,p);return c===`equidistantPreserveStart`?Yt(v,y,h,i,o):c===`equidistantPreserveEnd`?Xt(v,y,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?nn(v,y,h,i,o,c===`preserveStartEnd`):tn(v,y,h,i,o),f.filter(e=>e.isShow))}var an=e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:a=0}=e,o=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>o&&(o=t.width)}});var s=n?n.getBoundingClientRect().width:0,c=i+a,l=o+c+s+(n?r:0);return Math.round(l)}return 0},W=n(t()),on=[`axisLine`,`width`,`height`,`className`,`hide`,`ticks`,`axisType`,`axisId`];function sn(e,t){if(e==null)return{};var n,r,i=cn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{if(r==null||n==null)return ge;var e=t.map(e=>({value:e.value,coordinate:e.coordinate,offset:e.offset,index:e.index}));return i(Ve({ticks:e,axisId:r,axisType:n})),()=>{i(Re({axisId:r,axisType:n}))}},[i,t,r,n]),null}var yn=(0,W.forwardRef)((e,t)=>{var{ticks:n=[],tick:r,tickLine:i,stroke:a,tickFormatter:o,unit:s,padding:l,tickTextProps:u,orientation:d,mirror:f,x:p,y:m,width:h,height:g,tickSize:_,tickMargin:v,fontSize:y,letterSpacing:b,getTicksConfig:x,events:S,axisType:C,axisId:w}=e,T=rn(K(K({},x),{},{ticks:n}),y,b),E=I(x),O=Se(r),k=fe(E.textAnchor)?E.textAnchor:hn(d,f),A=gn(d,f),j={};typeof i==`object`&&(j=i);var ee=K(K({},E),{},{fill:`none`},j),M=T.map(e=>K({entry:e},mn(e,p,m,h,g,d,_,f,v))),N=M.map(e=>{var{entry:t,line:n}=e;return W.createElement(D,{className:`recharts-cartesian-axis-tick`,key:`tick-${t.value}-${t.coordinate}-${t.tickCoord}`},i&&W.createElement(`line`,G({},ee,n,{className:c(`recharts-cartesian-axis-tick-line`,Et(i,`className`))})))}),P=M.map((e,t)=>{var{entry:n,tick:i}=e,c=K(K({},K(K(K(K({verticalAnchor:A},E),{},{textAnchor:k,stroke:`none`,fill:a},i),{},{index:t,payload:n,visibleTicksCount:T.length,tickFormatter:o,padding:l},u),{},{angle:u?.angle??E.angle??0})),O);return W.createElement(D,G({className:`recharts-cartesian-axis-tick-label`,key:`tick-label-${n.value}-${n.coordinate}-${n.tickCoord}`},ce(S,n,t)),r&&W.createElement(_n,{option:r,tickProps:c,value:`${typeof o==`function`?o(n.value,t):n.value}${s||``}`}))});return W.createElement(`g`,{className:`recharts-cartesian-axis-ticks recharts-${C}-ticks`},W.createElement(vn,{ticks:T,axisId:w,axisType:C}),P.length>0&&W.createElement(ae,{zIndex:ht.label},W.createElement(`g`,{className:`recharts-cartesian-axis-tick-labels recharts-${C}-tick-labels`,ref:t},P)),N.length>0&&W.createElement(`g`,{className:`recharts-cartesian-axis-tick-lines recharts-${C}-tick-lines`},N))}),bn=(0,W.forwardRef)((e,t)=>{var{axisLine:n,width:r,height:i,className:a,hide:o,ticks:s,axisType:l,axisId:u}=e,d=sn(e,on),[f,p]=(0,W.useState)(``),[m,h]=(0,W.useState)(``),g=(0,W.useRef)(null);(0,W.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>an({ticks:g.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}));var _=(0,W.useCallback)(e=>{if(e){var t=e.getElementsByClassName(`recharts-cartesian-axis-tick-value`);g.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==f||a!==m)&&(p(i),h(a))}}},[f,m]);return o||r!=null&&r<=0||i!=null&&i<=0?null:W.createElement(ae,{zIndex:e.zIndex},W.createElement(D,{className:c(`recharts-cartesian-axis`,a)},W.createElement(pn,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:I(e)}),W.createElement(yn,{ref:_,axisType:l,events:d,fontSize:f,getTicksConfig:e,height:e.height,letterSpacing:m,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:u}),W.createElement(w,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},W.createElement(Ye,{label:e.label,labelRef:e.labelRef}),e.children)))}),xn=W.forwardRef((e,t)=>{var n=Xe(e,q);return W.createElement(bn,G({},n,{ref:t}))});xn.displayName=`CartesianAxis`;var Sn=[`x1`,`y1`,`x2`,`y2`,`key`],Cn=[`offset`],wn=[`xAxisId`,`yAxisId`],Tn=[`xAxisId`,`yAxisId`];function En(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;t{var{fill:t}=e;if(!t||t===`none`)return null;var{fillOpacity:n,x:r,y:i,width:a,height:o,ry:s}=e;return W.createElement(`rect`,{x:r,y:i,ry:s,width:a,height:o,stroke:`none`,fill:t,fillOpacity:n,className:`recharts-cartesian-grid-bg`})};function Nn(e){var{option:t,lineItemProps:n}=e,r;if(W.isValidElement(t))r=W.cloneElement(t,n);else if(typeof t==`function`)r=t(n);else{var{x1:i,y1:a,x2:o,y2:s,key:c}=n,l=An(n,Sn),u=I(l)??{},{offset:d}=u,f=An(u,Cn);r=W.createElement(`line`,Y({},f,{x1:i,y1:a,x2:o,y2:s,fill:`none`,key:c}))}return r}function Pn(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=An(e,wn),c=i.map((e,i)=>{var a=J(J({},s),{},{x1:t,y1:e,x2:t+n,y2:e,key:`line-${i}`,index:i});return W.createElement(Nn,{key:`line-${i}`,option:r,lineItemProps:a})});return W.createElement(`g`,{className:`recharts-cartesian-grid-horizontal`},c)}function Fn(e){var{y:t,height:n,vertical:r=!0,verticalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=An(e,Tn),c=i.map((e,i)=>{var a=J(J({},s),{},{x1:e,y1:t,x2:e,y2:t+n,key:`line-${i}`,index:i});return W.createElement(Nn,{option:r,lineItemProps:a,key:`line-${i}`})});return W.createElement(`g`,{className:`recharts-cartesian-grid-vertical`},c)}function In(e){var{horizontalFill:t,fillOpacity:n,x:r,y:i,width:a,height:o,horizontalPoints:s,horizontal:c=!0}=e;if(!c||!t||!t.length||s==null)return null;var l=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==l[0]&&l.unshift(0);var u=l.map((e,s)=>{var c=l[s+1],u=c==null?i+o-e:c-e;if(u<=0)return null;var d=s%t.length;return W.createElement(`rect`,{key:`react-${s}`,y:e,x:r,height:u,width:a,stroke:`none`,fill:t[d],fillOpacity:n,className:`recharts-cartesian-grid-bg`})});return W.createElement(`g`,{className:`recharts-cartesian-gridstripes-horizontal`},u)}function Ln(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:i,y:a,width:o,height:s,verticalPoints:c}=e;if(!t||!n||!n.length)return null;var l=c.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==l[0]&&l.unshift(0);var u=l.map((e,t)=>{var c=l[t+1],u=c==null?i+o-e:c-e;if(u<=0)return null;var d=t%n.length;return W.createElement(`rect`,{key:`react-${t}`,x:e,y:a,width:u,height:s,stroke:`none`,fill:n[d],fillOpacity:r,className:`recharts-cartesian-grid-bg`})});return W.createElement(`g`,{className:`recharts-cartesian-gridstripes-vertical`},u)}var Rn=(e,t)=>{var{xAxis:n,width:r,height:i,offset:a}=e;return Fe(rn(J(J(J({},q),n),{},{ticks:ve(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},zn=(e,t)=>{var{yAxis:n,width:r,height:i,offset:a}=e;return Fe(rn(J(J(J({},q),n),{},{ticks:ve(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},Bn={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:`#ccc`,fill:`none`,verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:ht.grid};function Vn(e){var t=ct(),n=ze(),r=nt(),i=J(J({},Xe(e,Bn)),{},{x:L(e.x)?e.x:r.left,y:L(e.y)?e.y:r.top,width:L(e.width)?e.width:r.width,height:L(e.height)?e.height:r.height}),{xAxisId:a,yAxisId:o,x:s,y:c,width:l,height:u,syncWithTicks:d,horizontalValues:f,verticalValues:p}=i,m=We(),h=T(e=>Ce(e,`xAxis`,a,m)),g=T(e=>Ce(e,`yAxis`,o,m));if(!M(l)||!M(u)||!L(s)||!L(c))return null;var _=i.verticalCoordinatesGenerator||Rn,v=i.horizontalCoordinatesGenerator||zn,{horizontalPoints:y,verticalPoints:b}=i;if((!y||!y.length)&&typeof v==`function`){var x=f&&f.length,S=v({yAxis:g?J(J({},g),{},{ticks:x?f:g.ticks}):void 0,width:t??l,height:n??u,offset:r},x?!0:d);Ke(Array.isArray(S),`horizontalCoordinatesGenerator should return Array but instead it returned [${typeof S}]`),Array.isArray(S)&&(y=S)}if((!b||!b.length)&&typeof _==`function`){var C=p&&p.length,w=_({xAxis:h?J(J({},h),{},{ticks:C?p:h.ticks}):void 0,width:t??l,height:n??u,offset:r},C?!0:d);Ke(Array.isArray(w),`verticalCoordinatesGenerator should return Array but instead it returned [${typeof w}]`),Array.isArray(w)&&(b=w)}return W.createElement(ae,{zIndex:i.zIndex},W.createElement(`g`,{className:`recharts-cartesian-grid`},W.createElement(Mn,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),W.createElement(In,Y({},i,{horizontalPoints:y})),W.createElement(Ln,Y({},i,{verticalPoints:b})),W.createElement(Pn,Y({},i,{offset:r,horizontalPoints:y,xAxis:h,yAxis:g})),W.createElement(Fn,Y({},i,{offset:r,verticalPoints:b,xAxis:h,yAxis:g}))))}Vn.displayName=`CartesianGrid`;function Hn(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function Un(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var Wn=(e,t,n)=>F(e,`xAxis`,Hn(e,t),n),Gn=(e,t,n)=>te(e,`xAxis`,Hn(e,t),n),Kn=(e,t,n)=>F(e,`yAxis`,Un(e,t),n),qn=(e,t,n)=>te(e,`yAxis`,Un(e,t),n),Jn=de([et,Wn,Kn,Gn,qn],(e,t,n,r,i)=>be(e,`xAxis`)?yt(t,r,!1):yt(n,i,!1)),Yn=de([ie,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`area`).find(e=>e.id===t)),Xn=e=>{var t=et(e);return be(t,`xAxis`)?`yAxis`:`xAxis`},Zn=(e,t)=>Xn(e)===`yAxis`?Un(e,t):Hn(e,t),Qn=de([Yn,(e,t,n)=>xe(e,Xn(e),Zn(e,t),n)],(e,t)=>{if(e!=null&&t!=null){var{stackId:n}=e,r=C(e);if(n!=null&&r!=null){var i=(t[n]?.stackedData)?.find(e=>e.key===r);if(i!=null)return i.map(e=>[e[0],e[1]])}}}),$n=de([et,Wn,Kn,Gn,qn,Qn,dt,Jn,Yn,it],(e,t,n,r,i,a,o,s,c,l)=>{var{chartData:u,dataStartIndex:d,dataEndIndex:f}=o;if(!(c==null||e!==`horizontal`&&e!==`vertical`||t==null||n==null||r==null||i==null||r.length===0||i.length===0||s==null)){var{data:p}=c,m=p&&p.length>0?p:u?.slice(d,f+1);if(m!=null)return Cr({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:d,areaSettings:c,stackedData:a,displayedData:m,chartBaseValue:l,bandSize:s})}}),er=[`id`],tr=[`activeDot`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`fill`,`fillOpacity`,`hide`,`isAnimationActive`,`legendType`,`stroke`,`xAxisId`,`yAxisId`];function X(){return X=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:cr(r,i),value:k(n,t),payload:e}]},ur=W.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:c,tooltipType:l,id:u}=e,d={dataDefinedOnItem:n,getPosition:ge,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:k(o,t),hide:s,type:l,color:cr(r,a),unit:c,graphicalItemId:u}};return W.createElement(ee,{tooltipEntrySettings:d})});function dr(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:a,dataKey:o}=r,s=I(r);return W.createElement(_e,{points:n,dot:a,className:`recharts-area-dots`,dotClassName:`recharts-area-dot`,dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function fr(e){var{showLabels:t,children:n,points:r}=e,i=r.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Z(Z({},t),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:t,fill:void 0})});return W.createElement(ue,{value:t?i:void 0},n)}function pr(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:a}=e,{layout:o,type:s,stroke:c,connectNulls:l,isRange:u}=a,{id:d}=a,f=nr(a,er),p=I(f),m=we(f);return W.createElement(W.Fragment,null,t?.length>1&&W.createElement(D,{clipPath:r?`url(#clipPath-${i})`:void 0},W.createElement(ot,X({},m,{id:d,points:t,connectNulls:l,type:s,baseLine:n,layout:o,stroke:`none`,className:`recharts-area-area`})),c!==`none`&&W.createElement(ot,X({},p,{className:`recharts-area-curve`,layout:o,type:s,connectNulls:l,fill:`none`,points:t})),c!==`none`&&u&&Array.isArray(n)&&W.createElement(ot,X({},p,{className:`recharts-area-curve`,layout:o,type:s,connectNulls:l,fill:`none`,points:n}))),W.createElement(dr,{points:t,props:f,clipPathId:i}))}function mr(e){var{alpha:t,baseLine:n,points:r,strokeWidth:i}=e,a=r[0]?.y,o=r[r.length-1]?.y;if(!j(a)||!j(o))return null;var s=t*Math.abs(a-o),c=Math.max(...r.map(e=>e.x||0));return L(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.x||0),c)),L(c)?W.createElement(`rect`,{x:0,y:ae.y||0));return L(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.y||0),c)),L(c)?W.createElement(`rect`,{x:a({points:o,baseLine:s}),[o,s]),h=Je(m,`recharts-area-`),g=_t(),[_,v]=(0,W.useState)(!1),y=!_,b=(0,W.useCallback)(()=>{typeof p==`function`&&p(),v(!1)},[p]),x=(0,W.useCallback)(()=>{typeof f==`function`&&f(),v(!0)},[f]);if(g==null)return null;var S=i.current,C=a.current;return W.createElement(fr,{showLabels:y,points:o},r.children,W.createElement(Ne,{animationId:h,begin:l,duration:u,isActive:c,easing:d,onAnimationEnd:b,onAnimationStart:x,key:h},e=>{if(S){var l=S.length/o.length,u=e===1?o:o.map((t,n)=>{var r=Math.floor(n*l);if(S[r]){var i=S[r];return Z(Z({},t),{},{x:R(i.x,t.x,e),y:R(i.y,t.y,e)})}return t}),d=L(s)?R(C,s,e):P(s)||pe(s)?R(C,0,e):s.map((t,n)=>{var r=Math.floor(n*l);if(Array.isArray(C)&&C[r]){var i=C[r];return Z(Z({},t),{},{x:R(i.x,t.x,e),y:R(i.y,t.y,e)})}return t});return e>0&&(i.current=u,a.current=d),W.createElement(pr,{points:u,baseLine:d,needClip:t,clipPathId:n,props:r})}return e>0&&(i.current=o,a.current=s),W.createElement(D,null,c&&W.createElement(`defs`,null,W.createElement(`clipPath`,{id:`animationClipPath-${n}`},W.createElement(gr,{alpha:e,points:o,baseLine:s,layout:g,strokeWidth:r.strokeWidth}))),W.createElement(D,{clipPath:`url(#animationClipPath-${n})`},W.createElement(pr,{points:o,baseLine:s,needClip:t,clipPathId:n,props:r})))}),W.createElement(Ze,{label:r.label}))}function vr(e){var{needClip:t,clipPathId:n,props:r}=e,i=(0,W.useRef)(null),a=(0,W.useRef)();return W.createElement(_r,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}var yr=class extends W.PureComponent{render(){var{hide:e,dot:t,points:n,className:r,top:i,left:a,needClip:o,xAxisId:s,yAxisId:l,width:u,height:d,id:f,baseLine:p,zIndex:m}=this.props;if(e)return null;var h=c(`recharts-area`,r),g=f,{r:_,strokeWidth:v}=Ie(t),y=A(t),b=_*2+v,x=o?`url(#clipPath-${y?``:`dots-`}${g})`:void 0;return W.createElement(ae,{zIndex:m},W.createElement(D,{className:h},o&&W.createElement(`defs`,null,W.createElement($e,{clipPathId:g,xAxisId:s,yAxisId:l}),!y&&W.createElement(`clipPath`,{id:`clipPath-dots-${g}`},W.createElement(`rect`,{x:a-b/2,y:i-b/2,width:u+b,height:d+b}))),W.createElement(vr,{needClip:o,clipPathId:g,props:this.props})),W.createElement(st,{points:n,mainColor:cr(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:x}),this.props.isRange&&Array.isArray(p)&&W.createElement(st,{points:p,mainColor:cr(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:x}))}},br={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,connectNulls:!1,dot:!1,fill:`#3182bd`,fillOpacity:.6,hide:!1,isAnimationActive:`auto`,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,type:`linear`,label:!1,xAxisId:0,yAxisId:0,zIndex:ht.area};function xr(e){var{activeDot:t,animationBegin:n,animationDuration:r,animationEasing:i,connectNulls:a,dot:o,fill:s,fillOpacity:c,hide:l,isAnimationActive:u,legendType:d,stroke:f,xAxisId:p,yAxisId:m}=e,h=nr(e,tr),g=He(),_=he(),{needClip:v}=gt(p,m),y=We(),{points:b,isRange:x,baseLine:S}=T(t=>$n(t,e.id,y))??{},C=tt();if(g!==`horizontal`&&g!==`vertical`||C==null||_!==`AreaChart`&&_!==`ComposedChart`)return null;var{height:w,width:E,x:D,y:O}=C;return!b||!b.length?null:W.createElement(yr,X({},h,{activeDot:t,animationBegin:n,animationDuration:r,animationEasing:i,baseLine:S,connectNulls:a,dot:o,fill:s,fillOpacity:c,height:w,hide:l,layout:g,isAnimationActive:u,isRange:x,legendType:d,needClip:v,points:b,stroke:f,width:E,left:D,top:O,xAxisId:p,yAxisId:m}))}var Sr=(e,t,n,r,i)=>{var a=n??t;if(L(a))return a;var o=e===`horizontal`?i:r,s=o.scale.domain();if(o.type===`number`){var c=Math.max(s[0],s[1]),l=Math.min(s[0],s[1]);return a===`dataMin`?l:a===`dataMax`||c<0?c:Math.max(Math.min(s[0],s[1]),0)}return a===`dataMin`?s[0]:a===`dataMax`?s[1]:s[0]};function Cr(e){var{areaSettings:{connectNulls:t,baseValue:n,dataKey:r},stackedData:i,layout:a,chartBaseValue:o,xAxis:s,yAxis:c,displayedData:l,dataStartIndex:u,xAxisTicks:d,yAxisTicks:f,bandSize:p}=e,m=i&&i.length,h=Sr(a,o,n,s,c),g=a===`horizontal`,_=!1,v=l.map((e,n)=>{var a;if(m)a=i[u+n];else{var o=xt(e,r);Array.isArray(o)?(a=o,_=!0):a=[h,o]}var l=a?.[1]??null,v=l==null||m&&!t&&xt(e,r)==null;return g?{x:Tt({axis:s,ticks:d,bandSize:p,entry:e,index:n}),y:v?null:c.scale.map(l)??null,value:a,payload:e}:{x:v?null:s.scale.map(l)??null,y:Tt({axis:c,ticks:f,bandSize:p,entry:e,index:n}),value:a,payload:e}});return{points:v,baseLine:(m||_?v.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return g?{x:e.x,y:t!=null&&e.y!=null?c.scale.map(t)??null:null,payload:e.payload}:{x:t==null?null:s.scale.map(t)??null,y:e.y,payload:e.payload}}):g?c.scale.map(h):s.scale.map(h))??0,isRange:_}}function wr(e){var t=Xe(e,br),n=We();return W.createElement(bt,{id:t.id,type:`area`},e=>W.createElement(W.Fragment,null,W.createElement(ye,{legendPayload:lr(t)}),W.createElement(ur,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),W.createElement(O,{type:`area`,id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:Ct(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),W.createElement(xr,X({},t,{id:e}))))}var Tr=W.memo(wr,Le);Tr.displayName=`Area`;var Er=[`domain`,`range`],Dr=[`domain`,`range`];function Or(e,t){if(e==null)return{};var n,r,i=kr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{if(o!=null)return Lr(Lr({},a),{},{type:o})},[a,o]);return(0,W.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(Ge(s)):n.current!==s&&t(wt({prev:n.current,next:s})),n.current=s)},[s,t]),(0,W.useLayoutEffect)(()=>()=>{n.current&&=(t(Ae(n.current)),null)},[t]),null}var Wr=e=>{var{xAxisId:t,className:n}=e,r=T(je),i=We(),a=`xAxis`,o=T(e=>Te(e,a,t,i)),s=T(e=>Oe(e,t)),l=T(e=>lt(e,t)),u=T(e=>re(e,t));if(s==null||l==null||u==null)return null;var{dangerouslySetInnerHTML:d,ticks:f,scale:p}=e,m=Vr(e,Nr),{id:h,scale:g}=u,_=Vr(u,Pr);return W.createElement(xn,Fr({},m,_,{x:l.x,y:l.y,width:s.width,height:s.height,className:c(`recharts-${a} ${a}`,n),viewBox:r,ticks:o,axisType:a,axisId:t}))},Gr={allowDataOverflow:z.allowDataOverflow,allowDecimals:z.allowDecimals,allowDuplicatedCategory:z.allowDuplicatedCategory,angle:z.angle,axisLine:q.axisLine,height:z.height,hide:!1,includeHidden:z.includeHidden,interval:z.interval,label:!1,minTickGap:z.minTickGap,mirror:z.mirror,orientation:z.orientation,padding:z.padding,reversed:z.reversed,scale:z.scale,tick:z.tick,tickCount:z.tickCount,tickLine:q.tickLine,tickSize:q.tickSize,type:z.type,niceTicks:z.niceTicks,xAxisId:0},Kr=W.memo(e=>{var t=Xe(e,Gr);return W.createElement(W.Fragment,null,W.createElement(Ur,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),W.createElement(Wr,t))},jr);Kr.displayName=`XAxis`;var qr=[`type`],Jr=[`dangerouslySetInnerHTML`,`ticks`,`scale`],Yr=[`id`,`scale`];function Xr(){return Xr=Object.assign?Object.assign.bind():function(e){for(var t=1;t{if(o!=null)return Qr(Qr({},a),{},{type:o})},[o,a]);return(0,W.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(Ue(s)):n.current!==s&&t(Pe({prev:n.current,next:s})),n.current=s)},[s,t]),(0,W.useLayoutEffect)(()=>()=>{n.current&&=(t(vt(n.current)),null)},[t]),null}function ai(e){var{yAxisId:t,className:n,width:r,label:i}=e,a=(0,W.useRef)(null),o=(0,W.useRef)(null),s=T(je),l=We(),u=Qe(),d=`yAxis`,f=T(e=>me(e,t)),p=T(e=>De(e,t)),m=T(e=>Te(e,d,t,l)),h=T(e=>ke(e,t));if((0,W.useLayoutEffect)(()=>{if(!(r!==`auto`||!f||se(i)||(0,W.isValidElement)(i)||h==null)){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(f.width)!==Math.round(n)&&u(St({id:t,width:n}))}}},[m,f,u,i,t,r,h]),f==null||p==null||h==null)return null;var{dangerouslySetInnerHTML:g,ticks:_,scale:v}=e,y=ni(e,Jr),{id:b,scale:x}=h,S=ni(h,Yr);return W.createElement(xn,Xr({},y,S,{ref:a,labelRef:o,x:p.x,y:p.y,tickTextProps:r===`auto`?{width:void 0}:{width:r},width:f.width,height:f.height,className:c(`recharts-${d} ${d}`,n),viewBox:s,ticks:m,axisType:d,axisId:t}))}var oi={allowDataOverflow:E.allowDataOverflow,allowDecimals:E.allowDecimals,allowDuplicatedCategory:E.allowDuplicatedCategory,angle:E.angle,axisLine:q.axisLine,hide:!1,includeHidden:E.includeHidden,interval:E.interval,label:!1,minTickGap:E.minTickGap,mirror:E.mirror,orientation:E.orientation,padding:E.padding,reversed:E.reversed,scale:E.scale,tick:E.tick,tickCount:E.tickCount,tickLine:q.tickLine,tickSize:q.tickSize,type:E.type,niceTicks:E.niceTicks,width:E.width,yAxisId:0},si=W.memo(e=>{var t=Xe(e,oi);return W.createElement(W.Fragment,null,W.createElement(ii,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),W.createElement(ai,t))},jr);si.displayName=`YAxis`;var ci=[`axis`],li=(0,W.forwardRef)((e,t)=>W.createElement(at,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:ci,tooltipPayloadSearcher:ne,categoricalChartProps:e,ref:t}));function ui(e,t){return e&&t.some(t=>t.queue===e)?e:t.length?`all`:void 0}function di(e){let t=0,n=0,r=0,i=null,a=null,o=!1,s={};for(let c of e){t+=c.unfinished_jobs,n+=c.arrival_rate,r+=c.drain_rate;for(let[e,t]of Object.entries(c.by_state??{}))s[e]=(s[e]??0)+t;c.oldest_available_ms!=null&&(i?.oldest_available_ms==null||c.oldest_available_ms>i.oldest_available_ms)&&(i=c),!(c.unfinished_jobs<=0)&&(c.time_to_drain_ms==null?((!o||c.unfinished_jobs>(a?.unfinished_jobs??-1))&&(a=c),o=!0):!o&&c.time_to_drain_ms>(a?.time_to_drain_ms??-1)&&(a=c))}return{arrivalRate:n,drainRate:r,infiniteDrain:o,oldest:i,slowestDrain:a,states:s,unfinished:t}}function fi(e){let t={},n=0,r=0,i=0;for(let a of e){n+=a.arrived,r+=a.completed,i+=a.failed??0;for(let[e,n]of Object.entries(a.admission_rejections??{}))t[e]=(t[e]??0)+n}return{arrived:n,completed:r,failed:i,rejections:t}}function pi(e){let t=new Map;for(let n of e)for(let e of n){let n=t.get(e.at_ms)??{admission_rejections:{},arrived:0,at_ms:e.at_ms,completed:0,depth:0,failed:0};n.arrived+=e.arrived,n.completed+=e.completed,n.failed=(n.failed??0)+(e.failed??0),n.depth=(n.depth??0)+(e.depth??0);let r=n.admission_rejections??{};for(let[t,n]of Object.entries(e.admission_rejections??{}))r[t]=(r[t]??0)+n;n.admission_rejections=r,t.set(e.at_ms,n)}return[...t.values()].sort((e,t)=>e.at_ms-t.at_ms)}var Q=e(),mi=[{bucket:6e4,duration:36e5,label:`Last hour`,value:`1h`},{bucket:3e5,duration:216e5,label:`Last 6 hours`,value:`6h`},{bucket:9e5,duration:864e5,label:`Last 24 hours`,value:`24h`},{bucket:72e5,duration:6048e5,label:`Last 7 days`,value:`7d`},{bucket:864e5,duration:2592e6,label:`Last 30 days`,value:`30d`}],$=new Intl.NumberFormat,hi=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}),gi=new Intl.NumberFormat(void 0,{maximumFractionDigits:1,notation:`compact`}),_i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),vi=new Intl.DateTimeFormat(void 0,{day:`numeric`,hour:`numeric`,month:`short`}),yi={arrived:{color:`var(--warning)`,label:`Arrived`},completed:{color:`var(--success)`,label:`Completed`},depth:{color:`var(--primary)`,label:`Queue depth`},failed:{color:`var(--destructive)`,label:`Failed`}};function bi({title:e,value:t,detail:n,icon:i,tone:a=`normal`,to:o,search:s}){return(0,Q.jsx)(r,{className:`group rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,search:s,to:o,children:(0,Q.jsxs)(It,{className:`h-full transition-[border-color,box-shadow,transform] duration-150 group-hover:-translate-y-0.5 group-hover:border-primary/35 group-hover:shadow-sm motion-reduce:transform-none motion-reduce:transition-none`,children:[(0,Q.jsxs)(Rt,{children:[(0,Q.jsx)(`div`,{className:`rounded-lg p-2 ${a===`warning`?`bg-destructive/10 text-destructive`:`bg-primary/10 text-primary`}`,children:(0,Q.jsx)(i,{"aria-hidden":!0,className:`size-4`})}),(0,Q.jsx)(At,{className:`min-w-0 flex-1 text-muted-foreground`,children:e}),(0,Q.jsx)(zt,{"aria-hidden":!0,className:`size-4 text-muted-foreground transition-transform group-hover:translate-x-0.5 motion-reduce:transition-none`})]}),(0,Q.jsxs)(kt,{children:[(0,Q.jsx)(`div`,{className:`font-semibold text-2xl tabular-nums ${a===`warning`?`text-destructive`:``}`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 truncate text-muted-foreground text-xs`,title:n,children:n})]})]})})}function xi({buckets:e,queue:t,range:n}){if(!e.length)return(0,Q.jsx)(v,{children:`No traffic recorded for this queue in the selected range.`});let r=e.map(e=>({...e,depth:e.depth??0,failed:e.failed??0}));return(0,Q.jsxs)(`figure`,{"aria-label":`${t} arrived, completed, failed, and queue depth over ${n}`,children:[(0,Q.jsx)(mt,{className:`aspect-auto h-72 w-full`,config:yi,children:(0,Q.jsxs)(li,{accessibilityLayer:!0,data:r,margin:{bottom:0,left:4,right:4,top:10},children:[(0,Q.jsx)(`defs`,{children:(0,Q.jsxs)(`linearGradient`,{id:`queue-depth-fill`,x1:`0`,x2:`0`,y1:`0`,y2:`1`,children:[(0,Q.jsx)(`stop`,{offset:`5%`,stopColor:`var(--color-depth)`,stopOpacity:.28}),(0,Q.jsx)(`stop`,{offset:`95%`,stopColor:`var(--color-depth)`,stopOpacity:.02})]})}),(0,Q.jsx)(Vn,{strokeDasharray:`3 5`,vertical:!1}),(0,Q.jsx)(Kr,{axisLine:!1,dataKey:`at_ms`,minTickGap:32,tickFormatter:e=>(n===`7d`||n===`30d`?vi:_i).format(new Date(e)),tickLine:!1,tickMargin:10}),(0,Q.jsx)(si,{axisLine:!1,tickFormatter:e=>gi.format(e),tickLine:!1,width:38,yAxisId:`traffic`}),(0,Q.jsx)(si,{axisLine:!1,orientation:`right`,tickFormatter:e=>gi.format(e),tickLine:!1,width:38,yAxisId:`depth`}),(0,Q.jsx)(qe,{content:(0,Q.jsx)(Me,{indicator:`line`,labelFormatter:(e,t)=>{let n=t?.[0]?.payload?.at_ms;return typeof n==`number`?vi.format(new Date(n)):``}}),cursor:{stroke:`var(--border)`,strokeDasharray:`3 4`}}),(0,Q.jsx)(rt,{content:(0,Q.jsx)(ut,{})}),(0,Q.jsx)(Tr,{dataKey:`depth`,fill:`url(#queue-depth-fill)`,stroke:`var(--color-depth)`,strokeWidth:2,type:`monotone`,yAxisId:`depth`}),(0,Q.jsx)(ft,{dataKey:`arrived`,dot:!1,stroke:`var(--color-arrived)`,strokeWidth:2,type:`monotone`,yAxisId:`traffic`}),(0,Q.jsx)(ft,{dataKey:`completed`,dot:!1,stroke:`var(--color-completed)`,strokeWidth:2,type:`monotone`,yAxisId:`traffic`}),(0,Q.jsx)(ft,{dataKey:`failed`,dot:!1,stroke:`var(--color-failed)`,strokeWidth:2,type:`monotone`,yAxisId:`traffic`})]})}),(0,Q.jsx)(`figcaption`,{className:`sr-only`,children:`Traffic uses the left axis. Queue depth uses the right axis. Focus the chart to inspect individual buckets.`})]})}function Si({queue:e,range:t,setSearch:n}){let c=g([`api`,`overview`,`queues`],e=>s(`/queues`,{signal:e})),l=g([`api`,`overview`,`cluster`],e=>s(`/cluster`,{signal:e})),S=Array.isArray(c.data)?c.data:c.data?.queues??[],C=di(S),w=ui(e,S),T=mi.find(e=>e.value===t)??mi[1],E=Date.now()-T.duration,D=w===`all`?S.map(e=>e.queue):w?[w]:[],O=d(D.map(e=>({queryFn:t=>s(`/queues/${encodeURIComponent(e)}/history?since_ms=${E}&bucket_ms=${T.bucket}`,{signal:t}),queryKey:[`api`,`overview`,`history`,e,t]})));if((c.isPending||l.isPending)&&!(c.data&&l.data))return(0,Q.jsx)(h,{});if(c.error)return(0,Q.jsx)(b,{message:c.error instanceof Error?c.error.message:String(c.error)});if(l.error)return(0,Q.jsx)(b,{message:l.error instanceof Error?l.error.message:String(l.error)});let k=l.data??{},A=(k.queues??[]).filter(e=>e.live_workers===0),j=O.find(e=>e.error)?.error,ee=O.some(e=>e.isPending),M=w===`all`?pi(O.map(e=>e.data??[])):O[0]?.data??[],N=fi(M),P=Object.values(N.rejections).reduce((e,t)=>e+t,0),te=[...S].sort((e,t)=>{let n=e.unfinished_jobs>0&&e.time_to_drain_ms==null;return n===(t.unfinished_jobs>0&&t.time_to_drain_ms==null)?(t.time_to_drain_ms??0)-(e.time_to_drain_ms??0)||t.unfinished_jobs-e.unfinished_jobs:n?-1:1}).slice(0,8),{oldest:F,slowestDrain:I}=C;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-end justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-balance font-semibold text-lg`,children:`Overview`}),(0,Q.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Fleet health, queue pressure, and the policies affecting admission.`})]}),(0,Q.jsxs)(i,{className:`tabular-nums`,variant:`outline`,children:[`in `,hi.format(C.arrivalRate),`/s · out`,` `,hi.format(C.drainRate),`/s`]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:[(0,Q.jsx)(bi,{detail:`${$.format(C.states.available)} available · ${$.format(C.states.retryable)} retryable`,icon:Vt,title:`Unfinished Work`,to:`/jobs`,value:$.format(C.unfinished)}),(0,Q.jsx)(bi,{detail:F?`Waiting in ${F.queue}`:`No available jobs are waiting`,icon:Dt,search:F?{queue:F.queue,state:`available`}:void 0,title:`Oldest Available`,to:`/jobs`,tone:F?`warning`:`normal`,value:F?Ft(F.oldest_available_ms):`None`}),(0,Q.jsx)(bi,{detail:I?`${I.queue} · ${$.format(I.unfinished_jobs)} unfinished`:`Every queue is clear`,icon:u,title:`Worst Time to Drain`,to:`/queues`,tone:C.infiniteDrain?`warning`:`normal`,value:I?C.infiniteDrain?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(Ee,{"aria-hidden":!0,className:`size-6`}),` Growing`]}):Ft(I.time_to_drain_ms):`Clear`}),(0,Q.jsx)(bi,{detail:`${$.format(k.inflight_total??0)} of ${$.format(k.capacity_total??0)} slots · ${k.workers?.live??0} live`,icon:Bt,title:`Fleet Utilization`,to:`/workers`,tone:(k.workers?.stale??0)>0?`warning`:`normal`,value:Mt(k.utilization)})]}),(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 xl:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]`,children:[(0,Q.jsxs)(It,{children:[(0,Q.jsxs)(Rt,{className:`flex-wrap`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(At,{children:`Queue Traffic`}),(0,Q.jsx)(jt,{children:`Arrivals, completions, failures, and depth from maintained history buckets.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(x,{onValueChange:e=>e&&n({queue:e}),value:w,children:[(0,Q.jsx)(_,{"aria-label":`Queue shown in traffic chart`,className:`w-44`,children:(0,Q.jsx)(m,{placeholder:`Choose queue…`})}),(0,Q.jsx)(f,{children:(0,Q.jsxs)(p,{children:[(0,Q.jsx)(y,{value:`all`,children:`All queues`}),S.map(e=>(0,Q.jsx)(y,{value:e.queue,children:(0,Q.jsx)(`span`,{translate:`no`,children:e.queue})},e.queue))]})})]}),(0,Q.jsxs)(x,{onValueChange:e=>e&&n({range:e}),value:t,children:[(0,Q.jsx)(_,{"aria-label":`Traffic chart time range`,className:`w-36`,children:(0,Q.jsx)(m,{})}),(0,Q.jsx)(f,{children:(0,Q.jsx)(p,{children:mi.map(e=>(0,Q.jsx)(y,{value:e.value,children:e.label},e.value))})})]})]})]}),(0,Q.jsxs)(kt,{children:[j?(0,Q.jsx)(b,{message:j instanceof Error?j.message:String(j)}):ee?(0,Q.jsx)(h,{}):w?(0,Q.jsx)(xi,{buckets:M,queue:w===`all`?`All queues`:w,range:t}):(0,Q.jsx)(v,{children:`No queue traffic is available.`}),w&&M.length?(0,Q.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 border-t pt-3 text-sm sm:grid-cols-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Arrived`}),(0,Q.jsx)(`p`,{className:`font-medium tabular-nums`,children:$.format(N.arrived)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Completed`}),(0,Q.jsx)(`p`,{className:`font-medium tabular-nums`,children:$.format(N.completed)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Failed`}),(0,Q.jsx)(`p`,{className:N.failed?`font-medium text-destructive tabular-nums`:`font-medium tabular-nums`,children:$.format(N.failed)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Policy Rejections`}),(0,Q.jsx)(`p`,{className:P?`font-medium text-destructive tabular-nums`:`font-medium tabular-nums`,children:$.format(P)})]})]}):null]})]}),(0,Q.jsxs)(It,{children:[(0,Q.jsx)(Rt,{children:(0,Q.jsx)(At,{children:`Attention Needed`})}),(0,Q.jsxs)(kt,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Q.jsx)(o,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 ${A.length?`text-destructive`:`text-success`}`}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`font-medium text-sm`,children:`Worker Coverage`}),(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:A.length?`${A.length} queue${A.length===1?` has`:`s have`} no live worker.`:`Every known queue has a live worker.`}),A.length?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:A.map(e=>(0,Q.jsx)(i,{variant:`destructive`,children:(0,Q.jsx)(`span`,{translate:`no`,children:e.queue})},e.queue))}),(0,Q.jsxs)(r,{className:`mt-2 inline-block text-primary text-xs hover:underline`,to:`/workers`,children:[`Inspect workers `,(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`→`})]})]}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Q.jsx)(a,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 ${P?`text-destructive`:`text-success`}`}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`font-medium text-sm`,children:`Admission Policies`}),(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:P?`${$.format(P)} rejection${P===1?``:`s`} ${w===`all`?`across all queues`:`for ${w}`} in this range.`:`No policy rejections ${w===`all`?`across all queues`:`for ${w??`known queues`}`} in this range.`}),Object.keys(N.rejections).length?(0,Q.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:Object.entries(N.rejections).sort((e,t)=>t[1]-e[1]).map(([e,t])=>(0,Q.jsxs)(i,{variant:`outline`,children:[e,` `,$.format(t)]},e))}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Q.jsx)(Bt,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 ${(k.empty_poll_ratio??0)>.8?`text-warning`:`text-muted-foreground`}`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`font-medium text-sm`,children:`Polling Efficiency`}),(0,Q.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[Mt(k.empty_poll_ratio),` of admissions returned no work.`]})]})]})]})]})]}),(0,Q.jsxs)(It,{className:`mt-4`,children:[(0,Q.jsxs)(Rt,{children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(At,{children:`Queue Pressure`}),(0,Q.jsx)(jt,{children:`Backlogged queues ordered by their ability to catch up.`})]}),(0,Q.jsxs)(r,{className:`text-primary text-sm hover:underline`,to:`/queues`,children:[`All queues `,(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`→`})]})]}),(0,Q.jsx)(kt,{children:te.length?(0,Q.jsxs)(Lt,{children:[(0,Q.jsx)(Ot,{children:(0,Q.jsxs)(Pt,{children:[(0,Q.jsx)(B,{children:`Queue`}),(0,Q.jsx)(B,{children:`Unfinished`}),(0,Q.jsx)(B,{children:`Oldest`}),(0,Q.jsx)(B,{children:`In / Out`}),(0,Q.jsx)(B,{children:`Time to Drain`}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Open jobs`})})]})}),(0,Q.jsx)(Nt,{children:te.map(e=>{let t=e.unfinished_jobs>0&&e.time_to_drain_ms==null;return(0,Q.jsxs)(Pt,{children:[(0,Q.jsxs)(V,{children:[(0,Q.jsx)(`span`,{className:`font-medium`,translate:`no`,children:e.queue}),e.paused?(0,Q.jsx)(i,{className:`ml-2`,variant:`destructive`,children:`paused`}):null]}),(0,Q.jsx)(V,{className:`tabular-nums`,children:$.format(e.unfinished_jobs)}),(0,Q.jsx)(V,{className:`tabular-nums`,children:Ft(e.oldest_available_ms)}),(0,Q.jsxs)(V,{className:`tabular-nums`,children:[hi.format(e.arrival_rate),` /`,` `,hi.format(e.drain_rate)]}),(0,Q.jsx)(V,{className:t?`font-medium text-destructive`:`tabular-nums`,children:t?`Growing`:Ft(e.time_to_drain_ms)}),(0,Q.jsx)(V,{children:(0,Q.jsxs)(r,{className:`text-primary text-sm hover:underline`,search:{queue:e.queue},to:`/jobs`,children:[`Jobs `,(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`→`})]})})]},e.queue)})})]}):(0,Q.jsx)(v,{children:`No queues reported.`})})]})]})}function Ci(){let e=S.useSearch(),t=S.useNavigate();return(0,Q.jsx)(Si,{queue:e.queue,range:e.range??`6h`,setSearch:e=>void t({search:t=>({...t,...e}),replace:!0})})}export{Ci as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.periodic-DY9l1h41.js b/go/headgateui/dist/assets/_console.periodic-DY9l1h41.js new file mode 100644 index 0000000..9a31908 --- /dev/null +++ b/go/headgateui/dist/assets/_console.periodic-DY9l1h41.js @@ -0,0 +1 @@ +import{a as e}from"./with-selector-hO0TNhHE.js";import{Yn as t}from"./theme-CN9-NrCi.js";import{C as n,E as r,V as i,a,i as o,n as s,o as c,r as l,s as u}from"./console-COYwGlau.js";import{i as d}from"./index-D8-0FUBj.js";import{t as f}from"./action-button-DKldNPQD.js";import{t as p}from"./relative-time-Bzc3eil5.js";import{a as m,c as h,d as g,i as _,n as v,o as y,r as b,s as x,t as S,u as C}from"./table-DtWJ0yY1.js";function w(e,t=0){switch(e){case`skip`:return{description:`Enqueue only the latest due tick and discard older missed ticks.`,label:`Skip backlog`};case`run_once`:return{description:`Enqueue one catch-up job for the latest due tick and discard older missed ticks.`,label:`Run once`};case`backfill`:return{description:`Enqueue up to ${Math.max(1,t)} of the most recent missed ticks as separate jobs.`,label:`Backfill up to ${Math.max(1,t)}`};default:return{description:`The API returned an unsupported missed-run policy: ${e}.`,label:`Unknown policy`}}}var T=e();function E({notify:e}){let{events:u}=d.useSearch(),E=a(),{data:D,error:O,loading:k}=c(`/periodic`),A=c(u?`/periodic/${encodeURIComponent(u)}/enqueue-events?limit=30`:null),j=Array.isArray(D)?D:D?.schedules??[],M=async t=>{try{await E.mutateAsync({path:`/periodic/${encodeURIComponent(t.id)}/run`}),e(`Job enqueued from schedule`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},N=async t=>{if(window.confirm(`Delete schedule ${t.id}?`))try{await E.mutateAsync({method:`DELETE`,path:`/periodic/${encodeURIComponent(t.id)}`}),e(`Schedule deleted`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}};return k&&!D?(0,T.jsx)(o,{}):O?(0,T.jsx)(l,{message:O}):u?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`div`,{className:`mb-4`,children:(0,T.jsx)(i,{nativeButton:!1,render:(0,T.jsx)(t,{replace:!0,search:{},to:`/periodic`}),children:`Back to schedules`})}),(0,T.jsxs)(x,{children:[(0,T.jsx)(C,{children:(0,T.jsxs)(g,{children:[`Scheduler events · `,u]})}),(0,T.jsx)(h,{children:A.loading?(0,T.jsx)(o,{}):A.error?(0,T.jsx)(l,{message:A.error}):A.data?.events?.length?(0,T.jsxs)(S,{children:[(0,T.jsx)(m,{children:(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{children:`Recorded`}),(0,T.jsx)(_,{children:`Tick`}),(0,T.jsx)(_,{children:`Outcome`}),(0,T.jsx)(_,{children:`Reason`}),(0,T.jsx)(_,{children:`Job`})]})}),(0,T.jsx)(v,{children:A.data.events.map(e=>(0,T.jsxs)(y,{children:[(0,T.jsx)(b,{children:(0,T.jsx)(p,{value:e.recorded_at_ms})}),(0,T.jsx)(b,{children:(0,T.jsx)(p,{value:e.tick_ms})}),(0,T.jsx)(b,{children:(0,T.jsx)(n,{variant:e.outcome===`failed`||e.outcome===`skipped`?`destructive`:`success`,children:e.outcome})}),(0,T.jsx)(b,{children:e.reason??`—`}),(0,T.jsx)(b,{className:`font-mono text-xs`,children:e.job_id?(0,T.jsx)(t,{"aria-label":`Inspect job ${e.job_id}`,className:`text-primary hover:underline`,params:{jobId:e.job_id},search:{},to:`/jobs/$jobId`,children:e.job_id}):`—`})]},`${e.recorded_at_ms}:${e.tick_ms}:${e.outcome}:${e.job_id??`none`}`))})]}):(0,T.jsx)(s,{children:`No scheduler attempts recorded.`})})]})]}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`div`,{className:`mb-4`,children:[(0,T.jsx)(`h1`,{className:`font-semibold text-lg`,children:`Periodic schedules`}),(0,T.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Durable, store-coordinated recurring work and its enqueue history.`})]}),(0,T.jsxs)(x,{children:[(0,T.jsx)(C,{children:(0,T.jsx)(g,{children:`Schedules`})}),(0,T.jsx)(h,{children:j.length?(0,T.jsxs)(S,{children:[(0,T.jsx)(m,{children:(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{children:`ID`}),(0,T.jsx)(_,{children:`Spec`}),(0,T.jsx)(_,{children:`Kind → queue`}),(0,T.jsx)(_,{children:`Next run`}),(0,T.jsx)(_,{children:`Missed runs`}),(0,T.jsx)(_,{children:(0,T.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,T.jsx)(v,{children:j.map(e=>{let a=`/periodic/${encodeURIComponent(e.id)}`,o=w(e.on_missed,e.backfill_limit);return(0,T.jsxs)(y,{children:[(0,T.jsxs)(b,{className:`font-mono text-xs`,children:[e.id,` `,e.paused&&(0,T.jsx)(n,{variant:`destructive`,children:`paused`})]}),(0,T.jsx)(b,{className:`font-mono text-xs`,children:e.spec}),(0,T.jsxs)(b,{children:[e.kind,` → `,e.queue]}),(0,T.jsx)(b,{children:(0,T.jsx)(p,{value:e.next_run_ms})}),(0,T.jsxs)(b,{children:[(0,T.jsx)(`p`,{className:`font-medium text-sm`,children:o.label}),(0,T.jsx)(`p`,{className:`max-w-64 text-muted-foreground text-xs`,children:o.description})]}),(0,T.jsx)(b,{children:(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,T.jsx)(i,{nativeButton:!1,render:(0,T.jsx)(t,{search:{events:e.id},to:`/periodic`}),size:`sm`,variant:`outline`,children:`Events`}),(0,T.jsx)(`span`,{title:`Enqueue one extra job now without changing the normal next-run time. The job still passes through admission.`,children:(0,T.jsx)(f,{disabled:r.readOnly||E.isPending,onClick:()=>void M(e),pending:E.isPending&&E.variables?.path===`${a}/run`,pendingLabel:`Enqueuing…`,size:`sm`,variant:`outline`,children:`Enqueue now`})}),(0,T.jsx)(f,{disabled:r.readOnly||E.isPending,onClick:()=>void N(e),pending:E.isPending&&E.variables?.path===a,pendingLabel:`Deleting…`,size:`sm`,variant:`destructive`,children:`Delete`})]})})]},e.id)})})]}):(0,T.jsx)(s,{children:`No schedules configured.`})})]})]})}function D(){return(0,T.jsx)(E,{...u()})}export{D as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.periodic-Dpot-gjP.js b/go/headgateui/dist/assets/_console.periodic-Dpot-gjP.js deleted file mode 100644 index 261ccc5..0000000 --- a/go/headgateui/dist/assets/_console.periodic-Dpot-gjP.js +++ /dev/null @@ -1 +0,0 @@ -import{o as e}from"./utils-o8v-URZ_.js";import{Jn as t}from"./theme-6NkSfuJL.js";import{B as n,T as r,U as i,a,i as o,n as s,o as c,r as l,s as u}from"./console-C2t3Lr2f.js";import{i as d}from"./index-B8M4ltzK.js";import{t as f}from"./action-button-DtQnwrt0.js";import{t as p}from"./relative-time-CtN3x3SY.js";import{a as m,c as h,d as g,i as _,n as v,o as y,r as b,s as x,t as S,u as C}from"./table-BngtkqYs.js";function w(e,t=0){switch(e){case`skip`:return{description:`Enqueue only the latest due tick and discard older missed ticks.`,label:`Skip backlog`};case`run_once`:return{description:`Enqueue one catch-up job for the latest due tick and discard older missed ticks.`,label:`Run once`};case`backfill`:return{description:`Enqueue up to ${Math.max(1,t)} of the most recent missed ticks as separate jobs.`,label:`Backfill up to ${Math.max(1,t)}`};default:return{description:`The API returned an unsupported missed-run policy: ${e}.`,label:`Unknown policy`}}}var T=e();function E({notify:e}){let{events:u}=d.useSearch(),E=a(),{data:D,error:O,loading:k}=c(`/periodic`),A=c(u?`/periodic/${encodeURIComponent(u)}/enqueue-events?limit=30`:null),j=Array.isArray(D)?D:D?.schedules??[],M=async t=>{try{await E.mutateAsync({path:`/periodic/${encodeURIComponent(t.id)}/run`}),e(`Job enqueued from schedule`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},N=async t=>{if(window.confirm(`Delete schedule ${t.id}?`))try{await E.mutateAsync({method:`DELETE`,path:`/periodic/${encodeURIComponent(t.id)}`}),e(`Schedule deleted`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}};return k&&!D?(0,T.jsx)(o,{}):O?(0,T.jsx)(l,{message:O}):u?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`div`,{className:`mb-4`,children:(0,T.jsx)(n,{nativeButton:!1,render:(0,T.jsx)(t,{replace:!0,search:{},to:`/periodic`}),children:`Back to schedules`})}),(0,T.jsxs)(x,{children:[(0,T.jsx)(C,{children:(0,T.jsxs)(g,{children:[`Scheduler events · `,u]})}),(0,T.jsx)(h,{children:A.loading?(0,T.jsx)(o,{}):A.error?(0,T.jsx)(l,{message:A.error}):A.data?.events?.length?(0,T.jsxs)(S,{children:[(0,T.jsx)(m,{children:(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{children:`Recorded`}),(0,T.jsx)(_,{children:`Tick`}),(0,T.jsx)(_,{children:`Outcome`}),(0,T.jsx)(_,{children:`Reason`}),(0,T.jsx)(_,{children:`Job`})]})}),(0,T.jsx)(v,{children:A.data.events.map(e=>(0,T.jsxs)(y,{children:[(0,T.jsx)(b,{children:(0,T.jsx)(p,{value:e.recorded_at_ms})}),(0,T.jsx)(b,{children:(0,T.jsx)(p,{value:e.tick_ms})}),(0,T.jsx)(b,{children:(0,T.jsx)(i,{variant:e.outcome===`failed`||e.outcome===`skipped`?`destructive`:`success`,children:e.outcome})}),(0,T.jsx)(b,{children:e.reason??`—`}),(0,T.jsx)(b,{className:`font-mono text-xs`,children:e.job_id?(0,T.jsx)(t,{"aria-label":`Inspect job ${e.job_id}`,className:`text-primary hover:underline`,params:{jobId:e.job_id},search:{},to:`/jobs/$jobId`,children:e.job_id}):`—`})]},`${e.recorded_at_ms}:${e.tick_ms}:${e.outcome}:${e.job_id??`none`}`))})]}):(0,T.jsx)(s,{children:`No scheduler attempts recorded.`})})]})]}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`div`,{className:`mb-4`,children:[(0,T.jsx)(`h1`,{className:`font-semibold text-lg`,children:`Periodic schedules`}),(0,T.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Durable, store-coordinated recurring work and its enqueue history.`})]}),(0,T.jsxs)(x,{children:[(0,T.jsx)(C,{children:(0,T.jsx)(g,{children:`Schedules`})}),(0,T.jsx)(h,{children:j.length?(0,T.jsxs)(S,{children:[(0,T.jsx)(m,{children:(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{children:`ID`}),(0,T.jsx)(_,{children:`Spec`}),(0,T.jsx)(_,{children:`Kind → queue`}),(0,T.jsx)(_,{children:`Next run`}),(0,T.jsx)(_,{children:`Missed runs`}),(0,T.jsx)(_,{children:(0,T.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,T.jsx)(v,{children:j.map(e=>{let a=`/periodic/${encodeURIComponent(e.id)}`,o=w(e.on_missed,e.backfill_limit);return(0,T.jsxs)(y,{children:[(0,T.jsxs)(b,{className:`font-mono text-xs`,children:[e.id,` `,e.paused&&(0,T.jsx)(i,{variant:`destructive`,children:`paused`})]}),(0,T.jsx)(b,{className:`font-mono text-xs`,children:e.spec}),(0,T.jsxs)(b,{children:[e.kind,` → `,e.queue]}),(0,T.jsx)(b,{children:(0,T.jsx)(p,{value:e.next_run_ms})}),(0,T.jsxs)(b,{children:[(0,T.jsx)(`p`,{className:`font-medium text-sm`,children:o.label}),(0,T.jsx)(`p`,{className:`max-w-64 text-muted-foreground text-xs`,children:o.description})]}),(0,T.jsx)(b,{children:(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,T.jsx)(n,{nativeButton:!1,render:(0,T.jsx)(t,{search:{events:e.id},to:`/periodic`}),size:`sm`,variant:`outline`,children:`Events`}),(0,T.jsx)(`span`,{title:`Enqueue one extra job now without changing the normal next-run time. The job still passes through admission.`,children:(0,T.jsx)(f,{disabled:r.readOnly||E.isPending,onClick:()=>void M(e),pending:E.isPending&&E.variables?.path===`${a}/run`,pendingLabel:`Enqueuing…`,size:`sm`,variant:`outline`,children:`Enqueue now`})}),(0,T.jsx)(f,{disabled:r.readOnly||E.isPending,onClick:()=>void N(e),pending:E.isPending&&E.variables?.path===a,pendingLabel:`Deleting…`,size:`sm`,variant:`destructive`,children:`Delete`})]})})]},e.id)})})]}):(0,T.jsx)(s,{children:`No schedules configured.`})})]})]})}function D(){return(0,T.jsx)(E,{...u()})}export{D as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.quarantine-CeEEGrSn.js b/go/headgateui/dist/assets/_console.quarantine-CeEEGrSn.js new file mode 100644 index 0000000..a474f9f --- /dev/null +++ b/go/headgateui/dist/assets/_console.quarantine-CeEEGrSn.js @@ -0,0 +1 @@ +import{a as e}from"./with-selector-hO0TNhHE.js";import{C as t,E as n,a as r,i,n as a,o,r as s,s as c}from"./console-COYwGlau.js";import{t as l}from"./action-button-DKldNPQD.js";import{t as u}from"./relative-time-Bzc3eil5.js";import{a as d,c as f,d as p,i as m,n as h,o as g,r as _,s as v,t as y,u as b}from"./table-DtWJ0yY1.js";var x=e();function S({notify:e}){let c=r(),{data:S,error:C,loading:w}=o(`/quarantine`),T=Array.isArray(S)?S:S?.quarantine??[],E=async t=>{if(window.confirm(`Release ${t.fingerprint}? It will be quarantined again if the crash threshold is reached.`))try{await c.mutateAsync({method:`DELETE`,path:`/quarantine/${encodeURIComponent(t.fingerprint)}`}),e(`Fingerprint released`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}};return w&&!S?(0,x.jsx)(i,{}):C?(0,x.jsx)(s,{message:C}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`mb-4`,children:[(0,x.jsx)(`h1`,{className:`font-semibold text-lg`,children:`Quarantine`}),(0,x.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Poison-pill fingerprints blocked after repeated worker crashes.`})]}),(0,x.jsxs)(v,{children:[(0,x.jsx)(b,{children:(0,x.jsx)(p,{children:`Quarantined fingerprints`})}),(0,x.jsx)(f,{children:T.length?(0,x.jsxs)(y,{children:[(0,x.jsx)(d,{children:(0,x.jsxs)(g,{children:[(0,x.jsx)(m,{children:`Fingerprint`}),(0,x.jsx)(m,{children:`Kind`}),(0,x.jsx)(m,{children:`Crashes`}),(0,x.jsx)(m,{children:`Since`}),(0,x.jsx)(m,{children:`Reason`}),(0,x.jsx)(m,{children:(0,x.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,x.jsx)(h,{children:T.map(e=>(0,x.jsxs)(g,{children:[(0,x.jsx)(_,{className:`max-w-64 break-all font-mono text-xs`,children:e.fingerprint}),(0,x.jsx)(_,{children:e.kind}),(0,x.jsx)(_,{children:(0,x.jsx)(t,{variant:`destructive`,children:e.crash_count})}),(0,x.jsx)(_,{children:(0,x.jsx)(u,{value:e.quarantined_at_ms})}),(0,x.jsx)(_,{children:e.reason}),(0,x.jsx)(_,{children:(0,x.jsx)(l,{disabled:n.readOnly||c.isPending,onClick:()=>void E(e),pending:c.isPending&&c.variables?.path===`/quarantine/${encodeURIComponent(e.fingerprint)}`,pendingLabel:`Releasing…`,size:`sm`,variant:`outline`,children:`Release`})})]},e.fingerprint))})]}):(0,x.jsx)(a,{children:`Nothing is quarantined.`})})]})]})}function C(){return(0,x.jsx)(S,{...c()})}export{C as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.quarantine-IhoJN7GC.js b/go/headgateui/dist/assets/_console.quarantine-IhoJN7GC.js deleted file mode 100644 index 42a413f..0000000 --- a/go/headgateui/dist/assets/_console.quarantine-IhoJN7GC.js +++ /dev/null @@ -1 +0,0 @@ -import{o as e}from"./utils-o8v-URZ_.js";import{T as t,U as n,a as r,i,n as a,o,r as s,s as c}from"./console-C2t3Lr2f.js";import{t as l}from"./action-button-DtQnwrt0.js";import{t as u}from"./relative-time-CtN3x3SY.js";import{a as d,c as f,d as p,i as m,n as h,o as g,r as _,s as v,t as y,u as b}from"./table-BngtkqYs.js";var x=e();function S({notify:e}){let c=r(),{data:S,error:C,loading:w}=o(`/quarantine`),T=Array.isArray(S)?S:S?.quarantine??[],E=async t=>{if(window.confirm(`Release ${t.fingerprint}? It will be quarantined again if the crash threshold is reached.`))try{await c.mutateAsync({method:`DELETE`,path:`/quarantine/${encodeURIComponent(t.fingerprint)}`}),e(`Fingerprint released`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}};return w&&!S?(0,x.jsx)(i,{}):C?(0,x.jsx)(s,{message:C}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`mb-4`,children:[(0,x.jsx)(`h1`,{className:`font-semibold text-lg`,children:`Quarantine`}),(0,x.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Poison-pill fingerprints blocked after repeated worker crashes.`})]}),(0,x.jsxs)(v,{children:[(0,x.jsx)(b,{children:(0,x.jsx)(p,{children:`Quarantined fingerprints`})}),(0,x.jsx)(f,{children:T.length?(0,x.jsxs)(y,{children:[(0,x.jsx)(d,{children:(0,x.jsxs)(g,{children:[(0,x.jsx)(m,{children:`Fingerprint`}),(0,x.jsx)(m,{children:`Kind`}),(0,x.jsx)(m,{children:`Crashes`}),(0,x.jsx)(m,{children:`Since`}),(0,x.jsx)(m,{children:`Reason`}),(0,x.jsx)(m,{children:(0,x.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,x.jsx)(h,{children:T.map(e=>(0,x.jsxs)(g,{children:[(0,x.jsx)(_,{className:`max-w-64 break-all font-mono text-xs`,children:e.fingerprint}),(0,x.jsx)(_,{children:e.kind}),(0,x.jsx)(_,{children:(0,x.jsx)(n,{variant:`destructive`,children:e.crash_count})}),(0,x.jsx)(_,{children:(0,x.jsx)(u,{value:e.quarantined_at_ms})}),(0,x.jsx)(_,{children:e.reason}),(0,x.jsx)(_,{children:(0,x.jsx)(l,{disabled:t.readOnly||c.isPending,onClick:()=>void E(e),pending:c.isPending&&c.variables?.path===`/quarantine/${encodeURIComponent(e.fingerprint)}`,pendingLabel:`Releasing…`,size:`sm`,variant:`outline`,children:`Release`})})]},e.fingerprint))})]}):(0,x.jsx)(a,{children:`Nothing is quarantined.`})})]})]})}function C(){return(0,x.jsx)(S,{...c()})}export{C as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.queues-C47vPXCj.js b/go/headgateui/dist/assets/_console.queues-C47vPXCj.js deleted file mode 100644 index 17a1c4b..0000000 --- a/go/headgateui/dist/assets/_console.queues-C47vPXCj.js +++ /dev/null @@ -1 +0,0 @@ -import{c as e,d as t,o as n}from"./utils-o8v-URZ_.js";import{Jn as r}from"./theme-6NkSfuJL.js";import{T as i,U as a,X as o,a as s,i as c,l,n as u,o as d,r as f,s as p,w as m}from"./console-C2t3Lr2f.js";import{I as h,Wt as g,a as _,i as v,o as y,s as b,t as x}from"./chart-CAYbmpTK.js";import{t as S}from"./action-button-DtQnwrt0.js";import{t as C}from"./play-BC4ZZCx4.js";import{a as w,c as T,d as E,i as D,n as O,o as k,p as A,r as j,s as M,t as N,u as P}from"./table-BngtkqYs.js";var F=o(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),I=t(e()),L=[`axis`],R=(0,I.forwardRef)((e,t)=>I.createElement(y,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:L,tooltipPayloadSearcher:h,categoricalChartProps:e,ref:t})),z=n(),B={arrived:{color:`var(--warning)`,label:`Arrived`},completed:{color:`var(--success)`,label:`Completed`}};function V({queue:e}){let t=l([`api`,`queue-history`,e],t=>{let n=Date.now()-72e5;return m(`/queues/${encodeURIComponent(e)}/history?since_ms=${n}&bucket_ms=300000`,{signal:t})}).data??[];return t.length?(0,z.jsxs)(`div`,{className:`mt-3`,children:[(0,z.jsx)(x,{"aria-label":`Arrivals and completions for ${e} over two hours`,className:`aspect-auto h-16 w-full`,config:B,initialDimension:{height:64,width:240},role:`img`,children:(0,z.jsxs)(R,{accessibilityLayer:!0,data:t,margin:{bottom:3,left:3,right:3,top:3},children:[(0,z.jsx)(v,{content:(0,z.jsx)(_,{hideLabel:!0,indicator:`line`})}),(0,z.jsx)(b,{dataKey:`arrived`,dot:!1,isAnimationActive:!1,stroke:`var(--color-arrived)`,strokeWidth:2,type:`monotone`}),(0,z.jsx)(b,{dataKey:`completed`,dot:!1,isAnimationActive:!1,stroke:`var(--color-completed)`,strokeWidth:2,type:`monotone`})]})}),(0,z.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[(0,z.jsx)(`span`,{className:`text-warning`,children:`in`}),` /`,` `,(0,z.jsx)(`span`,{className:`text-success`,children:`out`}),` · 2 hr`]})]}):(0,z.jsx)(`p`,{className:`mt-3 text-muted-foreground text-xs`,children:`No traffic in 2 hours`})}function H({queues:e}){let t=l([`api`,`partitions`,e.slice(0,6).map(({queue:e})=>e)],async t=>(await Promise.all(e.slice(0,6).map(async({queue:e})=>{let n=await m(`/partitions?queue=${encodeURIComponent(e)}`,{signal:t});return(Array.isArray(n)?n:n.partitions??[]).map(t=>({...t,queue:e}))}))).flat(),e.length>0).data??[];return(0,z.jsxs)(M,{className:`mt-4`,children:[(0,z.jsx)(P,{children:(0,z.jsx)(E,{children:`Partition fairness`})}),(0,z.jsx)(T,{children:t.length?(0,z.jsxs)(N,{children:[(0,z.jsx)(w,{children:(0,z.jsxs)(k,{children:[(0,z.jsx)(D,{children:`Queue`}),(0,z.jsx)(D,{children:`Partition`}),(0,z.jsx)(D,{children:`Waiting`}),(0,z.jsx)(D,{children:`Accrued deficit`})]})}),(0,z.jsx)(O,{children:t.map(e=>(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:e.queue}),(0,z.jsx)(j,{className:`font-mono text-xs`,children:e.partition_key||`default`}),(0,z.jsx)(j,{children:e.waiting}),(0,z.jsx)(j,{children:e.deficit})]},`${e.queue}:${e.partition_key}`))})]}):(0,z.jsx)(u,{children:`No active partitions`})})]})}function U({notify:e}){let t=s(),{data:n,error:o,loading:l}=d(`/queues`);if(l&&!n)return(0,z.jsx)(c,{});if(o)return(0,z.jsx)(f,{message:o});let p=Array.isArray(n)?n:n?.queues??[],m=async n=>{try{await t.mutateAsync({path:`/queues/${encodeURIComponent(n.queue)}/${n.paused?`resume`:`pause`}`}),e(n.paused?`Queue resumed`:`Queue paused`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`mb-4`,children:[(0,z.jsx)(`h1`,{className:`font-semibold text-lg`,children:`Queues`}),(0,z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Time to drain is the primary backlog signal; infinity means arrivals are outpacing completions.`})]}),p.length?(0,z.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4`,children:p.map(e=>(0,z.jsxs)(M,{children:[(0,z.jsxs)(P,{children:[(0,z.jsx)(E,{className:`min-w-0 flex-1 truncate`,children:e.queue}),e.paused&&(0,z.jsx)(a,{variant:`destructive`,children:`paused`}),(0,z.jsxs)(S,{disabled:i.readOnly||t.isPending,onClick:()=>void m(e),pending:t.isPending&&t.variables?.path.startsWith(`/queues/${encodeURIComponent(e.queue)}/`),pendingLabel:e.paused?`Resuming…`:`Pausing…`,size:`sm`,variant:`outline`,children:[e.paused?(0,z.jsx)(C,{}):(0,z.jsx)(F,{}),e.paused?`Resume`:`Pause`]})]}),(0,z.jsxs)(T,{children:[(0,z.jsx)(`div`,{className:`flex items-center gap-1 font-semibold text-3xl tracking-tight ${e.time_to_drain_ms==null?`text-destructive`:``}`,children:e.time_to_drain_ms==null?(0,z.jsx)(g,{className:`size-8`}):A(e.time_to_drain_ms)}),(0,z.jsxs)(`p`,{className:`mb-3 text-muted-foreground text-xs`,children:[`time to drain · in `,e.arrival_rate.toFixed(1),`/s · out`,` `,e.drain_rate.toFixed(1),`/s`]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[Object.entries(e.by_state??{}).map(([e,t])=>(0,z.jsxs)(a,{variant:`outline`,children:[e,` `,t>=1e4?`≥${t}`:t]},e)),!Object.keys(e.by_state??{}).length&&(0,z.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:`Empty`})]}),(0,z.jsx)(V,{queue:e.queue}),(0,z.jsxs)(r,{className:`mt-3 inline-block text-primary text-sm hover:underline`,search:{queue:e.queue},to:`/jobs`,children:[`View jobs `,(0,z.jsx)(`span`,{"aria-hidden":!0,children:`→`})]})]})]},e.queue))}):(0,z.jsx)(u,{children:`No queues reported`}),(0,z.jsx)(H,{queues:p})]})}function W(){return(0,z.jsx)(U,{...p()})}export{W as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.queues-vpWNbWgx.js b/go/headgateui/dist/assets/_console.queues-vpWNbWgx.js new file mode 100644 index 0000000..a6d8a36 --- /dev/null +++ b/go/headgateui/dist/assets/_console.queues-vpWNbWgx.js @@ -0,0 +1 @@ +import{a as e,s as t,u as n}from"./with-selector-hO0TNhHE.js";import{Yn as r}from"./theme-CN9-NrCi.js";import{C as i,E as a,T as o,X as s,a as c,i as l,l as u,n as d,o as f,r as p,s as m}from"./console-COYwGlau.js";import{I as h,Wt as g,a as _,i as v,o as y,s as b,t as x}from"./chart-QZj6B7U2.js";import{t as S}from"./action-button-DKldNPQD.js";import{t as C}from"./play-B9gqZXeA.js";import{a as w,c as T,d as E,i as D,n as O,o as k,p as A,r as j,s as M,t as N,u as P}from"./table-DtWJ0yY1.js";var F=s(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),I=n(t()),L=[`axis`],R=(0,I.forwardRef)((e,t)=>I.createElement(y,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:L,tooltipPayloadSearcher:h,categoricalChartProps:e,ref:t})),z=e(),B={arrived:{color:`var(--warning)`,label:`Arrived`},completed:{color:`var(--success)`,label:`Completed`}};function V({queue:e}){let t=u([`api`,`queue-history`,e],t=>{let n=Date.now()-72e5;return o(`/queues/${encodeURIComponent(e)}/history?since_ms=${n}&bucket_ms=300000`,{signal:t})}).data??[];return t.length?(0,z.jsxs)(`div`,{className:`mt-3`,children:[(0,z.jsx)(x,{"aria-label":`Arrivals and completions for ${e} over two hours`,className:`aspect-auto h-16 w-full`,config:B,initialDimension:{height:64,width:240},role:`img`,children:(0,z.jsxs)(R,{accessibilityLayer:!0,data:t,margin:{bottom:3,left:3,right:3,top:3},children:[(0,z.jsx)(v,{content:(0,z.jsx)(_,{hideLabel:!0,indicator:`line`})}),(0,z.jsx)(b,{dataKey:`arrived`,dot:!1,isAnimationActive:!1,stroke:`var(--color-arrived)`,strokeWidth:2,type:`monotone`}),(0,z.jsx)(b,{dataKey:`completed`,dot:!1,isAnimationActive:!1,stroke:`var(--color-completed)`,strokeWidth:2,type:`monotone`})]})}),(0,z.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[(0,z.jsx)(`span`,{className:`text-warning`,children:`in`}),` /`,` `,(0,z.jsx)(`span`,{className:`text-success`,children:`out`}),` · 2 hr`]})]}):(0,z.jsx)(`p`,{className:`mt-3 text-muted-foreground text-xs`,children:`No traffic in 2 hours`})}function H({queues:e}){let t=u([`api`,`partitions`,e.slice(0,6).map(({queue:e})=>e)],async t=>(await Promise.all(e.slice(0,6).map(async({queue:e})=>{let n=await o(`/partitions?queue=${encodeURIComponent(e)}`,{signal:t});return(Array.isArray(n)?n:n.partitions??[]).map(t=>({...t,queue:e}))}))).flat(),e.length>0).data??[];return(0,z.jsxs)(M,{className:`mt-4`,children:[(0,z.jsx)(P,{children:(0,z.jsx)(E,{children:`Partition fairness`})}),(0,z.jsx)(T,{children:t.length?(0,z.jsxs)(N,{children:[(0,z.jsx)(w,{children:(0,z.jsxs)(k,{children:[(0,z.jsx)(D,{children:`Queue`}),(0,z.jsx)(D,{children:`Partition`}),(0,z.jsx)(D,{children:`Waiting`}),(0,z.jsx)(D,{children:`Accrued deficit`})]})}),(0,z.jsx)(O,{children:t.map(e=>(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:e.queue}),(0,z.jsx)(j,{className:`font-mono text-xs`,children:e.partition_key||`default`}),(0,z.jsx)(j,{children:e.waiting}),(0,z.jsx)(j,{children:e.deficit})]},`${e.queue}:${e.partition_key}`))})]}):(0,z.jsx)(d,{children:`No active partitions`})})]})}function U({notify:e}){let t=c(),{data:n,error:o,loading:s}=f(`/queues`);if(s&&!n)return(0,z.jsx)(l,{});if(o)return(0,z.jsx)(p,{message:o});let u=Array.isArray(n)?n:n?.queues??[],m=async n=>{try{await t.mutateAsync({path:`/queues/${encodeURIComponent(n.queue)}/${n.paused?`resume`:`pause`}`}),e(n.paused?`Queue resumed`:`Queue paused`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`mb-4`,children:[(0,z.jsx)(`h1`,{className:`font-semibold text-lg`,children:`Queues`}),(0,z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Time to drain is the primary backlog signal; infinity means arrivals are outpacing completions.`})]}),u.length?(0,z.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4`,children:u.map(e=>(0,z.jsxs)(M,{children:[(0,z.jsxs)(P,{children:[(0,z.jsx)(E,{className:`min-w-0 flex-1 truncate`,children:e.queue}),e.paused&&(0,z.jsx)(i,{variant:`destructive`,children:`paused`}),(0,z.jsxs)(S,{disabled:a.readOnly||t.isPending,onClick:()=>void m(e),pending:t.isPending&&t.variables?.path.startsWith(`/queues/${encodeURIComponent(e.queue)}/`),pendingLabel:e.paused?`Resuming…`:`Pausing…`,size:`sm`,variant:`outline`,children:[e.paused?(0,z.jsx)(C,{}):(0,z.jsx)(F,{}),e.paused?`Resume`:`Pause`]})]}),(0,z.jsxs)(T,{children:[(0,z.jsx)(`div`,{className:`flex items-center gap-1 font-semibold text-3xl tracking-tight ${e.time_to_drain_ms==null?`text-destructive`:``}`,children:e.time_to_drain_ms==null?(0,z.jsx)(g,{className:`size-8`}):A(e.time_to_drain_ms)}),(0,z.jsxs)(`p`,{className:`mb-3 text-muted-foreground text-xs`,children:[`time to drain · in `,e.arrival_rate.toFixed(1),`/s · out`,` `,e.drain_rate.toFixed(1),`/s`]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[Object.entries(e.by_state??{}).map(([e,t])=>(0,z.jsxs)(i,{variant:`outline`,children:[e,` `,t>=1e4?`≥${t}`:t]},e)),!Object.keys(e.by_state??{}).length&&(0,z.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:`Empty`})]}),(0,z.jsx)(V,{queue:e.queue}),(0,z.jsxs)(r,{className:`mt-3 inline-block text-primary text-sm hover:underline`,search:{queue:e.queue},to:`/jobs`,children:[`View jobs `,(0,z.jsx)(`span`,{"aria-hidden":!0,children:`→`})]})]})]},e.queue))}):(0,z.jsx)(d,{children:`No queues reported`}),(0,z.jsx)(H,{queues:u})]})}function W(){return(0,z.jsx)(U,{...m()})}export{W as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.rate-classes-Cp7wdm51.js b/go/headgateui/dist/assets/_console.rate-classes-Cp7wdm51.js deleted file mode 100644 index 55246f9..0000000 --- a/go/headgateui/dist/assets/_console.rate-classes-Cp7wdm51.js +++ /dev/null @@ -1 +0,0 @@ -import{c as e,d as t,o as n}from"./utils-o8v-URZ_.js";import{B as r,N as i,S as a,T as o,U as s,_ as c,a as l,b as u,i as d,n as f,o as p,r as m,s as h,v as g,x as _,y as v}from"./console-C2t3Lr2f.js";import{t as y}from"./action-button-DtQnwrt0.js";import{n as b,t as x}from"./progress-BbTEfjhw.js";import{a as S,c as C,d as w,i as T,n as E,o as D,p as O,r as k,s as A,t as j,u as M}from"./table-BngtkqYs.js";var N=t(e(),1),P=n();function F({notify:e}){let{data:t,error:n,loading:i}=p(`/rate-classes`),[a,c]=(0,N.useState)(void 0),l=Array.isArray(t)?t:t?.rate_classes??[];return i&&!t?(0,P.jsx)(d,{}):n?(0,P.jsx)(m,{message:n}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`mb-4`,children:[(0,P.jsx)(`h1`,{className:`font-semibold text-lg`,children:`Rate classes`}),(0,P.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Fleet-wide token budgets are enforced atomically by the store.`})]}),(0,P.jsxs)(A,{children:[(0,P.jsxs)(M,{children:[(0,P.jsx)(w,{className:`flex-1`,children:`Fleet rate classes`}),(0,P.jsx)(r,{disabled:o.readOnly,onClick:()=>c(null),children:`New class`})]}),(0,P.jsx)(C,{children:l.length?(0,P.jsxs)(j,{children:[(0,P.jsx)(S,{children:(0,P.jsxs)(D,{children:[(0,P.jsx)(T,{children:`Name`}),(0,P.jsx)(T,{children:`Budget`}),(0,P.jsx)(T,{children:`Limit`}),(0,P.jsx)(T,{children:`Waiting`}),(0,P.jsx)(T,{children:(0,P.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,P.jsx)(E,{children:l.map(e=>{let t=e.burst?Math.max(0,Math.min(100,e.tokens_available*100/e.burst)):0;return(0,P.jsxs)(D,{children:[(0,P.jsxs)(k,{className:`font-mono text-xs`,children:[e.name,` `,e.paused&&(0,P.jsx)(s,{variant:`destructive`,children:`paused`})]}),(0,P.jsxs)(k,{className:`min-w-48`,children:[(0,P.jsxs)(`div`,{className:`mb-1 text-xs`,children:[e.tokens_available,`/`,e.burst]}),(0,P.jsx)(x,{"aria-label":`${e.name} token budget`,value:t})]}),(0,P.jsxs)(k,{children:[e.limit_per_window,`/`,O(e.window_ms)]}),(0,P.jsx)(k,{children:e.jobs_waiting}),(0,P.jsx)(k,{children:(0,P.jsx)(r,{disabled:o.readOnly,onClick:()=>c(e),size:`sm`,variant:`outline`,children:`Edit`})})]},e.name)})})]}):(0,P.jsx)(f,{children:`No rate classes configured.`})})]}),(0,P.jsx)(I,{close:()=>c(void 0),notify:e,open:a!==void 0,value:a},a===void 0?`closed`:a?.name??`new`)]})}function I({value:e,open:t,close:n,notify:o}){let s=l();return(0,P.jsx)(g,{onOpenChange:e=>!e&&n(),open:t,children:(0,P.jsxs)(v,{className:`inset-auto top-1/2 left-1/2 h-auto max-w-md -translate-x-1/2 -translate-y-1/2 rounded-xl border`,children:[(0,P.jsxs)(_,{children:[(0,P.jsx)(a,{children:e?`Edit ${e.name}`:`New rate class`}),(0,P.jsx)(u,{children:`Configure the shared budget and its operational kill switch.`})]}),(0,P.jsxs)(`form`,{className:`grid gap-4`,onSubmit:async e=>{e.preventDefault();let t=new FormData(e.currentTarget),r=String(t.get(`name`)??``).trim();try{await s.mutateAsync({body:{burst:Number(t.get(`burst`)),limit:Number(t.get(`limit`)),paused:t.get(`paused`)===`on`,window_ms:Number(t.get(`window`))},method:`PUT`,path:`/rate-classes/${encodeURIComponent(r)}`}),o(`Rate class saved`),n()}catch(e){o(e instanceof Error?e.message:String(e),`error`)}},children:[(0,P.jsxs)(`div`,{className:`grid gap-1`,children:[(0,P.jsx)(c,{htmlFor:`rate-name`,children:`Name`}),(0,P.jsx)(i,{defaultValue:e?.name,disabled:!!e,id:`rate-name`,name:`name`,required:!0})]}),(0,P.jsxs)(`div`,{className:`grid gap-1`,children:[(0,P.jsx)(c,{htmlFor:`rate-limit`,children:`Limit per window`}),(0,P.jsx)(i,{defaultValue:e?.limit_per_window??0,id:`rate-limit`,min:`0`,name:`limit`,required:!0,type:`number`})]}),(0,P.jsxs)(`div`,{className:`grid gap-1`,children:[(0,P.jsx)(c,{htmlFor:`rate-window`,children:`Window (milliseconds)`}),(0,P.jsx)(i,{defaultValue:e?.window_ms??1e3,id:`rate-window`,min:`1`,name:`window`,required:!0,type:`number`})]}),(0,P.jsxs)(`div`,{className:`grid gap-1`,children:[(0,P.jsx)(c,{htmlFor:`rate-burst`,children:`Burst`}),(0,P.jsx)(i,{defaultValue:e?.burst??1,id:`rate-burst`,min:`1`,name:`burst`,required:!0,type:`number`})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(b,{defaultChecked:e?.paused,id:`rate-paused`,name:`paused`}),(0,P.jsx)(c,{htmlFor:`rate-paused`,children:`Paused`})]}),(0,P.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,P.jsx)(r,{disabled:s.isPending,onClick:n,type:`button`,variant:`outline`,children:`Cancel`}),(0,P.jsx)(y,{pending:s.isPending,pendingLabel:`Saving…`,type:`submit`,children:`Save`})]})]})]})})}function L(){return(0,P.jsx)(F,{...h()})}export{L as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.rate-classes-DhgcFmCM.js b/go/headgateui/dist/assets/_console.rate-classes-DhgcFmCM.js new file mode 100644 index 0000000..7acec91 --- /dev/null +++ b/go/headgateui/dist/assets/_console.rate-classes-DhgcFmCM.js @@ -0,0 +1 @@ +import{a as e,s as t,u as n}from"./with-selector-hO0TNhHE.js";import{C as r,E as i,P as a,S as o,V as s,_ as c,a as l,b as u,i as d,n as f,o as p,r as m,s as h,v as g,x as _,y as v}from"./console-COYwGlau.js";import{t as y}from"./action-button-DKldNPQD.js";import{n as b,t as x}from"./progress-DIxv1Q_r.js";import{a as S,c as C,d as w,i as T,n as E,o as D,p as O,r as k,s as A,t as j,u as M}from"./table-DtWJ0yY1.js";var N=n(t(),1),P=e();function F({notify:e}){let{data:t,error:n,loading:a}=p(`/rate-classes`),[o,c]=(0,N.useState)(void 0),l=Array.isArray(t)?t:t?.rate_classes??[];return a&&!t?(0,P.jsx)(d,{}):n?(0,P.jsx)(m,{message:n}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`mb-4`,children:[(0,P.jsx)(`h1`,{className:`font-semibold text-lg`,children:`Rate classes`}),(0,P.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Fleet-wide token budgets are enforced atomically by the store.`})]}),(0,P.jsxs)(A,{children:[(0,P.jsxs)(M,{children:[(0,P.jsx)(w,{className:`flex-1`,children:`Fleet rate classes`}),(0,P.jsx)(s,{disabled:i.readOnly,onClick:()=>c(null),children:`New class`})]}),(0,P.jsx)(C,{children:l.length?(0,P.jsxs)(j,{children:[(0,P.jsx)(S,{children:(0,P.jsxs)(D,{children:[(0,P.jsx)(T,{children:`Name`}),(0,P.jsx)(T,{children:`Budget`}),(0,P.jsx)(T,{children:`Limit`}),(0,P.jsx)(T,{children:`Waiting`}),(0,P.jsx)(T,{children:(0,P.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,P.jsx)(E,{children:l.map(e=>{let t=e.burst?Math.max(0,Math.min(100,e.tokens_available*100/e.burst)):0;return(0,P.jsxs)(D,{children:[(0,P.jsxs)(k,{className:`font-mono text-xs`,children:[e.name,` `,e.paused&&(0,P.jsx)(r,{variant:`destructive`,children:`paused`})]}),(0,P.jsxs)(k,{className:`min-w-48`,children:[(0,P.jsxs)(`div`,{className:`mb-1 text-xs`,children:[e.tokens_available,`/`,e.burst]}),(0,P.jsx)(x,{"aria-label":`${e.name} token budget`,value:t})]}),(0,P.jsxs)(k,{children:[e.limit_per_window,`/`,O(e.window_ms)]}),(0,P.jsx)(k,{children:e.jobs_waiting}),(0,P.jsx)(k,{children:(0,P.jsx)(s,{disabled:i.readOnly,onClick:()=>c(e),size:`sm`,variant:`outline`,children:`Edit`})})]},e.name)})})]}):(0,P.jsx)(f,{children:`No rate classes configured.`})})]}),(0,P.jsx)(I,{close:()=>c(void 0),notify:e,open:o!==void 0,value:o},o===void 0?`closed`:o?.name??`new`)]})}function I({value:e,open:t,close:n,notify:r}){let i=l();return(0,P.jsx)(g,{onOpenChange:e=>!e&&n(),open:t,children:(0,P.jsxs)(v,{className:`inset-auto top-1/2 left-1/2 h-auto max-w-md -translate-x-1/2 -translate-y-1/2 rounded-xl border`,children:[(0,P.jsxs)(_,{children:[(0,P.jsx)(o,{children:e?`Edit ${e.name}`:`New rate class`}),(0,P.jsx)(u,{children:`Configure the shared budget and its operational kill switch.`})]}),(0,P.jsxs)(`form`,{className:`grid gap-4`,onSubmit:async e=>{e.preventDefault();let t=new FormData(e.currentTarget),a=String(t.get(`name`)??``).trim();try{await i.mutateAsync({body:{burst:Number(t.get(`burst`)),limit:Number(t.get(`limit`)),paused:t.get(`paused`)===`on`,window_ms:Number(t.get(`window`))},method:`PUT`,path:`/rate-classes/${encodeURIComponent(a)}`}),r(`Rate class saved`),n()}catch(e){r(e instanceof Error?e.message:String(e),`error`)}},children:[(0,P.jsxs)(`div`,{className:`grid gap-1`,children:[(0,P.jsx)(c,{htmlFor:`rate-name`,children:`Name`}),(0,P.jsx)(a,{defaultValue:e?.name,disabled:!!e,id:`rate-name`,name:`name`,required:!0})]}),(0,P.jsxs)(`div`,{className:`grid gap-1`,children:[(0,P.jsx)(c,{htmlFor:`rate-limit`,children:`Limit per window`}),(0,P.jsx)(a,{defaultValue:e?.limit_per_window??0,id:`rate-limit`,min:`0`,name:`limit`,required:!0,type:`number`})]}),(0,P.jsxs)(`div`,{className:`grid gap-1`,children:[(0,P.jsx)(c,{htmlFor:`rate-window`,children:`Window (milliseconds)`}),(0,P.jsx)(a,{defaultValue:e?.window_ms??1e3,id:`rate-window`,min:`1`,name:`window`,required:!0,type:`number`})]}),(0,P.jsxs)(`div`,{className:`grid gap-1`,children:[(0,P.jsx)(c,{htmlFor:`rate-burst`,children:`Burst`}),(0,P.jsx)(a,{defaultValue:e?.burst??1,id:`rate-burst`,min:`1`,name:`burst`,required:!0,type:`number`})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(b,{defaultChecked:e?.paused,id:`rate-paused`,name:`paused`}),(0,P.jsx)(c,{htmlFor:`rate-paused`,children:`Paused`})]}),(0,P.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,P.jsx)(s,{disabled:i.isPending,onClick:n,type:`button`,variant:`outline`,children:`Cancel`}),(0,P.jsx)(y,{pending:i.isPending,pendingLabel:`Saving…`,type:`submit`,children:`Save`})]})]})]})})}function L(){return(0,P.jsx)(F,{...h()})}export{L as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.workers-D-RyPU07.js b/go/headgateui/dist/assets/_console.workers-D-RyPU07.js new file mode 100644 index 0000000..ec58d15 --- /dev/null +++ b/go/headgateui/dist/assets/_console.workers-D-RyPU07.js @@ -0,0 +1 @@ +import{a as e,s as t,u as n}from"./with-selector-hO0TNhHE.js";import{C as r,E as i,a,i as o,n as s,o as c,r as l,s as u}from"./console-COYwGlau.js";import{t as d}from"./action-button-DKldNPQD.js";import{t as f}from"./relative-time-Bzc3eil5.js";import{a as p,c as m,d as h,i as g,m as _,n as v,o as y,r as b,s as x,t as S,u as C}from"./table-DtWJ0yY1.js";var w=n(t(),1);function T(e,t){if(e.pending_command)return`Waiting for the worker to acknowledge ${e.pending_command}.`;let n=e.status??`running`;return n===`restarting`||n===`terminating`?`Worker is ${n}.`:t===`quiet`&&n!==`running`?`Worker is already quiet.`:t===`resume`&&n!==`quiet`?`Resume is available only while the worker is quiet.`:t===`resign`&&e.duties_active===!1?`Worker has already resigned its singleton duties.`:null}var E=e();function D({notify:e}){let t=a(),[n,u]=(0,w.useState)(null),D=c(`/workers`),O=c(`/cluster`);if((D.loading||O.loading)&&!(D.data&&O.data))return(0,E.jsx)(o,{});if(D.error)return(0,E.jsx)(l,{message:D.error});if(O.error)return(0,E.jsx)(l,{message:O.error});let k=Array.isArray(D.data)?D.data:D.data?.workers??[],A=O.data??{},j=(A.queues??[]).filter(e=>!e.live_workers),M=async(n,r)=>{if(!([`restart`,`terminate`].includes(r)&&!window.confirm(`${r===`restart`?`Restart`:`Terminate`} ${n.worker_id}?`))){u(`${n.worker_id}:${r}`);try{await t.mutateAsync({body:{command:r},path:`/workers/${encodeURIComponent(n.worker_id)}/signal`}),e(`Worker command sent: ${r}`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}finally{u(null)}}};return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`mb-4`,children:[(0,E.jsx)(`h1`,{className:`font-semibold text-lg`,children:`Workers`}),(0,E.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Fleet coverage, capacity, and the store-backed control channel.`})]}),(0,E.jsxs)(x,{className:`mb-4`,children:[(0,E.jsx)(C,{children:(0,E.jsx)(h,{children:`Cluster`})}),(0,E.jsxs)(m,{children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,E.jsxs)(r,{variant:`outline`,children:[`workers`,` `,(0,E.jsx)(`strong`,{className:`ml-1`,children:A.workers?.live??0}),` `,`live`]}),(0,E.jsxs)(r,{variant:A.workers?.stale?`destructive`:`outline`,children:[A.workers?.stale??0,` stale`]}),(0,E.jsxs)(r,{variant:`outline`,children:[`slots`,` `,(0,E.jsx)(`strong`,{className:`ml-1`,children:A.inflight_total??0}),`/`,A.capacity_total??0]}),(0,E.jsxs)(r,{variant:`outline`,children:[`utilization`,` `,(0,E.jsx)(`strong`,{className:`ml-1`,children:_(A.utilization)})]}),(0,E.jsxs)(r,{variant:`outline`,children:[`empty polls`,` `,(0,E.jsx)(`strong`,{className:`ml-1`,children:_(A.empty_poll_ratio)})]})]}),(0,E.jsx)(`div`,{className:`mt-3 text-sm`,children:j.length?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{className:`text-destructive`,children:`No live worker for:`}),` `,(0,E.jsx)(`span`,{className:`inline-flex flex-wrap gap-1`,children:j.map(e=>(0,E.jsx)(r,{variant:`destructive`,children:e.queue},e.queue))})]}):(0,E.jsx)(`span`,{className:`text-muted-foreground`,children:`Every known queue has at least one live worker.`})}),(0,E.jsx)(`p`,{className:`mt-3 text-muted-foreground text-xs`,children:`Scale up when utilization is high and time to drain is growing. Scale down when empty polling remains high.`})]})]}),(0,E.jsxs)(x,{children:[(0,E.jsx)(C,{children:(0,E.jsx)(h,{children:`Workers`})}),(0,E.jsx)(m,{children:k.length?(0,E.jsxs)(S,{children:[(0,E.jsx)(p,{children:(0,E.jsxs)(y,{children:[(0,E.jsx)(g,{children:`ID`}),(0,E.jsx)(g,{children:`Host`}),(0,E.jsx)(g,{children:`Queues`}),(0,E.jsx)(g,{children:`Status`}),(0,E.jsx)(g,{children:`Slots`}),(0,E.jsx)(g,{children:`Heartbeat`}),(0,E.jsx)(g,{children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,E.jsx)(v,{children:k.map(e=>(0,E.jsxs)(y,{children:[(0,E.jsx)(b,{className:`font-mono text-xs`,children:e.worker_id}),(0,E.jsx)(b,{children:e.host??`—`}),(0,E.jsx)(b,{children:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(e.queues??[]).map(e=>(0,E.jsx)(r,{variant:`outline`,children:e},e))})}),(0,E.jsx)(b,{children:(0,E.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,E.jsx)(r,{variant:`outline`,children:e.status??`running`}),e.pending_command?(0,E.jsxs)(r,{variant:`secondary`,children:[`pending: `,e.pending_command]}):null,e.duties_active===!1?(0,E.jsx)(r,{variant:`secondary`,children:`duties resigned`}):null]})}),(0,E.jsxs)(b,{children:[e.inflight??0,`/`,e.concurrency]}),(0,E.jsx)(b,{children:(0,E.jsx)(f,{value:e.heartbeat_at_ms})}),(0,E.jsx)(b,{children:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[`quiet`,`resume`,`restart`,`resign`,`terminate`].map(r=>{let a=T(e,r);return(0,E.jsx)(`span`,{title:a??void 0,children:(0,E.jsx)(d,{disabled:i.readOnly||t.isPending||!!a,onClick:()=>void M(e,r),pending:n===`${e.worker_id}:${r}`,pendingLabel:`Sending…`,size:`sm`,variant:r===`terminate`?`destructive`:`outline`,children:r===`restart`?`Rolling restart`:r===`resign`?`Resign duties`:r[0].toUpperCase()+r.slice(1)})},r)})})})]},e.worker_id))})]}):(0,E.jsx)(s,{children:`No live workers.`})})]})]})}function O(){return(0,E.jsx)(D,{...u()})}export{O as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.workers-DrCdQYuK.js b/go/headgateui/dist/assets/_console.workers-DrCdQYuK.js deleted file mode 100644 index 03ccd14..0000000 --- a/go/headgateui/dist/assets/_console.workers-DrCdQYuK.js +++ /dev/null @@ -1 +0,0 @@ -import{c as e,d as t,o as n}from"./utils-o8v-URZ_.js";import{T as r,U as i,a,i as o,n as s,o as c,r as l,s as u}from"./console-C2t3Lr2f.js";import{t as d}from"./action-button-DtQnwrt0.js";import{t as f}from"./relative-time-CtN3x3SY.js";import{a as p,c as m,d as h,i as g,m as _,n as v,o as y,r as b,s as x,t as S,u as C}from"./table-BngtkqYs.js";var w=t(e(),1);function T(e,t){if(e.pending_command)return`Waiting for the worker to acknowledge ${e.pending_command}.`;let n=e.status??`running`;return n===`restarting`||n===`terminating`?`Worker is ${n}.`:t===`quiet`&&n!==`running`?`Worker is already quiet.`:t===`resume`&&n!==`quiet`?`Resume is available only while the worker is quiet.`:t===`resign`&&e.duties_active===!1?`Worker has already resigned its singleton duties.`:null}var E=n();function D({notify:e}){let t=a(),[n,u]=(0,w.useState)(null),D=c(`/workers`),O=c(`/cluster`);if((D.loading||O.loading)&&!(D.data&&O.data))return(0,E.jsx)(o,{});if(D.error)return(0,E.jsx)(l,{message:D.error});if(O.error)return(0,E.jsx)(l,{message:O.error});let k=Array.isArray(D.data)?D.data:D.data?.workers??[],A=O.data??{},j=(A.queues??[]).filter(e=>!e.live_workers),M=async(n,r)=>{if(!([`restart`,`terminate`].includes(r)&&!window.confirm(`${r===`restart`?`Restart`:`Terminate`} ${n.worker_id}?`))){u(`${n.worker_id}:${r}`);try{await t.mutateAsync({body:{command:r},path:`/workers/${encodeURIComponent(n.worker_id)}/signal`}),e(`Worker command sent: ${r}`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}finally{u(null)}}};return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`mb-4`,children:[(0,E.jsx)(`h1`,{className:`font-semibold text-lg`,children:`Workers`}),(0,E.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Fleet coverage, capacity, and the store-backed control channel.`})]}),(0,E.jsxs)(x,{className:`mb-4`,children:[(0,E.jsx)(C,{children:(0,E.jsx)(h,{children:`Cluster`})}),(0,E.jsxs)(m,{children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,E.jsxs)(i,{variant:`outline`,children:[`workers`,` `,(0,E.jsx)(`strong`,{className:`ml-1`,children:A.workers?.live??0}),` `,`live`]}),(0,E.jsxs)(i,{variant:A.workers?.stale?`destructive`:`outline`,children:[A.workers?.stale??0,` stale`]}),(0,E.jsxs)(i,{variant:`outline`,children:[`slots`,` `,(0,E.jsx)(`strong`,{className:`ml-1`,children:A.inflight_total??0}),`/`,A.capacity_total??0]}),(0,E.jsxs)(i,{variant:`outline`,children:[`utilization`,` `,(0,E.jsx)(`strong`,{className:`ml-1`,children:_(A.utilization)})]}),(0,E.jsxs)(i,{variant:`outline`,children:[`empty polls`,` `,(0,E.jsx)(`strong`,{className:`ml-1`,children:_(A.empty_poll_ratio)})]})]}),(0,E.jsx)(`div`,{className:`mt-3 text-sm`,children:j.length?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{className:`text-destructive`,children:`No live worker for:`}),` `,(0,E.jsx)(`span`,{className:`inline-flex flex-wrap gap-1`,children:j.map(e=>(0,E.jsx)(i,{variant:`destructive`,children:e.queue},e.queue))})]}):(0,E.jsx)(`span`,{className:`text-muted-foreground`,children:`Every known queue has at least one live worker.`})}),(0,E.jsx)(`p`,{className:`mt-3 text-muted-foreground text-xs`,children:`Scale up when utilization is high and time to drain is growing. Scale down when empty polling remains high.`})]})]}),(0,E.jsxs)(x,{children:[(0,E.jsx)(C,{children:(0,E.jsx)(h,{children:`Workers`})}),(0,E.jsx)(m,{children:k.length?(0,E.jsxs)(S,{children:[(0,E.jsx)(p,{children:(0,E.jsxs)(y,{children:[(0,E.jsx)(g,{children:`ID`}),(0,E.jsx)(g,{children:`Host`}),(0,E.jsx)(g,{children:`Queues`}),(0,E.jsx)(g,{children:`Status`}),(0,E.jsx)(g,{children:`Slots`}),(0,E.jsx)(g,{children:`Heartbeat`}),(0,E.jsx)(g,{children:(0,E.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,E.jsx)(v,{children:k.map(e=>(0,E.jsxs)(y,{children:[(0,E.jsx)(b,{className:`font-mono text-xs`,children:e.worker_id}),(0,E.jsx)(b,{children:e.host??`—`}),(0,E.jsx)(b,{children:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(e.queues??[]).map(e=>(0,E.jsx)(i,{variant:`outline`,children:e},e))})}),(0,E.jsx)(b,{children:(0,E.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,E.jsx)(i,{variant:`outline`,children:e.status??`running`}),e.pending_command?(0,E.jsxs)(i,{variant:`secondary`,children:[`pending: `,e.pending_command]}):null,e.duties_active===!1?(0,E.jsx)(i,{variant:`secondary`,children:`duties resigned`}):null]})}),(0,E.jsxs)(b,{children:[e.inflight??0,`/`,e.concurrency]}),(0,E.jsx)(b,{children:(0,E.jsx)(f,{value:e.heartbeat_at_ms})}),(0,E.jsx)(b,{children:(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[`quiet`,`resume`,`restart`,`resign`,`terminate`].map(i=>{let a=T(e,i);return(0,E.jsx)(`span`,{title:a??void 0,children:(0,E.jsx)(d,{disabled:r.readOnly||t.isPending||!!a,onClick:()=>void M(e,i),pending:n===`${e.worker_id}:${i}`,pendingLabel:`Sending…`,size:`sm`,variant:i===`terminate`?`destructive`:`outline`,children:i===`restart`?`Rolling restart`:i===`resign`?`Resign duties`:i[0].toUpperCase()+i.slice(1)})},i)})})})]},e.worker_id))})]}):(0,E.jsx)(s,{children:`No live workers.`})})]})]})}function O(){return(0,E.jsx)(D,{...u()})}export{O as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.workflows-De2OTveu.js b/go/headgateui/dist/assets/_console.workflows-De2OTveu.js new file mode 100644 index 0000000..900ce6c --- /dev/null +++ b/go/headgateui/dist/assets/_console.workflows-De2OTveu.js @@ -0,0 +1 @@ +import{a as e}from"./with-selector-hO0TNhHE.js";import{s as t}from"./console-COYwGlau.js";import{n}from"./workflows-Ci3f-4XF.js";var r=e();function i(){return(0,r.jsx)(n,{...t()})}export{i as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.workflows-XIi2cJnF.js b/go/headgateui/dist/assets/_console.workflows-XIi2cJnF.js deleted file mode 100644 index 1248432..0000000 --- a/go/headgateui/dist/assets/_console.workflows-XIi2cJnF.js +++ /dev/null @@ -1 +0,0 @@ -import{o as e}from"./utils-o8v-URZ_.js";import{s as t}from"./console-C2t3Lr2f.js";import{n}from"./workflows-Dw8XMSyI.js";var r=e();function i(){return(0,r.jsx)(n,{...t()})}export{i as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.workflows_._workflowId-BeezXsKr.js b/go/headgateui/dist/assets/_console.workflows_._workflowId-BeezXsKr.js deleted file mode 100644 index 5db54ae..0000000 --- a/go/headgateui/dist/assets/_console.workflows_._workflowId-BeezXsKr.js +++ /dev/null @@ -1 +0,0 @@ -import{o as e}from"./utils-o8v-URZ_.js";import{s as t}from"./console-C2t3Lr2f.js";import{t as n}from"./index-B8M4ltzK.js";import{t as r}from"./workflows-Dw8XMSyI.js";import{t as i}from"./jobs-CWBl3QlV.js";var a=e();function o(){let{workflowId:e}=n.useParams(),{selected:o}=n.useSearch(),s=n.useNavigate(),c=t();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r,{selectedJobID:o,workflowId:e,...c}),(0,a.jsx)(i,{id:o??null,notify:c.notify,open:!!o,setOpen:e=>{e||s({search:e=>({...e,selected:void 0}),replace:!0})}})]})}export{o as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/_console.workflows_._workflowId-DZZPa3z2.js b/go/headgateui/dist/assets/_console.workflows_._workflowId-DZZPa3z2.js new file mode 100644 index 0000000..9895d45 --- /dev/null +++ b/go/headgateui/dist/assets/_console.workflows_._workflowId-DZZPa3z2.js @@ -0,0 +1 @@ +import{a as e}from"./with-selector-hO0TNhHE.js";import{s as t}from"./console-COYwGlau.js";import{t as n}from"./index-D8-0FUBj.js";import{t as r}from"./workflows-Ci3f-4XF.js";import{t as i}from"./jobs-DEyFN2Bl.js";var a=e();function o(){let{workflowId:e}=n.useParams(),{selected:o}=n.useSearch(),s=n.useNavigate(),c=t();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r,{selectedJobID:o,workflowId:e,...c}),(0,a.jsx)(i,{id:o??null,notify:c.notify,open:!!o,setOpen:e=>{e||s({search:e=>({...e,selected:void 0}),replace:!0})},workflowId:e})]})}export{o as component}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/action-button-DKldNPQD.js b/go/headgateui/dist/assets/action-button-DKldNPQD.js new file mode 100644 index 0000000..d22aec5 --- /dev/null +++ b/go/headgateui/dist/assets/action-button-DKldNPQD.js @@ -0,0 +1 @@ +import{a as e}from"./with-selector-hO0TNhHE.js";import{V as t,X as n}from"./console-COYwGlau.js";var r=n(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),i=e();function a({children:e,disabled:n,pending:a=!1,pendingLabel:o=`Working…`,...s}){return(0,i.jsx)(t,{"aria-busy":a||void 0,disabled:n||a,...s,children:a?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r,{className:`animate-spin motion-reduce:animate-none`}),o]}):e})}export{a as t}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/action-button-DtQnwrt0.js b/go/headgateui/dist/assets/action-button-DtQnwrt0.js deleted file mode 100644 index d6b377e..0000000 --- a/go/headgateui/dist/assets/action-button-DtQnwrt0.js +++ /dev/null @@ -1 +0,0 @@ -import{o as e}from"./utils-o8v-URZ_.js";import{B as t,X as n}from"./console-C2t3Lr2f.js";var r=n(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),i=e();function a({children:e,disabled:n,pending:a=!1,pendingLabel:o=`Working…`,...s}){return(0,i.jsx)(t,{"aria-busy":a||void 0,disabled:n||a,...s,children:a?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r,{className:`animate-spin motion-reduce:animate-none`}),o]}):e})}export{a as t}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/chart-CAYbmpTK.js b/go/headgateui/dist/assets/chart-QZj6B7U2.js similarity index 88% rename from go/headgateui/dist/assets/chart-CAYbmpTK.js rename to go/headgateui/dist/assets/chart-QZj6B7U2.js index 78fcd5d..a380bff 100644 --- a/go/headgateui/dist/assets/chart-CAYbmpTK.js +++ b/go/headgateui/dist/assets/chart-QZj6B7U2.js @@ -1,10 +1,10 @@ -import{c as e,d as t,l as n,n as r,o as i,s as a,t as o,u as s}from"./utils-o8v-URZ_.js";import{W as c,X as l}from"./console-C2t3Lr2f.js";import{r as u,t as d}from"./value-8xOwwyZS.js";function f(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function p(e,t){t===void 0&&(t=e,e=d);for(var n=0,r=t.length-1,i=t[0],a=Array(r<0?0:r);n{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:l,desc:u}=e,d=O(e,E),f=a||{width:r,height:i,x:0,y:0},p=c(`recharts-surface`,o);return h.createElement(`svg`,D({},w(d),{className:p,width:r,height:i,style:s,viewBox:`${f.x} ${f.y} ${f.width} ${f.height}`,ref:t}),h.createElement(`title`,null,l),h.createElement(`desc`,null,u),n)}),te=[`children`,`className`];function A(){return A=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,className:r}=e,i=j(e,te),a=c(`recharts-layer`,r);return h.createElement(`g`,A({className:a},w(i),{ref:t}),n)}),ie=(0,h.createContext)(null),ae=()=>(0,h.useContext)(ie);function M(e){return function(){return e}}var oe=Math.cos,se=Math.sin,ce=Math.sqrt,le=Math.PI;le/2;var ue=2*le,de=Math.PI,fe=2*de,pe=1e-6,me=fe-pe;function he(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return he;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tpe){if(!(Math.abs(u*s-c*l)>pe)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((de-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>pe&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>pe||Math.abs(this._y1-l)>pe)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%fe+fe),d>me?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>pe&&this._append`A${n},${n},0,${+(d>=de)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};_e.prototype;function ve(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new _e(t)}Array.prototype.slice;function ye(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function be(e){this._context=e}be.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function xe(e){return new be(e)}function Se(e){return e[0]}function Ce(e){return e[1]}function we(e,t){var n=M(!0),r=null,i=xe,a=null,o=ve(s);e=typeof e==`function`?e:e===void 0?Se:M(e),t=typeof t==`function`?t:t===void 0?Ce:M(t);function s(s){var c,l=(s=ye(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return we().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:M(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:M(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:M(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:M(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:M(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:M(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:M(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var Ee=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function De(e){return new Ee(e,!0)}function Oe(e){return new Ee(e,!1)}var ke={draw(e,t){let n=ce(t/le);e.moveTo(n,0),e.arc(0,0,n,0,ue)}},Ae={draw(e,t){let n=ce(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},je=ce(1/3),Me=je*2,Ne={draw(e,t){let n=ce(t/Me),r=n*je;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},Pe={draw(e,t){let n=ce(t),r=-n/2;e.rect(r,r,n,n)}},Fe=.8908130915292852,Ie=se(le/10)/se(7*le/10),Le=se(ue/10)*Ie,Re=-oe(ue/10)*Ie,ze={draw(e,t){let n=ce(t*Fe),r=Le*n,i=Re*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=ue*t/5,o=oe(a),s=se(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},Be=ce(3),Ve={draw(e,t){let n=-ce(t/(Be*3));e.moveTo(0,n*2),e.lineTo(-Be*n,-n),e.lineTo(Be*n,-n),e.closePath()}},He=-.5,Ue=ce(3)/2,We=1/ce(12),Ge=(We/2+1)*3,Ke={draw(e,t){let n=ce(t/Ge),r=n/2,i=n*We,a=r,o=n*We+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(He*r-Ue*i,Ue*r+He*i),e.lineTo(He*a-Ue*o,Ue*a+He*o),e.lineTo(He*s-Ue*c,Ue*s+He*c),e.lineTo(He*r+Ue*i,He*i-Ue*r),e.lineTo(He*a+Ue*o,He*o-Ue*a),e.lineTo(He*s+Ue*c,He*c-Ue*s),e.closePath()}};function qe(e,t){let n=null,r=ve(i);e=typeof e==`function`?e:M(e||ke),t=typeof t==`function`?t:M(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:M(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:M(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function Je(){}function Ye(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Xe(e){this._context=e}Xe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ye(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ye(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Ze(e){return new Xe(e)}function Qe(e){this._context=e}Qe.prototype={areaStart:Je,areaEnd:Je,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Ye(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function $e(e){return new Qe(e)}function et(e){this._context=e}et.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Ye(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function tt(e){return new et(e)}function nt(e){this._context=e}nt.prototype={areaStart:Je,areaEnd:Je,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function rt(e){return new nt(e)}function it(e){return e<0?-1:1}function at(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(it(a)+it(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function ot(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function st(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function ct(e){this._context=e}ct.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:st(this,this._t0,ot(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,st(this,ot(this,n=at(this,e,t)),n);break;default:st(this,this._t0,n=at(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function lt(e){this._context=new ut(e)}(lt.prototype=Object.create(ct.prototype)).point=function(e,t){ct.prototype.point.call(this,t,e)};function ut(e){this._context=e}ut.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function dt(e){return new ct(e)}function ft(e){return new lt(e)}function pt(e){this._context=e}pt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=mt(e),i=mt(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function _t(e){return new gt(e,.5)}function vt(e){return new gt(e,0)}function yt(e){return new gt(e,1)}function bt(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function St(e,t){return e[t]}function Ct(e){let t=[];return t.key=e,t}function wt(){var e=M([]),t=xt,n=bt,r=St;function i(i){var a=Array.from(e.apply(this,arguments),Ct),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r1&&arguments[1]!==void 0?arguments[1]:Rt),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function N(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+zt(i)+n},``)}var Bt=e=>e===0?0:e>0?1:-1,Vt=e=>typeof e==`number`&&e!=+e,Ht=e=>typeof e==`string`&&e.indexOf(`%`)===e.length-1,P=e=>(typeof e==`number`||e instanceof Number)&&!Vt(e),Ut=e=>P(e)||typeof e==`string`,Wt=0,Gt=e=>{var t=++Wt;return`${e||``}${t}`},Kt=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!P(e)&&typeof e!=`string`)return n;var i;if(Ht(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return Vt(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},qt=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&(typeof t==`function`?t(e):It(e,t))===n)}var F=e=>e==null,Xt=e=>F(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function Zt(e){return e!=null}function Qt(){}var $t=[`type`,`size`,`sizeType`];function en(){return en=Object.assign?Object.assign.bind():function(e){for(var t=1;tln[`symbol${Xt(e)}`]||ke,fn=(e,t,n)=>{if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*un;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},pn=(e,t)=>{ln[`symbol${Xt(e)}`]=t},mn=e=>{var{type:t=`circle`,size:n=64,sizeType:r=`area`}=e,i=nn(nn({},sn(e,$t)),{},{type:t,size:n,sizeType:r}),a=`circle`;typeof t==`string`&&(a=t);var o=()=>{var e=dn(a),t=qe().type(e).size(fn(n,r,a))();if(t!==null)return t},{className:s,cx:l,cy:u}=i,d=w(i);return P(l)&&P(u)&&P(n)?h.createElement(`path`,en({},d,{className:c(`recharts-symbols`,s),transform:`translate(${l}, ${u})`,d:o()})):null};mn.registerSymbol=pn;var hn=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,gn=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,h.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{v(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},_n=(e,t,n)=>r=>(e(t,n,r),null),vn=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];v(i)&&typeof a==`function`&&(r||={},r[i]=_n(a,t,n))}),r};function yn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bn(e){for(var t=1;t(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function Tn(){return Tn=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:l,desc:u}=e,d=O(e,E),f=a||{width:r,height:i,x:0,y:0},p=c(`recharts-surface`,o);return h.createElement(`svg`,D({},w(d),{className:p,width:r,height:i,style:s,viewBox:`${f.x} ${f.y} ${f.width} ${f.height}`,ref:t}),h.createElement(`title`,null,l),h.createElement(`desc`,null,u),n)}),te=[`children`,`className`];function A(){return A=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:n,className:r}=e,i=j(e,te),a=c(`recharts-layer`,r);return h.createElement(`g`,A({className:a},w(i),{ref:t}),n)}),ie=(0,h.createContext)(null),ae=()=>(0,h.useContext)(ie);function M(e){return function(){return e}}var oe=Math.cos,se=Math.sin,ce=Math.sqrt,le=Math.PI;le/2;var ue=2*le,de=Math.PI,fe=2*de,pe=1e-6,me=fe-pe;function he(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return he;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tpe){if(!(Math.abs(u*s-c*l)>pe)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((de-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>pe&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>pe||Math.abs(this._y1-l)>pe)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%fe+fe),d>me?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>pe&&this._append`A${n},${n},0,${+(d>=de)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};_e.prototype;function ve(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new _e(t)}Array.prototype.slice;function ye(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function be(e){this._context=e}be.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function xe(e){return new be(e)}function Se(e){return e[0]}function Ce(e){return e[1]}function we(e,t){var n=M(!0),r=null,i=xe,a=null,o=ve(s);e=typeof e==`function`?e:e===void 0?Se:M(e),t=typeof t==`function`?t:t===void 0?Ce:M(t);function s(s){var c,l=(s=ye(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return we().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:M(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:M(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:M(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:M(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:M(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:M(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:M(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var Ee=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function De(e){return new Ee(e,!0)}function Oe(e){return new Ee(e,!1)}var ke={draw(e,t){let n=ce(t/le);e.moveTo(n,0),e.arc(0,0,n,0,ue)}},Ae={draw(e,t){let n=ce(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},je=ce(1/3),Me=je*2,Ne={draw(e,t){let n=ce(t/Me),r=n*je;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},Pe={draw(e,t){let n=ce(t),r=-n/2;e.rect(r,r,n,n)}},Fe=.8908130915292852,Ie=se(le/10)/se(7*le/10),Le=se(ue/10)*Ie,Re=-oe(ue/10)*Ie,ze={draw(e,t){let n=ce(t*Fe),r=Le*n,i=Re*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=ue*t/5,o=oe(a),s=se(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},Be=ce(3),Ve={draw(e,t){let n=-ce(t/(Be*3));e.moveTo(0,n*2),e.lineTo(-Be*n,-n),e.lineTo(Be*n,-n),e.closePath()}},He=-.5,Ue=ce(3)/2,We=1/ce(12),Ge=(We/2+1)*3,Ke={draw(e,t){let n=ce(t/Ge),r=n/2,i=n*We,a=r,o=n*We+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(He*r-Ue*i,Ue*r+He*i),e.lineTo(He*a-Ue*o,Ue*a+He*o),e.lineTo(He*s-Ue*c,Ue*s+He*c),e.lineTo(He*r+Ue*i,He*i-Ue*r),e.lineTo(He*a+Ue*o,He*o-Ue*a),e.lineTo(He*s+Ue*c,He*c-Ue*s),e.closePath()}};function qe(e,t){let n=null,r=ve(i);e=typeof e==`function`?e:M(e||ke),t=typeof t==`function`?t:M(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:M(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:M(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function Je(){}function Ye(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Xe(e){this._context=e}Xe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ye(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ye(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Ze(e){return new Xe(e)}function Qe(e){this._context=e}Qe.prototype={areaStart:Je,areaEnd:Je,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Ye(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function $e(e){return new Qe(e)}function et(e){this._context=e}et.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Ye(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function tt(e){return new et(e)}function nt(e){this._context=e}nt.prototype={areaStart:Je,areaEnd:Je,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function rt(e){return new nt(e)}function it(e){return e<0?-1:1}function at(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(it(a)+it(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function ot(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function st(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function ct(e){this._context=e}ct.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:st(this,this._t0,ot(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,st(this,ot(this,n=at(this,e,t)),n);break;default:st(this,this._t0,n=at(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function lt(e){this._context=new ut(e)}(lt.prototype=Object.create(ct.prototype)).point=function(e,t){ct.prototype.point.call(this,t,e)};function ut(e){this._context=e}ut.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function dt(e){return new ct(e)}function ft(e){return new lt(e)}function pt(e){this._context=e}pt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=mt(e),i=mt(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function _t(e){return new gt(e,.5)}function vt(e){return new gt(e,0)}function yt(e){return new gt(e,1)}function bt(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function St(e,t){return e[t]}function Ct(e){let t=[];return t.key=e,t}function wt(){var e=M([]),t=xt,n=bt,r=St;function i(i){var a=Array.from(e.apply(this,arguments),Ct),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r1&&arguments[1]!==void 0?arguments[1]:Rt),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function N(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+zt(i)+n},``)}var Bt=e=>e===0?0:e>0?1:-1,Vt=e=>typeof e==`number`&&e!=+e,Ht=e=>typeof e==`string`&&e.indexOf(`%`)===e.length-1,P=e=>(typeof e==`number`||e instanceof Number)&&!Vt(e),Ut=e=>P(e)||typeof e==`string`,Wt=0,Gt=e=>{var t=++Wt;return`${e||``}${t}`},Kt=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!P(e)&&typeof e!=`string`)return n;var i;if(Ht(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return Vt(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},qt=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&(typeof t==`function`?t(e):It(e,t))===n)}var F=e=>e==null,Xt=e=>F(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function Zt(e){return e!=null}function Qt(){}var $t=[`type`,`size`,`sizeType`];function en(){return en=Object.assign?Object.assign.bind():function(e){for(var t=1;tln[`symbol${Xt(e)}`]||ke,fn=(e,t,n)=>{if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*un;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},pn=(e,t)=>{ln[`symbol${Xt(e)}`]=t},mn=e=>{var{type:t=`circle`,size:n=64,sizeType:r=`area`}=e,i=nn(nn({},sn(e,$t)),{},{type:t,size:n,sizeType:r}),a=`circle`;typeof t==`string`&&(a=t);var o=()=>{var e=dn(a),t=qe().type(e).size(fn(n,r,a))();if(t!==null)return t},{className:s,cx:l,cy:u}=i,d=w(i);return P(l)&&P(u)&&P(n)?h.createElement(`path`,en({},d,{className:c(`recharts-symbols`,s),transform:`translate(${l}, ${u})`,d:o()})):null};mn.registerSymbol=pn;var hn=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,gn=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,h.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{v(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},_n=(e,t,n)=>r=>(e(t,n,r),null),vn=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];v(i)&&typeof a==`function`&&(r||={},r[i]=_n(a,t,n))}),r};function yn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bn(e){for(var t=1;t(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function Tn(){return Tn=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var f=t.formatter||i,p=c({"recharts-legend-item":!0,[`legend-item-${r}`]:!0,inactive:t.inactive});if(t.type===`none`)return null;var m=typeof s==`object`?Dn({},s):{};m.color=t.inactive?a:m.color||t.color;var g=f?f(t.value,t,r):t.value;return h.createElement(`li`,Tn({className:p,style:u,key:`legend-item-${r}`},vn(e,t,r)),h.createElement(ee,{width:n,height:n,viewBox:l,style:d,"aria-label":`${g} legend icon`},h.createElement(Pn,{data:t,iconType:o,inactiveColor:a})),h.createElement(`span`,{className:`recharts-legend-item-text`,style:m},g))})}var In=e=>{var t=wn(e,Mn),{payload:n,layout:r,align:i}=t;if(!n||!n.length)return null;var a={padding:0,margin:0,textAlign:r===`horizontal`?i:`left`};return h.createElement(`ul`,{className:`recharts-default-legend`,style:a},h.createElement(Fn,Tn({},t,{payload:n})))};function Ln(e,t){let n=new Map;for(let r=0;r=0}function Vn(e){return e!=null&&typeof e!=`function`&&Bn(e.length)}function Hn(e){return function(t){return It(t,e)}}function Un(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function Wn(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Gn(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function Kn(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var qn=`[object RegExp]`,Jn=`[object String]`,Yn=`[object Number]`,Xn=`[object Boolean]`,Zn=`[object Arguments]`,Qn=`[object Symbol]`,$n=`[object Date]`,er=`[object Map]`,tr=`[object Set]`,nr=`[object Array]`,rr=`[object ArrayBuffer]`,ir=`[object Object]`,ar=`[object DataView]`,or=`[object Uint8Array]`,sr=`[object Uint8ClampedArray]`,cr=`[object Uint16Array]`,lr=`[object Uint32Array]`,ur=`[object Int8Array]`,dr=`[object Int16Array]`,fr=`[object Int32Array]`,pr=`[object Float32Array]`,mr=`[object Float64Array]`,hr=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function gr(e){return hr.Buffer!==void 0&&hr.Buffer.isBuffer(e)}function _r(e,t){return vr(e,void 0,e,new Map,t)}function vr(e,t,n,r=new Map,i=void 0){let a=i?.(e,t,n,r);if(a!==void 0)return a;if(Un(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;avoid 0)}function Tr(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return Er(e,t,n,r,i);case`function`:return Object.keys(t).length>0?Tr(e,{...t},n,r,i):Sr(e,t);default:return Cr(e)&&i?typeof t!=`string`||t===``:Sr(e,t)}}function Er(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return Or(e,t,n,r);if(t instanceof Map)return Dr(e,t,n,r);if(t instanceof Set)return kr(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)Un(e)&&(e=Object(e));else{let t=Kn(e);if(t!==`[object Object]`&&t!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;ivoid 0)}function jr(e){return e=xr(e),t=>Ar(t,e)}function Mr(e,t){return _r(e,(n,r,i,a)=>{let o=t?.(n,r,i,a);if(o!==void 0)return o;if(typeof e==`object`){if(Kn(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return a.set(e,t),yr(t,e,i,a),t}switch(Object.prototype.toString.call(e)){case Yn:case Jn:case Xn:{let t=new e.constructor(e?.valueOf());return yr(t,e),t}case Zn:{let t={};return yr(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function Nr(e){return Mr(e)}var Pr=/^(?:0|[1-9]\d*)$/;function Fr(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&ee,I=()=>{var e=(0,h.useContext)(Wr);return e?e.store.dispatch:Gr},Kr=()=>{},qr=()=>Kr,Jr=(e,t)=>e===t;function L(e){var t=(0,h.useContext)(Wr),n=(0,h.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:Kr,[t,e]);return(0,Ur.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:qr,t?t.store.getState:Kr,t?t.store.getState:Kr,n,Jr)}function Yr(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function Xr(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function Zr(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var Qr=e=>Array.isArray(e)?e:[e];function $r(e){let t=Array.isArray(e[0])?e[0]:e;return Zr(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function ei(e,t){let n=[],{length:r}=e;for(let i=0;i{n=ai(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function si(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),Yr(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=oi,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=Qr(c),p=Qr(u),m=$r(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=ei(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var R=si(oi),ci=Object.assign((e,t=R)=>{Xr(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>ci});function li(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a{if(e!==t){let r=di(e),i=di(t);if(r===i&&r===0){if(et)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},pi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mi=/^\w*$/;function hi(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||Mt(e)?!0:typeof e==`string`&&(mi.test(e)||!pi.test(e))||t!=null&&Object.hasOwn(t,e)}function gi(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=Vn(e)?Array.from(e):Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||hi(e)?e:{key:e,path:Ft(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;re.original)}function _i(e,...t){let n=t.length;return n>1&&ui(e,t[0],t[1])?t=[]:n>2&&ui(t[0],t[1],t[2])&&(t=[t[0]]),gi(e,li(t),[`asc`])}var vi=e=>e.legend.settings,yi=e=>e.legend.size,bi=R([e=>e.legend.payload,vi],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?_i(r,n):r});function xi(){return L(bi)}var Si=1;function Ci(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=(0,h.useState)({height:0,left:0,top:0,width:0});return[t,(0,h.useCallback)(e=>{if(e!=null){var r=e.getBoundingClientRect(),i={height:r.height,left:r.left,top:r.top,width:r.width};(Math.abs(i.height-t.height)>Si||Math.abs(i.left-t.left)>Si||Math.abs(i.top-t.top)>Si||Math.abs(i.width-t.width)>Si)&&n({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e])]}function z(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var wi=typeof Symbol==`function`&&Symbol.observable||`@@observable`,Ti=()=>Math.random().toString(36).substring(7).split(``).join(`.`),Ei={INIT:`@@redux/INIT${Ti()}`,REPLACE:`@@redux/REPLACE${Ti()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ti()}`};function Di(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Oi(e,t,n){if(typeof e!=`function`)throw Error(z(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(z(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(z(1));return n(Oi)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(z(3));return i}function d(e){if(typeof e!=`function`)throw Error(z(4));if(c)throw Error(z(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(z(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!Di(e))throw Error(z(7));if(e.type===void 0)throw Error(z(8));if(typeof e.type!=`string`)throw Error(z(17));if(c)throw Error(z(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(z(10));r=e,f({type:Ei.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(z(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[wi](){return this}}}return f({type:Ei.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[wi]:m}}function ki(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:Ei.INIT})===void 0)throw Error(z(12));if(n(void 0,{type:Ei.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(z(13))})}function Ai(e){let t=Object.keys(e),n={};for(let r=0;re:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function Mi(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(z(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=ji(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function Ni(e){return Di(e)&&`type`in e&&typeof e.type==`string`}var Pi=Symbol.for(`immer-nothing`),Fi=Symbol.for(`immer-draftable`),Ii=Symbol.for(`immer-state`);function Li(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ri=Object,zi=Ri.getPrototypeOf,Bi=`constructor`,Vi=`prototype`,Hi=`configurable`,Ui=`enumerable`,Wi=`writable`,Gi=`value`,Ki=e=>!!e&&!!e[Ii];function qi(e){return e?Xi(e)||ra(e)||!!e[Fi]||!!e[Bi]?.[Fi]||ia(e)||aa(e):!1}var Ji=Ri[Vi][Bi].toString(),Yi=new WeakMap;function Xi(e){if(!e||!oa(e))return!1;let t=zi(e);if(t===null||t===Ri[Vi])return!0;let n=Ri.hasOwnProperty.call(t,Bi)&&t[Bi];if(n===Object)return!0;if(!sa(n))return!1;let r=Yi.get(n);return r===void 0&&(r=Function.toString.call(n),Yi.set(n,r)),r===Ji}function Zi(e,t,n=!0){Qi(e)===0?(n?Reflect.ownKeys(e):Ri.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Qi(e){let t=e[Ii];return t?t.type_:ra(e)?1:ia(e)?2:aa(e)?3:0}var $i=(e,t,n=Qi(e))=>n===2?e.has(t):Ri[Vi].hasOwnProperty.call(e,t),ea=(e,t,n=Qi(e))=>n===2?e.get(t):e[t],ta=(e,t,n,r=Qi(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function na(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var ra=Array.isArray,ia=e=>e instanceof Map,aa=e=>e instanceof Set,oa=e=>typeof e==`object`,sa=e=>typeof e==`function`,ca=e=>typeof e==`boolean`;function la(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var ua=e=>e.copy_||e.base_,da=e=>e.modified_?e.copy_:e.base_;function fa(e,t){if(ia(e))return new Map(e);if(aa(e))return new Set(e);if(ra(e))return Array[Vi].slice.call(e);let n=Xi(e);if(t===!0||t===`class_only`&&!n){let t=Ri.getOwnPropertyDescriptors(e);delete t[Ii];let n=Reflect.ownKeys(t);for(let r=0;r1&&Ri.defineProperties(e,{set:ha,add:ha,clear:ha,delete:ha}),Ri.freeze(e),t&&Zi(e,(e,t)=>{pa(t,!0)},!1),e)}function ma(){Li(2)}var ha={[Gi]:ma};function ga(e){return e===null||!oa(e)||Ri.isFrozen(e)}var _a=`MapSet`,va=`Patches`,ya=`ArrayMethods`,ba={};function xa(e){let t=ba[e];return t||Li(0,e),t}var Sa=e=>!!ba[e],Ca,wa=()=>Ca,Ta=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Sa(_a)?xa(_a):void 0,arrayMethodsPlugin_:Sa(ya)?xa(ya):void 0});function Ea(e,t){t&&(e.patchPlugin_=xa(va),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Da(e){Oa(e),e.drafts_.forEach(Aa),e.drafts_=null}function Oa(e){e===Ca&&(Ca=e.parent_)}var ka=e=>Ca=Ta(Ca,e);function Aa(e){let t=e[Ii];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function ja(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[Ii].modified_&&(Da(t),Li(4)),qi(e)&&(e=Ma(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[Ii].base_,e,t)}else e=Ma(t,n);return Na(t,e,!0),Da(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===Pi?void 0:e}function Ma(e,t){if(ga(t))return t;let n=t[Ii];if(!n)return Va(t,e.handledSet_,e);if(!Fa(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);za(n,e)}return n.copy_}function Na(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&pa(t,n)}function Pa(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Fa=(e,t)=>e.scope_===t,Ia=[];function La(e,t,n,r){let i=ua(e),a=e.type_;if(r!==void 0&&ea(i,r,a)===t){ta(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;Zi(i,(e,n)=>{if(Ki(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??Ia;for(let e of o)ta(i,e,n,a)}function Ra(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!Fa(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=da(i);La(e,i.draft_??i,a,n),za(i,r)})}function za(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}Pa(e)}}function Ba(e,t,n){let{scope_:r}=e;if(Ki(n)){let i=n[Ii];Fa(i,r)&&i.callbacks_.push(function(){Xa(e),La(e,n,da(i),t)})}else qi(n)&&e.callbacks_.push(function(){let i=ua(e);e.type_===3?i.has(n)&&Va(n,r.handledSet_,r):ea(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Va(ea(e.copy_,t,e.type_),r.handledSet_,r)})}function Va(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Ki(e)||t.has(e)||!qi(e)||ga(e)?e:(t.add(e),Zi(e,(r,i)=>{if(Ki(i)){let t=i[Ii];Fa(t,n)&&(ta(e,r,da(t),e.type_),Pa(t))}else qi(i)&&Va(i,t,n)}),e)}function Ha(e,t){let n=ra(e),r={type_:+!!n,scope_:t?t.scope_:wa(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=Ua;n&&(i=[r],a=Wa);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var Ua={get(e,t){if(t===Ii)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=ua(e);if(!$i(i,t,e.type_))return qa(e,i,t);let a=i[t];if(e.finalized_||!qi(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&la(t))return a;if(a===Ga(e.base_,t)||Ka(e,t,a)){Xa(e);let n=e.type_===1?+t:t,r=Qa(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in ua(e)},ownKeys(e){return Reflect.ownKeys(ua(e))},set(e,t,n){let r=Ja(ua(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=Ga(ua(e),t),i=r?.[Ii];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(na(n,r)&&(n!==void 0||$i(e.base_,t,e.type_)))return!0;Xa(e),Ya(e)}return e.copy_[t]===n&&(n!==void 0||$i(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),Ba(e,t,n),!0)},deleteProperty(e,t){return Xa(e),Ga(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Ya(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=ua(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Wi]:!0,[Hi]:e.type_!==1||t!==`length`,[Ui]:r[Ui],[Gi]:n[t]}},defineProperty(){Li(11)},getPrototypeOf(e){return zi(e.base_)},setPrototypeOf(){Li(12)}},Wa={};for(let e in Ua){let t=Ua[e];Wa[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}Wa.deleteProperty=function(e,t){return Wa.set.call(this,e,t,void 0)},Wa.set=function(e,t,n){return Ua.set.call(this,e[0],t,n,e[0])};function Ga(e,t){let n=e[Ii];return(n?ua(n):e)[t]}function Ka(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!qi(n)||n[Ii]?!1:e.baseRefs_.has(n)}function qa(e,t,n){let r=Ja(t,n);return r?Gi in r?r[Gi]:r.get?.call(e.draft_):void 0}function Ja(e,t){if(!(t in e))return;let n=zi(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=zi(n)}}function Ya(e){e.modified_||(e.modified_=!0,e.parent_&&Ya(e.parent_))}function Xa(e){e.copy_||=(e.assigned_=new Map,fa(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Za=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(sa(e)&&!sa(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}sa(t)||Li(6),n!==void 0&&!sa(n)&&Li(7);let r;if(qi(e)){let i=ka(this),a=Qa(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Da(i):Oa(i)}return Ea(i,n),ja(r,i)}if(!e||!oa(e)){if(r=t(e),r===void 0&&(r=e),r===Pi&&(r=void 0),this.autoFreeze_&&pa(r,!0),n){let t=[],i=[];xa(va).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}Li(1,e)},this.produceWithPatches=(e,t)=>{if(sa(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},ca(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),ca(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),ca(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){qi(e)||Li(8),Ki(e)&&(e=$a(e));let t=ka(this),n=Qa(t,e,void 0);return n[Ii].isManual_=!0,Oa(t),n}finishDraft(e,t){let n=e&&e[Ii];(!n||!n.isManual_)&&Li(9);let{scope_:r}=n;return Ea(r,t),ja(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=xa(va).applyPatches_;return Ki(e)?r(e,t):this.produce(e,e=>r(e,t))}};function Qa(e,t,n,r){let[i,a]=ia(t)?xa(_a).proxyMap_(t,n):aa(t)?xa(_a).proxySet_(t,n):Ha(t,n);return(n?.scope_??wa()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?Ra(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function $a(e){return Ki(e)||Li(10,e),eo(e)}function eo(e){if(!qi(e)||ga(e))return e;let t=e[Ii],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=fa(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=fa(e,!0);return Zi(n,(e,t)=>{ta(n,e,eo(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var to=new Za().produce;function no(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var ro=no(),io=no,ao=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?ji:ji.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function oo(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(hs(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>Ni(t)&&t.type===e,n}var so=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function co(e){return qi(e)?to(e,()=>{}):e}function lo(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function uo(e){return typeof e==`boolean`}var fo=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new so;return t&&(uo(t)?a.push(ro):a.push(io(t.extraArgument))),a},po=`RTK_autoBatch`,B=()=>e=>({payload:e,meta:{[po]:!0}}),mo=e=>t=>{setTimeout(t,e)},ho=(e,t)=>n=>{let r=!1,i=()=>{r||(r=!0,cancelAnimationFrame(a),clearTimeout(o),n())},a=e(i),o=setTimeout(i,t)},go=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?ho(window.requestAnimationFrame,100):mo(10):e.type===`callback`?e.queueNotification:mo(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[po],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},_o=e=>function(t){let{autoBatch:n=!0}=t??{},r=new so(e);return n&&r.push(go(typeof n==`object`?n:void 0)),r};function vo(e){let t=fo(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(Di(n))c=Ai(n);else throw Error(hs(1));let l;l=typeof r==`function`?r(t):t();let u=ji;i&&(u=ao({trace:!1,...typeof i==`object`&&i}));let d=_o(Mi(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return Oi(c,o,p)}function yo(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(hs(28));if(r in t)throw Error(hs(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function bo(e){return typeof e==`function`}function xo(e,t){let[n,r,i]=yo(t),a;if(bo(e))a=()=>co(e());else{let t=co(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n){if(Ki(e)){let r=n(e,t);return r===void 0?e:r}if(qi(e))return to(e,e=>n(e,t));{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}}return e},e)}return o.getInitialState=a,o}var So=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,Co=(e=21)=>{let t=``,n=e;for(;n--;)t+=So[Math.random()*64|0];return t},wo=Symbol.for(`rtk-slice-createasyncthunk`);function To(e,t){return`${e}/${t}`}function Eo({creators:e}={}){let t=e?.asyncThunk?.[wo];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(hs(11));let i=(typeof e.reducers==`function`?e.reducers(ko()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(hs(12));if(n in o.sliceCaseReducersByType)throw Error(hs(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:To(n,r),createNotation:typeof e.reducers==`function`};jo(a)?No(o,a,s,t):Ao(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?yo(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return xo(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=lo(d,r,m)),i}function i(t=l){return lo(lo(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=Do(a,t,()=>lo(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function Do(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var Oo=Eo();function ko(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function Ao({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!Mo(r))throw Error(hs(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?oo(e,o):oo(e))}function jo(e){return e._reducerDefinitionType===`asyncThunk`}function Mo(e){return e._reducerDefinitionType===`reducerWithPrepare`}function No({type:e,reducerName:t},n,r,i){if(!i)throw Error(hs(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||Po,pending:s||Po,rejected:c||Po,settled:l||Po})}function Po(){}var Fo=`task`,Io=`listener`,Lo=`completed`,Ro=`cancelled`,zo=`task-${Ro}`,Bo=`task-${Lo}`,Vo=`${Io}-${Ro}`,Ho=`${Io}-${Lo}`,Uo=class{constructor(e){this.code=e,this.message=`${Fo} ${Ro} (reason: ${e})`}code;name=`TaskAbortError`;message},Wo=(e,t)=>{if(typeof e!=`function`)throw TypeError(hs(32))},Go=()=>{},Ko=(e,t=Go)=>(e.catch(t),e),qo=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),Jo=e=>{if(e.aborted)throw new Uo(e.reason)};function Yo(e,t){let n=Go;return new Promise((r,i)=>{let a=()=>i(new Uo(e.reason));if(e.aborted){a();return}n=qo(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=Go})}var Xo=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof Uo?`cancelled`:`rejected`,error:e}}finally{t?.()}},Zo=e=>t=>Ko(Yo(e,t).then(t=>(Jo(e),t))),Qo=e=>{let t=Zo(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:$o}=Object,es={},ts=`listenerMiddleware`,ns=(e,t)=>{let n=t=>qo(e,()=>t.abort(e.reason));return(r,i)=>{Wo(r,`taskExecutor`);let a=new AbortController;n(a);let o=Xo(async()=>{Jo(e),Jo(a.signal);let t=await r({pause:Zo(a.signal),delay:Qo(a.signal),signal:a.signal});return Jo(a.signal),t},()=>a.abort(Bo));return i?.autoJoin&&t.push(o.catch(Go)),{result:Zo(e)(o),cancel(){a.abort(zo)}}}},rs=(e,t)=>{let n=async(n,r)=>{Jo(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await Yo(t,Promise.race(a));return Jo(t),e}finally{i()}};return((e,t)=>Ko(n(e,t)))},is=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=oo(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(hs(21));return Wo(a,`options.listener`),{predicate:i,type:t,effect:a}},as=$o(e=>{let{type:t,predicate:n,effect:r}=is(e);return{id:Co(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(hs(22))}}},{withTypes:()=>as}),os=(e,t)=>{let{type:n,effect:r,predicate:i}=is(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},ss=e=>{e.pending.forEach(e=>{e.abort(Vo)})},cs=(e,t)=>()=>{for(let e of t.keys())ss(e);e.clear()},ls=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},us=$o(oo(`${ts}/add`),{withTypes:()=>us}),ds=oo(`${ts}/removeAll`),fs=$o(oo(`${ts}/remove`),{withTypes:()=>fs}),ps=(...e)=>{console.error(`${ts}/error`,...e)},ms=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=ps}=e;Wo(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&ss(e)}),c=(e=>{let n=os(t,e)??as(e);return s(n)});$o(c,{withTypes:()=>c});let l=e=>{let n=os(t,e);return n&&(n.unsubscribe(),e.cancelActive&&ss(n)),!!n};$o(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=rs(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,$o({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:Qo(u.signal),pause:Zo(u.signal),extra:a,signal:u.signal,fork:ns(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(Vo),n.delete(e))})},cancel:()=>{u.abort(Vo),e.pending.delete(u)},throwIfCancelled:()=>{Jo(u.signal)}})))}catch(e){e instanceof Uo||ls(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(Ho),i(e),e.pending.delete(u)}},d=cs(t,n);return{middleware:e=>n=>r=>{if(!Ni(r))return n(r);if(us.match(r))return c(r.payload);if(ds.match(r)){d();return}if(fs.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===es)throw Error(hs(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,ls(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=es}return s},startListening:c,stopListening:l,clearListeners:d}};function hs(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var gs=Oo({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),{setMargin:_s,setLayout:vs,setChartSize:ys,setScale:bs}=gs.actions,xs=gs.reducer;function Ss(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function V(e){return Number.isFinite(e)}function Cs(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function ws(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ts(e){for(var t=1;t{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&P(e[a]))return Ts(Ts({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&P(e[o]))return Ts(Ts({},e),{},{[o]:e[o]+(i||0)})}return e},As=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,js=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},Ms=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:c,categoricalDomain:l,tickCount:u,ticks:d,niceTicks:f,axisType:p}=e;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?Bt(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return V(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(Zt):c&&l?l.map((e,t)=>{var n=o.map(e);return V(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(Zt):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return V(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(Zt):o.domain().map((e,t)=>{var n=o.map(e);return V(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(Zt)},Ns={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:Tt,none:bt,silhouette:Et,wiggle:Dt,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},Ps=(e,t,n)=>{var r=Ns[n]??bt,i=wt().keys(t).value((e,t)=>Number(H(e,t,0))).order(xt).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=H(e[i],t[r],0);Array.isArray(a)&&a.length===2&&P(a[0])&&P(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function Fs(e){return e==null?void 0:String(e)}function Is(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!F(i[t.dataKey])){var s=Yt(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=H(i,F(o)?t.dataKey:o),l=t.scale.map(c);return P(l)?l:null}var Ls=e=>{var t=e.flat(2).filter(P);return[Math.min(...t),Math.max(...t)]},Rs=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],zs=(e,t,n)=>{if(e!=null)return Rs(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((e,r)=>{var i=Ls(Ss(r,t,n));return!V(i[0])||!V(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))},Bs=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Vs=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Hs=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=_i(t,e=>e.coordinate),a=1/0,o=1,s=i.length;o{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},Ks=(e,t)=>t===`centric`?e.angle:e.radius,qs=e=>e.layout.width,Js=e=>e.layout.height,Ys=e=>e.layout.scale,Xs=e=>e.layout.margin,Zs=R(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Qs=R(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),$s=`data-recharts-item-index`;function ec(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function tc(e){for(var t=1;te.brush.height;function oc(e){return Qs(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function sc(e){return Qs(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function cc(e){return Zs(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+t.height:e,0)}function lc(e){return Zs(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+t.height:e,0)}var uc=R([qs,Js,Xs,ac,oc,sc,cc,lc,vi,yi],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=tc(tc({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=ks(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return tc(tc({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),dc=R(uc,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),fc=R(qs,Js,(e,t)=>({x:0,y:0,width:e,height:t})),pc=(0,h.createContext)(null),mc=()=>(0,h.useContext)(pc)!=null,hc=e=>e.brush,gc=R([hc,uc,Xs],(e,t,n)=>({height:e.height,x:P(e.x)?e.x:t.left,y:P(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:P(e.width)?e.width:t.width}));function _c(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function vc(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=_c(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?((r||i)&&(s=e.apply(this,t)),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function yc(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return vc(e,t,{leading:r,maxWait:t,trailing:i})}var bc=function(e,t){var n=[...arguments].slice(2);if(typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e)){if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}}},xc={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},Sc=(e,t,n)=>{var{width:r=xc.width,height:i=xc.height,aspect:a,maxHeight:o}=n,s=Ht(r)?e:Number(r),c=Ht(i)?t:Number(i);return a&&a>0&&(s?c=s/a:c&&(s=c*a),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:s,calculatedHeight:c}},Cc={width:0,height:0,overflow:`visible`},wc={width:0,overflowX:`visible`},Tc={height:0,overflowY:`visible`},Ec={},Dc=e=>{var{width:t,height:n}=e,r=Ht(t),i=Ht(n);return r&&i?Cc:r?wc:i?Tc:Ec};function Oc(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=xc.width,a=xc.height):i===void 0?i=r&&r>0?void 0:xc.width:a===void 0&&(a=r&&r>0?void 0:xc.height),{width:i,height:a}}function kc(){return kc=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:r}),[n,r]);return Ic(i)?h.createElement(Fc.Provider,{value:i},t):null}var Rc=()=>(0,h.useContext)(Fc),zc=(0,h.forwardRef)((e,t)=>{var{aspect:n,initialDimension:r=xc.initialDimension,width:i,height:a,minWidth:o=xc.minWidth,minHeight:s,maxHeight:l,children:u,debounce:d=xc.debounce,id:f,className:p,onResize:m,style:g={}}=e,_=(0,h.useRef)(null),v=(0,h.useRef)();v.current=m,(0,h.useImperativeHandle)(t,()=>_.current);var[y,b]=(0,h.useState)({containerWidth:r.width,containerHeight:r.height}),x=(0,h.useCallback)((e,t)=>{b(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,h.useEffect)(()=>{if(_.current==null||typeof ResizeObserver>`u`)return Qt;var e=e=>{var t,n=e[0];if(n!=null){var{width:r,height:i}=n.contentRect;x(r,i),(t=v.current)==null||t.call(v,r,i)}};d>0&&(e=yc(e,d,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=_.current.getBoundingClientRect();return x(n,r),t.observe(_.current),()=>{t.disconnect()}},[x,d]);var{containerWidth:S,containerHeight:C}=y;bc(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var{calculatedWidth:w,calculatedHeight:T}=Sc(S,C,{width:i,height:a,aspect:n,maxHeight:l});return bc(w!=null&&w>0||T!=null&&T>0,`The width(%s) and height(%s) of chart should be greater than 0, + A${a},${a},0,1,1,${o},${i}`,className:`recharts-legend-icon`});if(c===`rect`)return h.createElement(`path`,{stroke:`none`,fill:s,d:`M0,${jn/8}h${jn}v${jn*3/4}h${-jn}z`,className:`recharts-legend-icon`});if(h.isValidElement(t.legendIcon)){var l=Dn({},t);return delete l.legendIcon,h.cloneElement(t.legendIcon,l)}return h.createElement(mn,{fill:s,cx:i,cy:i,size:jn,sizeType:`diameter`,type:c})}function Fn(e){var{payload:t,iconSize:n,layout:r,formatter:i,inactiveColor:a,iconType:o,labelStyle:s}=e,l={x:0,y:0,width:jn,height:jn},u={display:r===`horizontal`?`inline-block`:`block`,marginRight:10},d={display:`inline-block`,verticalAlign:`middle`,marginRight:4};return t.map((t,r)=>{var f=t.formatter||i,p=c({"recharts-legend-item":!0,[`legend-item-${r}`]:!0,inactive:t.inactive});if(t.type===`none`)return null;var m=typeof s==`object`?Dn({},s):{};m.color=t.inactive?a:m.color||t.color;var g=f?f(t.value,t,r):t.value;return h.createElement(`li`,Tn({className:p,style:u,key:`legend-item-${r}`},vn(e,t,r)),h.createElement(ee,{width:n,height:n,viewBox:l,style:d,"aria-label":`${g} legend icon`},h.createElement(Pn,{data:t,iconType:o,inactiveColor:a})),h.createElement(`span`,{className:`recharts-legend-item-text`,style:m},g))})}var In=e=>{var t=wn(e,Mn),{payload:n,layout:r,align:i}=t;if(!n||!n.length)return null;var a={padding:0,margin:0,textAlign:r===`horizontal`?i:`left`};return h.createElement(`ul`,{className:`recharts-default-legend`,style:a},h.createElement(Fn,Tn({},t,{payload:n})))};function Ln(e,t){let n=new Map;for(let r=0;r=0}function Vn(e){return e!=null&&typeof e!=`function`&&Bn(e.length)}function Hn(e){return function(t){return It(t,e)}}function Un(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function Wn(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Gn(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function Kn(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var qn=`[object RegExp]`,Jn=`[object String]`,Yn=`[object Number]`,Xn=`[object Boolean]`,Zn=`[object Arguments]`,Qn=`[object Symbol]`,$n=`[object Date]`,er=`[object Map]`,tr=`[object Set]`,nr=`[object Array]`,rr=`[object ArrayBuffer]`,ir=`[object Object]`,ar=`[object DataView]`,or=`[object Uint8Array]`,sr=`[object Uint8ClampedArray]`,cr=`[object Uint16Array]`,lr=`[object Uint32Array]`,ur=`[object Int8Array]`,dr=`[object Int16Array]`,fr=`[object Int32Array]`,pr=`[object Float32Array]`,mr=`[object Float64Array]`,hr=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function gr(e){return hr.Buffer!==void 0&&hr.Buffer.isBuffer(e)}function _r(e,t){return vr(e,void 0,e,new Map,t)}function vr(e,t,n,r=new Map,i=void 0){let a=i?.(e,t,n,r);if(a!==void 0)return a;if(Un(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;avoid 0)}function Tr(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return Er(e,t,n,r,i);case`function`:return Object.keys(t).length>0?Tr(e,{...t},n,r,i):Sr(e,t);default:return Cr(e)&&i?typeof t!=`string`||t===``:Sr(e,t)}}function Er(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return Or(e,t,n,r);if(t instanceof Map)return Dr(e,t,n,r);if(t instanceof Set)return kr(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)Un(e)&&(e=Object(e));else{let t=Kn(e);if(t!==`[object Object]`&&t!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;ivoid 0)}function jr(e){return e=xr(e),t=>Ar(t,e)}function Mr(e,t){return _r(e,(n,r,i,a)=>{let o=t?.(n,r,i,a);if(o!==void 0)return o;if(typeof e==`object`){if(Kn(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return a.set(e,t),yr(t,e,i,a),t}switch(Object.prototype.toString.call(e)){case Yn:case Jn:case Xn:{let t=new e.constructor(e?.valueOf());return yr(t,e),t}case Zn:{let t={};return yr(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function Nr(e){return Mr(e)}var Pr=/^(?:0|[1-9]\d*)$/;function Fr(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&ee,I=()=>{var e=(0,h.useContext)(Wr);return e?e.store.dispatch:Gr},Kr=()=>{},qr=()=>Kr,Jr=(e,t)=>e===t;function L(e){var t=(0,h.useContext)(Wr),n=(0,h.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:Kr,[t,e]);return(0,Ur.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:qr,t?t.store.getState:Kr,t?t.store.getState:Kr,n,Jr)}function Yr(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function Xr(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function Zr(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var Qr=e=>Array.isArray(e)?e:[e];function $r(e){let t=Array.isArray(e[0])?e[0]:e;return Zr(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function ei(e,t){let n=[],{length:r}=e;for(let i=0;i{n=ai(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function si(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),Yr(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=oi,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=Qr(c),p=Qr(u),m=$r(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=ei(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var R=si(oi),ci=Object.assign((e,t=R)=>{Xr(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>ci});function li(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a{if(e!==t){let r=di(e),i=di(t);if(r===i&&r===0){if(et)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},pi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mi=/^\w*$/;function hi(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||Mt(e)?!0:typeof e==`string`&&(mi.test(e)||!pi.test(e))||t!=null&&Object.hasOwn(t,e)}function gi(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=Vn(e)?Array.from(e):Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||hi(e)?e:{key:e,path:Ft(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;re.original)}function _i(e,...t){let n=t.length;return n>1&&ui(e,t[0],t[1])?t=[]:n>2&&ui(t[0],t[1],t[2])&&(t=[t[0]]),gi(e,li(t),[`asc`])}var vi=e=>e.legend.settings,yi=e=>e.legend.size,bi=R([e=>e.legend.payload,vi],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?_i(r,n):r});function xi(){return L(bi)}var Si=1;function Ci(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=(0,h.useState)({height:0,left:0,top:0,width:0});return[t,(0,h.useCallback)(e=>{if(e!=null){var r=e.getBoundingClientRect(),i={height:r.height,left:r.left,top:r.top,width:r.width};(Math.abs(i.height-t.height)>Si||Math.abs(i.left-t.left)>Si||Math.abs(i.top-t.top)>Si||Math.abs(i.width-t.width)>Si)&&n({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e])]}function z(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var wi=typeof Symbol==`function`&&Symbol.observable||`@@observable`,Ti=()=>Math.random().toString(36).substring(7).split(``).join(`.`),Ei={INIT:`@@redux/INIT${Ti()}`,REPLACE:`@@redux/REPLACE${Ti()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ti()}`};function Di(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Oi(e,t,n){if(typeof e!=`function`)throw Error(z(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(z(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(z(1));return n(Oi)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(z(3));return i}function d(e){if(typeof e!=`function`)throw Error(z(4));if(c)throw Error(z(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(z(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!Di(e))throw Error(z(7));if(e.type===void 0)throw Error(z(8));if(typeof e.type!=`string`)throw Error(z(17));if(c)throw Error(z(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(z(10));r=e,f({type:Ei.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(z(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[wi](){return this}}}return f({type:Ei.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[wi]:m}}function ki(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:Ei.INIT})===void 0)throw Error(z(12));if(n(void 0,{type:Ei.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(z(13))})}function Ai(e){let t=Object.keys(e),n={};for(let r=0;re:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function Mi(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(z(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=ji(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function Ni(e){return Di(e)&&`type`in e&&typeof e.type==`string`}var Pi=Symbol.for(`immer-nothing`),Fi=Symbol.for(`immer-draftable`),Ii=Symbol.for(`immer-state`);function Li(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ri=Object,zi=Ri.getPrototypeOf,Bi=`constructor`,Vi=`prototype`,Hi=`configurable`,Ui=`enumerable`,Wi=`writable`,Gi=`value`,Ki=e=>!!e&&!!e[Ii];function qi(e){return e?Xi(e)||ra(e)||!!e[Fi]||!!e[Bi]?.[Fi]||ia(e)||aa(e):!1}var Ji=Ri[Vi][Bi].toString(),Yi=new WeakMap;function Xi(e){if(!e||!oa(e))return!1;let t=zi(e);if(t===null||t===Ri[Vi])return!0;let n=Ri.hasOwnProperty.call(t,Bi)&&t[Bi];if(n===Object)return!0;if(!sa(n))return!1;let r=Yi.get(n);return r===void 0&&(r=Function.toString.call(n),Yi.set(n,r)),r===Ji}function Zi(e,t,n=!0){Qi(e)===0?(n?Reflect.ownKeys(e):Ri.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Qi(e){let t=e[Ii];return t?t.type_:ra(e)?1:ia(e)?2:aa(e)?3:0}var $i=(e,t,n=Qi(e))=>n===2?e.has(t):Ri[Vi].hasOwnProperty.call(e,t),ea=(e,t,n=Qi(e))=>n===2?e.get(t):e[t],ta=(e,t,n,r=Qi(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function na(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var ra=Array.isArray,ia=e=>e instanceof Map,aa=e=>e instanceof Set,oa=e=>typeof e==`object`,sa=e=>typeof e==`function`,ca=e=>typeof e==`boolean`;function la(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var ua=e=>e.copy_||e.base_,da=e=>e.modified_?e.copy_:e.base_;function fa(e,t){if(ia(e))return new Map(e);if(aa(e))return new Set(e);if(ra(e))return Array[Vi].slice.call(e);let n=Xi(e);if(t===!0||t===`class_only`&&!n){let t=Ri.getOwnPropertyDescriptors(e);delete t[Ii];let n=Reflect.ownKeys(t);for(let r=0;r1&&Ri.defineProperties(e,{set:ha,add:ha,clear:ha,delete:ha}),Ri.freeze(e),t&&Zi(e,(e,t)=>{pa(t,!0)},!1),e)}function ma(){Li(2)}var ha={[Gi]:ma};function ga(e){return e===null||!oa(e)||Ri.isFrozen(e)}var _a=`MapSet`,va=`Patches`,ya=`ArrayMethods`,ba={};function xa(e){let t=ba[e];return t||Li(0,e),t}var Sa=e=>!!ba[e],Ca,wa=()=>Ca,Ta=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Sa(_a)?xa(_a):void 0,arrayMethodsPlugin_:Sa(ya)?xa(ya):void 0});function Ea(e,t){t&&(e.patchPlugin_=xa(va),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Da(e){Oa(e),e.drafts_.forEach(Aa),e.drafts_=null}function Oa(e){e===Ca&&(Ca=e.parent_)}var ka=e=>Ca=Ta(Ca,e);function Aa(e){let t=e[Ii];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function ja(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[Ii].modified_&&(Da(t),Li(4)),qi(e)&&(e=Ma(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[Ii].base_,e,t)}else e=Ma(t,n);return Na(t,e,!0),Da(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===Pi?void 0:e}function Ma(e,t){if(ga(t))return t;let n=t[Ii];if(!n)return Va(t,e.handledSet_,e);if(!Fa(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);za(n,e)}return n.copy_}function Na(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&pa(t,n)}function Pa(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Fa=(e,t)=>e.scope_===t,Ia=[];function La(e,t,n,r){let i=ua(e),a=e.type_;if(r!==void 0&&ea(i,r,a)===t){ta(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;Zi(i,(e,n)=>{if(Ki(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??Ia;for(let e of o)ta(i,e,n,a)}function Ra(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!Fa(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=da(i);La(e,i.draft_??i,a,n),za(i,r)})}function za(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}Pa(e)}}function Ba(e,t,n){let{scope_:r}=e;if(Ki(n)){let i=n[Ii];Fa(i,r)&&i.callbacks_.push(function(){Xa(e),La(e,n,da(i),t)})}else qi(n)&&e.callbacks_.push(function(){let i=ua(e);e.type_===3?i.has(n)&&Va(n,r.handledSet_,r):ea(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Va(ea(e.copy_,t,e.type_),r.handledSet_,r)})}function Va(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Ki(e)||t.has(e)||!qi(e)||ga(e)?e:(t.add(e),Zi(e,(r,i)=>{if(Ki(i)){let t=i[Ii];Fa(t,n)&&(ta(e,r,da(t),e.type_),Pa(t))}else qi(i)&&Va(i,t,n)}),e)}function Ha(e,t){let n=ra(e),r={type_:+!!n,scope_:t?t.scope_:wa(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=Ua;n&&(i=[r],a=Wa);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var Ua={get(e,t){if(t===Ii)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=ua(e);if(!$i(i,t,e.type_))return qa(e,i,t);let a=i[t];if(e.finalized_||!qi(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&la(t))return a;if(a===Ga(e.base_,t)||Ka(e,t,a)){Xa(e);let n=e.type_===1?+t:t,r=Qa(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in ua(e)},ownKeys(e){return Reflect.ownKeys(ua(e))},set(e,t,n){let r=Ja(ua(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=Ga(ua(e),t),i=r?.[Ii];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(na(n,r)&&(n!==void 0||$i(e.base_,t,e.type_)))return!0;Xa(e),Ya(e)}return e.copy_[t]===n&&(n!==void 0||$i(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),Ba(e,t,n),!0)},deleteProperty(e,t){return Xa(e),Ga(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Ya(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=ua(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Wi]:!0,[Hi]:e.type_!==1||t!==`length`,[Ui]:r[Ui],[Gi]:n[t]}},defineProperty(){Li(11)},getPrototypeOf(e){return zi(e.base_)},setPrototypeOf(){Li(12)}},Wa={};for(let e in Ua){let t=Ua[e];Wa[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}Wa.deleteProperty=function(e,t){return Wa.set.call(this,e,t,void 0)},Wa.set=function(e,t,n){return Ua.set.call(this,e[0],t,n,e[0])};function Ga(e,t){let n=e[Ii];return(n?ua(n):e)[t]}function Ka(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!qi(n)||n[Ii]?!1:e.baseRefs_.has(n)}function qa(e,t,n){let r=Ja(t,n);return r?Gi in r?r[Gi]:r.get?.call(e.draft_):void 0}function Ja(e,t){if(!(t in e))return;let n=zi(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=zi(n)}}function Ya(e){e.modified_||(e.modified_=!0,e.parent_&&Ya(e.parent_))}function Xa(e){e.copy_||=(e.assigned_=new Map,fa(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Za=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(sa(e)&&!sa(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}sa(t)||Li(6),n!==void 0&&!sa(n)&&Li(7);let r;if(qi(e)){let i=ka(this),a=Qa(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Da(i):Oa(i)}return Ea(i,n),ja(r,i)}if(!e||!oa(e)){if(r=t(e),r===void 0&&(r=e),r===Pi&&(r=void 0),this.autoFreeze_&&pa(r,!0),n){let t=[],i=[];xa(va).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}Li(1,e)},this.produceWithPatches=(e,t)=>{if(sa(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},ca(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),ca(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),ca(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){qi(e)||Li(8),Ki(e)&&(e=$a(e));let t=ka(this),n=Qa(t,e,void 0);return n[Ii].isManual_=!0,Oa(t),n}finishDraft(e,t){let n=e&&e[Ii];(!n||!n.isManual_)&&Li(9);let{scope_:r}=n;return Ea(r,t),ja(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=xa(va).applyPatches_;return Ki(e)?r(e,t):this.produce(e,e=>r(e,t))}};function Qa(e,t,n,r){let[i,a]=ia(t)?xa(_a).proxyMap_(t,n):aa(t)?xa(_a).proxySet_(t,n):Ha(t,n);return(n?.scope_??wa()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?Ra(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function $a(e){return Ki(e)||Li(10,e),eo(e)}function eo(e){if(!qi(e)||ga(e))return e;let t=e[Ii],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=fa(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=fa(e,!0);return Zi(n,(e,t)=>{ta(n,e,eo(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var to=new Za().produce;function no(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var ro=no(),io=no,ao=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?ji:ji.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function oo(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(hs(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>Ni(t)&&t.type===e,n}var so=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function co(e){return qi(e)?to(e,()=>{}):e}function lo(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function uo(e){return typeof e==`boolean`}var fo=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new so;return t&&(uo(t)?a.push(ro):a.push(io(t.extraArgument))),a},po=`RTK_autoBatch`,B=()=>e=>({payload:e,meta:{[po]:!0}}),mo=e=>t=>{setTimeout(t,e)},ho=(e,t)=>n=>{let r=!1,i=()=>{r||(r=!0,cancelAnimationFrame(a),clearTimeout(o),n())},a=e(i),o=setTimeout(i,t)},go=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?ho(window.requestAnimationFrame,100):mo(10):e.type===`callback`?e.queueNotification:mo(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[po],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},_o=e=>function(t){let{autoBatch:n=!0}=t??{},r=new so(e);return n&&r.push(go(typeof n==`object`?n:void 0)),r};function vo(e){let t=fo(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(Di(n))c=Ai(n);else throw Error(hs(1));let l;l=typeof r==`function`?r(t):t();let u=ji;i&&(u=ao({trace:!1,...typeof i==`object`&&i}));let d=_o(Mi(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return Oi(c,o,p)}function yo(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(hs(28));if(r in t)throw Error(hs(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function bo(e){return typeof e==`function`}function xo(e,t){let[n,r,i]=yo(t),a;if(bo(e))a=()=>co(e());else{let t=co(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n){if(Ki(e)){let r=n(e,t);return r===void 0?e:r}if(qi(e))return to(e,e=>n(e,t));{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}}return e},e)}return o.getInitialState=a,o}var So=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,Co=(e=21)=>{let t=``,n=e;for(;n--;)t+=So[Math.random()*64|0];return t},wo=Symbol.for(`rtk-slice-createasyncthunk`);function To(e,t){return`${e}/${t}`}function Eo({creators:e}={}){let t=e?.asyncThunk?.[wo];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(hs(11));let i=(typeof e.reducers==`function`?e.reducers(ko()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(hs(12));if(n in o.sliceCaseReducersByType)throw Error(hs(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:To(n,r),createNotation:typeof e.reducers==`function`};jo(a)?No(o,a,s,t):Ao(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?yo(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return xo(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=lo(d,r,m)),i}function i(t=l){return lo(lo(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=Do(a,t,()=>lo(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function Do(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var Oo=Eo();function ko(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function Ao({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!Mo(r))throw Error(hs(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?oo(e,o):oo(e))}function jo(e){return e._reducerDefinitionType===`asyncThunk`}function Mo(e){return e._reducerDefinitionType===`reducerWithPrepare`}function No({type:e,reducerName:t},n,r,i){if(!i)throw Error(hs(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||Po,pending:s||Po,rejected:c||Po,settled:l||Po})}function Po(){}var Fo=`task`,Io=`listener`,Lo=`completed`,Ro=`cancelled`,zo=`task-${Ro}`,Bo=`task-${Lo}`,Vo=`${Io}-${Ro}`,Ho=`${Io}-${Lo}`,Uo=class{constructor(e){this.code=e,this.message=`${Fo} ${Ro} (reason: ${e})`}code;name=`TaskAbortError`;message},Wo=(e,t)=>{if(typeof e!=`function`)throw TypeError(hs(32))},Go=()=>{},Ko=(e,t=Go)=>(e.catch(t),e),qo=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),Jo=e=>{if(e.aborted)throw new Uo(e.reason)};function Yo(e,t){let n=Go;return new Promise((r,i)=>{let a=()=>i(new Uo(e.reason));if(e.aborted){a();return}n=qo(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=Go})}var Xo=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof Uo?`cancelled`:`rejected`,error:e}}finally{t?.()}},Zo=e=>t=>Ko(Yo(e,t).then(t=>(Jo(e),t))),Qo=e=>{let t=Zo(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:$o}=Object,es={},ts=`listenerMiddleware`,ns=(e,t)=>{let n=t=>qo(e,()=>t.abort(e.reason));return(r,i)=>{Wo(r,`taskExecutor`);let a=new AbortController;n(a);let o=Xo(async()=>{Jo(e),Jo(a.signal);let t=await r({pause:Zo(a.signal),delay:Qo(a.signal),signal:a.signal});return Jo(a.signal),t},()=>a.abort(Bo));return i?.autoJoin&&t.push(o.catch(Go)),{result:Zo(e)(o),cancel(){a.abort(zo)}}}},rs=(e,t)=>{let n=async(n,r)=>{Jo(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await Yo(t,Promise.race(a));return Jo(t),e}finally{i()}};return((e,t)=>Ko(n(e,t)))},is=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=oo(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(hs(21));return Wo(a,`options.listener`),{predicate:i,type:t,effect:a}},as=$o(e=>{let{type:t,predicate:n,effect:r}=is(e);return{id:Co(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(hs(22))}}},{withTypes:()=>as}),os=(e,t)=>{let{type:n,effect:r,predicate:i}=is(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},ss=e=>{e.pending.forEach(e=>{e.abort(Vo)})},cs=(e,t)=>()=>{for(let e of t.keys())ss(e);e.clear()},ls=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},us=$o(oo(`${ts}/add`),{withTypes:()=>us}),ds=oo(`${ts}/removeAll`),fs=$o(oo(`${ts}/remove`),{withTypes:()=>fs}),ps=(...e)=>{console.error(`${ts}/error`,...e)},ms=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=ps}=e;Wo(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&ss(e)}),c=(e=>{let n=os(t,e)??as(e);return s(n)});$o(c,{withTypes:()=>c});let l=e=>{let n=os(t,e);return n&&(n.unsubscribe(),e.cancelActive&&ss(n)),!!n};$o(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=rs(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,$o({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:Qo(u.signal),pause:Zo(u.signal),extra:a,signal:u.signal,fork:ns(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(Vo),n.delete(e))})},cancel:()=>{u.abort(Vo),e.pending.delete(u)},throwIfCancelled:()=>{Jo(u.signal)}})))}catch(e){e instanceof Uo||ls(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(Ho),i(e),e.pending.delete(u)}},d=cs(t,n);return{middleware:e=>n=>r=>{if(!Ni(r))return n(r);if(us.match(r))return c(r.payload);if(ds.match(r)){d();return}if(fs.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===es)throw Error(hs(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,ls(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=es}return s},startListening:c,stopListening:l,clearListeners:d}};function hs(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var gs=Oo({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),{setMargin:_s,setLayout:vs,setChartSize:ys,setScale:bs}=gs.actions,xs=gs.reducer;function Ss(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function V(e){return Number.isFinite(e)}function Cs(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function ws(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ts(e){for(var t=1;t{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&P(e[a]))return Ts(Ts({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&P(e[o]))return Ts(Ts({},e),{},{[o]:e[o]+(i||0)})}return e},As=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,js=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},Ms=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:c,categoricalDomain:l,tickCount:u,ticks:d,niceTicks:f,axisType:p}=e;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?Bt(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return V(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(Zt):c&&l?l.map((e,t)=>{var n=o.map(e);return V(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(Zt):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return V(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(Zt):o.domain().map((e,t)=>{var n=o.map(e);return V(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(Zt)},Ns={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:Tt,none:bt,silhouette:Et,wiggle:Dt,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},Ps=(e,t,n)=>{var r=Ns[n]??bt,i=wt().keys(t).value((e,t)=>Number(H(e,t,0))).order(xt).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=H(e[i],t[r],0);Array.isArray(a)&&a.length===2&&P(a[0])&&P(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function Fs(e){return e==null?void 0:String(e)}function Is(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!F(i[t.dataKey])){var s=Yt(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=H(i,F(o)?t.dataKey:o),l=t.scale.map(c);return P(l)?l:null}var Ls=e=>{var t=e.flat(2).filter(P);return[Math.min(...t),Math.max(...t)]},Rs=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],zs=(e,t,n)=>{if(e!=null)return Rs(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((e,r)=>{var i=Ls(Ss(r,t,n));return!V(i[0])||!V(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))},Bs=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Vs=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Hs=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=_i(t,e=>e.coordinate),a=1/0,o=1,s=i.length;o{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},Ks=(e,t)=>t===`centric`?e.angle:e.radius,qs=e=>e.layout.width,Js=e=>e.layout.height,Ys=e=>e.layout.scale,Xs=e=>e.layout.margin,Zs=R(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Qs=R(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),$s=`data-recharts-item-index`;function ec(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function tc(e){for(var t=1;te.brush.height;function oc(e){return Qs(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function sc(e){return Qs(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function cc(e){return Zs(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+t.height:e,0)}function lc(e){return Zs(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+t.height:e,0)}var uc=R([qs,Js,Xs,ac,oc,sc,cc,lc,vi,yi],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=tc(tc({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=ks(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return tc(tc({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),dc=R(uc,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),fc=R(qs,Js,(e,t)=>({x:0,y:0,width:e,height:t})),pc=(0,h.createContext)(null),mc=()=>(0,h.useContext)(pc)!=null,hc=e=>e.brush,gc=R([hc,uc,Xs],(e,t,n)=>({height:e.height,x:P(e.x)?e.x:t.left,y:P(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:P(e.width)?e.width:t.width}));function _c(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function vc(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=_c(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?((r||i)&&(s=e.apply(this,t)),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function yc(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return vc(e,t,{leading:r,maxWait:t,trailing:i})}var bc=function(e,t){var n=[...arguments].slice(2);if(typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e)){if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}}},xc={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},Sc=(e,t,n)=>{var{width:r=xc.width,height:i=xc.height,aspect:a,maxHeight:o}=n,s=Ht(r)?e:Number(r),c=Ht(i)?t:Number(i);return a&&a>0&&(s?c=s/a:c&&(s=c*a),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:s,calculatedHeight:c}},Cc={width:0,height:0,overflow:`visible`},wc={width:0,overflowX:`visible`},Tc={height:0,overflowY:`visible`},Ec={},Dc=e=>{var{width:t,height:n}=e,r=Ht(t),i=Ht(n);return r&&i?Cc:r?wc:i?Tc:Ec};function Oc(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=xc.width,a=xc.height):i===void 0?i=r&&r>0?void 0:xc.width:a===void 0&&(a=r&&r>0?void 0:xc.height),{width:i,height:a}}function kc(){return kc=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:r}),[n,r]);return Ic(i)?h.createElement(Fc.Provider,{value:i},t):null}var Rc=()=>(0,h.useContext)(Fc),zc=(0,h.forwardRef)((e,t)=>{var{aspect:n,initialDimension:r=xc.initialDimension,width:i,height:a,minWidth:o=xc.minWidth,minHeight:s,maxHeight:l,children:u,debounce:d=xc.debounce,id:f,className:p,onResize:m,style:g={}}=e,_=(0,h.useRef)(null),v=(0,h.useRef)();v.current=m,(0,h.useImperativeHandle)(t,()=>_.current);var[y,b]=(0,h.useState)({containerWidth:r.width,containerHeight:r.height}),x=(0,h.useCallback)((e,t)=>{b(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,h.useEffect)(()=>{if(_.current==null||typeof ResizeObserver>`u`)return Qt;var e=e=>{var t,n=e[0];if(n!=null){var{width:r,height:i}=n.contentRect;x(r,i),(t=v.current)==null||t.call(v,r,i)}};d>0&&(e=yc(e,d,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=_.current.getBoundingClientRect();return x(n,r),t.observe(_.current),()=>{t.disconnect()}},[x,d]);var{containerWidth:S,containerHeight:C}=y;bc(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var{calculatedWidth:w,calculatedHeight:T}=Sc(S,C,{width:i,height:a,aspect:n,maxHeight:l});return bc(w!=null&&w>0||T!=null&&T>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the - height and width.`,w,T,i,a,o,s,n),h.createElement(`div`,{id:f?`${f}`:void 0,className:c(`recharts-responsive-container`,p),style:jc(jc({},g),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:l}),ref:_},h.createElement(`div`,{style:Dc({width:i,height:a})},h.createElement(Lc,{width:w,height:T},u)))}),Bc=(0,h.forwardRef)((e,t)=>{var n=Rc();if(Cs(n.width)&&Cs(n.height))return e.children;var{width:r,height:i}=Oc({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=Sc(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return P(a)&&P(o)?h.createElement(Lc,{width:a,height:o},e.children):h.createElement(zc,kc({},e,{width:r,height:i,ref:t}))});function Vc(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Hc=()=>{var e=mc(),t=L(dc),n=L(gc),r=L(hc)?.padding;return!e||!n||!r?t:{width:n.width-r.left-r.right,height:n.height-r.top-r.bottom,x:r.left,y:r.top}},Uc={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},Wc=()=>L(uc)??Uc,Gc=()=>L(qs),Kc=()=>L(Js),qc=()=>L(e=>e.layout.margin),U=e=>e.layout.layoutType,Jc=()=>L(U),Yc=()=>{var e=Jc();if(e===`horizontal`||e===`vertical`)return e},Xc=e=>{var t=e.layout.layoutType;if(t===`centric`||t===`radial`)return t},Zc=()=>Jc()!==void 0,Qc=e=>{var t=I(),n=mc(),{width:r,height:i}=e,a=Rc(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),(0,h.useEffect)(()=>{!n&&Cs(o)&&Cs(s)&&t(ys({width:o,height:s}))},[t,n,o,s]),null},$c=Symbol.for(`immer-nothing`),el=Symbol.for(`immer-draftable`),tl=Symbol.for(`immer-state`);function nl(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var rl=Object.getPrototypeOf;function il(e){return!!e&&!!e[tl]}function al(e){return e?cl(e)||Array.isArray(e)||!!e[el]||!!e.constructor?.[el]||ml(e)||hl(e):!1}var ol=Object.prototype.constructor.toString(),sl=new WeakMap;function cl(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let n=Object.hasOwnProperty.call(t,`constructor`)&&t.constructor;if(n===Object)return!0;if(typeof n!=`function`)return!1;let r=sl.get(n);return r===void 0&&(r=Function.toString.call(n),sl.set(n,r)),r===ol}function ll(e,t,n=!0){ul(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ul(e){let t=e[tl];return t?t.type_:Array.isArray(e)?1:ml(e)?2:hl(e)?3:0}function dl(e,t){return ul(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function fl(e,t,n){let r=ul(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function pl(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function ml(e){return e instanceof Map}function hl(e){return e instanceof Set}function gl(e){return e.copy_||e.base_}function _l(e,t){if(ml(e))return new Map(e);if(hl(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let n=cl(e);if(t===!0||t===`class_only`&&!n){let t=Object.getOwnPropertyDescriptors(e);delete t[tl];let n=Reflect.ownKeys(t);for(let r=0;r1&&Object.defineProperties(e,{set:bl,add:bl,clear:bl,delete:bl}),Object.freeze(e),t&&Object.values(e).forEach(e=>vl(e,!0)),e)}function yl(){nl(2)}var bl={value:yl};function xl(e){return typeof e!=`object`||!e||Object.isFrozen(e)}var Sl={};function Cl(e){let t=Sl[e];return t||nl(0,e),t}var wl;function Tl(){return wl}function El(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Dl(e,t){t&&(Cl(`Patches`),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ol(e){kl(e),e.drafts_.forEach(jl),e.drafts_=null}function kl(e){e===wl&&(wl=e.parent_)}function Al(e){return wl=El(wl,e)}function jl(e){let t=e[tl];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ml(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];return e!==void 0&&e!==n?(n[tl].modified_&&(Ol(t),nl(4)),al(e)&&(e=Nl(t,e),t.parent_||Fl(t,e)),t.patches_&&Cl(`Patches`).generateReplacementPatches_(n[tl].base_,e,t.patches_,t.inversePatches_)):e=Nl(t,n,[]),Ol(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===$c?void 0:e}function Nl(e,t,n){if(xl(t))return t;let r=e.immer_.shouldUseStrictIteration(),i=t[tl];if(!i)return ll(t,(r,a)=>Pl(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return Fl(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let t=i.copy_,a=t,o=!1;i.type_===3&&(a=new Set(t),t.clear(),o=!0),ll(a,(r,a)=>Pl(e,i,t,r,a,n,o),r),Fl(e,t,!1),n&&e.patches_&&Cl(`Patches`).generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Pl(e,t,n,r,i,a,o){if(i==null||typeof i!=`object`&&!o)return;let s=xl(i);if(!(s&&!o)){if(il(i)){let o=Nl(e,i,a&&t&&t.type_!==3&&!dl(t.assigned_,r)?a.concat(r):void 0);if(fl(n,r,o),il(o))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(al(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;Nl(e,i),(!t||!t.scope_.parent_)&&typeof r!=`symbol`&&(ml(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&Fl(e,i)}}}function Fl(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&vl(t,n)}function Il(e,t){let n=Array.isArray(e),r={type_:+!!n,scope_:t?t.scope_:Tl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=r,a=Ll;n&&(i=[r],a=Rl);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}var Ll={get(e,t){if(t===tl)return e;let n=gl(e);if(!dl(n,t))return Bl(e,n,t);let r=n[t];return e.finalized_||!al(r)?r:r===zl(e.base_,t)?(Ul(e),e.copy_[t]=Gl(r,e)):r},has(e,t){return t in gl(e)},ownKeys(e){return Reflect.ownKeys(gl(e))},set(e,t,n){let r=Vl(gl(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=zl(gl(e),t),i=r?.[tl];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(pl(n,r)&&(n!==void 0||dl(e.base_,t)))return!0;Ul(e),Hl(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_[t]=!0,!0)},deleteProperty(e,t){return zl(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ul(e),Hl(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=gl(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!==`length`,enumerable:r.enumerable,value:n[t]}},defineProperty(){nl(11)},getPrototypeOf(e){return rl(e.base_)},setPrototypeOf(){nl(12)}},Rl={};ll(Ll,(e,t)=>{Rl[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Rl.deleteProperty=function(e,t){return Rl.set.call(this,e,t,void 0)},Rl.set=function(e,t,n){return Ll.set.call(this,e[0],t,n,e[0])};function zl(e,t){let n=e[tl];return(n?gl(n):e)[t]}function Bl(e,t,n){let r=Vl(t,n);return r?`value`in r?r.value:r.get?.call(e.draft_):void 0}function Vl(e,t){if(!(t in e))return;let n=rl(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=rl(n)}}function Hl(e){e.modified_||(e.modified_=!0,e.parent_&&Hl(e.parent_))}function Ul(e){e.copy_||=_l(e.base_,e.scope_.immer_.useStrictShallowCopy_)}var Wl=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{if(typeof e==`function`&&typeof t!=`function`){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}typeof t!=`function`&&nl(6),n!==void 0&&typeof n!=`function`&&nl(7);let r;if(al(e)){let i=Al(this),a=Gl(e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Ol(i):kl(i)}return Dl(i,n),Ml(r,i)}if(!e||typeof e!=`object`){if(r=t(e),r===void 0&&(r=e),r===$c&&(r=void 0),this.autoFreeze_&&vl(r,!0),n){let t=[],i=[];Cl(`Patches`).generateReplacementPatches_(e,r,t,i),n(t,i)}return r}nl(1,e)},this.produceWithPatches=(e,t)=>{if(typeof e==`function`)return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},typeof e?.autoFreeze==`boolean`&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy==`boolean`&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration==`boolean`&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){al(e)||nl(8),il(e)&&(e=Kl(e));let t=Al(this),n=Gl(e,void 0);return n[tl].isManual_=!0,kl(t),n}finishDraft(e,t){let n=e&&e[tl];(!n||!n.isManual_)&&nl(9);let{scope_:r}=n;return Dl(r,t),Ml(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Cl(`Patches`).applyPatches_;return il(e)?r(e,t):this.produce(e,e=>r(e,t))}};function Gl(e,t){let n=ml(e)?Cl(`MapSet`).proxyMap_(e,t):hl(e)?Cl(`MapSet`).proxySet_(e,t):Il(e,t);return(t?t.scope_:Tl()).drafts_.push(n),n}function Kl(e){return il(e)||nl(10,e),ql(e)}function ql(e){if(!al(e)||xl(e))return e;let t=e[tl],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=_l(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=_l(e,!0);return ll(n,(e,t)=>{fl(n,e,ql(t))},r),t&&(t.finalized_=!1),n}new Wl().produce;function W(e){return e}var Jl=Oo({name:`legend`,initialState:{settings:{layout:`horizontal`,align:`center`,verticalAlign:`middle`,itemSorter:`value`},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(W(t.payload))},prepare:B()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=$a(e).payload.indexOf(W(n));i>-1&&(e.payload[i]=W(r))},prepare:B()},removeLegendPayload:{reducer(e,t){var n=$a(e).payload.indexOf(W(t.payload));n>-1&&e.payload.splice(n,1)},prepare:B()}}}),{setLegendSize:Yl,setLegendSettings:Xl,addLegendPayload:Zl,replaceLegendPayload:Ql,removeLegendPayload:$l}=Jl.actions,eu=Jl.reducer,tu=n((t=>{var n=e();n.useSyncExternalStore,n.useRef,n.useEffect,n.useMemo,n.useDebugValue}));n(((e,t)=>{t.exports=tu()}))();function nu(e){e()}function ru(){let e=null,t=null;return{clear(){e=null,t=null},notify(){nu(()=>{let t=e;for(;t;)t.callback(),t=t.next})},get(){let t=[],n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0,i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var iu={notify(){},get:()=>[]};function au(e,t){let n,r=iu,i=0,a=!1;function o(e){u();let t=r.subscribe(e),n=!1;return()=>{n||(n=!0,t(),d())}}function s(){r.notify()}function c(){m.onStateChange&&m.onStateChange()}function l(){return a}function u(){i++,n||(n=t?t.addNestedSub(c):e.subscribe(c),r=ru())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=iu)}function f(){a||(a=!0,u())}function p(){a&&(a=!1,d())}let m={addNestedSub:o,notifyNestedSubs:s,handleChangeWrapper:c,isSubscribed:l,trySubscribe:f,tryUnsubscribe:p,getListeners:()=>r};return m}var ou=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,su=typeof navigator<`u`&&navigator.product===`ReactNative`,cu=ou||su?h.useLayoutEffect:h.useEffect;function lu(e,t){return e===t?e!==0||t!==0||1/e==1/t:e!==e&&t!==t}function uu(e,t){if(lu(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r{let e=au(i);return{store:i,subscription:e,getServerState:r?()=>r:void 0}},[i,r]),o=h.useMemo(()=>i.getState(),[i]);cu(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]);let s=n||mu;return h.createElement(s.Provider,{value:a},t)}var gu=hu,_u=new Set([`axisLine`,`tickLine`,`activeBar`,`activeDot`,`activeLabel`,`activeShape`,`allowEscapeViewBox`,`background`,`cursor`,`dot`,`label`,`line`,`margin`,`padding`,`position`,`shape`,`style`,`tick`,`wrapperStyle`,`radius`,`throttledEvents`]);function vu(e,t){return e==null&&t==null?!0:typeof e==`number`&&typeof t==`number`?e===t||e!==e&&t!==t:e===t}function yu(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(_u.has(n)){if(e[n]==null&&t[n]==null)continue;if(!uu(e[n],t[n]))return!1}else if(!vu(e[n],t[n]))return!1;return!0}var bu=[`contextPayload`];function xu(){return xu=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t(Xl(e))},[t,e]),null}function Nu(e){var t=I();return(0,h.useEffect)(()=>(t(Yl(e)),()=>{t(Yl({width:0,height:0}))}),[t,e]),null}function Pu(e,t,n,r){return e===`vertical`&&t!=null?{height:t}:e===`horizontal`?{width:n||r}:null}var Fu={align:`center`,iconSize:14,inactiveColor:`#ccc`,itemSorter:`value`,layout:`horizontal`,verticalAlign:`bottom`};function Iu(e){var t=wn(e,Fu),n=xi(),r=ae(),i=qc(),{width:a,height:o,wrapperStyle:s,portal:c}=t,[l,u]=Ci([n]),d=Gc(),f=Kc();if(d==null||f==null)return null;var p=d-(i?.left||0)-(i?.right||0),m=Pu(t.layout,o,a,p),_=c?s:Cu(Cu({position:`absolute`,width:m?.width||a||`auto`,height:m?.height||o||`auto`},ju(s,t,i,d,f,l)),s),v=c??r;if(v==null||n==null)return null;var y=h.createElement(`div`,{className:`recharts-legend-wrapper`,style:_,ref:u},h.createElement(Mu,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),!c&&h.createElement(Nu,{width:l.width,height:l.height}),h.createElement(Au,xu({},t,m,{margin:i,chartWidth:d,chartHeight:f,contextPayload:n})));return(0,g.createPortal)(y,v)}var Lu=h.memo(Iu,yu);Lu.displayName=`Legend`;function Ru(){return Ru=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=Gu.separator,contentStyle:n,itemStyle:r,labelStyle:i=Gu.labelStyle,payload:a,formatter:o,itemSorter:s,wrapperClassName:l,labelClassName:u,label:d,labelFormatter:f,accessibilityLayer:p=Gu.accessibilityLayer}=e,m=()=>{if(a&&a.length){var e={padding:0,margin:0},n=Ku(a,s).map((e,n)=>{if(e.type===`none`)return null;var i=e.formatter||o||Wu,{value:s,name:c}=e,l=s,u=c;if(i){var d=i(s,c,e,n,a);if(Array.isArray(d))[l,u]=d;else if(d!=null)l=d;else return null}var f=Bu(Bu({},Gu.itemStyle),{},{color:e.color||Gu.itemStyle.color},r);return h.createElement(`li`,{className:`recharts-tooltip-item`,key:`tooltip-item-${n}`,style:f},Ut(u)?h.createElement(`span`,{className:`recharts-tooltip-item-name`},u):null,Ut(u)?h.createElement(`span`,{className:`recharts-tooltip-item-separator`},t):null,h.createElement(`span`,{className:`recharts-tooltip-item-value`},l),h.createElement(`span`,{className:`recharts-tooltip-item-unit`},e.unit||``))});return h.createElement(`ul`,{className:`recharts-tooltip-item-list`,style:e},n)}return null},g=Bu(Bu({},Gu.contentStyle),n),_=Bu({margin:0},i),v=!F(d),y=v?d:``,b=c(`recharts-default-tooltip`,l),x=c(`recharts-tooltip-label`,u);v&&f&&a!=null&&(y=f(d,a));var S=p?{role:`status`,"aria-live":`assertive`}:{};return h.createElement(`div`,Ru({className:b,style:g},S),h.createElement(`p`,{className:x,style:_},h.isValidElement(y)?y:`${y}`),m())},Ju=`recharts-tooltip-wrapper`,Yu={visibility:`hidden`};function Xu(e){var{coordinate:t,translateX:n,translateY:r}=e;return c(Ju,{[`${Ju}-right`]:P(n)&&t&&P(t.x)&&n>=t.x,[`${Ju}-left`]:P(n)&&t&&P(t.x)&&n=t.y,[`${Ju}-top`]:P(r)&&t&&P(t.y)&&r0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var f=c[r];return f==null?0:o[r]?Math.max(uf+l?Math.max(u,f):Math.max(d,f)}function Qu(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function $u(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:a,reverseDirection:o,tooltipBox:s,useTranslate3d:c,viewBox:l}=e,u,d,f;return s.height>0&&s.width>0&&n?(d=Zu({allowEscapeViewBox:t,coordinate:n,key:`x`,offset:i,position:a,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=Zu({allowEscapeViewBox:t,coordinate:n,key:`y`,offset:r,position:a,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=Qu({translateX:d,translateY:f,useTranslate3d:c})):u=Yu,{cssProperties:u,cssClasses:Xu({translateX:d,translateY:f,coordinate:n})}}var ed={devToolsEnabled:!0,isSsr:!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)};function td(){var[e,t]=(0,h.useState)(()=>ed.isSsr||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches);return(0,h.useEffect)(()=>{if(window.matchMedia){var e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=()=>{t(e.matches)};return e.addEventListener(`change`,n),()=>{e.removeEventListener(`change`,n)}}},[]),e}function nd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function rd(e){for(var t=1;t({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}));h.useEffect(()=>{var t=t=>{t.key===`Escape`&&r({dismissed:!0,dismissedAtCoordinate:{x:e.coordinate?.x??0,y:e.coordinate?.y??0}})};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e.coordinate?.x,e.coordinate?.y]),n.dismissed&&((e.coordinate?.x??0)!==n.dismissedAtCoordinate.x||(e.coordinate?.y??0)!==n.dismissedAtCoordinate.y)&&r(rd(rd({},n),{},{dismissed:!1}));var{cssClasses:i,cssProperties:a}=$u({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset==`number`?e.offset:e.offset.x,offsetTop:typeof e.offset==`number`?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:{height:e.lastBoundingBox.height,width:e.lastBoundingBox.width},useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),o=rd(rd({},e.hasPortalFromProps?{}:rd(rd({transition:sd({prefersReducedMotion:t,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},a),{},{pointerEvents:`none`,position:`absolute`,top:0,left:0})),{},{visibility:!n.dismissed&&e.active&&e.hasPayload?`visible`:`hidden`},e.wrapperStyle);return h.createElement(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,tabIndex:-1,className:i,style:o,ref:e.innerRef},e.children)}var ld=h.memo(cd),ud=()=>L(e=>e.rootProps.accessibilityLayer)??!0;function dd(){return dd=Object.assign?Object.assign.bind():function(e){for(var t=1;tV(e.x)&&V(e.y),yd=e=>e.base!=null&&vd(e.base)&&vd(e),bd=e=>e.x,xd=e=>e.y,Sd=(e,t)=>{if(typeof e==`function`)return e;var n=`curve${Xt(e)}`;if((n===`curveMonotone`||n===`curveBump`)&&t){var r=_d[`${n}${t===`vertical`?`Y`:`X`}`];if(r)return r}return _d[n]||xe},Cd={connectNulls:!1,type:`linear`},wd=e=>{var{type:t=Cd.type,points:n=[],baseLine:r,layout:i,connectNulls:a=Cd.connectNulls}=e,o=Sd(t,i),s=a?n.filter(vd):n;if(Array.isArray(r)){var c,l=n.map((e,t)=>pd(pd({},e),{},{base:r[t]}));return c=i===`vertical`?Te().y(xd).x1(bd).x0(e=>e.base.x):Te().x(bd).y1(xd).y0(e=>e.base.y),c.defined(yd).curve(o)(a?l.filter(yd):l)}return(i===`vertical`&&P(r)?Te().y(xd).x1(bd).x0(r):P(r)?Te().x(bd).y1(xd).y0(r):we().x(bd).y(xd)).defined(vd).curve(o)(s)},Td=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=Jc();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},s=n&&n.length?wd(o):r;return h.createElement(`path`,dd({},S(e),gn(e),{className:c(`recharts-curve`,t),d:s===null?void 0:s,ref:i}))},Ed=[`x`,`y`,`top`,`left`,`width`,`height`,`className`];function Dd(){return Dd=Object.assign?Object.assign.bind():function(e){for(var t=1;t`M${e},${i}v${r}M${a},${t}h${n}`,Id=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:s}=e,l=Nd(e,Ed),u=kd({x:t,y:n,top:r,left:i,width:a,height:o},l);return!P(t)||!P(n)||!P(a)||!P(o)||!P(r)||!P(i)?null:h.createElement(`path`,Dd({},w(u),{className:c(`recharts-cross`,s),d:Fd(t,n,a,o,r,i)}))};function Ld(e,t,n,r){var i=r/2;return{stroke:`none`,fill:`#ccc`,x:e===`horizontal`?t.x-i:n.left+.5,y:e===`horizontal`?n.top+.5:t.y-i,width:e===`horizontal`?r:n.width-1,height:e===`horizontal`?n.height-1:r}}function Rd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zd(e){for(var t=1;te.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`),Wd=(e,t,n)=>e.map(e=>`${Ud(e)} ${t}ms ${n}`).join(`,`),Gd=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((e,t)=>e.filter(e=>t.includes(e))),Kd=(e,t)=>Object.keys(t).reduce((n,r)=>zd(zd({},n),{},{[r]:e(r,t[r])}),{});function qd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function G(e){for(var t=1;te+(t-e)*n,Qd=e=>{var{from:t,to:n}=e;return t!==n},$d=(e,t,n)=>{var r=Kd((t,n)=>{if(Qd(n)){var[r,i]=e(n.from,n.to,n.velocity);return G(G({},n),{},{from:r,velocity:i})}return n},t);return n<1?Kd((e,t)=>Qd(t)&&r[e]!=null?G(G({},t),{},{velocity:Zd(t.velocity,r[e].velocity,n),from:Zd(t.from,r[e].from,n)}):t,t):$d(e,r,n-1)};function ef(e,t,n,r,i,a){var o,s=r.reduce((n,r)=>G(G({},n),{},{[r]:{from:e[r],velocity:0,to:t[r]}}),{}),c=()=>Kd((e,t)=>t.from,s),l=()=>!Object.values(s).filter(Qd).length,u=null,d=r=>{o||=r;var f=(r-o)/n.dt;s=$d(n,s,f),i(G(G(G({},e),t),c())),o=r,l()||(u=a.setTimeout(d))};return()=>(u=a.setTimeout(d),()=>{var e;(e=u)==null||e()})}function tf(e,t,n,r,i,a,o){var s=null,c=i.reduce((n,r)=>{var i=e[r],a=t[r];return i==null||a==null?n:G(G({},n),{},{[r]:[i,a]})},{}),l,u=i=>{l||=i;var d=(i-l)/r,f=Kd((e,t)=>Zd(...t,n(d)),c);if(a(G(G(G({},e),t),f)),d<1)s=o.setTimeout(u);else{var p=Kd((e,t)=>Zd(...t,n(1)),c);a(G(G(G({},e),t),p))}};return()=>(s=o.setTimeout(u),()=>{var e;(e=s)==null||e()})}var nf=(e,t,n,r,i,a)=>{var o=Gd(e,t);return n==null?()=>(i(G(G({},e),t)),()=>{}):n.isStepper===!0?ef(e,t,n,o,i,a):tf(e,t,n,r,o,i,a)},rf=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],af=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),of=(e,t)=>n=>af(rf(e,t),n),sf=(e,t)=>n=>af([...rf(e,t).map((e,t)=>e*t).slice(1),0],n),cf=e=>{var t,n=e.split(`(`);if(n.length!==2||n[0]!==`cubic-bezier`)return null;var r=(t=n[1])==null||(t=t.split(`)`)[0])==null?void 0:t.split(`,`);if(r==null||r.length!==4)return null;var i=r.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]},lf=function(){var e=[...arguments];if(e.length===1)switch(e[0]){case`linear`:return[0,0,1,1];case`ease`:return[.25,.1,.25,1];case`ease-in`:return[.42,0,1,1];case`ease-out`:return[.42,0,.58,1];case`ease-in-out`:return[0,0,.58,1];default:var t=cf(e[0]);if(t)return t}return e.length===4?e:[0,0,1,1]},uf=(e,t,n,r)=>{var i=of(e,n),a=of(t,r),o=sf(e,n),s=e=>e>1?1:e<0?0:e,c=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var c=i(n)-t,l=o(n);if(Math.abs(c-t)<1e-4||l<1e-4)return a(n);n=s(n-c/l)}return a(n)};return c.isStepper=!1,c},df=function(){return uf(...lf(...arguments))},ff=function(){var{stiff:e=100,damping:t=8,dt:n=17}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=(r,i,a)=>{var o=a+(-(r-i)*e-a*t)*n/1e3,s=a*n/1e3+r;return Math.abs(s-i)<1e-4&&Math.abs(o)<1e-4?[i,0]:[s,o]};return r.isStepper=!0,r.dt=n,r},pf=e=>{if(typeof e==`string`)switch(e){case`ease`:case`ease-in-out`:case`ease-out`:case`ease-in`:case`linear`:return df(e);case`spring`:return ff();default:if(e.split(`(`)[0]===`cubic-bezier`)return df(e)}return typeof e==`function`?e:null};function mf(e){var t,n=()=>null,r=!1,i=null,a=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var[s,...c]=o;if(typeof s==`number`){i=e.setTimeout(a.bind(null,c),s);return}a(s),i=e.setTimeout(a.bind(null,c));return}typeof o==`string`&&(t=o,n(t)),typeof o==`object`&&(t=o,n(t)),typeof o==`function`&&o()}};return{stop:()=>{r=!0},start:e=>{r=!1,i&&=(i(),null),a(e)},subscribe:e=>(n=e,()=>{n=()=>null}),getTimeoutController:()=>e}}var hf=class{setTimeout(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(i))};return r=requestAnimationFrame(i),()=>{r!=null&&cancelAnimationFrame(r)}}};function gf(){return mf(new hf)}var _f=(0,h.createContext)(gf);function vf(e,t){var n=(0,h.useContext)(_f);return(0,h.useMemo)(()=>t??n(e),[e,t,n])}var yf={begin:0,duration:1e3,easing:`ease`,isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},bf={t:0},xf={t:1};function Sf(e){var t=wn(e,yf),{isActive:n,canBegin:r,duration:i,easing:a,begin:o,onAnimationEnd:s,onAnimationStart:c,children:l}=t,u=td(),d=n===`auto`?!ed.isSsr&&!u:n,f=vf(t.animationId,t.animationManager),[p,m]=(0,h.useState)(d?bf:xf),g=(0,h.useRef)(null);return(0,h.useEffect)(()=>{d||m(xf)},[d]),(0,h.useEffect)(()=>{if(!d||!r)return Qt;var e=nf(bf,xf,pf(a),i,m,f.getTimeoutController());return f.start([c,o,()=>{g.current=e()},i,s]),()=>{f.stop(),g.current&&g.current(),s()}},[d,r,i,a,o,c,s,f]),l(p.t)}function Cf(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`animation-`,n=(0,h.useRef)(Gt(t)),r=(0,h.useRef)(e);return r.current!==e&&(n.current=Gt(t),r.current=e),n.current}var wf=[`radius`],Tf=[`radius`],Ef,Df,Of,kf,Af,jf,Mf,Nf,Pf,Ff;function If(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Lf(e){for(var t=1;t{var a=zt(n),o=zt(r),s=Math.min(Math.abs(a)/2,Math.abs(o)/2),c=o>=0?1:-1,l=a>=0?1:-1,u=+(o>=0&&a>=0||o<0&&a<0),d;if(s>0&&Array.isArray(i)){for(var f=[0,0,0,0],p=0,m=4;ps?s:h}d=N(Ef||=Wf([`M`,`,`,``]),e,t+c*f[0]),f[0]>0&&(d+=N(Df||=Wf([`A `,`,`,`,0,0,`,`,`,`,`,``]),f[0],f[0],u,e+l*f[0],t)),d+=N(Of||=Wf([`L `,`,`,``]),e+n-l*f[1],t),f[1]>0&&(d+=N(kf||=Wf([`A `,`,`,`,0,0,`,`, + height and width.`,w,T,i,a,o,s,n),h.createElement(`div`,{id:f?`${f}`:void 0,className:c(`recharts-responsive-container`,p),style:jc(jc({},g),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:l}),ref:_},h.createElement(`div`,{style:Dc({width:i,height:a})},h.createElement(Lc,{width:w,height:T},u)))}),Bc=(0,h.forwardRef)((e,t)=>{var n=Rc();if(Cs(n.width)&&Cs(n.height))return e.children;var{width:r,height:i}=Oc({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=Sc(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return P(a)&&P(o)?h.createElement(Lc,{width:a,height:o},e.children):h.createElement(zc,kc({},e,{width:r,height:i,ref:t}))});function Vc(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Hc=()=>{var e=mc(),t=L(dc),n=L(gc),r=L(hc)?.padding;return!e||!n||!r?t:{width:n.width-r.left-r.right,height:n.height-r.top-r.bottom,x:r.left,y:r.top}},Uc={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},Wc=()=>L(uc)??Uc,Gc=()=>L(qs),Kc=()=>L(Js),qc=()=>L(e=>e.layout.margin),U=e=>e.layout.layoutType,Jc=()=>L(U),Yc=()=>{var e=Jc();if(e===`horizontal`||e===`vertical`)return e},Xc=e=>{var t=e.layout.layoutType;if(t===`centric`||t===`radial`)return t},Zc=()=>Jc()!==void 0,Qc=e=>{var t=I(),n=mc(),{width:r,height:i}=e,a=Rc(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),(0,h.useEffect)(()=>{!n&&Cs(o)&&Cs(s)&&t(ys({width:o,height:s}))},[t,n,o,s]),null},$c=Symbol.for(`immer-nothing`),el=Symbol.for(`immer-draftable`),tl=Symbol.for(`immer-state`);function nl(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var rl=Object.getPrototypeOf;function il(e){return!!e&&!!e[tl]}function al(e){return e?cl(e)||Array.isArray(e)||!!e[el]||!!e.constructor?.[el]||ml(e)||hl(e):!1}var ol=Object.prototype.constructor.toString(),sl=new WeakMap;function cl(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let n=Object.hasOwnProperty.call(t,`constructor`)&&t.constructor;if(n===Object)return!0;if(typeof n!=`function`)return!1;let r=sl.get(n);return r===void 0&&(r=Function.toString.call(n),sl.set(n,r)),r===ol}function ll(e,t,n=!0){ul(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ul(e){let t=e[tl];return t?t.type_:Array.isArray(e)?1:ml(e)?2:hl(e)?3:0}function dl(e,t){return ul(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function fl(e,t,n){let r=ul(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function pl(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function ml(e){return e instanceof Map}function hl(e){return e instanceof Set}function gl(e){return e.copy_||e.base_}function _l(e,t){if(ml(e))return new Map(e);if(hl(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let n=cl(e);if(t===!0||t===`class_only`&&!n){let t=Object.getOwnPropertyDescriptors(e);delete t[tl];let n=Reflect.ownKeys(t);for(let r=0;r1&&Object.defineProperties(e,{set:bl,add:bl,clear:bl,delete:bl}),Object.freeze(e),t&&Object.values(e).forEach(e=>vl(e,!0)),e)}function yl(){nl(2)}var bl={value:yl};function xl(e){return typeof e!=`object`||!e||Object.isFrozen(e)}var Sl={};function Cl(e){let t=Sl[e];return t||nl(0,e),t}var wl;function Tl(){return wl}function El(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Dl(e,t){t&&(Cl(`Patches`),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ol(e){kl(e),e.drafts_.forEach(jl),e.drafts_=null}function kl(e){e===wl&&(wl=e.parent_)}function Al(e){return wl=El(wl,e)}function jl(e){let t=e[tl];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ml(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];return e!==void 0&&e!==n?(n[tl].modified_&&(Ol(t),nl(4)),al(e)&&(e=Nl(t,e),t.parent_||Fl(t,e)),t.patches_&&Cl(`Patches`).generateReplacementPatches_(n[tl].base_,e,t.patches_,t.inversePatches_)):e=Nl(t,n,[]),Ol(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===$c?void 0:e}function Nl(e,t,n){if(xl(t))return t;let r=e.immer_.shouldUseStrictIteration(),i=t[tl];if(!i)return ll(t,(r,a)=>Pl(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return Fl(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let t=i.copy_,a=t,o=!1;i.type_===3&&(a=new Set(t),t.clear(),o=!0),ll(a,(r,a)=>Pl(e,i,t,r,a,n,o),r),Fl(e,t,!1),n&&e.patches_&&Cl(`Patches`).generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Pl(e,t,n,r,i,a,o){if(i==null||typeof i!=`object`&&!o)return;let s=xl(i);if(!(s&&!o)){if(il(i)){let o=Nl(e,i,a&&t&&t.type_!==3&&!dl(t.assigned_,r)?a.concat(r):void 0);if(fl(n,r,o),il(o))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(al(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;Nl(e,i),(!t||!t.scope_.parent_)&&typeof r!=`symbol`&&(ml(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&Fl(e,i)}}}function Fl(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&vl(t,n)}function Il(e,t){let n=Array.isArray(e),r={type_:+!!n,scope_:t?t.scope_:Tl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=r,a=Ll;n&&(i=[r],a=Rl);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}var Ll={get(e,t){if(t===tl)return e;let n=gl(e);if(!dl(n,t))return Bl(e,n,t);let r=n[t];return e.finalized_||!al(r)?r:r===zl(e.base_,t)?(Ul(e),e.copy_[t]=Gl(r,e)):r},has(e,t){return t in gl(e)},ownKeys(e){return Reflect.ownKeys(gl(e))},set(e,t,n){let r=Vl(gl(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=zl(gl(e),t),i=r?.[tl];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(pl(n,r)&&(n!==void 0||dl(e.base_,t)))return!0;Ul(e),Hl(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_[t]=!0,!0)},deleteProperty(e,t){return zl(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ul(e),Hl(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=gl(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!==`length`,enumerable:r.enumerable,value:n[t]}},defineProperty(){nl(11)},getPrototypeOf(e){return rl(e.base_)},setPrototypeOf(){nl(12)}},Rl={};ll(Ll,(e,t)=>{Rl[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Rl.deleteProperty=function(e,t){return Rl.set.call(this,e,t,void 0)},Rl.set=function(e,t,n){return Ll.set.call(this,e[0],t,n,e[0])};function zl(e,t){let n=e[tl];return(n?gl(n):e)[t]}function Bl(e,t,n){let r=Vl(t,n);return r?`value`in r?r.value:r.get?.call(e.draft_):void 0}function Vl(e,t){if(!(t in e))return;let n=rl(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=rl(n)}}function Hl(e){e.modified_||(e.modified_=!0,e.parent_&&Hl(e.parent_))}function Ul(e){e.copy_||=_l(e.base_,e.scope_.immer_.useStrictShallowCopy_)}var Wl=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{if(typeof e==`function`&&typeof t!=`function`){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}typeof t!=`function`&&nl(6),n!==void 0&&typeof n!=`function`&&nl(7);let r;if(al(e)){let i=Al(this),a=Gl(e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Ol(i):kl(i)}return Dl(i,n),Ml(r,i)}if(!e||typeof e!=`object`){if(r=t(e),r===void 0&&(r=e),r===$c&&(r=void 0),this.autoFreeze_&&vl(r,!0),n){let t=[],i=[];Cl(`Patches`).generateReplacementPatches_(e,r,t,i),n(t,i)}return r}nl(1,e)},this.produceWithPatches=(e,t)=>{if(typeof e==`function`)return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},typeof e?.autoFreeze==`boolean`&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy==`boolean`&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration==`boolean`&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){al(e)||nl(8),il(e)&&(e=Kl(e));let t=Al(this),n=Gl(e,void 0);return n[tl].isManual_=!0,kl(t),n}finishDraft(e,t){let n=e&&e[tl];(!n||!n.isManual_)&&nl(9);let{scope_:r}=n;return Dl(r,t),Ml(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Cl(`Patches`).applyPatches_;return il(e)?r(e,t):this.produce(e,e=>r(e,t))}};function Gl(e,t){let n=ml(e)?Cl(`MapSet`).proxyMap_(e,t):hl(e)?Cl(`MapSet`).proxySet_(e,t):Il(e,t);return(t?t.scope_:Tl()).drafts_.push(n),n}function Kl(e){return il(e)||nl(10,e),ql(e)}function ql(e){if(!al(e)||xl(e))return e;let t=e[tl],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=_l(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=_l(e,!0);return ll(n,(e,t)=>{fl(n,e,ql(t))},r),t&&(t.finalized_=!1),n}new Wl().produce;function W(e){return e}var Jl=Oo({name:`legend`,initialState:{settings:{layout:`horizontal`,align:`center`,verticalAlign:`middle`,itemSorter:`value`},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(W(t.payload))},prepare:B()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=$a(e).payload.indexOf(W(n));i>-1&&(e.payload[i]=W(r))},prepare:B()},removeLegendPayload:{reducer(e,t){var n=$a(e).payload.indexOf(W(t.payload));n>-1&&e.payload.splice(n,1)},prepare:B()}}}),{setLegendSize:Yl,setLegendSettings:Xl,addLegendPayload:Zl,replaceLegendPayload:Ql,removeLegendPayload:$l}=Jl.actions,eu=Jl.reducer,tu=t((e=>{var t=i();t.useSyncExternalStore,t.useRef,t.useEffect,t.useMemo,t.useDebugValue}));t(((e,t)=>{t.exports=tu()}))();function nu(e){e()}function ru(){let e=null,t=null;return{clear(){e=null,t=null},notify(){nu(()=>{let t=e;for(;t;)t.callback(),t=t.next})},get(){let t=[],n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0,i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var iu={notify(){},get:()=>[]};function au(e,t){let n,r=iu,i=0,a=!1;function o(e){u();let t=r.subscribe(e),n=!1;return()=>{n||(n=!0,t(),d())}}function s(){r.notify()}function c(){m.onStateChange&&m.onStateChange()}function l(){return a}function u(){i++,n||(n=t?t.addNestedSub(c):e.subscribe(c),r=ru())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=iu)}function f(){a||(a=!0,u())}function p(){a&&(a=!1,d())}let m={addNestedSub:o,notifyNestedSubs:s,handleChangeWrapper:c,isSubscribed:l,trySubscribe:f,tryUnsubscribe:p,getListeners:()=>r};return m}var ou=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,su=typeof navigator<`u`&&navigator.product===`ReactNative`,cu=ou||su?h.useLayoutEffect:h.useEffect;function lu(e,t){return e===t?e!==0||t!==0||1/e==1/t:e!==e&&t!==t}function uu(e,t){if(lu(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r{let e=au(i);return{store:i,subscription:e,getServerState:r?()=>r:void 0}},[i,r]),o=h.useMemo(()=>i.getState(),[i]);cu(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]);let s=n||mu;return h.createElement(s.Provider,{value:a},t)}var gu=hu,_u=new Set([`axisLine`,`tickLine`,`activeBar`,`activeDot`,`activeLabel`,`activeShape`,`allowEscapeViewBox`,`background`,`cursor`,`dot`,`label`,`line`,`margin`,`padding`,`position`,`shape`,`style`,`tick`,`wrapperStyle`,`radius`,`throttledEvents`]);function vu(e,t){return e==null&&t==null?!0:typeof e==`number`&&typeof t==`number`?e===t||e!==e&&t!==t:e===t}function yu(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(_u.has(n)){if(e[n]==null&&t[n]==null)continue;if(!uu(e[n],t[n]))return!1}else if(!vu(e[n],t[n]))return!1;return!0}var bu=[`contextPayload`];function xu(){return xu=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t(Xl(e))},[t,e]),null}function Nu(e){var t=I();return(0,h.useEffect)(()=>(t(Yl(e)),()=>{t(Yl({width:0,height:0}))}),[t,e]),null}function Pu(e,t,n,r){return e===`vertical`&&t!=null?{height:t}:e===`horizontal`?{width:n||r}:null}var Fu={align:`center`,iconSize:14,inactiveColor:`#ccc`,itemSorter:`value`,layout:`horizontal`,verticalAlign:`bottom`};function Iu(e){var t=wn(e,Fu),n=xi(),r=ae(),i=qc(),{width:a,height:o,wrapperStyle:s,portal:c}=t,[l,u]=Ci([n]),d=Gc(),f=Kc();if(d==null||f==null)return null;var p=d-(i?.left||0)-(i?.right||0),m=Pu(t.layout,o,a,p),_=c?s:Cu(Cu({position:`absolute`,width:m?.width||a||`auto`,height:m?.height||o||`auto`},ju(s,t,i,d,f,l)),s),v=c??r;if(v==null||n==null)return null;var y=h.createElement(`div`,{className:`recharts-legend-wrapper`,style:_,ref:u},h.createElement(Mu,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),!c&&h.createElement(Nu,{width:l.width,height:l.height}),h.createElement(Au,xu({},t,m,{margin:i,chartWidth:d,chartHeight:f,contextPayload:n})));return(0,g.createPortal)(y,v)}var Lu=h.memo(Iu,yu);Lu.displayName=`Legend`;function Ru(){return Ru=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=Gu.separator,contentStyle:n,itemStyle:r,labelStyle:i=Gu.labelStyle,payload:a,formatter:o,itemSorter:s,wrapperClassName:l,labelClassName:u,label:d,labelFormatter:f,accessibilityLayer:p=Gu.accessibilityLayer}=e,m=()=>{if(a&&a.length){var e={padding:0,margin:0},n=Ku(a,s).map((e,n)=>{if(e.type===`none`)return null;var i=e.formatter||o||Wu,{value:s,name:c}=e,l=s,u=c;if(i){var d=i(s,c,e,n,a);if(Array.isArray(d))[l,u]=d;else if(d!=null)l=d;else return null}var f=Bu(Bu({},Gu.itemStyle),{},{color:e.color||Gu.itemStyle.color},r);return h.createElement(`li`,{className:`recharts-tooltip-item`,key:`tooltip-item-${n}`,style:f},Ut(u)?h.createElement(`span`,{className:`recharts-tooltip-item-name`},u):null,Ut(u)?h.createElement(`span`,{className:`recharts-tooltip-item-separator`},t):null,h.createElement(`span`,{className:`recharts-tooltip-item-value`},l),h.createElement(`span`,{className:`recharts-tooltip-item-unit`},e.unit||``))});return h.createElement(`ul`,{className:`recharts-tooltip-item-list`,style:e},n)}return null},g=Bu(Bu({},Gu.contentStyle),n),_=Bu({margin:0},i),v=!F(d),y=v?d:``,b=c(`recharts-default-tooltip`,l),x=c(`recharts-tooltip-label`,u);v&&f&&a!=null&&(y=f(d,a));var S=p?{role:`status`,"aria-live":`assertive`}:{};return h.createElement(`div`,Ru({className:b,style:g},S),h.createElement(`p`,{className:x,style:_},h.isValidElement(y)?y:`${y}`),m())},Ju=`recharts-tooltip-wrapper`,Yu={visibility:`hidden`};function Xu(e){var{coordinate:t,translateX:n,translateY:r}=e;return c(Ju,{[`${Ju}-right`]:P(n)&&t&&P(t.x)&&n>=t.x,[`${Ju}-left`]:P(n)&&t&&P(t.x)&&n=t.y,[`${Ju}-top`]:P(r)&&t&&P(t.y)&&r0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var f=c[r];return f==null?0:o[r]?Math.max(uf+l?Math.max(u,f):Math.max(d,f)}function Qu(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function $u(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:a,reverseDirection:o,tooltipBox:s,useTranslate3d:c,viewBox:l}=e,u,d,f;return s.height>0&&s.width>0&&n?(d=Zu({allowEscapeViewBox:t,coordinate:n,key:`x`,offset:i,position:a,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=Zu({allowEscapeViewBox:t,coordinate:n,key:`y`,offset:r,position:a,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=Qu({translateX:d,translateY:f,useTranslate3d:c})):u=Yu,{cssProperties:u,cssClasses:Xu({translateX:d,translateY:f,coordinate:n})}}var ed={devToolsEnabled:!0,isSsr:!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)};function td(){var[e,t]=(0,h.useState)(()=>ed.isSsr||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches);return(0,h.useEffect)(()=>{if(window.matchMedia){var e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=()=>{t(e.matches)};return e.addEventListener(`change`,n),()=>{e.removeEventListener(`change`,n)}}},[]),e}function nd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function rd(e){for(var t=1;t({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}));h.useEffect(()=>{var t=t=>{t.key===`Escape`&&r({dismissed:!0,dismissedAtCoordinate:{x:e.coordinate?.x??0,y:e.coordinate?.y??0}})};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e.coordinate?.x,e.coordinate?.y]),n.dismissed&&((e.coordinate?.x??0)!==n.dismissedAtCoordinate.x||(e.coordinate?.y??0)!==n.dismissedAtCoordinate.y)&&r(rd(rd({},n),{},{dismissed:!1}));var{cssClasses:i,cssProperties:a}=$u({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset==`number`?e.offset:e.offset.x,offsetTop:typeof e.offset==`number`?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:{height:e.lastBoundingBox.height,width:e.lastBoundingBox.width},useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),o=rd(rd({},e.hasPortalFromProps?{}:rd(rd({transition:sd({prefersReducedMotion:t,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},a),{},{pointerEvents:`none`,position:`absolute`,top:0,left:0})),{},{visibility:!n.dismissed&&e.active&&e.hasPayload?`visible`:`hidden`},e.wrapperStyle);return h.createElement(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,tabIndex:-1,className:i,style:o,ref:e.innerRef},e.children)}var ld=h.memo(cd),ud=()=>L(e=>e.rootProps.accessibilityLayer)??!0;function dd(){return dd=Object.assign?Object.assign.bind():function(e){for(var t=1;tV(e.x)&&V(e.y),yd=e=>e.base!=null&&vd(e.base)&&vd(e),bd=e=>e.x,xd=e=>e.y,Sd=(e,t)=>{if(typeof e==`function`)return e;var n=`curve${Xt(e)}`;if((n===`curveMonotone`||n===`curveBump`)&&t){var r=_d[`${n}${t===`vertical`?`Y`:`X`}`];if(r)return r}return _d[n]||xe},Cd={connectNulls:!1,type:`linear`},wd=e=>{var{type:t=Cd.type,points:n=[],baseLine:r,layout:i,connectNulls:a=Cd.connectNulls}=e,o=Sd(t,i),s=a?n.filter(vd):n;if(Array.isArray(r)){var c,l=n.map((e,t)=>pd(pd({},e),{},{base:r[t]}));return c=i===`vertical`?Te().y(xd).x1(bd).x0(e=>e.base.x):Te().x(bd).y1(xd).y0(e=>e.base.y),c.defined(yd).curve(o)(a?l.filter(yd):l)}return(i===`vertical`&&P(r)?Te().y(xd).x1(bd).x0(r):P(r)?Te().x(bd).y1(xd).y0(r):we().x(bd).y(xd)).defined(vd).curve(o)(s)},Td=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=Jc();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},s=n&&n.length?wd(o):r;return h.createElement(`path`,dd({},S(e),gn(e),{className:c(`recharts-curve`,t),d:s===null?void 0:s,ref:i}))},Ed=[`x`,`y`,`top`,`left`,`width`,`height`,`className`];function Dd(){return Dd=Object.assign?Object.assign.bind():function(e){for(var t=1;t`M${e},${i}v${r}M${a},${t}h${n}`,Id=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:s}=e,l=Nd(e,Ed),u=kd({x:t,y:n,top:r,left:i,width:a,height:o},l);return!P(t)||!P(n)||!P(a)||!P(o)||!P(r)||!P(i)?null:h.createElement(`path`,Dd({},w(u),{className:c(`recharts-cross`,s),d:Fd(t,n,a,o,r,i)}))};function Ld(e,t,n,r){var i=r/2;return{stroke:`none`,fill:`#ccc`,x:e===`horizontal`?t.x-i:n.left+.5,y:e===`horizontal`?n.top+.5:t.y-i,width:e===`horizontal`?r:n.width-1,height:e===`horizontal`?n.height-1:r}}function Rd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zd(e){for(var t=1;te.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`),Wd=(e,t,n)=>e.map(e=>`${Ud(e)} ${t}ms ${n}`).join(`,`),Gd=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((e,t)=>e.filter(e=>t.includes(e))),Kd=(e,t)=>Object.keys(t).reduce((n,r)=>zd(zd({},n),{},{[r]:e(r,t[r])}),{});function qd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function G(e){for(var t=1;te+(t-e)*n,Qd=e=>{var{from:t,to:n}=e;return t!==n},$d=(e,t,n)=>{var r=Kd((t,n)=>{if(Qd(n)){var[r,i]=e(n.from,n.to,n.velocity);return G(G({},n),{},{from:r,velocity:i})}return n},t);return n<1?Kd((e,t)=>Qd(t)&&r[e]!=null?G(G({},t),{},{velocity:Zd(t.velocity,r[e].velocity,n),from:Zd(t.from,r[e].from,n)}):t,t):$d(e,r,n-1)};function ef(e,t,n,r,i,a){var o,s=r.reduce((n,r)=>G(G({},n),{},{[r]:{from:e[r],velocity:0,to:t[r]}}),{}),c=()=>Kd((e,t)=>t.from,s),l=()=>!Object.values(s).filter(Qd).length,u=null,d=r=>{o||=r;var f=(r-o)/n.dt;s=$d(n,s,f),i(G(G(G({},e),t),c())),o=r,l()||(u=a.setTimeout(d))};return()=>(u=a.setTimeout(d),()=>{var e;(e=u)==null||e()})}function tf(e,t,n,r,i,a,o){var s=null,c=i.reduce((n,r)=>{var i=e[r],a=t[r];return i==null||a==null?n:G(G({},n),{},{[r]:[i,a]})},{}),l,u=i=>{l||=i;var d=(i-l)/r,f=Kd((e,t)=>Zd(...t,n(d)),c);if(a(G(G(G({},e),t),f)),d<1)s=o.setTimeout(u);else{var p=Kd((e,t)=>Zd(...t,n(1)),c);a(G(G(G({},e),t),p))}};return()=>(s=o.setTimeout(u),()=>{var e;(e=s)==null||e()})}var nf=(e,t,n,r,i,a)=>{var o=Gd(e,t);return n==null?()=>(i(G(G({},e),t)),()=>{}):n.isStepper===!0?ef(e,t,n,o,i,a):tf(e,t,n,r,o,i,a)},rf=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],af=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),of=(e,t)=>n=>af(rf(e,t),n),sf=(e,t)=>n=>af([...rf(e,t).map((e,t)=>e*t).slice(1),0],n),cf=e=>{var t,n=e.split(`(`);if(n.length!==2||n[0]!==`cubic-bezier`)return null;var r=(t=n[1])==null||(t=t.split(`)`)[0])==null?void 0:t.split(`,`);if(r==null||r.length!==4)return null;var i=r.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]},lf=function(){var e=[...arguments];if(e.length===1)switch(e[0]){case`linear`:return[0,0,1,1];case`ease`:return[.25,.1,.25,1];case`ease-in`:return[.42,0,1,1];case`ease-out`:return[.42,0,.58,1];case`ease-in-out`:return[0,0,.58,1];default:var t=cf(e[0]);if(t)return t}return e.length===4?e:[0,0,1,1]},uf=(e,t,n,r)=>{var i=of(e,n),a=of(t,r),o=sf(e,n),s=e=>e>1?1:e<0?0:e,c=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var c=i(n)-t,l=o(n);if(Math.abs(c-t)<1e-4||l<1e-4)return a(n);n=s(n-c/l)}return a(n)};return c.isStepper=!1,c},df=function(){return uf(...lf(...arguments))},ff=function(){var{stiff:e=100,damping:t=8,dt:n=17}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=(r,i,a)=>{var o=a+(-(r-i)*e-a*t)*n/1e3,s=a*n/1e3+r;return Math.abs(s-i)<1e-4&&Math.abs(o)<1e-4?[i,0]:[s,o]};return r.isStepper=!0,r.dt=n,r},pf=e=>{if(typeof e==`string`)switch(e){case`ease`:case`ease-in-out`:case`ease-out`:case`ease-in`:case`linear`:return df(e);case`spring`:return ff();default:if(e.split(`(`)[0]===`cubic-bezier`)return df(e)}return typeof e==`function`?e:null};function mf(e){var t,n=()=>null,r=!1,i=null,a=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var[s,...c]=o;if(typeof s==`number`){i=e.setTimeout(a.bind(null,c),s);return}a(s),i=e.setTimeout(a.bind(null,c));return}typeof o==`string`&&(t=o,n(t)),typeof o==`object`&&(t=o,n(t)),typeof o==`function`&&o()}};return{stop:()=>{r=!0},start:e=>{r=!1,i&&=(i(),null),a(e)},subscribe:e=>(n=e,()=>{n=()=>null}),getTimeoutController:()=>e}}var hf=class{setTimeout(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(i))};return r=requestAnimationFrame(i),()=>{r!=null&&cancelAnimationFrame(r)}}};function gf(){return mf(new hf)}var _f=(0,h.createContext)(gf);function vf(e,t){var n=(0,h.useContext)(_f);return(0,h.useMemo)(()=>t??n(e),[e,t,n])}var yf={begin:0,duration:1e3,easing:`ease`,isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},bf={t:0},xf={t:1};function Sf(e){var t=wn(e,yf),{isActive:n,canBegin:r,duration:i,easing:a,begin:o,onAnimationEnd:s,onAnimationStart:c,children:l}=t,u=td(),d=n===`auto`?!ed.isSsr&&!u:n,f=vf(t.animationId,t.animationManager),[p,m]=(0,h.useState)(d?bf:xf),g=(0,h.useRef)(null);return(0,h.useEffect)(()=>{d||m(xf)},[d]),(0,h.useEffect)(()=>{if(!d||!r)return Qt;var e=nf(bf,xf,pf(a),i,m,f.getTimeoutController());return f.start([c,o,()=>{g.current=e()},i,s]),()=>{f.stop(),g.current&&g.current(),s()}},[d,r,i,a,o,c,s,f]),l(p.t)}function Cf(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`animation-`,n=(0,h.useRef)(Gt(t)),r=(0,h.useRef)(e);return r.current!==e&&(n.current=Gt(t),r.current=e),n.current}var wf=[`radius`],Tf=[`radius`],Ef,Df,Of,kf,Af,jf,Mf,Nf,Pf,Ff;function If(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Lf(e){for(var t=1;t{var a=zt(n),o=zt(r),s=Math.min(Math.abs(a)/2,Math.abs(o)/2),c=o>=0?1:-1,l=a>=0?1:-1,u=+(o>=0&&a>=0||o<0&&a<0),d;if(s>0&&Array.isArray(i)){for(var f=[0,0,0,0],p=0,m=4;ps?s:h}d=N(Ef||=Wf([`M`,`,`,``]),e,t+c*f[0]),f[0]>0&&(d+=N(Df||=Wf([`A `,`,`,`,0,0,`,`,`,`,`,``]),f[0],f[0],u,e+l*f[0],t)),d+=N(Of||=Wf([`L `,`,`,``]),e+n-l*f[1],t),f[1]>0&&(d+=N(kf||=Wf([`A `,`,`,`,0,0,`,`, `,`,`,``]),f[1],f[1],u,e+n,t+c*f[1])),d+=N(Af||=Wf([`L `,`,`,``]),e+n,t+r-c*f[2]),f[2]>0&&(d+=N(jf||=Wf([`A `,`,`,`,0,0,`,`, `,`,`,``]),f[2],f[2],u,e+n-l*f[2],t+r)),d+=N(Mf||=Wf([`L `,`,`,``]),e+l*f[3],t+r),f[3]>0&&(d+=N(Nf||=Wf([`A `,`,`,`,0,0,`,`, `,`,`,``]),f[3],f[3],u,e,t+r-c*f[3])),d+=`Z`}else if(s>0&&i===+i&&i>0){var g=Math.min(s,i);d=N(Pf||=Wf(`M .,. @@ -31,12 +31,12 @@ import{c as e,d as t,l as n,n as r,o as i,s as a,t as o,u as s}from"./utils-o8v- `]),f.x,f.y,a,a,+(u<0),d.x,d.y,i,i,+(_>180),+(u<0),m.x,m.y,a,a,+(u<0),h.x,h.y);if(r>0){var{circleTangency:y,lineTangency:b,theta:x}=yp({cx:t,cy:n,radius:r,angle:c,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),{circleTangency:S,lineTangency:C,theta:w}=yp({cx:t,cy:n,radius:r,angle:l,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),T=s?Math.abs(c-l):Math.abs(c-l)-x-w;if(T<0&&a===0)return`${v}L${t},${n}Z`;v+=N(mp||=_p([`L`,`,`,` A`,`,`,`,0,0,`,`,`,`,`,` A`,`,`,`,0,`,`,`,`,`,`,`,` - A`,`,`,`,0,0,`,`,`,`,`,`Z`]),C.x,C.y,a,a,+(u<0),S.x,S.y,r,r,+(T>180),+(u>0),y.x,y.y,a,a,+(u<0),b.x,b.y)}else v+=N(hp||=_p([`L`,`,`,`Z`]),t,n);return v},Sp={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Cp=e=>{var t=wn(e,Sp),{cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:o,forceCornerRadius:s,cornerIsExternal:l,startAngle:u,endAngle:d,className:f}=t;if(a0&&Math.abs(u-d)<360?xp({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(g,m/2),forceCornerRadius:s,cornerIsExternal:l,startAngle:u,endAngle:d}):bp({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:u,endAngle:d});return h.createElement(`path`,gp({},w(t),{className:p,d:_}))};function wp(e,t,n){if(e===`horizontal`)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e===`vertical`)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(hn(t)){if(e===`centric`){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:s}=t,c=tp(r,i,a,s),l=tp(r,i,o,s);return[{x:c.x,y:c.y},{x:l.x,y:l.y}]}return cp(t)}}function Tp(e){return Mt(e)?NaN:Number(e)}function Ep(e){return e?(e=Tp(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function Dp(e,t,n){n&&typeof n!=`number`&&ui(e,t,n)&&(t=n=void 0),e=Ep(e),t===void 0?(t=e,e=0):t=Ep(t),n=n===void 0?ee.chartData,kp=R([Op],e=>{var t=e.chartData==null?0:e.chartData.length-1;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),Ap=(e,t,n,r)=>r?kp(e):Op(e),jp=(e,t,n)=>n?kp(e):Op(e);function Mp(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(V(t)&&V(n))return!0}return!1}function Np(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function Pp(e,t){if(t&&typeof e!=`function`&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,a;if(V(n))i=n;else if(typeof n==`function`)return;if(V(r))a=r;else if(typeof r==`function`)return;var o=[i,a];if(Mp(o))return o}}function Fp(e,t,n){if(!(!n&&t==null)){if(typeof e==`function`&&t!=null)try{var r=e(t,n);if(Mp(r))return Np(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,a]=e,o,s;if(i===`auto`)t!=null&&(o=Math.min(...t));else if(P(i))o=i;else if(typeof i==`function`)try{t!=null&&(o=i(t?.[0]))}catch{}else if(typeof i==`string`&&Bs.test(i)){var c=Bs.exec(i);if(c==null||c[1]==null||t==null)o=void 0;else{var l=+c[1];o=t[0]-l}}else o=t?.[0];if(a===`auto`)t!=null&&(s=Math.max(...t));else if(P(a))s=a;else if(typeof a==`function`)try{t!=null&&(s=a(t?.[1]))}catch{}else if(typeof a==`string`&&Vs.test(a)){var u=Vs.exec(a);if(u==null||u[1]==null||t==null)s=void 0;else{var d=+u[1];s=t[1]+d}}else s=t?.[1];var f=[o,s];if(Mp(f))return t==null?f:Np(f,t,n)}}}var K=t(n(((e,t)=>{(function(e){var n=1e9,r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:`2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286`},i=!0,a=`[DecimalError] `,o=a+`Invalid argument: `,s=a+`Exponent out of range: `,c=Math.floor,l=Math.pow,u=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d,f=1e7,p=7,m=9007199254740991,h=c(m/p),g={};g.absoluteValue=g.abs=function(){var e=new this.constructor(this);return e.s&&=1,e},g.comparedTo=g.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},g.decimalPlaces=g.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*p;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n},g.dividedBy=g.div=function(e){return b(this,new this.constructor(e))},g.dividedToIntegerBy=g.idiv=function(e){var t=this,n=t.constructor;return D(b(t,new n(e),0,1),n.precision)},g.equals=g.eq=function(e){return!this.cmp(e)},g.exponent=function(){return S(this)},g.greaterThan=g.gt=function(e){return this.cmp(e)>0},g.greaterThanOrEqualTo=g.gte=function(e){return this.cmp(e)>=0},g.isInteger=g.isint=function(){return this.e>this.d.length-2},g.isNegative=g.isneg=function(){return this.s<0},g.isPositive=g.ispos=function(){return this.s>0},g.isZero=function(){return this.s===0},g.lessThan=g.lt=function(e){return this.cmp(e)<0},g.lessThanOrEqualTo=g.lte=function(e){return this.cmp(e)<1},g.logarithm=g.log=function(e){var t,n=this,r=n.constructor,o=r.precision,s=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(d))throw Error(a+`NaN`);if(n.s<1)throw Error(a+(n.s?`NaN`:`-Infinity`));return n.eq(d)?new r(0):(i=!1,t=b(T(n,s),T(e,s),s),i=!0,D(t,o))},g.minus=g.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O(t,e):_(t,(e.s=-e.s,e))},g.modulo=g.mod=function(e){var t,n=this,r=n.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(a+`NaN`);return n.s?(i=!1,t=b(n,e,0,1).times(e),i=!0,n.minus(t)):D(new r(n),o)},g.naturalExponential=g.exp=function(){return x(this)},g.naturalLogarithm=g.ln=function(){return T(this)},g.negated=g.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},g.plus=g.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?_(t,e):O(t,(e.s=-e.s,e))},g.precision=g.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(o+e);if(t=S(i)+1,r=i.d.length-1,n=r*p+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},g.squareRoot=g.sqrt=function(){var e,t,n,r,o,s,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(a+`NaN`)}for(e=S(u),i=!1,o=Math.sqrt(+u),o==0||o==1/0?(t=y(u.d),(t.length+e)%2==0&&(t+=`0`),o=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),o==1/0?t=`5e`+e:(t=o.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+e),r=new d(t)):r=new d(o.toString()),n=d.precision,o=l=n+3;;)if(s=r,r=s.plus(b(u,s,l+2)).times(.5),y(s.d).slice(0,l)===(t=y(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),o==l&&t==`4999`){if(D(s,n+1,0),s.times(s).eq(u)){r=s;break}}else if(t!=`9999`)break;l+=4}return i=!0,D(r,n)},g.times=g.mul=function(e){var t,n,r,a,o,s,c,l,u,d=this,p=d.constructor,m=d.d,h=(e=new p(e)).d;if(!d.s||!e.s)return new p(0);for(e.s*=d.s,n=d.e+e.e,l=m.length,u=h.length,l=0;){for(t=0,a=l+r;a>r;)c=o[a]+h[r]*m[a-r-1]+t,o[a--]=c%f|0,t=c/f|0;o[a]=(o[a]+t)%f|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,i?D(e,p.precision):e},g.toDecimalPlaces=g.todp=function(e,t){var r=this,i=r.constructor;return r=new i(r),e===void 0?r:(v(e,0,n),t===void 0?t=i.rounding:v(t,0,8),D(r,e+S(r)+1,t))},g.toExponential=function(e,t){var r,i=this,a=i.constructor;return e===void 0?r=k(i,!0):(v(e,0,n),t===void 0?t=a.rounding:v(t,0,8),i=D(new a(i),e+1,t),r=k(i,!0,e+1)),r},g.toFixed=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?k(a):(v(e,0,n),t===void 0?t=o.rounding:v(t,0,8),i=D(new o(a),e+S(a)+1,t),r=k(i.abs(),!1,e+S(i)+1),a.isneg()&&!a.isZero()?`-`+r:r)},g.toInteger=g.toint=function(){var e=this,t=e.constructor;return D(new t(e),S(e)+1,t.rounding)},g.toNumber=function(){return+this},g.toPower=g.pow=function(e){var t,n,r,o,s,l,u=this,f=u.constructor,h=12,g=+(e=new f(e));if(!e.s)return new f(d);if(u=new f(u),!u.s){if(e.s<1)throw Error(a+`Infinity`);return u}if(u.eq(d))return u;if(r=f.precision,e.eq(d))return D(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,s=u.s,!l){if(s<0)throw Error(a+`NaN`)}else if((n=g<0?-g:g)<=m){for(o=new f(d),t=Math.ceil(r/p+4),i=!1;n%2&&(o=o.times(u),ee(o.d,t)),n=c(n/2),n!==0;)u=u.times(u),ee(u.d,t);return i=!0,e.s<0?new f(d).div(o):D(o,r)}return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,i=!1,o=e.times(T(u,r+h)),i=!0,o=x(o),o.s=s,o},g.toPrecision=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?(r=S(a),i=k(a,r<=o.toExpNeg||r>=o.toExpPos)):(v(e,1,n),t===void 0?t=o.rounding:v(t,0,8),a=D(new o(a),e,t),r=S(a),i=k(a,e<=r||r<=o.toExpNeg,e)),i},g.toSignificantDigits=g.tosd=function(e,t){var r=this,i=r.constructor;return e===void 0?(e=i.precision,t=i.rounding):(v(e,1,n),t===void 0?t=i.rounding:v(t,0,8)),D(new i(r),e,t)},g.toString=g.valueOf=g.val=g.toJSON=function(){var e=this,t=S(e),n=e.constructor;return k(e,t<=n.toExpNeg||t>=n.toExpPos)};function _(e,t){var n,r,a,o,s,c,l,u,d=e.constructor,m=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),i?D(t,m):t;if(l=e.d,u=t.d,s=e.e,a=t.e,l=l.slice(),o=s-a,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,a=s,c=l.length),s=Math.ceil(m/p),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/f|0,l[o]%=f;for(n&&(l.unshift(n),++a),c=l.length;l[--c]==0;)l.pop();return t.d=l,t.e=a,i?D(t,m):t}function v(e,t,n){if(e!==~~e||en)throw Error(o+e)}function y(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;tr?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]1;)e.shift()}return function(r,i,o,s){var c,l,u,d,m,h,g,_,v,y,b,x,C,w,T,E,O,k,ee=r.constructor,te=r.s==i.s?1:-1,A=r.d,j=i.d;if(!r.s)return new ee(r);if(!i.s)throw Error(a+`Division by zero`);for(l=r.e-i.e,O=j.length,T=A.length,g=new ee(te),_=g.d=[],u=0;j[u]==(A[u]||0);)++u;if(j[u]>(A[u]||0)&&--l,x=o==null?o=ee.precision:s?o+(S(r)-S(i))+1:o,x<0)return new ee(0);if(x=x/p+2|0,u=0,O==1)for(d=0,j=j[0],x++;(u1&&(j=e(j,d),A=e(A,d),O=j.length,T=A.length),w=O,v=A.slice(0,O),y=v.length;y=f/2&&++E;do d=0,c=t(j,v,O,y),c<0?(b=v[0],O!=y&&(b=b*f+(v[1]||0)),d=b/E|0,d>1?(d>=f&&(d=f-1),m=e(j,d),h=m.length,y=v.length,c=t(m,v,h,y),c==1&&(d--,n(m,O16)throw Error(s+S(e));if(!e.s)return new m(d);for(t==null?(i=!1,u=h):u=t,c=new m(.03125);e.abs().gte(.1);)e=e.times(c),p+=5;for(r=Math.log(l(2,p))/Math.LN10*2+5|0,u+=r,n=a=o=new m(d),m.precision=u;;){if(a=D(a.times(e),u),n=n.times(++f),c=o.plus(b(a,n,u)),y(c.d).slice(0,u)===y(o.d).slice(0,u)){for(;p--;)o=D(o.times(o),u);return m.precision=h,t==null?(i=!0,D(o,h)):o}o=c}}function S(e){for(var t=e.e*p,n=e.d[0];n>=10;n/=10)t++;return t}function C(e,t,n){if(t>e.LN10.sd())throw i=!0,n&&(e.precision=n),Error(a+`LN10 precision limit exceeded`);return D(new e(e.LN10),t)}function w(e){for(var t=``;e--;)t+=`0`;return t}function T(e,t){var n,r,o,s,c,l,u,f,p,m=1,h=10,g=e,_=g.d,v=g.constructor,x=v.precision;if(g.s<1)throw Error(a+(g.s?`NaN`:`-Infinity`));if(g.eq(d))return new v(0);if(t==null?(i=!1,f=x):f=t,g.eq(10))return t??(i=!0),C(v,f);if(f+=h,v.precision=f,n=y(_),r=n.charAt(0),s=S(g),Math.abs(s)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(e),n=y(g.d),r=n.charAt(0),m++;s=S(g),r>1?(g=new v(`0.`+n),s++):g=new v(r+`.`+n.slice(1))}else return u=C(v,f+2,x).times(s+``),g=T(new v(r+`.`+n.slice(1)),f-h).plus(u),v.precision=x,t==null?(i=!0,D(g,x)):g;for(l=c=g=b(g.minus(d),g.plus(d),f),p=D(g.times(g),f),o=3;;){if(c=D(c.times(p),f),u=l.plus(b(c,new v(o),f)),y(u.d).slice(0,f)===y(l.d).slice(0,f))return l=l.times(2),s!==0&&(l=l.plus(C(v,f+2,x).times(s+``))),l=b(l,new v(m),f),v.precision=x,t==null?(i=!0,D(l,x)):l;l=u,o+=2}}function E(e,t){var n,r,a;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=c(n/p),e.d=[],r=(n+1)%p,n<0&&(r+=p),rh||e.e<-h))throw Error(s+n)}else e.s=0,e.e=0,e.d=[0];return e}function D(e,t,n){var r,a,o,u,d,m,g,_,v=e.d;for(u=1,o=v[0];o>=10;o/=10)u++;if(r=t-u,r<0)r+=p,a=t,g=v[_=0];else{if(_=Math.ceil((r+1)/p),o=v.length,_>=o)return e;for(g=o=v[_],u=1;o>=10;o/=10)u++;r%=p,a=r-p+u}if(n!==void 0&&(o=l(10,u-a-1),d=g/o%10|0,m=t<0||v[_+1]!==void 0||g%o,m=n<4?(d||m)&&(n==0||n==(e.s<0?3:2)):d>5||d==5&&(n==4||m||n==6&&(r>0?a>0?g/l(10,u-a):0:v[_-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return m?(o=S(e),v.length=1,t=t-o-1,v[0]=l(10,(p-t%p)%p),e.e=c(-t/p)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(r==0?(v.length=_,o=1,_--):(v.length=_+1,o=l(10,p-r),v[_]=a>0?(g/l(10,u-a)%l(10,a)|0)*o:0),m)for(;;)if(_==0){(v[0]+=o)==f&&(v[0]=1,++e.e);break}else{if(v[_]+=o,v[_]!=f)break;v[_--]=0,o=1}for(r=v.length;v[--r]===0;)v.pop();if(i&&(e.e>h||e.e<-h))throw Error(s+S(e));return e}function O(e,t){var n,r,a,o,s,c,l,u,d,m,h=e.constructor,g=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),i?D(t,g):t;if(l=e.d,m=t.d,r=t.e,u=e.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=m.length):(n=m,r=u,c=l.length),a=Math.max(Math.ceil(g/p),c)+2,s>a&&(s=a,n.length=1),n.reverse(),a=s;a--;)n.push(0);n.reverse()}else{for(a=l.length,c=m.length,d=a0;--a)l[c++]=0;for(a=m.length;a>s;){if(l[--a]0?a=a.charAt(0)+`.`+a.slice(1)+w(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(i<0?`e`:`e+`)+i):i<0?(a=`0.`+w(-i-1)+a,n&&(r=n-o)>0&&(a+=w(r))):i>=o?(a+=w(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+w(r))):((r=i+1)0&&(i+1===o&&(a+=`.`),a+=w(r))),e.s<0?`-`+a:a}function ee(e,t){if(e.length>t)return e.length=t,!0}function te(e){var t,n,r;function i(e){var t=this;if(!(t instanceof i))return new i(e);if(t.constructor=i,e instanceof i){t.s=e.s,t.e=e.e,t.d=(e=e.d)?e.slice():e;return}if(typeof e==`number`){if(e*0!=0)throw Error(o+e);if(e>0)t.s=1;else if(e<0)e=-e,t.s=-1;else{t.s=0,t.e=0,t.d=[0];return}if(e===~~e&&e<1e7){t.e=0,t.d=[e];return}return E(t,e.toString())}if(typeof e!=`string`)throw Error(o+e);if(e.charCodeAt(0)===45?(e=e.slice(1),t.s=-1):t.s=1,u.test(e))E(t,e);else throw Error(o+e)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=te,i.config=i.set=A,e===void 0&&(e={}),e)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`LN10`],t=0;t=s[t+1]&&i<=s[t+2])this[r]=i;else throw Error(o+r+`: `+i)}if((i=e[r=`LN10`])!==void 0){if(i==Math.LN10)this[r]=new this(i);else throw Error(o+r+`: `+i)}return this}r=te(r),r.default=r.Decimal=r,d=new r(1),typeof define==`function`&&define.amd?define(function(){return r}):t!==void 0&&t.exports?t.exports=r:(e||=typeof self<`u`&&self&&self.self==self?self:Function(`return this`)(),e.Decimal=r)})(e)}))());function Ip(e){return e===0?1:Math.floor(new K.default(e).abs().log(10).toNumber())+1}function Lp(e,t,n){for(var r=new K.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var Rp=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},zp=(e,t,n)=>{if(e.lte(0))return new K.default(0);var r=Ip(e.toNumber()),i=new K.default(10).pow(r),a=e.div(i),o=r===1?.1:.05,s=new K.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return t?new K.default(s.toNumber()):new K.default(Math.ceil(s.toNumber()))},Bp=(e,t,n)=>{if(e.lte(0))return new K.default(0);var r=[1,2,2.5,5],i=e.toNumber(),a=Math.floor(new K.default(i).abs().log(10).toNumber()),o=new K.default(10).pow(a),s=e.div(o).toNumber(),c=r.findIndex(e=>e>=s-1e-10);if(c===-1&&(o=o.mul(10),c=0),c+=n,c>=r.length){var l=Math.floor(c/r.length);c%=r.length,o=o.mul(new K.default(10).pow(l))}var u=r[c]??1,d=new K.default(u).mul(o);return t?d:new K.default(Math.ceil(d.toNumber()))},Vp=(e,t,n)=>{var r=new K.default(1),i=new K.default(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new K.default(10).pow(Ip(e)-1),i=new K.default(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new K.default(Math.floor(e)))}else e===0?i=new K.default(Math.floor((t-1)/2)):n||(i=new K.default(Math.floor(e)));for(var o=Math.floor((t-1)/2),s=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:zp;if(!Number.isFinite((t-e)/(n-1)))return{step:new K.default(0),tickMin:new K.default(0),tickMax:new K.default(0)};var o=a(new K.default(t).sub(e).div(n-1),r,i),s;e<=0&&t>=0?s=new K.default(0):(s=new K.default(e).add(t).div(2),s=s.sub(new K.default(s).mod(o)));var c=Math.ceil(s.sub(e).div(o).toNumber()),l=Math.ceil(new K.default(t).sub(s).div(o).toNumber()),u=c+l+1;return u>n?Hp(e,t,n,r,i+1,a):(u0?l+(n-u):l,c=t>0?c:c+(n-u)),{step:o,tickMin:s.sub(new K.default(c).mul(o)),tickMax:s.add(new K.default(l).mul(o))})},Up=function(e){var[t,n]=e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`auto`,o=Math.max(r,2),[s,c]=Rp([t,n]);if(s===-1/0||c===1/0){var l=c===1/0?[s,...Array(r-1).fill(1/0)]:[...Array(r-1).fill(-1/0),c];return t>n?l.reverse():l}if(s===c)return Vp(s,r,i);var{step:u,tickMin:d,tickMax:f}=Hp(s,c,o,i,0,a===`snap125`?Bp:zp),p=Lp(d,f.add(new K.default(.1).mul(u)),u);return t>n?p.reverse():p},Wp=function(e,t){var[n,r]=e,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`auto`,[o,s]=Rp([n,r]);if(o===-1/0||s===1/0)return[n,r];if(o===s)return[o];var c=a===`snap125`?Bp:zp,l=Math.max(t,2),u=c(new K.default(s).sub(o).div(l-1),i,0),d=[...Lp(new K.default(o),new K.default(s),u),s];return i===!1&&(d=d.map(e=>Math.round(e))),n>r?d.reverse():d},Gp=e=>e.rootProps.barCategoryGap,Kp=e=>e.rootProps.stackOffset,qp=e=>e.rootProps.reverseStackOrder,Jp=e=>e.options.chartName,Yp=e=>e.rootProps.syncId,Xp=e=>e.rootProps.syncMethod,Zp=e=>e.options.eventEmitter,Qp=e=>e.rootProps.baseValue,$p={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},em={allowDecimals:!1,allowDuplicatedCategory:!0,allowDataOverflow:!1,angle:0,angleAxisId:0,axisLine:!0,axisLineType:`polygon`,cx:0,cy:0,hide:!1,includeHidden:!1,label:!1,niceTicks:`auto`,orientation:`outer`,reversed:!1,scale:`auto`,tick:!0,tickLine:!0,tickSize:8,type:`auto`,zIndex:$p.axis},tm={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,niceTicks:`auto`,label:!1,orientation:`right`,radiusAxisId:0,reversed:!1,scale:`auto`,stroke:`#ccc`,tick:!0,tickCount:5,tickLine:!0,type:`auto`,zIndex:$p.axis},nm=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function rm(e,t,n){if(n!==`auto`)return n;if(e!=null)return As(e,t)?`category`:`number`}function im(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function am(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},Xc],(e,t)=>{if(e!=null)return e;var n=rm(t,`angleAxis`,lm.type)??`category`;return am(am({},lm),{},{type:n})}),fm=R([(e,t)=>e.polarAxis.radiusAxis[t],Xc],(e,t)=>{if(e!=null)return e;var n=rm(t,`radiusAxis`,um.type)??`category`;return am(am({},um),{},{type:n})}),pm=e=>e.polarOptions,mm=R([qs,Js,uc],np),hm=R([pm,mm],(e,t)=>{if(e!=null)return Kt(e.innerRadius,t,0)}),gm=R([pm,mm],(e,t)=>{if(e!=null)return Kt(e.outerRadius,t,t*.8)}),_m=R([pm],e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]});R([dm,_m],nm);var vm=R([mm,hm,gm],(e,t,n)=>{if(e!=null&&t!=null&&n!=null)return[t,n]});R([fm,vm],nm);var ym=R([U,pm,hm,gm,qs,Js],(e,t,n,r,i,a)=>{if(!(e!==`centric`&&e!==`radial`||t==null||n==null||r==null)){var{cx:o,cy:s,startAngle:c,endAngle:l}=t;return{cx:Kt(o,i,i/2),cy:Kt(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:l,clockWise:!1}}}),q=(e,t)=>t,bm=(e,t,n)=>n;function xm(e){return e?.id}function Sm(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(e=>{var t=e.data??r;if(t!=null&&t.length!==0){var n=xm(e);t.forEach((t,r)=>{var s=a==null||i?r:String(H(t,a,null)),c=H(t,e.dataKey,0),l=o.has(s)?o.get(s):{};Object.assign(l,{[n]:c}),o.set(s,l)})}}),Array.from(o.values())}function Cm(e){return`stackId`in e&&e.stackId!=null&&e.dataKey!=null}var wm=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function Tm(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function Em(e,t){if(e.length===t.length){for(var n=0;n{var t=U(e);return t===`horizontal`?`xAxis`:t===`vertical`?`yAxis`:t===`centric`?`angleAxis`:`radiusAxis`},Dm=e=>e.tooltip.settings.axisId;function Om(e){if(e!=null){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(e){var t=i[0],n=i[1];return t<=n?e>=t&&e<=n:e>=n&&e<=t},bandwidth:n?()=>n.call(e):void 0,ticks:t?n=>t.call(e,n):void 0,map:(t,n)=>{var r=e(t);if(r!=null){if(e.bandwidth&&n!=null&&n.position){var i=e.bandwidth();switch(n.position){case`middle`:r+=i/2;break;case`end`:r+=i}}return r}}}}}var km=(e,t)=>{if(t!=null)switch(e){case`linear`:if(!Mp(t)){for(var n,r,i=0;ir)&&(r=a))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t;default:return t}};function Am(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function jm(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Mm(e){let t,n,r;e.length===2?(t=e===Am||e===jm?e:Nm,n=e,r=e):(t=Am,n=(t,n)=>Am(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<0?i=t+1:a=t}while(i>>1;n(e[t],r)<=0?i=t+1:a=t}while(in&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function Nm(){return 0}function Pm(e){return e===null?NaN:+e}function*Fm(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var Im=Mm(Am),Lm=Im.right;Im.left,Mm(Pm).center;var Rm=class extends Map{constructor(e,t=Hm){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(zm(this,e))}has(e){return super.has(zm(this,e))}set(e,t){return super.set(Bm(this,e),t)}delete(e){return super.delete(Vm(this,e))}};function zm({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function Bm({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Vm({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Hm(e){return typeof e==`object`&&e?e.valueOf():e}function Um(e=Am){if(e===Am)return Wm;if(typeof e!=`function`)throw TypeError(`compare is not a function`);return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Wm(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var Gm=Math.sqrt(50),Km=Math.sqrt(10),qm=Math.sqrt(2);function Jm(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=Gm?10:a>=Km?5:a>=qm?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/lt&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*lt&&--c),c0))return[];if(e===t)return[e];let r=t=i))return[];let s=a-i+1,c=Array(s);if(r){if(o<0)for(let e=0;e=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function $m(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function eh(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?Wm:Um(i);r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));eh(e,t,u,d,i)}let a=e[t],o=n,s=r;for(th(e,n,t),i(e[r],a)>0&&th(e,n,r);o0;)--s}i(e[n],a)===0?th(e,n,s):(++s,th(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function th(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function nh(e,t,n){if(e=Float64Array.from(Fm(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return $m(e);if(t>=1)return Qm(e);var r,i=(r-1)*t,a=Math.floor(i),o=Qm(eh(e,a).subarray(0,a+1));return o+($m(e.subarray(a+1))-o)*(i-a)}}function rh(e,t,n=Pm){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function ih(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++rt&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function vh(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?yh:vh,c=l=null,m}function m(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return m.invert=function(n){return o(i((l||=s(t,e.map(r),u))(n)))},m.domain=function(t){return arguments.length?(e=Array.from(t,ph),p()):e.slice()},m.range=function(e){return arguments.length?(t=Array.from(e),p()):t.slice()},m.rangeRound=function(e){return t=Array.from(e),n=f,p()},m.clamp=function(e){return arguments.length?(o=e?!0:hh,p()):o!==hh},m.interpolate=function(e){return arguments.length?(n=e,p()):n},m.unknown=function(e){return arguments.length?(a=e,m):a},function(e,t){return r=e,i=t,p()}}function Sh(){return xh()(hh,hh)}function Ch(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function wh(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Th(e){return e=wh(Math.abs(e)),e?e[1]:NaN}function Eh(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Dh(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var Oh=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function kh(e){if(!(t=Oh.exec(e)))throw Error(`invalid format: `+e);var t;return new Ah({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}kh.prototype=Ah.prototype;function Ah(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}Ah.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function jh(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0)}return r>0?e.slice(0,r)+e.slice(i+1):e}var Mh;function Nh(e,t){var n=wh(e,t);if(!n)return Mh=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(Mh=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+wh(e,Math.max(0,t+a-1))[0]}function Ph(e,t){var n=wh(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var Fh={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:Ch,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Ph(e*100,t),r:Ph,s:Nh,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Ih(e){return e}var Lh=Array.prototype.map,Rh=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function zh(e){var t=e.grouping===void 0||e.thousands===void 0?Ih:Eh(Lh.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?Ih:Dh(Lh.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=kh(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):Fh[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=Fh[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=jh(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&Mh!==void 0?Rh[8+Mh/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++op||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Th(t)/3)))*3,r=10**-n,i=l((e=kh(e),e.type=`f`,e),{suffix:Rh[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var Bh,Vh,Hh;Uh({thousands:`,`,grouping:[3],currency:[`$`,``]});function Uh(e){return Bh=zh(e),Vh=Bh.format,Hh=Bh.formatPrefix,Bh}function Wh(e){return Math.max(0,-Th(Math.abs(e)))}function Gh(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Th(t)/3)))*3-Th(Math.abs(e)))}function Kh(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Th(t)-Th(e))+1}function qh(e,t,n,r){var i=Zm(e,t,n),a;switch(r=kh(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=Gh(i,o))&&(r.precision=a),Hh(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=Kh(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=Wh(i))&&(r.precision=a-(r.type===`%`)*2)}return Vh(r)}function Jh(e){var t=e.domain;return e.ticks=function(e){var n=t();return Ym(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return qh(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s0;){if(l=Xm(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function Yh(){var e=Sh();return e.copy=function(){return bh(e,Yh())},ah.apply(e,arguments),Jh(e)}function Xh(e){var t;function n(e){return e==null||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,ph),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return Xh(e).unknown(t)},e=arguments.length?Array.from(e,ph):[0,1],Jh(n)}function Zh(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return ae**+t}function ig(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function ag(e){return(t,n)=>-e(-t,n)}function og(e){let t=e(Qh,$h),n=t.domain,r=10,i,a;function o(){return i=ig(r),a=rg(r),n()[0]<0?(i=ag(i),a=ag(a),e(eg,tg)):e(Qh,$h),t}return t.base=function(e){return arguments.length?(r=+e,o()):r},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{let t=n(),o=t[0],s=t[t.length-1],c=s0){for(;l<=u;++l)for(d=1;ds)break;m.push(f)}}else for(;l<=u;++l)for(d=r-1;d>=1;--d)if(f=l>0?d/a(-l):d*a(l),!(fs)break;m.push(f)}m.length*2{if(e??=10,n??=r===10?`s`:`,`,typeof n!=`function`&&(!(r%1)&&(n=kh(n)).precision==null&&(n.trim=!0),n=Vh(n)),e===1/0)return n;let o=Math.max(1,r*e/t.ticks().length);return e=>{let t=e/a(Math.round(i(e)));return t*rn(Zh(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function sg(){let e=og(xh()).domain([1,10]);return e.copy=()=>bh(e,sg()).base(e.base()),ah.apply(e,arguments),e}function cg(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function lg(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function ug(e){var t=1,n=e(cg(t),lg(t));return n.constant=function(n){return arguments.length?e(cg(t=+n),lg(t)):t},Jh(n)}function dg(){var e=ug(xh());return e.copy=function(){return bh(e,dg()).constant(e.constant())},ah.apply(e,arguments)}function fg(e){return function(t){return t<0?-((-t)**+e):t**+e}}function pg(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function mg(e){return e<0?-e*e:e*e}function hg(e){var t=e(hh,hh),n=1;function r(){return n===1?e(hh,hh):n===.5?e(pg,mg):e(fg(n),fg(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},Jh(t)}function gg(){var e=hg(xh());return e.copy=function(){return bh(e,gg()).exponent(e.exponent())},ah.apply(e,arguments),e}function _g(){return gg.apply(null,arguments).exponent(.5)}function vg(e){return Math.sign(e)*e*e}function yg(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function bg(){var e=Sh(),t=[0,1],n=!1,r;function i(t){var i=yg(e(t));return isNaN(i)?r:n?Math.round(i):i}return i.invert=function(t){return e.invert(vg(t))},i.domain=function(t){return arguments.length?(e.domain(t),i):e.domain()},i.range=function(n){return arguments.length?(e.range((t=Array.from(n,ph)).map(vg)),i):t.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(n=!!e,i):n},i.clamp=function(t){return arguments.length?(e.clamp(t),i):e.clamp()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return bg(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},ah.apply(i,arguments),Jh(i)}function xg(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r0?n[i-1]:e[0],i=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Sg().domain([e,t]).range(i).unknown(a)},ah.apply(Jh(o),arguments)}function Cg(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[Lm(e,i,0,r)]:n}return i.domain=function(n){return arguments.length?(e=Array.from(n),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(n){return arguments.length?(t=Array.from(n),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return Cg().domain(e).range(t).unknown(n)},ah.apply(i,arguments)}var wg=new Date,Tg=new Date;function Y(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(sY(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e){if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}}),n&&(i.count=(t,r)=>(wg.setTime(+t),Tg.setTime(+r),e(wg),e(Tg),Math.floor(n(wg,Tg))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var Eg=Y(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Eg.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Y(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Eg),Eg.range;var Dg=1e3,Og=Dg*60,kg=Og*60,Ag=kg*24,jg=Ag*7,Mg=Ag*30,Ng=Ag*365,Pg=Y(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Dg)},(e,t)=>(t-e)/Dg,e=>e.getUTCSeconds());Pg.range;var Fg=Y(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Dg)},(e,t)=>{e.setTime(+e+t*Og)},(e,t)=>(t-e)/Og,e=>e.getMinutes());Fg.range;var Ig=Y(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Og)},(e,t)=>(t-e)/Og,e=>e.getUTCMinutes());Ig.range;var Lg=Y(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Dg-e.getMinutes()*Og)},(e,t)=>{e.setTime(+e+t*kg)},(e,t)=>(t-e)/kg,e=>e.getHours());Lg.range;var Rg=Y(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*kg)},(e,t)=>(t-e)/kg,e=>e.getUTCHours());Rg.range;var zg=Y(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Og)/Ag,e=>e.getDate()-1);zg.range;var Bg=Y(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ag,e=>e.getUTCDate()-1);Bg.range;var Vg=Y(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ag,e=>Math.floor(e/Ag));Vg.range;function Hg(e){return Y(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Og)/jg)}var Ug=Hg(0),Wg=Hg(1),Gg=Hg(2),Kg=Hg(3),qg=Hg(4),Jg=Hg(5),Yg=Hg(6);Ug.range,Wg.range,Gg.range,Kg.range,qg.range,Jg.range,Yg.range;function Xg(e){return Y(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/jg)}var Zg=Xg(0),Qg=Xg(1),$g=Xg(2),e_=Xg(3),t_=Xg(4),n_=Xg(5),r_=Xg(6);Zg.range,Qg.range,$g.range,e_.range,t_.range,n_.range,r_.range;var i_=Y(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());i_.range;var a_=Y(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());a_.range;var o_=Y(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());o_.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Y(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),o_.range;var s_=Y(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());s_.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Y(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),s_.range;function c_(e,t,n,r,i,a){let o=[[Pg,1,Dg],[Pg,5,5*Dg],[Pg,15,15*Dg],[Pg,30,30*Dg],[a,1,Og],[a,5,5*Og],[a,15,15*Og],[a,30,30*Og],[i,1,kg],[i,3,3*kg],[i,6,6*kg],[i,12,12*kg],[r,1,Ag],[r,2,2*Ag],[n,1,jg],[t,1,Mg],[t,3,3*Mg],[e,1,Ng]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(Zm(t/Ng,n/Ng,r));if(a===0)return Eg.every(Math.max(Zm(t,n,r),1));let[s,c]=o[i/o[a-1][2]53)return null;`w`in r||(r.w=1),`Z`in r?(a=m_(h_(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?Qg.ceil(a):Qg(a),a=Bg.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=p_(h_(r.y,0,1)),o=a.getDay(),a=o>4||o===0?Wg.ceil(a):Wg(a),a=zg.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else(`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?m_(h_(r.y,0,1)).getUTCDay():p_(h_(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,m_(r)):p_(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in __?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function ee(e,n,r){return w(e,t,n,r)}function te(e,t,r){return w(e,n,t,r)}function A(e,t,n){return w(e,r,t,n)}function j(e){return o[e.getDay()]}function ne(e){return a[e.getDay()]}function re(e){return c[e.getMonth()]}function ie(e){return s[e.getMonth()]}function ae(e){return i[+(e.getHours()>=12)]}function M(e){return 1+~~(e.getMonth()/3)}function oe(e){return o[e.getUTCDay()]}function se(e){return a[e.getUTCDay()]}function ce(e){return c[e.getUTCMonth()]}function le(e){return s[e.getUTCMonth()]}function ue(e){return i[+(e.getUTCHours()>=12)]}function de(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}var __={"-":``,_:` `,0:`0`},X=/^\s*\d+/,v_=/^%/,y_=/[\\^$*+?|[\]().{}]/g;function Z(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function C_(e,t,n){var r=X.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function w_(e,t,n){var r=X.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function T_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function E_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function D_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function O_(e,t,n){var r=X.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function k_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function A_(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function j_(e,t,n){var r=X.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function M_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function N_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function P_(e,t,n){var r=X.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function F_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function I_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function L_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function R_(e,t,n){var r=X.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function z_(e,t,n){var r=X.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function B_(e,t,n){var r=v_.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function V_(e,t,n){var r=X.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function H_(e,t,n){var r=X.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function U_(e,t){return Z(e.getDate(),t,2)}function W_(e,t){return Z(e.getHours(),t,2)}function G_(e,t){return Z(e.getHours()%12||12,t,2)}function K_(e,t){return Z(1+zg.count(o_(e),e),t,3)}function q_(e,t){return Z(e.getMilliseconds(),t,3)}function J_(e,t){return q_(e,t)+`000`}function Y_(e,t){return Z(e.getMonth()+1,t,2)}function X_(e,t){return Z(e.getMinutes(),t,2)}function Z_(e,t){return Z(e.getSeconds(),t,2)}function Q_(e){var t=e.getDay();return t===0?7:t}function $_(e,t){return Z(Ug.count(o_(e)-1,e),t,2)}function ev(e){var t=e.getDay();return t>=4||t===0?qg(e):qg.ceil(e)}function tv(e,t){return e=ev(e),Z(qg.count(o_(e),e)+(o_(e).getDay()===4),t,2)}function nv(e){return e.getDay()}function rv(e,t){return Z(Wg.count(o_(e)-1,e),t,2)}function iv(e,t){return Z(e.getFullYear()%100,t,2)}function av(e,t){return e=ev(e),Z(e.getFullYear()%100,t,2)}function ov(e,t){return Z(e.getFullYear()%1e4,t,4)}function sv(e,t){var n=e.getDay();return e=n>=4||n===0?qg(e):qg.ceil(e),Z(e.getFullYear()%1e4,t,4)}function cv(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+Z(t/60|0,`0`,2)+Z(t%60,`0`,2)}function lv(e,t){return Z(e.getUTCDate(),t,2)}function uv(e,t){return Z(e.getUTCHours(),t,2)}function dv(e,t){return Z(e.getUTCHours()%12||12,t,2)}function fv(e,t){return Z(1+Bg.count(s_(e),e),t,3)}function pv(e,t){return Z(e.getUTCMilliseconds(),t,3)}function mv(e,t){return pv(e,t)+`000`}function hv(e,t){return Z(e.getUTCMonth()+1,t,2)}function gv(e,t){return Z(e.getUTCMinutes(),t,2)}function _v(e,t){return Z(e.getUTCSeconds(),t,2)}function vv(e){var t=e.getUTCDay();return t===0?7:t}function yv(e,t){return Z(Zg.count(s_(e)-1,e),t,2)}function bv(e){var t=e.getUTCDay();return t>=4||t===0?t_(e):t_.ceil(e)}function xv(e,t){return e=bv(e),Z(t_.count(s_(e),e)+(s_(e).getUTCDay()===4),t,2)}function Sv(e){return e.getUTCDay()}function Cv(e,t){return Z(Qg.count(s_(e)-1,e),t,2)}function wv(e,t){return Z(e.getUTCFullYear()%100,t,2)}function Tv(e,t){return e=bv(e),Z(e.getUTCFullYear()%100,t,2)}function Ev(e,t){return Z(e.getUTCFullYear()%1e4,t,4)}function Dv(e,t){var n=e.getUTCDay();return e=n>=4||n===0?t_(e):t_.ceil(e),Z(e.getUTCFullYear()%1e4,t,4)}function Ov(){return`+0000`}function kv(){return`%`}function Av(e){return+e}function jv(e){return Math.floor(e/1e3)}var Mv,Nv,Pv;Fv({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function Fv(e){return Mv=g_(e),Nv=Mv.format,Mv.parse,Pv=Mv.utcFormat,Mv.utcParse,Mv}function Iv(e){return new Date(e)}function Lv(e){return e instanceof Date?+e:+new Date(+e)}function Rv(e,t,n,r,i,a,o,s,c,l){var u=Sh(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>nh(e,r/t))},n.copy=function(){return Jv(t).domain(e)},oh.apply(n,arguments)}function Yv(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=hh,u,m=!1,h;function g(e){return isNaN(e=+e)?h:(e=.5+((e=+u(e))-a)*(r*elh,scaleDiverging:()=>Xv,scaleDivergingLog:()=>Zv,scaleDivergingPow:()=>$v,scaleDivergingSqrt:()=>ey,scaleDivergingSymlog:()=>Qv,scaleIdentity:()=>Xh,scaleImplicit:()=>sh,scaleLinear:()=>Yh,scaleLog:()=>sg,scaleOrdinal:()=>ch,scalePoint:()=>dh,scalePow:()=>gg,scaleQuantile:()=>xg,scaleQuantize:()=>Sg,scaleRadial:()=>bg,scaleSequential:()=>Uv,scaleSequentialLog:()=>Wv,scaleSequentialPow:()=>Kv,scaleSequentialQuantile:()=>Jv,scaleSequentialSqrt:()=>qv,scaleSequentialSymlog:()=>Gv,scaleSqrt:()=>_g,scaleSymlog:()=>dg,scaleThreshold:()=>Cg,scaleTime:()=>zv,scaleUtc:()=>Bv,tickFormat:()=>qh});function ny(e){if(e in ty)return ty[e]();var t=`scale${Xt(e)}`;if(t in ty)return ty[t]()}function ry(e,t,n){if(typeof e==`function`)return e.copy().domain(t).range(n);if(e!=null){var r=ny(e);if(r!=null)return r.domain(t).range(n),r}}function iy(e,t,n,r){if(n!=null&&r!=null)return typeof e.scale==`function`?ry(e.scale,n,r):ry(t,n,r)}function ay(e){return`scale${Xt(e)}`}function oy(e){return ay(e)in ty}var sy=(e,t,n)=>{if(e!=null){var{scale:r,type:i}=e;if(r===`auto`)return i===`category`&&n&&(n.indexOf(`LineChart`)>=0||n.indexOf(`AreaChart`)>=0||n.indexOf(`ComposedChart`)>=0&&!t)?`point`:i===`category`?`band`:`linear`;if(typeof r==`string`)return oy(r)?r:`point`}};function cy(e,t){for(var n=0,r=e.length,i=e[0]t)?n=a+1:r=a}return n}function ly(e,t){if(e){var n=t??e.domain(),r=n.map(t=>e(t)??0),i=e.range();if(!(n.length===0||i.length<2))return e=>{var t=cy(r,e);if(t<=0)return n[0];if(t>=n.length)return n[n.length-1];var i=r[t-1]??0,a=r[t]??0;return Math.abs(e-i)<=Math.abs(e-a)?n[t-1]:n[t]}}}function uy(e){if(e!=null)return`invert`in e&&typeof e.invert==`function`?e.invert.bind(e):ly(e,void 0)}function dy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fy(e){for(var t=1;te.cartesianAxis.xAxis[t],yy=(e,t)=>vy(e,t)??_y,by={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:gy,hide:!0,id:0,includeHidden:!1,interval:`preserveEnd`,minTickGap:5,mirror:!1,name:void 0,orientation:`left`,padding:{top:0,bottom:0},reversed:!1,scale:`auto`,tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:`number`,unit:void 0,niceTicks:`auto`,width:60},xy=(e,t)=>e.cartesianAxis.yAxis[t],Sy=(e,t)=>xy(e,t)??by,Cy={domain:[0,`auto`],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:``,range:[64,64],scale:`auto`,type:`number`,unit:``},wy=(e,t)=>e.cartesianAxis.zAxis[t]??Cy,Ty=(e,t,n)=>{switch(t){case`xAxis`:return yy(e,n);case`yAxis`:return Sy(e,n);case`zAxis`:return wy(e,n);case`angleAxis`:return dm(e,n);case`radiusAxis`:return fm(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},Ey=(e,t,n)=>{switch(t){case`xAxis`:return yy(e,n);case`yAxis`:return Sy(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},Dy=(e,t,n)=>{switch(t){case`xAxis`:return yy(e,n);case`yAxis`:return Sy(e,n);case`angleAxis`:return dm(e,n);case`radiusAxis`:return fm(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},Oy=e=>e.graphicalItems.cartesianItems.some(e=>e.type===`bar`)||e.graphicalItems.polarItems.some(e=>e.type===`radialBar`);function ky(e,t){return n=>{switch(e){case`xAxis`:return`xAxisId`in n&&n.xAxisId===t;case`yAxis`:return`yAxisId`in n&&n.yAxisId===t;case`zAxis`:return`zAxisId`in n&&n.zAxisId===t;case`angleAxis`:return`angleAxisId`in n&&n.angleAxisId===t;case`radiusAxis`:return`radiusAxisId`in n&&n.radiusAxisId===t;default:return!1}}}var Ay=e=>e.graphicalItems.cartesianItems,jy=R([q,bm],ky),My=(e,t,n)=>e.filter(n).filter(e=>t?.includeHidden===!0||!e.hide),Ny=R([Ay,Ty,jy],My,{memoizeOptions:{resultEqualityCheck:Tm}}),Py=R([Ny],e=>e.filter(e=>e.type===`area`||e.type===`bar`).filter(Cm)),Fy=e=>e.filter(e=>!(`stackId`in e)||e.stackId===void 0),Iy=R([Ny],Fy),Ly=e=>e.map(e=>e.data).filter(Boolean).flat(1),Ry=R([Ny],Ly,{memoizeOptions:{resultEqualityCheck:Tm}}),zy=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},By=R([Ry,Ap],zy),Vy=(e,t,n)=>t?.dataKey==null?n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:H(e,t)}))):e.map(e=>({value:e})):e.map(e=>({value:H(e,t.dataKey)})),Hy=R([By,Ty,Ny],Vy);function Uy(e){if(Ut(e)||e instanceof Date){var t=Number(e);if(V(t))return t}}function Wy(e){if(Array.isArray(e)){var t=[Uy(e[0]),Uy(e[1])];return Mp(t)?t:void 0}var n=Uy(e);if(n!=null)return[n,n]}function Gy(e){return e.map(Uy).filter(Zt)}function Ky(e,t){var n=Uy(e),r=Uy(t);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var qy=R([Hy],e=>e?.map(e=>e.value).sort(Ky));function Jy(e,t){switch(e){case`xAxis`:return t.direction===`x`;case`yAxis`:return t.direction===`y`;default:return!1}}function Yy(e,t,n){return!n||typeof t!=`number`||Vt(t)||!n.length?[]:Gy(n.flatMap(n=>{var r=H(e,n.dataKey),i,a;if(Array.isArray(r)?[i,a]=r:i=a=r,!(!V(i)||!V(a)))return[t-i,t+a]}))}var Q=e=>Dy(e,J(e),Dm(e)),Xy=R([Q],e=>e?.dataKey),Zy=R([Py,Ap,Q],Sm),Qy=(e,t,n,r)=>{var i=t.reduce((e,t)=>{if(t.stackId==null)return e;var n=e[t.stackId];return n??=[],n.push(t),e[t.stackId]=n,e},{});return Object.fromEntries(Object.entries(i).map(t=>{var[i,a]=t,o=r?[...a].reverse():a;return[i,{stackedData:Ps(e,o.map(xm),n),graphicalItems:o}]}))},$y=R([Zy,Py,Kp,qp],Qy),eb=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(r==null&&n!==`zAxis`){var o=zs(e,i,a);if(o==null||o[0]!==0||o[1]!==0)return o}},tb=R([Ty],e=>e.allowDataOverflow),nb=e=>{if(e==null||!(`domain`in e))return gy;if(e.domain!=null)return e.domain;if(`ticks`in e&&e.ticks!=null){if(e.type===`number`){var t=Gy(e.ticks);return[Math.min(...t),Math.max(...t)]}if(e.type===`category`)return e.ticks.map(String)}return e?.domain??gy},rb=R([Ty],nb),ib=R([rb,tb],Pp),ab=R([$y,Op,q,ib],eb,{memoizeOptions:{resultEqualityCheck:wm}}),ob=e=>e.errorBars,sb=(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>Jy(n,e)),cb=function(){var e=[...arguments].filter(Boolean);if(e.length!==0){var t=e.flat();return[Math.min(...t),Math.max(...t)]}},lb=(e,t,n,r,i)=>{var a,o;if(n.length>0&&e.forEach(e=>{n.forEach(n=>{var s=r[n.id]?.filter(e=>Jy(i,e)),c=H(e,t.dataKey??n.dataKey),l=Yy(e,c,s);if(l.length>=2){var u=Math.min(...l),d=Math.max(...l);(a==null||uo)&&(o=d)}var f=Wy(c);f!=null&&(a=a==null?f[0]:Math.min(a,f[0]),o=o==null?f[1]:Math.max(o,f[1]))})}),t?.dataKey!=null&&e.forEach(e=>{var n=Wy(H(e,t.dataKey));n!=null&&(a=a==null?n[0]:Math.min(a,n[0]),o=o==null?n[1]:Math.max(o,n[1]))}),V(a)&&V(o))return[a,o]},ub=R([By,Ty,Iy,ob,q],lb,{memoizeOptions:{resultEqualityCheck:wm}});function db(e){var{value:t}=e;if(Ut(t)||t instanceof Date)return t}var fb=(e,t,n)=>{var r=e.map(db).filter(e=>e!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&qt(r))?Dp(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},pb=e=>e.referenceElements.dots,mb=(e,t,n)=>e.filter(e=>e.ifOverflow===`extendDomain`).filter(e=>t===`xAxis`?e.xAxisId===n:e.yAxisId===n),hb=R([pb,q,bm],mb),gb=e=>e.referenceElements.areas,_b=R([gb,q,bm],mb),vb=e=>e.referenceElements.lines,yb=R([vb,q,bm],mb),bb=(e,t)=>{if(e!=null){var n=Gy(e.map(e=>t===`xAxis`?e.x:e.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},xb=R(hb,q,bb),Sb=(e,t)=>{if(e!=null){var n=Gy(e.flatMap(e=>[t===`xAxis`?e.x1:e.y1,t===`xAxis`?e.x2:e.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Cb=R([_b,q],Sb);function wb(e){if(e.x!=null)return Gy([e.x]);var t=e.segment?.map(e=>e.x);return t==null||t.length===0?[]:Gy(t)}function Tb(e){if(e.y!=null)return Gy([e.y]);var t=e.segment?.map(e=>e.y);return t==null||t.length===0?[]:Gy(t)}var Eb=(e,t)=>{if(e!=null){var n=e.flatMap(e=>t===`xAxis`?wb(e):Tb(e));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Db=R(xb,R([yb,q],Eb),Cb,(e,t,n)=>cb(e,n,t)),Ob=(e,t,n,r,i,a,o,s)=>n??Fp(t,o===`vertical`&&s===`xAxis`||o===`horizontal`&&s===`yAxis`?cb(r,a,i):cb(a,i),e.allowDataOverflow),kb=R([Ty,rb,ib,ab,ub,Db,U,q],Ob,{memoizeOptions:{resultEqualityCheck:wm}}),Ab=[0,1],jb=(e,t,n,r,i,a,o)=>{if(e!=null&&n!=null&&n.length!==0||o!==void 0){var{dataKey:s,type:c}=e,l=As(t,a);return l&&s==null?Dp(0,n?.length??0):c===`category`?fb(r,e,l):i===`expand`?Ab:o}},Mb=R([Ty,U,By,Hy,Kp,q,kb],jb),Nb=R([Ty,Oy,Jp],sy),Pb=(e,t,n)=>{var{niceTicks:r}=t;if(r!==`none`){var i=nb(t),a=Array.isArray(i)&&(i[0]===`auto`||i[1]===`auto`);if((r===`snap125`||r===`adaptive`)&&t!=null&&t.tickCount&&Mp(e)){if(a)return Up(e,t.tickCount,t.allowDecimals,r);if(t.type===`number`)return Wp(e,t.tickCount,t.allowDecimals,r)}if(r===`auto`&&n===`linear`&&t!=null&&t.tickCount){if(a&&Mp(e))return Up(e,t.tickCount,t.allowDecimals,`adaptive`);if(t.type===`number`&&Mp(e))return Wp(e,t.tickCount,t.allowDecimals,`adaptive`)}}},Fb=R([Mb,Dy,Nb],Pb),Ib=(e,t,n,r)=>{if(r!==`angleAxis`&&e?.type===`number`&&Mp(t)&&Array.isArray(n)&&n.length>0){var i=t[0],a=n[0]??0,o=t[1],s=n[n.length-1]??0;return[Math.min(i,a),Math.max(o,s)]}return t},Lb=R([Ty,Mb,Fb,q],Ib),Rb=R(R(Hy,Ty,(e,t)=>{if(!(!t||t.type!==`number`)){var n=1/0,r=Array.from(Gy(e.map(e=>e.value))).sort((e,t)=>e-t),i=r[0],a=r[r.length-1];if(i==null||a==null)return 1/0;var o=a-i;if(o===0)return 1/0;for(var s=0;si,(e,t,n,r,i)=>{if(!V(e))return 0;var a=t===`vertical`?r.height:r.width;if(i===`gap`)return e*a/2;if(i===`no-gap`){var o=Kt(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),zb=(e,t,n)=>{var r=yy(e,t);return r==null||typeof r.padding!=`string`?0:Rb(e,`xAxis`,t,n,r.padding)},Bb=(e,t,n)=>{var r=Sy(e,t);return r==null||typeof r.padding!=`string`?0:Rb(e,`yAxis`,t,n,r.padding)},Vb=R(yy,zb,(e,t)=>{if(e==null)return{left:0,right:0};var{padding:n}=e;return typeof n==`string`?{left:t,right:t}:{left:(n.left??0)+t,right:(n.right??0)+t}}),Hb=R(Sy,Bb,(e,t)=>{if(e==null)return{top:0,bottom:0};var{padding:n}=e;return typeof n==`string`?{top:t,bottom:t}:{top:(n.top??0)+t,bottom:(n.bottom??0)+t}}),Ub=R([uc,Vb,gc,hc,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),Wb=R([uc,U,Hb,gc,hc,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:t===`horizontal`?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),Gb=(e,t,n,r)=>{switch(t){case`xAxis`:return Ub(e,n,r);case`yAxis`:return Wb(e,n,r);case`zAxis`:return wy(e,n)?.range;case`angleAxis`:return _m(e);case`radiusAxis`:return vm(e,n);default:return}},Kb=R([Ty,Gb],nm),qb=R([Ty,Nb,R([Nb,Lb],km),Kb],iy),Jb=(e,t,n,r)=>{if(n!=null&&n.dataKey!=null){var{type:i,scale:a}=n;if(As(e,r)&&(i===`number`||a!==`auto`))return t.map(e=>e.value)}},Yb=R([U,Hy,Dy,q],Jb),Xb=R([qb],Om);R([qb],uy),R([qb,qy],ly),R([Ny,ob,q],sb);function Zb(e,t){return e.idt.id)}var Qb=(e,t)=>t,$b=(e,t,n)=>n,ex=R(Zs,Qb,$b,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Zb)),tx=R(Qs,Qb,$b,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Zb)),nx=(e,t)=>({width:e.width,height:t.height}),rx=(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height}),ix=R(uc,yy,nx),ax=(e,t,n)=>{switch(t){case`top`:return e.top;case`bottom`:return n-e.bottom;default:return 0}},ox=(e,t,n)=>{switch(t){case`left`:return e.left;case`right`:return n-e.right;default:return 0}},sx=R(Js,uc,ex,Qb,$b,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=nx(t,n);o??=ax(t,r,e);var c=r===`top`&&!i||r===`bottom`&&i;a[n.id]=o-Number(c)*s.height,o+=(c?-1:1)*s.height}),a}),cx=R(qs,uc,tx,Qb,$b,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=rx(t,n);o??=ox(t,r,e);var c=r===`left`&&!i||r===`right`&&i;a[n.id]=o-Number(c)*s.width,o+=(c?-1:1)*s.width}),a}),lx=R([uc,yy,(e,t)=>{var n=yy(e,t);if(n!=null)return sx(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}}),ux=R([uc,Sy,(e,t)=>{var n=Sy(e,t);if(n!=null)return cx(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}}),dx=R(uc,Sy,(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height})),fx=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,s=As(e,r),c=t.map(e=>e.value);if(o&&s&&a===`category`&&i&&qt(c))return c}},px=R([U,Hy,Ty,q],fx),mx=R([U,Ey,Nb,Xb,px,Yb,Gb,Fb,q],(e,t,n,r,i,a,o,s,c)=>{if(t!=null){var l=As(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:a,duplicateDomain:i,isCategorical:l,niceTicks:s,range:o,realScaleType:n,scale:r}}}),hx=R([U,Dy,Nb,Xb,Fb,Gb,px,Yb,q],(e,t,n,r,i,a,o,s,c)=>{if(t!=null&&r!=null){var l=As(e,c),{type:u,ticks:d,tickCount:f}=t,p=n===`scaleBand`&&typeof r.bandwidth==`function`?r.bandwidth()/2:2,m=u===`category`&&r.bandwidth?r.bandwidth()/p:0;m=c===`angleAxis`&&a!=null&&a.length>=2?Bt(a[0]-a[1])*2*m:m;var h=d||i;return h?h.map((e,t)=>{var n=o?o.indexOf(e):e,i=r.map(n);return V(i)?{index:t,coordinate:i+m,value:e,offset:m}:null}).filter(Zt):l&&s?s.map((e,t)=>{var n=r.map(e);return V(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(Zt):r.ticks?r.ticks(f).map((e,t)=>{var n=r.map(e);return V(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(Zt):r.domain().map((e,t)=>{var n=r.map(e);return V(n)?{coordinate:n+m,value:o?o[e]:e,index:t,offset:m}:null}).filter(Zt)}}),gx=R([U,Dy,Xb,Gb,px,Yb,q],(e,t,n,r,i,a,o)=>{if(t!=null&&n!=null&&r!=null&&r[0]!==r[1]){var s=As(e,o),{tickCount:c}=t,l=0;return l=o===`angleAxis`&&r?.length>=2?Bt(r[0]-r[1])*2*l:l,s&&a?a.map((e,t)=>{var r=n.map(e);return V(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(Zt):n.ticks?n.ticks(c).map((e,t)=>{var r=n.map(e);return V(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(Zt):n.domain().map((e,t)=>{var r=n.map(e);return V(r)?{coordinate:r+l,value:i?i[e]:e,index:t,offset:l}:null}).filter(Zt)}}),_x=R(Ty,Xb,(e,t)=>{if(e!=null&&t!=null)return fy(fy({},e),{},{scale:t})});R((e,t,n)=>wy(e,n),R([R([Ty,Nb,Mb,Kb],iy)],Om),(e,t)=>{if(e!=null&&t!=null)return fy(fy({},e),{},{scale:t})});var vx=R([U,Zs,Qs],(e,t,n)=>{switch(e){case`horizontal`:return t.some(e=>e.reversed)?`right-to-left`:`left-to-right`;case`vertical`:return n.some(e=>e.reversed)?`bottom-to-top`:`top-to-bottom`;case`centric`:case`radial`:return`left-to-right`;default:return}});R([(e,t,n)=>e.renderedTicks[t]?.[n]],e=>{if(!(!e||e.length===0))return t=>{var n=1/0,r=e[0];for(var i of e){var a=Math.abs(i.coordinate-t);ae.options.defaultTooltipEventType,bx=e=>e.options.validateTooltipEventTypes;function xx(e,t,n){if(e==null)return t;var r=e?`axis`:`item`;return n==null?t:n.includes(r)?r:t}function Sx(e,t){return xx(t,yx(e),bx(e))}function Cx(e){return L(t=>Sx(t,e))}var wx=(e,t)=>{var n,r=Number(t);if(!(Vt(r)||t==null))return r>=0?e==null||(n=e[r])==null?void 0:n.value:void 0},Tx=e=>e.tooltip.settings,Ex={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},Dx=Oo({name:`tooltip`,initialState:{itemInteraction:{click:Ex,hover:Ex},axisInteraction:{click:Ex,hover:Ex},keyboardInteraction:Ex,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:`hover`,axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(W(t.payload))},prepare:B()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=$a(e).tooltipItemPayloads.indexOf(W(n));i>-1&&(e.tooltipItemPayloads[i]=W(r))},prepare:B()},removeTooltipEntrySettings:{reducer(e,t){var n=$a(e).tooltipItemPayloads.indexOf(W(t.payload));n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:B()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:Ox,replaceTooltipEntrySettings:kx,removeTooltipEntrySettings:Ax,setTooltipSettingsState:jx,setActiveMouseOverItemIndex:Mx,mouseLeaveItem:Nx,mouseLeaveChart:Px,setActiveClickItemIndex:Fx,setMouseOverAxisIndex:Ix,setMouseClickAxisIndex:Lx,setSyncInteraction:Rx,setKeyboardInteraction:zx}=Dx.actions,Bx=Dx.reducer;function Vx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hx(e){for(var t=1;t{if(t==null)return Ex;var i=Kx(e,t,n);if(i==null)return Ex;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(qx(i)){if(a)return Hx(Hx({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Hx(Hx({},Ex),{},{coordinate:i.coordinate})};function Yx(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function Xx(e,t){var n=Yx(e),r=t[0],i=t[1];return n!==void 0&&n>=Math.min(r,i)&&n<=Math.max(r,i)}function Zx(e,t,n){if(n==null||t==null)return!0;var r=H(e,t);return r==null||!Mp(n)||Xx(r,n)}var Qx=(e,t,n,r)=>{var i=e?.index;if(i==null)return null;var a=Number(i);if(!V(a))return i;var o=0,s=1/0;t.length>0&&(s=t.length-1);var c=Math.max(o,Math.min(a,s)),l=t[c];return l==null||Zx(l,n,r)?String(c):null},$x=(e,t,n,r,i,a,o)=>{if(a!=null){var s=o[0]?.getPosition(a);if(s!=null)return s;var c=i?.[Number(a)];if(c)switch(n){case`horizontal`:return{x:c.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:c.coordinate}}}},eS=(e,t,n,r)=>{if(t===`axis`)return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i=n===`hover`?e.itemInteraction.hover.graphicalItemId:e.itemInteraction.click.graphicalItemId;if(e.syncInteraction.active&&i==null)return e.tooltipItemPayloads;if(i==null&&r!=null){var a=e.tooltipItemPayloads[0];return a==null?[]:[a]}return e.tooltipItemPayloads.filter(e=>e.settings?.graphicalItemId===i)},tS=e=>e.options.tooltipPayloadSearcher,nS=e=>e.tooltip;function rS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function iS(e){for(var t=1;te(t)}function dS(e){if(typeof e==`string`)return e}function fS(e){if(!(typeof e!=`object`||!e))return{name:`name`in e?cS(e.name):void 0,unit:`unit`in e?lS(e.unit):void 0,dataKey:`dataKey`in e?uS(e.dataKey):void 0,payload:`payload`in e?e.payload:void 0,color:`color`in e?dS(e.color):void 0,fill:`fill`in e?dS(e.fill):void 0}}function pS(e,t){return e??t}var mS=(e,t,n,r,i,a,o)=>{if(t!=null&&a!=null){var{chartData:s,computedData:c,dataStartIndex:l,dataEndIndex:u}=n;return e.reduce((e,n)=>{var{dataDefinedOnItem:d,settings:f}=n,p=pS(d,s),m=Array.isArray(p)?Ss(p,l,u):p,h=f?.dataKey??r,g=f?.nameKey,_=r&&Array.isArray(m)&&!Array.isArray(m[0])&&o===`axis`?Yt(m,r,i):a(m,t,c,g);return Array.isArray(_)?_.forEach(t=>{var n=fS(t),r=n?.name,i=n?.dataKey,a=n?.payload,o=iS(iS({},f),{},{name:r,unit:n?.unit,color:n?.color??f?.color,fill:n?.fill??f?.fill});e.push(Us({tooltipEntrySettings:o,dataKey:i,payload:a,value:H(a,i),name:r==null?void 0:String(r)}))}):e.push(Us({tooltipEntrySettings:f,dataKey:h,payload:_,value:H(_,h),name:H(_,g)??f?.name})),e},[])}},hS=R([Q,Oy,Jp],sy),gS=R([R([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),Q,R([J,Dm],ky)],My,{memoizeOptions:{resultEqualityCheck:Tm}}),_S=R([gS],e=>e.filter(Cm)),vS=R([R([gS],Ly,{memoizeOptions:{resultEqualityCheck:Tm}}),Op],zy),yS=R([_S,Op,Q],Sm),bS=R([vS,Q,gS],Vy),xS=R([Q],nb),SS=R([xS,R([Q],e=>e.allowDataOverflow)],Pp),CS=R([R([yS,R([gS],e=>e.filter(Cm)),Kp,qp],Qy),Op,J,SS],eb),wS=R([vS,Q,R([gS],Fy),ob,J],lb,{memoizeOptions:{resultEqualityCheck:wm}}),TS=R([R([pb,J,Dm],mb),J],bb),ES=R([R([gb,J,Dm],mb),J],Sb),DS=R([Q,U,vS,bS,Kp,J,R([Q,xS,SS,CS,wS,R([TS,R([R([vb,J,Dm],mb),J],Eb),ES],cb),U,J],Ob)],jb),OS=R([Q,DS,R([DS,Q,hS],Pb),J],Ib),kS=e=>Gb(e,J(e),Dm(e),!1),AS=R([Q,kS],nm),jS=R([R([Q,hS,OS,AS],iy)],Om),MS=R([U,Q,hS,jS,kS,R([U,bS,Q,J],fx),R([U,bS,Q,J],Jb),J],(e,t,n,r,i,a,o,s)=>{if(t){var{type:c}=t,l=As(e,s);if(r){var u=n===`scaleBand`&&r.bandwidth?r.bandwidth()/2:2,d=c===`category`&&r.bandwidth?r.bandwidth()/u:0;return d=s===`angleAxis`&&i!=null&&i?.length>=2?Bt(i[0]-i[1])*2*d:d,l&&o?o.map((e,t)=>{var n=r.map(e);return V(n)?{coordinate:n+d,value:e,index:t,offset:d}:null}).filter(Zt):r.domain().map((e,t)=>{var n=r.map(e);return V(n)?{coordinate:n+d,value:a?a[e]:e,index:t,offset:d}:null}).filter(Zt)}}}),NS=R([yx,bx,Tx],(e,t,n)=>xx(n.shared,e,t)),PS=e=>e.tooltip.settings.trigger,FS=e=>e.tooltip.settings.defaultIndex,IS=R([nS,NS,PS,FS],Jx),LS=R([IS,vS,Xy,DS],Qx),RS=R([MS,LS],wx),zS=R([IS],e=>{if(e)return e.dataKey}),BS=R([IS],e=>{if(e)return e.graphicalItemId}),VS=R([nS,NS,PS,FS],eS),HS=R([IS,R([qs,Js,U,uc,MS,FS,VS],$x)],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),US=R([IS],e=>e?.active??!1),WS=R([R([VS,LS,Op,Xy,RS,tS,NS],mS)],e=>{if(e!=null){var t=e.map(e=>e.payload).filter(e=>e!=null);return Array.from(new Set(t))}});function GS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function KS(e){for(var t=1;tL(Q),ZS=()=>{var e=XS(),t=L(MS),n=L(jS);return Hs(!e||!n?void 0:KS(KS({},e),{},{scale:n}),t)};function QS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $S(e){for(var t=1;t{var i=t.find(e=>e&&e.index===n);if(i){if(e===`horizontal`)return{x:i.coordinate,y:r.relativeY};if(e===`vertical`)return{x:r.relativeX,y:i.coordinate}}return{x:0,y:0}},iC=(e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if(e===`centric`){var a=i.coordinate,{radius:o}=r;return $S($S($S({},r),tp(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,{angle:c}=r;return $S($S($S({},r),tp(r.cx,r.cy,s,c)),{},{angle:c,radius:s})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function aC(e,t){var{relativeX:n,relativeY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var oC=(e,t,n,r,i)=>{var a=t?.length??0;if(a<=1||e==null)return 0;if(r===`angleAxis`&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var o=0;o0?n[o-1]?.coordinate:n[a-1]?.coordinate,c=n[o]?.coordinate,l=o>=a-1?n[0]?.coordinate:n[o+1]?.coordinate,u=void 0;if(s!=null&&c!=null&&l!=null){if(Bt(c-s)!==Bt(l-c)){var d=[];if(Bt(l-c)===Bt(i[1]-i[0])){u=l;var f=c+i[1]-i[0];d[0]=Math.min(f,(f+s)/2),d[1]=Math.max(f,(f+s)/2)}else{u=s;var p=l+i[1]-i[0];d[0]=Math.min(c,(p+c)/2),d[1]=Math.max(c,(p+c)/2)}var m=[Math.min(c,(u+c)/2),Math.max(c,(u+c)/2)];if(e>m[0]&&e<=m[1]||e>=d[0]&&e<=d[1])return n[o]?.index}else{var h=Math.min(s,l),g=Math.max(s,l);if(e>(h+c)/2&&e<=(g+c)/2)return n[o]?.index}}}else if(t)for(var _=0;_(v.coordinate+b.coordinate)/2||_>0&&_(v.coordinate+b.coordinate)/2&&e<=(v.coordinate+y.coordinate)/2)return v.index}}return-1},sC=()=>L(Jp),cC=(e,t)=>t,lC=(e,t,n)=>n,uC=(e,t,n,r)=>r,dC=R(MS,e=>_i(e,e=>e.coordinate)),fC=R([nS,cC,lC,uC],Jx),pC=R([fC,vS,Xy,DS],Qx),mC=(e,t,n)=>{if(t!=null){var r=nS(e);return t===`axis`?n===`hover`?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n===`hover`?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},hC=R([nS,cC,lC,uC],eS),gC=R([qs,Js,U,uc,MS,uC,hC],$x),_C=R([fC,gC],(e,t)=>e.coordinate??t),vC=R([MS,pC],wx),yC=R([hC,pC,Op,Xy,vC,tS,cC],mS),bC=R([fC,pC],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),xC=(e,t,n,r,i,a,o)=>{if(!(!e||!n||!r||!i)&&aC(e,o)){var s=oC(Gs(e,t),a,i,n,r),c=rC(t,i,s,e);return{activeIndex:String(s),activeCoordinate:c}}},SC=(e,t,n,r,i,a,o)=>{if(!(!e||!r||!i||!a||!n)){var s=sp(e,n);if(s){var c=oC(Ks(s,t),o,a,r,i),l=iC(t,a,c,s);return{activeIndex:String(c),activeCoordinate:l}}}},CC=(e,t,n,r,i,a,o,s)=>{if(!(!e||!t||!r||!i||!a))return t===`horizontal`||t===`vertical`?xC(e,t,r,i,a,o,s):SC(e,t,n,r,i,a,o)},wC=R(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),TC=R(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values($p));return Array.from(new Set(t)).sort((e,t)=>e-t)},{memoizeOptions:{resultEqualityCheck:Em}});function EC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function DC(e){for(var t=1;tDC(DC({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},MC=new Set(Object.values($p));function NC(e){return MC.has(e)}var PC=Oo({name:`zIndex`,initialState:jC,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:B()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(--e.zIndexMap[n].consumers,e.zIndexMap[n].consumers<=0&&!NC(n)&&delete e.zIndexMap[n])},prepare:B()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=W(r):e.zIndexMap[n].element=W(r):e.zIndexMap[n]={consumers:0,element:i?void 0:W(r),panoramaElement:i?W(r):void 0}},prepare:B()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:B()}}}),{registerZIndexPortal:FC,unregisterZIndexPortal:IC,registerZIndexPortalElement:LC,unregisterZIndexPortalElement:RC}=PC.actions,zC=PC.reducer;function BC(e){var{zIndex:t,children:n}=e,r=Zc()&&t!==void 0&&t!==0,i=mc(),a=I();(0,h.useLayoutEffect)(()=>r?(a(FC({zIndex:t})),()=>{a(IC({zIndex:t}))}):Qt,[a,t,r]);var o=L(e=>wC(e,t,i));return r?o?(0,g.createPortal)(n,o):null:n}function VC(){return VC=Object.assign?Object.assign.bind():function(e){for(var t=1;t(0,h.useContext)(XC),QC=t(n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!Vt(n))return e[n]}},rw=Oo({name:`options`,initialState:{chartName:``,tooltipPayloadSearcher:()=>void 0,eventEmitter:void 0,defaultTooltipEventType:`axis`},reducers:{createEventEmitter:e=>{e.eventEmitter??=Symbol(`rechartsEventEmitter`)}}}),iw=rw.reducer,{createEventEmitter:aw}=rw.actions;function ow(e){return e.tooltip.syncInteraction}var sw=Oo({name:`chartData`,initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=W(t.payload),t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:cw,setDataStartEndIndexes:lw,setComputedData:uw}=sw.actions,dw=sw.reducer,fw=[`x`,`y`];function pw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mw(e){for(var t=1;te.rootProps.className);(0,h.useEffect)(()=>{if(e==null)return Qt;var s=(s,c,l)=>{if(t!==l&&e===s){if(r===`index`){var u;if(o&&c!=null&&(u=c.payload)!=null&&u.coordinate&&c.payload.sourceViewBox){var d=c.payload.coordinate,{x:f,y:p}=d,m=vw(d,fw),{x:h,y:g,width:_,height:v}=c.payload.sourceViewBox,y=mw(mw({},m),{},{x:o.x+(_?(f-h)/_:0)*o.width,y:o.y+(v?(p-g)/v:0)*o.height});n(mw(mw({},c),{},{payload:mw(mw({},c.payload),{},{coordinate:y})}))}else n(c);return}if(i!=null){var b;typeof r==`function`?b=i[r(i,{activeTooltipIndex:c.payload.index==null?void 0:Number(c.payload.index),isTooltipActive:c.payload.active,activeIndex:c.payload.index==null?void 0:Number(c.payload.index),activeLabel:c.payload.label,activeDataKey:c.payload.dataKey,activeCoordinate:c.payload.coordinate})]:r===`value`&&(b=i.find(e=>String(e.value)===c.payload.label));var{coordinate:x}=c.payload;if(b==null||c.payload.active===!1||x==null||o==null){n(Rx({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:S,y:C}=x,w=Math.min(S,o.x+o.width),T=Math.min(C,o.y+o.height),E={x:a===`horizontal`?b.coordinate:w,y:a===`horizontal`?T:b.coordinate};n(Rx({active:c.payload.active,coordinate:E,dataKey:c.payload.dataKey,index:String(b.index),label:c.payload.label,sourceViewBox:c.payload.sourceViewBox,graphicalItemId:c.payload.graphicalItemId}))}}};return $C.on(ew,s),()=>{$C.off(ew,s)}},[s,n,t,e,r,i,a,o])}function xw(){var e=L(Yp),t=L(Zp),n=I();(0,h.useEffect)(()=>{if(e==null)return Qt;var r=(r,i,a)=>{t!==a&&e===r&&n(lw(i))};return $C.on(tw,r),()=>{$C.off(tw,r)}},[n,t,e])}function Sw(){var e=I();(0,h.useEffect)(()=>{e(aw())},[e]),bw(),xw()}function Cw(e,t,n,r,i,a){var o=L(n=>mC(n,e,t)),s=L(BS),c=L(Zp),l=L(Yp),u=L(Xp),d=L(ow)?.active,f=Hc();(0,h.useEffect)(()=>{if(!d&&l!=null&&c!=null){var e=Rx({active:a,coordinate:n,dataKey:o,index:i,label:typeof r==`number`?String(r):r,sourceViewBox:f,graphicalItemId:s});$C.emit(ew,l,e,c)}},[d,n,o,s,i,r,c,l,u,a,f])}function ww(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Tw(e){for(var t=1;t{C(jx({shared:v,trigger:y,axisId:S,active:n,defaultIndex:w}))},[C,v,y,S,n,w]);var T=Hc(),E=ud(),D=Cx(v),{activeIndex:O,isActive:k}=L(e=>bC(e,D,y,w))??{},ee=L(e=>yC(e,D,y,w)),te=L(e=>vC(e,D,y,w)),A=L(e=>_C(e,D,y,w)),j=ee,ne=ZC(),re=n??k??!1,[ie,ae]=Ci([j,re]),M=D===`axis`?te:void 0;Cw(D,y,A,M,O,re);var oe=x??ne;if(oe==null||T==null||D==null)return null;var se=j??jw;re||(se=jw),s&&se.length&&(se=Hr(se.filter(e=>e.value!=null&&(e.hide!==!0||t.includeHidden)),u,kw));var ce=se.length>0,le=Tw(Tw({},t),{},{payload:se,label:M,active:re,activeIndex:O,coordinate:A,accessibilityLayer:E}),ue=h.createElement(ld,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:c,active:re,coordinate:A,hasPayload:ce,offset:l,position:d,reverseDirection:f,useTranslate3d:p,viewBox:T,wrapperStyle:m,lastBoundingBox:ie,innerRef:ae,hasPortalFromProps:!!x},Aw(o,le));return h.createElement(h.Fragment,null,(0,g.createPortal)(ue,oe),re&&h.createElement(YC,{cursor:_,tooltipEventType:D,coordinate:A,payload:se,index:O}))}function Pw(e,t,n){return(t=Fw(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fw(e){var t=Iw(e,`string`);return typeof t==`symbol`?t:t+``}function Iw(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Lw=class{constructor(e){Pw(this,`cache`,new Map),this.maxSize=e}get(e){var t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}};function Rw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zw(e){for(var t=1;t{try{var n=document.getElementById(Kw);n||(n=document.createElement(`span`),n.setAttribute(`id`,Kw),n.setAttribute(`aria-hidden`,`true`),document.body.appendChild(n)),Object.assign(n.style,Gw,t),n.textContent=`${e}`;var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},Yw=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||ed.isSsr)return{width:0,height:0};if(!Uw.enableCache)return Jw(e,t);var n=qw(e,t),r=Ww.get(n);if(r)return r;var i=Jw(e,t);return Ww.set(n,i),i},Xw;function Zw(e,t,n){return(t=Qw(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qw(e){var t=$w(e,`string`);return typeof t==`symbol`?t:t+``}function $w(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var eT=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,tT=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,nT=/^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/,rT=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,iT={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},aT=[`cm`,`mm`,`pt`,`pc`,`in`,`Q`,`px`];function oT(e){return aT.includes(e)}var sT=`NaN`;function cT(e,t){return e*iT[t]}var lT=class e{static parse(t){var[,n,r]=rT.exec(t)??[];return n==null?e.NaN:new e(parseFloat(n),r??``)}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,Vt(e)&&(this.unit=``),t!==``&&!nT.test(t)&&(this.num=NaN,this.unit=``),oT(t)&&(this.num=cT(e,t),this.unit=`px`)}add(t){return this.unit===t.unit?new e(this.num+t.num,this.unit):new e(NaN,``)}subtract(t){return this.unit===t.unit?new e(this.num-t.num,this.unit):new e(NaN,``)}multiply(t){return this.unit!==``&&t.unit!==``&&this.unit!==t.unit?new e(NaN,``):new e(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==``&&t.unit!==``&&this.unit!==t.unit?new e(NaN,``):new e(this.num/t.num,this.unit||t.unit)}toString(){return`${this.num}${this.unit}`}isNaN(){return Vt(this.num)}};Xw=lT,Zw(lT,`NaN`,new Xw(NaN,``));function uT(e){if(e==null||e.includes(sT))return sT;for(var t=e;t.includes(`*`)||t.includes(`/`);){var[,n,r,i]=eT.exec(t)??[],a=lT.parse(n??``),o=lT.parse(i??``),s=r===`*`?a.multiply(o):a.divide(o);if(s.isNaN())return sT;t=t.replace(eT,s.toString())}for(;t.includes(`+`)||/.-\d+(?:\.\d+)?/.test(t);){var[,c,l,u]=tT.exec(t)??[],d=lT.parse(c??``),f=lT.parse(u??``),p=l===`+`?d.add(f):d.subtract(f);if(p.isNaN())return sT;t=t.replace(tT,p.toString())}return t}var dT=/\(([^()]*)\)/;function fT(e){for(var t=e,n;(n=dT.exec(t))!=null;){var[,r]=n;t=t.replace(dT,uT(r))}return t}function pT(e){var t=e.replace(/\s+/g,``);return t=fT(t),t=uT(t),t}function mT(e){try{return pT(e)}catch{return sT}}function hT(e){var t=mT(e.slice(5,-1));return t===sT?``:t}var gT=[`x`,`y`,`lineHeight`,`capHeight`,`fill`,`scaleToFit`,`textAnchor`,`verticalAnchor`],_T=[`dx`,`dy`,`angle`,`className`,`breakAll`];function vT(){return vT=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var i=[];return F(t)||(i=n?t.toString().split(``):t.toString().split(xT)),{wordsWithComputedWidth:i.map(e=>({word:e,width:Yw(e,r).width})),spaceWidth:n?0:Yw(`\xA0`,r).width}}catch{return null}};function CT(e){return e===`start`||e===`middle`||e===`end`||e===`inherit`}function wT(e){return F(e)||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}var TT=(e,t,n,r)=>e.reduce((e,i)=>{var{word:a,width:o}=i,s=e[e.length-1];if(s&&o!=null&&(t==null||r||s.width+o+ne.reduce((e,t)=>e.width>t.width?e:t),DT=`…`,OT=(e,t,n,r,i,a,o,s)=>{var c=ST({breakAll:n,style:r,children:e.slice(0,t)+DT});if(!c)return[!1,[]];var l=TT(c.wordsWithComputedWidth,a,o,s);return[l.length>i||ET(l).width>Number(a),l]},kT=(e,t,n,r,i)=>{var{maxLines:a,children:o,style:s,breakAll:c}=e,l=P(a),u=String(o),d=TT(t,r,n,i);if(!l||i||!(d.length>a||ET(d).width>Number(r)))return d;for(var f=0,p=u.length-1,m=0,h;f<=p&&m<=u.length-1;){var g=Math.floor((f+p)/2),[_,v]=OT(u,g-1,c,s,a,r,n,i),[y]=OT(u,g,c,s,a,r,n,i);if(!_&&!y&&(f=g+1),_&&y&&(p=g-1),!_&&y){h=v;break}m++}return h||d},AT=e=>[{words:F(e)?[]:e.toString().split(xT),width:void 0}],jT=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!ed.isSsr){var s,c,l=ST({breakAll:a,children:r,style:i});if(l){var{wordsWithComputedWidth:u,spaceWidth:d}=l;s=u,c=d}else return AT(r);return kT({breakAll:a,children:r,maxLines:o,style:i},s,c,t,!!n)}return AT(r)},MT=`#808080`,NT={angle:0,breakAll:!1,capHeight:`0.71em`,fill:MT,lineHeight:`1em`,scaleToFit:!1,textAnchor:`start`,verticalAnchor:`end`,x:0,y:0},PT=(0,h.forwardRef)((e,t)=>{var n=wn(e,NT),{x:r,y:i,lineHeight:a,capHeight:o,fill:s,scaleToFit:l,textAnchor:u,verticalAnchor:d}=n,f=yT(n,gT),p=(0,h.useMemo)(()=>jT({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:l,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,l,f.style,f.width]),{dx:m,dy:g,angle:_,className:v,breakAll:y}=f,b=yT(f,_T);if(!Ut(r)||!Ut(i)||p.length===0)return null;var x=Number(r)+(P(m)?m:0),S=Number(i)+(P(g)?g:0);if(!V(x)||!V(S))return null;var C;switch(d){case`start`:C=hT(`calc(${o})`);break;case`middle`:C=hT(`calc(${(p.length-1)/2} * -${a} + (${o} / 2))`);break;default:C=hT(`calc(${p.length-1} * -${a})`)}var T=[],E=p[0];if(l&&E!=null){var D=E.width,{width:O}=f;T.push(`scale(${P(O)&&P(D)?O/D:1})`)}return _&&T.push(`rotate(${_}, ${x}, ${S})`),T.length&&(b.transform=T.join(` `)),h.createElement(`text`,vT({},w(b),{ref:t,x,y:S,className:c(`recharts-text`,v),textAnchor:u,fill:s.includes(`url`)?MT:s}),p.map((e,t)=>{var n=e.words.join(y?``:` `);return h.createElement(`tspan`,{x,dy:t===0?C:a,key:`${n}-${t}`},n)}))});PT.displayName=`Text`;function FT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function IT(e){for(var t=1;t{var{viewBox:t,position:n,offset:r=0,parentViewBox:i,clamp:a}=e,{x:o,y:s,height:c,upperWidth:l,lowerWidth:u}=Vc(t),d=o,f=o+(l-u)/2,p=(d+f)/2,m=(l+u)/2,h=d+l/2,g=c>=0?1:-1,_=g*r,v=g>0?`end`:`start`,y=g>0?`start`:`end`,b=l>=0?1:-1,x=b*r,S=b>0?`end`:`start`,C=b>0?`start`:`end`,w=i;if(n===`top`){var T={x:d+l/2,y:s-_,horizontalAnchor:`middle`,verticalAnchor:v};return a&&w&&(T.height=Math.max(s-w.y,0),T.width=l),T}if(n===`bottom`){var E={x:f+u/2,y:s+c+_,horizontalAnchor:`middle`,verticalAnchor:y};return a&&w&&(E.height=Math.max(w.y+w.height-(s+c),0),E.width=u),E}if(n===`left`){var D={x:p-x,y:s+c/2,horizontalAnchor:S,verticalAnchor:`middle`};return a&&w&&(D.width=Math.max(D.x-w.x,0),D.height=c),D}if(n===`right`){var O={x:p+m+x,y:s+c/2,horizontalAnchor:C,verticalAnchor:`middle`};return a&&w&&(O.width=Math.max(w.x+w.width-O.x,0),O.height=c),O}var k=a&&w?{width:m,height:c}:{};return n===`insideLeft`?IT({x:p+x,y:s+c/2,horizontalAnchor:C,verticalAnchor:`middle`},k):n===`insideRight`?IT({x:p+m-x,y:s+c/2,horizontalAnchor:S,verticalAnchor:`middle`},k):n===`insideTop`?IT({x:d+l/2,y:s+_,horizontalAnchor:`middle`,verticalAnchor:y},k):n===`insideBottom`?IT({x:f+u/2,y:s+c-_,horizontalAnchor:`middle`,verticalAnchor:v},k):n===`insideTopLeft`?IT({x:d+x,y:s+_,horizontalAnchor:C,verticalAnchor:y},k):n===`insideTopRight`?IT({x:d+l-x,y:s+_,horizontalAnchor:S,verticalAnchor:y},k):n===`insideBottomLeft`?IT({x:f+x,y:s+c-_,horizontalAnchor:C,verticalAnchor:v},k):n===`insideBottomRight`?IT({x:f+u-x,y:s+c-_,horizontalAnchor:S,verticalAnchor:v},k):n&&typeof n==`object`&&(P(n.x)||Ht(n.x))&&(P(n.y)||Ht(n.y))?IT({x:o+Kt(n.x,m),y:s+Kt(n.y,c),horizontalAnchor:`end`,verticalAnchor:`end`},k):IT({x:h,y:s+c/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},k)},VT=[`labelRef`],HT=[`content`];function UT(e,t){if(e==null)return{};var n,r,i=WT(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var{x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o,children:s}=e,c=(0,h.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return h.createElement(ZT.Provider,{value:c},s)},$T=()=>{var e=(0,h.useContext)(ZT),t=Hc();return e||(t?Vc(t):void 0)},eE=(0,h.createContext)(null),tE=()=>{var e=(0,h.useContext)(eE),t=L(ym);return e||t},nE=e=>{var{value:t,formatter:n}=e,r=F(e.children)?t:e.children;return typeof n==`function`?n(r):r},rE=e=>e!=null&&typeof e==`function`,iE=(e,t)=>Bt(t-e)*Math.min(Math.abs(t-e),360),aE=(e,t,n,r,i)=>{var{offset:a,className:o}=e,{cx:s,cy:l,innerRadius:u,outerRadius:d,startAngle:f,endAngle:p,clockWise:m}=i,g=(u+d)/2,_=iE(f,p),v=_>=0?1:-1,y,b;switch(t){case`insideStart`:y=f+v*a,b=m;break;case`insideEnd`:y=p-v*a,b=!m;break;case`end`:y=p+v*a,b=m;break;default:throw Error(`Unsupported position ${t}`)}b=_<=0?b:!b;var x=tp(s,l,g,y),S=tp(s,l,g,y+(b?1:-1)*359),C=`M${x.x},${x.y} + A`,`,`,`,0,0,`,`,`,`,`,`Z`]),C.x,C.y,a,a,+(u<0),S.x,S.y,r,r,+(T>180),+(u>0),y.x,y.y,a,a,+(u<0),b.x,b.y)}else v+=N(hp||=_p([`L`,`,`,`Z`]),t,n);return v},Sp={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Cp=e=>{var t=wn(e,Sp),{cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:o,forceCornerRadius:s,cornerIsExternal:l,startAngle:u,endAngle:d,className:f}=t;if(a0&&Math.abs(u-d)<360?xp({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(g,m/2),forceCornerRadius:s,cornerIsExternal:l,startAngle:u,endAngle:d}):bp({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:u,endAngle:d});return h.createElement(`path`,gp({},w(t),{className:p,d:_}))};function wp(e,t,n){if(e===`horizontal`)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e===`vertical`)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(hn(t)){if(e===`centric`){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:s}=t,c=tp(r,i,a,s),l=tp(r,i,o,s);return[{x:c.x,y:c.y},{x:l.x,y:l.y}]}return cp(t)}}function Tp(e){return Mt(e)?NaN:Number(e)}function Ep(e){return e?(e=Tp(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function Dp(e,t,n){n&&typeof n!=`number`&&ui(e,t,n)&&(t=n=void 0),e=Ep(e),t===void 0?(t=e,e=0):t=Ep(t),n=n===void 0?ee.chartData,kp=R([Op],e=>{var t=e.chartData==null?0:e.chartData.length-1;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),Ap=(e,t,n,r)=>r?kp(e):Op(e),jp=(e,t,n)=>n?kp(e):Op(e);function Mp(e){if(Array.isArray(e)&&e.length===2){var[t,n]=e;if(V(t)&&V(n))return!0}return!1}function Np(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function Pp(e,t){if(t&&typeof e!=`function`&&Array.isArray(e)&&e.length===2){var[n,r]=e,i,a;if(V(n))i=n;else if(typeof n==`function`)return;if(V(r))a=r;else if(typeof r==`function`)return;var o=[i,a];if(Mp(o))return o}}function Fp(e,t,n){if(!(!n&&t==null)){if(typeof e==`function`&&t!=null)try{var r=e(t,n);if(Mp(r))return Np(r,t,n)}catch{}if(Array.isArray(e)&&e.length===2){var[i,a]=e,o,s;if(i===`auto`)t!=null&&(o=Math.min(...t));else if(P(i))o=i;else if(typeof i==`function`)try{t!=null&&(o=i(t?.[0]))}catch{}else if(typeof i==`string`&&Bs.test(i)){var c=Bs.exec(i);if(c==null||c[1]==null||t==null)o=void 0;else{var l=+c[1];o=t[0]-l}}else o=t?.[0];if(a===`auto`)t!=null&&(s=Math.max(...t));else if(P(a))s=a;else if(typeof a==`function`)try{t!=null&&(s=a(t?.[1]))}catch{}else if(typeof a==`string`&&Vs.test(a)){var u=Vs.exec(a);if(u==null||u[1]==null||t==null)s=void 0;else{var d=+u[1];s=t[1]+d}}else s=t?.[1];var f=[o,s];if(Mp(f))return t==null?f:Np(f,t,n)}}}var K=o(t(((e,t)=>{(function(e){var n=1e9,r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:`2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286`},i=!0,a=`[DecimalError] `,o=a+`Invalid argument: `,s=a+`Exponent out of range: `,c=Math.floor,l=Math.pow,u=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d,f=1e7,p=7,m=9007199254740991,h=c(m/p),g={};g.absoluteValue=g.abs=function(){var e=new this.constructor(this);return e.s&&=1,e},g.comparedTo=g.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},g.decimalPlaces=g.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*p;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n},g.dividedBy=g.div=function(e){return b(this,new this.constructor(e))},g.dividedToIntegerBy=g.idiv=function(e){var t=this,n=t.constructor;return D(b(t,new n(e),0,1),n.precision)},g.equals=g.eq=function(e){return!this.cmp(e)},g.exponent=function(){return S(this)},g.greaterThan=g.gt=function(e){return this.cmp(e)>0},g.greaterThanOrEqualTo=g.gte=function(e){return this.cmp(e)>=0},g.isInteger=g.isint=function(){return this.e>this.d.length-2},g.isNegative=g.isneg=function(){return this.s<0},g.isPositive=g.ispos=function(){return this.s>0},g.isZero=function(){return this.s===0},g.lessThan=g.lt=function(e){return this.cmp(e)<0},g.lessThanOrEqualTo=g.lte=function(e){return this.cmp(e)<1},g.logarithm=g.log=function(e){var t,n=this,r=n.constructor,o=r.precision,s=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(d))throw Error(a+`NaN`);if(n.s<1)throw Error(a+(n.s?`NaN`:`-Infinity`));return n.eq(d)?new r(0):(i=!1,t=b(T(n,s),T(e,s),s),i=!0,D(t,o))},g.minus=g.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O(t,e):_(t,(e.s=-e.s,e))},g.modulo=g.mod=function(e){var t,n=this,r=n.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(a+`NaN`);return n.s?(i=!1,t=b(n,e,0,1).times(e),i=!0,n.minus(t)):D(new r(n),o)},g.naturalExponential=g.exp=function(){return x(this)},g.naturalLogarithm=g.ln=function(){return T(this)},g.negated=g.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},g.plus=g.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?_(t,e):O(t,(e.s=-e.s,e))},g.precision=g.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(o+e);if(t=S(i)+1,r=i.d.length-1,n=r*p+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},g.squareRoot=g.sqrt=function(){var e,t,n,r,o,s,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(a+`NaN`)}for(e=S(u),i=!1,o=Math.sqrt(+u),o==0||o==1/0?(t=y(u.d),(t.length+e)%2==0&&(t+=`0`),o=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),o==1/0?t=`5e`+e:(t=o.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+e),r=new d(t)):r=new d(o.toString()),n=d.precision,o=l=n+3;;)if(s=r,r=s.plus(b(u,s,l+2)).times(.5),y(s.d).slice(0,l)===(t=y(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),o==l&&t==`4999`){if(D(s,n+1,0),s.times(s).eq(u)){r=s;break}}else if(t!=`9999`)break;l+=4}return i=!0,D(r,n)},g.times=g.mul=function(e){var t,n,r,a,o,s,c,l,u,d=this,p=d.constructor,m=d.d,h=(e=new p(e)).d;if(!d.s||!e.s)return new p(0);for(e.s*=d.s,n=d.e+e.e,l=m.length,u=h.length,l=0;){for(t=0,a=l+r;a>r;)c=o[a]+h[r]*m[a-r-1]+t,o[a--]=c%f|0,t=c/f|0;o[a]=(o[a]+t)%f|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,i?D(e,p.precision):e},g.toDecimalPlaces=g.todp=function(e,t){var r=this,i=r.constructor;return r=new i(r),e===void 0?r:(v(e,0,n),t===void 0?t=i.rounding:v(t,0,8),D(r,e+S(r)+1,t))},g.toExponential=function(e,t){var r,i=this,a=i.constructor;return e===void 0?r=k(i,!0):(v(e,0,n),t===void 0?t=a.rounding:v(t,0,8),i=D(new a(i),e+1,t),r=k(i,!0,e+1)),r},g.toFixed=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?k(a):(v(e,0,n),t===void 0?t=o.rounding:v(t,0,8),i=D(new o(a),e+S(a)+1,t),r=k(i.abs(),!1,e+S(i)+1),a.isneg()&&!a.isZero()?`-`+r:r)},g.toInteger=g.toint=function(){var e=this,t=e.constructor;return D(new t(e),S(e)+1,t.rounding)},g.toNumber=function(){return+this},g.toPower=g.pow=function(e){var t,n,r,o,s,l,u=this,f=u.constructor,h=12,g=+(e=new f(e));if(!e.s)return new f(d);if(u=new f(u),!u.s){if(e.s<1)throw Error(a+`Infinity`);return u}if(u.eq(d))return u;if(r=f.precision,e.eq(d))return D(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,s=u.s,!l){if(s<0)throw Error(a+`NaN`)}else if((n=g<0?-g:g)<=m){for(o=new f(d),t=Math.ceil(r/p+4),i=!1;n%2&&(o=o.times(u),ee(o.d,t)),n=c(n/2),n!==0;)u=u.times(u),ee(u.d,t);return i=!0,e.s<0?new f(d).div(o):D(o,r)}return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,i=!1,o=e.times(T(u,r+h)),i=!0,o=x(o),o.s=s,o},g.toPrecision=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?(r=S(a),i=k(a,r<=o.toExpNeg||r>=o.toExpPos)):(v(e,1,n),t===void 0?t=o.rounding:v(t,0,8),a=D(new o(a),e,t),r=S(a),i=k(a,e<=r||r<=o.toExpNeg,e)),i},g.toSignificantDigits=g.tosd=function(e,t){var r=this,i=r.constructor;return e===void 0?(e=i.precision,t=i.rounding):(v(e,1,n),t===void 0?t=i.rounding:v(t,0,8)),D(new i(r),e,t)},g.toString=g.valueOf=g.val=g.toJSON=function(){var e=this,t=S(e),n=e.constructor;return k(e,t<=n.toExpNeg||t>=n.toExpPos)};function _(e,t){var n,r,a,o,s,c,l,u,d=e.constructor,m=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),i?D(t,m):t;if(l=e.d,u=t.d,s=e.e,a=t.e,l=l.slice(),o=s-a,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,a=s,c=l.length),s=Math.ceil(m/p),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/f|0,l[o]%=f;for(n&&(l.unshift(n),++a),c=l.length;l[--c]==0;)l.pop();return t.d=l,t.e=a,i?D(t,m):t}function v(e,t,n){if(e!==~~e||en)throw Error(o+e)}function y(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;tr?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]1;)e.shift()}return function(r,i,o,s){var c,l,u,d,m,h,g,_,v,y,b,x,C,w,T,E,O,k,ee=r.constructor,te=r.s==i.s?1:-1,A=r.d,j=i.d;if(!r.s)return new ee(r);if(!i.s)throw Error(a+`Division by zero`);for(l=r.e-i.e,O=j.length,T=A.length,g=new ee(te),_=g.d=[],u=0;j[u]==(A[u]||0);)++u;if(j[u]>(A[u]||0)&&--l,x=o==null?o=ee.precision:s?o+(S(r)-S(i))+1:o,x<0)return new ee(0);if(x=x/p+2|0,u=0,O==1)for(d=0,j=j[0],x++;(u1&&(j=e(j,d),A=e(A,d),O=j.length,T=A.length),w=O,v=A.slice(0,O),y=v.length;y=f/2&&++E;do d=0,c=t(j,v,O,y),c<0?(b=v[0],O!=y&&(b=b*f+(v[1]||0)),d=b/E|0,d>1?(d>=f&&(d=f-1),m=e(j,d),h=m.length,y=v.length,c=t(m,v,h,y),c==1&&(d--,n(m,O16)throw Error(s+S(e));if(!e.s)return new m(d);for(t==null?(i=!1,u=h):u=t,c=new m(.03125);e.abs().gte(.1);)e=e.times(c),p+=5;for(r=Math.log(l(2,p))/Math.LN10*2+5|0,u+=r,n=a=o=new m(d),m.precision=u;;){if(a=D(a.times(e),u),n=n.times(++f),c=o.plus(b(a,n,u)),y(c.d).slice(0,u)===y(o.d).slice(0,u)){for(;p--;)o=D(o.times(o),u);return m.precision=h,t==null?(i=!0,D(o,h)):o}o=c}}function S(e){for(var t=e.e*p,n=e.d[0];n>=10;n/=10)t++;return t}function C(e,t,n){if(t>e.LN10.sd())throw i=!0,n&&(e.precision=n),Error(a+`LN10 precision limit exceeded`);return D(new e(e.LN10),t)}function w(e){for(var t=``;e--;)t+=`0`;return t}function T(e,t){var n,r,o,s,c,l,u,f,p,m=1,h=10,g=e,_=g.d,v=g.constructor,x=v.precision;if(g.s<1)throw Error(a+(g.s?`NaN`:`-Infinity`));if(g.eq(d))return new v(0);if(t==null?(i=!1,f=x):f=t,g.eq(10))return t??(i=!0),C(v,f);if(f+=h,v.precision=f,n=y(_),r=n.charAt(0),s=S(g),Math.abs(s)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(e),n=y(g.d),r=n.charAt(0),m++;s=S(g),r>1?(g=new v(`0.`+n),s++):g=new v(r+`.`+n.slice(1))}else return u=C(v,f+2,x).times(s+``),g=T(new v(r+`.`+n.slice(1)),f-h).plus(u),v.precision=x,t==null?(i=!0,D(g,x)):g;for(l=c=g=b(g.minus(d),g.plus(d),f),p=D(g.times(g),f),o=3;;){if(c=D(c.times(p),f),u=l.plus(b(c,new v(o),f)),y(u.d).slice(0,f)===y(l.d).slice(0,f))return l=l.times(2),s!==0&&(l=l.plus(C(v,f+2,x).times(s+``))),l=b(l,new v(m),f),v.precision=x,t==null?(i=!0,D(l,x)):l;l=u,o+=2}}function E(e,t){var n,r,a;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=c(n/p),e.d=[],r=(n+1)%p,n<0&&(r+=p),rh||e.e<-h))throw Error(s+n)}else e.s=0,e.e=0,e.d=[0];return e}function D(e,t,n){var r,a,o,u,d,m,g,_,v=e.d;for(u=1,o=v[0];o>=10;o/=10)u++;if(r=t-u,r<0)r+=p,a=t,g=v[_=0];else{if(_=Math.ceil((r+1)/p),o=v.length,_>=o)return e;for(g=o=v[_],u=1;o>=10;o/=10)u++;r%=p,a=r-p+u}if(n!==void 0&&(o=l(10,u-a-1),d=g/o%10|0,m=t<0||v[_+1]!==void 0||g%o,m=n<4?(d||m)&&(n==0||n==(e.s<0?3:2)):d>5||d==5&&(n==4||m||n==6&&(r>0?a>0?g/l(10,u-a):0:v[_-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return m?(o=S(e),v.length=1,t=t-o-1,v[0]=l(10,(p-t%p)%p),e.e=c(-t/p)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(r==0?(v.length=_,o=1,_--):(v.length=_+1,o=l(10,p-r),v[_]=a>0?(g/l(10,u-a)%l(10,a)|0)*o:0),m)for(;;)if(_==0){(v[0]+=o)==f&&(v[0]=1,++e.e);break}else{if(v[_]+=o,v[_]!=f)break;v[_--]=0,o=1}for(r=v.length;v[--r]===0;)v.pop();if(i&&(e.e>h||e.e<-h))throw Error(s+S(e));return e}function O(e,t){var n,r,a,o,s,c,l,u,d,m,h=e.constructor,g=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),i?D(t,g):t;if(l=e.d,m=t.d,r=t.e,u=e.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=m.length):(n=m,r=u,c=l.length),a=Math.max(Math.ceil(g/p),c)+2,s>a&&(s=a,n.length=1),n.reverse(),a=s;a--;)n.push(0);n.reverse()}else{for(a=l.length,c=m.length,d=a0;--a)l[c++]=0;for(a=m.length;a>s;){if(l[--a]0?a=a.charAt(0)+`.`+a.slice(1)+w(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(i<0?`e`:`e+`)+i):i<0?(a=`0.`+w(-i-1)+a,n&&(r=n-o)>0&&(a+=w(r))):i>=o?(a+=w(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+w(r))):((r=i+1)0&&(i+1===o&&(a+=`.`),a+=w(r))),e.s<0?`-`+a:a}function ee(e,t){if(e.length>t)return e.length=t,!0}function te(e){var t,n,r;function i(e){var t=this;if(!(t instanceof i))return new i(e);if(t.constructor=i,e instanceof i){t.s=e.s,t.e=e.e,t.d=(e=e.d)?e.slice():e;return}if(typeof e==`number`){if(e*0!=0)throw Error(o+e);if(e>0)t.s=1;else if(e<0)e=-e,t.s=-1;else{t.s=0,t.e=0,t.d=[0];return}if(e===~~e&&e<1e7){t.e=0,t.d=[e];return}return E(t,e.toString())}if(typeof e!=`string`)throw Error(o+e);if(e.charCodeAt(0)===45?(e=e.slice(1),t.s=-1):t.s=1,u.test(e))E(t,e);else throw Error(o+e)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=te,i.config=i.set=A,e===void 0&&(e={}),e)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`LN10`],t=0;t=s[t+1]&&i<=s[t+2])this[r]=i;else throw Error(o+r+`: `+i)}if((i=e[r=`LN10`])!==void 0){if(i==Math.LN10)this[r]=new this(i);else throw Error(o+r+`: `+i)}return this}r=te(r),r.default=r.Decimal=r,d=new r(1),typeof define==`function`&&define.amd?define(function(){return r}):t!==void 0&&t.exports?t.exports=r:(e||=typeof self<`u`&&self&&self.self==self?self:Function(`return this`)(),e.Decimal=r)})(e)}))());function Ip(e){return e===0?1:Math.floor(new K.default(e).abs().log(10).toNumber())+1}function Lp(e,t,n){for(var r=new K.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var Rp=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},zp=(e,t,n)=>{if(e.lte(0))return new K.default(0);var r=Ip(e.toNumber()),i=new K.default(10).pow(r),a=e.div(i),o=r===1?.1:.05,s=new K.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return t?new K.default(s.toNumber()):new K.default(Math.ceil(s.toNumber()))},Bp=(e,t,n)=>{if(e.lte(0))return new K.default(0);var r=[1,2,2.5,5],i=e.toNumber(),a=Math.floor(new K.default(i).abs().log(10).toNumber()),o=new K.default(10).pow(a),s=e.div(o).toNumber(),c=r.findIndex(e=>e>=s-1e-10);if(c===-1&&(o=o.mul(10),c=0),c+=n,c>=r.length){var l=Math.floor(c/r.length);c%=r.length,o=o.mul(new K.default(10).pow(l))}var u=r[c]??1,d=new K.default(u).mul(o);return t?d:new K.default(Math.ceil(d.toNumber()))},Vp=(e,t,n)=>{var r=new K.default(1),i=new K.default(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new K.default(10).pow(Ip(e)-1),i=new K.default(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new K.default(Math.floor(e)))}else e===0?i=new K.default(Math.floor((t-1)/2)):n||(i=new K.default(Math.floor(e)));for(var o=Math.floor((t-1)/2),s=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:zp;if(!Number.isFinite((t-e)/(n-1)))return{step:new K.default(0),tickMin:new K.default(0),tickMax:new K.default(0)};var o=a(new K.default(t).sub(e).div(n-1),r,i),s;e<=0&&t>=0?s=new K.default(0):(s=new K.default(e).add(t).div(2),s=s.sub(new K.default(s).mod(o)));var c=Math.ceil(s.sub(e).div(o).toNumber()),l=Math.ceil(new K.default(t).sub(s).div(o).toNumber()),u=c+l+1;return u>n?Hp(e,t,n,r,i+1,a):(u0?l+(n-u):l,c=t>0?c:c+(n-u)),{step:o,tickMin:s.sub(new K.default(c).mul(o)),tickMax:s.add(new K.default(l).mul(o))})},Up=function(e){var[t,n]=e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`auto`,o=Math.max(r,2),[s,c]=Rp([t,n]);if(s===-1/0||c===1/0){var l=c===1/0?[s,...Array(r-1).fill(1/0)]:[...Array(r-1).fill(-1/0),c];return t>n?l.reverse():l}if(s===c)return Vp(s,r,i);var{step:u,tickMin:d,tickMax:f}=Hp(s,c,o,i,0,a===`snap125`?Bp:zp),p=Lp(d,f.add(new K.default(.1).mul(u)),u);return t>n?p.reverse():p},Wp=function(e,t){var[n,r]=e,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`auto`,[o,s]=Rp([n,r]);if(o===-1/0||s===1/0)return[n,r];if(o===s)return[o];var c=a===`snap125`?Bp:zp,l=Math.max(t,2),u=c(new K.default(s).sub(o).div(l-1),i,0),d=[...Lp(new K.default(o),new K.default(s),u),s];return i===!1&&(d=d.map(e=>Math.round(e))),n>r?d.reverse():d},Gp=e=>e.rootProps.barCategoryGap,Kp=e=>e.rootProps.stackOffset,qp=e=>e.rootProps.reverseStackOrder,Jp=e=>e.options.chartName,Yp=e=>e.rootProps.syncId,Xp=e=>e.rootProps.syncMethod,Zp=e=>e.options.eventEmitter,Qp=e=>e.rootProps.baseValue,$p={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},em={allowDecimals:!1,allowDuplicatedCategory:!0,allowDataOverflow:!1,angle:0,angleAxisId:0,axisLine:!0,axisLineType:`polygon`,cx:0,cy:0,hide:!1,includeHidden:!1,label:!1,niceTicks:`auto`,orientation:`outer`,reversed:!1,scale:`auto`,tick:!0,tickLine:!0,tickSize:8,type:`auto`,zIndex:$p.axis},tm={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,niceTicks:`auto`,label:!1,orientation:`right`,radiusAxisId:0,reversed:!1,scale:`auto`,stroke:`#ccc`,tick:!0,tickCount:5,tickLine:!0,type:`auto`,zIndex:$p.axis},nm=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function rm(e,t,n){if(n!==`auto`)return n;if(e!=null)return As(e,t)?`category`:`number`}function im(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function am(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},Xc],(e,t)=>{if(e!=null)return e;var n=rm(t,`angleAxis`,lm.type)??`category`;return am(am({},lm),{},{type:n})}),fm=R([(e,t)=>e.polarAxis.radiusAxis[t],Xc],(e,t)=>{if(e!=null)return e;var n=rm(t,`radiusAxis`,um.type)??`category`;return am(am({},um),{},{type:n})}),pm=e=>e.polarOptions,mm=R([qs,Js,uc],np),hm=R([pm,mm],(e,t)=>{if(e!=null)return Kt(e.innerRadius,t,0)}),gm=R([pm,mm],(e,t)=>{if(e!=null)return Kt(e.outerRadius,t,t*.8)}),_m=R([pm],e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]});R([dm,_m],nm);var vm=R([mm,hm,gm],(e,t,n)=>{if(e!=null&&t!=null&&n!=null)return[t,n]});R([fm,vm],nm);var ym=R([U,pm,hm,gm,qs,Js],(e,t,n,r,i,a)=>{if(!(e!==`centric`&&e!==`radial`||t==null||n==null||r==null)){var{cx:o,cy:s,startAngle:c,endAngle:l}=t;return{cx:Kt(o,i,i/2),cy:Kt(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:l,clockWise:!1}}}),q=(e,t)=>t,bm=(e,t,n)=>n;function xm(e){return e?.id}function Sm(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(e=>{var t=e.data??r;if(t!=null&&t.length!==0){var n=xm(e);t.forEach((t,r)=>{var s=a==null||i?r:String(H(t,a,null)),c=H(t,e.dataKey,0),l=o.has(s)?o.get(s):{};Object.assign(l,{[n]:c}),o.set(s,l)})}}),Array.from(o.values())}function Cm(e){return`stackId`in e&&e.stackId!=null&&e.dataKey!=null}var wm=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function Tm(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function Em(e,t){if(e.length===t.length){for(var n=0;n{var t=U(e);return t===`horizontal`?`xAxis`:t===`vertical`?`yAxis`:t===`centric`?`angleAxis`:`radiusAxis`},Dm=e=>e.tooltip.settings.axisId;function Om(e){if(e!=null){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(e){var t=i[0],n=i[1];return t<=n?e>=t&&e<=n:e>=n&&e<=t},bandwidth:n?()=>n.call(e):void 0,ticks:t?n=>t.call(e,n):void 0,map:(t,n)=>{var r=e(t);if(r!=null){if(e.bandwidth&&n!=null&&n.position){var i=e.bandwidth();switch(n.position){case`middle`:r+=i/2;break;case`end`:r+=i}}return r}}}}}var km=(e,t)=>{if(t!=null)switch(e){case`linear`:if(!Mp(t)){for(var n,r,i=0;ir)&&(r=a))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t;default:return t}};function Am(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function jm(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Mm(e){let t,n,r;e.length===2?(t=e===Am||e===jm?e:Nm,n=e,r=e):(t=Am,n=(t,n)=>Am(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<0?i=t+1:a=t}while(i>>1;n(e[t],r)<=0?i=t+1:a=t}while(in&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function Nm(){return 0}function Pm(e){return e===null?NaN:+e}function*Fm(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var Im=Mm(Am),Lm=Im.right;Im.left,Mm(Pm).center;var Rm=class extends Map{constructor(e,t=Hm){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(zm(this,e))}has(e){return super.has(zm(this,e))}set(e,t){return super.set(Bm(this,e),t)}delete(e){return super.delete(Vm(this,e))}};function zm({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function Bm({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Vm({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Hm(e){return typeof e==`object`&&e?e.valueOf():e}function Um(e=Am){if(e===Am)return Wm;if(typeof e!=`function`)throw TypeError(`compare is not a function`);return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Wm(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var Gm=Math.sqrt(50),Km=Math.sqrt(10),qm=Math.sqrt(2);function Jm(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=Gm?10:a>=Km?5:a>=qm?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/lt&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*lt&&--c),c0))return[];if(e===t)return[e];let r=t=i))return[];let s=a-i+1,c=Array(s);if(r){if(o<0)for(let e=0;e=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function $m(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function eh(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?Wm:Um(i);r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));eh(e,t,u,d,i)}let a=e[t],o=n,s=r;for(th(e,n,t),i(e[r],a)>0&&th(e,n,r);o0;)--s}i(e[n],a)===0?th(e,n,s):(++s,th(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function th(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function nh(e,t,n){if(e=Float64Array.from(Fm(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return $m(e);if(t>=1)return Qm(e);var r,i=(r-1)*t,a=Math.floor(i),o=Qm(eh(e,a).subarray(0,a+1));return o+($m(e.subarray(a+1))-o)*(i-a)}}function rh(e,t,n=Pm){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function ih(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++rt&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function vh(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?yh:vh,c=l=null,m}function m(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return m.invert=function(n){return o(i((l||=s(t,e.map(r),u))(n)))},m.domain=function(t){return arguments.length?(e=Array.from(t,ph),p()):e.slice()},m.range=function(e){return arguments.length?(t=Array.from(e),p()):t.slice()},m.rangeRound=function(e){return t=Array.from(e),n=f,p()},m.clamp=function(e){return arguments.length?(o=e?!0:hh,p()):o!==hh},m.interpolate=function(e){return arguments.length?(n=e,p()):n},m.unknown=function(e){return arguments.length?(a=e,m):a},function(e,t){return r=e,i=t,p()}}function Sh(){return xh()(hh,hh)}function Ch(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function wh(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Th(e){return e=wh(Math.abs(e)),e?e[1]:NaN}function Eh(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Dh(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var Oh=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function kh(e){if(!(t=Oh.exec(e)))throw Error(`invalid format: `+e);var t;return new Ah({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}kh.prototype=Ah.prototype;function Ah(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}Ah.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function jh(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0)}return r>0?e.slice(0,r)+e.slice(i+1):e}var Mh;function Nh(e,t){var n=wh(e,t);if(!n)return Mh=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(Mh=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+wh(e,Math.max(0,t+a-1))[0]}function Ph(e,t){var n=wh(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var Fh={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:Ch,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Ph(e*100,t),r:Ph,s:Nh,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Ih(e){return e}var Lh=Array.prototype.map,Rh=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function zh(e){var t=e.grouping===void 0||e.thousands===void 0?Ih:Eh(Lh.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?Ih:Dh(Lh.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=kh(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):Fh[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=Fh[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=jh(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&Mh!==void 0?Rh[8+Mh/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++op||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Th(t)/3)))*3,r=10**-n,i=l((e=kh(e),e.type=`f`,e),{suffix:Rh[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var Bh,Vh,Hh;Uh({thousands:`,`,grouping:[3],currency:[`$`,``]});function Uh(e){return Bh=zh(e),Vh=Bh.format,Hh=Bh.formatPrefix,Bh}function Wh(e){return Math.max(0,-Th(Math.abs(e)))}function Gh(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Th(t)/3)))*3-Th(Math.abs(e)))}function Kh(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Th(t)-Th(e))+1}function qh(e,t,n,r){var i=Zm(e,t,n),a;switch(r=kh(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=Gh(i,o))&&(r.precision=a),Hh(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=Kh(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=Wh(i))&&(r.precision=a-(r.type===`%`)*2)}return Vh(r)}function Jh(e){var t=e.domain;return e.ticks=function(e){var n=t();return Ym(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return qh(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s0;){if(l=Xm(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function Yh(){var e=Sh();return e.copy=function(){return bh(e,Yh())},ah.apply(e,arguments),Jh(e)}function Xh(e){var t;function n(e){return e==null||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,ph),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return Xh(e).unknown(t)},e=arguments.length?Array.from(e,ph):[0,1],Jh(n)}function Zh(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return ae**+t}function ig(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function ag(e){return(t,n)=>-e(-t,n)}function og(e){let t=e(Qh,$h),n=t.domain,r=10,i,a;function o(){return i=ig(r),a=rg(r),n()[0]<0?(i=ag(i),a=ag(a),e(eg,tg)):e(Qh,$h),t}return t.base=function(e){return arguments.length?(r=+e,o()):r},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{let t=n(),o=t[0],s=t[t.length-1],c=s0){for(;l<=u;++l)for(d=1;ds)break;m.push(f)}}else for(;l<=u;++l)for(d=r-1;d>=1;--d)if(f=l>0?d/a(-l):d*a(l),!(fs)break;m.push(f)}m.length*2{if(e??=10,n??=r===10?`s`:`,`,typeof n!=`function`&&(!(r%1)&&(n=kh(n)).precision==null&&(n.trim=!0),n=Vh(n)),e===1/0)return n;let o=Math.max(1,r*e/t.ticks().length);return e=>{let t=e/a(Math.round(i(e)));return t*rn(Zh(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function sg(){let e=og(xh()).domain([1,10]);return e.copy=()=>bh(e,sg()).base(e.base()),ah.apply(e,arguments),e}function cg(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function lg(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function ug(e){var t=1,n=e(cg(t),lg(t));return n.constant=function(n){return arguments.length?e(cg(t=+n),lg(t)):t},Jh(n)}function dg(){var e=ug(xh());return e.copy=function(){return bh(e,dg()).constant(e.constant())},ah.apply(e,arguments)}function fg(e){return function(t){return t<0?-((-t)**+e):t**+e}}function pg(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function mg(e){return e<0?-e*e:e*e}function hg(e){var t=e(hh,hh),n=1;function r(){return n===1?e(hh,hh):n===.5?e(pg,mg):e(fg(n),fg(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},Jh(t)}function gg(){var e=hg(xh());return e.copy=function(){return bh(e,gg()).exponent(e.exponent())},ah.apply(e,arguments),e}function _g(){return gg.apply(null,arguments).exponent(.5)}function vg(e){return Math.sign(e)*e*e}function yg(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function bg(){var e=Sh(),t=[0,1],n=!1,r;function i(t){var i=yg(e(t));return isNaN(i)?r:n?Math.round(i):i}return i.invert=function(t){return e.invert(vg(t))},i.domain=function(t){return arguments.length?(e.domain(t),i):e.domain()},i.range=function(n){return arguments.length?(e.range((t=Array.from(n,ph)).map(vg)),i):t.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(n=!!e,i):n},i.clamp=function(t){return arguments.length?(e.clamp(t),i):e.clamp()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return bg(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},ah.apply(i,arguments),Jh(i)}function xg(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r0?n[i-1]:e[0],i=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Sg().domain([e,t]).range(i).unknown(a)},ah.apply(Jh(o),arguments)}function Cg(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[Lm(e,i,0,r)]:n}return i.domain=function(n){return arguments.length?(e=Array.from(n),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(n){return arguments.length?(t=Array.from(n),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return Cg().domain(e).range(t).unknown(n)},ah.apply(i,arguments)}var wg=new Date,Tg=new Date;function Y(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(sY(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e){if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}}),n&&(i.count=(t,r)=>(wg.setTime(+t),Tg.setTime(+r),e(wg),e(Tg),Math.floor(n(wg,Tg))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var Eg=Y(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Eg.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Y(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Eg),Eg.range;var Dg=1e3,Og=Dg*60,kg=Og*60,Ag=kg*24,jg=Ag*7,Mg=Ag*30,Ng=Ag*365,Pg=Y(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Dg)},(e,t)=>(t-e)/Dg,e=>e.getUTCSeconds());Pg.range;var Fg=Y(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Dg)},(e,t)=>{e.setTime(+e+t*Og)},(e,t)=>(t-e)/Og,e=>e.getMinutes());Fg.range;var Ig=Y(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Og)},(e,t)=>(t-e)/Og,e=>e.getUTCMinutes());Ig.range;var Lg=Y(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Dg-e.getMinutes()*Og)},(e,t)=>{e.setTime(+e+t*kg)},(e,t)=>(t-e)/kg,e=>e.getHours());Lg.range;var Rg=Y(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*kg)},(e,t)=>(t-e)/kg,e=>e.getUTCHours());Rg.range;var zg=Y(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Og)/Ag,e=>e.getDate()-1);zg.range;var Bg=Y(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ag,e=>e.getUTCDate()-1);Bg.range;var Vg=Y(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ag,e=>Math.floor(e/Ag));Vg.range;function Hg(e){return Y(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Og)/jg)}var Ug=Hg(0),Wg=Hg(1),Gg=Hg(2),Kg=Hg(3),qg=Hg(4),Jg=Hg(5),Yg=Hg(6);Ug.range,Wg.range,Gg.range,Kg.range,qg.range,Jg.range,Yg.range;function Xg(e){return Y(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/jg)}var Zg=Xg(0),Qg=Xg(1),$g=Xg(2),e_=Xg(3),t_=Xg(4),n_=Xg(5),r_=Xg(6);Zg.range,Qg.range,$g.range,e_.range,t_.range,n_.range,r_.range;var i_=Y(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());i_.range;var a_=Y(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());a_.range;var o_=Y(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());o_.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Y(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),o_.range;var s_=Y(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());s_.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Y(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),s_.range;function c_(e,t,n,r,i,a){let o=[[Pg,1,Dg],[Pg,5,5*Dg],[Pg,15,15*Dg],[Pg,30,30*Dg],[a,1,Og],[a,5,5*Og],[a,15,15*Og],[a,30,30*Og],[i,1,kg],[i,3,3*kg],[i,6,6*kg],[i,12,12*kg],[r,1,Ag],[r,2,2*Ag],[n,1,jg],[t,1,Mg],[t,3,3*Mg],[e,1,Ng]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(Zm(t/Ng,n/Ng,r));if(a===0)return Eg.every(Math.max(Zm(t,n,r),1));let[s,c]=o[i/o[a-1][2]53)return null;`w`in r||(r.w=1),`Z`in r?(a=m_(h_(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?Qg.ceil(a):Qg(a),a=Bg.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=p_(h_(r.y,0,1)),o=a.getDay(),a=o>4||o===0?Wg.ceil(a):Wg(a),a=zg.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else(`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?m_(h_(r.y,0,1)).getUTCDay():p_(h_(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,m_(r)):p_(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in __?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function ee(e,n,r){return w(e,t,n,r)}function te(e,t,r){return w(e,n,t,r)}function A(e,t,n){return w(e,r,t,n)}function j(e){return o[e.getDay()]}function ne(e){return a[e.getDay()]}function re(e){return c[e.getMonth()]}function ie(e){return s[e.getMonth()]}function ae(e){return i[+(e.getHours()>=12)]}function M(e){return 1+~~(e.getMonth()/3)}function oe(e){return o[e.getUTCDay()]}function se(e){return a[e.getUTCDay()]}function ce(e){return c[e.getUTCMonth()]}function le(e){return s[e.getUTCMonth()]}function ue(e){return i[+(e.getUTCHours()>=12)]}function de(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}var __={"-":``,_:` `,0:`0`},X=/^\s*\d+/,v_=/^%/,y_=/[\\^$*+?|[\]().{}]/g;function Z(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function C_(e,t,n){var r=X.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function w_(e,t,n){var r=X.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function T_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function E_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function D_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function O_(e,t,n){var r=X.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function k_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function A_(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function j_(e,t,n){var r=X.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function M_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function N_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function P_(e,t,n){var r=X.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function F_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function I_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function L_(e,t,n){var r=X.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function R_(e,t,n){var r=X.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function z_(e,t,n){var r=X.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function B_(e,t,n){var r=v_.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function V_(e,t,n){var r=X.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function H_(e,t,n){var r=X.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function U_(e,t){return Z(e.getDate(),t,2)}function W_(e,t){return Z(e.getHours(),t,2)}function G_(e,t){return Z(e.getHours()%12||12,t,2)}function K_(e,t){return Z(1+zg.count(o_(e),e),t,3)}function q_(e,t){return Z(e.getMilliseconds(),t,3)}function J_(e,t){return q_(e,t)+`000`}function Y_(e,t){return Z(e.getMonth()+1,t,2)}function X_(e,t){return Z(e.getMinutes(),t,2)}function Z_(e,t){return Z(e.getSeconds(),t,2)}function Q_(e){var t=e.getDay();return t===0?7:t}function $_(e,t){return Z(Ug.count(o_(e)-1,e),t,2)}function ev(e){var t=e.getDay();return t>=4||t===0?qg(e):qg.ceil(e)}function tv(e,t){return e=ev(e),Z(qg.count(o_(e),e)+(o_(e).getDay()===4),t,2)}function nv(e){return e.getDay()}function rv(e,t){return Z(Wg.count(o_(e)-1,e),t,2)}function iv(e,t){return Z(e.getFullYear()%100,t,2)}function av(e,t){return e=ev(e),Z(e.getFullYear()%100,t,2)}function ov(e,t){return Z(e.getFullYear()%1e4,t,4)}function sv(e,t){var n=e.getDay();return e=n>=4||n===0?qg(e):qg.ceil(e),Z(e.getFullYear()%1e4,t,4)}function cv(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+Z(t/60|0,`0`,2)+Z(t%60,`0`,2)}function lv(e,t){return Z(e.getUTCDate(),t,2)}function uv(e,t){return Z(e.getUTCHours(),t,2)}function dv(e,t){return Z(e.getUTCHours()%12||12,t,2)}function fv(e,t){return Z(1+Bg.count(s_(e),e),t,3)}function pv(e,t){return Z(e.getUTCMilliseconds(),t,3)}function mv(e,t){return pv(e,t)+`000`}function hv(e,t){return Z(e.getUTCMonth()+1,t,2)}function gv(e,t){return Z(e.getUTCMinutes(),t,2)}function _v(e,t){return Z(e.getUTCSeconds(),t,2)}function vv(e){var t=e.getUTCDay();return t===0?7:t}function yv(e,t){return Z(Zg.count(s_(e)-1,e),t,2)}function bv(e){var t=e.getUTCDay();return t>=4||t===0?t_(e):t_.ceil(e)}function xv(e,t){return e=bv(e),Z(t_.count(s_(e),e)+(s_(e).getUTCDay()===4),t,2)}function Sv(e){return e.getUTCDay()}function Cv(e,t){return Z(Qg.count(s_(e)-1,e),t,2)}function wv(e,t){return Z(e.getUTCFullYear()%100,t,2)}function Tv(e,t){return e=bv(e),Z(e.getUTCFullYear()%100,t,2)}function Ev(e,t){return Z(e.getUTCFullYear()%1e4,t,4)}function Dv(e,t){var n=e.getUTCDay();return e=n>=4||n===0?t_(e):t_.ceil(e),Z(e.getUTCFullYear()%1e4,t,4)}function Ov(){return`+0000`}function kv(){return`%`}function Av(e){return+e}function jv(e){return Math.floor(e/1e3)}var Mv,Nv,Pv;Fv({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function Fv(e){return Mv=g_(e),Nv=Mv.format,Mv.parse,Pv=Mv.utcFormat,Mv.utcParse,Mv}function Iv(e){return new Date(e)}function Lv(e){return e instanceof Date?+e:+new Date(+e)}function Rv(e,t,n,r,i,a,o,s,c,l){var u=Sh(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>nh(e,r/t))},n.copy=function(){return Jv(t).domain(e)},oh.apply(n,arguments)}function Yv(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=hh,u,m=!1,h;function g(e){return isNaN(e=+e)?h:(e=.5+((e=+u(e))-a)*(r*elh,scaleDiverging:()=>Xv,scaleDivergingLog:()=>Zv,scaleDivergingPow:()=>$v,scaleDivergingSqrt:()=>ey,scaleDivergingSymlog:()=>Qv,scaleIdentity:()=>Xh,scaleImplicit:()=>sh,scaleLinear:()=>Yh,scaleLog:()=>sg,scaleOrdinal:()=>ch,scalePoint:()=>dh,scalePow:()=>gg,scaleQuantile:()=>xg,scaleQuantize:()=>Sg,scaleRadial:()=>bg,scaleSequential:()=>Uv,scaleSequentialLog:()=>Wv,scaleSequentialPow:()=>Kv,scaleSequentialQuantile:()=>Jv,scaleSequentialSqrt:()=>qv,scaleSequentialSymlog:()=>Gv,scaleSqrt:()=>_g,scaleSymlog:()=>dg,scaleThreshold:()=>Cg,scaleTime:()=>zv,scaleUtc:()=>Bv,tickFormat:()=>qh});function ny(e){if(e in ty)return ty[e]();var t=`scale${Xt(e)}`;if(t in ty)return ty[t]()}function ry(e,t,n){if(typeof e==`function`)return e.copy().domain(t).range(n);if(e!=null){var r=ny(e);if(r!=null)return r.domain(t).range(n),r}}function iy(e,t,n,r){if(n!=null&&r!=null)return typeof e.scale==`function`?ry(e.scale,n,r):ry(t,n,r)}function ay(e){return`scale${Xt(e)}`}function oy(e){return ay(e)in ty}var sy=(e,t,n)=>{if(e!=null){var{scale:r,type:i}=e;if(r===`auto`)return i===`category`&&n&&(n.indexOf(`LineChart`)>=0||n.indexOf(`AreaChart`)>=0||n.indexOf(`ComposedChart`)>=0&&!t)?`point`:i===`category`?`band`:`linear`;if(typeof r==`string`)return oy(r)?r:`point`}};function cy(e,t){for(var n=0,r=e.length,i=e[0]t)?n=a+1:r=a}return n}function ly(e,t){if(e){var n=t??e.domain(),r=n.map(t=>e(t)??0),i=e.range();if(!(n.length===0||i.length<2))return e=>{var t=cy(r,e);if(t<=0)return n[0];if(t>=n.length)return n[n.length-1];var i=r[t-1]??0,a=r[t]??0;return Math.abs(e-i)<=Math.abs(e-a)?n[t-1]:n[t]}}}function uy(e){if(e!=null)return`invert`in e&&typeof e.invert==`function`?e.invert.bind(e):ly(e,void 0)}function dy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fy(e){for(var t=1;te.cartesianAxis.xAxis[t],yy=(e,t)=>vy(e,t)??_y,by={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:gy,hide:!0,id:0,includeHidden:!1,interval:`preserveEnd`,minTickGap:5,mirror:!1,name:void 0,orientation:`left`,padding:{top:0,bottom:0},reversed:!1,scale:`auto`,tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:`number`,unit:void 0,niceTicks:`auto`,width:60},xy=(e,t)=>e.cartesianAxis.yAxis[t],Sy=(e,t)=>xy(e,t)??by,Cy={domain:[0,`auto`],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:``,range:[64,64],scale:`auto`,type:`number`,unit:``},wy=(e,t)=>e.cartesianAxis.zAxis[t]??Cy,Ty=(e,t,n)=>{switch(t){case`xAxis`:return yy(e,n);case`yAxis`:return Sy(e,n);case`zAxis`:return wy(e,n);case`angleAxis`:return dm(e,n);case`radiusAxis`:return fm(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},Ey=(e,t,n)=>{switch(t){case`xAxis`:return yy(e,n);case`yAxis`:return Sy(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},Dy=(e,t,n)=>{switch(t){case`xAxis`:return yy(e,n);case`yAxis`:return Sy(e,n);case`angleAxis`:return dm(e,n);case`radiusAxis`:return fm(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},Oy=e=>e.graphicalItems.cartesianItems.some(e=>e.type===`bar`)||e.graphicalItems.polarItems.some(e=>e.type===`radialBar`);function ky(e,t){return n=>{switch(e){case`xAxis`:return`xAxisId`in n&&n.xAxisId===t;case`yAxis`:return`yAxisId`in n&&n.yAxisId===t;case`zAxis`:return`zAxisId`in n&&n.zAxisId===t;case`angleAxis`:return`angleAxisId`in n&&n.angleAxisId===t;case`radiusAxis`:return`radiusAxisId`in n&&n.radiusAxisId===t;default:return!1}}}var Ay=e=>e.graphicalItems.cartesianItems,jy=R([q,bm],ky),My=(e,t,n)=>e.filter(n).filter(e=>t?.includeHidden===!0||!e.hide),Ny=R([Ay,Ty,jy],My,{memoizeOptions:{resultEqualityCheck:Tm}}),Py=R([Ny],e=>e.filter(e=>e.type===`area`||e.type===`bar`).filter(Cm)),Fy=e=>e.filter(e=>!(`stackId`in e)||e.stackId===void 0),Iy=R([Ny],Fy),Ly=e=>e.map(e=>e.data).filter(Boolean).flat(1),Ry=R([Ny],Ly,{memoizeOptions:{resultEqualityCheck:Tm}}),zy=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},By=R([Ry,Ap],zy),Vy=(e,t,n)=>t?.dataKey==null?n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:H(e,t)}))):e.map(e=>({value:e})):e.map(e=>({value:H(e,t.dataKey)})),Hy=R([By,Ty,Ny],Vy);function Uy(e){if(Ut(e)||e instanceof Date){var t=Number(e);if(V(t))return t}}function Wy(e){if(Array.isArray(e)){var t=[Uy(e[0]),Uy(e[1])];return Mp(t)?t:void 0}var n=Uy(e);if(n!=null)return[n,n]}function Gy(e){return e.map(Uy).filter(Zt)}function Ky(e,t){var n=Uy(e),r=Uy(t);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var qy=R([Hy],e=>e?.map(e=>e.value).sort(Ky));function Jy(e,t){switch(e){case`xAxis`:return t.direction===`x`;case`yAxis`:return t.direction===`y`;default:return!1}}function Yy(e,t,n){return!n||typeof t!=`number`||Vt(t)||!n.length?[]:Gy(n.flatMap(n=>{var r=H(e,n.dataKey),i,a;if(Array.isArray(r)?[i,a]=r:i=a=r,!(!V(i)||!V(a)))return[t-i,t+a]}))}var Q=e=>Dy(e,J(e),Dm(e)),Xy=R([Q],e=>e?.dataKey),Zy=R([Py,Ap,Q],Sm),Qy=(e,t,n,r)=>{var i=t.reduce((e,t)=>{if(t.stackId==null)return e;var n=e[t.stackId];return n??=[],n.push(t),e[t.stackId]=n,e},{});return Object.fromEntries(Object.entries(i).map(t=>{var[i,a]=t,o=r?[...a].reverse():a;return[i,{stackedData:Ps(e,o.map(xm),n),graphicalItems:o}]}))},$y=R([Zy,Py,Kp,qp],Qy),eb=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(r==null&&n!==`zAxis`){var o=zs(e,i,a);if(o==null||o[0]!==0||o[1]!==0)return o}},tb=R([Ty],e=>e.allowDataOverflow),nb=e=>{if(e==null||!(`domain`in e))return gy;if(e.domain!=null)return e.domain;if(`ticks`in e&&e.ticks!=null){if(e.type===`number`){var t=Gy(e.ticks);return[Math.min(...t),Math.max(...t)]}if(e.type===`category`)return e.ticks.map(String)}return e?.domain??gy},rb=R([Ty],nb),ib=R([rb,tb],Pp),ab=R([$y,Op,q,ib],eb,{memoizeOptions:{resultEqualityCheck:wm}}),ob=e=>e.errorBars,sb=(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>Jy(n,e)),cb=function(){var e=[...arguments].filter(Boolean);if(e.length!==0){var t=e.flat();return[Math.min(...t),Math.max(...t)]}},lb=(e,t,n,r,i)=>{var a,o;if(n.length>0&&e.forEach(e=>{n.forEach(n=>{var s=r[n.id]?.filter(e=>Jy(i,e)),c=H(e,t.dataKey??n.dataKey),l=Yy(e,c,s);if(l.length>=2){var u=Math.min(...l),d=Math.max(...l);(a==null||uo)&&(o=d)}var f=Wy(c);f!=null&&(a=a==null?f[0]:Math.min(a,f[0]),o=o==null?f[1]:Math.max(o,f[1]))})}),t?.dataKey!=null&&e.forEach(e=>{var n=Wy(H(e,t.dataKey));n!=null&&(a=a==null?n[0]:Math.min(a,n[0]),o=o==null?n[1]:Math.max(o,n[1]))}),V(a)&&V(o))return[a,o]},ub=R([By,Ty,Iy,ob,q],lb,{memoizeOptions:{resultEqualityCheck:wm}});function db(e){var{value:t}=e;if(Ut(t)||t instanceof Date)return t}var fb=(e,t,n)=>{var r=e.map(db).filter(e=>e!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&qt(r))?Dp(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},pb=e=>e.referenceElements.dots,mb=(e,t,n)=>e.filter(e=>e.ifOverflow===`extendDomain`).filter(e=>t===`xAxis`?e.xAxisId===n:e.yAxisId===n),hb=R([pb,q,bm],mb),gb=e=>e.referenceElements.areas,_b=R([gb,q,bm],mb),vb=e=>e.referenceElements.lines,yb=R([vb,q,bm],mb),bb=(e,t)=>{if(e!=null){var n=Gy(e.map(e=>t===`xAxis`?e.x:e.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},xb=R(hb,q,bb),Sb=(e,t)=>{if(e!=null){var n=Gy(e.flatMap(e=>[t===`xAxis`?e.x1:e.y1,t===`xAxis`?e.x2:e.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Cb=R([_b,q],Sb);function wb(e){if(e.x!=null)return Gy([e.x]);var t=e.segment?.map(e=>e.x);return t==null||t.length===0?[]:Gy(t)}function Tb(e){if(e.y!=null)return Gy([e.y]);var t=e.segment?.map(e=>e.y);return t==null||t.length===0?[]:Gy(t)}var Eb=(e,t)=>{if(e!=null){var n=e.flatMap(e=>t===`xAxis`?wb(e):Tb(e));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Db=R(xb,R([yb,q],Eb),Cb,(e,t,n)=>cb(e,n,t)),Ob=(e,t,n,r,i,a,o,s)=>n??Fp(t,o===`vertical`&&s===`xAxis`||o===`horizontal`&&s===`yAxis`?cb(r,a,i):cb(a,i),e.allowDataOverflow),kb=R([Ty,rb,ib,ab,ub,Db,U,q],Ob,{memoizeOptions:{resultEqualityCheck:wm}}),Ab=[0,1],jb=(e,t,n,r,i,a,o)=>{if(e!=null&&n!=null&&n.length!==0||o!==void 0){var{dataKey:s,type:c}=e,l=As(t,a);return l&&s==null?Dp(0,n?.length??0):c===`category`?fb(r,e,l):i===`expand`?Ab:o}},Mb=R([Ty,U,By,Hy,Kp,q,kb],jb),Nb=R([Ty,Oy,Jp],sy),Pb=(e,t,n)=>{var{niceTicks:r}=t;if(r!==`none`){var i=nb(t),a=Array.isArray(i)&&(i[0]===`auto`||i[1]===`auto`);if((r===`snap125`||r===`adaptive`)&&t!=null&&t.tickCount&&Mp(e)){if(a)return Up(e,t.tickCount,t.allowDecimals,r);if(t.type===`number`)return Wp(e,t.tickCount,t.allowDecimals,r)}if(r===`auto`&&n===`linear`&&t!=null&&t.tickCount){if(a&&Mp(e))return Up(e,t.tickCount,t.allowDecimals,`adaptive`);if(t.type===`number`&&Mp(e))return Wp(e,t.tickCount,t.allowDecimals,`adaptive`)}}},Fb=R([Mb,Dy,Nb],Pb),Ib=(e,t,n,r)=>{if(r!==`angleAxis`&&e?.type===`number`&&Mp(t)&&Array.isArray(n)&&n.length>0){var i=t[0],a=n[0]??0,o=t[1],s=n[n.length-1]??0;return[Math.min(i,a),Math.max(o,s)]}return t},Lb=R([Ty,Mb,Fb,q],Ib),Rb=R(R(Hy,Ty,(e,t)=>{if(!(!t||t.type!==`number`)){var n=1/0,r=Array.from(Gy(e.map(e=>e.value))).sort((e,t)=>e-t),i=r[0],a=r[r.length-1];if(i==null||a==null)return 1/0;var o=a-i;if(o===0)return 1/0;for(var s=0;si,(e,t,n,r,i)=>{if(!V(e))return 0;var a=t===`vertical`?r.height:r.width;if(i===`gap`)return e*a/2;if(i===`no-gap`){var o=Kt(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),zb=(e,t,n)=>{var r=yy(e,t);return r==null||typeof r.padding!=`string`?0:Rb(e,`xAxis`,t,n,r.padding)},Bb=(e,t,n)=>{var r=Sy(e,t);return r==null||typeof r.padding!=`string`?0:Rb(e,`yAxis`,t,n,r.padding)},Vb=R(yy,zb,(e,t)=>{if(e==null)return{left:0,right:0};var{padding:n}=e;return typeof n==`string`?{left:t,right:t}:{left:(n.left??0)+t,right:(n.right??0)+t}}),Hb=R(Sy,Bb,(e,t)=>{if(e==null)return{top:0,bottom:0};var{padding:n}=e;return typeof n==`string`?{top:t,bottom:t}:{top:(n.top??0)+t,bottom:(n.bottom??0)+t}}),Ub=R([uc,Vb,gc,hc,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),Wb=R([uc,U,Hb,gc,hc,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:t===`horizontal`?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),Gb=(e,t,n,r)=>{switch(t){case`xAxis`:return Ub(e,n,r);case`yAxis`:return Wb(e,n,r);case`zAxis`:return wy(e,n)?.range;case`angleAxis`:return _m(e);case`radiusAxis`:return vm(e,n);default:return}},Kb=R([Ty,Gb],nm),qb=R([Ty,Nb,R([Nb,Lb],km),Kb],iy),Jb=(e,t,n,r)=>{if(n!=null&&n.dataKey!=null){var{type:i,scale:a}=n;if(As(e,r)&&(i===`number`||a!==`auto`))return t.map(e=>e.value)}},Yb=R([U,Hy,Dy,q],Jb),Xb=R([qb],Om);R([qb],uy),R([qb,qy],ly),R([Ny,ob,q],sb);function Zb(e,t){return e.idt.id)}var Qb=(e,t)=>t,$b=(e,t,n)=>n,ex=R(Zs,Qb,$b,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Zb)),tx=R(Qs,Qb,$b,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Zb)),nx=(e,t)=>({width:e.width,height:t.height}),rx=(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height}),ix=R(uc,yy,nx),ax=(e,t,n)=>{switch(t){case`top`:return e.top;case`bottom`:return n-e.bottom;default:return 0}},ox=(e,t,n)=>{switch(t){case`left`:return e.left;case`right`:return n-e.right;default:return 0}},sx=R(Js,uc,ex,Qb,$b,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=nx(t,n);o??=ax(t,r,e);var c=r===`top`&&!i||r===`bottom`&&i;a[n.id]=o-Number(c)*s.height,o+=(c?-1:1)*s.height}),a}),cx=R(qs,uc,tx,Qb,$b,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=rx(t,n);o??=ox(t,r,e);var c=r===`left`&&!i||r===`right`&&i;a[n.id]=o-Number(c)*s.width,o+=(c?-1:1)*s.width}),a}),lx=R([uc,yy,(e,t)=>{var n=yy(e,t);if(n!=null)return sx(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}}),ux=R([uc,Sy,(e,t)=>{var n=Sy(e,t);if(n!=null)return cx(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}}),dx=R(uc,Sy,(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height})),fx=(e,t,n,r)=>{if(n!=null){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,s=As(e,r),c=t.map(e=>e.value);if(o&&s&&a===`category`&&i&&qt(c))return c}},px=R([U,Hy,Ty,q],fx),mx=R([U,Ey,Nb,Xb,px,Yb,Gb,Fb,q],(e,t,n,r,i,a,o,s,c)=>{if(t!=null){var l=As(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:a,duplicateDomain:i,isCategorical:l,niceTicks:s,range:o,realScaleType:n,scale:r}}}),hx=R([U,Dy,Nb,Xb,Fb,Gb,px,Yb,q],(e,t,n,r,i,a,o,s,c)=>{if(t!=null&&r!=null){var l=As(e,c),{type:u,ticks:d,tickCount:f}=t,p=n===`scaleBand`&&typeof r.bandwidth==`function`?r.bandwidth()/2:2,m=u===`category`&&r.bandwidth?r.bandwidth()/p:0;m=c===`angleAxis`&&a!=null&&a.length>=2?Bt(a[0]-a[1])*2*m:m;var h=d||i;return h?h.map((e,t)=>{var n=o?o.indexOf(e):e,i=r.map(n);return V(i)?{index:t,coordinate:i+m,value:e,offset:m}:null}).filter(Zt):l&&s?s.map((e,t)=>{var n=r.map(e);return V(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(Zt):r.ticks?r.ticks(f).map((e,t)=>{var n=r.map(e);return V(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(Zt):r.domain().map((e,t)=>{var n=r.map(e);return V(n)?{coordinate:n+m,value:o?o[e]:e,index:t,offset:m}:null}).filter(Zt)}}),gx=R([U,Dy,Xb,Gb,px,Yb,q],(e,t,n,r,i,a,o)=>{if(t!=null&&n!=null&&r!=null&&r[0]!==r[1]){var s=As(e,o),{tickCount:c}=t,l=0;return l=o===`angleAxis`&&r?.length>=2?Bt(r[0]-r[1])*2*l:l,s&&a?a.map((e,t)=>{var r=n.map(e);return V(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(Zt):n.ticks?n.ticks(c).map((e,t)=>{var r=n.map(e);return V(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(Zt):n.domain().map((e,t)=>{var r=n.map(e);return V(r)?{coordinate:r+l,value:i?i[e]:e,index:t,offset:l}:null}).filter(Zt)}}),_x=R(Ty,Xb,(e,t)=>{if(e!=null&&t!=null)return fy(fy({},e),{},{scale:t})});R((e,t,n)=>wy(e,n),R([R([Ty,Nb,Mb,Kb],iy)],Om),(e,t)=>{if(e!=null&&t!=null)return fy(fy({},e),{},{scale:t})});var vx=R([U,Zs,Qs],(e,t,n)=>{switch(e){case`horizontal`:return t.some(e=>e.reversed)?`right-to-left`:`left-to-right`;case`vertical`:return n.some(e=>e.reversed)?`bottom-to-top`:`top-to-bottom`;case`centric`:case`radial`:return`left-to-right`;default:return}});R([(e,t,n)=>e.renderedTicks[t]?.[n]],e=>{if(!(!e||e.length===0))return t=>{var n=1/0,r=e[0];for(var i of e){var a=Math.abs(i.coordinate-t);ae.options.defaultTooltipEventType,bx=e=>e.options.validateTooltipEventTypes;function xx(e,t,n){if(e==null)return t;var r=e?`axis`:`item`;return n==null?t:n.includes(r)?r:t}function Sx(e,t){return xx(t,yx(e),bx(e))}function Cx(e){return L(t=>Sx(t,e))}var wx=(e,t)=>{var n,r=Number(t);if(!(Vt(r)||t==null))return r>=0?e==null||(n=e[r])==null?void 0:n.value:void 0},Tx=e=>e.tooltip.settings,Ex={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},Dx=Oo({name:`tooltip`,initialState:{itemInteraction:{click:Ex,hover:Ex},axisInteraction:{click:Ex,hover:Ex},keyboardInteraction:Ex,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:`hover`,axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(W(t.payload))},prepare:B()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=$a(e).tooltipItemPayloads.indexOf(W(n));i>-1&&(e.tooltipItemPayloads[i]=W(r))},prepare:B()},removeTooltipEntrySettings:{reducer(e,t){var n=$a(e).tooltipItemPayloads.indexOf(W(t.payload));n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:B()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:Ox,replaceTooltipEntrySettings:kx,removeTooltipEntrySettings:Ax,setTooltipSettingsState:jx,setActiveMouseOverItemIndex:Mx,mouseLeaveItem:Nx,mouseLeaveChart:Px,setActiveClickItemIndex:Fx,setMouseOverAxisIndex:Ix,setMouseClickAxisIndex:Lx,setSyncInteraction:Rx,setKeyboardInteraction:zx}=Dx.actions,Bx=Dx.reducer;function Vx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hx(e){for(var t=1;t{if(t==null)return Ex;var i=Kx(e,t,n);if(i==null)return Ex;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(qx(i)){if(a)return Hx(Hx({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Hx(Hx({},Ex),{},{coordinate:i.coordinate})};function Yx(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function Xx(e,t){var n=Yx(e),r=t[0],i=t[1];return n!==void 0&&n>=Math.min(r,i)&&n<=Math.max(r,i)}function Zx(e,t,n){if(n==null||t==null)return!0;var r=H(e,t);return r==null||!Mp(n)||Xx(r,n)}var Qx=(e,t,n,r)=>{var i=e?.index;if(i==null)return null;var a=Number(i);if(!V(a))return i;var o=0,s=1/0;t.length>0&&(s=t.length-1);var c=Math.max(o,Math.min(a,s)),l=t[c];return l==null||Zx(l,n,r)?String(c):null},$x=(e,t,n,r,i,a,o)=>{if(a!=null){var s=o[0]?.getPosition(a);if(s!=null)return s;var c=i?.[Number(a)];if(c)switch(n){case`horizontal`:return{x:c.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:c.coordinate}}}},eS=(e,t,n,r)=>{if(t===`axis`)return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i=n===`hover`?e.itemInteraction.hover.graphicalItemId:e.itemInteraction.click.graphicalItemId;if(e.syncInteraction.active&&i==null)return e.tooltipItemPayloads;if(i==null&&r!=null){var a=e.tooltipItemPayloads[0];return a==null?[]:[a]}return e.tooltipItemPayloads.filter(e=>e.settings?.graphicalItemId===i)},tS=e=>e.options.tooltipPayloadSearcher,nS=e=>e.tooltip;function rS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function iS(e){for(var t=1;te(t)}function dS(e){if(typeof e==`string`)return e}function fS(e){if(!(typeof e!=`object`||!e))return{name:`name`in e?cS(e.name):void 0,unit:`unit`in e?lS(e.unit):void 0,dataKey:`dataKey`in e?uS(e.dataKey):void 0,payload:`payload`in e?e.payload:void 0,color:`color`in e?dS(e.color):void 0,fill:`fill`in e?dS(e.fill):void 0}}function pS(e,t){return e??t}var mS=(e,t,n,r,i,a,o)=>{if(t!=null&&a!=null){var{chartData:s,computedData:c,dataStartIndex:l,dataEndIndex:u}=n;return e.reduce((e,n)=>{var{dataDefinedOnItem:d,settings:f}=n,p=pS(d,s),m=Array.isArray(p)?Ss(p,l,u):p,h=f?.dataKey??r,g=f?.nameKey,_=r&&Array.isArray(m)&&!Array.isArray(m[0])&&o===`axis`?Yt(m,r,i):a(m,t,c,g);return Array.isArray(_)?_.forEach(t=>{var n=fS(t),r=n?.name,i=n?.dataKey,a=n?.payload,o=iS(iS({},f),{},{name:r,unit:n?.unit,color:n?.color??f?.color,fill:n?.fill??f?.fill});e.push(Us({tooltipEntrySettings:o,dataKey:i,payload:a,value:H(a,i),name:r==null?void 0:String(r)}))}):e.push(Us({tooltipEntrySettings:f,dataKey:h,payload:_,value:H(_,h),name:H(_,g)??f?.name})),e},[])}},hS=R([Q,Oy,Jp],sy),gS=R([R([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),Q,R([J,Dm],ky)],My,{memoizeOptions:{resultEqualityCheck:Tm}}),_S=R([gS],e=>e.filter(Cm)),vS=R([R([gS],Ly,{memoizeOptions:{resultEqualityCheck:Tm}}),Op],zy),yS=R([_S,Op,Q],Sm),bS=R([vS,Q,gS],Vy),xS=R([Q],nb),SS=R([xS,R([Q],e=>e.allowDataOverflow)],Pp),CS=R([R([yS,R([gS],e=>e.filter(Cm)),Kp,qp],Qy),Op,J,SS],eb),wS=R([vS,Q,R([gS],Fy),ob,J],lb,{memoizeOptions:{resultEqualityCheck:wm}}),TS=R([R([pb,J,Dm],mb),J],bb),ES=R([R([gb,J,Dm],mb),J],Sb),DS=R([Q,U,vS,bS,Kp,J,R([Q,xS,SS,CS,wS,R([TS,R([R([vb,J,Dm],mb),J],Eb),ES],cb),U,J],Ob)],jb),OS=R([Q,DS,R([DS,Q,hS],Pb),J],Ib),kS=e=>Gb(e,J(e),Dm(e),!1),AS=R([Q,kS],nm),jS=R([R([Q,hS,OS,AS],iy)],Om),MS=R([U,Q,hS,jS,kS,R([U,bS,Q,J],fx),R([U,bS,Q,J],Jb),J],(e,t,n,r,i,a,o,s)=>{if(t){var{type:c}=t,l=As(e,s);if(r){var u=n===`scaleBand`&&r.bandwidth?r.bandwidth()/2:2,d=c===`category`&&r.bandwidth?r.bandwidth()/u:0;return d=s===`angleAxis`&&i!=null&&i?.length>=2?Bt(i[0]-i[1])*2*d:d,l&&o?o.map((e,t)=>{var n=r.map(e);return V(n)?{coordinate:n+d,value:e,index:t,offset:d}:null}).filter(Zt):r.domain().map((e,t)=>{var n=r.map(e);return V(n)?{coordinate:n+d,value:a?a[e]:e,index:t,offset:d}:null}).filter(Zt)}}}),NS=R([yx,bx,Tx],(e,t,n)=>xx(n.shared,e,t)),PS=e=>e.tooltip.settings.trigger,FS=e=>e.tooltip.settings.defaultIndex,IS=R([nS,NS,PS,FS],Jx),LS=R([IS,vS,Xy,DS],Qx),RS=R([MS,LS],wx),zS=R([IS],e=>{if(e)return e.dataKey}),BS=R([IS],e=>{if(e)return e.graphicalItemId}),VS=R([nS,NS,PS,FS],eS),HS=R([IS,R([qs,Js,U,uc,MS,FS,VS],$x)],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),US=R([IS],e=>e?.active??!1),WS=R([R([VS,LS,Op,Xy,RS,tS,NS],mS)],e=>{if(e!=null){var t=e.map(e=>e.payload).filter(e=>e!=null);return Array.from(new Set(t))}});function GS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function KS(e){for(var t=1;tL(Q),ZS=()=>{var e=XS(),t=L(MS),n=L(jS);return Hs(!e||!n?void 0:KS(KS({},e),{},{scale:n}),t)};function QS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $S(e){for(var t=1;t{var i=t.find(e=>e&&e.index===n);if(i){if(e===`horizontal`)return{x:i.coordinate,y:r.relativeY};if(e===`vertical`)return{x:r.relativeX,y:i.coordinate}}return{x:0,y:0}},iC=(e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if(e===`centric`){var a=i.coordinate,{radius:o}=r;return $S($S($S({},r),tp(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,{angle:c}=r;return $S($S($S({},r),tp(r.cx,r.cy,s,c)),{},{angle:c,radius:s})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function aC(e,t){var{relativeX:n,relativeY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var oC=(e,t,n,r,i)=>{var a=t?.length??0;if(a<=1||e==null)return 0;if(r===`angleAxis`&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var o=0;o0?n[o-1]?.coordinate:n[a-1]?.coordinate,c=n[o]?.coordinate,l=o>=a-1?n[0]?.coordinate:n[o+1]?.coordinate,u=void 0;if(s!=null&&c!=null&&l!=null){if(Bt(c-s)!==Bt(l-c)){var d=[];if(Bt(l-c)===Bt(i[1]-i[0])){u=l;var f=c+i[1]-i[0];d[0]=Math.min(f,(f+s)/2),d[1]=Math.max(f,(f+s)/2)}else{u=s;var p=l+i[1]-i[0];d[0]=Math.min(c,(p+c)/2),d[1]=Math.max(c,(p+c)/2)}var m=[Math.min(c,(u+c)/2),Math.max(c,(u+c)/2)];if(e>m[0]&&e<=m[1]||e>=d[0]&&e<=d[1])return n[o]?.index}else{var h=Math.min(s,l),g=Math.max(s,l);if(e>(h+c)/2&&e<=(g+c)/2)return n[o]?.index}}}else if(t)for(var _=0;_(v.coordinate+b.coordinate)/2||_>0&&_(v.coordinate+b.coordinate)/2&&e<=(v.coordinate+y.coordinate)/2)return v.index}}return-1},sC=()=>L(Jp),cC=(e,t)=>t,lC=(e,t,n)=>n,uC=(e,t,n,r)=>r,dC=R(MS,e=>_i(e,e=>e.coordinate)),fC=R([nS,cC,lC,uC],Jx),pC=R([fC,vS,Xy,DS],Qx),mC=(e,t,n)=>{if(t!=null){var r=nS(e);return t===`axis`?n===`hover`?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n===`hover`?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},hC=R([nS,cC,lC,uC],eS),gC=R([qs,Js,U,uc,MS,uC,hC],$x),_C=R([fC,gC],(e,t)=>e.coordinate??t),vC=R([MS,pC],wx),yC=R([hC,pC,Op,Xy,vC,tS,cC],mS),bC=R([fC,pC],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),xC=(e,t,n,r,i,a,o)=>{if(!(!e||!n||!r||!i)&&aC(e,o)){var s=oC(Gs(e,t),a,i,n,r),c=rC(t,i,s,e);return{activeIndex:String(s),activeCoordinate:c}}},SC=(e,t,n,r,i,a,o)=>{if(!(!e||!r||!i||!a||!n)){var s=sp(e,n);if(s){var c=oC(Ks(s,t),o,a,r,i),l=iC(t,a,c,s);return{activeIndex:String(c),activeCoordinate:l}}}},CC=(e,t,n,r,i,a,o,s)=>{if(!(!e||!t||!r||!i||!a))return t===`horizontal`||t===`vertical`?xC(e,t,r,i,a,o,s):SC(e,t,n,r,i,a,o)},wC=R(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),TC=R(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values($p));return Array.from(new Set(t)).sort((e,t)=>e-t)},{memoizeOptions:{resultEqualityCheck:Em}});function EC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function DC(e){for(var t=1;tDC(DC({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},MC=new Set(Object.values($p));function NC(e){return MC.has(e)}var PC=Oo({name:`zIndex`,initialState:jC,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:B()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(--e.zIndexMap[n].consumers,e.zIndexMap[n].consumers<=0&&!NC(n)&&delete e.zIndexMap[n])},prepare:B()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=W(r):e.zIndexMap[n].element=W(r):e.zIndexMap[n]={consumers:0,element:i?void 0:W(r),panoramaElement:i?W(r):void 0}},prepare:B()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:B()}}}),{registerZIndexPortal:FC,unregisterZIndexPortal:IC,registerZIndexPortalElement:LC,unregisterZIndexPortalElement:RC}=PC.actions,zC=PC.reducer;function BC(e){var{zIndex:t,children:n}=e,r=Zc()&&t!==void 0&&t!==0,i=mc(),a=I();(0,h.useLayoutEffect)(()=>r?(a(FC({zIndex:t})),()=>{a(IC({zIndex:t}))}):Qt,[a,t,r]);var o=L(e=>wC(e,t,i));return r?o?(0,g.createPortal)(n,o):null:n}function VC(){return VC=Object.assign?Object.assign.bind():function(e){for(var t=1;t(0,h.useContext)(XC),QC=o(t(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!Vt(n))return e[n]}},rw=Oo({name:`options`,initialState:{chartName:``,tooltipPayloadSearcher:()=>void 0,eventEmitter:void 0,defaultTooltipEventType:`axis`},reducers:{createEventEmitter:e=>{e.eventEmitter??=Symbol(`rechartsEventEmitter`)}}}),iw=rw.reducer,{createEventEmitter:aw}=rw.actions;function ow(e){return e.tooltip.syncInteraction}var sw=Oo({name:`chartData`,initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=W(t.payload),t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;n!=null&&(e.dataStartIndex=n),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:cw,setDataStartEndIndexes:lw,setComputedData:uw}=sw.actions,dw=sw.reducer,fw=[`x`,`y`];function pw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mw(e){for(var t=1;te.rootProps.className);(0,h.useEffect)(()=>{if(e==null)return Qt;var s=(s,c,l)=>{if(t!==l&&e===s){if(r===`index`){var u;if(o&&c!=null&&(u=c.payload)!=null&&u.coordinate&&c.payload.sourceViewBox){var d=c.payload.coordinate,{x:f,y:p}=d,m=vw(d,fw),{x:h,y:g,width:_,height:v}=c.payload.sourceViewBox,y=mw(mw({},m),{},{x:o.x+(_?(f-h)/_:0)*o.width,y:o.y+(v?(p-g)/v:0)*o.height});n(mw(mw({},c),{},{payload:mw(mw({},c.payload),{},{coordinate:y})}))}else n(c);return}if(i!=null){var b;typeof r==`function`?b=i[r(i,{activeTooltipIndex:c.payload.index==null?void 0:Number(c.payload.index),isTooltipActive:c.payload.active,activeIndex:c.payload.index==null?void 0:Number(c.payload.index),activeLabel:c.payload.label,activeDataKey:c.payload.dataKey,activeCoordinate:c.payload.coordinate})]:r===`value`&&(b=i.find(e=>String(e.value)===c.payload.label));var{coordinate:x}=c.payload;if(b==null||c.payload.active===!1||x==null||o==null){n(Rx({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:S,y:C}=x,w=Math.min(S,o.x+o.width),T=Math.min(C,o.y+o.height),E={x:a===`horizontal`?b.coordinate:w,y:a===`horizontal`?T:b.coordinate};n(Rx({active:c.payload.active,coordinate:E,dataKey:c.payload.dataKey,index:String(b.index),label:c.payload.label,sourceViewBox:c.payload.sourceViewBox,graphicalItemId:c.payload.graphicalItemId}))}}};return $C.on(ew,s),()=>{$C.off(ew,s)}},[s,n,t,e,r,i,a,o])}function xw(){var e=L(Yp),t=L(Zp),n=I();(0,h.useEffect)(()=>{if(e==null)return Qt;var r=(r,i,a)=>{t!==a&&e===r&&n(lw(i))};return $C.on(tw,r),()=>{$C.off(tw,r)}},[n,t,e])}function Sw(){var e=I();(0,h.useEffect)(()=>{e(aw())},[e]),bw(),xw()}function Cw(e,t,n,r,i,a){var o=L(n=>mC(n,e,t)),s=L(BS),c=L(Zp),l=L(Yp),u=L(Xp),d=L(ow)?.active,f=Hc();(0,h.useEffect)(()=>{if(!d&&l!=null&&c!=null){var e=Rx({active:a,coordinate:n,dataKey:o,index:i,label:typeof r==`number`?String(r):r,sourceViewBox:f,graphicalItemId:s});$C.emit(ew,l,e,c)}},[d,n,o,s,i,r,c,l,u,a,f])}function ww(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Tw(e){for(var t=1;t{C(jx({shared:v,trigger:y,axisId:S,active:n,defaultIndex:w}))},[C,v,y,S,n,w]);var T=Hc(),E=ud(),D=Cx(v),{activeIndex:O,isActive:k}=L(e=>bC(e,D,y,w))??{},ee=L(e=>yC(e,D,y,w)),te=L(e=>vC(e,D,y,w)),A=L(e=>_C(e,D,y,w)),j=ee,ne=ZC(),re=n??k??!1,[ie,ae]=Ci([j,re]),M=D===`axis`?te:void 0;Cw(D,y,A,M,O,re);var oe=x??ne;if(oe==null||T==null||D==null)return null;var se=j??jw;re||(se=jw),s&&se.length&&(se=Hr(se.filter(e=>e.value!=null&&(e.hide!==!0||t.includeHidden)),u,kw));var ce=se.length>0,le=Tw(Tw({},t),{},{payload:se,label:M,active:re,activeIndex:O,coordinate:A,accessibilityLayer:E}),ue=h.createElement(ld,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:c,active:re,coordinate:A,hasPayload:ce,offset:l,position:d,reverseDirection:f,useTranslate3d:p,viewBox:T,wrapperStyle:m,lastBoundingBox:ie,innerRef:ae,hasPortalFromProps:!!x},Aw(o,le));return h.createElement(h.Fragment,null,(0,g.createPortal)(ue,oe),re&&h.createElement(YC,{cursor:_,tooltipEventType:D,coordinate:A,payload:se,index:O}))}function Pw(e,t,n){return(t=Fw(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fw(e){var t=Iw(e,`string`);return typeof t==`symbol`?t:t+``}function Iw(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Lw=class{constructor(e){Pw(this,`cache`,new Map),this.maxSize=e}get(e){var t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}};function Rw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zw(e){for(var t=1;t{try{var n=document.getElementById(Kw);n||(n=document.createElement(`span`),n.setAttribute(`id`,Kw),n.setAttribute(`aria-hidden`,`true`),document.body.appendChild(n)),Object.assign(n.style,Gw,t),n.textContent=`${e}`;var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},Yw=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||ed.isSsr)return{width:0,height:0};if(!Uw.enableCache)return Jw(e,t);var n=qw(e,t),r=Ww.get(n);if(r)return r;var i=Jw(e,t);return Ww.set(n,i),i},Xw;function Zw(e,t,n){return(t=Qw(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qw(e){var t=$w(e,`string`);return typeof t==`symbol`?t:t+``}function $w(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var eT=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,tT=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,nT=/^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/,rT=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,iT={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},aT=[`cm`,`mm`,`pt`,`pc`,`in`,`Q`,`px`];function oT(e){return aT.includes(e)}var sT=`NaN`;function cT(e,t){return e*iT[t]}var lT=class e{static parse(t){var[,n,r]=rT.exec(t)??[];return n==null?e.NaN:new e(parseFloat(n),r??``)}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,Vt(e)&&(this.unit=``),t!==``&&!nT.test(t)&&(this.num=NaN,this.unit=``),oT(t)&&(this.num=cT(e,t),this.unit=`px`)}add(t){return this.unit===t.unit?new e(this.num+t.num,this.unit):new e(NaN,``)}subtract(t){return this.unit===t.unit?new e(this.num-t.num,this.unit):new e(NaN,``)}multiply(t){return this.unit!==``&&t.unit!==``&&this.unit!==t.unit?new e(NaN,``):new e(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==``&&t.unit!==``&&this.unit!==t.unit?new e(NaN,``):new e(this.num/t.num,this.unit||t.unit)}toString(){return`${this.num}${this.unit}`}isNaN(){return Vt(this.num)}};Xw=lT,Zw(lT,`NaN`,new Xw(NaN,``));function uT(e){if(e==null||e.includes(sT))return sT;for(var t=e;t.includes(`*`)||t.includes(`/`);){var[,n,r,i]=eT.exec(t)??[],a=lT.parse(n??``),o=lT.parse(i??``),s=r===`*`?a.multiply(o):a.divide(o);if(s.isNaN())return sT;t=t.replace(eT,s.toString())}for(;t.includes(`+`)||/.-\d+(?:\.\d+)?/.test(t);){var[,c,l,u]=tT.exec(t)??[],d=lT.parse(c??``),f=lT.parse(u??``),p=l===`+`?d.add(f):d.subtract(f);if(p.isNaN())return sT;t=t.replace(tT,p.toString())}return t}var dT=/\(([^()]*)\)/;function fT(e){for(var t=e,n;(n=dT.exec(t))!=null;){var[,r]=n;t=t.replace(dT,uT(r))}return t}function pT(e){var t=e.replace(/\s+/g,``);return t=fT(t),t=uT(t),t}function mT(e){try{return pT(e)}catch{return sT}}function hT(e){var t=mT(e.slice(5,-1));return t===sT?``:t}var gT=[`x`,`y`,`lineHeight`,`capHeight`,`fill`,`scaleToFit`,`textAnchor`,`verticalAnchor`],_T=[`dx`,`dy`,`angle`,`className`,`breakAll`];function vT(){return vT=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var i=[];return F(t)||(i=n?t.toString().split(``):t.toString().split(xT)),{wordsWithComputedWidth:i.map(e=>({word:e,width:Yw(e,r).width})),spaceWidth:n?0:Yw(`\xA0`,r).width}}catch{return null}};function CT(e){return e===`start`||e===`middle`||e===`end`||e===`inherit`}function wT(e){return F(e)||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}var TT=(e,t,n,r)=>e.reduce((e,i)=>{var{word:a,width:o}=i,s=e[e.length-1];if(s&&o!=null&&(t==null||r||s.width+o+ne.reduce((e,t)=>e.width>t.width?e:t),DT=`…`,OT=(e,t,n,r,i,a,o,s)=>{var c=ST({breakAll:n,style:r,children:e.slice(0,t)+DT});if(!c)return[!1,[]];var l=TT(c.wordsWithComputedWidth,a,o,s);return[l.length>i||ET(l).width>Number(a),l]},kT=(e,t,n,r,i)=>{var{maxLines:a,children:o,style:s,breakAll:c}=e,l=P(a),u=String(o),d=TT(t,r,n,i);if(!l||i||!(d.length>a||ET(d).width>Number(r)))return d;for(var f=0,p=u.length-1,m=0,h;f<=p&&m<=u.length-1;){var g=Math.floor((f+p)/2),[_,v]=OT(u,g-1,c,s,a,r,n,i),[y]=OT(u,g,c,s,a,r,n,i);if(!_&&!y&&(f=g+1),_&&y&&(p=g-1),!_&&y){h=v;break}m++}return h||d},AT=e=>[{words:F(e)?[]:e.toString().split(xT),width:void 0}],jT=e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!ed.isSsr){var s,c,l=ST({breakAll:a,children:r,style:i});if(l){var{wordsWithComputedWidth:u,spaceWidth:d}=l;s=u,c=d}else return AT(r);return kT({breakAll:a,children:r,maxLines:o,style:i},s,c,t,!!n)}return AT(r)},MT=`#808080`,NT={angle:0,breakAll:!1,capHeight:`0.71em`,fill:MT,lineHeight:`1em`,scaleToFit:!1,textAnchor:`start`,verticalAnchor:`end`,x:0,y:0},PT=(0,h.forwardRef)((e,t)=>{var n=wn(e,NT),{x:r,y:i,lineHeight:a,capHeight:o,fill:s,scaleToFit:l,textAnchor:u,verticalAnchor:d}=n,f=yT(n,gT),p=(0,h.useMemo)(()=>jT({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:l,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,l,f.style,f.width]),{dx:m,dy:g,angle:_,className:v,breakAll:y}=f,b=yT(f,_T);if(!Ut(r)||!Ut(i)||p.length===0)return null;var x=Number(r)+(P(m)?m:0),S=Number(i)+(P(g)?g:0);if(!V(x)||!V(S))return null;var C;switch(d){case`start`:C=hT(`calc(${o})`);break;case`middle`:C=hT(`calc(${(p.length-1)/2} * -${a} + (${o} / 2))`);break;default:C=hT(`calc(${p.length-1} * -${a})`)}var T=[],E=p[0];if(l&&E!=null){var D=E.width,{width:O}=f;T.push(`scale(${P(O)&&P(D)?O/D:1})`)}return _&&T.push(`rotate(${_}, ${x}, ${S})`),T.length&&(b.transform=T.join(` `)),h.createElement(`text`,vT({},w(b),{ref:t,x,y:S,className:c(`recharts-text`,v),textAnchor:u,fill:s.includes(`url`)?MT:s}),p.map((e,t)=>{var n=e.words.join(y?``:` `);return h.createElement(`tspan`,{x,dy:t===0?C:a,key:`${n}-${t}`},n)}))});PT.displayName=`Text`;function FT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function IT(e){for(var t=1;t{var{viewBox:t,position:n,offset:r=0,parentViewBox:i,clamp:a}=e,{x:o,y:s,height:c,upperWidth:l,lowerWidth:u}=Vc(t),d=o,f=o+(l-u)/2,p=(d+f)/2,m=(l+u)/2,h=d+l/2,g=c>=0?1:-1,_=g*r,v=g>0?`end`:`start`,y=g>0?`start`:`end`,b=l>=0?1:-1,x=b*r,S=b>0?`end`:`start`,C=b>0?`start`:`end`,w=i;if(n===`top`){var T={x:d+l/2,y:s-_,horizontalAnchor:`middle`,verticalAnchor:v};return a&&w&&(T.height=Math.max(s-w.y,0),T.width=l),T}if(n===`bottom`){var E={x:f+u/2,y:s+c+_,horizontalAnchor:`middle`,verticalAnchor:y};return a&&w&&(E.height=Math.max(w.y+w.height-(s+c),0),E.width=u),E}if(n===`left`){var D={x:p-x,y:s+c/2,horizontalAnchor:S,verticalAnchor:`middle`};return a&&w&&(D.width=Math.max(D.x-w.x,0),D.height=c),D}if(n===`right`){var O={x:p+m+x,y:s+c/2,horizontalAnchor:C,verticalAnchor:`middle`};return a&&w&&(O.width=Math.max(w.x+w.width-O.x,0),O.height=c),O}var k=a&&w?{width:m,height:c}:{};return n===`insideLeft`?IT({x:p+x,y:s+c/2,horizontalAnchor:C,verticalAnchor:`middle`},k):n===`insideRight`?IT({x:p+m-x,y:s+c/2,horizontalAnchor:S,verticalAnchor:`middle`},k):n===`insideTop`?IT({x:d+l/2,y:s+_,horizontalAnchor:`middle`,verticalAnchor:y},k):n===`insideBottom`?IT({x:f+u/2,y:s+c-_,horizontalAnchor:`middle`,verticalAnchor:v},k):n===`insideTopLeft`?IT({x:d+x,y:s+_,horizontalAnchor:C,verticalAnchor:y},k):n===`insideTopRight`?IT({x:d+l-x,y:s+_,horizontalAnchor:S,verticalAnchor:y},k):n===`insideBottomLeft`?IT({x:f+x,y:s+c-_,horizontalAnchor:C,verticalAnchor:v},k):n===`insideBottomRight`?IT({x:f+u-x,y:s+c-_,horizontalAnchor:S,verticalAnchor:v},k):n&&typeof n==`object`&&(P(n.x)||Ht(n.x))&&(P(n.y)||Ht(n.y))?IT({x:o+Kt(n.x,m),y:s+Kt(n.y,c),horizontalAnchor:`end`,verticalAnchor:`end`},k):IT({x:h,y:s+c/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},k)},VT=[`labelRef`],HT=[`content`];function UT(e,t){if(e==null)return{};var n,r,i=WT(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var{x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o,children:s}=e,c=(0,h.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return h.createElement(ZT.Provider,{value:c},s)},$T=()=>{var e=(0,h.useContext)(ZT),t=Hc();return e||(t?Vc(t):void 0)},eE=(0,h.createContext)(null),tE=()=>{var e=(0,h.useContext)(eE),t=L(ym);return e||t},nE=e=>{var{value:t,formatter:n}=e,r=F(e.children)?t:e.children;return typeof n==`function`?n(r):r},rE=e=>e!=null&&typeof e==`function`,iE=(e,t)=>Bt(t-e)*Math.min(Math.abs(t-e),360),aE=(e,t,n,r,i)=>{var{offset:a,className:o}=e,{cx:s,cy:l,innerRadius:u,outerRadius:d,startAngle:f,endAngle:p,clockWise:m}=i,g=(u+d)/2,_=iE(f,p),v=_>=0?1:-1,y,b;switch(t){case`insideStart`:y=f+v*a,b=m;break;case`insideEnd`:y=p-v*a,b=!m;break;case`end`:y=p+v*a,b=m;break;default:throw Error(`Unsupported position ${t}`)}b=_<=0?b:!b;var x=tp(s,l,g,y),S=tp(s,l,g,y+(b?1:-1)*359),C=`M${x.x},${x.y} A${g},${g},0,1,${+!b}, - ${S.x},${S.y}`,w=F(e.id)?Gt(`recharts-radial-line-`):e.id;return h.createElement(`text`,XT({},r,{dominantBaseline:`central`,className:c(`recharts-radial-bar-label`,o)}),h.createElement(`defs`,null,h.createElement(`path`,{id:w,d:C})),h.createElement(`textPath`,{xlinkHref:`#${w}`},n))},oE=(e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:s,endAngle:c}=e,l=(s+c)/2;if(n===`outside`){var{x:u,y:d}=tp(r,i,o+t,l);return{x:u,y:d,textAnchor:u>=r?`start`:`end`,verticalAnchor:`middle`}}if(n===`center`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`middle`};if(n===`centerTop`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`start`};if(n===`centerBottom`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`end`};var{x:f,y:p}=tp(r,i,(a+o)/2,l);return{x:f,y:p,textAnchor:`middle`,verticalAnchor:`middle`}},sE=e=>e!=null&&`cx`in e&&P(e.cx),cE={angle:0,offset:5,zIndex:$p.label,position:`middle`,textBreakAll:!1};function lE(e){if(!sE(e))return e;var{cx:t,cy:n,outerRadius:r}=e,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function uE(e){var t=wn(e,cE),{viewBox:n,parentViewBox:r,position:i,value:a,children:o,content:s,className:l=``,textBreakAll:u,labelRef:d}=t,f=tE(),p=$T(),m=n==null?i===`center`?p:f??p:sE(n)?n:Vc(n),g,_,v=lE(m);if(!m||F(a)&&F(o)&&!(0,h.isValidElement)(s)&&typeof s!=`function`)return null;var y=KT(KT({},t),{},{viewBox:m});if((0,h.isValidElement)(s)){var{labelRef:b}=y,x=UT(y,VT);return(0,h.cloneElement)(s,x)}if(typeof s==`function`){var{content:S}=y,C=UT(y,HT);if(g=(0,h.createElement)(s,C),(0,h.isValidElement)(g))return g}else g=nE(t);var T=w(t);if(sE(m)){if(i===`insideStart`||i===`insideEnd`||i===`end`)return aE(t,i,g,T,m);_=oE(m,t.offset,t.position)}else{if(!v)return null;var E=BT({viewBox:v,position:i,offset:t.offset,parentViewBox:sE(r)?void 0:r,clamp:!0});_=KT(KT({x:E.x,y:E.y,textAnchor:E.horizontalAnchor,verticalAnchor:E.verticalAnchor},E.width===void 0?{}:{width:E.width}),E.height===void 0?{}:{height:E.height})}return h.createElement(BC,{zIndex:t.zIndex},h.createElement(PT,XT({ref:d,className:c(`recharts-label`,l)},T,_,{textAnchor:CT(T.textAnchor)?T.textAnchor:_.textAnchor,breakAll:u}),g))}uE.displayName=`Label`;var dE=(e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return e===!0?h.createElement(uE,XT({key:`label-implicit`},r)):Ut(e)?h.createElement(uE,XT({key:`label-implicit`,value:e},r)):(0,h.isValidElement)(e)?e.type===uE?(0,h.cloneElement)(e,KT({key:`label-implicit`},r)):h.createElement(uE,XT({key:`label-implicit`,content:e},r)):rE(e)?h.createElement(uE,XT({key:`label-implicit`,content:e},r)):e&&typeof e==`object`?h.createElement(uE,XT({},e,{key:`label-implicit`},r)):null};function fE(e){var{label:t,labelRef:n}=e;return dE(t,$T(),n)||null}var pE=[`valueAccessor`],mE=[`dataKey`,`clockWise`,`id`,`textBreakAll`,`zIndex`];function hE(){return hE=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(wT(t))return t},yE=(0,h.createContext)(void 0),bE=yE.Provider,xE=(0,h.createContext)(void 0);xE.Provider;function SE(){return(0,h.useContext)(yE)}function CE(){return(0,h.useContext)(xE)}function wE(e){var{valueAccessor:t=vE}=e,n=gE(e,pE),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:s}=n,c=gE(n,mE),l=SE(),u=CE(),d=l||u;return!d||!d.length?null:h.createElement(BC,{zIndex:s??$p.label},h.createElement(re,{className:`recharts-label-list`},d.map((e,i)=>{var s=F(r)?t(e,i):H(e.payload,r),l=F(a)?{}:{id:`${a}-${i}`};return h.createElement(uE,hE({key:`label-${i}`},w(e),c,l,{fill:n.fill??e.fill,parentViewBox:e.parentViewBox,value:s,textBreakAll:o,viewBox:e.viewBox,index:i,zIndex:0}))})))}wE.displayName=`LabelList`;function TE(e){var{label:t}=e;return t?t===!0?h.createElement(wE,{key:`labelList-implicit`}):h.isValidElement(t)||rE(t)?h.createElement(wE,{key:`labelList-implicit`,content:t}):typeof t==`object`?h.createElement(wE,hE({key:`labelList-implicit`},t,{type:String(t.type)})):null:null}function EE(){return EE=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r,className:i}=e,a=c(`recharts-dot`,i);return P(t)&&P(n)&&P(r)?h.createElement(`circle`,EE({},S(e),gn(e),{className:a,cx:t,cy:n,r})):null},OE=Oo({name:`polarAxis`,initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=W(t.payload)},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=W(t.payload)},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:kE,removeRadiusAxis:AE,addAngleAxis:jE,removeAngleAxis:ME}=OE.actions,NE=OE.reducer,PE=n((e=>{if(typeof Symbol==`function`&&Symbol.for){var t=Symbol.for;t(`react.element`),t(`react.portal`),t(`react.fragment`),t(`react.strict_mode`),t(`react.profiler`),t(`react.provider`),t(`react.context`),t(`react.forward_ref`),t(`react.suspense`),t(`react.suspense_list`),t(`react.memo`),t(`react.lazy`),t(`react.block`),t(`react.server.block`),t(`react.fundamental`),t(`react.debug_trace_mode`),t(`react.legacy_hidden`)}}));n(((e,t)=>{t.exports=PE()}))();var FE=e=>e&&typeof e==`object`&&`clipDot`in e?!!e.clipDot:!0;function IE(e){if(typeof e!=`object`||!e)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!==`[object Object]`){let t=e[Symbol.toStringTag];return t==null||!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable?!1:e.toString()===`[object ${t}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}var LE,RE,zE,BE,VE;function HE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function UE(e){for(var t=1;t{var a=n-r,o=N(LE||=JE([`M `,`,`,``]),e,t);return o+=N(RE||=JE([`L `,`,`,``]),e+n,t),o+=N(zE||=JE([`L `,`,`,``]),e+n-a/2,t+i),o+=N(BE||=JE([`L `,`,`,``]),e+n-a/2-r,t+i),o+=N(VE||=JE([`L `,`,`,` Z`]),e,t),o},XE={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},ZE=e=>{var t=wn(e,XE),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:s}=t,{animationEasing:l,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,p=(0,h.useRef)(null),[m,g]=(0,h.useState)(-1),_=(0,h.useRef)(i),v=(0,h.useRef)(a),y=(0,h.useRef)(o),b=(0,h.useRef)(n),x=(0,h.useRef)(r),S=Cf(e,`trapezoid-`);if((0,h.useEffect)(()=>{if(p.current&&p.current.getTotalLength)try{var e=p.current.getTotalLength();e&&g(e)}catch{}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||i===0&&a===0||o===0)return null;var C=c(`recharts-trapezoid`,s);if(!f)return h.createElement(`g`,null,h.createElement(`path`,qE({},w(t),{className:C,d:YE(n,r,i,a,o)})));var T=_.current,E=v.current,D=y.current,O=b.current,k=x.current,ee=`0px ${m===-1?1:m}px`,te=`${m}px ${m}px`,A=Wd([`strokeDasharray`],u,l);return h.createElement(Sf,{animationId:S,key:S,canBegin:m>0,duration:u,easing:l,isActive:f,begin:d},e=>{var s=Jt(T,i,e),c=Jt(E,a,e),l=Jt(D,o,e),u=Jt(O,n,e),d=Jt(k,r,e);p.current&&(_.current=s,v.current=c,y.current=l,b.current=u,x.current=d);var f=e>0?{transition:A,strokeDasharray:te}:{strokeDasharray:ee};return h.createElement(`path`,qE({},w(t),{className:C,d:YE(u,d,s,c,l),ref:p,style:UE(UE({},f),t.style)}))})},QE=[`option`,`shapeType`,`activeClassName`,`inActiveClassName`];function $E(e,t){if(e==null)return{};var n,r,i=eD(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{r||(i.current===null?n(Ox(t)):i.current!==t&&n(kx({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,h.useLayoutEffect)(()=>()=>{i.current&&=(n(Ax(i.current)),null)},[n]),null}function fD(e){var{legendPayload:t}=e,n=I(),r=mc(),i=(0,h.useRef)(null);return(0,h.useLayoutEffect)(()=>{r||(i.current===null?n(Zl(t)):i.current!==t&&n(Ql({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,h.useLayoutEffect)(()=>()=>{i.current&&=(n($l(i.current)),null)},[n]),null}var pD=h.useId??(()=>{var[e]=h.useState(()=>Gt(`uid-`));return e});function mD(e,t){var n=pD();return t||(e?`${e}-${n}`:n)}var hD=(0,h.createContext)(void 0),gD=e=>{var{id:t,type:n,children:r}=e,i=mD(`recharts-${n}`,t);return h.createElement(hD.Provider,{value:i},r(i))},_D=Oo({name:`graphicalItems`,initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(W(t.payload))},prepare:B()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=$a(e).cartesianItems.indexOf(W(n));i>-1&&(e.cartesianItems[i]=W(r))},prepare:B()},removeCartesianGraphicalItem:{reducer(e,t){var n=$a(e).cartesianItems.indexOf(W(t.payload));n>-1&&e.cartesianItems.splice(n,1)},prepare:B()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(W(t.payload))},prepare:B()},removePolarGraphicalItem:{reducer(e,t){var n=$a(e).polarItems.indexOf(W(t.payload));n>-1&&e.polarItems.splice(n,1)},prepare:B()},replacePolarGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=$a(e).polarItems.indexOf(W(n));i>-1&&(e.polarItems[i]=W(r))},prepare:B()}}}),{addCartesianGraphicalItem:vD,replaceCartesianGraphicalItem:yD,removeCartesianGraphicalItem:bD,addPolarGraphicalItem:xD,removePolarGraphicalItem:SD,replacePolarGraphicalItem:CD}=_D.actions,wD=_D.reducer,TD=(0,h.memo)(e=>{var t=I(),n=(0,h.useRef)(null);return(0,h.useLayoutEffect)(()=>{n.current===null?t(vD(e)):n.current!==e&&t(yD({prev:n.current,next:e})),n.current=e},[t,e]),(0,h.useLayoutEffect)(()=>()=>{n.current&&=(t(bD(n.current)),null)},[t]),null}),ED=[`points`];function DD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function OD(e){for(var t=1;t{var s=OD(OD(OD({r:3},o),d),{},{index:r,cx:e.x??void 0,cy:e.y??void 0,dataKey:a,value:e.value,payload:e.payload,points:t});return h.createElement(FD,{key:`dot-${r}`,option:n,dotProps:s,className:i})}),p={};return s&&c!=null&&(p.clipPath=`url(#clipPath-${u?``:`dots-`}${c})`),h.createElement(BC,{zIndex:l},h.createElement(re,MD({className:r},p),f))}function RD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zD(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),qs,Js],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),nO=()=>L(tO),rO=()=>L(WS);function iO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function aO(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:a,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var s=aO(aO(aO({},{index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??`none`,strokeWidth:2,stroke:`#fff`,payload:t.payload,value:t.value}),C(i)),gn(i)),c=(0,h.isValidElement)(i)?(0,h.cloneElement)(i,s):typeof i==`function`?i(s):h.createElement(DE,s);return h.createElement(re,{className:`recharts-active-dot`,clipPath:o},c)};function uO(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=$p.activeDot}=e,s=L(LS),c=rO();if(t==null||c==null)return null;var l=t.find(e=>c.includes(e.payload));return F(l)?null:h.createElement(BC,{zIndex:o},h.createElement(lO,{point:l,childIndex:Number(s),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}var dO=e=>{var{chartData:t}=e,n=I(),r=mc();return(0,h.useEffect)(()=>r?()=>{}:(n(cw(t)),()=>{n(cw(void 0))}),[t,n,r]),null},fO={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},pO=Oo({name:`brush`,initialState:fO,reducers:{setBrushSettings(e,t){return t.payload==null?fO:t.payload}}}),{setBrushSettings:mO}=pO.actions,hO=pO.reducer,gO=Oo({name:`referenceElements`,initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=$a(e).dots.findIndex(e=>e===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=$a(e).areas.findIndex(e=>e===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(W(t.payload))},removeLine:(e,t)=>{var n=$a(e).lines.findIndex(e=>e===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:_O,removeDot:vO,addArea:yO,removeArea:bO,addLine:xO,removeLine:SO}=gO.actions,CO=gO.reducer,wO=(0,h.createContext)(void 0),TO=e=>{var{children:t}=e,[n]=(0,h.useState)(`${Gt(`recharts`)}-clip`),r=nO();if(r==null)return null;var{x:i,y:a,width:o,height:s}=r;return h.createElement(wO.Provider,{value:n},h.createElement(`defs`,null,h.createElement(`clipPath`,{id:n},h.createElement(`rect`,{x:i,y:a,height:s,width:o}))),t)},EO=Oo({name:`renderedTicks`,initialState:{xAxis:{},yAxis:{}},reducers:{setRenderedTicks:(e,t)=>{var{axisType:n,axisId:r,ticks:i}=t.payload;e[n][r]=W(i)},removeRenderedTicks:(e,t)=>{var{axisType:n,axisId:r}=t.payload;delete e[n][r]}}}),{setRenderedTicks:DO,removeRenderedTicks:OO}=EO.actions,kO=EO.reducer,AO=Oo({name:`errorBars`,initialState:{},reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(e=>e.dataKey===r.dataKey&&e.direction===r.direction?i:e))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(e=>e.dataKey!==r.dataKey||e.direction!==r.direction))}}}),{addErrorBar:jO,replaceErrorBar:MO,removeErrorBar:NO}=AO.actions,PO=AO.reducer,FO=[`children`];function IO(e,t){if(e==null)return{};var n,r,i=LO(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function zO(e){var{children:t}=e,n=IO(e,FO);return h.createElement(RO.Provider,{value:n},t)}function BO(e,t){var n=L(t=>yy(t,e)),r=L(e=>Sy(e,t)),i=n?.allowDataOverflow??_y.allowDataOverflow,a=r?.allowDataOverflow??by.allowDataOverflow;return{needClip:i||a,needClipX:i,needClipY:a}}function VO(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=nO(),{needClipX:a,needClipY:o,needClip:s}=BO(t,n);if(!s||!i)return null;var{x:c,y:l,width:u,height:d}=i;return h.createElement(`clipPath`,{id:`clipPath-${r}`},h.createElement(`rect`,{x:a?c:c-u/2,y:o?l:l-d/2,width:a?u:u*2,height:o?d:d*2}))}var HO=(e,t,n,r)=>_x(e,`xAxis`,t,r),UO=(e,t,n,r)=>gx(e,`xAxis`,t,r),WO=(e,t,n,r)=>_x(e,`yAxis`,n,r),GO=(e,t,n,r)=>gx(e,`yAxis`,n,r),KO=R([U,HO,WO,UO,GO],(e,t,n,r,i)=>As(e,`xAxis`)?Hs(t,r,!1):Hs(n,i,!1)),qO=(e,t,n,r,i)=>i;function JO(e){return e.type===`line`}var YO=R([U,HO,WO,UO,GO,R([Ay,qO],(e,t)=>e.filter(JO).find(e=>e.id===t)),KO,Ap],(e,t,n,r,i,a,o,s)=>{var{chartData:c,dataStartIndex:l,dataEndIndex:u}=s;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var{dataKey:d,data:f}=a,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return Ck({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}});function XO(e){var t=C(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:a}=t,o=Number(i),s=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(s)||s<0)&&(s=r),{r:o,strokeWidth:s}}return{r:n,strokeWidth:r}}var ZO=[`id`],QO=[`type`,`layout`,`connectNulls`,`needClip`,`shape`],$O=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function ek(){return ek=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:Ws(n,t),payload:e}]},lk=h.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:c,tooltipType:l,id:u}=e,d={dataDefinedOnItem:n,getPosition:Qt,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Ws(o,t),hide:s,type:l,color:r,unit:c,graphicalItemId:u}};return h.createElement(dD,{tooltipEntrySettings:d})}),uk=(e,t)=>`${t}px ${e}px`;function dk(e,t){for(var n=e.length%2==0?e:[...e,0],r=[],i=0;i{var r=n.reduce((e,t)=>e+t,0);if(!r)return uk(t,e);for(var i=Math.floor(e/r),a=e%r,o=[],s=0,c=0;sa){o=[...n.slice(0,s),a-c];break}}var d=o.length%2==0?[0,t]:[t];return[...dk(n,i),...o,...d].map(e=>`${e}px`).join(`, `)};function pk(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:o}=r,{id:s}=r,c=S(ok(r,ZO));return h.createElement(LD,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function mk(e){var{showLabels:t,children:n,points:r}=e,i=(0,h.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return nk(nk({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return h.createElement(bE,{value:t?i:void 0},n)}function hk(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:a}=e,{type:o,layout:s,connectNulls:c,needClip:l,shape:u}=a,d=nk(nk({},w(ok(a,QO))),{},{fill:`none`,className:`recharts-line-curve`,clipPath:l?`url(#clipPath-${t})`:void 0,points:r,type:o,layout:s,connectNulls:c,strokeDasharray:i??a.strokeDasharray});return h.createElement(h.Fragment,null,r?.length>1&&h.createElement(uD,ek({shapeType:`curve`,option:u},d,{pathRef:n})),h.createElement(pk,{points:r,clipPathId:t,props:a}))}function gk(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function _k(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:s,isAnimationActive:c,animationBegin:l,animationDuration:u,animationEasing:d,animateNewValues:f,width:p,height:m,onAnimationEnd:g,onAnimationStart:_}=n,v=i.current,y=Cf(o,`recharts-line-`),b=(0,h.useRef)(y),[x,S]=(0,h.useState)(!1),C=!x,w=(0,h.useCallback)(()=>{typeof g==`function`&&g(),S(!1)},[g]),T=(0,h.useCallback)(()=>{typeof _==`function`&&_(),S(!0)},[_]),E=gk(r.current),D=(0,h.useRef)(0);b.current!==y&&(D.current=a.current,b.current=y);var O=D.current;return h.createElement(mk,{points:o,showLabels:C},n.children,h.createElement(Sf,{animationId:y,begin:l,duration:u,isActive:c,easing:d,onAnimationEnd:w,onAnimationStart:T,key:y},e=>{var l=Jt(O,E+O,e),u=Math.min(l,E),d=c?s?fk(u,E,`${s}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):uk(E,u):s==null?void 0:String(s);if(e>0&&E>0&&(i.current=o,a.current=Math.max(a.current,u)),v){var g=v.length/o.length,_=e===1?o:o.map((t,n)=>{var r=Math.floor(n*g);if(v[r]){var i=v[r];return nk(nk({},t),{},{x:Jt(i.x,t.x,e),y:Jt(i.y,t.y,e)})}return f?nk(nk({},t),{},{x:Jt(p*2,t.x,e),y:Jt(m/2,t.y,e)}):nk(nk({},t),{},{x:t.x,y:t.y})});return i.current=_,h.createElement(hk,{props:n,points:_,clipPathId:t,pathRef:r,strokeDasharray:d})}return h.createElement(hk,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:d})}),h.createElement(TE,{label:n.label}))}function vk(e){var{clipPathId:t,props:n}=e,r=(0,h.useRef)(null),i=(0,h.useRef)(0),a=(0,h.useRef)(null);return h.createElement(_k,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var yk=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:H(e.payload,t)}),bk=class extends h.Component{render(){var{hide:e,dot:t,points:n,className:r,xAxisId:i,yAxisId:a,top:o,left:s,width:l,height:u,id:d,needClip:f,zIndex:p}=this.props;if(e)return null;var m=c(`recharts-line`,r),g=d,{r:_,strokeWidth:v}=XO(t),y=FE(t),b=_*2+v,x=f?`url(#clipPath-${y?``:`dots-`}${g})`:void 0;return h.createElement(BC,{zIndex:p},h.createElement(re,{className:m},f&&h.createElement(`defs`,null,h.createElement(VO,{clipPathId:g,xAxisId:i,yAxisId:a}),!y&&h.createElement(`clipPath`,{id:`clipPath-dots-${g}`},h.createElement(`rect`,{x:s-b/2,y:o-b/2,width:l+b,height:u+b}))),h.createElement(zO,{xAxisId:i,yAxisId:a,data:n,dataPointFormatter:yk,errorBarOffset:0},h.createElement(vk,{props:this.props,clipPathId:g}))),h.createElement(uO,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:x}))}},xk={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:$p.line,type:`linear`};function Sk(e){var t=wn(e,xk),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:c,hide:l,isAnimationActive:u,label:d,legendType:f,xAxisId:p,yAxisId:m,id:g}=t,_=ok(t,$O),{needClip:v}=BO(p,m),y=nO(),b=Jc(),x=mc(),S=L(e=>YO(e,p,m,x,g));if(b!==`horizontal`&&b!==`vertical`||S==null||y==null)return null;var{height:C,width:w,x:T,y:E}=y;return h.createElement(bk,ek({},_,{id:g,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:S,layout:b,height:C,width:w,left:T,top:E,needClip:v}))}function Ck(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:s,displayedData:c}=e;return c.map((e,c)=>{var l=H(e,o);if(t===`horizontal`)return{x:Is({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(F(l)?null:r.scale.map(l))??null,value:l,payload:e};var u=F(l)?null:n.scale.map(l),d=Is({axis:r,ticks:a,bandSize:s,entry:e,index:c});return u==null||d==null?null:{x:u,y:d,value:l,payload:e}}).filter(Boolean)}function wk(e){var t=wn(e,xk),n=mc();return h.createElement(gD,{id:t.id,type:`line`},e=>h.createElement(h.Fragment,null,h.createElement(fD,{legendPayload:ck(t)}),h.createElement(lk,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),h.createElement(TD,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),h.createElement(Sk,ek({},t,{id:e}))))}var Tk=h.memo(wk,yu);Tk.displayName=`Line`;var Ek=R([(e,t)=>t,U,ym,J,AS,MS,dC,uc],CC);function Dk(e){return`getBBox`in e.currentTarget&&typeof e.currentTarget.getBBox==`function`}function Ok(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(Dk(e)){var i=e.currentTarget.getBBox();n=i.width>0?t.width/i.width:1,r=i.height>0?t.height/i.height:1}else{var a=e.currentTarget;n=a.offsetWidth>0?t.width/a.offsetWidth:1,r=a.offsetHeight>0?t.height/a.offsetHeight:1}var o=(e,i)=>({relativeX:Math.round((e-t.left)/n),relativeY:Math.round((i-t.top)/r)});return`touches`in e?Array.from(e.touches).map(e=>o(e.clientX,e.clientY)):o(e.clientX,e.clientY)}var kk=oo(`mouseClick`),Ak=ms();Ak.startListening({actionCreator:kk,effect:(e,t)=>{var n=e.payload,r=Ek(t.getState(),Ok(n));r?.activeIndex!=null&&t.dispatch(Lx({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var jk=oo(`mouseMove`),Mk=ms(),Nk=null,Pk=null,Fk=null;Mk.startListening({actionCreator:jk,effect:(e,t)=>{var n=e.payload,{throttleDelay:r,throttledEvents:i}=t.getState().eventSettings,a=i===`all`||i?.includes(`mousemove`);Nk!==null&&(cancelAnimationFrame(Nk),Nk=null),Pk!==null&&(typeof r!=`number`||!a)&&(clearTimeout(Pk),Pk=null),Fk=Ok(n);var o=()=>{var e=t.getState(),n=Sx(e,e.tooltip.settings.shared);if(!Fk){Nk=null,Pk=null;return}if(n===`axis`){var r=Ek(e,Fk);r?.activeIndex==null?t.dispatch(Px()):t.dispatch(Ix({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}Nk=null,Pk=null};if(!a){o();return}r===`raf`?Nk=requestAnimationFrame(o):typeof r==`number`&&Pk===null&&(Pk=setTimeout(o,r))}});function Ik(e,t){return t instanceof HTMLElement?`HTMLElement <${t.tagName} class="${t.className}">`:t===window?`global.window`:e===`children`&&typeof t==`object`&&t?`<>`:t}var Lk={accessibilityLayer:!0,barCategoryGap:`10%`,barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:`none`,syncId:void 0,syncMethod:`index`,baseValue:void 0,reverseStackOrder:!1},Rk=Oo({name:`rootProps`,initialState:Lk,reducers:{updateOptions:(e,t)=>{e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=t.payload.barGap??Lk.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),zk=Rk.reducer,{updateOptions:Bk}=Rk.actions,Vk=Oo({name:`polarOptions`,initialState:null,reducers:{updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)}}),{updatePolarOptions:Hk}=Vk.actions,Uk=Vk.reducer,Wk=oo(`keyDown`),Gk=oo(`focus`),Kk=oo(`blur`),qk=ms(),Jk=null,Yk=null,Xk=null;qk.startListening({actionCreator:Wk,effect:(e,t)=>{Xk=e.payload,Jk!==null&&(cancelAnimationFrame(Jk),Jk=null);var{throttleDelay:n,throttledEvents:r}=t.getState().eventSettings,i=r===`all`||r.includes(`keydown`);Yk!==null&&(typeof n!=`number`||!i)&&(clearTimeout(Yk),Yk=null);var a=()=>{try{var e=t.getState();if(e.rootProps.accessibilityLayer===!1)return;var{keyboardInteraction:n}=e.tooltip,r=Xk;if(r!==`ArrowRight`&&r!==`ArrowLeft`&&r!==`Enter`)return;var i=Qx(n,vS(e),Xy(e),DS(e)),a=i==null?-1:Number(i);if(!Number.isFinite(a)||a<0)return;var o=MS(e);if(r===`Enter`){var s=gC(e,`axis`,`hover`,String(n.index));t.dispatch(zx({active:!n.active,activeIndex:n.index,activeCoordinate:s}));return}var c=vx(e)===`left-to-right`?1:-1,l=a+(r===`ArrowRight`?1:-1)*c;if(o==null||l>=o.length||l<0)return;var u=gC(e,`axis`,`hover`,String(l));t.dispatch(zx({active:!0,activeIndex:l.toString(),activeCoordinate:u}))}finally{Jk=null,Yk=null}};if(!i){a();return}n===`raf`?Jk=requestAnimationFrame(a):typeof n==`number`&&Yk===null&&(a(),Xk=null,Yk=setTimeout(()=>{Xk?a():(Yk=null,Jk=null)},n))}}),qk.startListening({actionCreator:Gk,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var{keyboardInteraction:r}=n.tooltip;if(!r.active&&r.index==null){var i=`0`,a=gC(n,`axis`,`hover`,String(i));t.dispatch(zx({active:!0,activeIndex:i,activeCoordinate:a}))}}}}),qk.startListening({actionCreator:Kk,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var{keyboardInteraction:r}=n.tooltip;r.active&&t.dispatch(zx({active:!1,activeIndex:r.index,activeCoordinate:r.coordinate}))}}});function Zk(e){e.persist();var{currentTarget:t}=e;return new Proxy(e,{get:(e,n)=>{if(n===`currentTarget`)return t;var r=Reflect.get(e,n);return typeof r==`function`?r.bind(e):r}})}var Qk=oo(`externalEvent`),$k=ms(),eA=new Map,tA=new Map,nA=new Map;$k.startListening({actionCreator:Qk,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){var i=r.type,a=Zk(r);nA.set(i,{handler:n,reactEvent:a});var o=eA.get(i);o!==void 0&&(cancelAnimationFrame(o),eA.delete(i));var{throttleDelay:s,throttledEvents:c}=t.getState().eventSettings,l=c,u=l===`all`||l?.includes(i),d=tA.get(i);d!==void 0&&(typeof s!=`number`||!u)&&(clearTimeout(d),tA.delete(i));var f=()=>{var e=nA.get(i);try{if(!e)return;var{handler:n,reactEvent:r}=e,a=t.getState(),o={activeCoordinate:HS(a),activeDataKey:zS(a),activeIndex:LS(a),activeLabel:RS(a),activeTooltipIndex:LS(a),isTooltipActive:US(a)};n&&n(o,r)}finally{eA.delete(i),tA.delete(i),nA.delete(i)}};if(!u){f();return}if(s===`raf`){var p=requestAnimationFrame(f);eA.set(i,p)}else if(typeof s==`number`){if(!tA.has(i)){f();var m=setTimeout(f,s);tA.set(i,m)}}else f()}}});var rA=R([R([nS],e=>e.tooltipItemPayloads),(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(e=>e.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),iA=oo(`touchMove`),aA=ms(),oA=null,sA=null,cA=null,lA=null;aA.startListening({actionCreator:iA,effect:(e,t)=>{var n=e.payload;if(n.touches!=null&&n.touches.length!==0){lA=Zk(n);var{throttleDelay:r,throttledEvents:i}=t.getState().eventSettings,a=i===`all`||i.includes(`touchmove`);oA!==null&&(cancelAnimationFrame(oA),oA=null),sA!==null&&(typeof r!=`number`||!a)&&(clearTimeout(sA),sA=null),cA=Array.from(n.touches).map(e=>Ok({clientX:e.clientX,clientY:e.clientY,currentTarget:n.currentTarget}));var o=()=>{if(lA!=null){var e=t.getState(),n=Sx(e,e.tooltip.settings.shared);if(n===`axis`){var r=cA?.[0];if(r==null){oA=null,sA=null;return}var i=Ek(e,r);i?.activeIndex!=null&&t.dispatch(Ix({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}else if(n===`item`){var a=lA.touches[0];if(document.elementFromPoint==null||a==null)return;var o=document.elementFromPoint(a.clientX,a.clientY);if(!o||!o.getAttribute)return;var s=o.getAttribute($s),c=o.getAttribute(`data-recharts-item-id`)??void 0,l=gS(e).find(e=>e.id===c);if(s==null||l==null||c==null)return;var{dataKey:u}=l,d=rA(e,s,c);t.dispatch(Mx({activeDataKey:u,activeIndex:s,activeCoordinate:d,activeGraphicalItemId:c}))}oA=null,sA=null}};if(!a){o();return}r===`raf`?oA=requestAnimationFrame(o):typeof r==`number`&&sA===null&&(o(),lA=null,sA=setTimeout(()=>{lA?o():(sA=null,oA=null)},r))}}});var uA={throttleDelay:`raf`,throttledEvents:[`mousemove`,`touchmove`,`pointermove`,`scroll`,`wheel`]},dA=Oo({name:`eventSettings`,initialState:uA,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=W(t.payload.throttledEvents))}}}),{setEventSettings:fA}=dA.actions,pA=dA.reducer,mA=Ai({brush:hO,cartesianAxis:eO,chartData:dw,errorBars:PO,eventSettings:pA,graphicalItems:wD,layout:xs,legend:eu,options:iw,polarAxis:NE,polarOptions:Uk,referenceElements:CO,renderedTicks:kO,rootProps:zk,tooltip:Bx,zIndex:zC}),hA=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Chart`;return vo({reducer:mA,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:![`commonjs`,`es6`,`production`].includes(`es6`)}).concat([Ak.middleware,Mk.middleware,qk.middleware,$k.middleware,aA.middleware]),enhancers:e=>{var t=e;return typeof e==`function`&&(t=e()),t.concat(go({type:`raf`}))},devTools:ed.devToolsEnabled&&{serialize:{replacer:Ik},name:`recharts-${t}`}})};function gA(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=mc(),a=(0,h.useRef)(null);if(i)return n;a.current??=hA(t,r);var o=Wr;return h.createElement(gu,{context:o,store:a.current},n)}function _A(e){var{layout:t,margin:n}=e,r=I(),i=mc();return(0,h.useEffect)(()=>{i||(r(vs(t)),r(_s(n)))},[r,i,t,n]),null}var vA=(0,h.memo)(_A,yu);function yA(e){var t=I();return(0,h.useEffect)(()=>{t(Bk(e))},[t,e]),null}var bA=(0,h.memo)(e=>{var t=I();return(0,h.useEffect)(()=>{t(fA(e))},[t,e]),null},yu);function xA(e){var{zIndex:t,isPanorama:n}=e,r=(0,h.useRef)(null),i=I();return(0,h.useLayoutEffect)(()=>(r.current&&i(LC({zIndex:t,element:r.current,isPanorama:n})),()=>{i(RC({zIndex:t,isPanorama:n}))}),[i,t,n]),h.createElement(`g`,{tabIndex:-1,ref:r,className:`recharts-zIndex-layer_${t}`})}function SA(e){var{children:t,isPanorama:n}=e,r=L(TC);if(!r||r.length===0)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return h.createElement(h.Fragment,null,i.map(e=>h.createElement(xA,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>h.createElement(xA,{key:e,zIndex:e,isPanorama:n})))}var CA=[`children`];function wA(e,t){if(e==null)return{};var n,r,i=TA(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=Gc(),r=Kc(),i=ud();if(!Cs(n)||!Cs(r))return null;var{children:a,otherAttributes:o,title:s,desc:c}=e,l,u;return o!=null&&(l=typeof o.tabIndex==`number`?o.tabIndex:i?0:void 0,u=typeof o.role==`string`?o.role:i?`application`:void 0),h.createElement(ee,EA({},o,{title:s,desc:c,role:u,tabIndex:l,width:n,height:r,style:DA,ref:t}),a)}),kA=e=>{var{children:t}=e,n=L(gc);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return h.createElement(ee,{width:r,height:i,x:o,y:a},t)},AA=(0,h.forwardRef)((e,t)=>{var{children:n}=e,r=wA(e,CA);return mc()?h.createElement(kA,null,h.createElement(SA,{isPanorama:!0},n)):h.createElement(OA,EA({ref:t},r),h.createElement(SA,{isPanorama:!1},n))});function jA(){var e=I(),[t,n]=(0,h.useState)(null),r=L(Ys);return(0,h.useEffect)(()=>{if(t!=null){var n=t.getBoundingClientRect().width/t.offsetWidth;V(n)&&n!==r&&e(bs(n))}},[t,e,r]),n}function MA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function NA(e){for(var t=1;t(Sw(),null);function zA(e){if(typeof e==`number`)return e;if(typeof e==`string`){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var BA=(0,h.forwardRef)((e,t)=>{var n=(0,h.useRef)(null),[r,i]=(0,h.useState)({containerWidth:zA(e.style?.width),containerHeight:zA(e.style?.height)}),a=(0,h.useCallback)((e,t)=>{i(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),o=(0,h.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null&&typeof ResizeObserver<`u`){var{width:r,height:i}=e.getBoundingClientRect();a(r,i);var o=new ResizeObserver(e=>{var t=e[0];if(t!=null){var{width:n,height:r}=t.contentRect;a(n,r)}});o.observe(e),n.current=o}},[t,a]);return(0,h.useEffect)(()=>()=>{n.current?.disconnect()},[a]),h.createElement(h.Fragment,null,h.createElement(Qc,{width:r.containerWidth,height:r.containerHeight}),h.createElement(`div`,LA({ref:o},e)))}),VA=(0,h.forwardRef)((e,t)=>{var{width:n,height:r}=e,[i,a]=(0,h.useState)({containerWidth:zA(n),containerHeight:zA(r)}),o=(0,h.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,h.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null){var{width:n,height:r}=e.getBoundingClientRect();o(n,r)}},[t,o]);return h.createElement(h.Fragment,null,h.createElement(Qc,{width:i.containerWidth,height:i.containerHeight}),h.createElement(`div`,LA({ref:s},e)))}),HA=(0,h.forwardRef)((e,t)=>{var{width:n,height:r}=e;return h.createElement(h.Fragment,null,h.createElement(Qc,{width:n,height:r}),h.createElement(`div`,LA({ref:t},e)))}),UA=(0,h.forwardRef)((e,t)=>{var{width:n,height:r}=e;return typeof n==`string`||typeof r==`string`?h.createElement(VA,LA({},e,{ref:t})):typeof n==`number`&&typeof r==`number`?h.createElement(HA,LA({},e,{width:n,height:r,ref:t})):h.createElement(h.Fragment,null,h.createElement(Qc,{width:n,height:r}),h.createElement(`div`,LA({ref:t},e)))});function WA(e){return e?BA:UA}var GA=(0,h.forwardRef)((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:s,onMouseDown:l,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:p,onTouchEnd:m,onTouchMove:g,onTouchStart:_,style:v,width:y,responsive:b,dispatchTouchEvents:x=!0}=e,S=(0,h.useRef)(null),C=I(),[w,T]=(0,h.useState)(null),[E,D]=(0,h.useState)(null),O=jA(),k=Rc(),ee=k?.width>0?k.width:y,te=k?.height>0?k.height:i,A=(0,h.useCallback)(e=>{O(e),typeof t==`function`&&t(e),T(e),D(e),e!=null&&(S.current=e)},[O,t,T,D]),j=(0,h.useCallback)(e=>{C(kk(e)),C(Qk({handler:a,reactEvent:e}))},[C,a]),ne=(0,h.useCallback)(e=>{C(jk(e)),C(Qk({handler:u,reactEvent:e}))},[C,u]),re=(0,h.useCallback)(e=>{C(Px()),C(Qk({handler:d,reactEvent:e}))},[C,d]),ae=(0,h.useCallback)(e=>{C(jk(e)),C(Qk({handler:f,reactEvent:e}))},[C,f]),M=(0,h.useCallback)(()=>{C(Gk())},[C]),oe=(0,h.useCallback)(()=>{C(Kk())},[C]),se=(0,h.useCallback)(e=>{C(Wk(e.key))},[C]),ce=(0,h.useCallback)(e=>{C(Qk({handler:o,reactEvent:e}))},[C,o]),le=(0,h.useCallback)(e=>{C(Qk({handler:s,reactEvent:e}))},[C,s]),ue=(0,h.useCallback)(e=>{C(Qk({handler:l,reactEvent:e}))},[C,l]),de=(0,h.useCallback)(e=>{C(Qk({handler:p,reactEvent:e}))},[C,p]),fe=(0,h.useCallback)(e=>{C(Qk({handler:_,reactEvent:e}))},[C,_]),pe=(0,h.useCallback)(e=>{x&&C(iA(e)),C(Qk({handler:g,reactEvent:e}))},[C,x,g]),me=(0,h.useCallback)(e=>{C(Qk({handler:m,reactEvent:e}))},[C,m]),he=WA(b);return h.createElement(XC.Provider,{value:w},h.createElement(ie.Provider,{value:E},h.createElement(he,{width:ee??v?.width,height:te??v?.height,className:c(`recharts-wrapper`,r),style:NA({position:`relative`,cursor:`default`,width:ee,height:te},v),onClick:j,onContextMenu:ce,onDoubleClick:le,onFocus:M,onBlur:oe,onKeyDown:se,onMouseDown:ue,onMouseEnter:ne,onMouseLeave:re,onMouseMove:ae,onMouseUp:de,onTouchEnd:me,onTouchMove:pe,onTouchStart:fe,ref:A},h.createElement(RA,null),n)))}),KA=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function qA(e,t){if(e==null)return{};var n,r,i=JA(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var{width:n,height:r,responsive:i,children:a,className:o,style:s,compact:c,title:l,desc:u}=e,d=S(qA(e,KA));return c?h.createElement(h.Fragment,null,h.createElement(Qc,{width:n,height:r}),h.createElement(AA,{otherAttributes:d,title:l,desc:u},a)):h.createElement(GA,{className:o,style:s,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},h.createElement(AA,{otherAttributes:d,title:l,desc:u,ref:t},h.createElement(TO,null,a)))});function XA(){return XA=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);return e}function cj({id:e,className:t,children:n,config:r,initialDimension:i=aj,...a}){let s=h.useId(),c=`chart-${e??s.replace(/:/g,``)}`;return(0,$.jsx)(oj.Provider,{value:{config:r},children:(0,$.jsxs)(`div`,{className:o(`flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-hidden [&_.recharts-surface]:outline-hidden`,t),"data-chart":c,"data-slot":`chart`,...a,children:[(0,$.jsx)(lj,{config:r,id:c}),(0,$.jsx)(Bc,{initialDimension:i,children:n})]})})}var lj=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme??e.color);return n.length?(0,$.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(ij).map(([t,r])=>` + ${S.x},${S.y}`,w=F(e.id)?Gt(`recharts-radial-line-`):e.id;return h.createElement(`text`,XT({},r,{dominantBaseline:`central`,className:c(`recharts-radial-bar-label`,o)}),h.createElement(`defs`,null,h.createElement(`path`,{id:w,d:C})),h.createElement(`textPath`,{xlinkHref:`#${w}`},n))},oE=(e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:s,endAngle:c}=e,l=(s+c)/2;if(n===`outside`){var{x:u,y:d}=tp(r,i,o+t,l);return{x:u,y:d,textAnchor:u>=r?`start`:`end`,verticalAnchor:`middle`}}if(n===`center`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`middle`};if(n===`centerTop`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`start`};if(n===`centerBottom`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`end`};var{x:f,y:p}=tp(r,i,(a+o)/2,l);return{x:f,y:p,textAnchor:`middle`,verticalAnchor:`middle`}},sE=e=>e!=null&&`cx`in e&&P(e.cx),cE={angle:0,offset:5,zIndex:$p.label,position:`middle`,textBreakAll:!1};function lE(e){if(!sE(e))return e;var{cx:t,cy:n,outerRadius:r}=e,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function uE(e){var t=wn(e,cE),{viewBox:n,parentViewBox:r,position:i,value:a,children:o,content:s,className:l=``,textBreakAll:u,labelRef:d}=t,f=tE(),p=$T(),m=n==null?i===`center`?p:f??p:sE(n)?n:Vc(n),g,_,v=lE(m);if(!m||F(a)&&F(o)&&!(0,h.isValidElement)(s)&&typeof s!=`function`)return null;var y=KT(KT({},t),{},{viewBox:m});if((0,h.isValidElement)(s)){var{labelRef:b}=y,x=UT(y,VT);return(0,h.cloneElement)(s,x)}if(typeof s==`function`){var{content:S}=y,C=UT(y,HT);if(g=(0,h.createElement)(s,C),(0,h.isValidElement)(g))return g}else g=nE(t);var T=w(t);if(sE(m)){if(i===`insideStart`||i===`insideEnd`||i===`end`)return aE(t,i,g,T,m);_=oE(m,t.offset,t.position)}else{if(!v)return null;var E=BT({viewBox:v,position:i,offset:t.offset,parentViewBox:sE(r)?void 0:r,clamp:!0});_=KT(KT({x:E.x,y:E.y,textAnchor:E.horizontalAnchor,verticalAnchor:E.verticalAnchor},E.width===void 0?{}:{width:E.width}),E.height===void 0?{}:{height:E.height})}return h.createElement(BC,{zIndex:t.zIndex},h.createElement(PT,XT({ref:d,className:c(`recharts-label`,l)},T,_,{textAnchor:CT(T.textAnchor)?T.textAnchor:_.textAnchor,breakAll:u}),g))}uE.displayName=`Label`;var dE=(e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return e===!0?h.createElement(uE,XT({key:`label-implicit`},r)):Ut(e)?h.createElement(uE,XT({key:`label-implicit`,value:e},r)):(0,h.isValidElement)(e)?e.type===uE?(0,h.cloneElement)(e,KT({key:`label-implicit`},r)):h.createElement(uE,XT({key:`label-implicit`,content:e},r)):rE(e)?h.createElement(uE,XT({key:`label-implicit`,content:e},r)):e&&typeof e==`object`?h.createElement(uE,XT({},e,{key:`label-implicit`},r)):null};function fE(e){var{label:t,labelRef:n}=e;return dE(t,$T(),n)||null}var pE=[`valueAccessor`],mE=[`dataKey`,`clockWise`,`id`,`textBreakAll`,`zIndex`];function hE(){return hE=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(wT(t))return t},yE=(0,h.createContext)(void 0),bE=yE.Provider,xE=(0,h.createContext)(void 0);xE.Provider;function SE(){return(0,h.useContext)(yE)}function CE(){return(0,h.useContext)(xE)}function wE(e){var{valueAccessor:t=vE}=e,n=gE(e,pE),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:s}=n,c=gE(n,mE),l=SE(),u=CE(),d=l||u;return!d||!d.length?null:h.createElement(BC,{zIndex:s??$p.label},h.createElement(re,{className:`recharts-label-list`},d.map((e,i)=>{var s=F(r)?t(e,i):H(e.payload,r),l=F(a)?{}:{id:`${a}-${i}`};return h.createElement(uE,hE({key:`label-${i}`},w(e),c,l,{fill:n.fill??e.fill,parentViewBox:e.parentViewBox,value:s,textBreakAll:o,viewBox:e.viewBox,index:i,zIndex:0}))})))}wE.displayName=`LabelList`;function TE(e){var{label:t}=e;return t?t===!0?h.createElement(wE,{key:`labelList-implicit`}):h.isValidElement(t)||rE(t)?h.createElement(wE,{key:`labelList-implicit`,content:t}):typeof t==`object`?h.createElement(wE,hE({key:`labelList-implicit`},t,{type:String(t.type)})):null:null}function EE(){return EE=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r,className:i}=e,a=c(`recharts-dot`,i);return P(t)&&P(n)&&P(r)?h.createElement(`circle`,EE({},S(e),gn(e),{className:a,cx:t,cy:n,r})):null},OE=Oo({name:`polarAxis`,initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=W(t.payload)},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=W(t.payload)},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:kE,removeRadiusAxis:AE,addAngleAxis:jE,removeAngleAxis:ME}=OE.actions,NE=OE.reducer,PE=t((e=>{if(typeof Symbol==`function`&&Symbol.for){var t=Symbol.for;t(`react.element`),t(`react.portal`),t(`react.fragment`),t(`react.strict_mode`),t(`react.profiler`),t(`react.provider`),t(`react.context`),t(`react.forward_ref`),t(`react.suspense`),t(`react.suspense_list`),t(`react.memo`),t(`react.lazy`),t(`react.block`),t(`react.server.block`),t(`react.fundamental`),t(`react.debug_trace_mode`),t(`react.legacy_hidden`)}}));t(((e,t)=>{t.exports=PE()}))();var FE=e=>e&&typeof e==`object`&&`clipDot`in e?!!e.clipDot:!0;function IE(e){if(typeof e!=`object`||!e)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!==`[object Object]`){let t=e[Symbol.toStringTag];return t==null||!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable?!1:e.toString()===`[object ${t}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}var LE,RE,zE,BE,VE;function HE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function UE(e){for(var t=1;t{var a=n-r,o=N(LE||=JE([`M `,`,`,``]),e,t);return o+=N(RE||=JE([`L `,`,`,``]),e+n,t),o+=N(zE||=JE([`L `,`,`,``]),e+n-a/2,t+i),o+=N(BE||=JE([`L `,`,`,``]),e+n-a/2-r,t+i),o+=N(VE||=JE([`L `,`,`,` Z`]),e,t),o},XE={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},ZE=e=>{var t=wn(e,XE),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:s}=t,{animationEasing:l,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,p=(0,h.useRef)(null),[m,g]=(0,h.useState)(-1),_=(0,h.useRef)(i),v=(0,h.useRef)(a),y=(0,h.useRef)(o),b=(0,h.useRef)(n),x=(0,h.useRef)(r),S=Cf(e,`trapezoid-`);if((0,h.useEffect)(()=>{if(p.current&&p.current.getTotalLength)try{var e=p.current.getTotalLength();e&&g(e)}catch{}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||i===0&&a===0||o===0)return null;var C=c(`recharts-trapezoid`,s);if(!f)return h.createElement(`g`,null,h.createElement(`path`,qE({},w(t),{className:C,d:YE(n,r,i,a,o)})));var T=_.current,E=v.current,D=y.current,O=b.current,k=x.current,ee=`0px ${m===-1?1:m}px`,te=`${m}px ${m}px`,A=Wd([`strokeDasharray`],u,l);return h.createElement(Sf,{animationId:S,key:S,canBegin:m>0,duration:u,easing:l,isActive:f,begin:d},e=>{var s=Jt(T,i,e),c=Jt(E,a,e),l=Jt(D,o,e),u=Jt(O,n,e),d=Jt(k,r,e);p.current&&(_.current=s,v.current=c,y.current=l,b.current=u,x.current=d);var f=e>0?{transition:A,strokeDasharray:te}:{strokeDasharray:ee};return h.createElement(`path`,qE({},w(t),{className:C,d:YE(u,d,s,c,l),ref:p,style:UE(UE({},f),t.style)}))})},QE=[`option`,`shapeType`,`activeClassName`,`inActiveClassName`];function $E(e,t){if(e==null)return{};var n,r,i=eD(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{r||(i.current===null?n(Ox(t)):i.current!==t&&n(kx({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,h.useLayoutEffect)(()=>()=>{i.current&&=(n(Ax(i.current)),null)},[n]),null}function fD(e){var{legendPayload:t}=e,n=I(),r=mc(),i=(0,h.useRef)(null);return(0,h.useLayoutEffect)(()=>{r||(i.current===null?n(Zl(t)):i.current!==t&&n(Ql({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,h.useLayoutEffect)(()=>()=>{i.current&&=(n($l(i.current)),null)},[n]),null}var pD=h.useId??(()=>{var[e]=h.useState(()=>Gt(`uid-`));return e});function mD(e,t){var n=pD();return t||(e?`${e}-${n}`:n)}var hD=(0,h.createContext)(void 0),gD=e=>{var{id:t,type:n,children:r}=e,i=mD(`recharts-${n}`,t);return h.createElement(hD.Provider,{value:i},r(i))},_D=Oo({name:`graphicalItems`,initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(W(t.payload))},prepare:B()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=$a(e).cartesianItems.indexOf(W(n));i>-1&&(e.cartesianItems[i]=W(r))},prepare:B()},removeCartesianGraphicalItem:{reducer(e,t){var n=$a(e).cartesianItems.indexOf(W(t.payload));n>-1&&e.cartesianItems.splice(n,1)},prepare:B()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(W(t.payload))},prepare:B()},removePolarGraphicalItem:{reducer(e,t){var n=$a(e).polarItems.indexOf(W(t.payload));n>-1&&e.polarItems.splice(n,1)},prepare:B()},replacePolarGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=$a(e).polarItems.indexOf(W(n));i>-1&&(e.polarItems[i]=W(r))},prepare:B()}}}),{addCartesianGraphicalItem:vD,replaceCartesianGraphicalItem:yD,removeCartesianGraphicalItem:bD,addPolarGraphicalItem:xD,removePolarGraphicalItem:SD,replacePolarGraphicalItem:CD}=_D.actions,wD=_D.reducer,TD=(0,h.memo)(e=>{var t=I(),n=(0,h.useRef)(null);return(0,h.useLayoutEffect)(()=>{n.current===null?t(vD(e)):n.current!==e&&t(yD({prev:n.current,next:e})),n.current=e},[t,e]),(0,h.useLayoutEffect)(()=>()=>{n.current&&=(t(bD(n.current)),null)},[t]),null}),ED=[`points`];function DD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function OD(e){for(var t=1;t{var s=OD(OD(OD({r:3},o),d),{},{index:r,cx:e.x??void 0,cy:e.y??void 0,dataKey:a,value:e.value,payload:e.payload,points:t});return h.createElement(FD,{key:`dot-${r}`,option:n,dotProps:s,className:i})}),p={};return s&&c!=null&&(p.clipPath=`url(#clipPath-${u?``:`dots-`}${c})`),h.createElement(BC,{zIndex:l},h.createElement(re,MD({className:r},p),f))}function RD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zD(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),qs,Js],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),nO=()=>L(tO),rO=()=>L(WS);function iO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function aO(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:a,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var s=aO(aO(aO({},{index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??`none`,strokeWidth:2,stroke:`#fff`,payload:t.payload,value:t.value}),C(i)),gn(i)),c=(0,h.isValidElement)(i)?(0,h.cloneElement)(i,s):typeof i==`function`?i(s):h.createElement(DE,s);return h.createElement(re,{className:`recharts-active-dot`,clipPath:o},c)};function uO(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=$p.activeDot}=e,s=L(LS),c=rO();if(t==null||c==null)return null;var l=t.find(e=>c.includes(e.payload));return F(l)?null:h.createElement(BC,{zIndex:o},h.createElement(lO,{point:l,childIndex:Number(s),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}var dO=e=>{var{chartData:t}=e,n=I(),r=mc();return(0,h.useEffect)(()=>r?()=>{}:(n(cw(t)),()=>{n(cw(void 0))}),[t,n,r]),null},fO={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},pO=Oo({name:`brush`,initialState:fO,reducers:{setBrushSettings(e,t){return t.payload==null?fO:t.payload}}}),{setBrushSettings:mO}=pO.actions,hO=pO.reducer,gO=Oo({name:`referenceElements`,initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=$a(e).dots.findIndex(e=>e===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=$a(e).areas.findIndex(e=>e===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(W(t.payload))},removeLine:(e,t)=>{var n=$a(e).lines.findIndex(e=>e===t.payload);n!==-1&&e.lines.splice(n,1)}}}),{addDot:_O,removeDot:vO,addArea:yO,removeArea:bO,addLine:xO,removeLine:SO}=gO.actions,CO=gO.reducer,wO=(0,h.createContext)(void 0),TO=e=>{var{children:t}=e,[n]=(0,h.useState)(`${Gt(`recharts`)}-clip`),r=nO();if(r==null)return null;var{x:i,y:a,width:o,height:s}=r;return h.createElement(wO.Provider,{value:n},h.createElement(`defs`,null,h.createElement(`clipPath`,{id:n},h.createElement(`rect`,{x:i,y:a,height:s,width:o}))),t)},EO=Oo({name:`renderedTicks`,initialState:{xAxis:{},yAxis:{}},reducers:{setRenderedTicks:(e,t)=>{var{axisType:n,axisId:r,ticks:i}=t.payload;e[n][r]=W(i)},removeRenderedTicks:(e,t)=>{var{axisType:n,axisId:r}=t.payload;delete e[n][r]}}}),{setRenderedTicks:DO,removeRenderedTicks:OO}=EO.actions,kO=EO.reducer,AO=Oo({name:`errorBars`,initialState:{},reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(e=>e.dataKey===r.dataKey&&e.direction===r.direction?i:e))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(e=>e.dataKey!==r.dataKey||e.direction!==r.direction))}}}),{addErrorBar:jO,replaceErrorBar:MO,removeErrorBar:NO}=AO.actions,PO=AO.reducer,FO=[`children`];function IO(e,t){if(e==null)return{};var n,r,i=LO(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function zO(e){var{children:t}=e,n=IO(e,FO);return h.createElement(RO.Provider,{value:n},t)}function BO(e,t){var n=L(t=>yy(t,e)),r=L(e=>Sy(e,t)),i=n?.allowDataOverflow??_y.allowDataOverflow,a=r?.allowDataOverflow??by.allowDataOverflow;return{needClip:i||a,needClipX:i,needClipY:a}}function VO(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=nO(),{needClipX:a,needClipY:o,needClip:s}=BO(t,n);if(!s||!i)return null;var{x:c,y:l,width:u,height:d}=i;return h.createElement(`clipPath`,{id:`clipPath-${r}`},h.createElement(`rect`,{x:a?c:c-u/2,y:o?l:l-d/2,width:a?u:u*2,height:o?d:d*2}))}var HO=(e,t,n,r)=>_x(e,`xAxis`,t,r),UO=(e,t,n,r)=>gx(e,`xAxis`,t,r),WO=(e,t,n,r)=>_x(e,`yAxis`,n,r),GO=(e,t,n,r)=>gx(e,`yAxis`,n,r),KO=R([U,HO,WO,UO,GO],(e,t,n,r,i)=>As(e,`xAxis`)?Hs(t,r,!1):Hs(n,i,!1)),qO=(e,t,n,r,i)=>i;function JO(e){return e.type===`line`}var YO=R([U,HO,WO,UO,GO,R([Ay,qO],(e,t)=>e.filter(JO).find(e=>e.id===t)),KO,Ap],(e,t,n,r,i,a,o,s)=>{var{chartData:c,dataStartIndex:l,dataEndIndex:u}=s;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var{dataKey:d,data:f}=a,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return Ck({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}});function XO(e){var t=C(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:a}=t,o=Number(i),s=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(s)||s<0)&&(s=r),{r:o,strokeWidth:s}}return{r:n,strokeWidth:r}}var ZO=[`id`],QO=[`type`,`layout`,`connectNulls`,`needClip`,`shape`],$O=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function ek(){return ek=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:Ws(n,t),payload:e}]},lk=h.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:c,tooltipType:l,id:u}=e,d={dataDefinedOnItem:n,getPosition:Qt,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Ws(o,t),hide:s,type:l,color:r,unit:c,graphicalItemId:u}};return h.createElement(dD,{tooltipEntrySettings:d})}),uk=(e,t)=>`${t}px ${e}px`;function dk(e,t){for(var n=e.length%2==0?e:[...e,0],r=[],i=0;i{var r=n.reduce((e,t)=>e+t,0);if(!r)return uk(t,e);for(var i=Math.floor(e/r),a=e%r,o=[],s=0,c=0;sa){o=[...n.slice(0,s),a-c];break}}var d=o.length%2==0?[0,t]:[t];return[...dk(n,i),...o,...d].map(e=>`${e}px`).join(`, `)};function pk(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:o}=r,{id:s}=r,c=S(ok(r,ZO));return h.createElement(LD,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function mk(e){var{showLabels:t,children:n,points:r}=e,i=(0,h.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return nk(nk({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return h.createElement(bE,{value:t?i:void 0},n)}function hk(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:a}=e,{type:o,layout:s,connectNulls:c,needClip:l,shape:u}=a,d=nk(nk({},w(ok(a,QO))),{},{fill:`none`,className:`recharts-line-curve`,clipPath:l?`url(#clipPath-${t})`:void 0,points:r,type:o,layout:s,connectNulls:c,strokeDasharray:i??a.strokeDasharray});return h.createElement(h.Fragment,null,r?.length>1&&h.createElement(uD,ek({shapeType:`curve`,option:u},d,{pathRef:n})),h.createElement(pk,{points:r,clipPathId:t,props:a}))}function gk(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function _k(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:s,isAnimationActive:c,animationBegin:l,animationDuration:u,animationEasing:d,animateNewValues:f,width:p,height:m,onAnimationEnd:g,onAnimationStart:_}=n,v=i.current,y=Cf(o,`recharts-line-`),b=(0,h.useRef)(y),[x,S]=(0,h.useState)(!1),C=!x,w=(0,h.useCallback)(()=>{typeof g==`function`&&g(),S(!1)},[g]),T=(0,h.useCallback)(()=>{typeof _==`function`&&_(),S(!0)},[_]),E=gk(r.current),D=(0,h.useRef)(0);b.current!==y&&(D.current=a.current,b.current=y);var O=D.current;return h.createElement(mk,{points:o,showLabels:C},n.children,h.createElement(Sf,{animationId:y,begin:l,duration:u,isActive:c,easing:d,onAnimationEnd:w,onAnimationStart:T,key:y},e=>{var l=Jt(O,E+O,e),u=Math.min(l,E),d=c?s?fk(u,E,`${s}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):uk(E,u):s==null?void 0:String(s);if(e>0&&E>0&&(i.current=o,a.current=Math.max(a.current,u)),v){var g=v.length/o.length,_=e===1?o:o.map((t,n)=>{var r=Math.floor(n*g);if(v[r]){var i=v[r];return nk(nk({},t),{},{x:Jt(i.x,t.x,e),y:Jt(i.y,t.y,e)})}return f?nk(nk({},t),{},{x:Jt(p*2,t.x,e),y:Jt(m/2,t.y,e)}):nk(nk({},t),{},{x:t.x,y:t.y})});return i.current=_,h.createElement(hk,{props:n,points:_,clipPathId:t,pathRef:r,strokeDasharray:d})}return h.createElement(hk,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:d})}),h.createElement(TE,{label:n.label}))}function vk(e){var{clipPathId:t,props:n}=e,r=(0,h.useRef)(null),i=(0,h.useRef)(0),a=(0,h.useRef)(null);return h.createElement(_k,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var yk=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:H(e.payload,t)}),bk=class extends h.Component{render(){var{hide:e,dot:t,points:n,className:r,xAxisId:i,yAxisId:a,top:o,left:s,width:l,height:u,id:d,needClip:f,zIndex:p}=this.props;if(e)return null;var m=c(`recharts-line`,r),g=d,{r:_,strokeWidth:v}=XO(t),y=FE(t),b=_*2+v,x=f?`url(#clipPath-${y?``:`dots-`}${g})`:void 0;return h.createElement(BC,{zIndex:p},h.createElement(re,{className:m},f&&h.createElement(`defs`,null,h.createElement(VO,{clipPathId:g,xAxisId:i,yAxisId:a}),!y&&h.createElement(`clipPath`,{id:`clipPath-dots-${g}`},h.createElement(`rect`,{x:s-b/2,y:o-b/2,width:l+b,height:u+b}))),h.createElement(zO,{xAxisId:i,yAxisId:a,data:n,dataPointFormatter:yk,errorBarOffset:0},h.createElement(vk,{props:this.props,clipPathId:g}))),h.createElement(uO,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:x}))}},xk={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:$p.line,type:`linear`};function Sk(e){var t=wn(e,xk),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:c,hide:l,isAnimationActive:u,label:d,legendType:f,xAxisId:p,yAxisId:m,id:g}=t,_=ok(t,$O),{needClip:v}=BO(p,m),y=nO(),b=Jc(),x=mc(),S=L(e=>YO(e,p,m,x,g));if(b!==`horizontal`&&b!==`vertical`||S==null||y==null)return null;var{height:C,width:w,x:T,y:E}=y;return h.createElement(bk,ek({},_,{id:g,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:S,layout:b,height:C,width:w,left:T,top:E,needClip:v}))}function Ck(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:s,displayedData:c}=e;return c.map((e,c)=>{var l=H(e,o);if(t===`horizontal`)return{x:Is({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(F(l)?null:r.scale.map(l))??null,value:l,payload:e};var u=F(l)?null:n.scale.map(l),d=Is({axis:r,ticks:a,bandSize:s,entry:e,index:c});return u==null||d==null?null:{x:u,y:d,value:l,payload:e}}).filter(Boolean)}function wk(e){var t=wn(e,xk),n=mc();return h.createElement(gD,{id:t.id,type:`line`},e=>h.createElement(h.Fragment,null,h.createElement(fD,{legendPayload:ck(t)}),h.createElement(lk,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),h.createElement(TD,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),h.createElement(Sk,ek({},t,{id:e}))))}var Tk=h.memo(wk,yu);Tk.displayName=`Line`;var Ek=R([(e,t)=>t,U,ym,J,AS,MS,dC,uc],CC);function Dk(e){return`getBBox`in e.currentTarget&&typeof e.currentTarget.getBBox==`function`}function Ok(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(Dk(e)){var i=e.currentTarget.getBBox();n=i.width>0?t.width/i.width:1,r=i.height>0?t.height/i.height:1}else{var a=e.currentTarget;n=a.offsetWidth>0?t.width/a.offsetWidth:1,r=a.offsetHeight>0?t.height/a.offsetHeight:1}var o=(e,i)=>({relativeX:Math.round((e-t.left)/n),relativeY:Math.round((i-t.top)/r)});return`touches`in e?Array.from(e.touches).map(e=>o(e.clientX,e.clientY)):o(e.clientX,e.clientY)}var kk=oo(`mouseClick`),Ak=ms();Ak.startListening({actionCreator:kk,effect:(e,t)=>{var n=e.payload,r=Ek(t.getState(),Ok(n));r?.activeIndex!=null&&t.dispatch(Lx({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var jk=oo(`mouseMove`),Mk=ms(),Nk=null,Pk=null,Fk=null;Mk.startListening({actionCreator:jk,effect:(e,t)=>{var n=e.payload,{throttleDelay:r,throttledEvents:i}=t.getState().eventSettings,a=i===`all`||i?.includes(`mousemove`);Nk!==null&&(cancelAnimationFrame(Nk),Nk=null),Pk!==null&&(typeof r!=`number`||!a)&&(clearTimeout(Pk),Pk=null),Fk=Ok(n);var o=()=>{var e=t.getState(),n=Sx(e,e.tooltip.settings.shared);if(!Fk){Nk=null,Pk=null;return}if(n===`axis`){var r=Ek(e,Fk);r?.activeIndex==null?t.dispatch(Px()):t.dispatch(Ix({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}Nk=null,Pk=null};if(!a){o();return}r===`raf`?Nk=requestAnimationFrame(o):typeof r==`number`&&Pk===null&&(Pk=setTimeout(o,r))}});function Ik(e,t){return t instanceof HTMLElement?`HTMLElement <${t.tagName} class="${t.className}">`:t===window?`global.window`:e===`children`&&typeof t==`object`&&t?`<>`:t}var Lk={accessibilityLayer:!0,barCategoryGap:`10%`,barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:`none`,syncId:void 0,syncMethod:`index`,baseValue:void 0,reverseStackOrder:!1},Rk=Oo({name:`rootProps`,initialState:Lk,reducers:{updateOptions:(e,t)=>{e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=t.payload.barGap??Lk.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),zk=Rk.reducer,{updateOptions:Bk}=Rk.actions,Vk=Oo({name:`polarOptions`,initialState:null,reducers:{updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)}}),{updatePolarOptions:Hk}=Vk.actions,Uk=Vk.reducer,Wk=oo(`keyDown`),Gk=oo(`focus`),Kk=oo(`blur`),qk=ms(),Jk=null,Yk=null,Xk=null;qk.startListening({actionCreator:Wk,effect:(e,t)=>{Xk=e.payload,Jk!==null&&(cancelAnimationFrame(Jk),Jk=null);var{throttleDelay:n,throttledEvents:r}=t.getState().eventSettings,i=r===`all`||r.includes(`keydown`);Yk!==null&&(typeof n!=`number`||!i)&&(clearTimeout(Yk),Yk=null);var a=()=>{try{var e=t.getState();if(e.rootProps.accessibilityLayer===!1)return;var{keyboardInteraction:n}=e.tooltip,r=Xk;if(r!==`ArrowRight`&&r!==`ArrowLeft`&&r!==`Enter`)return;var i=Qx(n,vS(e),Xy(e),DS(e)),a=i==null?-1:Number(i);if(!Number.isFinite(a)||a<0)return;var o=MS(e);if(r===`Enter`){var s=gC(e,`axis`,`hover`,String(n.index));t.dispatch(zx({active:!n.active,activeIndex:n.index,activeCoordinate:s}));return}var c=vx(e)===`left-to-right`?1:-1,l=a+(r===`ArrowRight`?1:-1)*c;if(o==null||l>=o.length||l<0)return;var u=gC(e,`axis`,`hover`,String(l));t.dispatch(zx({active:!0,activeIndex:l.toString(),activeCoordinate:u}))}finally{Jk=null,Yk=null}};if(!i){a();return}n===`raf`?Jk=requestAnimationFrame(a):typeof n==`number`&&Yk===null&&(a(),Xk=null,Yk=setTimeout(()=>{Xk?a():(Yk=null,Jk=null)},n))}}),qk.startListening({actionCreator:Gk,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var{keyboardInteraction:r}=n.tooltip;if(!r.active&&r.index==null){var i=`0`,a=gC(n,`axis`,`hover`,String(i));t.dispatch(zx({active:!0,activeIndex:i,activeCoordinate:a}))}}}}),qk.startListening({actionCreator:Kk,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var{keyboardInteraction:r}=n.tooltip;r.active&&t.dispatch(zx({active:!1,activeIndex:r.index,activeCoordinate:r.coordinate}))}}});function Zk(e){e.persist();var{currentTarget:t}=e;return new Proxy(e,{get:(e,n)=>{if(n===`currentTarget`)return t;var r=Reflect.get(e,n);return typeof r==`function`?r.bind(e):r}})}var Qk=oo(`externalEvent`),$k=ms(),eA=new Map,tA=new Map,nA=new Map;$k.startListening({actionCreator:Qk,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(n!=null){var i=r.type,a=Zk(r);nA.set(i,{handler:n,reactEvent:a});var o=eA.get(i);o!==void 0&&(cancelAnimationFrame(o),eA.delete(i));var{throttleDelay:s,throttledEvents:c}=t.getState().eventSettings,l=c,u=l===`all`||l?.includes(i),d=tA.get(i);d!==void 0&&(typeof s!=`number`||!u)&&(clearTimeout(d),tA.delete(i));var f=()=>{var e=nA.get(i);try{if(!e)return;var{handler:n,reactEvent:r}=e,a=t.getState(),o={activeCoordinate:HS(a),activeDataKey:zS(a),activeIndex:LS(a),activeLabel:RS(a),activeTooltipIndex:LS(a),isTooltipActive:US(a)};n&&n(o,r)}finally{eA.delete(i),tA.delete(i),nA.delete(i)}};if(!u){f();return}if(s===`raf`){var p=requestAnimationFrame(f);eA.set(i,p)}else if(typeof s==`number`){if(!tA.has(i)){f();var m=setTimeout(f,s);tA.set(i,m)}}else f()}}});var rA=R([R([nS],e=>e.tooltipItemPayloads),(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(e=>e.settings.graphicalItemId===n);if(r!=null){var{getPosition:i}=r;if(i!=null)return i(t)}}}),iA=oo(`touchMove`),aA=ms(),oA=null,sA=null,cA=null,lA=null;aA.startListening({actionCreator:iA,effect:(e,t)=>{var n=e.payload;if(n.touches!=null&&n.touches.length!==0){lA=Zk(n);var{throttleDelay:r,throttledEvents:i}=t.getState().eventSettings,a=i===`all`||i.includes(`touchmove`);oA!==null&&(cancelAnimationFrame(oA),oA=null),sA!==null&&(typeof r!=`number`||!a)&&(clearTimeout(sA),sA=null),cA=Array.from(n.touches).map(e=>Ok({clientX:e.clientX,clientY:e.clientY,currentTarget:n.currentTarget}));var o=()=>{if(lA!=null){var e=t.getState(),n=Sx(e,e.tooltip.settings.shared);if(n===`axis`){var r=cA?.[0];if(r==null){oA=null,sA=null;return}var i=Ek(e,r);i?.activeIndex!=null&&t.dispatch(Ix({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}else if(n===`item`){var a=lA.touches[0];if(document.elementFromPoint==null||a==null)return;var o=document.elementFromPoint(a.clientX,a.clientY);if(!o||!o.getAttribute)return;var s=o.getAttribute($s),c=o.getAttribute(`data-recharts-item-id`)??void 0,l=gS(e).find(e=>e.id===c);if(s==null||l==null||c==null)return;var{dataKey:u}=l,d=rA(e,s,c);t.dispatch(Mx({activeDataKey:u,activeIndex:s,activeCoordinate:d,activeGraphicalItemId:c}))}oA=null,sA=null}};if(!a){o();return}r===`raf`?oA=requestAnimationFrame(o):typeof r==`number`&&sA===null&&(o(),lA=null,sA=setTimeout(()=>{lA?o():(sA=null,oA=null)},r))}}});var uA={throttleDelay:`raf`,throttledEvents:[`mousemove`,`touchmove`,`pointermove`,`scroll`,`wheel`]},dA=Oo({name:`eventSettings`,initialState:uA,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=W(t.payload.throttledEvents))}}}),{setEventSettings:fA}=dA.actions,pA=dA.reducer,mA=Ai({brush:hO,cartesianAxis:eO,chartData:dw,errorBars:PO,eventSettings:pA,graphicalItems:wD,layout:xs,legend:eu,options:iw,polarAxis:NE,polarOptions:Uk,referenceElements:CO,renderedTicks:kO,rootProps:zk,tooltip:Bx,zIndex:zC}),hA=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Chart`;return vo({reducer:mA,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:![`commonjs`,`es6`,`production`].includes(`es6`)}).concat([Ak.middleware,Mk.middleware,qk.middleware,$k.middleware,aA.middleware]),enhancers:e=>{var t=e;return typeof e==`function`&&(t=e()),t.concat(go({type:`raf`}))},devTools:ed.devToolsEnabled&&{serialize:{replacer:Ik},name:`recharts-${t}`}})};function gA(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=mc(),a=(0,h.useRef)(null);if(i)return n;a.current??=hA(t,r);var o=Wr;return h.createElement(gu,{context:o,store:a.current},n)}function _A(e){var{layout:t,margin:n}=e,r=I(),i=mc();return(0,h.useEffect)(()=>{i||(r(vs(t)),r(_s(n)))},[r,i,t,n]),null}var vA=(0,h.memo)(_A,yu);function yA(e){var t=I();return(0,h.useEffect)(()=>{t(Bk(e))},[t,e]),null}var bA=(0,h.memo)(e=>{var t=I();return(0,h.useEffect)(()=>{t(fA(e))},[t,e]),null},yu);function xA(e){var{zIndex:t,isPanorama:n}=e,r=(0,h.useRef)(null),i=I();return(0,h.useLayoutEffect)(()=>(r.current&&i(LC({zIndex:t,element:r.current,isPanorama:n})),()=>{i(RC({zIndex:t,isPanorama:n}))}),[i,t,n]),h.createElement(`g`,{tabIndex:-1,ref:r,className:`recharts-zIndex-layer_${t}`})}function SA(e){var{children:t,isPanorama:n}=e,r=L(TC);if(!r||r.length===0)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return h.createElement(h.Fragment,null,i.map(e=>h.createElement(xA,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>h.createElement(xA,{key:e,zIndex:e,isPanorama:n})))}var CA=[`children`];function wA(e,t){if(e==null)return{};var n,r,i=TA(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=Gc(),r=Kc(),i=ud();if(!Cs(n)||!Cs(r))return null;var{children:a,otherAttributes:o,title:s,desc:c}=e,l,u;return o!=null&&(l=typeof o.tabIndex==`number`?o.tabIndex:i?0:void 0,u=typeof o.role==`string`?o.role:i?`application`:void 0),h.createElement(ee,EA({},o,{title:s,desc:c,role:u,tabIndex:l,width:n,height:r,style:DA,ref:t}),a)}),kA=e=>{var{children:t}=e,n=L(gc);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return h.createElement(ee,{width:r,height:i,x:o,y:a},t)},AA=(0,h.forwardRef)((e,t)=>{var{children:n}=e,r=wA(e,CA);return mc()?h.createElement(kA,null,h.createElement(SA,{isPanorama:!0},n)):h.createElement(OA,EA({ref:t},r),h.createElement(SA,{isPanorama:!1},n))});function jA(){var e=I(),[t,n]=(0,h.useState)(null),r=L(Ys);return(0,h.useEffect)(()=>{if(t!=null){var n=t.getBoundingClientRect().width/t.offsetWidth;V(n)&&n!==r&&e(bs(n))}},[t,e,r]),n}function MA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function NA(e){for(var t=1;t(Sw(),null);function zA(e){if(typeof e==`number`)return e;if(typeof e==`string`){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var BA=(0,h.forwardRef)((e,t)=>{var n=(0,h.useRef)(null),[r,i]=(0,h.useState)({containerWidth:zA(e.style?.width),containerHeight:zA(e.style?.height)}),a=(0,h.useCallback)((e,t)=>{i(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),o=(0,h.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null&&typeof ResizeObserver<`u`){var{width:r,height:i}=e.getBoundingClientRect();a(r,i);var o=new ResizeObserver(e=>{var t=e[0];if(t!=null){var{width:n,height:r}=t.contentRect;a(n,r)}});o.observe(e),n.current=o}},[t,a]);return(0,h.useEffect)(()=>()=>{n.current?.disconnect()},[a]),h.createElement(h.Fragment,null,h.createElement(Qc,{width:r.containerWidth,height:r.containerHeight}),h.createElement(`div`,LA({ref:o},e)))}),VA=(0,h.forwardRef)((e,t)=>{var{width:n,height:r}=e,[i,a]=(0,h.useState)({containerWidth:zA(n),containerHeight:zA(r)}),o=(0,h.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,h.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null){var{width:n,height:r}=e.getBoundingClientRect();o(n,r)}},[t,o]);return h.createElement(h.Fragment,null,h.createElement(Qc,{width:i.containerWidth,height:i.containerHeight}),h.createElement(`div`,LA({ref:s},e)))}),HA=(0,h.forwardRef)((e,t)=>{var{width:n,height:r}=e;return h.createElement(h.Fragment,null,h.createElement(Qc,{width:n,height:r}),h.createElement(`div`,LA({ref:t},e)))}),UA=(0,h.forwardRef)((e,t)=>{var{width:n,height:r}=e;return typeof n==`string`||typeof r==`string`?h.createElement(VA,LA({},e,{ref:t})):typeof n==`number`&&typeof r==`number`?h.createElement(HA,LA({},e,{width:n,height:r,ref:t})):h.createElement(h.Fragment,null,h.createElement(Qc,{width:n,height:r}),h.createElement(`div`,LA({ref:t},e)))});function WA(e){return e?BA:UA}var GA=(0,h.forwardRef)((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:s,onMouseDown:l,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:p,onTouchEnd:m,onTouchMove:g,onTouchStart:_,style:v,width:y,responsive:b,dispatchTouchEvents:x=!0}=e,S=(0,h.useRef)(null),C=I(),[w,T]=(0,h.useState)(null),[E,D]=(0,h.useState)(null),O=jA(),k=Rc(),ee=k?.width>0?k.width:y,te=k?.height>0?k.height:i,A=(0,h.useCallback)(e=>{O(e),typeof t==`function`&&t(e),T(e),D(e),e!=null&&(S.current=e)},[O,t,T,D]),j=(0,h.useCallback)(e=>{C(kk(e)),C(Qk({handler:a,reactEvent:e}))},[C,a]),ne=(0,h.useCallback)(e=>{C(jk(e)),C(Qk({handler:u,reactEvent:e}))},[C,u]),re=(0,h.useCallback)(e=>{C(Px()),C(Qk({handler:d,reactEvent:e}))},[C,d]),ae=(0,h.useCallback)(e=>{C(jk(e)),C(Qk({handler:f,reactEvent:e}))},[C,f]),M=(0,h.useCallback)(()=>{C(Gk())},[C]),oe=(0,h.useCallback)(()=>{C(Kk())},[C]),se=(0,h.useCallback)(e=>{C(Wk(e.key))},[C]),ce=(0,h.useCallback)(e=>{C(Qk({handler:o,reactEvent:e}))},[C,o]),le=(0,h.useCallback)(e=>{C(Qk({handler:s,reactEvent:e}))},[C,s]),ue=(0,h.useCallback)(e=>{C(Qk({handler:l,reactEvent:e}))},[C,l]),de=(0,h.useCallback)(e=>{C(Qk({handler:p,reactEvent:e}))},[C,p]),fe=(0,h.useCallback)(e=>{C(Qk({handler:_,reactEvent:e}))},[C,_]),pe=(0,h.useCallback)(e=>{x&&C(iA(e)),C(Qk({handler:g,reactEvent:e}))},[C,x,g]),me=(0,h.useCallback)(e=>{C(Qk({handler:m,reactEvent:e}))},[C,m]),he=WA(b);return h.createElement(XC.Provider,{value:w},h.createElement(ie.Provider,{value:E},h.createElement(he,{width:ee??v?.width,height:te??v?.height,className:c(`recharts-wrapper`,r),style:NA({position:`relative`,cursor:`default`,width:ee,height:te},v),onClick:j,onContextMenu:ce,onDoubleClick:le,onFocus:M,onBlur:oe,onKeyDown:se,onMouseDown:ue,onMouseEnter:ne,onMouseLeave:re,onMouseMove:ae,onMouseUp:de,onTouchEnd:me,onTouchMove:pe,onTouchStart:fe,ref:A},h.createElement(RA,null),n)))}),KA=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function qA(e,t){if(e==null)return{};var n,r,i=JA(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var{width:n,height:r,responsive:i,children:a,className:o,style:s,compact:c,title:l,desc:u}=e,d=S(qA(e,KA));return c?h.createElement(h.Fragment,null,h.createElement(Qc,{width:n,height:r}),h.createElement(AA,{otherAttributes:d,title:l,desc:u},a)):h.createElement(GA,{className:o,style:s,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},h.createElement(AA,{otherAttributes:d,title:l,desc:u,ref:t},h.createElement(TO,null,a)))});function XA(){return XA=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);return e}function cj({id:e,className:t,children:n,config:r,initialDimension:i=aj,...a}){let o=h.useId(),c=`chart-${e??o.replace(/:/g,``)}`;return(0,$.jsx)(oj.Provider,{value:{config:r},children:(0,$.jsxs)(`div`,{className:s(`flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-hidden [&_.recharts-surface]:outline-hidden`,t),"data-chart":c,"data-slot":`chart`,...a,children:[(0,$.jsx)(lj,{config:r,id:c}),(0,$.jsx)(Bc,{initialDimension:i,children:n})]})})}var lj=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme??e.color);return n.length?(0,$.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(ij).map(([t,r])=>` ${r} [data-chart=${e}] { ${n.map(([e,n])=>{let r=n.theme?.[t]??n.color;return r?` --color-${e}: ${r};`:null}).join(` `)} } `).join(` -`)}}):null},uj=Nw;function dj({active:e,payload:t,className:n,indicator:r=`dot`,hideLabel:i=!1,hideIndicator:a=!1,label:s,labelFormatter:c,labelClassName:l,formatter:u,color:d,nameKey:f,labelKey:p}){let{config:m}=sj(),g=h.useMemo(()=>{if(i||!t?.length)return null;let[e]=t,n=`${p??e?.dataKey??e?.name??`value`}`,r=mj(m,e,n),a=!p&&typeof s==`string`?m[s]?.label??s:r?.label;return c?(0,$.jsx)(`div`,{className:o(`font-medium`,l),children:c(a,t)}):a?(0,$.jsx)(`div`,{className:o(`font-medium`,l),children:a}):null},[s,c,t,i,l,m,p]);if(!(e&&t?.length))return null;let _=t.length===1&&r!==`dot`;return(0,$.jsxs)(`div`,{className:o(`grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl`,n),children:[_?null:g,(0,$.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let n=`${f??e.name??e.dataKey??`value`}`,i=mj(m,e,n),s=d??e.payload?.fill??e.color;return(0,$.jsx)(`div`,{className:o(`flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground`,r===`dot`&&`items-center`),children:u&&e?.value!==void 0&&e.name?u(e.value,e.name,e,t,e.payload):(0,$.jsxs)($.Fragment,{children:[i?.icon?(0,$.jsx)(i.icon,{}):!a&&(0,$.jsx)(`div`,{className:o(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,{"h-2.5 w-2.5":r===`dot`,"my-0.5":_&&r===`dashed`,"w-0 border-[1.5px] border-dashed bg-transparent":r===`dashed`,"w-1":r===`line`}),style:{"--color-bg":s,"--color-border":s}}),(0,$.jsxs)(`div`,{className:o(`flex flex-1 justify-between leading-none`,_?`items-end`:`items-center`),children:[(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[_?g:null,(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:i?.label??e.name})]}),e.value!=null&&(0,$.jsx)(`span`,{className:`font-medium font-mono text-foreground tabular-nums`,children:typeof e.value==`number`?e.value.toLocaleString():String(e.value)})]})]})},n)})})]})}var fj=Lu;function pj({className:e,hideIcon:t=!1,payload:n,verticalAlign:r=`bottom`,nameKey:i}){let{config:a}=sj();return n?.length?(0,$.jsx)(`div`,{className:o(`flex items-center justify-center gap-4`,r===`top`?`pb-3`:`pt-3`,e),children:n.filter(e=>e.type!==`none`).map(e=>{let n=`${i??e.dataKey??`value`}`,r=mj(a,e,n);return(0,$.jsxs)(`div`,{className:o(`flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground`),children:[r?.icon&&!t?(0,$.jsx)(r.icon,{}):(0,$.jsx)(`div`,{className:`h-2 w-2 shrink-0 rounded-[2px]`,style:{backgroundColor:e.color}}),r?.label]},n)})}):null}function mj(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}export{xm as $,QT as A,L as At,by as B,re as Bt,TD as C,Ws as Ct,FE as D,V as Dt,dD as E,Cs as Et,Yw as F,F as Ft,gx as G,_x as H,S as Ht,nw as I,P as It,vy as J,Ay as K,BC as L,Bt as Lt,rE as M,vn as Mt,PT as N,Jt as Nt,bE as O,R as Ot,CT as P,Vt as Pt,dx as Q,sC as R,Qt as Rt,LD as S,Ms as St,fD as T,As as Tt,$y as U,C as Ut,mx as V,w as Vt,hx as W,m as Wt,ux as X,ix as Y,xy as Z,KD as _,fc as _t,dj as a,Sf as at,JD as b,js as bt,XO as c,yu as ct,OO as d,Kc as dt,rm as et,DO as f,Jc as ft,qD as g,mc as gt,WD as h,bc as ht,uj as i,Cf as it,fE as j,wn as jt,TE as k,I as kt,VO as l,U as lt,nO as m,Wc as mt,fj as n,Qp as nt,rj as o,Td as ot,uO as p,Gc as pt,lx as q,pj as r,jp as rt,Tk as s,ed as st,cj as t,$p as tt,BO as u,Yc as ut,YD as v,Hs as vt,gD as w,H as wt,$D as x,Fs as xt,GD as y,Is as yt,_y as z,It as zt}; \ No newline at end of file +`)}}):null},uj=Nw;function dj({active:e,payload:t,className:n,indicator:r=`dot`,hideLabel:i=!1,hideIndicator:a=!1,label:o,labelFormatter:c,labelClassName:l,formatter:u,color:d,nameKey:f,labelKey:p}){let{config:m}=sj(),g=h.useMemo(()=>{if(i||!t?.length)return null;let[e]=t,n=`${p??e?.dataKey??e?.name??`value`}`,r=mj(m,e,n),a=!p&&typeof o==`string`?m[o]?.label??o:r?.label;return c?(0,$.jsx)(`div`,{className:s(`font-medium`,l),children:c(a,t)}):a?(0,$.jsx)(`div`,{className:s(`font-medium`,l),children:a}):null},[o,c,t,i,l,m,p]);if(!(e&&t?.length))return null;let _=t.length===1&&r!==`dot`;return(0,$.jsxs)(`div`,{className:s(`grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl`,n),children:[_?null:g,(0,$.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let n=`${f??e.name??e.dataKey??`value`}`,i=mj(m,e,n),o=d??e.payload?.fill??e.color;return(0,$.jsx)(`div`,{className:s(`flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground`,r===`dot`&&`items-center`),children:u&&e?.value!==void 0&&e.name?u(e.value,e.name,e,t,e.payload):(0,$.jsxs)($.Fragment,{children:[i?.icon?(0,$.jsx)(i.icon,{}):!a&&(0,$.jsx)(`div`,{className:s(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,{"h-2.5 w-2.5":r===`dot`,"my-0.5":_&&r===`dashed`,"w-0 border-[1.5px] border-dashed bg-transparent":r===`dashed`,"w-1":r===`line`}),style:{"--color-bg":o,"--color-border":o}}),(0,$.jsxs)(`div`,{className:s(`flex flex-1 justify-between leading-none`,_?`items-end`:`items-center`),children:[(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[_?g:null,(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:i?.label??e.name})]}),e.value!=null&&(0,$.jsx)(`span`,{className:`font-medium font-mono text-foreground tabular-nums`,children:typeof e.value==`number`?e.value.toLocaleString():String(e.value)})]})]})},n)})})]})}var fj=Lu;function pj({className:e,hideIcon:t=!1,payload:n,verticalAlign:r=`bottom`,nameKey:i}){let{config:a}=sj();return n?.length?(0,$.jsx)(`div`,{className:s(`flex items-center justify-center gap-4`,r===`top`?`pb-3`:`pt-3`,e),children:n.filter(e=>e.type!==`none`).map(e=>{let n=`${i??e.dataKey??`value`}`,r=mj(a,e,n);return(0,$.jsxs)(`div`,{className:s(`flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground`),children:[r?.icon&&!t?(0,$.jsx)(r.icon,{}):(0,$.jsx)(`div`,{className:`h-2 w-2 shrink-0 rounded-[2px]`,style:{backgroundColor:e.color}}),r?.label]},n)})}):null}function mj(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}export{xm as $,QT as A,L as At,by as B,re as Bt,TD as C,Ws as Ct,FE as D,V as Dt,dD as E,Cs as Et,Yw as F,F as Ft,gx as G,_x as H,S as Ht,nw as I,P as It,vy as J,Ay as K,BC as L,Bt as Lt,rE as M,vn as Mt,PT as N,Jt as Nt,bE as O,R as Ot,CT as P,Vt as Pt,dx as Q,sC as R,Qt as Rt,LD as S,Ms as St,fD as T,As as Tt,$y as U,C as Ut,mx as V,w as Vt,hx as W,m as Wt,ux as X,ix as Y,xy as Z,KD as _,fc as _t,dj as a,Sf as at,JD as b,js as bt,XO as c,yu as ct,OO as d,Kc as dt,rm as et,DO as f,Jc as ft,qD as g,mc as gt,WD as h,bc as ht,uj as i,Cf as it,fE as j,wn as jt,TE as k,I as kt,VO as l,U as lt,nO as m,Wc as mt,fj as n,Qp as nt,rj as o,Td as ot,uO as p,Gc as pt,lx as q,pj as r,jp as rt,Tk as s,ed as st,cj as t,$p as tt,BO as u,Yc as ut,YD as v,Hs as vt,gD as w,H as wt,$D as x,Fs as xt,GD as y,Is as yt,_y as z,It as zt}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/chevron-right-Dqi3i9r9.js b/go/headgateui/dist/assets/chevron-right-Dqi3i9r9.js deleted file mode 100644 index 439ecae..0000000 --- a/go/headgateui/dist/assets/chevron-right-Dqi3i9r9.js +++ /dev/null @@ -1 +0,0 @@ -import{X as e}from"./console-C2t3Lr2f.js";var t=e(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),n=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t as n,n as t}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/clock-3-CrAcdu0a.js b/go/headgateui/dist/assets/clock-3-CBdsf5xL.js similarity index 60% rename from go/headgateui/dist/assets/clock-3-CrAcdu0a.js rename to go/headgateui/dist/assets/clock-3-CBdsf5xL.js index 0483cc0..ebdc154 100644 --- a/go/headgateui/dist/assets/clock-3-CrAcdu0a.js +++ b/go/headgateui/dist/assets/clock-3-CBdsf5xL.js @@ -1 +1 @@ -import{X as e}from"./console-C2t3Lr2f.js";var t=e(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]);export{t}; \ No newline at end of file +import{X as e}from"./console-COYwGlau.js";var t=e(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]);export{t}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/console-C2t3Lr2f.js b/go/headgateui/dist/assets/console-C2t3Lr2f.js deleted file mode 100644 index f0705cb..0000000 --- a/go/headgateui/dist/assets/console-C2t3Lr2f.js +++ /dev/null @@ -1 +0,0 @@ -import{c as e,d as t,i as n,o as r,t as i}from"./utils-o8v-URZ_.js";import{$ as a,$t as o,A as s,At as c,B as l,Bn as u,Bt as d,C as f,Cn as p,Ct as m,D as h,Dn as g,Dt as _,E as v,Et as y,F as b,Fn as x,Ft as S,G as C,Gn as w,Gt as T,H as E,Ht as D,I as O,In as k,J as A,Jn as j,Jt as ee,K as M,Kt as N,L as te,Ln as P,M as F,Mn as I,Mt as L,N as R,Nt as z,O as B,Ot as ne,P as V,Pn as H,Pt as U,Q as W,Qt as re,R as G,Rn as ie,Rt as ae,S as oe,Sn as K,St as se,T as ce,Tn as le,Tt as ue,U as de,Un as fe,Ut as pe,V as me,Vn as he,Vt as ge,W as _e,Wt as q,X as J,Xn as ve,Xt as ye,Y as be,Yt as xe,Z as Se,Zn as Ce,Zt as we,_ as Te,_t as Ee,an as De,at as Oe,b as ke,bn as Ae,bt as Y,c as je,cn as Me,ct as Ne,d as Pe,dn as Fe,dt as Ie,en as Le,et as Re,f as ze,fn as X,ft as Be,g as Ve,gn as He,gt as Ue,h as We,hn as Ge,ht as Ke,i as qe,in as Je,it as Ye,j as Xe,jt as Ze,k as Qe,kn as $e,kt as et,ln as tt,lt as nt,m as rt,mn as it,mt as at,n as ot,nn as st,nt as ct,o as lt,on as ut,ot as dt,p as ft,pn as pt,pt as mt,q as ht,qt as gt,r as _t,rn as vt,rt as yt,s as bt,sn as xt,st as St,t as Ct,tn as wt,tt as Tt,u as Et,un as Dt,ut as Ot,v as kt,vn as At,vt as jt,w as Mt,wn as Nt,wt as Pt,x as Ft,xt as It,y as Lt,yt as Rt,z as zt,zt as Bt}from"./theme-6NkSfuJL.js";function Vt(e){let t=n({warn:e?.router===void 0}),r=e?.router||t;return Ce(r.stores.__store,ve(e,r))}var Ht=class extends Nt{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Wt(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Gt(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Gt(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof k(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!P(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Kt(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||k(this.options.staleTime,this.#t)!==k(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return P(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(I)),t}#h(e){return!le()&&k(this.options.enabled,this.#t)!==!1&&$e(e)}#g(){this.#b();let e=k(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=u(this.#r.dataUpdatedAt,e)+1;this.#u=he.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=he.setInterval(()=>{(this.options.refetchIntervalInBackground||p.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(he.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(he.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Wt(e,t),o=i&&Kt(e,n,t,r);(a||o)&&(l={...l,...Ae(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=H(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=H(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:qt(e,t),refetch:this.refetch,isEnabled:k(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),P(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();K.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Ut(e,t){return k(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||k(t.retryOnMount,e)!==!1)}function Wt(e,t){return Ut(e,t)||e.state.data!==void 0&&Gt(e,t,t.refetchOnMount)}function Gt(e,t,n){if(k(t.enabled,e)!==!1&&k(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&qt(e,t)}return!1}function Kt(e,t,n,r){return(e!==t||k(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&qt(e,n)}function qt(e,t){return k(t.enabled,e)!==!1&&e.isStaleByTime(k(t.staleTime,e))}var Jt=class extends Nt{#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),P(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&g(t.mutationKey)!==g(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??At();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){K.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)})})}};function Yt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var Xt=class extends Nt{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,K.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!P(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Yt(e,n).forEach(e=>{e.destroy()}),Yt(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=x(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Ht(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&K.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Z=t(e(),1),Zt=Z.createContext(!1),Qt=()=>Z.useContext(Zt);Zt.Provider;var Q=r();function $t(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var en=Z.createContext($t()),tn=()=>Z.useContext(en),nn=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ie(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},rn=e=>{Z.useEffect(()=>{e.clearReset()},[e])},an=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ie(n,[e.error,r])),on=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},sn=(e,t)=>e?.suspense&&t.isPending,cn=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ln({queries:e,...t},n){let r=fe(n),i=Qt(),a=tn(),o=t.subscribed!==!1,s=Z.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{on(e);let t=r.getQueryCache().get(e.queryHash);nn(e,a,t)}),rn(a);let[c]=Z.useState(()=>new Xt(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;Z.useSyncExternalStore(Z.useCallback(e=>f?c.subscribe(K.batchCalls(e)):I,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),Z.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>sn(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&sn(n,e)?cn(n,new Ht(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&an({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m)throw m.error;return u(d())}function un(e,t,n){let r=Qt(),i=tn(),a=fe(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,on(o),nn(o,i,s),rn(i);let[l]=Z.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(Z.useSyncExternalStore(Z.useCallback(e=>{let t=d?l.subscribe(K.batchCalls(e)):I;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),Z.useEffect(()=>{l.setOptions(o)},[o,l]),sn(o,u))throw cn(o,l,i);if(an({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function dn(e,t){return un(e,Ht,t)}function fn(e,t){let n=fe(t),[r]=Z.useState(()=>new Jt(n,e));Z.useEffect(()=>{r.setOptions(e)},[r,e]);let i=Z.useSyncExternalStore(Z.useCallback(e=>r.subscribe(K.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=Z.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(I)},[r]);if(i.error&&ie(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var pn=0;function mn(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(pn);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),Ge;let o=requestAnimationFrame(a);return pn=o,()=>{pn===o&&(cancelAnimationFrame(o),pn=0)}}var hn={inert:new WeakMap,"aria-hidden":new WeakMap},gn=`data-base-ui-inert`,_n={inert:new WeakSet,"aria-hidden":new WeakSet},vn=new WeakMap,yn=0;function bn(e){return _n[e]}function xn(e){return e?wt(e)?e.host:xn(e.parentNode):null}var Sn=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=xn(t);return e.contains(n)?n:null}).filter(e=>e!=null),Cn=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},wn=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{ye(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function Tn(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=Sn(t,e),l=i?wn(t,Cn(c),new Set(c)):[],u=[],d=[];if(a){let e=hn[a],n=bn(a);s=n,o=e;let r=Sn(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);wn(t,Cn(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(vn.get(e)||0)+1;vn.set(e,t),d.push(e),t===1&&e.setAttribute(gn,``)}),yn+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(vn.get(e)||0)-1;vn.set(e,t),t||e.removeAttribute(gn)}),--yn,yn||(hn.inert=new WeakMap,hn[`aria-hidden`]=new WeakMap,_n.inert=new WeakSet,_n[`aria-hidden`]=new WeakSet,vn=new WeakMap)}}function En(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=Y(e[0]).body;return Tn(e,a,n,r,{mark:i})}function Dn(e,t){let n=we(T(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var On=20,kn=[];function An(){kn=kn.filter(e=>e.deref()?.isConnected)}function jn(e){An(),e&&ye(e)!==`body`&&(kn.push(new WeakRef(e)),kn.length>On&&(kn=kn.slice(-20)))}function Mn(){return An(),kn[kn.length-1]?.deref()}function Nn(e){return e?Ne(e)?e:nt(e)[0]||e:null}function Pn(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=Ye(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Ne(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function Fn(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,nextFocusableElement:f,previousFocusableElement:p,beforeContentFocusGuardRef:h,externalTree:g,getInsideElements:v}=e,b=`rootStore`in t?t.rootStore:t,x=b.useState(`open`),S=b.useState(`domReferenceElement`),w=b.useState(`floatingElement`),{events:E,dataRef:O}=b.context,k=m(()=>O.current.floatingContext?.nodeId),A=i===!1,j=ge(S)&&A,ee=Pt(i),M=Pt(a),N=Pt(u),te=Pt(x),P=C(g),F=ht(),I=Z.useRef(!1),L=Z.useRef(!1),R=Z.useRef(!1),z=Z.useRef(null),B=Z.useRef(``),V=Z.useRef(``),H=Z.useRef(null),U=Z.useRef(null),W=ue(H,h,F?.beforeInsideRef),re=ue(U,F?.afterInsideRef),G=Dt(),ie=Dt(),ae=se(),oe=F!=null,K=d(w),ce=m((e=K)=>e?nt(e):[]),le=m(()=>v?.().filter(e=>e!=null)??[]);Z.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&q(K,pe(Y(K)))&&ce().length===0&&!j&&De(e)}let t=Y(K);return _(t,`keydown`,e)},[r,K,c,j,ce]),Z.useEffect(()=>{if(r||!x)return;let e=Y(K);function t(){R.current=!1}function n(e){let t=T(e),n=le(),r=q(w,t)||q(S,t)||q(F?.portalNode,t)||n.some(e=>e===t||q(e,t));R.current=!r,V.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(L.current=!0,ie.start(0,()=>{L.current=!1}))}function i(){V.current=`keyboard`}return y(_(e,`pointerdown`,n,!0),_(e,`pointerup`,t,!0),_(e,`pointercancel`,t,!0),_(e,`keydown`,i,!0),t)},[r,w,S,K,x,F,ie,le]),Z.useEffect(()=>{if(r||!l)return;let e=Y(K);function t(){L.current=!0,ie.start(0,()=>{L.current=!1})}function n(e){let t=T(e);Ne(t)&&(z.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=T(t);c&&n==null&&i!=null&&q(w,i)&&jn(i),queueMicrotask(()=>{let a=k(),l=b.context.triggerElements,u=le(),m=n?.hasAttribute(Tt(`focus-guard`))&&[H.current,U.current,F?.beforeInsideRef.current,F?.afterInsideRef.current,F?.beforeOutsideRef.current,F?.afterOutsideRef.current,de(p),de(f)].includes(n),h=!(q(S,n)||q(w,n)||q(n,w)||q(F?.portalNode,n)||u.some(e=>e===n||q(e,n))||l.hasMatchingElement(e=>q(e,n))||m||P&&(yt(P.nodesRef.current,a).find(e=>q(e.context?.elements.floating,n)||q(e.context?.elements.domReference,n))||ct(P.nodesRef.current,a).find(e=>[e.context?.elements.floating,d(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===S&&K&&Pn(K),s&&r!==S&&!mt(i)&&pe(e)===e.body){if(o(K)&&(K.focus(),s===`popup`)){ae.request(()=>{K.focus()});return}let e=ce(),t=z.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||K;o(n)&&n.focus()}if(O.current.insideReactTree){O.current.insideReactTree=!1;return}(j||!c)&&n&&h&&!L.current&&(j||n!==Mn())&&(I.current=!0,b.setOpen(!1,ne(Ze,t)))})}function a(){R.current||(O.current.insideReactTree=!0,G.start(0,()=>{O.current.insideReactTree=!1}))}let u=o(S)?S:null;if(!(!w&&!u))return y(u&&_(u,`focusout`,i),u&&_(u,`pointerdown`,t),w&&_(w,`focusin`,n),w&&_(w,`focusout`,i),w&&F&&_(w,`focusout`,a,!0))},[r,S,w,K,c,P,F,b,l,s,ce,j,k,O,G,ie,ae,f,p,le]),Z.useEffect(()=>{if(r||!w||!x)return;let e=Array.from(F?.portalNode?.querySelectorAll(`[${Tt(`portal`)}]`)||[]),t=(P?ct(P.nodesRef.current,k()):[]).find(e=>ge(e.context?.elements.domReference||null))?.context?.elements.domReference,n=En([w,...e,H.current,U.current,F?.beforeOutsideRef.current,F?.afterOutsideRef.current,...le(),t,de(p),de(f),j?S:null].filter(e=>e!=null),{ariaHidden:c||j,mark:!1}),i=En([w,...e].filter(e=>e!=null));return()=>{i(),n()}},[x,r,S,w,c,F,j,P,k,f,p,le]),X(()=>{if(!x||r||!o(K))return;B.current=``,V.current=``;let e=Y(K),t=pe(e);queueMicrotask(()=>{let n=ee.current,r=typeof n==`function`?n(N.current||``):n;if(r===void 0||r===!1||q(K,t))return;let i=null,a=()=>(i??=ce(K),i[0]||K),o;o=r===!0||r===null?a():de(r),o||=a();let s=q(K,pe(e));mn(o,{preventScroll:o===K,shouldFocus(){if(!te.current)return!1;if(s)return!0;let t=pe(e);return!(t!==o&&q(K,t))}})})},[r,x,K,ce,ee,N,te]),X(()=>{if(r||!K)return;let e=Y(K),t=pe(e),n=N.current==null;jn(t);function i(e){if(e.open||(B.current=Dn(e.nativeEvent,V.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(I.current=!0),e.reason===`outside-press`){if(e.nested)I.current=!1;else if(vt(e.nativeEvent)||Je(e.nativeEvent))I.current=!1;else{let e=!1;Y(K).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?I.current=!1:I.current=!0}}}E.on(`openchange`,i);function a(e){let r=M.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=S?.isConnected?S:null,o=t?.isConnected&&ye(t)!==`body`?t:null,s=n?o||a:a||o;return s||=Mn()||null,typeof i==`boolean`?s:de(i)||s||null}return()=>{E.off(`openchange`,i);let t=pe(e),n=le(),r=q(w,t)||n.some(e=>e===t||q(e,t))||P&&yt(P.nodesRef.current,k(),!1).some(e=>q(e.context?.elements.floating,t)),s=M.current,c=B.current,l=a(c);queueMicrotask(()=>{let n=Nn(l),i=typeof s!=`boolean`;if(s&&!I.current&&o(n)&&(!(!i&&n!==t&&t!==e.body)||r)){let e={preventScroll:!0};c===`keyboard`&&(e.focusVisible=!0),n.focus(e)}I.current=!1})}},[r,w,K,M,N,E,P,S,k,le]),X(()=>{if(!xt||x||!w)return;let e=pe(Y(w));!o(e)||!D(e)||q(w,e)&&e.blur()},[x,w]),X(()=>{if(!(r||!F))return F.setFocusManagerState({modal:c,closeOnFocusOut:l,open:x,onOpenChange:b.setOpen,domReference:S}),()=>{F.setFocusManagerState(null)}},[r,F,c,x,b,l,S]),X(()=>{if(!(r||!K))return Pn(K),()=>{queueMicrotask(An)}},[r,K]);let fe=!r&&(!c||!j)&&(oe||c);return(0,Q.jsxs)(Z.Fragment,{children:[fe&&(0,Q.jsx)(Ee,{"data-type":`inside`,ref:W,onFocus:e=>{if(c){let e=ce();mn(e[e.length-1])}else F?.portalNode&&(I.current=!1,St(e,F.portalNode)?Oe(S)?.focus():de(p??F.beforeOutsideRef)?.focus())}}),n,fe&&(0,Q.jsx)(Ee,{"data-type":`inside`,ref:re,onFocus:e=>{c?mn(ce()[0]):F?.portalNode&&(l&&(I.current=!0),St(e,F.portalNode)?dt(S)?.focus():de(f??F.afterOutsideRef)?.focus())}})]})}function In(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=ae}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=Z.useRef(void 0),f=se(),p=Dt(),m=Z.useMemo(()=>{function e(e,t,n,r){let i=ne(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=st(e.pointerType,!0)&&Je(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||st(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=T(o);if(D(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}st(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return Z.useMemo(()=>n?{reference:m}:it,[n,m])}function Ln(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=Re(),a=_e()!=null,o=He(()=>new G({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new ce,floatingId:i,syncOnly:!1,nested:a})).current;return X(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=re(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}var Rn=`Escape`;function zn(e){return xt&&e.movementX===0&&e.movementY===0}function Bn(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Vn(e,t){return Bn(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Hn(e,t,n){return Bn(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Un(e,t,n){return Bn(t,n?e===gt:e===ee,e===N)}function Wn(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===Rn:Bn(t,n?e===ee:e===gt,e===xe)}function Gn(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:s=null,allowEscape:c=!1,loopFocus:l=!1,nested:u=!1,rtl:f=!1,virtual:p=!1,focusItemOnOpen:h=`auto`,focusItemOnHover:g=!0,openOnArrowKeyDown:_=!0,disabledIndices:v=void 0,orientation:y=`vertical`,parentOrientation:b,id:x,resetOnPointerLeave:S=!0,externalTree:w,grid:E}=t,D=E!=null,O=`rootStore`in e?e.rootStore:e,k=O.useState(`open`),A=O.useState(`floatingElement`),j=O.useState(`domReferenceElement`),ee=O.context.dataRef,M=d(A),N=ge(j),te=Pt(M),P=_e(),F=C(w),I=Z.useRef(h),L=Z.useRef(s??-1),R=Z.useRef(null),z=Z.useRef(!0),B=m(e=>{i(L.current===-1?null:L.current,e)}),V=Z.useRef(!!A),H=Z.useRef(k),W=Z.useRef(!1),re=Z.useRef(!1),G=Z.useRef(null),ie=Pt(v),ae=Pt(k),oe=Pt(s),K=Pt(S),ce=se(),le=se(),ue=m(()=>{function e(e){p?F?.events.emit(`virtualfocus`,e):G.current=mn(e,{sync:W.current,preventScroll:!0})}let t=n.current[L.current],r=re.current;t&&e(t),(W.current?e=>e():e=>ce.request(e))(()=>{let i=n.current[L.current]||t;i&&(t||e(i),ve&&(r||!z.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});X(()=>{ee.current.orientation=y},[ee,y]),X(()=>{a&&(k&&A?(L.current=s??-1,I.current&&s!=null&&(re.current=!0,B())):V.current&&(L.current=-1,B()))},[a,k,A,s,B]),X(()=>{if(a){if(!k){W.current=!1;return}if(A){if(r==null){if(W.current=!1,oe.current!=null)return;if(V.current&&(L.current=-1,ue()),(!H.current||!V.current)&&I.current&&(R.current!=null||I.current===!0&&R.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>le.request(e):queueMicrotask)(t),e+=1):(L.current=R.current==null||Hn(R.current,y,f)||u?Be(n):Ie(n),R.current=null,B())};t()}}else at(n.current,r)||(L.current=r,ue(),re.current=!1)}}},[a,k,A,r,oe,u,n,y,f,B,ue,le]),X(()=>{if(!a||A||!F||p||!V.current)return;let e=F.nodesRef.current,t=e.find(e=>e.id===P)?.context?.elements.floating,n=pe(Y(j??t??null)),r=e.some(e=>e.context&&q(e.context.elements.floating,n));t&&!r&&z.current&&t.focus({preventScroll:!0})},[a,A,j,F,P,p]),X(()=>{H.current=k,V.current=!!A}),X(()=>{k||(R.current=null,I.current=h)},[k,h]);let de=r!=null,fe=m(e=>{if(!ae.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(L.current!==t||r!==t)&&(L.current=t,B(e))}),me=m(()=>b??F?.nodesRef.current.find(e=>e.id===P)?.context?.dataRef?.current.orientation),he=m(()=>Be(n,ie.current)),J=m(e=>{if(z.current=!1,W.current=!0,e.which===229||!ae.current&&e.currentTarget===te.current)return;if(u&&Wn(e.key,y,f,D)){Vn(e.key,me())||De(e),O.setOpen(!1,ne(U,e.nativeEvent)),o(j)&&(p?F?.events.emit(`virtualfocus`,j):j.focus());return}let t=L.current,r=Be(n,v),i=Ie(n,v);if(N||(e.key===`Home`&&(De(e),L.current=r,B(e)),e.key===`End`&&(De(e),L.current=i,B(e))),E!=null){let t=E(e,L.current,n,y,l,f,v,r,i);if(t!=null&&(L.current=t,B(e)),y===`both`)return}if(Vn(e.key,y)){if(De(e),k&&!p&&pe(e.currentTarget.ownerDocument)===e.currentTarget){L.current=Hn(e.key,y,f)?r:i,B(e);return}Hn(e.key,y,f)?l?t>=i?c&&t!==n.current.length?L.current=-1:(W.current=!1,L.current=r):L.current=Ot(n.current,{startingIndex:t,disabledIndices:v}):L.current=Math.min(i,Ot(n.current,{startingIndex:t,disabledIndices:v})):l?t<=r?c&&t!==-1?L.current=n.current.length:(W.current=!1,L.current=i):L.current=Ot(n.current,{startingIndex:t,decrement:!0,disabledIndices:v}):L.current=Math.max(r,Ot(n.current,{startingIndex:t,decrement:!0,disabledIndices:v})),at(n.current,L.current)&&(L.current=-1),B(e)}}),ve=Z.useMemo(()=>({onFocus(e){W.current=!0,fe(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){zn(e)||(W.current=!0,re.current=!1,g&&fe(e))},onPointerLeave(e){if(!ae.current||!z.current||e.pointerType===`touch`)return;W.current=!0;let t=e.relatedTarget;if(!(!g||n.current.includes(t))&&K.current&&(G.current?.(),G.current=null,L.current=-1,B(e),!p)){let e=te.current,t=pe(Y(e));e&&q(e,t)&&e.focus({preventScroll:!0})}}}),[fe,ae,te,g,n,B,K,p]),ye=Z.useMemo(()=>p&&k&&de&&{"aria-activedescendant":`${x}-${r}`},[p,k,de,x,r]),be=Z.useMemo(()=>({"aria-orientation":y===`both`?void 0:y,...N?{}:ye,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&k&&!p){let t=T(e.nativeEvent);if(t&&!q(te.current,t))return;De(e),O.setOpen(!1,ne(Ze,e.nativeEvent)),o(j)&&j.focus();return}J(e)},onPointerMove(e){zn(e)||(z.current=!0)}}),[ye,J,te,y,N,O,k,p,j]),xe=Z.useMemo(()=>{function e(e){O.setOpen(!0,ne(U,e.nativeEvent,e.currentTarget))}function t(e){h===`auto`&&vt(e.nativeEvent)&&(I.current=!p)}function n(e){I.current=h,h===`auto`&&Je(e.nativeEvent)&&(I.current=!0)}return{onKeyDown(t){let n=O.select(`open`);z.current=!1;let r=t.key.startsWith(`Arrow`),i=Un(t.key,me(),f),a=Vn(t.key,y),o=(u?i:a)||t.key===`Enter`||t.key.trim()===``;if(p&&n)return J(t);if(!(!n&&!_&&r)){if(o){let e=Vn(t.key,me());R.current=u&&e?null:t.key}if(u){i&&(De(t),n?(L.current=he(),B(t)):e(t));return}a&&(oe.current!=null&&(L.current=oe.current),De(t),!n&&_?e(t):J(t),n&&B(t))}},onFocus(e){O.select(`open`)&&!p&&(L.current=-1,B(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[J,h,he,u,B,O,_,y,me,f,oe,p]),Se=Z.useMemo(()=>({...ye,...xe}),[ye,xe]);return Z.useMemo(()=>a?{reference:Se,floating:be,item:ve,trigger:xe}:{},[a,Se,be,xe,ve])}function Kn(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=Dt(),h=Z.useRef(``),g=Z.useRef(u??i??-1),_=Z.useRef(null),v=m(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!mt(n)||n?.matches(`:disabled`)?!1:o==null||!Ke(pt,e,o)}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t0&&e.key===` `&&(De(e),s?.(!0)),h.current.length>0&&h.current[0]!==` `&&d(m,h.current)===-1&&e.key!==` `&&s?.(!1),m==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(De(e),s?.(!0));let v=h.current===``;v&&(g.current=u??i??-1),m.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&h.current===e.key&&(h.current=``,g.current=_.current),h.current+=e.key,p.start(l,()=>{h.current=``,g.current=_.current,s?.(!1)});let y=((v?u??i??-1:g.current)??0)+1,b=d(m,h.current,y);b===-1?e.key!==` `&&(h.current=``,s?.(!1)):(a?.(b),_.current=b)}),y=m(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);q(n,t)||q(r,t)||(p.clear(),h.current=``,g.current=_.current,s?.(!1))});X(()=>{!f&&u!==null||(p.clear(),_.current=null,h.current!==``&&(h.current=``))},[f,u,p]);let b=Z.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]);return Z.useMemo(()=>c?{reference:b,floating:b}:{},[c,b])}function qn(e){return a(19)?e:e?`true`:void 0}function Jn(e){let[t,n]=Z.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}var Yn=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Xn=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Zn=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Qn=e=>{let t=Zn(e);return t.charAt(0).toUpperCase()+t.slice(1)},$n={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},er=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},tr=(0,Z.createContext)({}),nr=()=>(0,Z.useContext)(tr),rr=(0,Z.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=nr()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,Z.createElement)(`svg`,{ref:c,...$n,width:t??l??$n.width,height:t??l??$n.height,stroke:e??f,strokeWidth:m,className:Yn(`lucide`,p,i),...!a&&!er(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,Z.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),ir=(e,t)=>{let n=(0,Z.forwardRef)(({className:n,...r},i)=>(0,Z.createElement)(rr,{ref:i,iconNode:t,className:Yn(`lucide-${Xn(Qn(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Qn(e),n},ar=ir(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),or=ir(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338`,key:`7hb8p4`}],[`path`,{d:`M3 9h5.859`,key:`numkqi`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),sr=ir(`chart-no-axes-combined`,[[`path`,{d:`M12 16v5`,key:`zza2cw`}],[`path`,{d:`M16 14.639V21`,key:`1s85h0`}],[`path`,{d:`M20 10.656V21`,key:`q45596`}],[`path`,{d:`m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15`,key:`1fw8x9`}],[`path`,{d:`M4 18.463V21`,key:`1otddq`}],[`path`,{d:`M8 14.656V21`,key:`1t2idw`}]]),cr=ir(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),lr=ir(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),ur=ir(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),dr=ir(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),fr=ir(`git-fork`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),pr=ir(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),mr=ir(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),hr=ir(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),gr=ir(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),_r=ir(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),vr=ir(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),yr=ir(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),br=ir(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function xr(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e==`boolean`?`${e}`:e===0?`0`:e,wr=Sr,Tr=(e,t)=>n=>{if(t?.variants==null)return wr(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Cr(t)||Cr(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return wr(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Er=Tr(`inline-flex h-5 w-fit items-center rounded-full px-2 font-medium text-xs`,{defaultVariants:{variant:`secondary`},variants:{variant:{default:`bg-primary text-primary-foreground`,destructive:`bg-destructive/10 text-destructive`,outline:`border border-border text-foreground`,secondary:`bg-muted text-muted-foreground`,success:`bg-success/10 text-success`,warning:`bg-warning/10 text-warning`}}});function Dr({className:e,variant:t,...n}){return(0,Q.jsx)(`span`,{className:i(Er({variant:t}),e),...n})}function Or(e){return J(e.defaultTagName??`div`,e,e)}var kr=Z.createContext(void 0);function Ar(e=!1){let t=Z.useContext(kr);if(t===void 0&&!e)throw Error(Fe(16));return t}function jr(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:Z.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function Mr(e,t,{detail:n=0}={}){e.dispatchEvent(new(we(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Nr(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=Z.useRef(null),s=Ar(!0),c=a??s!==void 0,{props:l}=jr({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=Z.useCallback(()=>{let e=o.current;Pr(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return X(u,[u]),{getButtonProps:Z.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return W({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(Se(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=Pr(r),s=!i&&Fr(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),Mr(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),Mr(r,e)))},onKeyUp(e){if(!t){if(Se(e),a?.(e),e.target===e.currentTarget&&i&&c&&Pr(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),Mr(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:m(e=>{o.current=e,u()})}}function Pr(e){return o(e)&&e.tagName===`BUTTON`}function Fr(e){return o(e)&&e.tagName===`A`&&!!e.href}var Ir=Z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=Nr({disabled:i,focusableWhenDisabled:a,native:o});return J(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),Lr=Tr(`group/button inline-flex shrink-0 select-none items-center justify-center whitespace-nowrap rounded-lg border border-transparent bg-clip-padding font-medium text-sm outline-none transition-[color,background-color,border-color,box-shadow,transform,opacity] duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:scale-[0.97] disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 motion-reduce:active:not-aria-[haspopup]:scale-100 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{defaultVariants:{size:`default`,variant:`default`},variants:{size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-lg":`size-9`,"icon-sm":`size-7 in-data-[slot=button-group]:rounded-lg rounded-[min(var(--radius-md),12px)]`,"icon-xs":`size-6 in-data-[slot=button-group]:rounded-lg rounded-[min(var(--radius-md),10px)] [&_svg:not([class*='size-'])]:size-3`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 gap-1 in-data-[slot=button-group]:rounded-lg rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,xs:`h-6 gap-1 in-data-[slot=button-group]:rounded-lg rounded-[min(var(--radius-md),10px)] px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`},variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 dark:hover:bg-destructive/30`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`}}});function Rr({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,Q.jsx)(Ir,{className:i(Lr({className:e,size:n,variant:t})),"data-slot":`button`,...r})}var zr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Br={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Vr={valid(e){return e===null?null:e?{"data-valid":``}:{"data-invalid":``}}},Hr={invalid:void 0,name:void 0,validityData:{state:zr,errors:[],error:``,value:``,initialValue:null},setValidityData:Ge,disabled:void 0,setTouched:Ge,setDirty:Ge,setFilled:Ge,setFocused:Ge,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:Br,registerFieldControl:Ge,validation:{getValidationProps:(e,t=it)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:Ge,getInputControl:()=>null,commit:async()=>{},change:Ge}},Ur=Z.createContext(Hr);function Wr(e=!0){let t=Z.useContext(Ur);if(t.setValidityData===Ge&&!e)throw Error(Fe(28));return t}var Gr=Z.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:Ge,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function Kr(){return Z.useContext(Gr)}var qr=Z.createContext({controlId:void 0,registerControlId:Ge,labelId:void 0,setLabelId:Ge,messageIds:[],setMessageIds:Ge,getDescriptionProps:e=>e});function Jr(){return Z.useContext(qr)}function Yr(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=Jr(),o=We(t),s=n?i:void 0,c=He(()=>Symbol()),l=Z.useRef(!1),u=Z.useRef(t!=null),d=m(()=>{!l.current||a===Ge||(l.current=!1,a(c.current,void 0))});return X(()=>{if(a===Ge)return;let e;if(n){let n=r?.current;e=re(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),Z.useEffect(()=>d,[d]),i??o}function Xr({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=Z.useRef(e!==void 0),[a,o]=Z.useState(t);return[i?e:a,Z.useCallback(e=>{i||o(e)},[])]}function Zr(e,t,n,r,i=!0,a){let{registerFieldControl:o}=Wr(),s=He(()=>Symbol());X(()=>{let c=s.current;if(!i){o(c,void 0);return}o(c,{controlRef:e,getValue:r,id:t,name:a,value:n})},[e,i,r,t,a,o,s,n]),X(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}var Qr=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:h,disabled:g,setTouched:_,setDirty:v,validityData:y,setFocused:b,setFilled:x,validationMode:C,validation:w}=Wr(),{clearErrors:T}=Kr(),E=g||s,D=h??a,O={...p,disabled:E},{labelId:k}=Jr(),A=Yr({id:i});X(()=>{let e=o!=null;w.inputRef.current?.value||e&&o!==``?x(!0):e&&o===``&&x(!1)},[w.inputRef,x,o]);let j=Z.useRef(null);X(()=>{u&&j.current===pe(Y(j.current))&&b(!0)},[u,b]);let[ee]=Xr({controlled:o,default:l,name:`FieldControl`,state:`value`}),M=o!==void 0,N=M?ee:void 0,te=m(()=>w.inputRef.current?.value);return Zr(w.inputRef,A,N,te,!E,a),J(`input`,e,{ref:[t,j],state:O,props:[{id:A,disabled:E,name:D,ref:w.inputRef,"aria-labelledby":k,autoFocus:u,...M?{value:N}:{defaultValue:l},onChange(e){let t=e.currentTarget.value;c?.(t,ne(S,e.nativeEvent)),v(t!==(y.initialValue??``)),x(t!==``),e.nativeEvent.defaultPrevented||(T(D),w.change(t))},onFocus(){b(!0)},onBlur(e){_(!0),b(!1),C===`onBlur`&&w.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(_(!0),w.commit(e.currentTarget.value))}},f,e=>w.getValidationProps(E,e)],stateAttributesMapping:Vr})}),$r=Z.forwardRef(function(e,t){return(0,Q.jsx)(Qr,{ref:t,...e})});function ei({className:e,type:t,...n}){return(0,Q.jsx)($r,{className:i(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base outline-none transition-colors file:inline-flex file:h-6 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:disabled:bg-input/80`,e),"data-slot":`input`,type:t,...n})}var ti=Z.createContext(void 0);function ni(e){let t=Z.useContext(ti);if(!e&&t===void 0)throw Error(Fe(27));return t}var ri=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=ni(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`),d={open:c,transitionStatus:s.useState(`transitionStatus`)};return J(`div`,e,{state:d,ref:[s.context.backdropRef,t],stateAttributesMapping:Te,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),ii=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,l=ni(),u=l.useState(`open`),{getButtonProps:d,buttonRef:f}=Nr({disabled:a,native:o}),p={disabled:a};function m(e){u&&l.setOpen(!1,ne(c,e.nativeEvent))}return J(`button`,e,{state:p,ref:[t,f],props:[{onClick:m},s,d]})}),ai=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=ni(),c=We(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),J(`p`,e,{ref:t,props:[{id:c},o]})}),oi=Z.createContext(void 0);function si(){let e=Z.useContext(oi);if(e===void 0)throw Error(Fe(26));return e}var ci=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]),li={...Ve,...ke,nestedDialogOpen(e){return e?{"data-nested-dialog-open":``}:null}},ui=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=ni(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),y=c.useState(`openMethod`),b=c.useState(`titleElementId`),x=c.useState(`transitionStatus`),S=c.useState(`role`),C=d.useState(`floatingId`);si(),O({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let w=o===void 0?B(c.context.popupRef):o,T=g>0,E=c.useStateSetter(`popupElement`),D=J(`div`,e,{state:{open:_,nested:h,transitionStatus:x,nestedDialogOpen:T},props:[f,{id:C,"aria-labelledby":b,"aria-describedby":l,role:S,...v,hidden:!m,onKeyDown(e){ci.has(e.key)&&e.stopPropagation()},style:{"--nested-dialogs":g}},s],ref:[t,c.context.popupRef,E],stateAttributesMapping:li});return(0,Q.jsx)(Fn,{context:d,openInteractionType:y,disabled:!m,closeOnFocusOut:!u,initialFocus:w,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:D})}),di=Z.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,Q.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),fi=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=ni(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,Q.jsx)(oi.Provider,{value:n,children:(0,Q.jsxs)(M,{ref:t,...r,children:[a&&o===!0&&(0,Q.jsx)(di,{ref:i.context.internalBackdropRef,inert:qn(!s)}),e.children]})}):null}),pi={},mi={},hi=``;function gi(e,t){return Le(e)?e:t}function _i(e,t,n){return/hidden|clip/.test(e.getComputedStyle(gi(t,n)).overflowY)}function vi(e){if(typeof document>`u`)return!1;let t=Y(e);return we(t).innerWidth-t.documentElement.clientWidth>0}function yi(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Y(e),n=t.documentElement,r=t.body,i=gi(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function bi(e){let t=Y(e),n=t.documentElement,r=t.body,i=gi(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function xi(e){let t=Y(e),n=t.documentElement,r=t.body,i=we(n),a=0,o=0,s=!1,c=It.create();if(xt&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,pi={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},hi=n.style.scrollBehavior,mi={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=gi(n,r);if(s=yi(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,pi),Object.assign(r.style,mi),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=hi)}function d(){u(),c.request(l)}l();let f=_(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var Si=new class{lockCount=0;restore=null;timeoutLock=tt.create();timeoutUnlock=tt.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Y(e),n=t.documentElement,r=t.body,i=we(n);if(_i(i,n,r)){let t=new i.MutationObserver(()=>{_i(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=Me||!vi(e);this.restore=a?bi(e):xi(e)}};function Ci(e=!0,t=null){X(()=>{if(e)return Si.acquire(t)},[e,t])}function wi({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=Z.useState(0),[u,d]=Z.useState(0),f=c===0,p=E(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=T(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||q(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return Ci(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),X(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),F(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var Ti={...Mt,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},Ei=class extends zt{constructor(e,t,n){let r=new ce,i=Di(e,r,t,n);super(i,Oi(r),Ti)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};Qe(n,e,t.trigger),this.update(n)}};function Di(e,t,n,r=!1){let i={...oe(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e};return i.floatingRootContext=f(t,n,r),i}function Oi(e){return{popupRef:Z.createRef(),backdropRef:Z.createRef(),internalBackdropRef:Z.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function ki(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:c=!1,modal:l=!0,actionsRef:u,handle:d,triggerId:f,defaultTriggerId:p=null}=t,m=e===`drawer`,g=e===`alert-dialog`,_=g?!0:l,v=g||c,y=g?`alertdialog`:`dialog`,b=ni(!0),x={modal:_,disablePointerDismissal:v,nested:b!=null,role:y},S=R((e,t)=>new Ei({open:i,openProp:r,activeTriggerId:p,triggerIdProp:f,...x},e,t),!0);S.useControlledProp(`openProp`,r),S.useControlledProp(`triggerIdProp`,f),S.useSyncedValues(x),S.useContextCallback(`onOpenChange`,a),S.useContextCallback(`onOpenChangeComplete`,o);let C=S.useState(`open`),w=S.useState(`mounted`),T=S.useState(`payload`);V(S,C),s(S);let{forceUnmount:E}=Xe(C,S);Z.useImperativeHandle(u,()=>({unmount:E,close:()=>S.setOpen(!1,ne(L))}),[E,S]);let D=C||w;return(0,Q.jsxs)(ti.Provider,{value:S,children:[d&&(0,Q.jsx)(h,{handle:d,store:S}),D&&(0,Q.jsx)(wi,{store:S,parentContext:b?.context,isDrawer:m}),typeof n==`function`?n({payload:T}):n]})}function Ai(e){return ki(`dialog`,e)}var ji=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=ni(),c=We(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),J(`h2`,e,{ref:t,props:[{id:c},o]})});function Mi(e){let t=Z.useRef(``),n=Z.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Z.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Ni(e,t){let n=Z.useRef(e),r=m(t);X(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Pi(e,t){let{onClick:n,onPointerDown:r}=Mi(m((n,r)=>{(typeof e==`function`?e():e)||t(r||(Me?`touch`:``))}));return Z.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function Fi(e){let[t,n]=Z.useState(null),r=Pi(e,n);return Ni(e,t=>{t&&!e&&n(null)}),Z.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var Ii=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=ni(!0),f=Ft(l)??d;if(!f)throw Error(Fe(79));let p=We(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=Z.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=b(p,_,f,{payload:c}),{getButtonProps:x,buttonRef:S}=Nr({disabled:a,native:o}),C=In(m),w=Pi(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),T={disabled:a,open:h},E=f.useState(`triggerProps`,y);return J(`button`,e,{state:T,ref:[S,t,v,_],props:[C.reference,E,w,{[A]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,x],stateAttributesMapping:Lt})});function Li({...e}){return(0,Q.jsx)(Ai,{"data-slot":`sheet`,...e})}function Ri({...e}){return(0,Q.jsx)(fi,{"data-slot":`sheet-portal`,...e})}function zi({className:e,...t}){return(0,Q.jsx)(ri,{className:i(`fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),"data-slot":`sheet-overlay`,...t})}function Bi({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...a}){return(0,Q.jsxs)(Ri,{children:[(0,Q.jsx)(zi,{}),(0,Q.jsxs)(ui,{className:i(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-popover-foreground text-sm shadow-lg transition duration-200 ease-in-out data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=bottom]:inset-x-0 data-[side=top]:inset-x-0 data-[side=left]:inset-y-0 data-[side=right]:inset-y-0 data-[side=top]:top-0 data-[side=right]:right-0 data-[side=bottom]:bottom-0 data-[side=left]:left-0 data-[side=bottom]:h-auto data-[side=left]:h-full data-[side=right]:h-full data-[side=top]:h-auto data-[side=left]:w-3/4 data-[side=right]:w-3/4 data-[side=bottom]:border-t data-[side=left]:border-r data-[side=top]:border-b data-[side=right]:border-l data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,e),"data-side":n,"data-slot":`sheet-content`,...a,children:[t,r&&(0,Q.jsx)(ii,{"data-slot":`sheet-close`,render:(0,Q.jsxs)(Rr,{className:`absolute top-3 right-3`,size:`icon-sm`,variant:`ghost`,children:[(0,Q.jsx)(br,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function Vi({className:e,...t}){return(0,Q.jsx)(`div`,{className:i(`flex flex-col gap-0.5 p-4`,e),"data-slot":`sheet-header`,...t})}function Hi({className:e,...t}){return(0,Q.jsx)(`div`,{className:i(`mt-auto flex flex-col gap-2 p-4`,e),"data-slot":`sheet-footer`,...t})}function Ui({className:e,...t}){return(0,Q.jsx)(ji,{className:i(`cn-font-heading font-medium text-base text-foreground`,e),"data-slot":`sheet-title`,...t})}function Wi({className:e,...t}){return(0,Q.jsx)(ai,{className:i(`text-muted-foreground text-sm`,e),"data-slot":`sheet-description`,...t})}var Gi=768;function Ki(){let[e,t]=(0,Z.useState)(void 0);return(0,Z.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=()=>{t(window.innerWidthe.removeEventListener(`change`,n)},[]),!!e}var qi=`sidebar_state`,Ji=604800,Yi=`16rem`,Xi=`18rem`,Zi=`3rem`,Qi=`b`,$i=Z.createContext(null);function ea(){let e=Z.useContext($i);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function ta({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:a,children:o,...s}){let c=Ki(),[l,u]=Z.useState(!1),[d,f]=Z.useState(e),p=t??d,m=Z.useCallback(e=>{let t=typeof e==`function`?e(p):e;n?n(t):f(t),document.cookie=`${qi}=${t}; path=/; max-age=${Ji}`},[n,p]),h=Z.useCallback(()=>c?u(e=>!e):m(e=>!e),[c,m]);Z.useEffect(()=>{let e=e=>{e.key===Qi&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),h())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]);let g=p?`expanded`:`collapsed`,_=Z.useMemo(()=>({isMobile:c,open:p,openMobile:l,setOpen:m,setOpenMobile:u,state:g,toggleSidebar:h}),[g,p,m,c,l,h]);return(0,Q.jsx)($i.Provider,{value:_,children:(0,Q.jsx)(`div`,{className:i(`group/sidebar-wrapper flex h-full w-full has-data-[variant=inset]:bg-sidebar`,r),"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":Yi,"--sidebar-width-icon":Zi,...a},...s,children:o})})}function na({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:a,dir:o,...s}){let{isMobile:c,state:l,openMobile:u,setOpenMobile:d}=ea();return n===`none`?(0,Q.jsx)(`div`,{className:i(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),"data-slot":`sidebar`,...s,children:a}):c?(0,Q.jsx)(Li,{onOpenChange:d,open:u,...s,children:(0,Q.jsxs)(Bi,{className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,"data-mobile":`true`,"data-sidebar":`sidebar`,"data-slot":`sidebar`,dir:o,side:e,style:{"--sidebar-width":Xi},children:[(0,Q.jsxs)(Vi,{className:`sr-only`,children:[(0,Q.jsx)(Ui,{children:`Sidebar`}),(0,Q.jsx)(Wi,{children:`Displays the mobile sidebar.`})]}),(0,Q.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:a})]})}):(0,Q.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-collapsible":l===`collapsed`?n:``,"data-side":e,"data-slot":`sidebar`,"data-state":l,"data-variant":t,children:[(0,Q.jsx)(`div`,{className:i(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`),"data-slot":`sidebar-gap`}),(0,Q.jsx)(`div`,{className:i(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=right]:right-0 data-[side=left]:left-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] md:flex`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),"data-side":e,"data-slot":`sidebar-container`,...s,children:(0,Q.jsx)(`div`,{className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,children:a})})]})}function ra({className:e,onClick:t,...n}){let{toggleSidebar:r}=ea();return(0,Q.jsxs)(Rr,{className:i(e),"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,onClick:e=>{t?.(e),r()},size:`icon-sm`,variant:`ghost`,...n,children:[(0,Q.jsx)(mr,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function ia({className:e,...t}){return(0,Q.jsx)(`main`,{className:i(`scrollbar-thin relative flex w-full flex-1 flex-col overflow-y-auto bg-background md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm`,e),"data-slot":`sidebar-inset`,...t})}function aa({className:e,...t}){return(0,Q.jsx)(`div`,{className:i(`flex flex-col gap-2 p-2`,e),"data-sidebar":`header`,"data-slot":`sidebar-header`,...t})}function oa({className:e,...t}){return(0,Q.jsx)(`div`,{className:i(`flex flex-col gap-2 p-2`,e),"data-sidebar":`footer`,"data-slot":`sidebar-footer`,...t})}function sa({className:e,...t}){return(0,Q.jsx)(`div`,{className:i(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),"data-sidebar":`content`,"data-slot":`sidebar-content`,...t})}function ca({className:e,...t}){return(0,Q.jsx)(`div`,{className:i(`relative flex w-full min-w-0 flex-col p-2`,e),"data-sidebar":`group`,"data-slot":`sidebar-group`,...t})}function la({className:e,render:t,...n}){return Or({defaultTagName:`div`,props:W({className:i(`flex h-8 shrink-0 items-center rounded-md px-2 font-medium text-sidebar-foreground/70 text-xs outline-hidden ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 [&>svg]:size-4 [&>svg]:shrink-0`,e)},n),render:t,state:{sidebar:`group-label`,slot:`sidebar-group-label`}})}function ua({className:e,...t}){return(0,Q.jsx)(`ul`,{className:i(`flex w-full min-w-0 flex-col gap-0`,e),"data-sidebar":`menu`,"data-slot":`sidebar-menu`,...t})}function da({className:e,...t}){return(0,Q.jsx)(`li`,{className:i(`group/menu-item relative`,e),"data-sidebar":`menu-item`,"data-slot":`sidebar-menu-item`,...t})}var fa=Tr(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&_svg]:size-4 [&_svg]:shrink-0`,{defaultVariants:{size:`default`,variant:`default`},variants:{size:{default:`h-8 text-sm`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`,sm:`h-7 text-xs`},variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]`}}});function pa({render:e,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:a,className:o,...s}){let{isMobile:c,state:l}=ea(),u=Or({defaultTagName:`button`,props:W({className:i(fa({size:r,variant:n}),o)},s),render:a?(0,Q.jsx)(Et,{render:e}):e,state:{active:t,sidebar:`menu-button`,size:r,slot:`sidebar-menu-button`}});return a?(typeof a==`string`&&(a={children:a}),(0,Q.jsxs)(bt,{children:[u,(0,Q.jsx)(je,{align:`center`,hidden:l!==`collapsed`||c,side:`right`,...a})]})):u}var ma={apiBase:window.HEADGATE?.apiBase??`/api/v1`,readOnly:window.HEADGATE?.readOnly??!1},ha=class extends Error{status;constructor(e,t){super(e),this.status=t}};async function ga(e,t={}){let n=t.method??`GET`;if(ma.readOnly&&n!==`GET`)throw new ha(`This console is read-only.`,403);let r=new Headers(t.headers),{body:i}=t;n!==`GET`&&(r.set(`Idempotency-Key`,crypto.randomUUID()),typeof i==`object`&&i&&!(i instanceof Blob)&&(r.set(`Content-Type`,`application/json`),i=JSON.stringify(i)));let a=await fetch(`${ma.apiBase}${e}`,{...t,body:i,headers:r,method:n}),o=await a.text(),s=null;try{s=o?JSON.parse(o):null}catch{s=o}if(!a.ok)throw new ha(s&&typeof s==`object`&&`error`in s?String(s.error):`Request failed (${a.status})`,a.status);return s}var _a=[{icon:sr,label:`Overview`,to:`/overview`},{icon:dr,label:`Queues`,to:`/queues`},{icon:pr,label:`Jobs`,to:`/jobs`},{icon:fr,label:`Workflows`,to:`/workflows`},{icon:ar,label:`Rate classes`,to:`/rate-classes`},{icon:vr,label:`Quarantine`,to:`/quarantine`},{icon:or,label:`Periodic`,to:`/periodic`},{icon:gr,label:`Workers`,to:`/workers`}];function va(e){let t=Vt({select:e=>e.location.pathname}),n=dn({queryFn:({signal:e})=>ga(`/meta`,{signal:e}),queryKey:[`api`,`meta`],retry:1,staleTime:1/0}),r=n.data?.version?.trim(),i=r?`${ya.test(r)?`v`:``}${r}`:n.isPending?`…`:`version unavailable`;return(0,Q.jsxs)(na,{collapsible:`icon`,variant:`inset`,...e,children:[(0,Q.jsx)(aa,{children:(0,Q.jsx)(ua,{children:(0,Q.jsx)(da,{children:(0,Q.jsxs)(pa,{render:(0,Q.jsx)(j,{to:`/overview`}),size:`lg`,tooltip:`headgate`,children:[(0,Q.jsx)(`div`,{className:`flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground`,children:(0,Q.jsx)(`span`,{className:`font-semibold text-sm`,children:`h`})}),(0,Q.jsxs)(`div`,{className:`grid flex-1 text-left leading-tight`,children:[(0,Q.jsx)(`span`,{className:`truncate font-semibold`,children:`headgate`}),(0,Q.jsx)(`span`,{className:`truncate text-xs`,children:`operations console`})]})]})})})}),(0,Q.jsx)(sa,{children:(0,Q.jsxs)(ca,{children:[(0,Q.jsx)(la,{children:`Operate`}),(0,Q.jsx)(ua,{className:`gap-0.5`,children:_a.map(e=>(0,Q.jsx)(da,{children:(0,Q.jsxs)(pa,{isActive:t===e.to||t.startsWith(`${e.to}/`),render:(0,Q.jsx)(j,{to:e.to}),tooltip:e.label,children:[(0,Q.jsx)(e.icon,{}),(0,Q.jsx)(`span`,{children:e.label})]})},e.to))})]})}),(0,Q.jsx)(oa,{children:(0,Q.jsxs)(`div`,{className:`space-y-0.5 px-2 text-sidebar-foreground/65 text-xs group-data-[collapsible=icon]:hidden`,children:[(0,Q.jsxs)(`p`,{children:[`Headgate`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,translate:`no`,children:i})]}),(0,Q.jsxs)(`p`,{className:`truncate`,title:`API ${ma.apiBase}`,children:[`API `,ma.apiBase]})]})})]})}var ya=/^\d/;function ba({...e}){return(0,Q.jsx)(Ai,{"data-slot":`dialog`,...e})}function xa({...e}){return(0,Q.jsx)(Ii,{"data-slot":`dialog-trigger`,...e})}function Sa({...e}){return(0,Q.jsx)(fi,{"data-slot":`dialog-portal`,...e})}function Ca({className:e,...t}){return(0,Q.jsx)(ri,{className:i(`data-open:fade-in-0 data-closed:fade-out-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 data-closed:animate-out data-open:animate-in supports-backdrop-filter:backdrop-blur-xs`,e),"data-slot":`dialog-overlay`,...t})}function wa({className:e,children:t,showCloseButton:n=!0,...r}){return(0,Q.jsxs)(Sa,{children:[(0,Q.jsx)(Ca,{}),(0,Q.jsxs)(ui,{className:i(`data-open:fade-in-0 data-open:zoom-in-95 data-closed:fade-out-0 data-closed:zoom-out-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground text-sm outline-none ring-1 ring-foreground/10 duration-100 data-closed:animate-out data-open:animate-in sm:max-w-sm`,e),"data-slot":`dialog-content`,...r,children:[t,n&&(0,Q.jsx)(ii,{"data-slot":`dialog-close`,render:(0,Q.jsxs)(Rr,{className:`absolute top-2 right-2`,size:`icon-sm`,variant:`ghost`,children:[(0,Q.jsx)(br,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function Ta({className:e,...t}){return(0,Q.jsx)(`div`,{className:i(`flex flex-col gap-2`,e),"data-slot":`dialog-header`,...t})}function Ea({className:e,...t}){return(0,Q.jsx)(ji,{className:i(`cn-font-heading font-medium text-base leading-none`,e),"data-slot":`dialog-title`,...t})}function Da({className:e,...t}){return(0,Q.jsx)(ai,{className:i(`text-muted-foreground text-sm *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),"data-slot":`dialog-description`,...t})}function Oa({className:e,...t}){return(0,Q.jsx)(`label`,{className:i(`font-medium text-sm`,e),...t})}function ka(e){let t=Z.useRef(!0);t.current&&(t.current=!1,e())}function Aa(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var ja=Z.createContext(null);function Ma(){let e=Z.useContext(ja);if(e===null)throw Error(Fe(60));return e}var Na=(e,t)=>Object.is(e,t);function Pa(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Fa(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e!==void 0&&Pa(e,t,n))}function Ia(e,t,n){return e.filter(e=>!Pa(t,e,n))}function La(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Ra(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function za(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Ra(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Ba(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return La(e)}function Va(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?La(e.value):La(e)}function Ha(e,t,n){function r(){return Ba(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=Ra(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Ua(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Q.jsx)(Z.Fragment,{children:Ha(r,t,n)},i)),e),[])}var $={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Va(t,r)!==``},hasNullItemLabel:(e,t)=>t?za(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>Pa(t,e,n)):Pa(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function Wa(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function Ga(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function Ka(e,t){return Math.max(0,e-t)}function qa(e,t){if(t<=0)return 0;let n=Ga(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function Ja(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:u,autoComplete:d,disabled:f=!1,readOnly:p=!1,required:h=!1,modal:g=!0,actionsRef:_,inputRef:y,onOpenChangeComplete:b,items:x,multiple:C=!1,itemToStringLabel:w,itemToStringValue:T,isItemEqualToValue:D=Na,highlightItemOnHover:k=!0,children:A}=e,{clearErrors:j}=Kr(),{setDirty:ee,setTouched:M,setFocused:N,validityData:P,setFilled:F,name:I,disabled:L,validation:R,validationMode:z}=Wr(),B=Yr({id:t}),V=L||f,H=I??c,[U,re]=Xr({controlled:n,default:C?r??pt:r,name:`Select`,state:`value`}),[G,ie]=Xr({controlled:a,default:o,name:`Select`,state:`open`}),ae=Z.useRef([]),oe=Z.useRef([]),K=Z.useRef(null),se=Z.useRef(null),ce=Z.useRef(0),le=Z.useRef(null),de=Z.useRef([]),fe=Z.useRef(!1),pe=Z.useRef(null),me=Z.useRef(null),he=Z.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ge=Z.useRef(!1),{mounted:_e,setMounted:q,transitionStatus:J}=te(G),{openMethod:ve,triggerProps:ye}=Fi(G),be=He(()=>new zt({id:B,labelId:void 0,modal:g,multiple:C,itemToStringLabel:w,itemToStringValue:T,isItemEqualToValue:D,value:U,open:G,mounted:_e,transitionStatus:J,items:x,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,xe=l(be,$.activeIndex),Se=l(be,$.selectedIndex),Ce=l(be,$.triggerElement),we=l(be,$.positionerElement),Te=Jn(ve),Ee=ve??Te,De=Z.useMemo(()=>C?``:Va(U,T),[C,U,T]),Oe=Z.useMemo(()=>C&&Array.isArray(U)?U.map(e=>Va(e,T)):Va(U,T),[C,U,T]);Zr(Pt(Ce),B,U,m(()=>Oe),!V,c);let ke=Z.useRef(U),Ae=C?Array.isArray(U)&&U.length>0:U!=null&&De!==``;X(()=>{F(Ae)},[Ae,F]),X(function(){let e=U,t=!1;if(C){let n=Array.isArray(U)?U:[];t=n.length===0,e=n[n.length-1]}let n=t?-1:Fa(de.current,e,D),r=n===-1?null:n;r===null&&(me.current=null),!G&&be.set(`selectedIndex`,r)},[C,G,U,D,be]);function Y(e){let t=P.initialValue;return Array.isArray(e)&&Array.isArray(t)?!Wa(e,t,(e,t)=>Pa(e,t,D)):e!==t}Ni(U,()=>{j(H),ee(Y(U)),R.change(U)});let je=m((e,t)=>{s?.(e,t),!t.isCanceled&&(ie(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(M(!0),N(!1),z===`onBlur`&&R.commit(U)))}),Me=m(()=>{q(!1),be.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),b?.(!1)});O({enabled:!_,open:G,ref:K,onComplete(){G||Me()}}),Z.useImperativeHandle(_,()=>({unmount:Me}),[Me]);let Ne=m((e,t)=>{i?.(e,t),!t.isCanceled&&re(e)}),Pe=m(e=>{let t=Ka(e.scrollHeight,e.clientHeight),n=qa(e.scrollTop,t),r=n>0,i=nAa(ae.current[e]),onMatch(e){G?be.set(`activeIndex`,e):Ne(de.current[e],ne(S))},onTyping(e){fe.current=e}}),Be=Z.useMemo(()=>W(ze.reference,Re.reference,Le.reference,Ie.reference,ye),[Ie.reference,ze.reference,Re.reference,Le.reference,ye]),Ve=Z.useMemo(()=>W(v,ze.floating,Re.floating,Le.floating),[ze.floating,Re.floating,Le.floating]),Ue=Re.item??it;ka(()=>{be.update({popupProps:Ve,triggerProps:Be})}),be.useSyncedValues({id:B,modal:g,multiple:C,value:U,open:G,mounted:_e,transitionStatus:J,popupProps:Ve,triggerProps:Be,items:x,itemToStringLabel:w,itemToStringValue:T,isItemEqualToValue:D,openMethod:Ee});let We=Z.useMemo(()=>({store:be,floatingContext:Fe,required:h,disabled:V,readOnly:p,multiple:C,highlightItemOnHover:k,setValue:Ne,setOpen:je,listRef:ae,popupRef:K,scrollHandlerRef:se,handleScrollArrowVisibility:Pe,scrollArrowsMountedCountRef:ce,itemProps:Ue,valueRef:le,valuesRef:de,labelsRef:oe,typingRef:fe,selectionRef:he,firstItemTextRef:pe,selectedItemTextRef:me,validation:R,onOpenChangeComplete:b,alignItemWithTriggerActiveRef:ge,initialValueRef:ke}),[be,Fe,h,V,p,C,k,Ne,je,Ue,R,b,Pe]),Ge=ue(y,R.inputRef),Ke=C?void 0:H,qe=Z.useMemo(()=>!C||!Array.isArray(U)||!H?null:U.map(e=>{let t=Va(e,T);return(0,Q.jsx)(`input`,{type:`hidden`,form:u,name:H,value:t,disabled:V},t)}),[C,U,u,H,T,V]);return(0,Q.jsxs)(ja.Provider,{value:We,children:[A,(0,Q.jsx)(`input`,{...R.getValidationProps(V,{onFocus(){be.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||V||p)return;let t=e.currentTarget.value,n=ne(S,e.nativeEvent);function r(){if(C)return;let e=t.toLowerCase(),r=de.current.findIndex(t=>Va(t,T).toLowerCase()===e||Ba(t,w).toLowerCase()===e);r===-1&&(r=de.current.findIndex((t,n)=>{let r=oe.current[n];return r!=null&&r.toLowerCase()===e}));let i=de.current[r];i!=null&&Ne(i,n)}be.set(`forceMount`,!0),queueMicrotask(r)}}),id:B&&Ke==null?`${B}-hidden-input`:void 0,form:u,name:Ke,autoComplete:d,value:De,disabled:V,required:h&&!(C&&Ae),readOnly:p,ref:Ge,style:H?Rt:jt,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),qe]})}function Ya(e,t){return e??t}var Xa=5;function Za(e,t){let n=Qa(t);return e.clientX>=n.left-Xa&&e.clientX<=n.right+Xa&&e.clientY>=n.top-Xa&&e.clientY<=n.bottom+Xa}function Qa(e){let t=e.getBoundingClientRect(),n=we(e);if(ut)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var $a=400,eo={...kt,...Vr,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},to=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:u,setFocused:f,validationMode:p,state:m,disabled:h}=Wr(),{labelId:g}=Jr(),{store:_,setOpen:v,selectionRef:y,validation:b,readOnly:x,required:C,alignItemWithTriggerActiveRef:w,disabled:T}=Ma(),E=h||T||a,D=l(_,$.open),O=l(_,$.mounted),k=l(_,$.value),A=l(_,$.triggerProps),j=l(_,$.positionerElement),ee=l(_,$.listElement),M=l(_,$.popupSide),N=l(_,$.id),te=l(_,$.labelId),P=l(_,$.hasSelectedValue),F=O&&j?M:null,I=i??N,L=Ya(g,te);Yr({id:I});let R=Pt(j),z=Z.useRef(null),{getButtonProps:B,buttonRef:V}=Nr({disabled:E,native:o}),H=_.useStateSetter(`triggerElement`),U=Dt(),re=Dt(),G=Dt();Z.useEffect(()=>{if(D)return G.start($a,()=>{y.current.allowUnselectedMouseUp=!0,y.current.allowSelectedMouseUp=!0}),()=>{G.clear()};y.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},re.clear()},[D,y,re,G]);let ie=W(A,{id:I,role:`combobox`,"aria-expanded":D,"aria-haspopup":`listbox`,"aria-controls":D?ee?.id??d(j)?.id:void 0,"aria-labelledby":L,"aria-readonly":x||void 0,"aria-required":C||void 0,tabIndex:E?-1:0,onFocus(e){f(!0),D&&w.current&&v(!1,ne(S,e.nativeEvent)),U.start(0,()=>{_.set(`forceMount`,!0)})},onBlur(e){q(j,e.relatedTarget)||(u(!0),f(!1),p===`onBlur`&&b.commit(k))},onMouseDown(e){if(D)return;let t=Y(e.currentTarget);function n(e){if(!z.current)return;let t=e.target;q(z.current,t)||q(R.current,t)||Za(e,z.current)||v(!1,ne(et,e))}re.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,B),ae=b.getValidationProps(E,ie);ae.role=`combobox`;let oe={...m,open:D,disabled:E,value:k,readOnly:x,popupSide:F,placeholder:!P};return J(`button`,e,{ref:[t,z,V,H],state:oe,stateAttributesMapping:eo,props:ae})}),no={value:()=>null},ro=Z.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:u}=Ma(),d=l(c,$.value),f=l(c,$.items),p=l(c,$.itemToStringLabel),m=l(c,$.hasSelectedValue),h=!m&&a!=null&&i==null,g=l(c,$.hasNullItemLabel,h),_={value:d,placeholder:!m},v=null;return v=typeof i==`function`?i(d):i??(h&&!g?a:Array.isArray(d)?Ua(d,f,p):Ha(d,f,p)),J(`span`,e,{state:_,ref:[t,u],props:[{children:v},s],stateAttributesMapping:no})}),io=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=Ma(),s={open:l(o,$.open)};return J(`span`,e,{state:s,ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:Lt})}),ao=Z.forwardRef(function(e,t){let{store:n}=Ma(),r=l(n,$.mounted),i=l(n,$.forceMount);return r||i?(0,Q.jsx)(M,{ref:t,...e}):null}),oo=Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function so(){return Z.useContext(oo)}function co(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=m(i),[,o]=Z.useState(!1),s=He(uo).current,c=He(lo).current,l=Z.useRef(0),u=Z.useRef(!0),d=Z.useRef([]),f=Z.useRef(null),p=m(()=>{u.current||(u.current=!0,o(e=>!e))}),h=m((e,t)=>{c.set(e,t),p()}),g=m(e=>{c.delete(e),p()}),_=m(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function v(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!mo(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&ho(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;tt.observe(e,{childList:!0}))}let y=m(()=>{let[e,t]=fo(c),n=_(e);v(t),d.current=e,u.current=!1,s.forEach(e=>e(n)),a(n)});X(()=>(u.current||_(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,_]),X(()=>{u.current&&y()}),X(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let b=m(e=>(s.add(e),()=>{s.delete(e)})),x=Z.useMemo(()=>({register:h,unregister:g,subscribeMapChange:b,nextIndexRef:l}),[h,g,b,l]);return(0,Q.jsx)(oo.Provider,{value:x,children:t})}function lo(){return new Map}function uo(){return new Set}function fo(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>ho(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function po(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function mo(e){for(let t of e)for(let e=0;e{if(!e||!t||n==null){a(!1);return}let r=Y(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-bo)},[e,t,n]),Ci(e&&(!t||i),r)}var So={position:`fixed`},Co=Z.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:h,disableAnchorTracking:g,alignItemWithTrigger:_=!0,collisionAvoidance:v=be,style:y,...b}=e,{store:x,listRef:C,labelsRef:w,alignItemWithTriggerActiveRef:T,selectedItemTextRef:E,valuesRef:D,initialValueRef:O,popupRef:k,setValue:A,floatingContext:j}=Ma(),ee=l(x,$.open),M=l(x,$.mounted),N=l(x,$.modal),te=l(x,$.value),P=l(x,$.openMethod),F=l(x,$.positionerElement),I=l(x,$.triggerElement),L=l(x,$.isItemEqualToValue),R=l(x,$.transitionStatus),z=Z.useRef(null),B=Z.useRef(null),[V,H]=Z.useState(_),U=M&&V&&P!==`touch`;!M&&V!==_&&H(_),Z.useImperativeHandle(T,()=>U),xo((U||N)&&ee,P===`touch`,F,I);let W=ft({anchor:n,floatingRootContext:j,positionMethod:a,mounted:M,side:o,sideOffset:c,align:s,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:h,disableAnchorTracking:g??U,collisionAvoidance:v,keepMounted:!0}),re=U?`none`:W.side,G=U?So:W.positionerStyles,ie={open:ee,side:re,align:W.align,anchorHidden:W.anchorHidden};X(()=>{x.set(`popupSide`,W.side)},[x,W.side]);let ae=x.useStateSetter(`positionerElement`),oe=Pe(e,ie,{styles:G,transitionStatus:R,props:b,refs:[t,ae],hidden:!M,inert:!ee}),K=Z.useRef(0),se=m(e=>{if(D.current.length===0)return;let t=K.current;if(K.current=e.size,e.size===t)return;let n=ne(S);if(t!==0&&!x.state.multiple&&te!==null&&Fa(D.current,te,L)===-1){let e=O.current,t=e!=null&&Fa(D.current,e,L)!==-1?e:null;A(t,n),t===null&&(x.set(`selectedIndex`,null),E.current=null)}if(t!==0&&x.state.multiple&&Array.isArray(te)){let e=te.filter(e=>Fa(D.current,e,L)!==-1);e.length!==te.length&&(A(e,n),e.length===0&&(x.set(`selectedIndex`,null),E.current=null))}if(ee&&U){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};vo(F,e),vo(k.current,e)}}),ce=Z.useMemo(()=>({...W,side:re,alignItemWithTriggerActive:U,setControlledAlignItemWithTrigger:H,scrollUpArrowRef:z,scrollDownArrowRef:B}),[W,re,U,H]);return(0,Q.jsx)(co,{elementsRef:C,labelsRef:w,onMapChange:se,children:(0,Q.jsxs)(go.Provider,{value:ce,children:[M&&N&&(0,Q.jsx)(di,{inert:qn(!ee),cutout:I}),oe]})})}),wo=`base-ui-disable-scrollbar`,To={className:wo,getElement(e){return(0,Q.jsx)(`style`,{nonce:e,href:wo,precedence:`base-ui:low`,children:`.${wo}{scrollbar-width:none}.${wo}::-webkit-scrollbar{display:none}`})}},Eo=Z.createContext(void 0);function Do(e){let t=Z.useContext(Eo);if(t===void 0&&!e)throw Error(Fe(69));return t}var Oo=Z.createContext(void 0),ko={disableStyleElements:!1};function Ao(){return Z.useContext(Oo)??ko}var jo={...Ve,...ke},Mo=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:u,setOpen:d,valueRef:f,firstItemTextRef:p,selectedItemTextRef:h,multiple:g,handleScrollArrowVisibility:v,scrollHandlerRef:y,listRef:b,highlightItemOnHover:x,floatingContext:S}=Ma(),{side:C,align:w,alignItemWithTriggerActive:T,isPositioned:E,setControlledAlignItemWithTrigger:D}=_o(),k=Do(!0)!=null,A=rt(),{nonce:j,disableStyleElements:ee}=Ao(),M=l(s,$.id),N=l(s,$.open),te=l(s,$.openMethod),P=l(s,$.mounted),F=l(s,$.popupProps),I=l(s,$.transitionStatus),L=l(s,$.triggerElement),R=l(s,$.positionerElement),z=l(s,$.listElement),B=Z.useRef(!1),V=Z.useRef(!1),H=Z.useRef({}),U=se(),W=m(e=>{if(!R||!c.current||!V.current)return;let t=R.style.top===`0px`,n=R.style.bottom===`0px`;if(B.current||!T||!t&&!n){v(e);return}let r=Fo(R),i=Io(R.getBoundingClientRect().height,`y`,r),a=Y(R),o=we(R),s=o.getComputedStyle(R),l=parseFloat(s.marginTop),u=parseFloat(s.marginBottom),d=No(o.getComputedStyle(c.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,m=Po(e),h=null,g=e=>{R.style.height=`${e}px`},_=t?m-p:p,y=Math.min(i+_,f);if(_<=1){let n=Ga(_,0,f-i);n>0&&g(i+n),e.scrollTop=t?m:0,f-(i+n)<=1&&(B.current=!0),v(e);return}f-y>1?h=t?1/0:0:n&&p1&&(e.scrollTop=t)}b>=f-1&&(B.current=!0),v(e)});Z.useImperativeHandle(y,()=>W,[W]),O({open:N,ref:c,onComplete(){N&&u?.(!0)}});let re={open:N,transitionStatus:I,side:C,align:w};X(()=>{!R||!c.current||Object.keys(H.current).length||(H.current={top:R.style.top||`0`,left:R.style.left||`0`,right:R.style.right,height:R.style.height,bottom:R.style.bottom,minHeight:R.style.minHeight,maxHeight:R.style.maxHeight,marginTop:R.style.marginTop,marginBottom:R.style.marginBottom})},[c,R]),X(()=>{N||T||(V.current=!1,B.current=!1,vo(R,H.current))},[N,T,R,c]),X(()=>{let e=c.current;if(!N||!L||!R||!e||T&&!E||s.state.transitionStatus===`ending`)return;if(V.current=!0,e.style.removeProperty(`--transform-origin`),!T){U.request(()=>v(z||e));return}let t=zo(e);try{let t=h.current;t?.isConnected||(t=!$.hasSelectedValue(s.state)&&p.current?.isConnected?p.current:null);let n=f.current,r=we(R),i=r.getComputedStyle(R),a=r.getComputedStyle(e),o=Y(L),c=Fo(L),l=Lo(L.getBoundingClientRect(),c),u=Lo(R.getBoundingClientRect(),c),d=l.height,m=z||e,g=m.scrollHeight,_=parseFloat(a.borderBottomWidth),y=parseFloat(i.marginTop)||10,S=parseFloat(i.marginBottom)||10,C=parseFloat(i.minHeight)||100,w=No(a),T=o.documentElement.clientHeight-y-S,E=o.documentElement.clientWidth,O=T-l.bottom+d,k,j=A===`rtl`?l.right-u.width:l.left,ee=0;if(t&&n){let e=Lo(n.getBoundingClientRect(),c);k=Lo(t.getBoundingClientRect(),c),j=u.left+(A===`rtl`?e.right-k.right:e.left-k.left);let r=e.top-l.top+e.height/2;ee=k.top-u.top+k.height/2-r}let M=O+ee+S+_,N=Math.min(T,M),te=T-y-S,P=M-N,F=E-5;R.style.left=`${Ga(j,5,F-u.width)}px`,R.style.height=`${N}px`,R.style.maxHeight=`none`,R.style.marginTop=`${y}px`,R.style.marginBottom=`${S}px`,e.style.height=`100%`;let I=Po(m),ne=P>=I-1;ne&&(N=Math.min(T,u.height)-(P-I));let V=l.top<20||l.bottom>T-20||Math.ceil(N)+1=te?`0`:`${e}px`,R.style.height=`${N}px`,m.scrollTop=Po(m)}else R.style.bottom=`0`,m.scrollTop=P;if(k){let t=u.top,n=u.height,r=k.top+k.height/2,i=Ga(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(W===T||N>=w)&&(B.current=!0),v(m),x&&s.state.selectedIndex===null&&s.state.activeIndex===null&&b.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,N,R,L,f,p,h,c,v,T,D,U,z,b,x,A,E]),Z.useEffect(()=>{if(!T||!R||!N)return;let e=we(R);function t(e){d(!1,ne(Bt,e))}return _(e,`resize`,t)},[d,T,R,N]);let G={...z?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":g||void 0,id:`${M}-list`},onKeyDown(e){k&&ci.has(e.key)&&e.stopPropagation()},onScroll(e){z||W(e.currentTarget)},...T&&{style:z?{height:`100%`}:yo},className:!z&&T?To.className:void 0},ie=J(`div`,e,{ref:[t,c],state:re,stateAttributesMapping:jo,props:[F,G,ze(I),o]});return(0,Q.jsxs)(Z.Fragment,{children:[!ee&&To.getElement(j),(0,Q.jsx)(Fn,{context:S,modal:!1,disabled:!P,openInteractionType:te,returnFocus:a,restoreFocus:!0,children:ie})]})});function No(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function Po(e){return Ka(e.scrollHeight,e.clientHeight)}function Fo(e){return me.getScale(e)}function Io(e,t,n){return e/n[t]}function Lo(e,t){return Ue({x:Io(e.x,`x`,t),y:Io(e.y,`y`,t),width:Io(e.width,`x`,t),height:Io(e.height,`y`,t)})}var Ro=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function zo(e){let{style:t}=e,n={};for(let[e,r]of Ro)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of Ro){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Bo=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s,multiple:c}=Ma(),{alignItemWithTriggerActive:u}=_o(),d=l(o,$.hasScrollArrows),f=l(o,$.openMethod),p={id:`${l(o,$.id)}-list`,role:`listbox`,"aria-multiselectable":c||void 0,onScroll(e){s.current?.(e.currentTarget)},...u&&{style:yo},className:d&&f!==`touch`?To.className:void 0},m=o.useStateSetter(`listElement`);return J(`div`,e,{ref:[t,m],props:[p,a]})});function Vo(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=so(),u=Z.useRef(-1),[d,f]=Z.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=Z.useRef(null),h=Z.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return X(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var Ho=Z.createContext(void 0);function Uo(){let e=Z.useContext(Ho);if(!e)throw Error(Fe(57));return e}var Wo=Z.memo(Z.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...u}=e,d=Z.useRef(null),f=Vo({guess:!0,label:o,textRef:d}),{store:p,itemProps:m,setOpen:h,setValue:g,selectionRef:_,typingRef:v,valuesRef:y,multiple:b,selectedItemTextRef:x,disabled:S,readOnly:C}=Ma(),w=S||s,T=l(p,$.isActive,f.index),E=l(p,$.open),D=l(p,$.isSelected,a),O=l(p,$.isSelectedByFocus,f.index),k=l(p,$.isItemEqualToValue),A=f.index,j=Z.useRef(null);X(()=>{let e=y.current;return e[A]=a,()=>{delete e[A]}},[A,a,y]),X(()=>{let e=p.state.value,t=e;b&&Array.isArray(e)&&(t=e.length>0?e[e.length-1]:void 0),t!==void 0&&Pa(a,t,k)&&(p.set(`selectedIndex`,A),d.current&&(x.current=d.current))},[A,b,k,p,a,x]);let ee=Z.useRef(`mouse`),M=Z.useRef(!1),{getButtonProps:N,buttonRef:te}=Nr({disabled:w,focusableWhenDisabled:!0,native:c,composite:!0}),P={disabled:w,selected:D,highlighted:T};function F(e){if(S||C)return;let t=p.state.value;if(b){let n=Array.isArray(t)?t:[],r=D?Ia(n,a,k):[...n,a];g(r,ne(z,e))}else g(a,ne(z,e)),h(!1,ne(z,e))}function I(){_.current.dragY=0}let L={role:`option`,"aria-selected":D,tabIndex:E&&T?0:-1,onKeyDown(e){p.set(`activeIndex`,A),e.key===` `&&v.current&&e.preventDefault()},onClick(e){let t=ee.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&vt(e.nativeEvent)&&(n!==void 0||T),i=t&&!r&&!M.current;M.current=!1,!(w||i)&&F(e.nativeEvent)},onPointerEnter(e){ee.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=_.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){ee.current=e.pointerType,M.current=!0,I()},onMouseUp(){if(I(),w||ee.current===`touch`||M.current)return;let e=!_.current.allowSelectedMouseUp&&D,t=!_.current.allowUnselectedMouseUp&&!D;e||t||(M.current=!0,j.current?.click(),M.current=!1)}},R=J(`div`,e,{ref:[te,t,f.ref,j],state:P,props:[m,L,u,N]}),B=Z.useMemo(()=>({selected:D,index:A,textRef:d,selectedByFocus:O}),[D,A,d,O]);return(0,Q.jsx)(Ho.Provider,{value:B,children:R})})),Go=Z.forwardRef(function(e,t){let{selected:n}=Uo();return e.keepMounted||n?(0,Q.jsx)(Ko,{...e,ref:t}):null}),Ko=Z.memo(Z.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Uo(),c=Z.useRef(null),{transitionStatus:l,setMounted:u}=te(s),d=J(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:ke});return O({open:s,ref:c,onComplete(){s||u(!1)}}),d})),qo=Z.memo(Z.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=Uo(),{firstItemTextRef:a,selectedItemTextRef:o}=Ma(),{render:s,className:c,style:l,...u}=e,d=Z.useCallback(e=>{e&&(n===0&&(a.current=e),i&&(o.current=e))},[a,o,n,i]);return J(`div`,e,{ref:[d,t,r],props:u})})),Jo=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,{store:u,popupRef:d,listRef:f,handleScrollArrowVisibility:p,scrollArrowsMountedCountRef:m}=Ma(),{side:h,scrollDownArrowRef:g,scrollUpArrowRef:_}=_o(),v=c?$.scrollUpArrowVisible:$.scrollDownArrowVisible,y=l(u,v),b=l(u,$.openMethod),x=y&&b!==`touch`,S=Dt(),C=c?_:g,{mounted:w,transitionStatus:T,setMounted:E}=te(x);X(()=>(m.current+=1,u.set(`hasScrollArrows`,!0),()=>{m.current=Math.max(0,m.current-1),m.current===0&&u.set(`hasScrollArrows`,!1)}),[u,m]),O({open:x,ref:C,onComplete(){x||E(!1)}});let D=J(`div`,e,{ref:[t,C],state:{direction:a,visible:x,side:h,transitionStatus:T},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||S.isStarted())return;u.set(`activeIndex`,null);function t(){let e=u.state.listElement??d.current;if(!e)return;u.set(`activeIndex`,null),p(e);let n=Ka(e.scrollHeight,e.clientHeight),r=qa(e.scrollTop,n),i=r===(c?0:n),a=f.current;if(r!==e.scrollTop&&(e.scrollTop=r),i){S.clear();return}if(a.length>0){let t=C.current?.offsetHeight||0;e.scrollTop=Yo(a,c,r,e.clientHeight,t,n)}S.start(40,t)}S.start(40,t)},onMouseLeave(){S.clear()}},s],stateAttributesMapping:ke});return w||o?D:null});function Yo(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return os){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?qa(l.offsetTop+l.offsetHeight-r+i,a):a}var Xo=Z.forwardRef(function(e,t){return(0,Q.jsx)(Jo,{...e,ref:t,direction:`down`})}),Zo=Z.forwardRef(function(e,t){return(0,Q.jsx)(Jo,{...e,ref:t,direction:`up`})}),Qo=Z.createContext(void 0),$o=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Z.useState(),c=Z.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=J(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,Q.jsx)(Qo.Provider,{value:c,children:l})}),es=Ja;function ts({className:e,...t}){return(0,Q.jsx)($o,{className:i(`scroll-my-1 p-1`,e),"data-slot":`select-group`,...t})}function ns({className:e,...t}){return(0,Q.jsx)(ro,{className:i(`flex flex-1 text-left`,e),"data-slot":`select-value`,...t})}function rs({className:e,size:t=`default`,children:n,...r}){return(0,Q.jsxs)(to,{className:i(`flex w-fit select-none items-center justify-between gap-1.5 whitespace-nowrap rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-placeholder:text-muted-foreground *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:hover:bg-input/50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),"data-size":t,"data-slot":`select-trigger`,...r,children:[n,(0,Q.jsx)(io,{render:(0,Q.jsx)(lr,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function is({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:a=`center`,alignOffset:o=0,alignItemWithTrigger:s=!0,...c}){return(0,Q.jsx)(ao,{children:(0,Q.jsx)(Co,{align:a,alignItemWithTrigger:s,alignOffset:o,className:`isolate z-50`,side:n,sideOffset:r,children:(0,Q.jsxs)(Mo,{className:i(`data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:fade-in-0 data-open:zoom-in-95 data-closed:fade-out-0 data-closed:zoom-out-95 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-y-auto overflow-x-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-closed:animate-out data-open:animate-in`,e),"data-align-trigger":s,"data-slot":`select-content`,...c,children:[(0,Q.jsx)(os,{}),(0,Q.jsx)(Bo,{children:t}),(0,Q.jsx)(ss,{})]})})})}function as({className:e,children:t,...n}){return(0,Q.jsxs)(Wo,{className:i(`relative flex w-full cursor-default select-none items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),"data-slot":`select-item`,...n,children:[(0,Q.jsx)(qo,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,Q.jsx)(Go,{render:(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,Q.jsx)(cr,{className:`pointer-events-none`})})})]})}function os({className:e,...t}){return(0,Q.jsx)(Zo,{className:i(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),"data-slot":`select-scroll-up-button`,...t,children:(0,Q.jsx)(ur,{})})}function ss({className:e,...t}){return(0,Q.jsx)(Xo,{className:i(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),"data-slot":`select-scroll-down-button`,...t,children:(0,Q.jsx)(lr,{})})}var cs=15e3,ls=`headgate.console.polling-interval-ms`,us=[{label:`Every 5 seconds`,value:5e3},{label:`Every 15 seconds`,value:15e3},{label:`Every 30 seconds`,value:3e4},{label:`Every minute`,value:6e4}],ds=new Set(us.map(e=>e.value)),fs=new Set,ps=cs,ms=!1;function hs(e){if(e===null)return cs;let t=Number(e);return ds.has(t)?t:cs}function gs(e,t){let n=ds.has(t)?t:cs;return e.setItem(ls,String(n)),n}function _s(){if(typeof window>`u`)return ps;try{ps=hs(window.localStorage.getItem(ls))}catch{}return ps}function vs(){for(let e of fs)e()}function ys(e){e.key===`headgate.console.polling-interval-ms`&&(ps=hs(e.newValue),vs())}function bs(e){return fs.add(e),!ms&&typeof window<`u`&&(window.addEventListener(`storage`,ys),ms=!0),()=>{fs.delete(e),ms&&fs.size===0&&(window.removeEventListener(`storage`,ys),ms=!1)}}function xs(e){let t=ds.has(e)?e:cs;ps=t;try{gs(window.localStorage,t)}catch{}return vs(),t}var Ss=(0,Z.createContext)(null);function Cs(){let e=(0,Z.useContext)(Ss);if(!e)throw Error(`useConsole must be used inside ConsoleLayout`);return e}function ws(e,t,n=!0){let r=(0,Z.useContext)(Ss);return dn({enabled:n,queryFn:({signal:e})=>t(e),queryKey:e,refetchInterval:r?.livePaused?!1:r?.pollingIntervalMs??15e3})}function Ts(e){let t=(0,Z.useContext)(Ss);return ln({queries:e.map(e=>({enabled:e.enabled??!0,queryFn:({signal:t})=>e.queryFn(t),queryKey:e.queryKey,refetchInterval:t?.livePaused?!1:t?.pollingIntervalMs??15e3}))})}function Es(e){let t=ws([`api`,e],t=>e===null?Promise.reject(Error(`API path is required.`)):ga(e,{signal:t}),!!e);return{data:t.data??null,error:t.error?t.error instanceof Error?t.error.message:String(t.error):null,loading:t.isPending}}function Ds(){let e=fe();return fn({mutationFn:({path:e,method:t=`POST`,body:n})=>ga(e,{body:n,method:t}),onSuccess:()=>e.invalidateQueries({queryKey:[`api`]})})}function Os({children:e}){return(0,Q.jsx)(`p`,{className:`py-8 text-center text-muted-foreground text-sm`,children:e})}function ks(){return(0,Q.jsxs)(`div`,{className:`flex min-h-48 items-center justify-center text-muted-foreground`,role:`status`,children:[(0,Q.jsx)(hr,{className:`mr-2 size-4 animate-spin motion-reduce:animate-none`}),`Loading…`]})}function As({message:e}){return(0,Q.jsxs)(`div`,{className:`rounded-xl border border-destructive/30 bg-destructive/5 p-4 text-destructive text-sm`,role:`alert`,children:[(0,Q.jsx)(yr,{className:`mr-2 inline size-4`}),e]})}function js(e){let[t,n]=(0,Z.useState)(!1),[r,i]=(0,Z.useState)(!1),a=(0,Z.useRef)(!1),o=(0,Z.useRef)(null),s=(0,Z.useRef)(null),c=(0,Z.useCallback)(e=>{a.current=e,i(e)},[]);return(0,Z.useEffect)(()=>{let t=new EventSource(`${ma.apiBase}/events`),r=Ms(e,()=>a.current,o,s);return t.onopen=()=>n(!0),t.onerror=()=>n(!1),t.onmessage=r.schedule,t.addEventListener(`queue_activity`,r.schedule),()=>{t.close(),r.dispose()}},[e]),{connected:t,paused:r,setPaused:c}}function Ms(e,t,n={current:null},r={current:null}){let i=()=>{n.current!==null&&window.clearTimeout(n.current),r.current!==null&&window.clearTimeout(r.current),n.current=null,r.current=null,e()};return{dispose:()=>{n.current!==null&&window.clearTimeout(n.current),r.current!==null&&window.clearTimeout(r.current),n.current=null,r.current=null},schedule:()=>{t()||(n.current!==null&&window.clearTimeout(n.current),n.current=window.setTimeout(i,700),r.current===null&&(r.current=window.setTimeout(i,2e3)))}}}var Ns={jobs:`Jobs`,overview:`Overview`,periodic:`Periodic schedules`,quarantine:`Quarantine`,queues:`Queues`,"rate-classes":`Rate classes`,workers:`Workers`,workflows:`Workflows`};function Ps(){let e=Vt({select:e=>e.location.pathname}),[t,n]=(0,Z.useState)(null),[r,i]=(0,Z.useState)(!1),a=(0,Z.useSyncExternalStore)(bs,_s,()=>cs),o=(0,Z.useSyncExternalStore)(qe,ot,()=>Ct),s=(0,Z.useRef)(null),c=fe(),l=(0,Z.useCallback)(()=>c.refetchQueries({queryKey:[`api`],type:`active`}),[c]),u=js(l),d=e.split(`/`).find(Boolean)??`queues`,f=(0,Z.useCallback)((e,t=`normal`)=>{s.current!==null&&window.clearTimeout(s.current),n({message:e,tone:t}),s.current=window.setTimeout(()=>n(null),3500)},[]),p=(0,Z.useCallback)(async()=>{if(!r){i(!0);try{await Promise.all([l(),new Promise(e=>window.setTimeout(e,400))]),f(`Data refreshed`)}catch(e){f(e instanceof Error?e.message:String(e),`error`)}finally{i(!1)}}},[r,f,l]),m=(0,Z.useCallback)(e=>{if(!e)return;let t=xs(Number(e));f(`Polling interval set to ${t/1e3} seconds`)},[f]),h=(0,Z.useCallback)(e=>{if(!e)return;let t=_t(e);f(`Theme set to ${t}`)},[f]),g=(0,Z.useMemo)(()=>({livePaused:u.paused,notify:f,pollingIntervalMs:a,refresh:l}),[l,f,u.paused,a]);return(0,Q.jsxs)(Ss.Provider,{value:g,children:[(0,Q.jsx)(`a`,{className:`sr-only fixed top-3 left-3 z-100 rounded-md bg-background px-3 py-2 focus:not-sr-only`,href:`#main-content`,children:`Skip to content`}),(0,Q.jsxs)(ta,{children:[(0,Q.jsx)(va,{}),(0,Q.jsxs)(ia,{className:`console-scrollbar`,children:[(0,Q.jsxs)(`header`,{className:`sticky top-0 z-30 flex h-14 shrink-0 items-center gap-3 border-b bg-background/95 px-4 backdrop-blur`,children:[(0,Q.jsx)(ra,{"aria-label":`Toggle navigation`}),(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 truncate font-medium text-sm`,children:Ns[d]??`headgate`}),ma.readOnly&&(0,Q.jsx)(Dr,{variant:`outline`,children:`read-only`}),(0,Q.jsxs)(Rr,{"aria-pressed":u.paused,onClick:()=>u.setPaused(!u.paused),size:`sm`,variant:`ghost`,children:[(0,Q.jsx)(`span`,{className:`size-2 rounded-full ${u.connected&&!u.paused?`bg-success`:`bg-muted-foreground`}`}),u.paused?`Resume updates`:u.connected?`Live`:`Polling`]}),(0,Q.jsx)(Rr,{"aria-busy":r||void 0,"aria-label":r?`Refreshing data`:`Refresh data`,disabled:r,onClick:()=>void p(),size:`icon`,title:r?`Refreshing…`:`Refresh data`,variant:`ghost`,children:(0,Q.jsx)(hr,{className:r?`animate-spin motion-reduce:animate-none`:``})}),(0,Q.jsxs)(ba,{children:[(0,Q.jsx)(xa,{render:(0,Q.jsx)(Rr,{"aria-label":`Console settings`,size:`icon`,title:`Console settings`,variant:`ghost`}),children:(0,Q.jsx)(_r,{"aria-hidden":!0})}),(0,Q.jsxs)(wa,{className:`inset-auto top-1/2 left-1/2 h-auto max-w-sm -translate-x-1/2 -translate-y-1/2 rounded-xl border`,children:[(0,Q.jsxs)(Ta,{children:[(0,Q.jsx)(Ea,{children:`Console Settings`}),(0,Q.jsx)(Da,{children:`Control how often this browser checks for fresh data. Live events can still refresh the console sooner.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(Oa,{htmlFor:`console-theme`,children:`Theme`}),(0,Q.jsxs)(es,{onValueChange:h,value:o,children:[(0,Q.jsx)(rs,{id:`console-theme`,children:(0,Q.jsx)(ns,{})}),(0,Q.jsx)(is,{children:(0,Q.jsx)(ts,{children:lt.map(e=>(0,Q.jsx)(as,{value:e.value,children:e.label},e.value))})})]}),(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`System follows your operating-system appearance.`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(Oa,{htmlFor:`polling-interval`,children:`Polling Interval`}),(0,Q.jsxs)(es,{onValueChange:m,value:String(a),children:[(0,Q.jsx)(rs,{id:`polling-interval`,children:(0,Q.jsx)(ns,{})}),(0,Q.jsx)(is,{children:(0,Q.jsx)(ts,{children:us.map(e=>(0,Q.jsx)(as,{value:String(e.value),children:e.label},e.value))})})]}),(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Saved in this browser. Pausing live updates also pauses polling.`})]})]})]})]})]}),(0,Q.jsx)(`main`,{className:`flex-1 scroll-mt-16 p-4 lg:p-6`,id:`main-content`,children:(0,Q.jsx)(w,{})})]})]}),(0,Q.jsx)(`div`,{"aria-live":`polite`,className:`pointer-events-none fixed bottom-4 left-1/2 z-70 -translate-x-1/2 rounded-lg px-4 py-2 text-sm shadow-lg transition-[opacity,transform] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none ${t?.tone===`error`?`bg-destructive text-white`:`bg-foreground text-background`} ${t?`translate-y-0 opacity-100`:`translate-y-2 opacity-0`}`,children:t?.message})]})}export{Vi as A,Rr as B,ha as C,Bi as D,Li as E,Xr as F,yr as G,Mr as H,Jr as I,cr as J,gr as K,Kr as L,Ni as M,ei as N,Wi as O,Zr as P,Wr as R,Ea as S,ma as T,Dr as U,Nr as V,Sr as W,ir as X,ar as Y,Oa as _,Ds as a,Da as b,Ts as c,is as d,ts as f,Ga as g,ns as h,ks as i,Ui as j,Hi as k,ws as l,rs as m,Os as n,Es as o,as as p,fr as q,As as r,Cs as s,Ps as t,es as u,ba as v,ga as w,Ta as x,wa as y,Vr as z}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/console-COYwGlau.js b/go/headgateui/dist/assets/console-COYwGlau.js new file mode 100644 index 0000000..84d3d94 --- /dev/null +++ b/go/headgateui/dist/assets/console-COYwGlau.js @@ -0,0 +1 @@ +import{a as e,r as t,s as n,u as r}from"./with-selector-hO0TNhHE.js";import{$ as i,$t as a,A as o,An as s,At as c,B as l,Bt as u,C as d,Cn as f,Ct as p,D as m,Dt as h,E as g,En as _,Et as v,F as y,Fn as b,Ft as x,G as S,Gt as C,H as w,Hn as T,Ht as E,I as D,In as O,It as k,J as A,Jt as j,K as M,Kn as ee,Kt as te,L as ne,Ln as N,M as P,Mt as re,N as F,Nn as I,Nt as L,O as R,On as z,Ot as B,P as V,Pt as H,Q as ie,Qn as ae,Qt as oe,R as se,Rn as ce,S as le,St as ue,T as U,Tn as de,Tt as fe,U as pe,Ut as me,V as W,Vn as he,Vt as ge,W as _e,Wn as ve,Wt as ye,X as be,Xt as xe,Y as Se,Yn as Ce,Yt as G,Z as K,Zn as we,Zt as Te,_ as Ee,_n as De,_t as Oe,an as ke,at as Ae,b as je,bt as Me,c as Ne,cn as Pe,ct as Fe,d as q,dn as Ie,dt as Le,en as Re,et as ze,f as Be,fn as Ve,ft as He,g as Ue,gn as We,gt as Ge,h as Ke,hn as qe,ht as Je,i as Ye,in as Xe,it as Ze,j as Qe,jt as $e,k as et,kt as tt,ln as nt,lt as rt,m as it,mn as at,mt as ot,n as st,nn as ct,nt as lt,o as ut,on as dt,ot as ft,p as pt,pn as J,pt as mt,q as ht,qt as gt,r as _t,rn as vt,rt as yt,s as bt,sn as xt,st as St,t as Ct,tn as wt,tt as Tt,u as Et,un as Dt,ut as Ot,v as kt,vt as At,w as jt,wn as Mt,wt as Y,x as Nt,xn as Pt,xt as X,y as Ft,yn as It,yt as Lt,z as Rt,zn as zt,zt as Bt}from"./theme-CN9-NrCi.js";function Vt(e){let n=t({warn:e?.router===void 0}),r=e?.router||n;return ae(r.stores.__store,we(e,r))}var Ht=class extends de{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Wt(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Gt(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Gt(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof N(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!ce(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Kt(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||N(this.options.enabled,this.#t)!==N(t.enabled,this.#t)||N(this.options.staleTime,this.#t)!==N(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||N(this.options.enabled,this.#t)!==N(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ce(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(I)),t}#h(e){return!_()&&N(this.options.enabled,this.#t)!==!1&&s(e)}#g(){this.#b();let e=N(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=he(this.#r.dataUpdatedAt,e)+1;this.#u=T.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=T.setInterval(()=>{(this.options.refetchIntervalInBackground||Mt.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(T.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(T.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Wt(e,t),o=i&&Kt(e,n,t,r);(a||o)&&(l={...l,...Pt(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=b(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=b(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,x=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&x,isStale:qt(e,t),refetch:this.refetch,isEnabled:N(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),ce(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();f.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Ut(e,t){return N(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||N(t.retryOnMount,e)!==!1)}function Wt(e,t){return Ut(e,t)||e.state.data!==void 0&&Gt(e,t,t.refetchOnMount)}function Gt(e,t,n){if(N(t.enabled,e)!==!1&&N(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&qt(e,t)}return!1}function Kt(e,t,n,r){return(e!==t||N(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&qt(e,n)}function qt(e,t){return N(t.enabled,e)!==!1&&e.isStaleByTime(N(t.staleTime,e))}var Jt=class extends de{#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),ce(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&z(t.mutationKey)!==z(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??It();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){f.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)})})}};function Yt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var Xt=class extends de{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,f.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!ce(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Yt(e,n).forEach(e=>{e.destroy()}),Yt(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=O(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Ht(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&f.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Z=r(n(),1),Zt=Z.createContext(!1),Qt=()=>Z.useContext(Zt);Zt.Provider;var Q=e();function $t(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var en=Z.createContext($t()),tn=()=>Z.useContext(en),nn=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?zt(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},rn=e=>{Z.useEffect(()=>{e.clearReset()},[e])},an=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||zt(n,[e.error,r])),on=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},sn=(e,t)=>e?.suspense&&t.isPending,cn=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ln({queries:e,...t},n){let r=ve(n),i=Qt(),a=tn(),o=t.subscribed!==!1,s=Z.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{on(e);let t=r.getQueryCache().get(e.queryHash);nn(e,a,t)}),rn(a);let[c]=Z.useState(()=>new Xt(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),p=!i&&o;Z.useSyncExternalStore(Z.useCallback(e=>p?c.subscribe(f.batchCalls(e)):I,[c,p]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),Z.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let m=l.some((e,t)=>sn(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&sn(n,e)?cn(n,new Ht(r,n),a):[]}):[];if(m.length>0)throw Promise.all(m);let h=l.find((e,t)=>{let n=s[t];return n&&an({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(h)throw h.error;return u(d())}function un(e,t,n){let r=Qt(),i=tn(),a=ve(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,on(o),nn(o,i,s),rn(i);let[l]=Z.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(Z.useSyncExternalStore(Z.useCallback(e=>{let t=d?l.subscribe(f.batchCalls(e)):I;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),Z.useEffect(()=>{l.setOptions(o)},[o,l]),sn(o,u))throw cn(o,l,i);if(an({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function dn(e,t){return un(e,Ht,t)}function fn(e,t){let n=ve(t),[r]=Z.useState(()=>new Jt(n,e));Z.useEffect(()=>{r.setOptions(e)},[r,e]);let i=Z.useSyncExternalStore(Z.useCallback(e=>r.subscribe(f.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=Z.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(I)},[r]);if(i.error&&zt(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var pn=0;function mn(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(pn);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),We;let o=requestAnimationFrame(a);return pn=o,()=>{pn===o&&(cancelAnimationFrame(o),pn=0)}}var hn={inert:new WeakMap,"aria-hidden":new WeakMap},gn=`data-base-ui-inert`,_n={inert:new WeakSet,"aria-hidden":new WeakSet},vn=new WeakMap,yn=0;function bn(e){return _n[e]}function xn(e){return e?ct(e)?e.host:xn(e.parentNode):null}var Sn=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=xn(t);return e.contains(n)?n:null}).filter(e=>e!=null),Cn=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},wn=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{Te(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function Tn(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=Sn(t,e),l=i?wn(t,Cn(c),new Set(c)):[],u=[],d=[];if(a){let e=hn[a],n=bn(a);s=n,o=e;let r=Sn(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);wn(t,Cn(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(vn.get(e)||0)+1;vn.set(e,t),d.push(e),t===1&&e.setAttribute(gn,``)}),yn+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(vn.get(e)||0)-1;vn.set(e,t),t||e.removeAttribute(gn)}),--yn,yn||(hn.inert=new WeakMap,hn[`aria-hidden`]=new WeakMap,_n.inert=new WeakSet,_n[`aria-hidden`]=new WeakSet,vn=new WeakMap)}}function En(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=X(e[0]).body;return Tn(e,a,n,r,{mark:i})}function Dn(e,t){let n=oe(te(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var On=20,kn=[];function An(){kn=kn.filter(e=>e.deref()?.isConnected)}function jn(e){An(),e&&Te(e)!==`body`&&(kn.push(new WeakRef(e)),kn.length>On&&(kn=kn.slice(-20)))}function Mn(){return An(),kn[kn.length-1]?.deref()}function Nn(e){return e?rt(e)?e:Ot(e)[0]||e:null}function Pn(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=Ae(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return rt(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function Fn(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:m,getInsideElements:g}=e,_=`rootStore`in t?t.rootStore:t,y=_.useState(`open`),b=_.useState(`domReferenceElement`),x=_.useState(`floatingElement`),{events:S,dataRef:w}=_.context,T=Y(()=>w.current.floatingContext?.nodeId),D=i===!1,O=E(b)&&D,k=fe(i),j=fe(a),ee=fe(l),ne=fe(y),N=M(m),P=A(),F=Z.useRef(!1),I=Z.useRef(!1),L=Z.useRef(!1),R=Z.useRef(null),z=Z.useRef(``),V=Z.useRef(``),H=Z.useRef(null),ie=Z.useRef(null),ae=v(H,f,P?.beforeInsideRef),oe=v(ie,P?.afterInsideRef),se=Ie(),ce=Ie(),le=p(),ue=P!=null,U=ge(x),de=Y((e=U)=>e?Ot(e):[]),pe=Y(()=>g?.().filter(e=>e!=null)??[]);Z.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&C(U,ye(X(U)))&&de().length===0&&!O&&dt(e)}let t=X(U);return B(t,`keydown`,e)},[r,U,s,O,de]),Z.useEffect(()=>{if(r||!y)return;let e=X(U);function t(){L.current=!1}function n(e){let t=te(e),n=pe(),r=C(x,t)||C(b,t)||C(P?.portalNode,t)||n.some(e=>e===t||C(e,t));L.current=!r,V.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(I.current=!0,ce.start(0,()=>{I.current=!1}))}function i(){V.current=`keyboard`}return h(B(e,`pointerdown`,n,!0),B(e,`pointerup`,t,!0),B(e,`pointercancel`,t,!0),B(e,`keydown`,i,!0),t)},[r,x,b,U,y,P,ce,pe]),Z.useEffect(()=>{if(r||!c)return;let e=X(U);function t(){I.current=!0,ce.start(0,()=>{I.current=!1})}function n(e){let t=te(e);rt(t)&&(R.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=te(t);s&&n==null&&i!=null&&C(x,i)&&jn(i),queueMicrotask(()=>{let a=T(),c=_.context.triggerElements,l=pe(),f=n?.hasAttribute(lt(`focus-guard`))&&[H.current,ie.current,P?.beforeInsideRef.current,P?.afterInsideRef.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,_e(d),_e(u)].includes(n),p=!(C(b,n)||C(x,n)||C(n,x)||C(P?.portalNode,n)||l.some(e=>e===n||C(e,n))||c.hasMatchingElement(e=>C(e,n))||f||N&&(Ze(N.nodesRef.current,a).find(e=>C(e.context?.elements.floating,n)||C(e.context?.elements.domReference,n))||yt(N.nodesRef.current,a).find(e=>[e.context?.elements.floating,ge(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===b&&U&&Pn(U),o&&r!==b&&!ot(i)&&ye(e)===e.body){if(Re(U)&&(U.focus(),o===`popup`)){le.request(()=>{U.focus()});return}let e=de(),t=R.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||U;Re(n)&&n.focus()}if(w.current.insideReactTree){w.current.insideReactTree=!1;return}(O||!s)&&n&&p&&!I.current&&(O||n!==Mn())&&(F.current=!0,_.setOpen(!1,tt(re,t)))})}function a(){L.current||(w.current.insideReactTree=!0,se.start(0,()=>{w.current.insideReactTree=!1}))}let l=Re(b)?b:null;if(!(!x&&!l))return h(l&&B(l,`focusout`,i),l&&B(l,`pointerdown`,t),x&&B(x,`focusin`,n),x&&B(x,`focusout`,i),x&&P&&B(x,`focusout`,a,!0))},[r,b,x,U,s,N,P,_,c,o,de,O,T,w,se,ce,le,u,d,pe]),Z.useEffect(()=>{if(r||!x||!y)return;let e=Array.from(P?.portalNode?.querySelectorAll(`[${lt(`portal`)}]`)||[]),t=(N?yt(N.nodesRef.current,T()):[]).find(e=>E(e.context?.elements.domReference||null))?.context?.elements.domReference,n=En([x,...e,H.current,ie.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,...pe(),t,_e(d),_e(u),O?b:null].filter(e=>e!=null),{ariaHidden:s||O,mark:!1}),i=En([x,...e].filter(e=>e!=null));return()=>{i(),n()}},[y,r,b,x,s,P,O,N,T,u,d,pe]),J(()=>{if(!y||r||!Re(U))return;z.current=``,V.current=``;let e=X(U),t=ye(e);queueMicrotask(()=>{let n=k.current,r=typeof n==`function`?n(ee.current||``):n;if(r===void 0||r===!1||C(U,t))return;let i=null,a=()=>(i??=de(U),i[0]||U),o;o=r===!0||r===null?a():_e(r),o||=a();let s=C(U,ye(e));mn(o,{preventScroll:o===U,shouldFocus(){if(!ne.current)return!1;if(s)return!0;let t=ye(e);return!(t!==o&&C(U,t))}})})},[r,y,U,de,k,ee,ne]),J(()=>{if(r||!U)return;let e=X(U),t=ye(e),n=ee.current==null;jn(t);function i(e){if(e.open||(z.current=Dn(e.nativeEvent,V.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(F.current=!0),e.reason===`outside-press`){if(e.nested)F.current=!1;else if(Xe(e.nativeEvent)||ke(e.nativeEvent))F.current=!1;else{let e=!1;X(U).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?F.current=!1:F.current=!0}}}S.on(`openchange`,i);function a(e){let r=j.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=b?.isConnected?b:null,o=t?.isConnected&&Te(t)!==`body`?t:null,s=n?o||a:a||o;return s||=Mn()||null,typeof i==`boolean`?s:_e(i)||s||null}return()=>{S.off(`openchange`,i);let t=ye(e),n=pe(),r=C(x,t)||n.some(e=>e===t||C(e,t))||N&&Ze(N.nodesRef.current,T(),!1).some(e=>C(e.context?.elements.floating,t)),o=j.current,s=z.current,c=a(s);queueMicrotask(()=>{let n=Nn(c),i=typeof o!=`boolean`;if(o&&!F.current&&Re(n)&&(!(!i&&n!==t&&t!==e.body)||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}F.current=!1})}},[r,x,U,j,ee,S,N,b,T,pe]),J(()=>{if(!Pe||y||!x)return;let e=ye(X(x));!Re(e)||!me(e)||C(x,e)&&e.blur()},[y,x]),J(()=>{if(!(r||!P))return P.setFocusManagerState({modal:s,closeOnFocusOut:c,open:y,onOpenChange:_.setOpen,domReference:b}),()=>{P.setFocusManagerState(null)}},[r,P,s,y,_,c,b]),J(()=>{if(!(r||!U))return Pn(U),()=>{queueMicrotask(An)}},[r,U]);let W=!r&&(!s||!O)&&(ue||s);return(0,Q.jsxs)(Z.Fragment,{children:[W&&(0,Q.jsx)(At,{"data-type":`inside`,ref:ae,onFocus:e=>{if(s){let e=de();mn(e[e.length-1])}else P?.portalNode&&(F.current=!1,Fe(e,P.portalNode)?ft(b)?.focus():_e(d??P.beforeOutsideRef)?.focus())}}),n,W&&(0,Q.jsx)(At,{"data-type":`inside`,ref:oe,onFocus:e=>{s?mn(de()[0]):P?.portalNode&&(c&&(F.current=!0),Fe(e,P.portalNode)?St(b)?.focus():_e(u??P.afterOutsideRef)?.focus())}})]})}function In(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=Bt}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=Z.useRef(void 0),f=p(),m=Ie(),h=Z.useMemo(()=>{function e(e,t,n,r){let i=tt(c,t,n);e&&r===`touch`&&s>0?m.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=vt(e.pointerType,!0)&&ke(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||vt(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=te(o);if(me(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}vt(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,m,s]);return Z.useMemo(()=>n?{reference:h}:qe,[n,h])}function Ln(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=Tt(),o=S()!=null,s=De(()=>new Rt({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new g,floatingId:i,syncOnly:!1,nested:o})).current;return J(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=a(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),s.update(e)},[t,i,r.reference,r.floating,s]),s.context.onOpenChange=n,s.context.nested=o,s}var Rn=`Escape`;function zn(e){return Pe&&e.movementX===0&&e.movementY===0}function Bn(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Vn(e,t){return Bn(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Hn(e,t,n){return Bn(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Un(e,t,n){return Bn(t,n?e===j:e===G,e===gt)}function Wn(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===Rn:Bn(t,n?e===G:e===j,e===xe)}function Gn(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:m=!0,openOnArrowKeyDown:h=!0,disabledIndices:g=void 0,orientation:_=`vertical`,parentOrientation:v,id:y,resetOnPointerLeave:b=!0,externalTree:w,grid:T}=t,D=T!=null,O=`rootStore`in e?e.rootStore:e,k=O.useState(`open`),A=O.useState(`floatingElement`),j=O.useState(`domReferenceElement`),ee=O.context.dataRef,ne=ge(A),N=E(j),P=fe(ne),F=S(),I=M(w),L=Z.useRef(f),R=Z.useRef(o??-1),z=Z.useRef(null),B=Z.useRef(!0),V=Y(e=>{i(R.current===-1?null:R.current,e)}),H=Z.useRef(!!A),ie=Z.useRef(k),ae=Z.useRef(!1),oe=Z.useRef(!1),se=Z.useRef(null),ce=fe(g),le=fe(k),ue=fe(o),U=fe(b),de=p(),pe=p(),me=Y(()=>{function e(e){d?I?.events.emit(`virtualfocus`,e):se.current=mn(e,{sync:ae.current,preventScroll:!0})}let t=n.current[R.current],r=oe.current;t&&e(t),(ae.current?e=>e():e=>de.request(e))(()=>{let i=n.current[R.current]||t;i&&(t||e(i),xe&&(r||!B.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});J(()=>{ee.current.orientation=_},[ee,_]),J(()=>{a&&(k&&A?(R.current=o??-1,L.current&&o!=null&&(oe.current=!0,V())):H.current&&(R.current=-1,V()))},[a,k,A,o,V]),J(()=>{if(a){if(!k){ae.current=!1;return}if(A){if(r==null){if(ae.current=!1,ue.current!=null)return;if(H.current&&(R.current=-1,me()),(!ie.current||!H.current)&&L.current&&(z.current!=null||L.current===!0&&z.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>pe.request(e):queueMicrotask)(t),e+=1):(R.current=z.current==null||Hn(z.current,_,u)||l?mt(n):He(n),z.current=null,V())};t()}}else Je(n.current,r)||(R.current=r,me(),oe.current=!1)}}},[a,k,A,r,ue,l,n,_,u,V,me,pe]),J(()=>{if(!a||A||!I||d||!H.current)return;let e=I.nodesRef.current,t=e.find(e=>e.id===F)?.context?.elements.floating,n=ye(X(j??t??null)),r=e.some(e=>e.context&&C(e.context.elements.floating,n));t&&!r&&B.current&&t.focus({preventScroll:!0})},[a,A,j,I,F,d]),J(()=>{ie.current=k,H.current=!!A}),J(()=>{k||(z.current=null,L.current=f)},[k,f]);let W=r!=null,he=Y(e=>{if(!le.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(R.current!==t||r!==t)&&(R.current=t,V(e))}),_e=Y(()=>v??I?.nodesRef.current.find(e=>e.id===F)?.context?.dataRef?.current.orientation),ve=Y(()=>mt(n,ce.current)),be=Y(e=>{if(B.current=!1,ae.current=!0,e.which===229||!le.current&&e.currentTarget===P.current)return;if(l&&Wn(e.key,_,u,D)){Vn(e.key,_e())||dt(e),O.setOpen(!1,tt(x,e.nativeEvent)),Re(j)&&(d?I?.events.emit(`virtualfocus`,j):j.focus());return}let t=R.current,r=mt(n,g),i=He(n,g);if(N||(e.key===`Home`&&(dt(e),R.current=r,V(e)),e.key===`End`&&(dt(e),R.current=i,V(e))),T!=null){let t=T(e,R.current,n,_,c,u,g,r,i);if(t!=null&&(R.current=t,V(e)),_===`both`)return}if(Vn(e.key,_)){if(dt(e),k&&!d&&ye(e.currentTarget.ownerDocument)===e.currentTarget){R.current=Hn(e.key,_,u)?r:i,V(e);return}Hn(e.key,_,u)?c?t>=i?s&&t!==n.current.length?R.current=-1:(ae.current=!1,R.current=r):R.current=Le(n.current,{startingIndex:t,disabledIndices:g}):R.current=Math.min(i,Le(n.current,{startingIndex:t,disabledIndices:g})):c?t<=r?s&&t!==-1?R.current=n.current.length:(ae.current=!1,R.current=i):R.current=Le(n.current,{startingIndex:t,decrement:!0,disabledIndices:g}):R.current=Math.max(r,Le(n.current,{startingIndex:t,decrement:!0,disabledIndices:g})),Je(n.current,R.current)&&(R.current=-1),V(e)}}),xe=Z.useMemo(()=>({onFocus(e){ae.current=!0,he(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){zn(e)||(ae.current=!0,oe.current=!1,m&&he(e))},onPointerLeave(e){if(!le.current||!B.current||e.pointerType===`touch`)return;ae.current=!0;let t=e.relatedTarget;if(!(!m||n.current.includes(t))&&U.current&&(se.current?.(),se.current=null,R.current=-1,V(e),!d)){let e=P.current,t=ye(X(e));e&&C(e,t)&&e.focus({preventScroll:!0})}}}),[he,le,P,m,n,V,U,d]),Se=Z.useMemo(()=>d&&k&&W&&{"aria-activedescendant":`${y}-${r}`},[d,k,W,y,r]),Ce=Z.useMemo(()=>({"aria-orientation":_===`both`?void 0:_,...N?{}:Se,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&k&&!d){let t=te(e.nativeEvent);if(t&&!C(P.current,t))return;dt(e),O.setOpen(!1,tt(re,e.nativeEvent)),Re(j)&&j.focus();return}be(e)},onPointerMove(e){zn(e)||(B.current=!0)}}),[Se,be,P,_,N,O,k,d,j]),G=Z.useMemo(()=>{function e(e){O.setOpen(!0,tt(x,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&Xe(e.nativeEvent)&&(L.current=!d)}function n(e){L.current=f,f===`auto`&&ke(e.nativeEvent)&&(L.current=!0)}return{onKeyDown(t){let n=O.select(`open`);B.current=!1;let r=t.key.startsWith(`Arrow`),i=Un(t.key,_e(),u),a=Vn(t.key,_),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return be(t);if(!(!n&&!h&&r)){if(o){let e=Vn(t.key,_e());z.current=l&&e?null:t.key}if(l){i&&(dt(t),n?(R.current=ve(),V(t)):e(t));return}a&&(ue.current!=null&&(R.current=ue.current),dt(t),!n&&h?e(t):be(t),n&&V(t))}},onFocus(e){O.select(`open`)&&!d&&(R.current=-1,V(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[be,f,ve,l,V,O,h,_,_e,u,ue,d]),K=Z.useMemo(()=>({...Se,...G}),[Se,G]);return Z.useMemo(()=>a?{reference:K,floating:Ce,item:xe,trigger:G}:{},[a,K,Ce,G,xe])}function Kn(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=Ie(),m=Z.useRef(``),h=Z.useRef(u??i??-1),g=Z.useRef(null),_=Y(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!ot(n)||n?.matches(`:disabled`)?!1:o==null||!Ge(at,e,o)}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t0&&e.key===` `&&(dt(e),s?.(!0)),m.current.length>0&&m.current[0]!==` `&&d(_,m.current)===-1&&e.key!==` `&&s?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(dt(e),s?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,s?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=d(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,s?.(!1)):(a?.(b),g.current=b)}),v=Y(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);C(n,t)||C(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});J(()=>{!f&&u!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]);let y=Z.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return Z.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}function qn(e){return ze(19)?e:e?`true`:void 0}function Jn(e){let[t,n]=Z.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}var Yn=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Xn=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Zn=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Qn=e=>{let t=Zn(e);return t.charAt(0).toUpperCase()+t.slice(1)},$n={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},er=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},tr=(0,Z.createContext)({}),nr=()=>(0,Z.useContext)(tr),rr=(0,Z.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=nr()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,Z.createElement)(`svg`,{ref:c,...$n,width:t??l??$n.width,height:t??l??$n.height,stroke:e??f,strokeWidth:m,className:Yn(`lucide`,p,i),...!a&&!er(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,Z.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),ir=(e,t)=>{let n=(0,Z.forwardRef)(({className:n,...r},i)=>(0,Z.createElement)(rr,{ref:i,iconNode:t,className:Yn(`lucide-${Xn(Qn(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Qn(e),n},ar=ir(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),or=ir(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338`,key:`7hb8p4`}],[`path`,{d:`M3 9h5.859`,key:`numkqi`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),sr=ir(`chart-no-axes-combined`,[[`path`,{d:`M12 16v5`,key:`zza2cw`}],[`path`,{d:`M16 14.639V21`,key:`1s85h0`}],[`path`,{d:`M20 10.656V21`,key:`q45596`}],[`path`,{d:`m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15`,key:`1fw8x9`}],[`path`,{d:`M4 18.463V21`,key:`1otddq`}],[`path`,{d:`M8 14.656V21`,key:`1t2idw`}]]),cr=ir(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),lr=ir(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),ur=ir(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),dr=ir(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),fr=ir(`git-fork`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),pr=ir(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),mr=ir(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),hr=ir(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),gr=ir(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),_r=ir(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),vr=ir(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),yr=ir(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),br=ir(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function xr(e){return K(e.defaultTagName??`div`,e,e)}function Sr(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e==`boolean`?`${e}`:e===0?`0`:e,Tr=Cr,Er=(e,t)=>n=>{if(t?.variants==null)return Tr(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=wr(t)||wr(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Tr(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Dr=Z.createContext(void 0);function Or(e=!1){let t=Z.useContext(Dr);if(t===void 0&&!e)throw Error(Ve(16));return t}function kr(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:Z.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function Ar(e,t,{detail:n=0}={}){e.dispatchEvent(new(oe(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function jr(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:a=!0,composite:o}=e,s=Z.useRef(null),c=Or(!0),l=o??c!==void 0,{props:u}=kr({focusableWhenDisabled:n,disabled:t,composite:l,tabIndex:r,isNativeButton:a}),d=Z.useCallback(()=>{let e=s.current;Mr(e)&&l&&t&&u.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,u.disabled,l]);return J(d,[d]),{getButtonProps:Z.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:o,onKeyDown:s,onPointerDown:c,...d}=e;return i({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(ie(e),s?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,i=Mr(r),o=!a&&Nr(r),c=n&&(a?i:!o),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&l&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!a||i)&&(e.preventBaseUIHandler(),Ar(r,e));return}if(!c||a||!d&&!u){n&&o&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),Ar(r,e)))},onKeyUp(e){if(!t){if(ie(e),o?.(e),e.target===e.currentTarget&&a&&l&&Mr(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!a&&!l&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),Ar(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}c?.(e)}},a?{type:`button`}:{role:`button`},u,d)},[t,u,l,a]),buttonRef:Y(e=>{s.current=e,d()})}}function Mr(e){return Re(e)&&e.tagName===`BUTTON`}function Nr(e){return Re(e)&&e.tagName===`A`&&!!e.href}var Pr=Z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=jr({disabled:i,focusableWhenDisabled:a,native:o});return K(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),Fr=Er(`group/button inline-flex shrink-0 select-none items-center justify-center whitespace-nowrap rounded-lg border border-transparent bg-clip-padding font-medium text-sm outline-none transition-[color,background-color,border-color,box-shadow,transform,opacity] duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:scale-[0.97] disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 motion-reduce:active:not-aria-[haspopup]:scale-100 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{defaultVariants:{size:`default`,variant:`default`},variants:{size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-lg":`size-9`,"icon-sm":`size-7 in-data-[slot=button-group]:rounded-lg rounded-[min(var(--radius-md),12px)]`,"icon-xs":`size-6 in-data-[slot=button-group]:rounded-lg rounded-[min(var(--radius-md),10px)] [&_svg:not([class*='size-'])]:size-3`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 gap-1 in-data-[slot=button-group]:rounded-lg rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,xs:`h-6 gap-1 in-data-[slot=button-group]:rounded-lg rounded-[min(var(--radius-md),10px)] px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`},variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 dark:hover:bg-destructive/30`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`}}});function Ir({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,Q.jsx)(Pr,{className:q(Fr({className:e,size:n,variant:t})),"data-slot":`button`,...r})}var Lr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Rr={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},zr={valid(e){return e===null?null:e?{"data-valid":``}:{"data-invalid":``}}},Br={invalid:void 0,name:void 0,validityData:{state:Lr,errors:[],error:``,value:``,initialValue:null},setValidityData:We,disabled:void 0,setTouched:We,setDirty:We,setFilled:We,setFocused:We,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:Rr,registerFieldControl:We,validation:{getValidationProps:(e,t=qe)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:We,getInputControl:()=>null,commit:async()=>{},change:We}},Vr=Z.createContext(Br);function Hr(e=!0){let t=Z.useContext(Vr);if(t.setValidityData===We&&!e)throw Error(Ve(28));return t}var Ur=Z.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:We,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function Wr(){return Z.useContext(Ur)}var Gr=Z.createContext({controlId:void 0,registerControlId:We,labelId:void 0,setLabelId:We,messageIds:[],setMessageIds:We,getDescriptionProps:e=>e});function Kr(){return Z.useContext(Gr)}function qr(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:o}=Kr(),s=Ue(t),c=n?i:void 0,l=De(()=>Symbol()),u=Z.useRef(!1),d=Z.useRef(t!=null),f=Y(()=>{!u.current||o===We||(u.current=!1,o(l.current,void 0))});return J(()=>{if(o===We)return;let e;if(n){let n=r?.current;e=a(n)&&n.closest(`label`)!=null?t??null:c??s}else if(t!=null)d.current=!0,e=t;else if(d.current)e=s;else{f();return}if(e===void 0){f();return}u.current=!0,o(l.current,e)},[t,r,c,o,n,s,l,f]),Z.useEffect(()=>f,[f]),i??s}function Jr({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=Z.useRef(e!==void 0),[a,o]=Z.useState(t);return[i?e:a,Z.useCallback(e=>{i||o(e)},[])]}function Yr(e,t,n,r,i=!0,a){let{registerFieldControl:o}=Hr(),s=De(()=>Symbol());J(()=>{let c=s.current;if(!i){o(c,void 0);return}o(c,{controlRef:e,getValue:r,id:t,name:a,value:n})},[e,i,r,t,a,o,s,n]),J(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}var Xr=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:b,validationMode:x,validation:S}=Hr(),{clearErrors:C}=Wr(),w=h||s,T=m??a,E={...p,disabled:w},{labelId:D}=Kr(),O=qr({id:i});J(()=>{let e=o!=null;S.inputRef.current?.value||e&&o!==``?b(!0):e&&o===``&&b(!1)},[S.inputRef,b,o]);let A=Z.useRef(null);J(()=>{u&&A.current===ye(X(A.current))&&y(!0)},[u,y]);let[j]=Jr({controlled:o,default:l,name:`FieldControl`,state:`value`}),M=o!==void 0,ee=M?j:void 0,te=Y(()=>S.inputRef.current?.value);return Yr(S.inputRef,O,ee,te,!w,a),K(`input`,e,{ref:[t,A],state:E,props:[{id:O,disabled:w,name:T,ref:S.inputRef,"aria-labelledby":D,autoFocus:u,...M?{value:ee}:{defaultValue:l},onChange(e){let t=e.currentTarget.value;c?.(t,tt(k,e.nativeEvent)),_(t!==(v.initialValue??``)),b(t!==``),e.nativeEvent.defaultPrevented||(C(T),S.change(t))},onFocus(){y(!0)},onBlur(e){g(!0),y(!1),x===`onBlur`&&S.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(g(!0),S.commit(e.currentTarget.value))}},f,e=>S.getValidationProps(w,e)],stateAttributesMapping:zr})}),Zr=Z.forwardRef(function(e,t){return(0,Q.jsx)(Xr,{ref:t,...e})});function Qr({className:e,type:t,...n}){return(0,Q.jsx)(Zr,{className:q(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base outline-none transition-colors file:inline-flex file:h-6 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:disabled:bg-input/80`,e),"data-slot":`input`,type:t,...n})}var $r=Z.createContext(void 0);function ei(e){let t=Z.useContext($r);if(!e&&t===void 0)throw Error(Ve(27));return t}var ti=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=ei(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`),d={open:c,transitionStatus:s.useState(`transitionStatus`)};return K(`div`,e,{state:d,ref:[s.context.backdropRef,t],stateAttributesMapping:kt,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),ni=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=ei(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=jr({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,tt($e,e.nativeEvent))}return K(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),ri=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=ei(),c=Ue(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),K(`p`,e,{ref:t,props:[{id:c},o]})}),ii=Z.createContext(void 0);function ai(){let e=Z.useContext(ii);if(e===void 0)throw Error(Ve(26));return e}var oi=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]),si={...Ee,...Nt,nestedDialogOpen(e){return e?{"data-nested-dialog-open":``}:null}},ci=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=ei(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),h=c.useState(`mounted`),g=c.useState(`nested`),_=c.useState(`nestedOpenDialogCount`),v=c.useState(`open`),y=c.useState(`openMethod`),b=c.useState(`titleElementId`),x=c.useState(`transitionStatus`),S=c.useState(`role`),C=d.useState(`floatingId`);ai(),ne({open:v,ref:c.context.popupRef,onComplete(){v&&c.context.onOpenChangeComplete?.(!0)}});let w=o===void 0?et(c.context.popupRef):o,T=_>0,E=c.useStateSetter(`popupElement`),D=K(`div`,e,{state:{open:v,nested:g,transitionStatus:x,nestedDialogOpen:T},props:[f,{id:C,"aria-labelledby":b,"aria-describedby":l,role:S,...m,hidden:!h,onKeyDown(e){oi.has(e.key)&&e.stopPropagation()},style:{"--nested-dialogs":_}},s],ref:[t,c.context.popupRef,E],stateAttributesMapping:si});return(0,Q.jsx)(Fn,{context:d,openInteractionType:y,disabled:!h,closeOnFocusOut:!u,initialFocus:w,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:D})}),li=Z.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,Q.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),ui=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=ei(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,Q.jsx)(ii.Provider,{value:n,children:(0,Q.jsxs)(ht,{ref:t,...r,children:[a&&o===!0&&(0,Q.jsx)(li,{ref:i.context.internalBackdropRef,inert:qn(!s)}),e.children]})}):null}),di={},fi={},pi=``;function mi(e,t){return wt(e)?e:t}function hi(e,t,n){return/hidden|clip/.test(e.getComputedStyle(mi(t,n)).overflowY)}function gi(e){if(typeof document>`u`)return!1;let t=X(e);return oe(t).innerWidth-t.documentElement.clientWidth>0}function _i(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=X(e),n=t.documentElement,r=t.body,i=mi(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function vi(e){let t=X(e),n=t.documentElement,r=t.body,i=mi(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function yi(e){let t=X(e),n=t.documentElement,r=t.body,i=oe(n),a=0,o=0,s=!1,c=ue.create();if(Pe&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,di={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},pi=n.style.scrollBehavior,fi={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=mi(n,r);if(s=_i(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,di),Object.assign(r.style,fi),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=pi)}function d(){u(),c.request(l)}l();let f=B(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var bi=new class{lockCount=0;restore=null;timeoutLock=Dt.create();timeoutUnlock=Dt.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=X(e),n=t.documentElement,r=t.body,i=oe(n);if(hi(i,n,r)){let t=new i.MutationObserver(()=>{hi(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=nt||!gi(e);this.restore=a?vi(e):yi(e)}};function xi(e=!0,t=null){J(()=>{if(e)return bi.acquire(t)},[e,t])}function Si({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=Z.useState(0),[u,d]=Z.useState(0),f=c===0,p=pe(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=te(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||C(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return xi(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),J(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),F(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var Ci={...U,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},wi=class extends l{constructor(e,t,n){let r=new g,i=Ti(e,r,t,n);super(i,Ei(r),Ci)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};o(n,e,t.trigger),this.update(n)}};function Ti(e,t,n,r=!1){let i={...d(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e};return i.floatingRootContext=jt(t,n,r),i}function Ei(e){return{popupRef:Z.createRef(),backdropRef:Z.createRef(),internalBackdropRef:Z.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Di(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=ei(!0),b={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},x=V((e,t)=>new wi({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...b},e,t),!0);x.useControlledProp(`openProp`,r),x.useControlledProp(`triggerIdProp`,d),x.useSyncedValues(b),x.useContextCallback(`onOpenChange`,a),x.useContextCallback(`onOpenChangeComplete`,o);let S=x.useState(`open`),C=x.useState(`mounted`),w=x.useState(`payload`);y(x,S),Qe(x);let{forceUnmount:T}=P(S,x);Z.useImperativeHandle(l,()=>({unmount:T,close:()=>x.setOpen(!1,tt(L))}),[T,x]);let E=S||C;return(0,Q.jsxs)($r.Provider,{value:x,children:[u&&(0,Q.jsx)(R,{handle:u,store:x}),E&&(0,Q.jsx)(Si,{store:x,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:w}):n]})}function Oi(e){return Di(`dialog`,e)}var ki=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=ei(),c=Ue(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),K(`h2`,e,{ref:t,props:[{id:c},o]})});function Ai(e){let t=Z.useRef(``),n=Z.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Z.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function ji(e,t){let n=Z.useRef(e),r=Y(t);J(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Mi(e,t){let{onClick:n,onPointerDown:r}=Ai(Y((n,r)=>{(typeof e==`function`?e():e)||t(r||(nt?`touch`:``))}));return Z.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function Ni(e){let[t,n]=Z.useState(null),r=Mi(e,n);return ji(e,t=>{t&&!e&&n(null)}),Z.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var Pi=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=ei(!0),f=le(l)??d;if(!f)throw Error(Ve(79));let p=Ue(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=Z.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=D(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=jr({disabled:a,native:o}),S=In(m),C=Mi(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return K(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[Se]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:je})});function Fi({...e}){return(0,Q.jsx)(Oi,{"data-slot":`sheet`,...e})}function Ii({...e}){return(0,Q.jsx)(ui,{"data-slot":`sheet-portal`,...e})}function Li({className:e,...t}){return(0,Q.jsx)(ti,{className:q(`fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),"data-slot":`sheet-overlay`,...t})}function Ri({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,Q.jsxs)(Ii,{children:[(0,Q.jsx)(Li,{}),(0,Q.jsxs)(ci,{className:q(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-popover-foreground text-sm shadow-lg transition duration-200 ease-in-out data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=bottom]:inset-x-0 data-[side=top]:inset-x-0 data-[side=left]:inset-y-0 data-[side=right]:inset-y-0 data-[side=top]:top-0 data-[side=right]:right-0 data-[side=bottom]:bottom-0 data-[side=left]:left-0 data-[side=bottom]:h-auto data-[side=left]:h-full data-[side=right]:h-full data-[side=top]:h-auto data-[side=left]:w-3/4 data-[side=right]:w-3/4 data-[side=bottom]:border-t data-[side=left]:border-r data-[side=top]:border-b data-[side=right]:border-l data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,e),"data-side":n,"data-slot":`sheet-content`,...i,children:[t,r&&(0,Q.jsx)(ni,{"data-slot":`sheet-close`,render:(0,Q.jsxs)(Ir,{className:`absolute top-3 right-3`,size:`icon-sm`,variant:`ghost`,children:[(0,Q.jsx)(br,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function zi({className:e,...t}){return(0,Q.jsx)(`div`,{className:q(`flex flex-col gap-0.5 p-4`,e),"data-slot":`sheet-header`,...t})}function Bi({className:e,...t}){return(0,Q.jsx)(`div`,{className:q(`mt-auto flex flex-col gap-2 p-4`,e),"data-slot":`sheet-footer`,...t})}function Vi({className:e,...t}){return(0,Q.jsx)(ki,{className:q(`cn-font-heading font-medium text-base text-foreground`,e),"data-slot":`sheet-title`,...t})}function Hi({className:e,...t}){return(0,Q.jsx)(ri,{className:q(`text-muted-foreground text-sm`,e),"data-slot":`sheet-description`,...t})}var Ui=768;function Wi(){let[e,t]=(0,Z.useState)(void 0);return(0,Z.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=()=>{t(window.innerWidthe.removeEventListener(`change`,n)},[]),!!e}var Gi=`sidebar_state`,Ki=604800,qi=`16rem`,Ji=`18rem`,Yi=`3rem`,Xi=`b`,Zi=Z.createContext(null);function Qi(){let e=Z.useContext(Zi);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function $i({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=Wi(),[c,l]=Z.useState(!1),[u,d]=Z.useState(e),f=t??u,p=Z.useCallback(e=>{let t=typeof e==`function`?e(f):e;n?n(t):d(t),document.cookie=`${Gi}=${t}; path=/; max-age=${Ki}`},[n,f]),m=Z.useCallback(()=>s?l(e=>!e):p(e=>!e),[s,p]);Z.useEffect(()=>{let e=e=>{e.key===Xi&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m]);let h=f?`expanded`:`collapsed`,g=Z.useMemo(()=>({isMobile:s,open:f,openMobile:c,setOpen:p,setOpenMobile:l,state:h,toggleSidebar:m}),[h,f,p,s,c,m]);return(0,Q.jsx)(Zi.Provider,{value:g,children:(0,Q.jsx)(`div`,{className:q(`group/sidebar-wrapper flex h-full w-full has-data-[variant=inset]:bg-sidebar`,r),"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":qi,"--sidebar-width-icon":Yi,...i},...o,children:a})})}function ea({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,dir:a,...o}){let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=Qi();return n===`none`?(0,Q.jsx)(`div`,{className:q(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),"data-slot":`sidebar`,...o,children:i}):s?(0,Q.jsx)(Fi,{onOpenChange:u,open:l,...o,children:(0,Q.jsxs)(Ri,{className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,"data-mobile":`true`,"data-sidebar":`sidebar`,"data-slot":`sidebar`,dir:a,side:e,style:{"--sidebar-width":Ji},children:[(0,Q.jsxs)(zi,{className:`sr-only`,children:[(0,Q.jsx)(Vi,{children:`Sidebar`}),(0,Q.jsx)(Hi,{children:`Displays the mobile sidebar.`})]}),(0,Q.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,Q.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-collapsible":c===`collapsed`?n:``,"data-side":e,"data-slot":`sidebar`,"data-state":c,"data-variant":t,children:[(0,Q.jsx)(`div`,{className:q(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`),"data-slot":`sidebar-gap`}),(0,Q.jsx)(`div`,{className:q(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=right]:right-0 data-[side=left]:left-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] md:flex`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),"data-side":e,"data-slot":`sidebar-container`,...o,children:(0,Q.jsx)(`div`,{className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,children:i})})]})}function ta({className:e,onClick:t,...n}){let{toggleSidebar:r}=Qi();return(0,Q.jsxs)(Ir,{className:q(e),"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,onClick:e=>{t?.(e),r()},size:`icon-sm`,variant:`ghost`,...n,children:[(0,Q.jsx)(mr,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function na({className:e,...t}){return(0,Q.jsx)(`main`,{className:q(`scrollbar-thin relative flex w-full flex-1 flex-col overflow-y-auto bg-background md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm`,e),"data-slot":`sidebar-inset`,...t})}function ra({className:e,...t}){return(0,Q.jsx)(`div`,{className:q(`flex flex-col gap-2 p-2`,e),"data-sidebar":`header`,"data-slot":`sidebar-header`,...t})}function ia({className:e,...t}){return(0,Q.jsx)(`div`,{className:q(`flex flex-col gap-2 p-2`,e),"data-sidebar":`footer`,"data-slot":`sidebar-footer`,...t})}function aa({className:e,...t}){return(0,Q.jsx)(`div`,{className:q(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),"data-sidebar":`content`,"data-slot":`sidebar-content`,...t})}function oa({className:e,...t}){return(0,Q.jsx)(`div`,{className:q(`relative flex w-full min-w-0 flex-col p-2`,e),"data-sidebar":`group`,"data-slot":`sidebar-group`,...t})}function sa({className:e,render:t,...n}){return xr({defaultTagName:`div`,props:i({className:q(`flex h-8 shrink-0 items-center rounded-md px-2 font-medium text-sidebar-foreground/70 text-xs outline-hidden ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 [&>svg]:size-4 [&>svg]:shrink-0`,e)},n),render:t,state:{sidebar:`group-label`,slot:`sidebar-group-label`}})}function ca({className:e,...t}){return(0,Q.jsx)(`ul`,{className:q(`flex w-full min-w-0 flex-col gap-0`,e),"data-sidebar":`menu`,"data-slot":`sidebar-menu`,...t})}function la({className:e,...t}){return(0,Q.jsx)(`li`,{className:q(`group/menu-item relative`,e),"data-sidebar":`menu-item`,"data-slot":`sidebar-menu-item`,...t})}var ua=Er(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&_svg]:size-4 [&_svg]:shrink-0`,{defaultVariants:{size:`default`,variant:`default`},variants:{size:{default:`h-8 text-sm`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`,sm:`h-7 text-xs`},variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]`}}});function da({render:e,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:a,className:o,...s}){let{isMobile:c,state:l}=Qi(),u=xr({defaultTagName:`button`,props:i({className:q(ua({size:r,variant:n}),o)},s),render:a?(0,Q.jsx)(Et,{render:e}):e,state:{active:t,sidebar:`menu-button`,size:r,slot:`sidebar-menu-button`}});return a?(typeof a==`string`&&(a={children:a}),(0,Q.jsxs)(bt,{children:[u,(0,Q.jsx)(Ne,{align:`center`,hidden:l!==`collapsed`||c,side:`right`,...a})]})):u}var fa={apiBase:window.HEADGATE?.apiBase??`/api/v1`,readOnly:window.HEADGATE?.readOnly??!1},pa=class extends Error{status;constructor(e,t){super(e),this.status=t}};async function ma(e,t={}){let n=t.method??`GET`;if(fa.readOnly&&n!==`GET`)throw new pa(`This console is read-only.`,403);let r=new Headers(t.headers),{body:i}=t;n!==`GET`&&(r.set(`Idempotency-Key`,crypto.randomUUID()),typeof i==`object`&&i&&!(i instanceof Blob)&&(r.set(`Content-Type`,`application/json`),i=JSON.stringify(i)));let a=await fetch(`${fa.apiBase}${e}`,{...t,body:i,headers:r,method:n}),o=await a.text(),s=null;try{s=o?JSON.parse(o):null}catch{s=o}if(!a.ok)throw new pa(s&&typeof s==`object`&&`error`in s?String(s.error):`Request failed (${a.status})`,a.status);return s}var ha=[{icon:sr,label:`Overview`,to:`/overview`},{icon:dr,label:`Queues`,to:`/queues`},{icon:pr,label:`Jobs`,to:`/jobs`},{icon:fr,label:`Workflows`,to:`/workflows`},{icon:ar,label:`Rate classes`,to:`/rate-classes`},{icon:vr,label:`Quarantine`,to:`/quarantine`},{icon:or,label:`Periodic`,to:`/periodic`},{icon:gr,label:`Workers`,to:`/workers`}];function ga(e){let t=Vt({select:e=>e.location.pathname}),n=dn({queryFn:({signal:e})=>ma(`/meta`,{signal:e}),queryKey:[`api`,`meta`],retry:1,staleTime:1/0}),r=n.data?.version?.trim(),i=r?`${_a.test(r)?`v`:``}${r}`:n.isPending?`…`:`version unavailable`;return(0,Q.jsxs)(ea,{collapsible:`icon`,variant:`inset`,...e,children:[(0,Q.jsx)(ra,{children:(0,Q.jsx)(ca,{children:(0,Q.jsx)(la,{children:(0,Q.jsxs)(da,{render:(0,Q.jsx)(Ce,{to:`/overview`}),size:`lg`,tooltip:`headgate`,children:[(0,Q.jsx)(`img`,{alt:``,className:`size-8 shrink-0`,height:`32`,src:`/favicon.svg`,width:`32`}),(0,Q.jsxs)(`div`,{className:`grid flex-1 text-left leading-tight`,children:[(0,Q.jsx)(`span`,{className:`truncate font-semibold`,children:`headgate`}),(0,Q.jsx)(`span`,{className:`truncate text-xs`,children:`operations console`})]})]})})})}),(0,Q.jsx)(aa,{children:(0,Q.jsxs)(oa,{children:[(0,Q.jsx)(sa,{children:`Operate`}),(0,Q.jsx)(ca,{className:`gap-0.5`,children:ha.map(e=>(0,Q.jsx)(la,{children:(0,Q.jsxs)(da,{isActive:t===e.to||t.startsWith(`${e.to}/`),render:(0,Q.jsx)(Ce,{to:e.to}),tooltip:e.label,children:[(0,Q.jsx)(e.icon,{}),(0,Q.jsx)(`span`,{children:e.label})]})},e.to))})]})}),(0,Q.jsx)(ia,{children:(0,Q.jsxs)(`div`,{className:`space-y-0.5 px-2 text-sidebar-foreground/65 text-xs group-data-[collapsible=icon]:hidden`,children:[(0,Q.jsxs)(`p`,{children:[`Headgate`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,translate:`no`,children:i})]}),(0,Q.jsxs)(`p`,{className:`truncate`,title:`API ${fa.apiBase}`,children:[`API `,fa.apiBase]})]})})]})}var _a=/^\d/,va=Er(`inline-flex h-5 w-fit items-center rounded-full px-2 font-medium text-xs`,{defaultVariants:{variant:`secondary`},variants:{variant:{default:`bg-primary text-primary-foreground`,destructive:`bg-destructive/10 text-destructive`,outline:`border border-border text-foreground`,secondary:`bg-muted text-muted-foreground`,success:`bg-success/10 text-success`,warning:`bg-warning/10 text-warning`}}});function ya({className:e,variant:t,...n}){return(0,Q.jsx)(`span`,{className:q(va({variant:t}),e),...n})}function ba({...e}){return(0,Q.jsx)(Oi,{"data-slot":`dialog`,...e})}function xa({...e}){return(0,Q.jsx)(Pi,{"data-slot":`dialog-trigger`,...e})}function Sa({...e}){return(0,Q.jsx)(ui,{"data-slot":`dialog-portal`,...e})}function Ca({className:e,...t}){return(0,Q.jsx)(ti,{className:q(`data-open:fade-in-0 data-closed:fade-out-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 data-closed:animate-out data-open:animate-in supports-backdrop-filter:backdrop-blur-xs`,e),"data-slot":`dialog-overlay`,...t})}function wa({className:e,children:t,showCloseButton:n=!0,...r}){return(0,Q.jsxs)(Sa,{children:[(0,Q.jsx)(Ca,{}),(0,Q.jsxs)(ci,{className:q(`data-open:fade-in-0 data-open:zoom-in-95 data-closed:fade-out-0 data-closed:zoom-out-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground text-sm outline-none ring-1 ring-foreground/10 duration-100 data-closed:animate-out data-open:animate-in sm:max-w-sm`,e),"data-slot":`dialog-content`,...r,children:[t,n&&(0,Q.jsx)(ni,{"data-slot":`dialog-close`,render:(0,Q.jsxs)(Ir,{className:`absolute top-2 right-2`,size:`icon-sm`,variant:`ghost`,children:[(0,Q.jsx)(br,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function Ta({className:e,...t}){return(0,Q.jsx)(`div`,{className:q(`flex flex-col gap-2`,e),"data-slot":`dialog-header`,...t})}function Ea({className:e,...t}){return(0,Q.jsx)(ki,{className:q(`cn-font-heading font-medium text-base leading-none`,e),"data-slot":`dialog-title`,...t})}function Da({className:e,...t}){return(0,Q.jsx)(ri,{className:q(`text-muted-foreground text-sm *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),"data-slot":`dialog-description`,...t})}function Oa({className:e,...t}){return(0,Q.jsx)(`label`,{className:q(`font-medium text-sm`,e),...t})}function ka(e){let t=Z.useRef(!0);t.current&&(t.current=!1,e())}function Aa(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var ja=Z.createContext(null);function Ma(){let e=Z.useContext(ja);if(e===null)throw Error(Ve(60));return e}var Na=(e,t)=>Object.is(e,t);function Pa(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Fa(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e!==void 0&&Pa(e,t,n))}function Ia(e,t,n){return e.filter(e=>!Pa(t,e,n))}function La(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Ra(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function za(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Ra(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Ba(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return La(e)}function Va(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?La(e.value):La(e)}function Ha(e,t,n){function r(){return Ba(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=Ra(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Ua(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Q.jsx)(Z.Fragment,{children:Ha(r,t,n)},i)),e),[])}var $={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Va(t,r)!==``},hasNullItemLabel:(e,t)=>t?za(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>Pa(t,e,n)):Pa(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function Wa(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function Ga(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function Ka(e,t){return Math.max(0,e-t)}function qa(e,t){if(t<=0)return 0;let n=Ga(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function Ja(e){let{id:t,value:n,defaultValue:r=null,onValueChange:a,open:o,defaultOpen:s=!1,onOpenChange:c,name:u,form:d,autoComplete:f,disabled:p=!1,readOnly:h=!1,required:g=!1,modal:_=!0,actionsRef:y,inputRef:b,onOpenChangeComplete:x,items:S,multiple:C=!1,itemToStringLabel:w,itemToStringValue:T,isItemEqualToValue:E=Na,highlightItemOnHover:D=!0,children:O}=e,{clearErrors:A}=Wr(),{setDirty:j,setTouched:M,setFocused:ee,validityData:te,setFilled:N,name:P,disabled:re,validation:F,validationMode:I}=Hr(),L=qr({id:t}),R=re||p,z=P??u,[B,V]=Jr({controlled:n,default:C?r??at:r,name:`Select`,state:`value`}),[H,ie]=Jr({controlled:o,default:s,name:`Select`,state:`open`}),ae=Z.useRef([]),oe=Z.useRef([]),ce=Z.useRef(null),le=Z.useRef(null),ue=Z.useRef(0),U=Z.useRef(null),de=Z.useRef([]),me=Z.useRef(!1),he=Z.useRef(null),ge=Z.useRef(null),_e=Z.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ve=Z.useRef(!1),{mounted:ye,setMounted:be,transitionStatus:xe}=se(H),{openMethod:Se,triggerProps:Ce}=Ni(H),G=De(()=>new l({id:L,labelId:void 0,modal:_,multiple:C,itemToStringLabel:w,itemToStringValue:T,isItemEqualToValue:E,value:B,open:H,mounted:ye,transitionStatus:xe,items:S,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,K=W(G,$.activeIndex),we=W(G,$.selectedIndex),Te=W(G,$.triggerElement),Ee=W(G,$.positionerElement),Oe=Jn(Se),ke=Se??Oe,Ae=Z.useMemo(()=>C?``:Va(B,T),[C,B,T]),je=Z.useMemo(()=>C&&Array.isArray(B)?B.map(e=>Va(e,T)):Va(B,T),[C,B,T]);Yr(fe(Te),L,B,Y(()=>je),!R,u);let Ne=Z.useRef(B),Pe=C?Array.isArray(B)&&B.length>0:B!=null&&Ae!==``;J(()=>{N(Pe)},[Pe,N]),J(function(){let e=B,t=!1;if(C){let n=Array.isArray(B)?B:[];t=n.length===0,e=n[n.length-1]}let n=t?-1:Fa(de.current,e,E),r=n===-1?null:n;r===null&&(ge.current=null),!H&&G.set(`selectedIndex`,r)},[C,H,B,E,G]);function Fe(e){let t=te.initialValue;return Array.isArray(e)&&Array.isArray(t)?!Wa(e,t,(e,t)=>Pa(e,t,E)):e!==t}ji(B,()=>{A(z),j(Fe(B)),F.change(B)});let q=Y((e,t)=>{c?.(e,t),!t.isCanceled&&(ie(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(M(!0),ee(!1),I===`onBlur`&&F.commit(B)))}),Ie=Y(()=>{be(!1),G.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),x?.(!1)});ne({enabled:!y,open:H,ref:ce,onComplete(){H||Ie()}}),Z.useImperativeHandle(y,()=>({unmount:Ie}),[Ie]);let Le=Y((e,t)=>{a?.(e,t),!t.isCanceled&&V(e)}),Re=Y(e=>{let t=Ka(e.scrollHeight,e.clientHeight),n=qa(e.scrollTop,t),r=n>0,i=nAa(ae.current[e]),onMatch(e){H?G.set(`activeIndex`,e):Le(de.current[e],tt(k))},onTyping(e){me.current=e}}),We=Z.useMemo(()=>i(Ue.reference,He.reference,Ve.reference,Be.reference,Ce),[Be.reference,Ue.reference,He.reference,Ve.reference,Ce]),Ge=Z.useMemo(()=>i(m,Ue.floating,He.floating,Ve.floating),[Ue.floating,He.floating,Ve.floating]),Ke=He.item??qe;ka(()=>{G.update({popupProps:Ge,triggerProps:We})}),G.useSyncedValues({id:L,modal:_,multiple:C,value:B,open:H,mounted:ye,transitionStatus:xe,popupProps:Ge,triggerProps:We,items:S,itemToStringLabel:w,itemToStringValue:T,isItemEqualToValue:E,openMethod:ke});let Je=Z.useMemo(()=>({store:G,floatingContext:ze,required:g,disabled:R,readOnly:h,multiple:C,highlightItemOnHover:D,setValue:Le,setOpen:q,listRef:ae,popupRef:ce,scrollHandlerRef:le,handleScrollArrowVisibility:Re,scrollArrowsMountedCountRef:ue,itemProps:Ke,valueRef:U,valuesRef:de,labelsRef:oe,typingRef:me,selectionRef:_e,firstItemTextRef:he,selectedItemTextRef:ge,validation:F,onOpenChangeComplete:x,alignItemWithTriggerActiveRef:ve,initialValueRef:Ne}),[G,ze,g,R,h,C,D,Le,q,Ke,F,x,Re]),Ye=v(b,F.inputRef),Xe=C?void 0:z,Ze=Z.useMemo(()=>!C||!Array.isArray(B)||!z?null:B.map(e=>{let t=Va(e,T);return(0,Q.jsx)(`input`,{type:`hidden`,form:d,name:z,value:t,disabled:R},t)}),[C,B,d,z,T,R]);return(0,Q.jsxs)(ja.Provider,{value:Je,children:[O,(0,Q.jsx)(`input`,{...F.getValidationProps(R,{onFocus(){G.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||R||h)return;let t=e.currentTarget.value,n=tt(k,e.nativeEvent);function r(){if(C)return;let e=t.toLowerCase(),r=de.current.findIndex(t=>Va(t,T).toLowerCase()===e||Ba(t,w).toLowerCase()===e);r===-1&&(r=de.current.findIndex((t,n)=>{let r=oe.current[n];return r!=null&&r.toLowerCase()===e}));let i=de.current[r];i!=null&&Le(i,n)}G.set(`forceMount`,!0),queueMicrotask(r)}}),id:L&&Xe==null?`${L}-hidden-input`:void 0,form:d,name:Xe,autoComplete:f,value:Ae,disabled:R,required:g&&!(C&&Pe),readOnly:h,ref:Ye,style:z?Me:Lt,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ze]})}function Ya(e,t){return e??t}var Xa=5;function Za(e,t){let n=Qa(t);return e.clientX>=n.left-Xa&&e.clientX<=n.right+Xa&&e.clientY>=n.top-Xa&&e.clientY<=n.bottom+Xa}function Qa(e){let t=e.getBoundingClientRect(),n=oe(e);if(xt)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var $a=400,eo={...Ft,...zr,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},to=Z.forwardRef(function(e,t){let{render:n,className:r,id:a,disabled:o=!1,nativeButton:s=!0,style:l,...u}=e,{setTouched:d,setFocused:f,validationMode:p,state:m,disabled:h}=Hr(),{labelId:g}=Kr(),{store:_,setOpen:v,selectionRef:y,validation:b,readOnly:x,required:S,alignItemWithTriggerActiveRef:w,disabled:T}=Ma(),E=h||T||o,D=W(_,$.open),O=W(_,$.mounted),A=W(_,$.value),j=W(_,$.triggerProps),M=W(_,$.positionerElement),ee=W(_,$.listElement),te=W(_,$.popupSide),ne=W(_,$.id),N=W(_,$.labelId),P=W(_,$.hasSelectedValue),re=O&&M?te:null,F=a??ne,I=Ya(g,N);qr({id:F});let L=fe(M),R=Z.useRef(null),{getButtonProps:z,buttonRef:B}=jr({disabled:E,native:s}),V=_.useStateSetter(`triggerElement`),H=Ie(),ie=Ie(),ae=Ie();Z.useEffect(()=>{if(D)return ae.start($a,()=>{y.current.allowUnselectedMouseUp=!0,y.current.allowSelectedMouseUp=!0}),()=>{ae.clear()};y.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},ie.clear()},[D,y,ie,ae]);let oe=i(j,{id:F,role:`combobox`,"aria-expanded":D,"aria-haspopup":`listbox`,"aria-controls":D?ee?.id??ge(M)?.id:void 0,"aria-labelledby":I,"aria-readonly":x||void 0,"aria-required":S||void 0,tabIndex:E?-1:0,onFocus(e){f(!0),D&&w.current&&v(!1,tt(k,e.nativeEvent)),H.start(0,()=>{_.set(`forceMount`,!0)})},onBlur(e){C(M,e.relatedTarget)||(d(!0),f(!1),p===`onBlur`&&b.commit(A))},onMouseDown(e){if(D)return;let t=X(e.currentTarget);function n(e){if(!R.current)return;let t=e.target;C(R.current,t)||C(L.current,t)||Za(e,R.current)||v(!1,tt(c,e))}ie.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},u,z),se=b.getValidationProps(E,oe);se.role=`combobox`;let ce={...m,open:D,disabled:E,value:A,readOnly:x,popupSide:re,placeholder:!P};return K(`button`,e,{ref:[t,R,B,V],state:ce,stateAttributesMapping:eo,props:se})}),no={value:()=>null},ro=Z.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=Ma(),u=W(c,$.value),d=W(c,$.items),f=W(c,$.itemToStringLabel),p=W(c,$.hasSelectedValue),m=!p&&a!=null&&i==null,h=W(c,$.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(m&&!h?a:Array.isArray(u)?Ua(u,d,f):Ha(u,d,f)),K(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:no})}),io=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=Ma(),s={open:W(o,$.open)};return K(`span`,e,{state:s,ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:je})}),ao=Z.forwardRef(function(e,t){let{store:n}=Ma(),r=W(n,$.mounted),i=W(n,$.forceMount);return r||i?(0,Q.jsx)(ht,{ref:t,...e}):null}),oo=Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function so(){return Z.useContext(oo)}function co(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Y(i),[,o]=Z.useState(!1),s=De(uo).current,c=De(lo).current,l=Z.useRef(0),u=Z.useRef(!0),d=Z.useRef([]),f=Z.useRef(null),p=Y(()=>{u.current||(u.current=!0,o(e=>!e))}),m=Y((e,t)=>{c.set(e,t),p()}),h=Y(e=>{c.delete(e),p()}),g=Y(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!mo(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&ho(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;tt.observe(e,{childList:!0}))}let v=Y(()=>{let[e,t]=fo(c),n=g(e);_(t),d.current=e,u.current=!1,s.forEach(e=>e(n)),a(n)});J(()=>(u.current||g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),J(()=>{u.current&&v()}),J(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=Y(e=>(s.add(e),()=>{s.delete(e)})),b=Z.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,Q.jsx)(oo.Provider,{value:b,children:t})}function lo(){return new Map}function uo(){return new Set}function fo(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>ho(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function po(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function mo(e){for(let t of e)for(let e=0;e{if(!e||!t||n==null){a(!1);return}let r=X(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-bo)},[e,t,n]),xi(e&&(!t||i),r)}var So={position:`fixed`},Co=Z.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=be,style:_,...v}=e,{store:y,listRef:b,labelsRef:x,alignItemWithTriggerActiveRef:S,selectedItemTextRef:C,valuesRef:w,initialValueRef:T,popupRef:E,setValue:D,floatingContext:O}=Ma(),A=W(y,$.open),j=W(y,$.mounted),M=W(y,$.modal),ee=W(y,$.value),te=W(y,$.openMethod),ne=W(y,$.positionerElement),N=W(y,$.triggerElement),P=W(y,$.isItemEqualToValue),re=W(y,$.transitionStatus),F=Z.useRef(null),I=Z.useRef(null),[L,R]=Z.useState(h),z=j&&L&&te!==`touch`;!j&&L!==h&&R(h),Z.useImperativeHandle(S,()=>z),xo((z||M)&&A,te===`touch`,ne,N);let B=it({anchor:n,floatingRootContext:O,positionMethod:a,mounted:j,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??z,collisionAvoidance:g,keepMounted:!0}),V=z?`none`:B.side,H=z?So:B.positionerStyles,ie={open:A,side:V,align:B.align,anchorHidden:B.anchorHidden};J(()=>{y.set(`popupSide`,B.side)},[y,B.side]);let ae=y.useStateSetter(`positionerElement`),oe=Be(e,ie,{styles:H,transitionStatus:re,props:v,refs:[t,ae],hidden:!j,inert:!A}),se=Z.useRef(0),ce=Y(e=>{if(w.current.length===0)return;let t=se.current;if(se.current=e.size,e.size===t)return;let n=tt(k);if(t!==0&&!y.state.multiple&&ee!==null&&Fa(w.current,ee,P)===-1){let e=T.current,t=e!=null&&Fa(w.current,e,P)!==-1?e:null;D(t,n),t===null&&(y.set(`selectedIndex`,null),C.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(ee)){let e=ee.filter(e=>Fa(w.current,e,P)!==-1);e.length!==ee.length&&(D(e,n),e.length===0&&(y.set(`selectedIndex`,null),C.current=null))}if(A&&z){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};vo(ne,e),vo(E.current,e)}}),le=Z.useMemo(()=>({...B,side:V,alignItemWithTriggerActive:z,setControlledAlignItemWithTrigger:R,scrollUpArrowRef:F,scrollDownArrowRef:I}),[B,V,z,R]);return(0,Q.jsx)(co,{elementsRef:b,labelsRef:x,onMapChange:ce,children:(0,Q.jsxs)(go.Provider,{value:le,children:[j&&M&&(0,Q.jsx)(li,{inert:qn(!A),cutout:N}),oe]})})}),wo=`base-ui-disable-scrollbar`,To={className:wo,getElement(e){return(0,Q.jsx)(`style`,{nonce:e,href:wo,precedence:`base-ui:low`,children:`.${wo}{scrollbar-width:none}.${wo}::-webkit-scrollbar{display:none}`})}},Eo=Z.createContext(void 0);function Do(e){let t=Z.useContext(Eo);if(t===void 0&&!e)throw Error(Ve(69));return t}var Oo=Z.createContext(void 0),ko={disableStyleElements:!1};function Ao(){return Z.useContext(Oo)??ko}var jo={...Ee,...Nt},Mo=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:d,valueRef:f,firstItemTextRef:m,selectedItemTextRef:h,multiple:g,handleScrollArrowVisibility:_,scrollHandlerRef:v,listRef:y,highlightItemOnHover:b,floatingContext:x}=Ma(),{side:S,align:C,alignItemWithTriggerActive:w,isPositioned:T,setControlledAlignItemWithTrigger:E}=_o(),D=Do(!0)!=null,O=Ke(),{nonce:k,disableStyleElements:A}=Ao(),j=W(s,$.id),M=W(s,$.open),ee=W(s,$.openMethod),te=W(s,$.mounted),N=W(s,$.popupProps),P=W(s,$.transitionStatus),re=W(s,$.triggerElement),F=W(s,$.positionerElement),I=W(s,$.listElement),L=Z.useRef(!1),R=Z.useRef(!1),z=Z.useRef({}),V=p(),H=Y(e=>{if(!F||!c.current||!R.current)return;let t=F.style.top===`0px`,n=F.style.bottom===`0px`;if(L.current||!w||!t&&!n){_(e);return}let r=Fo(F),i=Io(F.getBoundingClientRect().height,`y`,r),a=X(F),o=oe(F),s=o.getComputedStyle(F),l=parseFloat(s.marginTop),u=parseFloat(s.marginBottom),d=No(o.getComputedStyle(c.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,m=Po(e),h=null,g=e=>{F.style.height=`${e}px`},v=t?m-p:p,y=Math.min(i+v,f);if(v<=1){let n=Ga(v,0,f-i);n>0&&g(i+n),e.scrollTop=t?m:0,f-(i+n)<=1&&(L.current=!0),_(e);return}f-y>1?h=t?1/0:0:n&&p1&&(e.scrollTop=t)}b>=f-1&&(L.current=!0),_(e)});Z.useImperativeHandle(v,()=>H,[H]),ne({open:M,ref:c,onComplete(){M&&l?.(!0)}});let ie={open:M,transitionStatus:P,side:S,align:C};J(()=>{!F||!c.current||Object.keys(z.current).length||(z.current={top:F.style.top||`0`,left:F.style.left||`0`,right:F.style.right,height:F.style.height,bottom:F.style.bottom,minHeight:F.style.minHeight,maxHeight:F.style.maxHeight,marginTop:F.style.marginTop,marginBottom:F.style.marginBottom})},[c,F]),J(()=>{M||w||(R.current=!1,L.current=!1,vo(F,z.current))},[M,w,F,c]),J(()=>{let e=c.current;if(!M||!re||!F||!e||w&&!T||s.state.transitionStatus===`ending`)return;if(R.current=!0,e.style.removeProperty(`--transform-origin`),!w){V.request(()=>_(I||e));return}let t=zo(e);try{let t=h.current;t?.isConnected||(t=!$.hasSelectedValue(s.state)&&m.current?.isConnected?m.current:null);let n=f.current,r=oe(F),i=r.getComputedStyle(F),a=r.getComputedStyle(e),o=X(re),c=Fo(re),l=Lo(re.getBoundingClientRect(),c),u=Lo(F.getBoundingClientRect(),c),d=l.height,p=I||e,g=p.scrollHeight,v=parseFloat(a.borderBottomWidth),x=parseFloat(i.marginTop)||10,S=parseFloat(i.marginBottom)||10,C=parseFloat(i.minHeight)||100,w=No(a),T=o.documentElement.clientHeight-x-S,D=o.documentElement.clientWidth,k=T-l.bottom+d,A,j=O===`rtl`?l.right-u.width:l.left,M=0;if(t&&n){let e=Lo(n.getBoundingClientRect(),c);A=Lo(t.getBoundingClientRect(),c),j=u.left+(O===`rtl`?e.right-A.right:e.left-A.left);let r=e.top-l.top+e.height/2;M=A.top-u.top+A.height/2-r}let ee=k+M+S+v,te=Math.min(T,ee),ne=T-x-S,N=ee-te,P=D-5;F.style.left=`${Ga(j,5,P-u.width)}px`,F.style.height=`${te}px`,F.style.maxHeight=`none`,F.style.marginTop=`${x}px`,F.style.marginBottom=`${S}px`,e.style.height=`100%`;let R=Po(p),B=N>=R-1;B&&(te=Math.min(T,u.height)-(N-R));let V=l.top<20||l.bottom>T-20||Math.ceil(te)+1=ne?`0`:`${e}px`,F.style.height=`${te}px`,p.scrollTop=Po(p)}else F.style.bottom=`0`,p.scrollTop=N;if(A){let t=u.top,n=u.height,r=A.top+A.height/2,i=Ga(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(ie===T||te>=w)&&(L.current=!0),_(p),b&&s.state.selectedIndex===null&&s.state.activeIndex===null&&y.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,M,F,re,f,m,h,c,_,w,E,V,I,y,b,O,T]),Z.useEffect(()=>{if(!w||!F||!M)return;let e=oe(F);function t(e){d(!1,tt(u,e))}return B(e,`resize`,t)},[d,w,F,M]);let ae={...I?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":g||void 0,id:`${j}-list`},onKeyDown(e){D&&oi.has(e.key)&&e.stopPropagation()},onScroll(e){I||H(e.currentTarget)},...w&&{style:I?{height:`100%`}:yo},className:!I&&w?To.className:void 0},se=K(`div`,e,{ref:[t,c],state:ie,stateAttributesMapping:jo,props:[N,ae,pt(P),o]});return(0,Q.jsxs)(Z.Fragment,{children:[!A&&To.getElement(k),(0,Q.jsx)(Fn,{context:x,modal:!1,disabled:!te,openInteractionType:ee,returnFocus:a,restoreFocus:!0,children:se})]})});function No(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function Po(e){return Ka(e.scrollHeight,e.clientHeight)}function Fo(e){return w.getScale(e)}function Io(e,t,n){return e/n[t]}function Lo(e,t){return Oe({x:Io(e.x,`x`,t),y:Io(e.y,`y`,t),width:Io(e.width,`x`,t),height:Io(e.height,`y`,t)})}var Ro=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function zo(e){let{style:t}=e,n={};for(let[e,r]of Ro)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of Ro){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Bo=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s,multiple:c}=Ma(),{alignItemWithTriggerActive:l}=_o(),u=W(o,$.hasScrollArrows),d=W(o,$.openMethod),f={id:`${W(o,$.id)}-list`,role:`listbox`,"aria-multiselectable":c||void 0,onScroll(e){s.current?.(e.currentTarget)},...l&&{style:yo},className:u&&d!==`touch`?To.className:void 0},p=o.useStateSetter(`listElement`);return K(`div`,e,{ref:[t,p],props:[f,a]})});function Vo(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=so(),u=Z.useRef(-1),[d,f]=Z.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=Z.useRef(null),h=Z.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return J(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var Ho=Z.createContext(void 0);function Uo(){let e=Z.useContext(Ho);if(!e)throw Error(Ve(57));return e}var Wo=Z.memo(Z.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=Z.useRef(null),d=Vo({guess:!0,label:o,textRef:u}),{store:f,itemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:y,selectedItemTextRef:b,disabled:x,readOnly:S}=Ma(),C=x||s,w=W(f,$.isActive,d.index),T=W(f,$.open),E=W(f,$.isSelected,a),D=W(f,$.isSelectedByFocus,d.index),O=W(f,$.isItemEqualToValue),k=d.index,A=Z.useRef(null);J(()=>{let e=v.current;return e[k]=a,()=>{delete e[k]}},[k,a,v]),J(()=>{let e=f.state.value,t=e;y&&Array.isArray(e)&&(t=e.length>0?e[e.length-1]:void 0),t!==void 0&&Pa(a,t,O)&&(f.set(`selectedIndex`,k),u.current&&(b.current=u.current))},[k,y,O,f,a,b]);let j=Z.useRef(`mouse`),M=Z.useRef(!1),{getButtonProps:ee,buttonRef:te}=jr({disabled:C,focusableWhenDisabled:!0,native:c,composite:!0}),ne={disabled:C,selected:E,highlighted:w};function N(e){if(x||S)return;let t=f.state.value;if(y){let n=Array.isArray(t)?t:[],r=E?Ia(n,a,O):[...n,a];h(r,tt(H,e))}else h(a,tt(H,e)),m(!1,tt(H,e))}function P(){g.current.dragY=0}let re={role:`option`,"aria-selected":E,tabIndex:T&&w?0:-1,onKeyDown(e){f.set(`activeIndex`,k),e.key===` `&&_.current&&e.preventDefault()},onClick(e){let t=j.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&Xe(e.nativeEvent)&&(n!==void 0||w),i=t&&!r&&!M.current;M.current=!1,!(C||i)&&N(e.nativeEvent)},onPointerEnter(e){j.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=g.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){j.current=e.pointerType,M.current=!0,P()},onMouseUp(){if(P(),C||j.current===`touch`||M.current)return;let e=!g.current.allowSelectedMouseUp&&E,t=!g.current.allowUnselectedMouseUp&&!E;e||t||(M.current=!0,A.current?.click(),M.current=!1)}},F=K(`div`,e,{ref:[te,t,d.ref,A],state:ne,props:[p,re,l,ee]}),I=Z.useMemo(()=>({selected:E,index:k,textRef:u,selectedByFocus:D}),[E,k,u,D]);return(0,Q.jsx)(Ho.Provider,{value:I,children:F})})),Go=Z.forwardRef(function(e,t){let{selected:n}=Uo();return e.keepMounted||n?(0,Q.jsx)(Ko,{...e,ref:t}):null}),Ko=Z.memo(Z.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Uo(),c=Z.useRef(null),{transitionStatus:l,setMounted:u}=se(s),d=K(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:Nt});return ne({open:s,ref:c,onComplete(){s||u(!1)}}),d})),qo=Z.memo(Z.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=Uo(),{firstItemTextRef:a,selectedItemTextRef:o}=Ma(),{render:s,className:c,style:l,...u}=e,d=Z.useCallback(e=>{e&&(n===0&&(a.current=e),i&&(o.current=e))},[a,o,n,i]);return K(`div`,e,{ref:[d,t,r],props:u})})),Jo=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=Ma(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=_o(),_=c?$.scrollUpArrowVisible:$.scrollDownArrowVisible,v=W(l,_),y=W(l,$.openMethod),b=v&&y!==`touch`,x=Ie(),S=c?g:h,{mounted:C,transitionStatus:w,setMounted:T}=se(b);J(()=>(p.current+=1,l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.set(`hasScrollArrows`,!1)}),[l,p]),ne({open:b,ref:S,onComplete(){b||T(!1)}});let E=K(`div`,e,{ref:[t,S],state:{direction:a,visible:b,side:m,transitionStatus:w},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||x.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f(e);let n=Ka(e.scrollHeight,e.clientHeight),r=qa(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),i){x.clear();return}if(a.length>0){let t=S.current?.offsetHeight||0;e.scrollTop=Yo(a,c,r,e.clientHeight,t,n)}x.start(40,t)}x.start(40,t)},onMouseLeave(){x.clear()}},s],stateAttributesMapping:Nt});return C||o?E:null});function Yo(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return os){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?qa(l.offsetTop+l.offsetHeight-r+i,a):a}var Xo=Z.forwardRef(function(e,t){return(0,Q.jsx)(Jo,{...e,ref:t,direction:`down`})}),Zo=Z.forwardRef(function(e,t){return(0,Q.jsx)(Jo,{...e,ref:t,direction:`up`})}),Qo=Z.createContext(void 0),$o=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Z.useState(),c=Z.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=K(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,Q.jsx)(Qo.Provider,{value:c,children:l})}),es=Ja;function ts({className:e,...t}){return(0,Q.jsx)($o,{className:q(`scroll-my-1 p-1`,e),"data-slot":`select-group`,...t})}function ns({className:e,...t}){return(0,Q.jsx)(ro,{className:q(`flex flex-1 text-left`,e),"data-slot":`select-value`,...t})}function rs({className:e,size:t=`default`,children:n,...r}){return(0,Q.jsxs)(to,{className:q(`flex w-fit select-none items-center justify-between gap-1.5 whitespace-nowrap rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-placeholder:text-muted-foreground *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:hover:bg-input/50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),"data-size":t,"data-slot":`select-trigger`,...r,children:[n,(0,Q.jsx)(io,{render:(0,Q.jsx)(lr,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function is({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,Q.jsx)(ao,{children:(0,Q.jsx)(Co,{align:i,alignItemWithTrigger:o,alignOffset:a,className:`isolate z-50`,side:n,sideOffset:r,children:(0,Q.jsxs)(Mo,{className:q(`data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:fade-in-0 data-open:zoom-in-95 data-closed:fade-out-0 data-closed:zoom-out-95 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-y-auto overflow-x-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-closed:animate-out data-open:animate-in`,e),"data-align-trigger":o,"data-slot":`select-content`,...s,children:[(0,Q.jsx)(os,{}),(0,Q.jsx)(Bo,{children:t}),(0,Q.jsx)(ss,{})]})})})}function as({className:e,children:t,...n}){return(0,Q.jsxs)(Wo,{className:q(`relative flex w-full cursor-default select-none items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),"data-slot":`select-item`,...n,children:[(0,Q.jsx)(qo,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,Q.jsx)(Go,{render:(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,Q.jsx)(cr,{className:`pointer-events-none`})})})]})}function os({className:e,...t}){return(0,Q.jsx)(Zo,{className:q(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),"data-slot":`select-scroll-up-button`,...t,children:(0,Q.jsx)(ur,{})})}function ss({className:e,...t}){return(0,Q.jsx)(Xo,{className:q(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),"data-slot":`select-scroll-down-button`,...t,children:(0,Q.jsx)(lr,{})})}var cs=15e3,ls=`headgate.console.polling-interval-ms`,us=[{label:`Every 5 seconds`,value:5e3},{label:`Every 15 seconds`,value:15e3},{label:`Every 30 seconds`,value:3e4},{label:`Every minute`,value:6e4}],ds=new Set(us.map(e=>e.value)),fs=new Set,ps=cs,ms=!1;function hs(e){if(e===null)return cs;let t=Number(e);return ds.has(t)?t:cs}function gs(e,t){let n=ds.has(t)?t:cs;return e.setItem(ls,String(n)),n}function _s(){if(typeof window>`u`)return ps;try{ps=hs(window.localStorage.getItem(ls))}catch{}return ps}function vs(){for(let e of fs)e()}function ys(e){e.key===`headgate.console.polling-interval-ms`&&(ps=hs(e.newValue),vs())}function bs(e){return fs.add(e),!ms&&typeof window<`u`&&(window.addEventListener(`storage`,ys),ms=!0),()=>{fs.delete(e),ms&&fs.size===0&&(window.removeEventListener(`storage`,ys),ms=!1)}}function xs(e){let t=ds.has(e)?e:cs;ps=t;try{gs(window.localStorage,t)}catch{}return vs(),t}var Ss=(0,Z.createContext)(null);function Cs(){let e=(0,Z.useContext)(Ss);if(!e)throw Error(`useConsole must be used inside ConsoleLayout`);return e}function ws(e,t,n=!0){let r=(0,Z.useContext)(Ss);return dn({enabled:n,queryFn:({signal:e})=>t(e),queryKey:e,refetchInterval:r?.livePaused?!1:r?.pollingIntervalMs??15e3})}function Ts(e){let t=(0,Z.useContext)(Ss);return ln({queries:e.map(e=>({enabled:e.enabled??!0,queryFn:({signal:t})=>e.queryFn(t),queryKey:e.queryKey,refetchInterval:t?.livePaused?!1:t?.pollingIntervalMs??15e3}))})}function Es(e){let t=ws([`api`,e],t=>e===null?Promise.reject(Error(`API path is required.`)):ma(e,{signal:t}),!!e);return{data:t.data??null,error:t.error?t.error instanceof Error?t.error.message:String(t.error):null,loading:t.isPending}}function Ds(){let e=ve();return fn({mutationFn:({path:e,method:t=`POST`,body:n})=>ma(e,{body:n,method:t}),onSuccess:()=>e.invalidateQueries({queryKey:[`api`]})})}function Os({children:e}){return(0,Q.jsx)(`p`,{className:`py-8 text-center text-muted-foreground text-sm`,children:e})}function ks(){return(0,Q.jsxs)(`div`,{className:`flex min-h-48 items-center justify-center text-muted-foreground`,role:`status`,children:[(0,Q.jsx)(hr,{className:`mr-2 size-4 animate-spin motion-reduce:animate-none`}),`Loading…`]})}function As({message:e}){return(0,Q.jsxs)(`div`,{className:`rounded-xl border border-destructive/30 bg-destructive/5 p-4 text-destructive text-sm`,role:`alert`,children:[(0,Q.jsx)(yr,{className:`mr-2 inline size-4`}),e]})}function js(e){let[t,n]=(0,Z.useState)(!1),[r,i]=(0,Z.useState)(!1),a=(0,Z.useRef)(!1),o=(0,Z.useRef)(null),s=(0,Z.useRef)(null),c=(0,Z.useCallback)(e=>{a.current=e,i(e)},[]);return(0,Z.useEffect)(()=>{let t=new EventSource(`${fa.apiBase}/events`),r=Ms(e,()=>a.current,o,s);return t.onopen=()=>n(!0),t.onerror=()=>n(!1),t.onmessage=r.schedule,t.addEventListener(`queue_activity`,r.schedule),()=>{t.close(),r.dispose()}},[e]),{connected:t,paused:r,setPaused:c}}function Ms(e,t,n={current:null},r={current:null}){let i=()=>{n.current!==null&&window.clearTimeout(n.current),r.current!==null&&window.clearTimeout(r.current),n.current=null,r.current=null,e()};return{dispose:()=>{n.current!==null&&window.clearTimeout(n.current),r.current!==null&&window.clearTimeout(r.current),n.current=null,r.current=null},schedule:()=>{t()||(n.current!==null&&window.clearTimeout(n.current),n.current=window.setTimeout(i,700),r.current===null&&(r.current=window.setTimeout(i,2e3)))}}}var Ns={jobs:`Jobs`,overview:`Overview`,periodic:`Periodic schedules`,quarantine:`Quarantine`,queues:`Queues`,"rate-classes":`Rate classes`,workers:`Workers`,workflows:`Workflows`};function Ps(){let e=Vt({select:e=>e.location.pathname}),[t,n]=(0,Z.useState)(null),[r,i]=(0,Z.useState)(!1),a=(0,Z.useSyncExternalStore)(bs,_s,()=>cs),o=(0,Z.useSyncExternalStore)(Ye,st,()=>Ct),s=(0,Z.useRef)(null),c=ve(),l=(0,Z.useCallback)(()=>c.refetchQueries({queryKey:[`api`],type:`active`}),[c]),u=js(l),d=e.split(`/`).find(Boolean)??`queues`,f=(0,Z.useCallback)((e,t=`normal`)=>{s.current!==null&&window.clearTimeout(s.current),n({message:e,tone:t}),s.current=window.setTimeout(()=>n(null),3500)},[]),p=(0,Z.useCallback)(async()=>{if(!r){i(!0);try{await Promise.all([l(),new Promise(e=>window.setTimeout(e,400))]),f(`Data refreshed`)}catch(e){f(e instanceof Error?e.message:String(e),`error`)}finally{i(!1)}}},[r,f,l]),m=(0,Z.useCallback)(e=>{if(!e)return;let t=xs(Number(e));f(`Polling interval set to ${t/1e3} seconds`)},[f]),h=(0,Z.useCallback)(e=>{if(!e)return;let t=_t(e);f(`Theme set to ${t}`)},[f]),g=(0,Z.useMemo)(()=>({livePaused:u.paused,notify:f,pollingIntervalMs:a,refresh:l}),[l,f,u.paused,a]);return(0,Q.jsxs)(Ss.Provider,{value:g,children:[(0,Q.jsx)(`a`,{className:`sr-only fixed top-3 left-3 z-100 rounded-md bg-background px-3 py-2 focus:not-sr-only`,href:`#main-content`,children:`Skip to content`}),(0,Q.jsxs)($i,{children:[(0,Q.jsx)(ga,{}),(0,Q.jsxs)(na,{className:`console-scrollbar`,children:[(0,Q.jsxs)(`header`,{className:`sticky top-0 z-30 flex h-14 shrink-0 items-center gap-3 border-b bg-background/95 px-4 backdrop-blur`,children:[(0,Q.jsx)(ta,{"aria-label":`Toggle navigation`}),(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 truncate font-medium text-sm`,children:Ns[d]??`headgate`}),fa.readOnly&&(0,Q.jsx)(ya,{variant:`outline`,children:`read-only`}),(0,Q.jsxs)(Ir,{"aria-pressed":u.paused,onClick:()=>u.setPaused(!u.paused),size:`sm`,variant:`ghost`,children:[(0,Q.jsx)(`span`,{className:`size-2 rounded-full ${u.connected&&!u.paused?`bg-success`:`bg-muted-foreground`}`}),u.paused?`Resume updates`:u.connected?`Live`:`Polling`]}),(0,Q.jsx)(Ir,{"aria-busy":r||void 0,"aria-label":r?`Refreshing data`:`Refresh data`,disabled:r,onClick:()=>void p(),size:`icon`,title:r?`Refreshing…`:`Refresh data`,variant:`ghost`,children:(0,Q.jsx)(hr,{className:r?`animate-spin motion-reduce:animate-none`:``})}),(0,Q.jsxs)(ba,{children:[(0,Q.jsx)(xa,{render:(0,Q.jsx)(Ir,{"aria-label":`Console settings`,size:`icon`,title:`Console settings`,variant:`ghost`}),children:(0,Q.jsx)(_r,{"aria-hidden":!0})}),(0,Q.jsxs)(wa,{className:`inset-auto top-1/2 left-1/2 h-auto max-w-sm -translate-x-1/2 -translate-y-1/2 rounded-xl border`,children:[(0,Q.jsxs)(Ta,{children:[(0,Q.jsx)(Ea,{children:`Console Settings`}),(0,Q.jsx)(Da,{children:`Control how often this browser checks for fresh data. Live events can still refresh the console sooner.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(Oa,{htmlFor:`console-theme`,children:`Theme`}),(0,Q.jsxs)(es,{onValueChange:h,value:o,children:[(0,Q.jsx)(rs,{id:`console-theme`,children:(0,Q.jsx)(ns,{})}),(0,Q.jsx)(is,{children:(0,Q.jsx)(ts,{children:ut.map(e=>(0,Q.jsx)(as,{value:e.value,children:e.label},e.value))})})]}),(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`System follows your operating-system appearance.`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(Oa,{htmlFor:`polling-interval`,children:`Polling Interval`}),(0,Q.jsxs)(es,{onValueChange:m,value:String(a),children:[(0,Q.jsx)(rs,{id:`polling-interval`,children:(0,Q.jsx)(ns,{})}),(0,Q.jsx)(is,{children:(0,Q.jsx)(ts,{children:us.map(e=>(0,Q.jsx)(as,{value:String(e.value),children:e.label},e.value))})})]}),(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Saved in this browser. Pausing live updates also pauses polling.`})]})]})]})]})]}),(0,Q.jsx)(`main`,{className:`flex-1 scroll-mt-16 p-4 lg:p-6`,id:`main-content`,children:(0,Q.jsx)(ee,{})})]})]}),(0,Q.jsx)(`div`,{"aria-live":`polite`,className:`pointer-events-none fixed bottom-4 left-1/2 z-70 -translate-x-1/2 rounded-lg px-4 py-2 text-sm shadow-lg transition-[opacity,transform] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none ${t?.tone===`error`?`bg-destructive text-white`:`bg-foreground text-background`} ${t?`translate-y-0 opacity-100`:`translate-y-2 opacity-0`}`,children:t?.message})]})}export{Bi as A,zr as B,ya as C,Fi as D,fa as E,Yr as F,yr as G,jr as H,Jr as I,cr as J,gr as K,Kr as L,Vi as M,ji as N,Ri as O,Qr as P,Wr as R,Ea as S,ma as T,Ar as U,Ir as V,Cr as W,ir as X,ar as Y,Oa as _,Ds as a,Da as b,Ts as c,is as d,ts as f,Ga as g,ns as h,ks as i,zi as j,Hi as k,ws as l,rs as m,Os as n,Es as o,as as p,fr as q,As as r,Cs as s,Ps as t,es as u,ba as v,pa as w,Ta as x,wa as y,Hr as z}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/index-B8M4ltzK.js b/go/headgateui/dist/assets/index-B8M4ltzK.js deleted file mode 100644 index c17f76b..0000000 --- a/go/headgateui/dist/assets/index-B8M4ltzK.js +++ /dev/null @@ -1,12 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_console-Cx1B6VV3.js","./console-C2t3Lr2f.js","./utils-o8v-URZ_.js","./theme-6NkSfuJL.js","./_console.jobs-CgmGFIqK.js","./jobs-CWBl3QlV.js","./chevron-right-Dqi3i9r9.js","./clock-3-CrAcdu0a.js","./action-button-DtQnwrt0.js","./play-BC4ZZCx4.js","./progress-BbTEfjhw.js","./relative-time-CtN3x3SY.js","./table-BngtkqYs.js","./_console.overview-M0AniEMF.js","./chart-CAYbmpTK.js","./value-8xOwwyZS.js","./_console.periodic-Dpot-gjP.js","./_console.quarantine-IhoJN7GC.js","./_console.queues-C47vPXCj.js","./_console.rate-classes-Cp7wdm51.js","./_console.workers-DrCdQYuK.js","./_console.workflows-XIi2cJnF.js","./workflows-Dw8XMSyI.js","./_console.jobs._jobId-C0SN-qBR.js","./_console.workflows_._workflowId-BeezXsKr.js"])))=>i.map(i=>d[i]); -import{a as e,c as t,d as n,i as r,l as i,o as a,s as o}from"./utils-o8v-URZ_.js";import{$n as s,An as c,Ar as l,Cn as u,Cr as d,Dn as f,Dr as p,En as m,Er as h,Hn as g,In as _,Jn as v,Kn as y,Mn as b,Mr as x,Nn as S,On as ee,Or as te,Qn as ne,Sn as C,Sr as re,Tr as ie,Wn as ae,Yn as oe,Zn as se,_n as ce,_r as le,a as ue,ar as w,br as T,cr as de,dr as fe,er as pe,fr as me,gr as he,hr as E,ir as ge,jn as _e,jr as ve,kr as ye,l as be,lr as xe,mr as Se,nr as Ce,or as we,pr as Te,qn as Ee,rr as De,sr as Oe,tr as ke,ur as Ae,vr as je,wn as Me,wr as Ne,xn as Pe,xr as Fe,yn as Ie,yr as Le,zn as Re}from"./theme-6NkSfuJL.js";var ze=i((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,ie());else{var t=n(l);t!==null&&se(x,t.startTime-e)}}}var S=!1,ee=-1,te=5,ne=-1;function C(){return g?!0:!(e.unstable_now()-net&&C());){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&&se(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ie():S=!1}}}var ie;if(typeof y==`function`)ie=function(){y(re)};else if(typeof MessageChannel<`u`){var ae=new MessageChannel,oe=ae.port2;ae.port1.onmessage=re,ie=function(){oe.postMessage(null)}}else ie=function(){_(re,0)};function se(t,n){ee=_(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(ee),ee=-1):h=!0,se(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,ie()))),r},e.unstable_shouldYield=C,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Be=i(((e,t)=>{t.exports=ze()})),Ve=i((e=>{var n=Be(),r=t(),i=o();function a(e){var t=`https://react.dev/errors/`+e;if(1pe||(e.current=fe[pe],fe[pe]=null,pe--)}function E(e,t){pe++,fe[pe]=e.current,e.current=t}var ge=me(null),_e=me(null),ve=me(null),ye=me(null);function be(e,t){switch(E(ve,t),E(_e,e),E(ge,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}he(ge),E(ge,e)}function xe(){he(ge),he(_e),he(ve)}function Se(e){e.memoizedState!==null&&E(ye,e);var t=ge.current,n=Hd(t,e.type);t!==n&&(E(_e,e),E(ge,n))}function Ce(e){_e.current===e&&(he(ge),he(_e)),ye.current===e&&(he(ye),Qf._currentValue=de)}var we,Te;function Ee(e){if(we===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);we=t&&t[1]||``,Te=-1)`:-1i||c[r]!==l[i]){var u=` -`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{De=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ee(n):``}function ke(e,t){switch(e.tag){case 26:case 27:case 5:return Ee(e.type);case 16:return Ee(`Lazy`);case 13:return e.child!==t&&t!==null?Ee(`Suspense Fallback`):Ee(`Suspense`);case 19:return Ee(`SuspenseList`);case 0:case 15:return Oe(e.type,!1);case 11:return Oe(e.type.render,!1);case 1:return Oe(e.type,!0);case 31:return Ee(`Activity`);default:return``}}function Ae(e){try{var t=``,n=null;do t+=ke(e,n),n=e,e=e.return;while(e);return t}catch(e){return` -Error generating stack: `+e.message+` -`+e.stack}}var je=Object.prototype.hasOwnProperty,Me=n.unstable_scheduleCallback,Ne=n.unstable_cancelCallback,Pe=n.unstable_shouldYield,Fe=n.unstable_requestPaint,Ie=n.unstable_now,Le=n.unstable_getCurrentPriorityLevel,Re=n.unstable_ImmediatePriority,ze=n.unstable_UserBlockingPriority,Ve=n.unstable_NormalPriority,He=n.unstable_LowPriority,Ue=n.unstable_IdlePriority,We=n.log,Ge=n.unstable_setDisableYieldValue,Ke=null,qe=null;function Je(e){if(typeof We==`function`&&Ge(e),qe&&typeof qe.setStrictMode==`function`)try{qe.setStrictMode(Ke,e)}catch{}}var Ye=Math.clz32?Math.clz32:Qe,Xe=Math.log,Ze=Math.LN2;function Qe(e){return e>>>=0,e===0?32:31-(Xe(e)/Ze|0)|0}var $e=256,et=262144,tt=4194304;function nt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function rt(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=nt(n))):i=nt(o):i=nt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=nt(n))):i=nt(o)):i=nt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function it(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function at(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ot(){var e=tt;return tt<<=1,!(tt&62914560)&&(tt=4194304),e}function st(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ct(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function lt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),xn=!1;if(bn)try{var Sn={};Object.defineProperty(Sn,"passive",{get:function(){xn=!0}}),window.addEventListener(`test`,Sn,Sn),window.removeEventListener(`test`,Sn,Sn)}catch{xn=!1}var Cn=null,wn=null,Tn=null;function En(){if(Tn)return Tn;var e,t=wn,n=t.length,r,i=`value`in Cn?Cn.value:Cn.textContent,a=i.length;for(e=0;e=ir),sr=` `,cr=!1;function lr(e,t){switch(e){case`keyup`:return nr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function ur(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var dr=!1;function fr(e,t){switch(e){case`compositionend`:return ur(t);case`keypress`:return t.which===32?(cr=!0,sr):null;case`textInput`:return e=t.data,e===sr&&cr?null:e;default:return null}}function pr(e,t){if(dr)return e===`compositionend`||!rr&&lr(e,t)?(e=En(),Tn=wn=Cn=null,dr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Pr(n)}}function Ir(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ir(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Lr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Jt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Jt(e.document)}return t}function Rr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var zr=bn&&`documentMode`in document&&11>=document.documentMode,Br=null,Vr=null,Hr=null,Ur=!1;function Wr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ur||Br==null||Br!==Jt(r)||(r=Br,`selectionStart`in r&&Rr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Hr&&Nr(Hr,r)||(Hr=r,r=Ed(Vr,`onSelect`),0>=o,i-=o,Fi=1<<32-Ye(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),j&&Li(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),j&&Li(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return j&&Li(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),j&&Li(i,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===v&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case g:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===v){if(r.tag===7){n(e,r.sibling),c=i(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===re&&Pa(l)===r.type){n(e,r.sibling),c=i(r,o.props),Va(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===v?(c=Si(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=xi(o.type,o.key,o.props,null,e.mode,c),Va(c,o),c.return=e,e=c)}return s(e);case _:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=i(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Ti(o,e.mode,c),c.return=e,e=c}return s(e);case re:return o=Pa(o),b(e,r,o,c)}if(ue(o))return h(e,r,o,c);if(se(o)){if(l=se(o),typeof l!=`function`)throw Error(a(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Ba(o),c);if(o.$$typeof===S)return b(e,r,ua(e,o),c);Ha(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,o),c.return=e,e=c):(n(e,r),c=Ci(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{za=0;var i=b(e,t,n,r);return Ra=null,i}catch(t){if(t===Oa||t===Aa)throw t;var a=_i(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var P=Ua(!0),Wa=Ua(!1),Ga=!1;function Ka(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ja(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ya(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,G&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=mi(e),pi(e,null,n),t}return ui(e,r,t,n),mi(e)}function Xa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,dt(e,n)}}function Za(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Qa=!1;function $a(){if(Qa){var e=ba;if(e!==null)throw e}}function eo(e,t,n,r){Qa=!1;var i=e.updateQueue;Ga=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(J&f)===f:(r&f)===f){f!==0&&f===ya&&(Qa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Ga=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Gl|=o,e.lanes=o,e.memoizedState=d}}function to(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function no(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=w.T,s={};w.T=s,Is(e,!1,t,n);try{var c=i(),l=w.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Fs(e,t,Ca(c,r),pu(e)):Fs(e,t,r,pu(e))}catch(n){Fs(e,t,{then:function(){},status:`rejected`,reason:n},pu())}finally{T.p=a,o!==null&&s.types!==null&&(o.types=s.types),w.T=o}}function Ts(){}function Es(e,t,n,r){if(e.tag!==5)throw Error(a(476));var i=Ds(e).queue;ws(e,i,t,de,n===null?Ts:function(){return Os(e),n(r)})}function Ds(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:de},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Os(e){var t=Ds(e);t.next===null&&(t=e.alternate.memoizedState),Fs(e,t.next.queue,{},pu())}function ks(){return la(Qf)}function As(){return z().memoizedState}function js(){return z().memoizedState}function Ms(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=pu();e=Ja(n);var r=Ya(t,e,n);r!==null&&(hu(r,t,n),Xa(r,t,n)),t={cache:ha()},e.payload=t;return}t=t.return}}function Ns(e,t,n){var r=pu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ls(e)?Rs(t,n):(n=di(e,t,n,r),n!==null&&(hu(n,e,r),zs(n,t,r)))}function Ps(e,t,n){Fs(e,t,n,pu())}function Fs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ls(e))Rs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Mr(s,o))return ui(e,t,i,0),K===null&&li(),!1}catch{}if(n=di(e,t,i,r),n!==null)return hu(n,e,r),zs(n,t,r),!0}return!1}function Is(e,t,n,r){if(r={lane:2,revertLane:dd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ls(e)){if(t)throw Error(a(479))}else t=di(e,n,r,2),t!==null&&hu(t,e,2)}function Ls(e){var t=e.alternate;return e===F||t!==null&&t===F}function Rs(e,t){xo=bo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function zs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,dt(e,n)}}var Bs={readContext:la,use:Lo,useCallback:R,useContext:R,useEffect:R,useImperativeHandle:R,useLayoutEffect:R,useInsertionEffect:R,useMemo:R,useReducer:R,useRef:R,useState:R,useDebugValue:R,useDeferredValue:R,useTransition:R,useSyncExternalStore:R,useId:R,useHostTransitionStatus:R,useFormState:R,useActionState:R,useOptimistic:R,useMemoCache:R,useCacheRefresh:R};Bs.useEffectEvent=R;var Vs={readContext:la,use:Lo,useCallback:function(e,t){return Po().memoizedState=[e,t===void 0?null:t],e},useContext:la,useEffect:ps,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ds(4194308,4,vs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ds(4194308,4,e,t)},useInsertionEffect:function(e,t){ds(4,2,e,t)},useMemo:function(e,t){var n=Po();t=t===void 0?null:t;var r=e();if(So){Je(!0);try{e()}finally{Je(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Po();if(n!==void 0){var i=n(t);if(So){Je(!0);try{n(t)}finally{Je(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ns.bind(null,F,e),[r.memoizedState,e]},useRef:function(e){var t=Po();return e={current:e},t.memoizedState=e},useState:function(e){e=Yo(e);var t=e.queue,n=Ps.bind(null,F,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:V,useDeferredValue:function(e,t){return Ss(Po(),e,t)},useTransition:function(){var e=Yo(!1);return e=ws.bind(null,F,e.queue,!0,!1),Po().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=F,i=Po();if(j){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),K===null)throw Error(a(349));J&127||Wo(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,ps(Ko.bind(null,r,o,e),[e]),r.flags|=2048,ls(9,{destroy:void 0},Go.bind(null,r,o,n,t),null),n},useId:function(){var e=Po(),t=K.identifierPrefix;if(j){var n=Ii,r=Fi;n=(r&~(1<<32-Ye(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=L++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}o[vt]=t,o[yt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Pc(t)}}return U(t),Fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=ve.current,Yi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Hi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[vt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Md(e.nodeValue,n)),e||Ki(t,!0)}else e=Bd(e).createTextNode(r),e[vt]=t,t.stateNode=e}return U(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Yi(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[vt]=t}else Xi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;U(t),e=!1}else n=Zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ho(t),t):(ho(t),null);if(t.flags&128)throw Error(a(558))}return U(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Yi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));i[vt]=t}else Xi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;U(t),i=!1}else i=Zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(ho(t),t):(ho(t),null)}return ho(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Lc(t,t.updateQueue),U(t),null);case 4:return xe(),e===null&&Sd(t.stateNode.containerInfo),U(t),null;case 10:return ra(t.type),U(t),null;case 19:if(he(go),r=t.memoizedState,r===null)return U(t),null;if(i=!!(t.flags&128),o=r.rendering,o===null){if(i)Rc(r,!1);else{if(X!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=_o(e),o!==null){for(t.flags|=128,Rc(r,!1),e=o.updateQueue,t.updateQueue=e,Lc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)bi(n,e),n=n.sibling;return E(go,go.current&1|2),j&&Li(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ie()>tu&&(t.flags|=128,i=!0,Rc(r,!1),t.lanes=4194304)}}else{if(!i){if(e=_o(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Lc(t,e),Rc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!j)return U(t),null}else 2*Ie()-r.renderingStartTime>tu&&n!==536870912&&(t.flags|=128,i=!0,Rc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(U(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ie(),e.sibling=null,n=go.current,E(go,i?n&1|2:n&1),j&&Li(t,r.treeForkCount),e);case 22:case 23:return ho(t),so(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(U(t),t.subtreeFlags&6&&(t.flags|=8192)):U(t),n=t.updateQueue,n!==null&&Lc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&he(N),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ra(M),U(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function Bc(e,t){switch(Bi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ra(M),xe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ce(t),null;case 31:if(t.memoizedState!==null){if(ho(t),t.alternate===null)throw Error(a(340));Xi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ho(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));Xi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return he(go),null;case 4:return xe(),null;case 10:return ra(t.type),null;case 22:case 23:return ho(t),so(),e!==null&&he(N),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ra(M),null;case 25:return null;default:return null}}function Vc(e,t){switch(Bi(t),t.tag){case 3:ra(M),xe();break;case 26:case 27:case 5:Ce(t);break;case 4:xe();break;case 31:t.memoizedState!==null&&ho(t);break;case 13:ho(t);break;case 19:he(go);break;case 10:ra(t.type);break;case 22:case 23:ho(t),so(),e!==null&&he(N);break;case 24:ra(M)}}function Hc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Z(t,t.return,e)}}function Uc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Z(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Z(t,t.return,e)}}function Wc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{no(t,n)}catch(t){Z(e,e.return,t)}}}function Gc(e,t,n){n.props=Js(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Z(e,t,n)}}function Kc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Z(e,t,n)}}function qc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Z(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Z(e,t,n)}else n.current=null}}function Jc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Z(e,e.return,t)}}function Yc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[yt]=t}catch(t){Z(e,e.return,t)}}function Xc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Zc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Xc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=fn));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function $c(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function el(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[vt]=e,t[yt]=n}catch(t){Z(e,e.return,t)}}var tl=!1,nl=!1,rl=!1,il=typeof WeakSet==`function`?WeakSet:Set,al=null;function ol(e,t){if(e=e.containerInfo,Rd=sp,e=Lr(e),Rr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,al=t;al!==null;)if(t=al,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,al=e;else for(;al!==null;){switch(t=al,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Pd(o,r,n),o[vt]=e,jt(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=Fr(s,h),v=Fr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,w.T=null,n=lu,lu=null;var o=au,s=su;if(iu=0,ou=au=null,su=0,G&6)throw Error(a(331));var c=G;if(G|=4,Fl(o.current),Dl(o,o.current,s,n),G=c,id(0,!1),qe&&typeof qe.onPostCommitFiberRoot==`function`)try{qe.onPostCommitFiberRoot(Ke,o)}catch{}return!0}finally{T.p=i,w.T=r,Vu(e,t)}}function Wu(e,t,n){t=Di(n,t),t=ec(e.stateNode,t,2),e=Ya(e,t,2),e!==null&&(ct(e,2),rd(e))}function Z(e,t,n){if(e.tag===3)Wu(e,e,n);else for(;t!==null;){if(t.tag===3){Wu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ru===null||!ru.has(r))){e=Di(n,e),n=tc(2),r=Ya(t,n,2),r!==null&&(nc(n,r,t,e),ct(r,2),rd(r));break}}t=t.return}}function Gu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new zl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ul=!0,i.add(n),e=Ku.bind(null,e,t,n),t.then(e,e))}function Ku(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,K===e&&(J&n)===n&&(X===4||X===3&&(J&62914560)===J&&300>Ie()-$l?!(G&2)&&Su(e,0):ql|=n,Yl===J&&(Yl=0)),rd(e)}function qu(e,t){t===0&&(t=ot()),e=fi(e,t),e!==null&&(ct(e,t),rd(e))}function Ju(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qu(e,n)}function Yu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),qu(e,n)}function Xu(e,t){return Me(e,t)}var Zu=null,Qu=null,$u=!1,ed=!1,td=!1,nd=0;function rd(e){e!==Qu&&e.next===null&&(Qu===null?Zu=Qu=e:Qu=Qu.next=e),ed=!0,$u||($u=!0,ud())}function id(e,t){if(!td&&ed){td=!0;do for(var n=!1,r=Zu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ye(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ld(r,a))}else a=J,a=rt(r,r===K?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||it(r,a)||(n=!0,ld(r,a))}r=r.next}while(n);td=!1}}function ad(){od()}function od(){ed=$u=!1;var e=0;nd!==0&&Gd()&&(e=nd);for(var t=Ie(),n=null,r=Zu;r!==null;){var i=r.next,a=sd(r,t);a===0?(r.next=null,n===null?Zu=i:n.next=i,i===null&&(Qu=n)):(n=r,(e!==0||a&3)&&(ed=!0)),r=i}iu!==0&&iu!==5||id(e,!1),nd!==0&&(nd=0)}function sd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Xt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),jt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Xt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Xt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Xt(n.imageSizes)+`"]`)):i+=`[href="`+Xt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),jt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Xt(r)+`"][href="`+Xt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),jt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=At(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);jt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=At(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=m({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),jt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=At(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),jt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=ve.current)?gf(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=At(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=At(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(i,e,n,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=At(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Af(e){return`href="`+Xt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),jt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Xt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Xt(n.href)+`"]`);if(r)return t.instance=r,jt(r),r;var i=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),jt(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var o=e.querySelector(jf(i));if(o)return t.state.loading|=4,t.instance=o,jt(o),o;r=Mf(n),(i=mf.get(i))&&Rf(r,i),o=(e.ownerDocument||e).createElement(`link`),jt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(i=e.querySelector(Ff(o)))?(t.instance=i,jt(i),i):(r=n,(i=mf.get(o))&&(r=m({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),jt(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,jt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),jt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Ve()})),Ue=`__TSS_CONTEXT`,We=Symbol.for(`TSS_SERVER_FUNCTION`),Ge=`application/x-tss-framed`,Ke={JSON:0,CHUNK:1,END:2,ERROR:3};`${Ge}`;var qe=/;\s*v=(\d+)/;function Je(e){let t=e.match(qe);return t?parseInt(t[1],10):void 0}function Ye(e){let t=Je(e);if(t!==void 0&&t!==1)throw Error(`Incompatible framed protocol version: server=${t}, client=1. Please ensure client and server are using compatible versions.`)}var Xe=()=>window.__TSS_START_OPTIONS__;function Ze(){try{return sessionStorage}catch{return}}var Qe=`tsr-scroll-restoration-v1_3`,$e=Ze();function et(){try{return JSON.parse($e?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function tt(){try{$e?.setItem(Qe,JSON.stringify(nt))}catch{}}var nt=et(),rt=`data-scroll-restoration-id`,it=e=>e.state.__TSR_key||e.href;function at(e){let t=e.getAttribute(rt);if(t)return`[${rt}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var ot=!1,st=`window`;function ct(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function lt(e){let t=new Set;for(let n of e){if(n===st)continue;let e=ct(n);e&&t.add(e)}return t}function ut(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||it,a=new Set,o=e=>{let t=nt[e]||={};for(let e of a)e===document?t[st]={scrollX,scrollY}:e.isConnected&&(t[at(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,ot=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{ot||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),tt()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=nt[d];if(e){let t=nt[u];for(let n in e){if(n===st){if(s)continue}else{let e=ct(n);if(!e||s&&o&&(l??=lt(o),l.has(e)))continue}t||=nt[u]={},t[n]??=e[n]}}}ot=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=lt(o));let t=e&&i&&c,s=r.restoring?nt[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===st){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=ct(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{ot=!1}}))}function dt(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function ft(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function pt(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=ft(r):Array.isArray(t)?t.push(ft(r)):n[e]=[t,ft(r)]}return n}var mt=/^(?:\s|["[{\d-]|fa|nu|tr)/,ht=_t(JSON.parse),gt=vt(JSON.stringify,JSON.parse);function _t(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=pt(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function vt(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!mt.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=dt(e,r);return t?`?${t}`:``}}function yt(e){if(e.statusCode=e.statusCode||e.code||307,!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function bt(e){return e instanceof Response&&!!e.options}function xt(e){if(typeof e==`object`&&e&&e.isSerializedRedirect)return yt(e)}function St(e){return e.replaceAll(`\0`,`/`).replaceAll(`�`,`/`).replace(/~([~0r])/g,(e,t)=>t===`0`?`\0`:t===`r`?`�`:t)}function Ct(e){return{input:({url:t})=>{for(let n of e)t=Tt(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Et(e[n],t);return t}}}function wt(e){let t=xe(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=Oe([`/`,t,e.pathname]),e)}}function Tt(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Et(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Dt(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{Fe(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var Ot=`__TSR_index`,kt=`popstate`,At=`beforeunload`;function jt(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=Ft(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[Ot];i=Mt(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[Ot];i=Mt(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[Ot]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Mt(e,t){t||={};let n=It();return{...t,key:n,__TSR_key:n,[Ot]:e}}function Nt(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>Ft(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=It();t.history.replaceState({[Ot]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(e,t,n)=>{let r=s(t),i=!!g;i||(u=l),l=Ft(t,n),g=[r,n,g?.[2]||e],i||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(f){f=!1;return}let e=c(),n=e.state[Ot]-l.state[Ot],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=jt({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(At,x,{capture:!0}),t.removeEventListener(kt,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(At,x,{capture:!0}),t.addEventListener(kt,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function Pt(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function Ft(e,t){let n=Pt(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=It();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[Ot]:0,key:a,__TSR_key:a}}}function It(){return(Math.random()+1).toString(36).substring(7)}function Lt(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Rt(e){return e instanceof Error?{name:e.name,message:e.message}:{data:e}}function zt(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Bt({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function Vt(e,t,n,r){for(let i of t){if(r&&e._tx!==r)return;n.some(e=>e.routeId===i.routeId)||e.routesById[i.routeId].options.onLeave?.(i)}for(let i of n){if(r&&e._tx!==r)return;e.routesById[i.routeId].options[t.some(e=>e.routeId===i.routeId)?`onStay`:`onEnter`]?.(i)}}var Ht=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=w(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:Nt()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`,this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=je(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Dt(this.latestLocation,e),ut(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=xe(a);t&&t!==`/`&&e.push(wt({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Ct(e),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=le(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&he(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:re(e).path,external:!1,searchStr:o,search:ve(t?.search,i),hash:re(r.slice(1)).path,state:x(t?.state,a)}}let o=new URL(i,this.origin),s=Tt(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:re(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:ve(t?.search,c),hash:re(s.hash.slice(1)).path,state:x(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>de({base:e,to:t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=Se(fe(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{let t=(t={})=>{if(t.href){let e=Ft(t.href,{});t={...t,to:Tt(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let n=t._fromLocation||this._pendingLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r[1],a=r[2],o=r[3],s=this.resolvePathWithBase(i,t.to?`${t.to}`:`.`),c=Jt(t.params,o),l=this.routesByPath[fe(s)],u;if(l)u=this.getRouteBranch(l);else if(s.includes(`$`))u=[];else{let[e,t,n]=this.getMatchedRoutes(s);u=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(u=[...u,this.options.notFoundRoute])}if(u.length&&p(c))for(let e of u){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){c===o&&(c=Object.assign(Object.create(null),c));try{Object.assign(c,t(c))}catch{}}}let d=e.leaveParams?s:re(we({path:s,params:c,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,f=a;if(e._includeValidateSearch&&this.options.search?.strict){let e={};u.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Gt(t.options.validateSearch,{...e,...f}))}catch{}}),f=e}f=Kt(f,t,u,e._includeValidateSearch),f=ve(a,f);let m=this.options.stringifySearch(f),g=t.hash===!0?n.hash:t.hash?h(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?h(t.state,n.state):{};t.state&&(v=x(n.state,v));let y=`${d}${m}${_}`,b,S,ee=!1;if(this.rewrite){let e=new URL(y,this.origin),t=Et(this.rewrite,e);b=e.href.replace(e.origin,``),t.origin===this.origin?S=t.pathname+t.search+t.hash:(S=t.href,ee=!0)}else b=Ne(y),S=b;return{publicHref:S,href:b,pathname:d,search:f,searchStr:m,state:v,hash:g??``,external:ee,unmaskOnReload:t.unmaskOnReload}},n=t(e);if(e.mask)n.maskedLocation=t({from:e.from,...e.mask});else if(this.options.routeMasks){let r=Te(n.pathname,this.processedTree);if(r){let i=Object.assign(Object.create(null),r.rawParams),{from:a,params:o,...s}=r.route,c=Jt(o,i);n.maskedLocation=t({from:e.from,...s,params:c})}}return n},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=fe(this.latestLocation.href)===fe(n.href)&&d(Bt(n.state),Bt(this.latestLocation.state)),a=this._commitPromise,o,s=new Promise(e=>{o=e});if(s.resolve=()=>{o(),a?.resolve()},this._commitPromise=s,i)this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:r}})}return this._scroll.next=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(te(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.hash=e.action.type===`PUSH`||e.action.type===`REPLACE`),await Bn(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(zt(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set([...t,...this._cache.values(),...[...r?.values()??[]].flat(),...this._tx?.[3]??[]].filter(e=>!n||n(e)).map(e=>e.id)),a=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),a.push(e));let o=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&Lt(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(o);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i)this._flights?.delete(e);for(let e of a)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href){let t=this.buildLocation(e.options).publicHref||`/`;e.options.href=t,e.headers.set(`Location`,t)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&te(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=Qt,this.preloadRoute=e=>Vn(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=E(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!d(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?d(a.search,r.search,{partial:!0})?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??gt,parseSearch:e.parseSearch??ht,protocolAllowlist:e.protocolAllowlist??T}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=me(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:fe(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?qt(this.options.notFoundMode,a):void 0,c=Array(a.length),l=this._committed,u=(e,t)=>{let n=l[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?l.find(t=>t.routeId===e.id):void 0},d;for(let n=0;n{let r=n(t.preSearchFilters?t.preSearchFilters.reduce((e,t)=>t(e),e):e);return t.postSearchFilters?t.postSearchFilters.reduce((e,t)=>t(e),r):r});let n=t.validateSearch;r&&n&&i.push(({search:e,next:t,meta:r})=>{let i=t(e);try{let e=Gt(n,i);if(r&&e)for(let t in e)t in i||(r.defaulted||=new Map).set(t,e[t]);return{...i,...e}}catch{}return i})}let a=(e,n,r)=>{if(e>=i.length){if(!t.search)return{};if(t.search===!0)return n;let e=h(t.search,n);return r&&(r.explicit=e),e}return i[e]({search:n,next:(t,n)=>{if(n){let n=r||{};return{search:a(e+1,t,n),meta:n}}return a(e+1,t,r)},meta:r})};return a(0,e)}function qt(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return De}function Jt(e,t){if(e===!1||e===null)return Object.create(null);if((e??!0)===!0)return t;let n=Object.assign(Object.create(null),t);return Object.assign(n,h(e,n))}function Yt(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function Xt(e,t){return e.options[t]?.preload?.()}function Zt(e,t){let n=Xt(e,`component`),r=Xt(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function Qt(e,t,n){let r=()=>t===!1?void 0:t?Xt(e,t):Zt(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function $t(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).finally(()=>t.removeEventListener(`abort`,i))})}function ln(e,t){return e.routesById[t.routeId]}function un(e,t,n){return bt(e)?[an,e]:ge(e)?(e.routeId||=n,[rn,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[nn,e]):[tn,e]}function dn(e,t){let n=un(t,!0,e.id);if(n[0]!==nn)return n;try{e.options.onError?.(n[1])}catch(t){n=un(t,!0,e.id)}return n}function fn(e,t,n,r,i){return i[0].signal.aborted?on:Dn(e,t,n,dn(n,r),i)}async function pn(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;ie.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return hn(e,r),[i,fn(e,t,u,a,n)]}if(c.aborted)return[i,on];let p=r.paramsError??r.searchError;if(p!==void 0)return hn(e,r),[i,fn(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{_n(e,r,`beforeLoad`,n[0]);let a=await cn(m({...f,search:r.search,context:r.context,...e.options.additionalContext}),c);if(c.aborted)return[i,on];let o=Dn(e,t,u,un(a,!1,u.id),n);if(o[0]!==tn)return hn(e,r),[i,o];r.context={...r.context,...a}}catch(a){return hn(e,r),[i,fn(e,t,u,a,n)]}finally{r.status=h,_n(e,r,!1,n[0])}}i()}function mn(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function hn(e,t){let n=t._flight;t._flight=void 0,mn(e,t,n)?.abort()}function D(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=mn(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function gn(e){for(let t of e){let e=t._flight;e&&e[2]++}}function _n(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function vn(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation:s}),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function yn(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return on;if(!i)return[tn,void 0];let l=n._flight;_n(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(vn(e,t,n,r,s,a,!!o[3]))).then(e=>un(e,!1,r.id),e=>un(e,!0,r.id)).then(t=>(t[0]!==tn&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===nn&&l[2]?dn(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Dn(e,t,r,await cn(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return hn(e,n),on}finally{_n(e,n,!1,s)}}function bn(e,t,n){t[0]!==an&&(e.status=`success`,e.error=void 0,t[0]===tn?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function xn(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&hn(e,r)}function Sn(e,t){return t[0]===nn||t[0]===rn?{...e,status:t[0]===nn?`error`:`notFound`,error:t[1],_flight:void 0}:e}function Cn(e,t,n,r,i,a,o){let s=t[1][n],c=ln(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(vn(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=on)),!p){if(s.status!==`success`)f=!0;else{let t=l||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,hn(e,s),p=fn(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!!(m&&f&&s.status===`success`&&!l&&!a[4]&&((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)!==`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),S=n>=o?a[7]:void 0,ee=c.lazyFn&&c._lazy!==!0?S:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,mn(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let te=(p?Promise.resolve(p):x?yn(e,t,s,c,g,i,a):Promise.resolve([tn,s.loaderData])).then(t=>(x&&(bn(s,t,l),t[0]===tn&&(m&&!a[0].signal.aborted&&xn(e,s,u),n>=o&&(s.status=`pending`))),t)),ne=cn(Promise.resolve().then(()=>Qt(c,void 0,ee)),a[0].signal).then(()=>void 0,r=>t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound))?void 0:[n,fn(e,t,c,r,a)]).then(e=>te.then(t=>(x&&!e&&t[0]===tn&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.()),e)));if(r.push([n,te,ne]),!y)return te.then(e=>Sn(s,e));let C={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let re=yn(e,t,C,c,g,i,a).then(e=>(s.isFetching=!1,bn(C,e,!1),e));return(t[2]??=[]).push([n,re,ne,C]),re.then(e=>Sn(C,e))}async function wn(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=ln(e,t[n]);try{let e=Qt(i,!1);e&&await cn(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function Tn(e,t){t[2]&&=(D(e,t[2].map(e=>e[3])),void 0)}async function En(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=an)throw[a,t];!i&&t[0]!==tn&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===an)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Dn(e,t,n,r,i,a){for(;r[0]===an;){let o=r[1],s=o.options;if(s.reloadDocument?i[3]:i[1]>=20)return r;try{return s.href&&s.reloadDocument?(e.resolveRedirect(o),r):[an,o,e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0})]}catch(e){r=a?[nn,e]:dn(n,e),a=!0}}return r}async function On(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===rn?wn(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=an)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==tn&&t[0]=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=an){let n=s[1];if(n[0]!==an||n[1].options.reloadDocument||n[2])return Tn(e,t),n;c=!0,s=[0,[nn,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===nn?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};p(),i||a?.();let m=ln(e,u);try{await cn(i?Promise.resolve().then(()=>Qt(m,l===nn?`errorComponent`:`notFoundComponent`)):Promise.all([Qt(m),Qt(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return Tn(e,t),on}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),Tn(e,t),D(e,o),p()):u.status=`success`}return t}async function kn(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;te._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await wn(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l{for(let t=d;t=an&&(c=0);p()}if(!a.aborted&&!r[3]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let h=On(e,i,u,r[0],En(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=En(i[2],void 0,void 0,h.then(e=>sn(e)?0:$t(n).length,()=>0))),o=await h}catch(t){if(Tn(e,i),t===a&&a.aborted)return on;throw t}return sn(o)?o:kn(e,o,a,r[6]===n.length?r[6]:0)}function jn(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a0){i[3]=setTimeout(()=>jn(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function Mn(e,t){let n=e._pending;(e._tx===t||!e._tx?.[3].some(e=>e.id===n?.[1]))&&(clearTimeout(n?.[3]),e._pending=void 0)}async function Nn(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!$t(t[3]).some(e=>e.id===n[1]))return;let i;try{await cn(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function Pn(e,t){e._committed=t,e.stores.setMatches(t)}function Fn(e,t,n,r){let i=e._committed,a=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let o=$t(n).length,s=new Map;{let t=Date.now();for(let r of[...i,...a.values()]){if(r.status!==`success`||n.some((e,t)=>e.id===r.id&&(t=(r.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||s.set(r.id,a.get(r.id)===r?r:{...r,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=s,Pn(e,n),D(e,[...a.values(),...i],[...n,...s.values()]),Vt(e,i,n,t)}async function In(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}function Ln(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:i.publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function Rn(e,t,n,r,i){let a=n.map(e=>({...e}));gn(a);for(let t of r)hn(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await On(e,o,r,t[0],i)}catch(t){throw D(e,a),t}if(sn(s)){D(e,a),s[0]===an&&e._tx===t&&e._committed===n&&await Ln(e,t,s);return}if(await kn(e,s,t[0].signal),e._tx!==t||e._committed!==n){D(e,a);return}for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),hn(e,n))}Pn(e,a),D(e,n,a)}async function zn(e,t,n,r,i,a){let o=await An(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(sn(o)){let n=o[0]===an&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Mn(e,t),D(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Mn(e,t);return}await Ln(e,t,o);return}let s=o[1];if(e._tx===t&&await Nn(e,t),e._tx!==t){Mn(e,t),D(e,s),Tn(e,o);return}let c=t[2],l=zt(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await Nn(e,t),e._tx!==t){Mn(e,t),D(e,s),Tn(e,o);return}let n=await e.startTransition(()=>{Mn(e,t),Fn(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);if(e._tx!==t){Tn(e,o);return}u?.length&&Rn(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function Bn(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),!u.signal.aborted){let t=zt(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await In(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});gn(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){D(e,m),await In(e,n);return}e._preflight=void 0;let g,_=()=>zn(e,y,f,()=>jn(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_).then(),y=[p,s,a,m,Date.now(),v];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&_n(e,t,!1)}n[0].abort(),D(e,n[3],y[3],!0)}if(e._tx!==y){D(e,y[3]),y[3]=[],g?.(),await In(e,y);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&jn(e,y),g?.(_()),await v,await In(e,y)}async function Vn(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),gn(a),o=(e._preloads??=new Map).set(i,a),s=await An(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),D(e,a)),i.abort()}if(!sn(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){ge(e)||console.error(e);return}}}async function Hn(e){let t=window.$_TSR,n=e.options.serializationAdapters;n?.length&&(t.t=new Map(n.map(e=>[e.key,e.fromSerializable])),t.buffer.forEach(e=>e())),t.initialized=!0;let r=t.router;e.ssr={manifest:r.manifest},e.options.ssr={nonce:document.querySelector(`meta[property="csp-nonce"]`)?.content};let i=r.matches,a=new AbortController,o=e._preflight;e._preflight=a,o?.abort();let s=()=>e._preflight===a,c,l,u,d;try{if(await cn(e.options.hydrate?.(r.dehydratedData),a.signal),!s())return;let t=e.history.location;u=t.href,d=t.state,e.updateLatestLocation(),c=e.latestLocation,e.stores.location.set(c),l=e.matchRoutes(c,{_controller:a})}catch(t){if(s()&&(e._preflight=void 0),a.abort(t),t!==a.signal)throw t}if(!s())return;let f=[],p,m=0,h=t=>{m=Math.min(m,t+1);let n=f.splice(t);for(let t of n)ln(e,t).options.loader&&(t.status===`success`||!t.invalid&&`loaderData`in t)&&xn(e,{...t,status:`success`,error:void 0,preload:!0},e._cache.get(t.id));D(e,n)},g=i.length>l.length?l.findIndex(e=>e._notFound)+1:i.length,_=!1;for(let t=0;t{try{let n=ln(e,t);return await(t._notFound?Promise.all([Qt(n),Qt(n,`notFoundComponent`)]):Qt(n,t.status===`error`?`errorComponent`:t.status===`notFound`?`notFoundComponent`:void 0)),!0}catch{return!1}}),y=0;try{for(;ye.navigate({...t,_fromLocation:c}),buildLocation:e.buildLocation,cause:n.cause,abortController:a,preload:!1,matches:l,routeId:r.id})||{}}catch{if(!s())return;if(n.status!==`error`&&n.status!==`notFound`&&!n._notFound){p=Math.min(p??t,t),h(t);break}}if(!s())return}n.context={...o,...u,...f[t]&&i[t].b}}if(await kn(e,[c,l],a.signal,0,m),!s())return;let x=p!==void 0||f.lengthp+1?m:void 0,ee=ee.slice(),ee[p]={...e,status:`pending`,ssr:e.ssr===`data-only`&&`data-only`,_assetEnd:te}}let ne=()=>{let t=e.history.location;return x&&!e._tx&&t.href===u&&t.state===d&&e._committed===S&&S.length&&!a.signal.aborted?a:void 0},C=[ne,t=>{if(e._handoff!==C)return;e._handoff=void 0;let n=S.length;if(!t||!ne()||S.some((e,n)=>e.id!==t[n]?.id)){a.abort();return}let r=te;if(r!==void 0){for(let e=n;ep+1?e:void 0;break}}let i=S.map(e=>({...e}));r!==void 0&&(i[p]._assetEnd=r),D(e,t.splice(0,n,...i));for(let e=n;e{e.stores.setMatches(ee),e.stores.status.set(`idle`),x||e.stores.resolvedLocation.set(e.stores.location.get())})}var Un=Symbol.for(`TSR_DEFERRED_PROMISE`);function Wn(e,t){let n=e;return n[Un]?n:(n[Un]={status:`pending`},n.then(e=>{n[Un].status=`success`,n[Un].data=e}).catch(e=>{n[Un].status=`error`,n[Un].error={data:(t?.serializeError??Rt)(e),__isServerError:!0}}),n)}function Gn(e,t){if(e)return typeof e==`string`?e:e[t]}function Kn(e){return e?.scriptFormat??`module`}function qn(e,t,n){let r=Jn(t),i=Gn(n,`script`)??r.crossOrigin;return{...Kn(e)===`iife`?{rel:`preload`,as:`script`}:{rel:`modulepreload`},href:r.href,...i?{crossOrigin:i}:{}}}function Jn(e){return typeof e==`string`?{href:e,crossOrigin:void 0}:e}function Yn(e,t){if(t.length===0)return;if(t.length===1){e.push(t[0]);return}let n=new Set;for(let r of t){let t=JSON.stringify(r);n.has(t)||(n.add(t),e.push(r))}}function Xn(e){return typeof e==`string`?{href:e,crossOrigin:void 0}:e}var Zn=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=De:this.parentRoute||Le();let r=n?De:t?.path;r&&r!==`/`&&(r=Ae(r));let i=t?.id||r,a=n?De:Oe([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=Oe([`/`,a]));let o=a===`__root__`?`/`:Oe([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=fe(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=>yt({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.`)}},Qn=class extends Zn{constructor(e){super(e)}},$n=Symbol.asyncIterator,er=Symbol.hasInstance,tr=Symbol.isConcatSpreadable,nr=Symbol.iterator,rr=Symbol.match,ir=Symbol.matchAll,ar=Symbol.replace,or=Symbol.search,sr=Symbol.species,cr=Symbol.split,lr=Symbol.toPrimitive,ur=Symbol.toStringTag,dr=Symbol.unscopables,fr={[$n]:0,[er]:1,[tr]:2,[nr]:3,[rr]:4,[ir]:5,[ar]:6,[or]:7,[sr]:8,[cr]:9,[lr]:10,[ur]:11,[dr]:12},pr={0:$n,1:er,2:tr,3:nr,4:rr,5:ir,6:ar,7:or,8:sr,9:cr,10:lr,11:ur,12:dr},mr={2:!0,3:!1,1:void 0,0:null,4:-0,5:1/0,6:-1/0,7:NaN},hr={0:`Error`,1:`EvalError`,2:`RangeError`,3:`ReferenceError`,4:`SyntaxError`,5:`TypeError`,6:`URIError`},gr={0:Error,1:EvalError,2:RangeError,3:ReferenceError,4:SyntaxError,5:TypeError,6:URIError};function O(e,t,n,r,i,a,o,s,c,l,u,d){return{t:e,i:t,s:n,c:r,m:i,p:a,e:o,a:s,f:c,b:l,o:u,l:d}}function _r(e){return O(2,void 0,e,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)}var vr=_r(2),yr=_r(3),br=_r(1),xr=_r(0),Sr=_r(4),Cr=_r(5),wr=_r(6),Tr=_r(7);function Er(e){switch(e){case`"`:return`\\"`;case`\\`:return`\\\\`;case` -`:return`\\n`;case`\r`:return`\\r`;case`\b`:return`\\b`;case` `:return`\\t`;case`\f`:return`\\f`;case`<`:return`\\x3C`;case`\u2028`:return`\\u2028`;case`\u2029`:return`\\u2029`;default:return}}function Dr(e){let t=``,n=0,r;for(let i=0,a=e.length;iMr(e),Pr=class extends Error{constructor(e,t){super(Nr(e,t)),this.cause=t}},Fr=class extends Pr{constructor(e){super(`parsing`,e)}},Ir=class extends Pr{constructor(e){super(`deserialization`,e)}};function Lr(e){return`Seroval Error (specific: ${e})`}var Rr=class extends Error{constructor(e){super(Lr(1)),this.value=e}},zr=class extends Error{constructor(e){super(Lr(2))}},Br=class extends Error{constructor(e){super(Lr(3))}},Vr=class extends Error{constructor(e){super(Lr(4))}},Hr=class extends Error{constructor(e){super(Lr(5)),this.value=e}},Ur=class extends Error{constructor(e){super(Lr(6))}},Wr=class extends Error{constructor(e){super(Lr(7))}},k=class extends Error{constructor(e){super(Lr(8))}},Gr=class extends Error{constructor(e){super(Lr(9))}},Kr=`__SEROVAL_REFS__`,qr=new Map,Jr=new Map;function Yr(e){return qr.has(e)}function Xr(e){return Jr.has(e)}function Zr(e){if(Yr(e))return qr.get(e);throw new Hr(e)}function Qr(e){if(Xr(e))return Jr.get(e);throw new Ur(e)}typeof globalThis<`u`?Object.defineProperty(globalThis,Kr,{value:Jr,configurable:!0,writable:!1,enumerable:!1}):typeof window<`u`?Object.defineProperty(window,Kr,{value:Jr,configurable:!0,writable:!1,enumerable:!1}):typeof self<`u`?Object.defineProperty(self,Kr,{value:Jr,configurable:!0,writable:!1,enumerable:!1}):typeof global<`u`&&Object.defineProperty(global,Kr,{value:Jr,configurable:!0,writable:!1,enumerable:!1});function $r(e){return e instanceof EvalError?1:e instanceof RangeError?2:e instanceof ReferenceError?3:e instanceof SyntaxError?4:e instanceof TypeError?5:e instanceof URIError?6:0}function ei(e){let t=hr[$r(e)];return e.name===t?e.constructor.name===t?{}:{name:e.constructor.name}:{name:e.name}}function ti(e,t){let n=ei(e),r=Object.getOwnPropertyNames(e);for(let i=0,a=r.length,o;ihi)throw new Rr(t);return O(15,e,void 0,t.constructor.name,void 0,void 0,void 0,void 0,n,t.byteOffset,void 0,t.length)}function _i(e,t,n){if(t.length>hi)throw new Rr(t);return O(16,e,void 0,t.constructor.name,void 0,void 0,void 0,void 0,n,t.byteOffset,void 0,t.length)}function vi(e,t,n){if(t.byteLength>hi)throw new Rr(t);return O(20,e,void 0,void 0,void 0,void 0,void 0,void 0,n,t.byteOffset,void 0,t.byteLength)}function yi(e,t,n){return O(13,e,$r(t),void 0,Dr(t.message),n,void 0,void 0,void 0,void 0,void 0,void 0)}function bi(e,t,n){return O(14,e,$r(t),void 0,Dr(t.message),n,void 0,void 0,void 0,void 0,void 0,void 0)}function xi(e,t){return O(7,e,void 0,void 0,void 0,void 0,void 0,t,void 0,void 0,void 0,void 0)}function Si(e,t){return O(28,void 0,void 0,void 0,void 0,void 0,void 0,[e,t],void 0,void 0,void 0,void 0)}function Ci(e,t){return O(30,void 0,void 0,void 0,void 0,void 0,void 0,[e,t],void 0,void 0,void 0,void 0)}function wi(e,t,n){return O(31,e,void 0,void 0,void 0,void 0,void 0,n,t,void 0,void 0,void 0)}function Ti(e,t){return O(32,e,void 0,void 0,void 0,void 0,void 0,void 0,t,void 0,void 0,void 0)}function Ei(e,t){return O(33,e,void 0,void 0,void 0,void 0,void 0,void 0,t,void 0,void 0,void 0)}function Di(e,t){return O(34,e,void 0,void 0,void 0,void 0,void 0,void 0,t,void 0,void 0,void 0)}function Oi(e,t,n,r){return O(35,e,n,void 0,void 0,void 0,void 0,t,void 0,void 0,void 0,r)}var ki=class{constructor(e,t){this.value=e,this.replacement=t}},Ai=()=>{let e={p:0,s:0,f:0};return e.p=new Promise((t,n)=>{e.s=t,e.f=n}),e},ji=()=>{let e=[],t=[],n=!0,r=!1,i=0,a={flush(e,n,r){for(r=0;r{n&&(t[r]=t[i],t[i--]=void 0)}}};return{__SEROVAL_STREAM__:!0,on(e){return a.on(e)},next(t){n&&(e.push(t),a.flush(t,`next`))},throw(i){n&&(e.push(i),a.flush(i,`throw`),n=!1,r=!1,t.length=0)},return(i){n&&(e.push(i),a.flush(i,`return`),n=!1,r=!0,t.length=0)}}},Mi=e=>t=>()=>{let n=0,r={[e](){return r},next(){if(n>t.d)return{done:!0,value:void 0};let e=n++,r=t.v[e];if(e===t.t)throw r;return{done:e===t.d,value:r}}};return r},Ni=(e,t)=>n=>()=>{let r=0,i=-1,a=!1,o=[],s=[],c={finalize(e=0,t=s.length){for(;e=o.length){let e=t();return s.push(e),e.p}return{done:!1,value:o[e]}}if(r>i)return{done:!0,value:void 0};let e=r++,n=o[e];if(e!==i)return{done:!1,value:n};if(a)throw n;return{done:!0,value:n}}};return l},Pi=e=>{let t=atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e{}),t}var Wi=Ni($n,Ai);function Gi(e){return Wi(e)}async function Ki(e){try{return[1,await e]}catch(e){return[0,e]}}function qi(e,t){return{plugins:t.plugins,mode:e,marked:new Set,features:127^(t.disabledFeatures||0),refs:t.refs||new Map,depthLimit:t.depthLimit||1e3}}function Ji(e,t){e.marked.add(t)}function Yi(e,t){let n=e.refs.size;return e.refs.set(t,n),n}function Xi(e,t){let n=e.refs.get(t);return n==null?{type:0,value:Yi(e,t)}:(Ji(e,n),{type:1,value:oi(n)})}function Zi(e,t){let n=Xi(e,t);return n.type===1?n:Yr(t)?{type:2,value:di(n.value,t)}:n}function Qi(e,t){let n=Zi(e,t);if(n.type!==0)return n.value;if(t in fr)return ui(n.value,t);throw new Rr(t)}function $i(e,t){let n=Xi(e,Hi[t]);return n.type===1?n.value:O(26,n.value,t,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)}function ea(e){let t=Xi(e,Bi);return t.type===1?t.value:O(27,t.value,void 0,void 0,void 0,void 0,void 0,void 0,Qi(e,nr),void 0,void 0,void 0)}function ta(e){let t=Xi(e,Vi);return t.type===1?t.value:O(29,t.value,void 0,void 0,void 0,void 0,void 0,[$i(e,1),Qi(e,$n)],void 0,void 0,void 0,void 0)}function na(e,t,n,r){return O(n?11:10,e,void 0,void 0,void 0,r,void 0,void 0,void 0,void 0,ni(t),void 0)}function ra(e,t,n,r){return O(8,t,void 0,void 0,void 0,void 0,{k:n,v:r},void 0,$i(e,0),void 0,void 0,void 0)}function ia(e,t,n){let r=new Uint8Array(n),i=``;for(let e=0,t=r.length;e{Ji(this.base,t),N(this,e,n).then(e=>{a.push(Ti(t,e))},e=>{i(e),o()})},throw:n=>{Ji(this.base,t),N(this,e,n).then(e=>{a.push(Ei(t,e)),r(a),o()},e=>{i(e),o()})},return:n=>{Ji(this.base,t),N(this,e,n).then(e=>{a.push(Di(t,e)),r(a),o()},e=>{i(e),o()})}})}async function xa(e,t,n,r){return wi(n,$i(e.base,4),await new Promise(ba.bind(e,t,n,r)))}async function Sa(e,t,n,r){let i=[];for(let n=0,a=r.v.length;n=e.base.depthLimit)throw new Gr(e.base.depthLimit);switch(typeof n){case`boolean`:return n?vr:yr;case`undefined`:return br;case`string`:return ii(n);case`number`:return ri(n);case`bigint`:return ai(n);case`object`:if(n){let r=Zi(e.base,n);return r.type===0?await Ca(e,t+1,r.value,n):r.value}return xr;case`symbol`:return Qi(e.base,n);case`function`:return wa(e,t,n);default:throw new Rr(n)}}async function Ta(e,t){try{return await N(e,0,t)}catch(e){throw e instanceof Fr?e:new Fr(e)}}function Ea(e){return e}function Da(e,t){for(let n=0,r=t.length;n0)for(let a=0,o=n.v,s=i.length;aPa)throw new k(t);return P(e,t.i,new RegExp(n,t.m))}throw new zr(t)}function no(e,t,n){let r=P(e,n.i,new Set);for(let i=0,a=n.a,o=a.length;iMa)throw new k(t);return P(e,t.i,Pi(kr(t.s)))}function ao(e,t,n){let r=ka(n.c),i=L(e,t,n.f);if(!(i instanceof ArrayBuffer))throw new k(n);let a=n.b??0;if(a<0||a>i.byteLength||n.l>Ma)throw new k(n);return P(e,n.i,new r(i,a,n.l))}function oo(e,t,n){let r=L(e,t,n.f);if(!(r instanceof ArrayBuffer))throw new k(n);let i=n.b??0;if(i<0||i>r.byteLength||n.l>Ma)throw new k(n);return P(e,n.i,new DataView(r,i,n.l))}function so(e,t,n,r){if(n.p){let i=Za(e,t,n.p,{});Object.defineProperties(r,Object.getOwnPropertyDescriptors(i))}return r}function co(e,t,n){return so(e,t,n,P(e,n.i,AggregateError([],kr(n.m))))}function lo(e,t,n){let r=Wa(n,gr,n.s);return so(e,t,n,P(e,n.i,new r(kr(n.m))))}function uo(e,t,n){let r=Ai(),i=P(e,n.i,r.p),a=L(e,t,n.f);if(Va(a))throw new k(n.f);return n.s?r.s(a):r.f(a),i}function fo(e,t,n){return P(e,n.i,Object(L(e,t,n.f)))}function po(e,t,n){let r=e.base.plugins;if(r){let i=kr(n.c);for(let a=0,o=r.length;ae.base.depthLimit)throw new Gr(e.base.depthLimit);switch(t+=1,n.t){case 2:return Wa(n,mr,n.s);case 0:return Number(n.s);case 1:return kr(String(n.s));case 3:if(String(n.s).length>Na)throw new k(n);return BigInt(n.s);case 4:return e.base.refs.get(n.i);case 18:return Ga(e,n);case 9:return Ka(e,t,n);case 10:case 11:return Qa(e,t,n);case 5:return $a(e,n);case 6:return to(e,n);case 7:return no(e,t,n);case 8:return ro(e,t,n);case 19:return io(e,n);case 16:case 15:return ao(e,t,n);case 20:return oo(e,t,n);case 14:return co(e,t,n);case 13:return lo(e,t,n);case 12:return uo(e,t,n);case 17:return Wa(n,pr,n.s);case 21:return fo(e,t,n);case 25:return po(e,t,n);case 22:return mo(e,n);case 23:case 24:return ho(e,t,n);case 28:return go(e,t,n);case 30:return _o(e,t,n);case 31:return vo(e,t,n);case 32:return F(e,t,n);case 33:return I(e,t,n);case 34:return yo(e,t,n);case 27:return bo(e,t,n);case 29:return xo(e,t,n);case 35:return So(e,t,n);case 36:return eo(e,n);default:throw new zr(n)}}function Co(e,t){try{return L(e,0,t)}catch(e){throw new Ir(e)}}function wo(e,t){return Co(Ra({plugins:Oa(t.plugins),refs:t.refs,features:t.features,disabledFeatures:t.disabledFeatures,depthLimit:t.depthLimit}),e)}async function To(e,t={}){let n=aa(1,{plugins:Oa(t.plugins),disabledFeatures:t.disabledFeatures});return{t:await Ta(n,e),f:n.base.features,m:Array.from(n.base.marked)}}function R(e){return e}function Eo(e){return Ea({tag:`$TSR/t/`+e.key,test:e.test,parse:{sync(t,n,r){return{v:n.parse(e.toSerializable(t))}},async async(t,n,r){return{v:await n.parse(e.toSerializable(t))}},stream(t,n,r){return{v:n.parse(e.toSerializable(t))}}},serialize:void 0,deserialize(t,n,r){return e.fromSerializable(n.deserialize(t.v))}})}var Do=class{constructor(e,t){this.stream=e,this.hint=t?.hint??`binary`}},Oo=globalThis.Buffer,ko=!!Oo&&typeof Oo.from==`function`;function Ao(e){if(e.length===0)return``;if(ko)return Oo.from(e).toString(`base64`);let t=32768,n=[];for(let r=0;rnew ReadableStream({start(t){e.on({next(e){try{t.enqueue(jo(e))}catch{}},throw(e){t.error(e)},return(){try{t.close()}catch{}}})}}),z=new TextEncoder,Fo=e=>new ReadableStream({start(t){e.on({next(e){try{typeof e==`string`?t.enqueue(z.encode(e)):t.enqueue(jo(e.$b64))}catch{}},throw(e){t.error(e)},return(){try{t.close()}catch{}}})}}),Io=`(s=>new ReadableStream({start(c){s.on({next(b){try{const d=atob(b),a=new Uint8Array(d.length);for(let i=0;i{const e=new TextEncoder();return new ReadableStream({start(c){s.on({next(v){try{if(typeof v==='string'){c.enqueue(e.encode(v))}else{const d=atob(v.$b64),a=new Uint8Array(d.length);for(let i=0;i{try{for(;;){let{done:e,value:r}=await n.read();if(e){t.return(void 0);break}t.next(Ao(r))}}catch(e){t.throw(e)}finally{n.releaseLock()}})(),t}function zo(e){let t=j(),n=e.getReader(),r=new TextDecoder(`utf-8`,{fatal:!0});return(async()=>{try{for(;;){let{done:e,value:i}=await n.read();if(e){try{let e=r.decode();e.length>0&&t.next(e)}catch{}t.return(void 0);break}try{let e=r.decode(i,{stream:!0});e.length>0&&t.next(e)}catch{t.next({$b64:Ao(i)})}}}catch(e){t.throw(e)}finally{n.releaseLock()}})(),t}var Bo=Ea({tag:`tss/RawStream`,extends:[Ea({tag:`tss/RawStreamFactory`,test(e){return e===Mo},parse:{sync(e,t,n){return{}},async async(e,t,n){return{}},stream(e,t,n){return{}}},serialize(e,t,n){return Io},deserialize(e,t,n){return Mo}}),Ea({tag:`tss/RawStreamFactoryText`,test(e){return e===No},parse:{sync(e,t,n){return{}},async async(e,t,n){return{}},stream(e,t,n){return{}}},serialize(e,t,n){return Lo},deserialize(e,t,n){return No}})],test(e){return e instanceof Do},parse:{sync(e,t,n){let r=e.hint===`text`?No:Mo;return{hint:t.parse(e.hint),factory:t.parse(r),stream:t.parse(j())}},async async(e,t,n){let r=e.hint===`text`?No:Mo,i=e.hint===`text`?zo(e.stream):Ro(e.stream);return{hint:await t.parse(e.hint),factory:await t.parse(r),stream:await t.parse(i)}},stream(e,t,n){let r=e.hint===`text`?No:Mo,i=e.hint===`text`?zo(e.stream):Ro(e.stream);return{hint:t.parse(e.hint),factory:t.parse(r),stream:t.parse(i)}}},serialize(e,t,n){return`(`+t.serialize(e.factory)+`)(`+t.serialize(e.stream)+`)`},deserialize(e,t,n){let r=t.deserialize(e.stream);return t.deserialize(e.hint)===`text`?Fo(r):Po(r)}});function Vo(e){return Ea({tag:`tss/RawStream`,test:()=>!1,parse:{},serialize(){throw Error(`RawStreamDeserializePlugin.serialize should not be called. Client only deserializes.`)},deserialize(t,n,r){return e(typeof n?.deserialize==`function`?n.deserialize(t.streamId):t.streamId)}})}var Ho=Ea({tag:`$TSR/Error`,test(e){return e instanceof Error},parse:{sync(e,t){return{message:t.parse(e.message)}},async async(e,t){return{message:await t.parse(e.message)}},stream(e,t){return{message:t.parse(e.message)}}},serialize(e,t){return`new Error(`+t.serialize(e.message)+`)`},deserialize(e,t){return Error(t.deserialize(e.message))}}),Uo={},Wo=e=>new ReadableStream({start(t){e.on({next(e){try{t.enqueue(e)}catch{}},throw(e){t.error(e)},return(){try{t.close()}catch{}}})}}),Go=Ea({tag:`seroval-plugins/web/ReadableStreamFactory`,test(e){return e===Uo},parse:{sync(){return Uo},async async(){return await Promise.resolve(Uo)},stream(){return Uo}},serialize(){return Wo.toString()},deserialize(){return Uo}});async function Ko(e,t){try{let n=await t.read();n.done?(e.return(n.value),t.releaseLock()):(e.next(n.value),await Ko(e,t))}catch(t){e.throw(t)}}function qo(e){e.cancel().catch(()=>{}),e.releaseLock()}function Jo(e){let t=j(),n=e.getReader(),r=qo.bind(null,n);return Ko(t,n).catch(r),[t,r]}var Yo=[Ho,Bo,Ea({tag:`seroval/plugins/web/ReadableStream`,extends:[Go],test(e){return typeof ReadableStream>`u`?!1:e instanceof ReadableStream},parse:{sync(e,t){return{factory:t.parse(Uo),stream:t.parse(j())}},async async(e,t){return{factory:await t.parse(Uo),stream:await t.parse(Jo(e)[0])}},stream(e,t){let[n,r]=Jo(e);return t.addCleanup(r),{factory:t.parse(Uo),stream:t.parse(n)}}},serialize(e,t){return`(`+t.serialize(e.factory)+`)(`+t.serialize(e.stream)+`)`},deserialize(e,t){return Wo(t.deserialize(e.stream))}})];function Xo(){return[...(Xe()?.serializationAdapters)?.map(Eo)??[],...Yo]}var Zo=new TextDecoder,Qo=new Uint8Array,$o=16777216,es=33554432,ts=1024,ns=1e5;function rs(e){let t=new Map,n=new Map,r=new Set,i=!1,a=null,o=0,s,c=new ReadableStream({start(e){s=e},cancel(){i=!0;try{a?.cancel()}catch{}t.forEach(e=>{try{e.error(Error(`Framed response cancelled`))}catch{}}),t.clear(),n.clear(),r.clear()}});function l(e){let i=n.get(e);if(i)return i;if(r.has(e))return new ReadableStream({start(e){e.close()}});if(n.size>=ts)throw Error(`Too many raw streams in framed response (max ${ts})`);let a=new ReadableStream({start(n){t.set(e,n)},cancel(){r.add(e),t.delete(e),n.delete(e)}});return n.set(e,a),a}function u(e){return l(e),t.get(e)}return(async()=>{let n=e.getReader();a=n;let c=[],l=0,d=0;function f(){c[l++]=Qo,l===c.length?(c.length=0,l=0):l>=32&&(c.splice(0,l),l=0)}function p(){if(d<9)return null;let e=c[l];if(e.length>=9)return{type:e[0],streamId:(e[1]<<24|e[2]<<16|e[3]<<8|e[4])>>>0,length:(e[5]<<24|e[6]<<16|e[7]<<8|e[8])>>>0};let t=new Uint8Array(9),n=0,r=9;for(let e=l;e0;e++){let i=c[e],a=Math.min(i.length,r);t.set(i.subarray(0,a),n),n+=a,r-=a}return{type:t[0],streamId:(t[1]<<24|t[2]<<16|t[3]<<8|t[4])>>>0,length:(t[5]<<24|t[6]<<16|t[7]<<8|t[8])>>>0}}function m(e){if(e===0)return Qo;let t=c[l];if(t&&t.length>=e){let n=t.subarray(0,e);return t.length===e?f():c[l]=t.subarray(e),d-=e,n}let n=new Uint8Array(e),r=0,i=e;for(;i>0&&les)throw Error(`Framed response buffer exceeded ${es} bytes`);for(c.push(a),d+=a.length;;){let e=p();if(!e)break;let{type:n,streamId:i,length:a}=e;if(n!==Ke.JSON&&n!==Ke.CHUNK&&n!==Ke.END&&n!==Ke.ERROR)throw Error(`Unknown frame type: ${n}`);if(n===Ke.JSON){if(i!==0)throw Error(`Invalid JSON frame streamId (expected 0)`)}else if(i===0)throw Error(`Invalid raw frame streamId (expected non-zero)`);if(a>$o)throw Error(`Frame payload too large: ${a} bytes (max ${$o})`);let c=9+a;if(dns)throw Error(`Too many frames in framed response (max ${ns})`);m(9);let l=m(a);switch(n){case Ke.JSON:try{s.enqueue(Zo.decode(l))}catch{}break;case Ke.CHUNK:{let e=u(i);e&&e.enqueue(l);break}case Ke.END:{let e=u(i);if(r.add(i),e){try{e.close()}catch{}t.delete(i)}break}case Ke.ERROR:{let e=u(i);if(r.add(i),e){let n=Zo.decode(l);e.error(Error(n)),t.delete(i)}break}}}}}if(d!==0)throw Error(`Incomplete frame at end of framed response`);try{s.close()}catch{}t.forEach(e=>{try{e.close()}catch{}}),t.clear()}catch(e){try{s.error(e)}catch{}t.forEach(t=>{try{t.error(e)}catch{}}),t.clear()}finally{try{n.releaseLock()}catch{}a=null}})(),{getStream:l,chunks:c}}var is=null;async function as(e){e.length>0&&await Promise.allSettled(e)}var os=Object.prototype.hasOwnProperty;function ss(e){for(let t in e)if(os.call(e,t))return!0;return!1}async function cs(e,t,n){is||=Xo();let r=t[0],i=r.fetch??n,a=r.data instanceof FormData?`formData`:`payload`,o=r.headers?new Headers(r.headers):new Headers;if(o.set(`x-tsr-serverFn`,`true`),a===`payload`&&o.set(`accept`,`${Ge}, application/x-ndjson, application/json`),r.method===`GET`){if(a===`formData`)throw Error(`FormData is not supported with GET requests`);let t=await ls(r);if(t!==void 0){let n=dt({payload:t});e.includes(`?`)?e+=`&${n}`:e+=`?${n}`}}let s;return r.method===`POST`&&(s=await ds(r),typeof s==`string`&&o.set(`content-type`,`application/json`)),await fs(async()=>i(e,{method:r.method,headers:o,signal:r.signal,body:s}))}async function ls(e){let t=!1,n={};if(e.data!==void 0&&(t=!0,n.data=e.data),e.context&&ss(e.context)&&(t=!0,n.context=e.context),t)return us(n)}async function us(e){return JSON.stringify(await Promise.resolve(To(e,{plugins:is})))}async function ds(e){if(e.data instanceof FormData){let t;return e.context&&ss(e.context)&&(t=await us(e.context)),t!==void 0&&e.data.set(Ue,t),e.data}let t=await ls(e);if(t)return t}async function fs(e){let t;try{t=await e()}catch(e){if(e instanceof Response)t=e;else throw console.log(e),e}if(t.headers.get(`x-tss-raw`)===`true`)return t;let n=t.headers.get(`content-type`);if(n||Le(),t.headers.get(`x-tss-serialized`)){let e;if(n.includes(`application/x-tss-framed`)){if(Ye(n),!t.body)throw Error(`No response body for framed response`);let{getStream:r,chunks:i}=rs(t.body),a=[Vo(r),...is||[]],o=new Map;e=await ps({jsonStream:i,onMessage:e=>wo(e,{refs:o,plugins:a}),onError(e,t){console.error(e,t)}})}else if(n.includes(`application/json`)){let n=await t.json(),r=[];try{e=wo(n,{plugins:is})}finally{}await as(r)}if(e||Le(),e instanceof Error)throw e;return e}if(n.includes(`application/json`)){let e=await t.json(),n=xt(e);if(n)throw n;if(ge(e))throw e;return e}if(!t.ok)throw Error(await t.text());return t}async function ps({jsonStream:e,onMessage:t,onError:n}){let r=e.getReader(),{value:i,done:a}=await r.read();if(a||!i)throw Error(`Stream ended before first object`);let o=JSON.parse(i),s=!1,c=(async()=>{try{for(;;){let{value:e,done:i}=await r.read();if(i)break;if(e)try{let n=[];try{t(JSON.parse(e))}finally{}await as(n)}catch(t){n?.(`Invalid JSON: ${e}`,t)}}}catch(e){s||n?.(`Stream processing error:`,e)}})(),l,u=[];try{l=t(o)}catch(e){throw s=!0,r.cancel().catch(()=>{}),e}return await as(u),Promise.resolve(l).catch(()=>{s=!0,r.cancel().catch(()=>{})}),c.finally(()=>{try{r.releaseLock()}catch{}}),l}function ms(e){let t=`/./_serverFn/`+e;return Object.assign((...e)=>{let n=Xe()?.serverFns?.fetch;return cs(t,e,n??fetch)},{url:t,serverFnMeta:{id:e},[We]:!0})}var hs=R({key:`$TSS/serverfn`,test:e=>typeof e!=`function`||!(We in e)?!1:!!e[We],toSerializable:({serverFnMeta:e})=>({functionId:e.id}),fromSerializable:({functionId:e})=>ms(e)}),gs=n(t(),1),B=a();function _s({promise:e}){if(ke)return ke(e);let t=Wn(e);if(t[Un].status===`pending`)throw t;if(t[Un].status===`error`)throw t[Un].error;return t[Un].data}function vs(e){let t=(0,B.jsx)(ys,{...e});return e.fallback?(0,B.jsx)(gs.Suspense,{fallback:e.fallback,children:t}):t}function ys(e){let t=_s(e);return e.children(t)}var V=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(V||{});function bs({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function xs(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Ss=[],Cs=0,{link:ws,unlink:Ts,propagate:Es,checkDirty:Ds,shallowPropagate:Os}=bs({update(e){return e._update()},notify(e){Ss[As++]=e,e.flags&=~V.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=V.Mutable|V.Dirty,Ps(e))}}),ks=0,As=0,js,Ms=0;function Ns(e){try{++Ms,e()}finally{--Ms||Fs()}}function Ps(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Ts(n,e)}function Fs(){if(!(Ms>0)){for(;ks{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=js,o=t?.compare??Object.is;if(n)js=i,++Cs,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=V.Mutable|V.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{js=a,n&&(i.flags&=~V.RecursedCheck),Ps(i)}}};return n?(i.flags=V.Mutable|V.Dirty,i.get=function(){let e=i.flags;if(e&V.Dirty||e&V.Pending&&Ds(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Os(e)}}else e&V.Pending&&(i.flags=e&~V.Pending);return js!==void 0&&ws(i,js,Cs),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Es(e),Os(e),Fs())}},i}function Ls(e){let t=()=>{let t=js;js=n,++Cs,n.depsTail=void 0,n.flags=V.Watching|V.RecursedCheck;try{return e()}finally{js=t,n.flags&=~V.RecursedCheck,Ps(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:V.Watching|V.RecursedCheck,notify(){let e=this.flags;e&V.Dirty||e&V.Pending&&Ds(this.deps,this)?t():this.flags=V.Watching},stop(){this.flags=V.None,this.depsTail=void 0,Ps(this)}};return t(),n}function Rs(e){return oe({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function zs(e){let{select:t,...n}=e;return oe({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Bs(e){return oe({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 Vs(e){return oe({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Hs(e){let t=r();return gs.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Us(e){return oe({...e,select:t=>e.select?e.select(t.context):t.context})}var Ws=class extends Zn{constructor(e){super(e),this.useMatch=e=>oe({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Us({...e,from:this.id}),this.useSearch=e=>Vs({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Bs({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>zs({...e,from:this.id}),this.useLoaderData=e=>Rs({...e,from:this.id}),this.useNavigate=()=>Hs({from:this.fullPath}),this.Link=gs.forwardRef((e,t)=>(0,B.jsx)(v,{ref:t,from:this.fullPath,...e}))}};function Gs(e){return new Ws(e)}var Ks=class extends Qn{constructor(e){super(e),this.useMatch=e=>oe({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Us({...e,from:this.id}),this.useSearch=e=>Vs({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Bs({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>zs({...e,from:this.id}),this.useLoaderData=e=>Rs({...e,from:this.id}),this.useNavigate=()=>Hs({from:this.fullPath}),this.Link=gs.forwardRef((e,t)=>(0,B.jsx)(v,{ref:t,from:this.fullPath,...e}))}};function qs(e){return new Ks(e)}function Js(e){return e=>{let t=Gs(e);return t.isRoot=!1,t}}function Ys(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(ye(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(ke)ke(a());else throw a()}return gs.createElement(r,e)};return o.preload=a,o}function Xs(e,t){let n=e[1];e.length=0,n?.(t)}function Zs({t:e}){let t=r(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{Xs(n,!1),n.push(i,a),e(t),gs.startTransition(r)}),Ce(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(fe(r.publicHref)!==fe(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...zt(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function Qs(){let e=r(),t=e.routesById[De],n=y(e,t),i=e.ssr?Ee:gs.Suspense,a=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Zs,{t:gs.useState()[1]}),(0,B.jsx)(i,{fallback:n,children:(0,B.jsx)($s,{})})]});return e.options.InnerWrap?(0,B.jsx)(e.options.InnerWrap,{children:a}):a}function $s(){let e=r(),t=e._rendered,n=se(e.stores.matches,e=>t[0]??e),i=n[0],a=i?.routeId;Ce(()=>{t[0]===n&&Xs(t,!0)},[t,n]);let o=a?(0,B.jsx)(ae,{routeId:a}):null;return(0,B.jsx)(ne.Provider,{value:a,children:e.options.disableGlobalCatchBoundary?o:(0,B.jsx)(pe,{getResetKey:()=>i,onCatch:void 0,children:o})})}var ec=e=>({createMutableStore:Is,createReadonlyStore:Is,batch:Ns}),tc=e=>new nc(e),nc=class extends Ht{constructor(e){super(e,ec)}};function rc({router:t,children:n,...r}){p(r)&&t.update({...t.options,...r,context:{...t.options.context,...r.context}});let i=(0,B.jsx)(e.Provider,{value:t,children:n});return t.options.Wrap?(0,B.jsx)(t.options.Wrap,{children:i}):i}function ic({router:e,...t}){return(0,B.jsx)(rc,{router:e,...t,children:(0,B.jsx)(Qs,{})})}function H(e,t){if(t)for(let[n,r]of Object.entries(t))n!==`suppressHydrationWarning`&&r!==void 0&&r!==!1&&e.setAttribute(n,typeof r==`boolean`?``:String(r))}function ac(e){let{attrs:t,children:n,nonce:r,preventScriptHoist:i}=e;switch(e.tag){case`title`:return(0,B.jsx)(`title`,{...t,suppressHydrationWarning:!0,children:n});case`meta`:return(0,B.jsx)(`meta`,{...t,suppressHydrationWarning:!0});case`link`:return(0,B.jsx)(`link`,{...t,precedence:t?.precedence??(t?.rel===`stylesheet`?`default`:void 0),nonce:r,suppressHydrationWarning:!0});case`style`:return e.inlineCss,(0,B.jsx)(`style`,{...t,dangerouslySetInnerHTML:{__html:n},nonce:r});case`script`:return(0,B.jsx)(oc,{attrs:t,preventScriptHoist:i,children:n});default:return null}}function oc({attrs:e,children:t,preventScriptHoist:n}){r();let i=s(),a=typeof e?.type==`string`&&e.type!==``&&e.type!==`text/javascript`&&e.type!==`module`;if(gs.useEffect(()=>{if(!a){if(e?.src){let t=(()=>{try{let t=document.baseURI||window.location.href;return new URL(e.src,t).href}catch{return e.src}})();for(let e of document.querySelectorAll(`script[src]`))if(e.src===t)return;let n=document.createElement(`script`);return H(n,e),document.head.appendChild(n),()=>n.remove()}if(typeof t==`string`){let n=typeof e?.type==`string`?e.type:`text/javascript`,r=typeof e?.nonce==`string`?e.nonce:void 0;for(let e of document.querySelectorAll(`script:not([src])`)){if(!(e instanceof HTMLScriptElement))continue;let i=e.getAttribute(`type`)??`text/javascript`,a=e.getAttribute(`nonce`)??void 0;if(e.textContent===t&&i===n&&a===r)return}let i=document.createElement(`script`);return i.textContent=t,H(i,e),document.head.appendChild(i),()=>i.remove()}}},[e,t,a]),a&&typeof t==`string`)return(0,B.jsx)(`script`,{...e,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:t}});if(!i){if(e?.src)return(0,B.jsx)(`script`,{...e,suppressHydrationWarning:!0});if(typeof t==`string`)return(0,B.jsx)(`script`,{...e,dangerouslySetInnerHTML:{__html:t},suppressHydrationWarning:!0})}return null}function sc(e,t,n,r){n=en(n);let i=n.map(e=>e.meta).filter(e=>e!==void 0),a=[],o={},s;for(let e=i.length-1;e>=0;e--){let n=i[e];for(let e=n.length-1;e>=0;e--){let r=n[e];if(r){if(r.title)s||={tag:`title`,children:r.title};else if(`script:ld+json`in r)try{let e=JSON.stringify(r[`script:ld+json`]);a.push({tag:`script`,attrs:{type:`application/ld+json`},children:ie(e)})}catch{}else{let e=r.name??r.property;if(e){if(o[e])continue;o[e]=!0}a.push({tag:`meta`,attrs:{...r,nonce:t}})}}}}s&&a.push(s),t&&a.push({tag:`meta`,attrs:{property:`csp-nonce`,content:t}}),a.reverse();let c=n.flatMap(e=>e.links??[]).filter(e=>e!==void 0).map(e=>({tag:`link`,attrs:{...e,nonce:t}})),l=e.ssr?.manifest,u=[];l&&(n.forEach(e=>{(l.routes[e.routeId]?.css)?.forEach(e=>{let n=Xn(e);u.push({tag:`link`,attrs:{rel:`stylesheet`,...n,crossOrigin:Gn(r,`stylesheet`)??n.crossOrigin,suppressHydrationWarning:!0,nonce:t}})})}),l.inlineStyle&&u.push({tag:`style`,attrs:{...l.inlineStyle.attrs,nonce:t},children:l.inlineStyle.children,inlineCss:!0}));let d=[];l&&n.forEach(e=>{l.routes[e.routeId]?.preloads?.forEach(e=>{d.push({tag:`link`,attrs:{...qn(l,e,r),nonce:t}})})});let f=n.flatMap(e=>e.styles??[]).filter(e=>e!==void 0).map(({children:e,...n})=>({tag:`style`,attrs:{...n,nonce:t},children:e})),p=n.flatMap(e=>e.headScripts??[]).filter(e=>e!==void 0).map(({children:e,...n})=>({tag:`script`,attrs:{...n,nonce:t},children:e})),m=[];return Yn(m,a),m.push(...d),Yn(m,c),m.push(...u),Yn(m,f),Yn(m,p),m}var cc=e=>{let t=r(),n=t.options.ssr?.nonce,i=gs.useCallback(r=>sc(t,n,r,e),[e,n,t]);return se(t.stores.matches,i,d)};function lc(e){let t=cc(e.assetCrossOrigin),n=r().options.ssr?.nonce;return(0,B.jsx)(B.Fragment,{children:t.map(e=>(0,gs.createElement)(ac,{...e,key:`tsr-meta-${JSON.stringify(e)}`,nonce:n}))})}var uc=()=>{let e=r(),t=e.options.ssr?.nonce;return dc(e,se(e.stores.matches,n=>{n=en(n);let r=n.flatMap(e=>e.scripts??[]).filter(Boolean).map(({children:e,...n})=>({tag:`script`,attrs:{...n,suppressHydrationWarning:!0,nonce:t},children:e})),i=e.ssr?.manifest;if(!i)return r;for(let e of n){let n=i.routes[e.routeId]?.scripts;if(n)for(let e of n)r.push({tag:`script`,attrs:{...e.attrs,nonce:t},children:e.children,...typeof e.attrs?.src==`string`?{preventScriptHoist:!0}:{}})}return r},d))};function dc(e,t){return(0,B.jsx)(B.Fragment,{children:t.map((e,t)=>(0,gs.createElement)(ac,{...e,key:`tsr-scripts-${e.tag}-${t}`}))})}var fc=class extends Me{#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 ce({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=pc(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=pc(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=pc(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=pc(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){C.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=>c(t,e))}findAll(e={}){return this.getAll().filter(t=>c(e,t))}notify(e){C.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return C.batch(()=>Promise.all(e.map(e=>e.continue().catch(b))))}};function pc(e){return e.options.scope?.id}var mc=class extends Me{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??ee(r,t),a=this.get(i);return a||(a=new Ie({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(){C.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=>_e(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>_e(e,t)):t}notify(e){C.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){C.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){C.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},hc=new class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new mc,this.#t=e.mutationCache||new fc,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=u.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Pe.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(_(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=m(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return C.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;C.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return C.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=C.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(b).catch(b)}invalidateQueries(e,t={}){return C.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=C.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(b)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(b)}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(_(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(_(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(b).catch(b)}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(b).catch(b)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Pe.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(f(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{S(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(f(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{S(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||=ee(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===Re&&(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()}}({defaultOptions:{queries:{retry:1,staleTime:1e3}}}),gc=``+new URL(`styles-D_-Bc3ZW.css`,import.meta.url).href,_c=qs({head:()=>({meta:[{charSet:`utf-8`},{name:`viewport`,content:`width=device-width, initial-scale=1`},{name:`theme-color`,content:`#111827`},{title:`headgate console`}],links:[{rel:`stylesheet`,href:gc}]}),shellComponent:yc,notFoundComponent:vc});function vc(){return(0,B.jsx)(`main`,{className:`grid min-h-svh place-items-center p-6 text-center`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`404`}),(0,B.jsx)(`h1`,{className:`mt-2 text-balance font-semibold text-2xl`,children:`This console page does not exist`}),(0,B.jsx)(`p`,{className:`mt-2 text-muted-foreground text-sm`,children:`Use the operator navigation to return to a supported headgate view.`}),(0,B.jsx)(v,{className:`mt-5 inline-flex rounded-lg bg-primary px-4 py-2 font-medium text-primary-foreground text-sm hover:opacity-90`,to:`/overview`,children:`Open overview`})]})})}function yc({children:e}){return(0,B.jsxs)(`html`,{lang:`en`,suppressHydrationWarning:!0,children:[(0,B.jsxs)(`head`,{children:[(0,B.jsx)(lc,{}),(0,B.jsx)(`script`,{id:`headgate-theme`,suppressHydrationWarning:!0,children:ue}),(0,B.jsx)(`script`,{id:`headgate-config`,suppressHydrationWarning:!0,children:`window.HEADGATE = window.HEADGATE || {apiBase:"/api/v1",readOnly:false};`})]}),(0,B.jsxs)(`body`,{children:[(0,B.jsx)(g,{client:hc,children:(0,B.jsx)(be,{children:e})}),(0,B.jsx)(uc,{})]})]})}var bc=Js(`/`)({beforeLoad:()=>{throw yt({to:`/overview`})}}),xc=`modulepreload`,Sc=function(e,t){return new URL(e,t).href},Cc={},wc=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Sc(t,n),t=s(t),t in Cc)return;Cc[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:xc,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Tc=Js(`/_console`)({component:Ys(()=>wc(()=>import(`./_console-Cx1B6VV3.js`),__vite__mapDeps([0,1,2,3]),import.meta.url),`component`)}),Ec=Js(`/_console/jobs`)({validateSearch:e=>({q:typeof e.q==`string`&&e.q?e.q:void 0,queue:typeof e.queue==`string`&&e.queue?e.queue:void 0,state:typeof e.state==`string`&&e.state?e.state:void 0,cursor:typeof e.cursor==`string`&&e.cursor?e.cursor:void 0,cursorTrail:typeof e.cursorTrail==`string`&&e.cursorTrail?e.cursorTrail:void 0}),component:Ys(()=>wc(()=>import(`./_console.jobs-CgmGFIqK.js`),__vite__mapDeps([4,2,3,1,5,6,7,8,9,10,11,12]),import.meta.url),`component`)}),Dc=()=>wc(()=>import(`./_console.overview-M0AniEMF.js`),__vite__mapDeps([13,2,3,1,14,15,7,12]),import.meta.url),Oc=new Set([`1h`,`6h`,`24h`,`7d`,`30d`]),kc=Js(`/_console/overview`)({validateSearch:e=>({queue:typeof e.queue==`string`&&e.queue?e.queue:void 0,range:typeof e.range==`string`&&Oc.has(e.range)?e.range:void 0}),component:Ys(Dc,`component`)}),Ac=Js(`/_console/periodic`)({validateSearch:e=>({events:typeof e.events==`string`&&e.events?e.events:void 0}),component:Ys(()=>wc(()=>import(`./_console.periodic-Dpot-gjP.js`),__vite__mapDeps([16,2,3,1,8,11,12]),import.meta.url),`component`)}),jc=Js(`/_console/quarantine`)({component:Ys(()=>wc(()=>import(`./_console.quarantine-IhoJN7GC.js`),__vite__mapDeps([17,2,1,3,8,11,12]),import.meta.url),`component`)}),Mc=Js(`/_console/queues`)({component:Ys(()=>wc(()=>import(`./_console.queues-C47vPXCj.js`),__vite__mapDeps([18,2,3,1,14,15,8,9,12]),import.meta.url),`component`)}),Nc=Js(`/_console/rate-classes`)({component:Ys(()=>wc(()=>import(`./_console.rate-classes-Cp7wdm51.js`),__vite__mapDeps([19,2,1,3,8,10,12]),import.meta.url),`component`)}),Pc=Js(`/_console/workers`)({component:Ys(()=>wc(()=>import(`./_console.workers-DrCdQYuK.js`),__vite__mapDeps([20,2,1,3,8,11,12]),import.meta.url),`component`)}),Fc=Js(`/_console/workflows`)({validateSearch:e=>({cursor:typeof e.cursor==`string`&&e.cursor?e.cursor:void 0,cursorTrail:typeof e.cursorTrail==`string`&&e.cursorTrail?e.cursorTrail:void 0}),component:Ys(()=>wc(()=>import(`./_console.workflows-XIi2cJnF.js`),__vite__mapDeps([21,2,1,3,22,6,11,12]),import.meta.url),`component`)}),Ic=Js(`/_console/jobs/$jobId`)({component:Ys(()=>wc(()=>import(`./_console.jobs._jobId-C0SN-qBR.js`),__vite__mapDeps([23,2,1,3,5,6,7,8,9,10,11,12]),import.meta.url),`component`)}),Lc=Js(`/_console/workflows_/$workflowId`)({validateSearch:e=>({selected:typeof e.selected==`string`&&e.selected?e.selected:void 0}),component:Ys(()=>wc(()=>import(`./_console.workflows_._workflowId-BeezXsKr.js`),__vite__mapDeps([24,2,1,3,22,6,11,12,5,7,8,9,10]),import.meta.url),`component`)}),Rc=bc.update({id:`/`,path:`/`,getParentRoute:()=>_c}),U=Tc.update({id:`/_console`,getParentRoute:()=>_c}),zc=Ec.update({id:`/jobs`,path:`/jobs`,getParentRoute:()=>U}),Bc=kc.update({id:`/overview`,path:`/overview`,getParentRoute:()=>U}),Vc=Ac.update({id:`/periodic`,path:`/periodic`,getParentRoute:()=>U}),Hc=jc.update({id:`/quarantine`,path:`/quarantine`,getParentRoute:()=>U}),Uc=Mc.update({id:`/queues`,path:`/queues`,getParentRoute:()=>U}),Wc=Nc.update({id:`/rate-classes`,path:`/rate-classes`,getParentRoute:()=>U}),Gc=Pc.update({id:`/workers`,path:`/workers`,getParentRoute:()=>U}),Kc=Fc.update({id:`/workflows`,path:`/workflows`,getParentRoute:()=>U}),qc=Ic.update({id:`/$jobId`,path:`/$jobId`,getParentRoute:()=>zc}),Jc=Lc.update({id:`/workflows_/$workflowId`,path:`/workflows/$workflowId`,getParentRoute:()=>U}),Yc={ConsoleJobsJobIdRoute:qc},Xc={ConsoleJobsRoute:zc._addFileChildren(Yc),ConsoleOverviewRoute:Bc,ConsolePeriodicRoute:Vc,ConsoleQuarantineRoute:Hc,ConsoleQueuesRoute:Uc,ConsoleRateClassesRoute:Wc,ConsoleWorkersRoute:Gc,ConsoleWorkflowsRoute:Kc,ConsoleWorkflowsWorkflowIdRoute:Jc},Zc={IndexRoute:Rc,ConsoleRoute:U._addFileChildren(Xc)},Qc=_c._addFileChildren(Zc);function $c(){return tc({defaultPreload:`intent`,routeTree:Qc,scrollRestoration:!0})}async function el(){let e=await $c(),t=[];return window.__TSS_START_OPTIONS__={serializationAdapters:t},t.push(hs),e.options.serializationAdapters&&t.push(...e.options.serializationAdapters),e.update({basepath:`.`,serializationAdapters:t}),e.stores.ids.get().length||await Hn(e),e}var tl=el;function nl(){return tl().finally(()=>window.$_TSR?.h())}var rl;function il(){return rl||=nl(),(0,B.jsx)(vs,{promise:rl,children:e=>(0,B.jsx)(ic,{router:e})})}var al=He();(0,gs.startTransition)(()=>{(0,al.hydrateRoot)(document,(0,B.jsx)(gs.StrictMode,{children:(0,B.jsx)(il,{})}))});export{kc as a,Hs as c,Ac as i,Ic as n,Ec as o,Fc as r,wc as s,Lc as t}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/index-D8-0FUBj.js b/go/headgateui/dist/assets/index-D8-0FUBj.js new file mode 100644 index 0000000..2450e17 --- /dev/null +++ b/go/headgateui/dist/assets/index-D8-0FUBj.js @@ -0,0 +1,12 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_console-0Rv7Ejka.js","./console-COYwGlau.js","./with-selector-hO0TNhHE.js","./theme-CN9-NrCi.js","./_console.jobs-CcQsOwUN.js","./jobs-DEyFN2Bl.js","./workflow-DSGFLdZh.js","./table-DtWJ0yY1.js","./radio-DTs_-itw.js","./clock-3-CBdsf5xL.js","./action-button-DKldNPQD.js","./play-B9gqZXeA.js","./progress-DIxv1Q_r.js","./relative-time-Bzc3eil5.js","./_console.overview-Q11CjhGH.js","./chart-QZj6B7U2.js","./value-8xOwwyZS.js","./_console.periodic-DY9l1h41.js","./_console.quarantine-CeEEGrSn.js","./_console.queues-vpWNbWgx.js","./_console.rate-classes-DhgcFmCM.js","./_console.workers-D-RyPU07.js","./_console.workflows-De2OTveu.js","./workflows-Ci3f-4XF.js","./_console.jobs._jobId-w2X4oppA.js","./_console.workflows_._workflowId-DZZPa3z2.js"])))=>i.map(i=>d[i]); +import{a as e,c as t,i as n,o as r,r as i,s as a,u as o}from"./with-selector-hO0TNhHE.js";import{$n as s,Ar as c,Bn as l,Cn as u,Cr as d,Dn as f,Dr as p,Er as m,Gn as h,Jn as g,Ln as _,Mn as v,Mr as y,Nn as b,Nr as x,On as S,Or as ee,Pn as te,Qn as ne,Sn as re,Sr as ie,Tn as ae,Tr as oe,Un as se,Xn as ce,Yn as le,_r as ue,a as de,ar as C,bn as w,br as fe,cr as pe,dr as me,er as he,fr as T,gr as E,hr as ge,ir as _e,jn as ve,jr as ye,kn as be,kr as xe,l as Se,lr as Ce,mr as we,nr as Te,or as Ee,pr as De,qn as Oe,rr as ke,sr as Ae,tr as je,ur as Me,vn as Ne,vr as Pe,wn as Fe,wr as Ie,xr as Le,yr as Re}from"./theme-CN9-NrCi.js";var ze=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,ae());else{var t=n(l);t!==null&&ce(x,t.startTime-e)}}}var S=!1,ee=-1,te=5,ne=-1;function re(){return g?!0:!(e.unstable_now()-net&&re());){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():S=!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){ee=_(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(ee),ee=-1):h=!0,ce(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,ae()))),r},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Be=t(((e,t)=>{t.exports=ze()})),Ve=t((e=>{var t=Be(),n=a(),i=r();function o(e){var t=`https://react.dev/errors/`+e;if(1me||(e.current=pe[me],pe[me]=null,me--)}function E(e,t){me++,pe[me]=e.current,e.current=t}var ge=he(null),_e=he(null),ve=he(null),ye=he(null);function be(e,t){switch(E(ve,t),E(_e,e),E(ge,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}T(ge),E(ge,e)}function xe(){T(ge),T(_e),T(ve)}function Se(e){e.memoizedState!==null&&E(ye,e);var t=ge.current,n=Hd(t,e.type);t!==n&&(E(_e,e),E(ge,n))}function Ce(e){_e.current===e&&(T(ge),T(_e)),ye.current===e&&(T(ye),Qf._currentValue=fe)}var we,Te;function Ee(e){if(we===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);we=t&&t[1]||``,Te=-1)`:-1i||c[r]!==l[i]){var u=` +`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{De=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ee(n):``}function ke(e,t){switch(e.tag){case 26:case 27:case 5:return Ee(e.type);case 16:return Ee(`Lazy`);case 13:return e.child!==t&&t!==null?Ee(`Suspense Fallback`):Ee(`Suspense`);case 19:return Ee(`SuspenseList`);case 0:case 15:return Oe(e.type,!1);case 11:return Oe(e.type.render,!1);case 1:return Oe(e.type,!0);case 31:return Ee(`Activity`);default:return``}}function Ae(e){try{var t=``,n=null;do t+=ke(e,n),n=e,e=e.return;while(e);return t}catch(e){return` +Error generating stack: `+e.message+` +`+e.stack}}var je=Object.prototype.hasOwnProperty,Me=t.unstable_scheduleCallback,Ne=t.unstable_cancelCallback,Pe=t.unstable_shouldYield,Fe=t.unstable_requestPaint,Ie=t.unstable_now,Le=t.unstable_getCurrentPriorityLevel,Re=t.unstable_ImmediatePriority,ze=t.unstable_UserBlockingPriority,Ve=t.unstable_NormalPriority,He=t.unstable_LowPriority,Ue=t.unstable_IdlePriority,We=t.log,Ge=t.unstable_setDisableYieldValue,Ke=null,qe=null;function Je(e){if(typeof We==`function`&&Ge(e),qe&&typeof qe.setStrictMode==`function`)try{qe.setStrictMode(Ke,e)}catch{}}var Ye=Math.clz32?Math.clz32:Qe,Xe=Math.log,Ze=Math.LN2;function Qe(e){return e>>>=0,e===0?32:31-(Xe(e)/Ze|0)|0}var $e=256,et=262144,tt=4194304;function nt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function rt(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=nt(n))):i=nt(o):i=nt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=nt(n))):i=nt(o)):i=nt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function it(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function at(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ot(){var e=tt;return tt<<=1,!(tt&62914560)&&(tt=4194304),e}function st(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ct(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function lt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),xn=!1;if(bn)try{var Sn={};Object.defineProperty(Sn,"passive",{get:function(){xn=!0}}),window.addEventListener(`test`,Sn,Sn),window.removeEventListener(`test`,Sn,Sn)}catch{xn=!1}var Cn=null,wn=null,Tn=null;function En(){if(Tn)return Tn;var e,t=wn,n=t.length,r,i=`value`in Cn?Cn.value:Cn.textContent,a=i.length;for(e=0;e=ir),sr=` `,cr=!1;function lr(e,t){switch(e){case`keyup`:return nr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function ur(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var dr=!1;function fr(e,t){switch(e){case`compositionend`:return ur(t);case`keypress`:return t.which===32?(cr=!0,sr):null;case`textInput`:return e=t.data,e===sr&&cr?null:e;default:return null}}function pr(e,t){if(dr)return e===`compositionend`||!rr&&lr(e,t)?(e=En(),Tn=wn=Cn=null,dr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Pr(n)}}function Ir(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ir(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Lr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Jt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Jt(e.document)}return t}function Rr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var zr=bn&&`documentMode`in document&&11>=document.documentMode,Br=null,Vr=null,Hr=null,Ur=!1;function Wr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ur||Br==null||Br!==Jt(r)||(r=Br,`selectionStart`in r&&Rr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Hr&&Nr(Hr,r)||(Hr=r,r=Ed(Vr,`onSelect`),0>=o,i-=o,Fi=1<<32-Ye(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),j&&Li(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=a(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),j&&Li(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return j&&Li(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),j&&Li(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===v&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case g:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===v){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===ie&&Pa(l)===r.type){n(e,r.sibling),c=i(r,a.props),Va(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===v?(c=Si(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=xi(a.type,a.key,a.props,null,e.mode,c),Va(c,a),c.return=e,e=c)}return s(e);case _:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Ti(a,e.mode,c),c.return=e,e=c}return s(e);case ie:return a=Pa(a),b(e,r,a,c)}if(de(a))return h(e,r,a,c);if(ce(a)){if(l=ce(a),typeof l!=`function`)throw Error(o(150));return a=l.call(a),y(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,Ba(a),c);if(a.$$typeof===S)return b(e,r,ua(e,a),c);Ha(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=Ci(a,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{za=0;var i=b(e,t,n,r);return Ra=null,i}catch(t){if(t===Oa||t===Aa)throw t;var a=_i(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var P=Ua(!0),Wa=Ua(!1),Ga=!1;function Ka(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ja(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ya(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,G&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=mi(e),pi(e,null,n),t}return ui(e,r,t,n),mi(e)}function Xa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,dt(e,n)}}function Za(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Qa=!1;function $a(){if(Qa){var e=ba;if(e!==null)throw e}}function eo(e,t,n,r){Qa=!1;var i=e.updateQueue;Ga=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(J&f)===f:(r&f)===f){f!==0&&f===ya&&(Qa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Ga=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Gl|=o,e.lanes=o,e.memoizedState=d}}function to(e,t){if(typeof e!=`function`)throw Error(o(191,e));e.call(t)}function no(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=C.T,s={};C.T=s,Is(e,!1,t,n);try{var c=i(),l=C.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Fs(e,t,Ca(c,r),pu(e)):Fs(e,t,r,pu(e))}catch(n){Fs(e,t,{then:function(){},status:`rejected`,reason:n},pu())}finally{w.p=a,o!==null&&s.types!==null&&(o.types=s.types),C.T=o}}function Ts(){}function Es(e,t,n,r){if(e.tag!==5)throw Error(o(476));var i=Ds(e).queue;ws(e,i,t,fe,n===null?Ts:function(){return Os(e),n(r)})}function Ds(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:fe,baseState:fe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:fe},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Os(e){var t=Ds(e);t.next===null&&(t=e.alternate.memoizedState),Fs(e,t.next.queue,{},pu())}function ks(){return la(Qf)}function As(){return z().memoizedState}function js(){return z().memoizedState}function Ms(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=pu();e=Ja(n);var r=Ya(t,e,n);r!==null&&(hu(r,t,n),Xa(r,t,n)),t={cache:ha()},e.payload=t;return}t=t.return}}function Ns(e,t,n){var r=pu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ls(e)?Rs(t,n):(n=di(e,t,n,r),n!==null&&(hu(n,e,r),zs(n,t,r)))}function Ps(e,t,n){Fs(e,t,n,pu())}function Fs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ls(e))Rs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Mr(s,o))return ui(e,t,i,0),K===null&&li(),!1}catch{}if(n=di(e,t,i,r),n!==null)return hu(n,e,r),zs(n,t,r),!0}return!1}function Is(e,t,n,r){if(r={lane:2,revertLane:dd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ls(e)){if(t)throw Error(o(479))}else t=di(e,n,r,2),t!==null&&hu(t,e,2)}function Ls(e){var t=e.alternate;return e===F||t!==null&&t===F}function Rs(e,t){xo=bo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function zs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,dt(e,n)}}var Bs={readContext:la,use:Lo,useCallback:R,useContext:R,useEffect:R,useImperativeHandle:R,useLayoutEffect:R,useInsertionEffect:R,useMemo:R,useReducer:R,useRef:R,useState:R,useDebugValue:R,useDeferredValue:R,useTransition:R,useSyncExternalStore:R,useId:R,useHostTransitionStatus:R,useFormState:R,useActionState:R,useOptimistic:R,useMemoCache:R,useCacheRefresh:R};Bs.useEffectEvent=R;var Vs={readContext:la,use:Lo,useCallback:function(e,t){return Po().memoizedState=[e,t===void 0?null:t],e},useContext:la,useEffect:ps,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ds(4194308,4,vs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ds(4194308,4,e,t)},useInsertionEffect:function(e,t){ds(4,2,e,t)},useMemo:function(e,t){var n=Po();t=t===void 0?null:t;var r=e();if(So){Je(!0);try{e()}finally{Je(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Po();if(n!==void 0){var i=n(t);if(So){Je(!0);try{n(t)}finally{Je(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ns.bind(null,F,e),[r.memoizedState,e]},useRef:function(e){var t=Po();return e={current:e},t.memoizedState=e},useState:function(e){e=Yo(e);var t=e.queue,n=Ps.bind(null,F,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:V,useDeferredValue:function(e,t){return Ss(Po(),e,t)},useTransition:function(){var e=Yo(!1);return e=ws.bind(null,F,e.queue,!0,!1),Po().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=F,i=Po();if(j){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),K===null)throw Error(o(349));J&127||Wo(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,ps(Ko.bind(null,r,a,e),[e]),r.flags|=2048,ls(9,{destroy:void 0},Go.bind(null,r,a,n,t),null),n},useId:function(){var e=Po(),t=K.identifierPrefix;if(j){var n=Ii,r=Fi;n=(r&~(1<<32-Ye(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=L++,0<\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}a[vt]=t,a[yt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)a.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=a;a:switch(Pd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Pc(t)}}return U(t),Fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(o(166));if(e=ve.current,Yi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Hi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[vt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Md(e.nodeValue,n)),e||Ki(t,!0)}else e=Bd(e).createTextNode(r),e[vt]=t,t.stateNode=e}return U(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Yi(t),n!==null){if(e===null){if(!r)throw Error(o(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(557));e[vt]=t}else Xi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;U(t),e=!1}else n=Zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ho(t),t):(ho(t),null);if(t.flags&128)throw Error(o(558))}return U(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Yi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(o(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(o(317));i[vt]=t}else Xi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;U(t),i=!1}else i=Zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(ho(t),t):(ho(t),null)}return ho(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Lc(t,t.updateQueue),U(t),null);case 4:return xe(),e===null&&Sd(t.stateNode.containerInfo),U(t),null;case 10:return ra(t.type),U(t),null;case 19:if(T(go),r=t.memoizedState,r===null)return U(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)Rc(r,!1);else{if(X!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=_o(e),a!==null){for(t.flags|=128,Rc(r,!1),e=a.updateQueue,t.updateQueue=e,Lc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)bi(n,e),n=n.sibling;return E(go,go.current&1|2),j&&Li(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ie()>tu&&(t.flags|=128,i=!0,Rc(r,!1),t.lanes=4194304)}}else{if(!i){if(e=_o(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Lc(t,e),Rc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!j)return U(t),null}else 2*Ie()-r.renderingStartTime>tu&&n!==536870912&&(t.flags|=128,i=!0,Rc(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(U(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ie(),e.sibling=null,n=go.current,E(go,i?n&1|2:n&1),j&&Li(t,r.treeForkCount),e);case 22:case 23:return ho(t),so(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(U(t),t.subtreeFlags&6&&(t.flags|=8192)):U(t),n=t.updateQueue,n!==null&&Lc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&T(N),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ra(M),U(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Bc(e,t){switch(Bi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ra(M),xe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ce(t),null;case 31:if(t.memoizedState!==null){if(ho(t),t.alternate===null)throw Error(o(340));Xi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ho(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Xi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return T(go),null;case 4:return xe(),null;case 10:return ra(t.type),null;case 22:case 23:return ho(t),so(),e!==null&&T(N),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ra(M),null;case 25:return null;default:return null}}function Vc(e,t){switch(Bi(t),t.tag){case 3:ra(M),xe();break;case 26:case 27:case 5:Ce(t);break;case 4:xe();break;case 31:t.memoizedState!==null&&ho(t);break;case 13:ho(t);break;case 19:T(go);break;case 10:ra(t.type);break;case 22:case 23:ho(t),so(),e!==null&&T(N);break;case 24:ra(M)}}function Hc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Z(t,t.return,e)}}function Uc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Z(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Z(t,t.return,e)}}function Wc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{no(t,n)}catch(t){Z(e,e.return,t)}}}function Gc(e,t,n){n.props=Js(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Z(e,t,n)}}function Kc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Z(e,t,n)}}function qc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Z(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Z(e,t,n)}else n.current=null}}function Jc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Z(e,e.return,t)}}function Yc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[yt]=t}catch(t){Z(e,e.return,t)}}function Xc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Zc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Xc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=fn));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function $c(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function el(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[vt]=e,t[yt]=n}catch(t){Z(e,e.return,t)}}var tl=!1,nl=!1,rl=!1,il=typeof WeakSet==`function`?WeakSet:Set,al=null;function ol(e,t){if(e=e.containerInfo,Rd=sp,e=Lr(e),Rr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==a||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===a&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,al=t;al!==null;)if(t=al,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,al=e;else for(;al!==null;){switch(t=al,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Pd(a,r,n),a[vt]=e,jt(a),r=a;break a;case`link`:var s=Vf(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=Fr(s,h),v=Fr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,C.T=null,n=lu,lu=null;var a=au,s=su;if(iu=0,ou=au=null,su=0,G&6)throw Error(o(331));var c=G;if(G|=4,Fl(a.current),Dl(a,a.current,s,n),G=c,id(0,!1),qe&&typeof qe.onPostCommitFiberRoot==`function`)try{qe.onPostCommitFiberRoot(Ke,a)}catch{}return!0}finally{w.p=i,C.T=r,Vu(e,t)}}function Wu(e,t,n){t=Di(n,t),t=ec(e.stateNode,t,2),e=Ya(e,t,2),e!==null&&(ct(e,2),rd(e))}function Z(e,t,n){if(e.tag===3)Wu(e,e,n);else for(;t!==null;){if(t.tag===3){Wu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ru===null||!ru.has(r))){e=Di(n,e),n=tc(2),r=Ya(t,n,2),r!==null&&(nc(n,r,t,e),ct(r,2),rd(r));break}}t=t.return}}function Gu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new zl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ul=!0,i.add(n),e=Ku.bind(null,e,t,n),t.then(e,e))}function Ku(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,K===e&&(J&n)===n&&(X===4||X===3&&(J&62914560)===J&&300>Ie()-$l?!(G&2)&&Su(e,0):ql|=n,Yl===J&&(Yl=0)),rd(e)}function qu(e,t){t===0&&(t=ot()),e=fi(e,t),e!==null&&(ct(e,t),rd(e))}function Ju(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qu(e,n)}function Yu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(o(314))}r!==null&&r.delete(t),qu(e,n)}function Xu(e,t){return Me(e,t)}var Zu=null,Qu=null,$u=!1,ed=!1,td=!1,nd=0;function rd(e){e!==Qu&&e.next===null&&(Qu===null?Zu=Qu=e:Qu=Qu.next=e),ed=!0,$u||($u=!0,ud())}function id(e,t){if(!td&&ed){td=!0;do for(var n=!1,r=Zu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ye(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ld(r,a))}else a=J,a=rt(r,r===K?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||it(r,a)||(n=!0,ld(r,a))}r=r.next}while(n);td=!1}}function ad(){od()}function od(){ed=$u=!1;var e=0;nd!==0&&Gd()&&(e=nd);for(var t=Ie(),n=null,r=Zu;r!==null;){var i=r.next,a=sd(r,t);a===0?(r.next=null,n===null?Zu=i:n.next=i,i===null&&(Qu=n)):(n=r,(e!==0||a&3)&&(ed=!0)),r=i}iu!==0&&iu!==5||id(e,!1),nd!==0&&(nd=0)}function sd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Xt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),jt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Xt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Xt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Xt(n.imageSizes)+`"]`)):i+=`[href="`+Xt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),jt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Xt(r)+`"][href="`+Xt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),jt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=At(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);jt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=At(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=m({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),jt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=At(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),jt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=ve.current)?gf(i):null;if(!i)throw Error(o(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=At(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var a=At(i).hoistableStyles,s=a.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,s),(a=i.querySelector(jf(e)))&&!a._p&&(s.instance=a,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),a||Nf(i,e,n,s.state))),t&&r===null)throw Error(o(528,``));return s}if(t&&r!==null)throw Error(o(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=At(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Af(e){return`href="`+Xt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),jt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Xt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Xt(n.href)+`"]`);if(r)return t.instance=r,jt(r),r;var i=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),jt(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var a=e.querySelector(jf(i));if(a)return t.state.loading|=4,t.instance=a,jt(a),a;r=Mf(n),(i=mf.get(i))&&Rf(r,i),a=(e.ownerDocument||e).createElement(`link`),jt(a);var s=a;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(a,`link`,r),t.state.loading|=4,Lf(a,n.precedence,e),t.instance=a;case`script`:return a=Pf(n.src),(i=e.querySelector(Ff(a)))?(t.instance=i,jt(i),i):(r=n,(i=mf.get(a))&&(r=m({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),jt(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(o(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,jt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),jt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Ve()})),Ue=`__TSS_CONTEXT`,We=Symbol.for(`TSS_SERVER_FUNCTION`),Ge=`application/x-tss-framed`,Ke={JSON:0,CHUNK:1,END:2,ERROR:3};`${Ge}`;var qe=/;\s*v=(\d+)/;function Je(e){let t=e.match(qe);return t?parseInt(t[1],10):void 0}function Ye(e){let t=Je(e);if(t!==void 0&&t!==1)throw Error(`Incompatible framed protocol version: server=${t}, client=1. Please ensure client and server are using compatible versions.`)}var Xe=()=>window.__TSS_START_OPTIONS__;function Ze(){try{return sessionStorage}catch{return}}var Qe=`tsr-scroll-restoration-v1_3`,$e=Ze();function et(){try{return JSON.parse($e?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function tt(){try{$e?.setItem(Qe,JSON.stringify(nt))}catch{}}var nt=et(),rt=`data-scroll-restoration-id`,it=e=>e.state.__TSR_key||e.href;function at(e){let t=e.getAttribute(rt);if(t)return`[${rt}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var ot=!1,st=`window`;function ct(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function lt(e){let t=new Set;for(let n of e){if(n===st)continue;let e=ct(n);e&&t.add(e)}return t}function ut(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||it,a=new Set,o=e=>{let t=nt[e]||={};for(let e of a)e===document?t[st]={scrollX,scrollY}:e.isConnected&&(t[at(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,ot=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{ot||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),tt()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=nt[d];if(e){let t=nt[u];for(let n in e){if(n===st){if(s)continue}else{let e=ct(n);if(!e||s&&o&&(l??=lt(o),l.has(e)))continue}t||=nt[u]={},t[n]??=e[n]}}}ot=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=lt(o));let t=e&&i&&c,s=r.restoring?nt[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===st){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=ct(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{ot=!1}}))}function dt(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function ft(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function pt(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=ft(r):Array.isArray(t)?t.push(ft(r)):n[e]=[t,ft(r)]}return n}var mt=/^(?:\s|["[{\d-]|fa|nu|tr)/,ht=_t(JSON.parse),gt=vt(JSON.stringify,JSON.parse);function _t(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=pt(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function vt(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!mt.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=dt(e,r);return t?`?${t}`:``}}function yt(e){if(e.statusCode=e.statusCode||e.code||307,!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function bt(e){return e instanceof Response&&!!e.options}function xt(e){if(typeof e==`object`&&e&&e.isSerializedRedirect)return yt(e)}function St(e){return e.replaceAll(`\0`,`/`).replaceAll(`�`,`/`).replace(/~([~0r])/g,(e,t)=>t===`0`?`\0`:t===`r`?`�`:t)}function Ct(e){return{input:({url:t})=>{for(let n of e)t=Tt(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Et(e[n],t);return t}}}function wt(e){let t=Me(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=pe([`/`,t,e.pathname]),e)}}function Tt(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Et(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Dt(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{ie(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var Ot=`__TSR_index`,kt=`popstate`,At=`beforeunload`;function jt(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=Ft(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[Ot];i=Mt(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[Ot];i=Mt(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[Ot]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Mt(e,t){t||={};let n=It();return{...t,key:n,__TSR_key:n,[Ot]:e}}function Nt(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>Ft(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=It();t.history.replaceState({[Ot]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(e,t,n)=>{let r=s(t),i=!!g;i||(u=l),l=Ft(t,n),g=[r,n,g?.[2]||e],i||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(f){f=!1;return}let e=c(),n=e.state[Ot]-l.state[Ot],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=jt({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(At,x,{capture:!0}),t.removeEventListener(kt,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(At,x,{capture:!0}),t.addEventListener(kt,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function Pt(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function Ft(e,t){let n=Pt(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=It();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[Ot]:0,key:a,__TSR_key:a}}}function It(){return(Math.random()+1).toString(36).substring(7)}function Lt(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Rt(e){return e instanceof Error?{name:e.name,message:e.message}:{data:e}}function zt(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Bt({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function Vt(e,t,n,r){for(let i of t){if(r&&e._tx!==r)return;n.some(e=>e.routeId===i.routeId)||e.routesById[i.routeId].options.onLeave?.(i)}for(let i of n){if(r&&e._tx!==r)return;e.routesById[i.routeId].options[t.some(e=>e.routeId===i.routeId)?`onStay`:`onEnter`]?.(i)}}var Ht=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Ee(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:Nt()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`,this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=Re(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Dt(this.latestLocation,e),ut(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=Me(a);t&&t!==`/`&&e.push(wt({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Ct(e),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Pe(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&ue(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:d(e).path,external:!1,searchStr:o,search:y(t?.search,i),hash:d(r.slice(1)).path,state:x(t?.state,a)}}let o=new URL(i,this.origin),s=Tt(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:d(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:y(t?.search,c),hash:d(s.hash.slice(1)).path,state:x(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>Ce({base:e,to:t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=ge(T(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{let t=(t={})=>{if(t.href){let e=Ft(t.href,{});t={...t,to:Tt(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let n=t._fromLocation||this._pendingLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r[1],a=r[2],o=r[3],s=this.resolvePathWithBase(i,t.to?`${t.to}`:`.`),c=Jt(t.params,o),l=this.routesByPath[T(s)],u;if(l)u=this.getRouteBranch(l);else if(s.includes(`$`))u=[];else{let[e,t,n]=this.getMatchedRoutes(s);u=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(u=[...u,this.options.notFoundRoute])}if(u.length&&ee(c))for(let e of u){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){c===o&&(c=Object.assign(Object.create(null),c));try{Object.assign(c,t(c))}catch{}}}let f=e.leaveParams?s:d(Ae({path:s,params:c,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,m=a;if(e._includeValidateSearch&&this.options.search?.strict){let e={};u.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Gt(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=Kt(m,t,u,e._includeValidateSearch),m=y(a,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?p(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?p(t.state,n.state):{};t.state&&(v=x(n.state,v));let b=`${f}${h}${_}`,S,te,ne=!1;if(this.rewrite){let e=new URL(b,this.origin),t=Et(this.rewrite,e);S=e.href.replace(e.origin,``),t.origin===this.origin?te=t.pathname+t.search+t.hash:(te=t.href,ne=!0)}else S=oe(b),te=S;return{publicHref:te,href:S,pathname:f,search:m,searchStr:h,state:v,hash:g??``,external:ne,unmaskOnReload:t.unmaskOnReload}},n=t(e);if(e.mask)n.maskedLocation=t({from:e.from,...e.mask});else if(this.options.routeMasks){let r=we(n.pathname,this.processedTree);if(r){let i=Object.assign(Object.create(null),r.rawParams),{from:a,params:o,...s}=r.route,c=Jt(o,i);n.maskedLocation=t({from:e.from,...s,params:c})}}return n},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=T(this.latestLocation.href)===T(n.href)&&Ie(Bt(n.state),Bt(this.latestLocation.state)),a=this._commitPromise,o,s=new Promise(e=>{o=e});if(s.resolve=()=>{o(),a?.resolve()},this._commitPromise=s,i)this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:r}})}return this._scroll.next=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(xe(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.hash=e.action.type===`PUSH`||e.action.type===`REPLACE`),await Bn(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(zt(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set([...t,...this._cache.values(),...[...r?.values()??[]].flat(),...this._tx?.[3]??[]].filter(e=>!n||n(e)).map(e=>e.id)),a=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),a.push(e));let o=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&Lt(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(o);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i)this._flights?.delete(e);for(let e of a)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href){let t=this.buildLocation(e.options).publicHref||`/`;e.options.href=t,e.headers.set(`Location`,t)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&xe(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=Qt,this.preloadRoute=e=>Vn(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=E(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!Ie(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?Ie(a.search,r.search,{partial:!0})?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??gt,parseSearch:e.parseSearch??ht,protocolAllowlist:e.protocolAllowlist??Le}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=De(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:T(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?qt(this.options.notFoundMode,a):void 0,c=Array(a.length),l=this._committed,u=(e,t)=>{let n=l[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?l.find(t=>t.routeId===e.id):void 0},d;for(let n=0;n{let r=n(t.preSearchFilters?t.preSearchFilters.reduce((e,t)=>t(e),e):e);return t.postSearchFilters?t.postSearchFilters.reduce((e,t)=>t(e),r):r});let n=t.validateSearch;r&&n&&i.push(({search:e,next:t,meta:r})=>{let i=t(e);try{let e=Gt(n,i);if(r&&e)for(let t in e)t in i||(r.defaulted||=new Map).set(t,e[t]);return{...i,...e}}catch{}return i})}let a=(e,n,r)=>{if(e>=i.length){if(!t.search)return{};if(t.search===!0)return n;let e=p(t.search,n);return r&&(r.explicit=e),e}return i[e]({search:n,next:(t,n)=>{if(n){let n=r||{};return{search:a(e+1,t,n),meta:n}}return a(e+1,t,r)},meta:r})};return a(0,e)}function qt(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return _e}function Jt(e,t){if(e===!1||e===null)return Object.create(null);if((e??!0)===!0)return t;let n=Object.assign(Object.create(null),t);return Object.assign(n,p(e,n))}function Yt(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function Xt(e,t){return e.options[t]?.preload?.()}function Zt(e,t){let n=Xt(e,`component`),r=Xt(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function Qt(e,t,n){let r=()=>t===!1?void 0:t?Xt(e,t):Zt(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function $t(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).finally(()=>t.removeEventListener(`abort`,i))})}function ln(e,t){return e.routesById[t.routeId]}function un(e,t,n){return bt(e)?[an,e]:C(e)?(e.routeId||=n,[rn,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[nn,e]):[tn,e]}function dn(e,t){let n=un(t,!0,e.id);if(n[0]!==nn)return n;try{e.options.onError?.(n[1])}catch(t){n=un(t,!0,e.id)}return n}function fn(e,t,n,r,i){return i[0].signal.aborted?on:Dn(e,t,n,dn(n,r),i)}async function pn(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;ie.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return hn(e,r),[i,fn(e,t,u,a,n)]}if(c.aborted)return[i,on];let p=r.paramsError??r.searchError;if(p!==void 0)return hn(e,r),[i,fn(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{_n(e,r,`beforeLoad`,n[0]);let a=await cn(m({...f,search:r.search,context:r.context,...e.options.additionalContext}),c);if(c.aborted)return[i,on];let o=Dn(e,t,u,un(a,!1,u.id),n);if(o[0]!==tn)return hn(e,r),[i,o];r.context={...r.context,...a}}catch(a){return hn(e,r),[i,fn(e,t,u,a,n)]}finally{r.status=h,_n(e,r,!1,n[0])}}i()}function mn(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function hn(e,t){let n=t._flight;t._flight=void 0,mn(e,t,n)?.abort()}function D(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=mn(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function gn(e){for(let t of e){let e=t._flight;e&&e[2]++}}function _n(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function vn(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation:s}),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function yn(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return on;if(!i)return[tn,void 0];let l=n._flight;_n(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(vn(e,t,n,r,s,a,!!o[3]))).then(e=>un(e,!1,r.id),e=>un(e,!0,r.id)).then(t=>(t[0]!==tn&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===nn&&l[2]?dn(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Dn(e,t,r,await cn(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return hn(e,n),on}finally{_n(e,n,!1,s)}}function bn(e,t,n){t[0]!==an&&(e.status=`success`,e.error=void 0,t[0]===tn?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function xn(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&hn(e,r)}function Sn(e,t){return t[0]===nn||t[0]===rn?{...e,status:t[0]===nn?`error`:`notFound`,error:t[1],_flight:void 0}:e}function Cn(e,t,n,r,i,a,o){let s=t[1][n],c=ln(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(vn(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=on)),!p){if(s.status!==`success`)f=!0;else{let t=l||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,hn(e,s),p=fn(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!!(m&&f&&s.status===`success`&&!l&&!a[4]&&((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)!==`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),S=n>=o?a[7]:void 0,ee=c.lazyFn&&c._lazy!==!0?S:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,mn(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let te=(p?Promise.resolve(p):x?yn(e,t,s,c,g,i,a):Promise.resolve([tn,s.loaderData])).then(t=>(x&&(bn(s,t,l),t[0]===tn&&(m&&!a[0].signal.aborted&&xn(e,s,u),n>=o&&(s.status=`pending`))),t)),ne=cn(Promise.resolve().then(()=>Qt(c,void 0,ee)),a[0].signal).then(()=>void 0,r=>t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound))?void 0:[n,fn(e,t,c,r,a)]).then(e=>te.then(t=>(x&&!e&&t[0]===tn&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.()),e)));if(r.push([n,te,ne]),!y)return te.then(e=>Sn(s,e));let re={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let ie=yn(e,t,re,c,g,i,a).then(e=>(s.isFetching=!1,bn(re,e,!1),e));return(t[2]??=[]).push([n,ie,ne,re]),ie.then(e=>Sn(re,e))}async function wn(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=ln(e,t[n]);try{let e=Qt(i,!1);e&&await cn(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function Tn(e,t){t[2]&&=(D(e,t[2].map(e=>e[3])),void 0)}async function En(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=an)throw[a,t];!i&&t[0]!==tn&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===an)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Dn(e,t,n,r,i,a){for(;r[0]===an;){let o=r[1],s=o.options;if(s.reloadDocument?i[3]:i[1]>=20)return r;try{return s.href&&s.reloadDocument?(e.resolveRedirect(o),r):[an,o,e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0})]}catch(e){r=a?[nn,e]:dn(n,e),a=!0}}return r}async function On(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===rn?wn(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=an)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==tn&&t[0]=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=an){let n=s[1];if(n[0]!==an||n[1].options.reloadDocument||n[2])return Tn(e,t),n;c=!0,s=[0,[nn,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===nn?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};p(),i||a?.();let m=ln(e,u);try{await cn(i?Promise.resolve().then(()=>Qt(m,l===nn?`errorComponent`:`notFoundComponent`)):Promise.all([Qt(m),Qt(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return Tn(e,t),on}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),Tn(e,t),D(e,o),p()):u.status=`success`}return t}async function kn(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;te._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await wn(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l{for(let t=d;t=an&&(c=0);p()}if(!a.aborted&&!r[3]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let h=On(e,i,u,r[0],En(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=En(i[2],void 0,void 0,h.then(e=>sn(e)?0:$t(n).length,()=>0))),o=await h}catch(t){if(Tn(e,i),t===a&&a.aborted)return on;throw t}return sn(o)?o:kn(e,o,a,r[6]===n.length?r[6]:0)}function jn(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a0){i[3]=setTimeout(()=>jn(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function Mn(e,t){let n=e._pending;(e._tx===t||!e._tx?.[3].some(e=>e.id===n?.[1]))&&(clearTimeout(n?.[3]),e._pending=void 0)}async function Nn(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!$t(t[3]).some(e=>e.id===n[1]))return;let i;try{await cn(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function Pn(e,t){e._committed=t,e.stores.setMatches(t)}function Fn(e,t,n,r){let i=e._committed,a=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let o=$t(n).length,s=new Map;{let t=Date.now();for(let r of[...i,...a.values()]){if(r.status!==`success`||n.some((e,t)=>e.id===r.id&&(t=(r.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||s.set(r.id,a.get(r.id)===r?r:{...r,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=s,Pn(e,n),D(e,[...a.values(),...i],[...n,...s.values()]),Vt(e,i,n,t)}async function In(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}function Ln(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:i.publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function Rn(e,t,n,r,i){let a=n.map(e=>({...e}));gn(a);for(let t of r)hn(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await On(e,o,r,t[0],i)}catch(t){throw D(e,a),t}if(sn(s)){D(e,a),s[0]===an&&e._tx===t&&e._committed===n&&await Ln(e,t,s);return}if(await kn(e,s,t[0].signal),e._tx!==t||e._committed!==n){D(e,a);return}for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),hn(e,n))}Pn(e,a),D(e,n,a)}async function zn(e,t,n,r,i,a){let o=await An(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(sn(o)){let n=o[0]===an&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Mn(e,t),D(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Mn(e,t);return}await Ln(e,t,o);return}let s=o[1];if(e._tx===t&&await Nn(e,t),e._tx!==t){Mn(e,t),D(e,s),Tn(e,o);return}let c=t[2],l=zt(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await Nn(e,t),e._tx!==t){Mn(e,t),D(e,s),Tn(e,o);return}let n=await e.startTransition(()=>{Mn(e,t),Fn(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);if(e._tx!==t){Tn(e,o);return}u?.length&&Rn(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function Bn(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),!u.signal.aborted){let t=zt(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await In(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});gn(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){D(e,m),await In(e,n);return}e._preflight=void 0;let g,_=()=>zn(e,y,f,()=>jn(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_).then(),y=[p,s,a,m,Date.now(),v];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&_n(e,t,!1)}n[0].abort(),D(e,n[3],y[3],!0)}if(e._tx!==y){D(e,y[3]),y[3]=[],g?.(),await In(e,y);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&jn(e,y),g?.(_()),await v,await In(e,y)}async function Vn(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),gn(a),o=(e._preloads??=new Map).set(i,a),s=await An(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),D(e,a)),i.abort()}if(!sn(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){C(e)||console.error(e);return}}}async function Hn(e){let t=window.$_TSR,n=e.options.serializationAdapters;n?.length&&(t.t=new Map(n.map(e=>[e.key,e.fromSerializable])),t.buffer.forEach(e=>e())),t.initialized=!0;let r=t.router;e.ssr={manifest:r.manifest},e.options.ssr={nonce:document.querySelector(`meta[property="csp-nonce"]`)?.content};let i=r.matches,a=new AbortController,o=e._preflight;e._preflight=a,o?.abort();let s=()=>e._preflight===a,c,l,u,d;try{if(await cn(e.options.hydrate?.(r.dehydratedData),a.signal),!s())return;let t=e.history.location;u=t.href,d=t.state,e.updateLatestLocation(),c=e.latestLocation,e.stores.location.set(c),l=e.matchRoutes(c,{_controller:a})}catch(t){if(s()&&(e._preflight=void 0),a.abort(t),t!==a.signal)throw t}if(!s())return;let f=[],p,m=0,h=t=>{m=Math.min(m,t+1);let n=f.splice(t);for(let t of n)ln(e,t).options.loader&&(t.status===`success`||!t.invalid&&`loaderData`in t)&&xn(e,{...t,status:`success`,error:void 0,preload:!0},e._cache.get(t.id));D(e,n)},g=i.length>l.length?l.findIndex(e=>e._notFound)+1:i.length,_=!1;for(let t=0;t{try{let n=ln(e,t);return await(t._notFound?Promise.all([Qt(n),Qt(n,`notFoundComponent`)]):Qt(n,t.status===`error`?`errorComponent`:t.status===`notFound`?`notFoundComponent`:void 0)),!0}catch{return!1}}),y=0;try{for(;ye.navigate({...t,_fromLocation:c}),buildLocation:e.buildLocation,cause:n.cause,abortController:a,preload:!1,matches:l,routeId:r.id})||{}}catch{if(!s())return;if(n.status!==`error`&&n.status!==`notFound`&&!n._notFound){p=Math.min(p??t,t),h(t);break}}if(!s())return}n.context={...o,...u,...f[t]&&i[t].b}}if(await kn(e,[c,l],a.signal,0,m),!s())return;let x=p!==void 0||f.lengthp+1?m:void 0,ee=ee.slice(),ee[p]={...e,status:`pending`,ssr:e.ssr===`data-only`&&`data-only`,_assetEnd:te}}let ne=()=>{let t=e.history.location;return x&&!e._tx&&t.href===u&&t.state===d&&e._committed===S&&S.length&&!a.signal.aborted?a:void 0},re=[ne,t=>{if(e._handoff!==re)return;e._handoff=void 0;let n=S.length;if(!t||!ne()||S.some((e,n)=>e.id!==t[n]?.id)){a.abort();return}let r=te;if(r!==void 0){for(let e=n;ep+1?e:void 0;break}}let i=S.map(e=>({...e}));r!==void 0&&(i[p]._assetEnd=r),D(e,t.splice(0,n,...i));for(let e=n;e{e.stores.setMatches(ee),e.stores.status.set(`idle`),x||e.stores.resolvedLocation.set(e.stores.location.get())})}var Un=Symbol.for(`TSR_DEFERRED_PROMISE`);function Wn(e,t){let n=e;return n[Un]?n:(n[Un]={status:`pending`},n.then(e=>{n[Un].status=`success`,n[Un].data=e}).catch(e=>{n[Un].status=`error`,n[Un].error={data:(t?.serializeError??Rt)(e),__isServerError:!0}}),n)}function Gn(e,t){if(e)return typeof e==`string`?e:e[t]}function Kn(e){return e?.scriptFormat??`module`}function qn(e,t,n){let r=Jn(t),i=Gn(n,`script`)??r.crossOrigin;return{...Kn(e)===`iife`?{rel:`preload`,as:`script`}:{rel:`modulepreload`},href:r.href,...i?{crossOrigin:i}:{}}}function Jn(e){return typeof e==`string`?{href:e,crossOrigin:void 0}:e}function Yn(e,t){if(t.length===0)return;if(t.length===1){e.push(t[0]);return}let n=new Set;for(let r of t){let t=JSON.stringify(r);n.has(t)||(n.add(t),e.push(r))}}function Xn(e){return typeof e==`string`?{href:e,crossOrigin:void 0}:e}var Zn=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=_e:this.parentRoute||fe();let r=n?_e:t?.path;r&&r!==`/`&&(r=me(r));let i=t?.id||r,a=n?_e:pe([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=pe([`/`,a]));let o=a===`__root__`?`/`:pe([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=T(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=>yt({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.`)}},Qn=class extends Zn{constructor(e){super(e)}},$n=Symbol.asyncIterator,er=Symbol.hasInstance,tr=Symbol.isConcatSpreadable,nr=Symbol.iterator,rr=Symbol.match,ir=Symbol.matchAll,ar=Symbol.replace,or=Symbol.search,sr=Symbol.species,cr=Symbol.split,lr=Symbol.toPrimitive,ur=Symbol.toStringTag,dr=Symbol.unscopables,fr={[$n]:0,[er]:1,[tr]:2,[nr]:3,[rr]:4,[ir]:5,[ar]:6,[or]:7,[sr]:8,[cr]:9,[lr]:10,[ur]:11,[dr]:12},pr={0:$n,1:er,2:tr,3:nr,4:rr,5:ir,6:ar,7:or,8:sr,9:cr,10:lr,11:ur,12:dr},mr={2:!0,3:!1,1:void 0,0:null,4:-0,5:1/0,6:-1/0,7:NaN},hr={0:`Error`,1:`EvalError`,2:`RangeError`,3:`ReferenceError`,4:`SyntaxError`,5:`TypeError`,6:`URIError`},gr={0:Error,1:EvalError,2:RangeError,3:ReferenceError,4:SyntaxError,5:TypeError,6:URIError};function O(e,t,n,r,i,a,o,s,c,l,u,d){return{t:e,i:t,s:n,c:r,m:i,p:a,e:o,a:s,f:c,b:l,o:u,l:d}}function _r(e){return O(2,void 0,e,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)}var vr=_r(2),yr=_r(3),br=_r(1),xr=_r(0),Sr=_r(4),Cr=_r(5),wr=_r(6),Tr=_r(7);function Er(e){switch(e){case`"`:return`\\"`;case`\\`:return`\\\\`;case` +`:return`\\n`;case`\r`:return`\\r`;case`\b`:return`\\b`;case` `:return`\\t`;case`\f`:return`\\f`;case`<`:return`\\x3C`;case`\u2028`:return`\\u2028`;case`\u2029`:return`\\u2029`;default:return}}function Dr(e){let t=``,n=0,r;for(let i=0,a=e.length;iMr(e),Pr=class extends Error{constructor(e,t){super(Nr(e,t)),this.cause=t}},Fr=class extends Pr{constructor(e){super(`parsing`,e)}},Ir=class extends Pr{constructor(e){super(`deserialization`,e)}};function Lr(e){return`Seroval Error (specific: ${e})`}var Rr=class extends Error{constructor(e){super(Lr(1)),this.value=e}},zr=class extends Error{constructor(e){super(Lr(2))}},Br=class extends Error{constructor(e){super(Lr(3))}},Vr=class extends Error{constructor(e){super(Lr(4))}},Hr=class extends Error{constructor(e){super(Lr(5)),this.value=e}},Ur=class extends Error{constructor(e){super(Lr(6))}},Wr=class extends Error{constructor(e){super(Lr(7))}},k=class extends Error{constructor(e){super(Lr(8))}},Gr=class extends Error{constructor(e){super(Lr(9))}},Kr=`__SEROVAL_REFS__`,qr=new Map,Jr=new Map;function Yr(e){return qr.has(e)}function Xr(e){return Jr.has(e)}function Zr(e){if(Yr(e))return qr.get(e);throw new Hr(e)}function Qr(e){if(Xr(e))return Jr.get(e);throw new Ur(e)}typeof globalThis<`u`?Object.defineProperty(globalThis,Kr,{value:Jr,configurable:!0,writable:!1,enumerable:!1}):typeof window<`u`?Object.defineProperty(window,Kr,{value:Jr,configurable:!0,writable:!1,enumerable:!1}):typeof self<`u`?Object.defineProperty(self,Kr,{value:Jr,configurable:!0,writable:!1,enumerable:!1}):typeof global<`u`&&Object.defineProperty(global,Kr,{value:Jr,configurable:!0,writable:!1,enumerable:!1});function $r(e){return e instanceof EvalError?1:e instanceof RangeError?2:e instanceof ReferenceError?3:e instanceof SyntaxError?4:e instanceof TypeError?5:e instanceof URIError?6:0}function ei(e){let t=hr[$r(e)];return e.name===t?e.constructor.name===t?{}:{name:e.constructor.name}:{name:e.name}}function ti(e,t){let n=ei(e),r=Object.getOwnPropertyNames(e);for(let i=0,a=r.length,o;ihi)throw new Rr(t);return O(15,e,void 0,t.constructor.name,void 0,void 0,void 0,void 0,n,t.byteOffset,void 0,t.length)}function _i(e,t,n){if(t.length>hi)throw new Rr(t);return O(16,e,void 0,t.constructor.name,void 0,void 0,void 0,void 0,n,t.byteOffset,void 0,t.length)}function vi(e,t,n){if(t.byteLength>hi)throw new Rr(t);return O(20,e,void 0,void 0,void 0,void 0,void 0,void 0,n,t.byteOffset,void 0,t.byteLength)}function yi(e,t,n){return O(13,e,$r(t),void 0,Dr(t.message),n,void 0,void 0,void 0,void 0,void 0,void 0)}function bi(e,t,n){return O(14,e,$r(t),void 0,Dr(t.message),n,void 0,void 0,void 0,void 0,void 0,void 0)}function xi(e,t){return O(7,e,void 0,void 0,void 0,void 0,void 0,t,void 0,void 0,void 0,void 0)}function Si(e,t){return O(28,void 0,void 0,void 0,void 0,void 0,void 0,[e,t],void 0,void 0,void 0,void 0)}function Ci(e,t){return O(30,void 0,void 0,void 0,void 0,void 0,void 0,[e,t],void 0,void 0,void 0,void 0)}function wi(e,t,n){return O(31,e,void 0,void 0,void 0,void 0,void 0,n,t,void 0,void 0,void 0)}function Ti(e,t){return O(32,e,void 0,void 0,void 0,void 0,void 0,void 0,t,void 0,void 0,void 0)}function Ei(e,t){return O(33,e,void 0,void 0,void 0,void 0,void 0,void 0,t,void 0,void 0,void 0)}function Di(e,t){return O(34,e,void 0,void 0,void 0,void 0,void 0,void 0,t,void 0,void 0,void 0)}function Oi(e,t,n,r){return O(35,e,n,void 0,void 0,void 0,void 0,t,void 0,void 0,void 0,r)}var ki=class{constructor(e,t){this.value=e,this.replacement=t}},Ai=()=>{let e={p:0,s:0,f:0};return e.p=new Promise((t,n)=>{e.s=t,e.f=n}),e},ji=()=>{let e=[],t=[],n=!0,r=!1,i=0,a={flush(e,n,r){for(r=0;r{n&&(t[r]=t[i],t[i--]=void 0)}}};return{__SEROVAL_STREAM__:!0,on(e){return a.on(e)},next(t){n&&(e.push(t),a.flush(t,`next`))},throw(i){n&&(e.push(i),a.flush(i,`throw`),n=!1,r=!1,t.length=0)},return(i){n&&(e.push(i),a.flush(i,`return`),n=!1,r=!0,t.length=0)}}},Mi=e=>t=>()=>{let n=0,r={[e](){return r},next(){if(n>t.d)return{done:!0,value:void 0};let e=n++,r=t.v[e];if(e===t.t)throw r;return{done:e===t.d,value:r}}};return r},Ni=(e,t)=>n=>()=>{let r=0,i=-1,a=!1,o=[],s=[],c={finalize(e=0,t=s.length){for(;e=o.length){let e=t();return s.push(e),e.p}return{done:!1,value:o[e]}}if(r>i)return{done:!0,value:void 0};let e=r++,n=o[e];if(e!==i)return{done:!1,value:n};if(a)throw n;return{done:!0,value:n}}};return l},Pi=e=>{let t=atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e{}),t}var Wi=Ni($n,Ai);function Gi(e){return Wi(e)}async function Ki(e){try{return[1,await e]}catch(e){return[0,e]}}function qi(e,t){return{plugins:t.plugins,mode:e,marked:new Set,features:127^(t.disabledFeatures||0),refs:t.refs||new Map,depthLimit:t.depthLimit||1e3}}function Ji(e,t){e.marked.add(t)}function Yi(e,t){let n=e.refs.size;return e.refs.set(t,n),n}function Xi(e,t){let n=e.refs.get(t);return n==null?{type:0,value:Yi(e,t)}:(Ji(e,n),{type:1,value:oi(n)})}function Zi(e,t){let n=Xi(e,t);return n.type===1?n:Yr(t)?{type:2,value:di(n.value,t)}:n}function Qi(e,t){let n=Zi(e,t);if(n.type!==0)return n.value;if(t in fr)return ui(n.value,t);throw new Rr(t)}function $i(e,t){let n=Xi(e,Hi[t]);return n.type===1?n.value:O(26,n.value,t,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)}function ea(e){let t=Xi(e,Bi);return t.type===1?t.value:O(27,t.value,void 0,void 0,void 0,void 0,void 0,void 0,Qi(e,nr),void 0,void 0,void 0)}function ta(e){let t=Xi(e,Vi);return t.type===1?t.value:O(29,t.value,void 0,void 0,void 0,void 0,void 0,[$i(e,1),Qi(e,$n)],void 0,void 0,void 0,void 0)}function na(e,t,n,r){return O(n?11:10,e,void 0,void 0,void 0,r,void 0,void 0,void 0,void 0,ni(t),void 0)}function ra(e,t,n,r){return O(8,t,void 0,void 0,void 0,void 0,{k:n,v:r},void 0,$i(e,0),void 0,void 0,void 0)}function ia(e,t,n){let r=new Uint8Array(n),i=``;for(let e=0,t=r.length;e{Ji(this.base,t),N(this,e,n).then(e=>{a.push(Ti(t,e))},e=>{i(e),o()})},throw:n=>{Ji(this.base,t),N(this,e,n).then(e=>{a.push(Ei(t,e)),r(a),o()},e=>{i(e),o()})},return:n=>{Ji(this.base,t),N(this,e,n).then(e=>{a.push(Di(t,e)),r(a),o()},e=>{i(e),o()})}})}async function xa(e,t,n,r){return wi(n,$i(e.base,4),await new Promise(ba.bind(e,t,n,r)))}async function Sa(e,t,n,r){let i=[];for(let n=0,a=r.v.length;n=e.base.depthLimit)throw new Gr(e.base.depthLimit);switch(typeof n){case`boolean`:return n?vr:yr;case`undefined`:return br;case`string`:return ii(n);case`number`:return ri(n);case`bigint`:return ai(n);case`object`:if(n){let r=Zi(e.base,n);return r.type===0?await Ca(e,t+1,r.value,n):r.value}return xr;case`symbol`:return Qi(e.base,n);case`function`:return wa(e,t,n);default:throw new Rr(n)}}async function Ta(e,t){try{return await N(e,0,t)}catch(e){throw e instanceof Fr?e:new Fr(e)}}function Ea(e){return e}function Da(e,t){for(let n=0,r=t.length;n0)for(let a=0,o=n.v,s=i.length;aPa)throw new k(t);return P(e,t.i,new RegExp(n,t.m))}throw new zr(t)}function no(e,t,n){let r=P(e,n.i,new Set);for(let i=0,a=n.a,o=a.length;iMa)throw new k(t);return P(e,t.i,Pi(kr(t.s)))}function ao(e,t,n){let r=ka(n.c),i=L(e,t,n.f);if(!(i instanceof ArrayBuffer))throw new k(n);let a=n.b??0;if(a<0||a>i.byteLength||n.l>Ma)throw new k(n);return P(e,n.i,new r(i,a,n.l))}function oo(e,t,n){let r=L(e,t,n.f);if(!(r instanceof ArrayBuffer))throw new k(n);let i=n.b??0;if(i<0||i>r.byteLength||n.l>Ma)throw new k(n);return P(e,n.i,new DataView(r,i,n.l))}function so(e,t,n,r){if(n.p){let i=Za(e,t,n.p,{});Object.defineProperties(r,Object.getOwnPropertyDescriptors(i))}return r}function co(e,t,n){return so(e,t,n,P(e,n.i,AggregateError([],kr(n.m))))}function lo(e,t,n){let r=Wa(n,gr,n.s);return so(e,t,n,P(e,n.i,new r(kr(n.m))))}function uo(e,t,n){let r=Ai(),i=P(e,n.i,r.p),a=L(e,t,n.f);if(Va(a))throw new k(n.f);return n.s?r.s(a):r.f(a),i}function fo(e,t,n){return P(e,n.i,Object(L(e,t,n.f)))}function po(e,t,n){let r=e.base.plugins;if(r){let i=kr(n.c);for(let a=0,o=r.length;ae.base.depthLimit)throw new Gr(e.base.depthLimit);switch(t+=1,n.t){case 2:return Wa(n,mr,n.s);case 0:return Number(n.s);case 1:return kr(String(n.s));case 3:if(String(n.s).length>Na)throw new k(n);return BigInt(n.s);case 4:return e.base.refs.get(n.i);case 18:return Ga(e,n);case 9:return Ka(e,t,n);case 10:case 11:return Qa(e,t,n);case 5:return $a(e,n);case 6:return to(e,n);case 7:return no(e,t,n);case 8:return ro(e,t,n);case 19:return io(e,n);case 16:case 15:return ao(e,t,n);case 20:return oo(e,t,n);case 14:return co(e,t,n);case 13:return lo(e,t,n);case 12:return uo(e,t,n);case 17:return Wa(n,pr,n.s);case 21:return fo(e,t,n);case 25:return po(e,t,n);case 22:return mo(e,n);case 23:case 24:return ho(e,t,n);case 28:return go(e,t,n);case 30:return _o(e,t,n);case 31:return vo(e,t,n);case 32:return F(e,t,n);case 33:return I(e,t,n);case 34:return yo(e,t,n);case 27:return bo(e,t,n);case 29:return xo(e,t,n);case 35:return So(e,t,n);case 36:return eo(e,n);default:throw new zr(n)}}function Co(e,t){try{return L(e,0,t)}catch(e){throw new Ir(e)}}function wo(e,t){return Co(Ra({plugins:Oa(t.plugins),refs:t.refs,features:t.features,disabledFeatures:t.disabledFeatures,depthLimit:t.depthLimit}),e)}async function To(e,t={}){let n=aa(1,{plugins:Oa(t.plugins),disabledFeatures:t.disabledFeatures});return{t:await Ta(n,e),f:n.base.features,m:Array.from(n.base.marked)}}function R(e){return e}function Eo(e){return Ea({tag:`$TSR/t/`+e.key,test:e.test,parse:{sync(t,n,r){return{v:n.parse(e.toSerializable(t))}},async async(t,n,r){return{v:await n.parse(e.toSerializable(t))}},stream(t,n,r){return{v:n.parse(e.toSerializable(t))}}},serialize:void 0,deserialize(t,n,r){return e.fromSerializable(n.deserialize(t.v))}})}var Do=class{constructor(e,t){this.stream=e,this.hint=t?.hint??`binary`}},Oo=globalThis.Buffer,ko=!!Oo&&typeof Oo.from==`function`;function Ao(e){if(e.length===0)return``;if(ko)return Oo.from(e).toString(`base64`);let t=32768,n=[];for(let r=0;rnew ReadableStream({start(t){e.on({next(e){try{t.enqueue(jo(e))}catch{}},throw(e){t.error(e)},return(){try{t.close()}catch{}}})}}),z=new TextEncoder,Fo=e=>new ReadableStream({start(t){e.on({next(e){try{typeof e==`string`?t.enqueue(z.encode(e)):t.enqueue(jo(e.$b64))}catch{}},throw(e){t.error(e)},return(){try{t.close()}catch{}}})}}),Io=`(s=>new ReadableStream({start(c){s.on({next(b){try{const d=atob(b),a=new Uint8Array(d.length);for(let i=0;i{const e=new TextEncoder();return new ReadableStream({start(c){s.on({next(v){try{if(typeof v==='string'){c.enqueue(e.encode(v))}else{const d=atob(v.$b64),a=new Uint8Array(d.length);for(let i=0;i{try{for(;;){let{done:e,value:r}=await n.read();if(e){t.return(void 0);break}t.next(Ao(r))}}catch(e){t.throw(e)}finally{n.releaseLock()}})(),t}function zo(e){let t=j(),n=e.getReader(),r=new TextDecoder(`utf-8`,{fatal:!0});return(async()=>{try{for(;;){let{done:e,value:i}=await n.read();if(e){try{let e=r.decode();e.length>0&&t.next(e)}catch{}t.return(void 0);break}try{let e=r.decode(i,{stream:!0});e.length>0&&t.next(e)}catch{t.next({$b64:Ao(i)})}}}catch(e){t.throw(e)}finally{n.releaseLock()}})(),t}var Bo=Ea({tag:`tss/RawStream`,extends:[Ea({tag:`tss/RawStreamFactory`,test(e){return e===Mo},parse:{sync(e,t,n){return{}},async async(e,t,n){return{}},stream(e,t,n){return{}}},serialize(e,t,n){return Io},deserialize(e,t,n){return Mo}}),Ea({tag:`tss/RawStreamFactoryText`,test(e){return e===No},parse:{sync(e,t,n){return{}},async async(e,t,n){return{}},stream(e,t,n){return{}}},serialize(e,t,n){return Lo},deserialize(e,t,n){return No}})],test(e){return e instanceof Do},parse:{sync(e,t,n){let r=e.hint===`text`?No:Mo;return{hint:t.parse(e.hint),factory:t.parse(r),stream:t.parse(j())}},async async(e,t,n){let r=e.hint===`text`?No:Mo,i=e.hint===`text`?zo(e.stream):Ro(e.stream);return{hint:await t.parse(e.hint),factory:await t.parse(r),stream:await t.parse(i)}},stream(e,t,n){let r=e.hint===`text`?No:Mo,i=e.hint===`text`?zo(e.stream):Ro(e.stream);return{hint:t.parse(e.hint),factory:t.parse(r),stream:t.parse(i)}}},serialize(e,t,n){return`(`+t.serialize(e.factory)+`)(`+t.serialize(e.stream)+`)`},deserialize(e,t,n){let r=t.deserialize(e.stream);return t.deserialize(e.hint)===`text`?Fo(r):Po(r)}});function Vo(e){return Ea({tag:`tss/RawStream`,test:()=>!1,parse:{},serialize(){throw Error(`RawStreamDeserializePlugin.serialize should not be called. Client only deserializes.`)},deserialize(t,n,r){return e(typeof n?.deserialize==`function`?n.deserialize(t.streamId):t.streamId)}})}var Ho=Ea({tag:`$TSR/Error`,test(e){return e instanceof Error},parse:{sync(e,t){return{message:t.parse(e.message)}},async async(e,t){return{message:await t.parse(e.message)}},stream(e,t){return{message:t.parse(e.message)}}},serialize(e,t){return`new Error(`+t.serialize(e.message)+`)`},deserialize(e,t){return Error(t.deserialize(e.message))}}),Uo={},Wo=e=>new ReadableStream({start(t){e.on({next(e){try{t.enqueue(e)}catch{}},throw(e){t.error(e)},return(){try{t.close()}catch{}}})}}),Go=Ea({tag:`seroval-plugins/web/ReadableStreamFactory`,test(e){return e===Uo},parse:{sync(){return Uo},async async(){return await Promise.resolve(Uo)},stream(){return Uo}},serialize(){return Wo.toString()},deserialize(){return Uo}});async function Ko(e,t){try{let n=await t.read();n.done?(e.return(n.value),t.releaseLock()):(e.next(n.value),await Ko(e,t))}catch(t){e.throw(t)}}function qo(e){e.cancel().catch(()=>{}),e.releaseLock()}function Jo(e){let t=j(),n=e.getReader(),r=qo.bind(null,n);return Ko(t,n).catch(r),[t,r]}var Yo=[Ho,Bo,Ea({tag:`seroval/plugins/web/ReadableStream`,extends:[Go],test(e){return typeof ReadableStream>`u`?!1:e instanceof ReadableStream},parse:{sync(e,t){return{factory:t.parse(Uo),stream:t.parse(j())}},async async(e,t){return{factory:await t.parse(Uo),stream:await t.parse(Jo(e)[0])}},stream(e,t){let[n,r]=Jo(e);return t.addCleanup(r),{factory:t.parse(Uo),stream:t.parse(n)}}},serialize(e,t){return`(`+t.serialize(e.factory)+`)(`+t.serialize(e.stream)+`)`},deserialize(e,t){return Wo(t.deserialize(e.stream))}})];function Xo(){return[...(Xe()?.serializationAdapters)?.map(Eo)??[],...Yo]}var Zo=new TextDecoder,Qo=new Uint8Array,$o=16777216,es=33554432,ts=1024,ns=1e5;function rs(e){let t=new Map,n=new Map,r=new Set,i=!1,a=null,o=0,s,c=new ReadableStream({start(e){s=e},cancel(){i=!0;try{a?.cancel()}catch{}t.forEach(e=>{try{e.error(Error(`Framed response cancelled`))}catch{}}),t.clear(),n.clear(),r.clear()}});function l(e){let i=n.get(e);if(i)return i;if(r.has(e))return new ReadableStream({start(e){e.close()}});if(n.size>=ts)throw Error(`Too many raw streams in framed response (max ${ts})`);let a=new ReadableStream({start(n){t.set(e,n)},cancel(){r.add(e),t.delete(e),n.delete(e)}});return n.set(e,a),a}function u(e){return l(e),t.get(e)}return(async()=>{let n=e.getReader();a=n;let c=[],l=0,d=0;function f(){c[l++]=Qo,l===c.length?(c.length=0,l=0):l>=32&&(c.splice(0,l),l=0)}function p(){if(d<9)return null;let e=c[l];if(e.length>=9)return{type:e[0],streamId:(e[1]<<24|e[2]<<16|e[3]<<8|e[4])>>>0,length:(e[5]<<24|e[6]<<16|e[7]<<8|e[8])>>>0};let t=new Uint8Array(9),n=0,r=9;for(let e=l;e0;e++){let i=c[e],a=Math.min(i.length,r);t.set(i.subarray(0,a),n),n+=a,r-=a}return{type:t[0],streamId:(t[1]<<24|t[2]<<16|t[3]<<8|t[4])>>>0,length:(t[5]<<24|t[6]<<16|t[7]<<8|t[8])>>>0}}function m(e){if(e===0)return Qo;let t=c[l];if(t&&t.length>=e){let n=t.subarray(0,e);return t.length===e?f():c[l]=t.subarray(e),d-=e,n}let n=new Uint8Array(e),r=0,i=e;for(;i>0&&les)throw Error(`Framed response buffer exceeded ${es} bytes`);for(c.push(a),d+=a.length;;){let e=p();if(!e)break;let{type:n,streamId:i,length:a}=e;if(n!==Ke.JSON&&n!==Ke.CHUNK&&n!==Ke.END&&n!==Ke.ERROR)throw Error(`Unknown frame type: ${n}`);if(n===Ke.JSON){if(i!==0)throw Error(`Invalid JSON frame streamId (expected 0)`)}else if(i===0)throw Error(`Invalid raw frame streamId (expected non-zero)`);if(a>$o)throw Error(`Frame payload too large: ${a} bytes (max ${$o})`);let c=9+a;if(dns)throw Error(`Too many frames in framed response (max ${ns})`);m(9);let l=m(a);switch(n){case Ke.JSON:try{s.enqueue(Zo.decode(l))}catch{}break;case Ke.CHUNK:{let e=u(i);e&&e.enqueue(l);break}case Ke.END:{let e=u(i);if(r.add(i),e){try{e.close()}catch{}t.delete(i)}break}case Ke.ERROR:{let e=u(i);if(r.add(i),e){let n=Zo.decode(l);e.error(Error(n)),t.delete(i)}break}}}}}if(d!==0)throw Error(`Incomplete frame at end of framed response`);try{s.close()}catch{}t.forEach(e=>{try{e.close()}catch{}}),t.clear()}catch(e){try{s.error(e)}catch{}t.forEach(t=>{try{t.error(e)}catch{}}),t.clear()}finally{try{n.releaseLock()}catch{}a=null}})(),{getStream:l,chunks:c}}var is=null;async function as(e){e.length>0&&await Promise.allSettled(e)}var os=Object.prototype.hasOwnProperty;function ss(e){for(let t in e)if(os.call(e,t))return!0;return!1}async function cs(e,t,n){is||=Xo();let r=t[0],i=r.fetch??n,a=r.data instanceof FormData?`formData`:`payload`,o=r.headers?new Headers(r.headers):new Headers;if(o.set(`x-tsr-serverFn`,`true`),a===`payload`&&o.set(`accept`,`${Ge}, application/x-ndjson, application/json`),r.method===`GET`){if(a===`formData`)throw Error(`FormData is not supported with GET requests`);let t=await ls(r);if(t!==void 0){let n=dt({payload:t});e.includes(`?`)?e+=`&${n}`:e+=`?${n}`}}let s;return r.method===`POST`&&(s=await ds(r),typeof s==`string`&&o.set(`content-type`,`application/json`)),await fs(async()=>i(e,{method:r.method,headers:o,signal:r.signal,body:s}))}async function ls(e){let t=!1,n={};if(e.data!==void 0&&(t=!0,n.data=e.data),e.context&&ss(e.context)&&(t=!0,n.context=e.context),t)return us(n)}async function us(e){return JSON.stringify(await Promise.resolve(To(e,{plugins:is})))}async function ds(e){if(e.data instanceof FormData){let t;return e.context&&ss(e.context)&&(t=await us(e.context)),t!==void 0&&e.data.set(Ue,t),e.data}let t=await ls(e);if(t)return t}async function fs(e){let t;try{t=await e()}catch(e){if(e instanceof Response)t=e;else throw console.log(e),e}if(t.headers.get(`x-tss-raw`)===`true`)return t;let n=t.headers.get(`content-type`);if(n||fe(),t.headers.get(`x-tss-serialized`)){let e;if(n.includes(`application/x-tss-framed`)){if(Ye(n),!t.body)throw Error(`No response body for framed response`);let{getStream:r,chunks:i}=rs(t.body),a=[Vo(r),...is||[]],o=new Map;e=await ps({jsonStream:i,onMessage:e=>wo(e,{refs:o,plugins:a}),onError(e,t){console.error(e,t)}})}else if(n.includes(`application/json`)){let n=await t.json(),r=[];try{e=wo(n,{plugins:is})}finally{}await as(r)}if(e||fe(),e instanceof Error)throw e;return e}if(n.includes(`application/json`)){let e=await t.json(),n=xt(e);if(n)throw n;if(C(e))throw e;return e}if(!t.ok)throw Error(await t.text());return t}async function ps({jsonStream:e,onMessage:t,onError:n}){let r=e.getReader(),{value:i,done:a}=await r.read();if(a||!i)throw Error(`Stream ended before first object`);let o=JSON.parse(i),s=!1,c=(async()=>{try{for(;;){let{value:e,done:i}=await r.read();if(i)break;if(e)try{let n=[];try{t(JSON.parse(e))}finally{}await as(n)}catch(t){n?.(`Invalid JSON: ${e}`,t)}}}catch(e){s||n?.(`Stream processing error:`,e)}})(),l,u=[];try{l=t(o)}catch(e){throw s=!0,r.cancel().catch(()=>{}),e}return await as(u),Promise.resolve(l).catch(()=>{s=!0,r.cancel().catch(()=>{})}),c.finally(()=>{try{r.releaseLock()}catch{}}),l}function ms(e){let t=`/./_serverFn/`+e;return Object.assign((...e)=>{let n=Xe()?.serverFns?.fetch;return cs(t,e,n??fetch)},{url:t,serverFnMeta:{id:e},[We]:!0})}var hs=R({key:`$TSS/serverfn`,test:e=>typeof e!=`function`||!(We in e)?!1:!!e[We],toSerializable:({serverFnMeta:e})=>({functionId:e.id}),fromSerializable:({functionId:e})=>ms(e)}),gs=o(a(),1),B=e();function _s({promise:e}){if(Te)return Te(e);let t=Wn(e);if(t[Un].status===`pending`)throw t;if(t[Un].status===`error`)throw t[Un].error;return t[Un].data}function vs(e){let t=(0,B.jsx)(ys,{...e});return e.fallback?(0,B.jsx)(gs.Suspense,{fallback:e.fallback,children:t}):t}function ys(e){let t=_s(e);return e.children(t)}var V=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(V||{});function bs({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function xs(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Ss=[],Cs=0,{link:ws,unlink:Ts,propagate:Es,checkDirty:Ds,shallowPropagate:Os}=bs({update(e){return e._update()},notify(e){Ss[As++]=e,e.flags&=~V.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=V.Mutable|V.Dirty,Ps(e))}}),ks=0,As=0,js,Ms=0;function Ns(e){try{++Ms,e()}finally{--Ms||Fs()}}function Ps(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Ts(n,e)}function Fs(){if(!(Ms>0)){for(;ks{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=js,o=t?.compare??Object.is;if(n)js=i,++Cs,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=V.Mutable|V.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{js=a,n&&(i.flags&=~V.RecursedCheck),Ps(i)}}};return n?(i.flags=V.Mutable|V.Dirty,i.get=function(){let e=i.flags;if(e&V.Dirty||e&V.Pending&&Ds(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Os(e)}}else e&V.Pending&&(i.flags=e&~V.Pending);return js!==void 0&&ws(i,js,Cs),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Es(e),Os(e),Fs())}},i}function Ls(e){let t=()=>{let t=js;js=n,++Cs,n.depsTail=void 0,n.flags=V.Watching|V.RecursedCheck;try{return e()}finally{js=t,n.flags&=~V.RecursedCheck,Ps(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:V.Watching|V.RecursedCheck,notify(){let e=this.flags;e&V.Dirty||e&V.Pending&&Ds(this.deps,this)?t():this.flags=V.Watching},stop(){this.flags=V.None,this.depsTail=void 0,Ps(this)}};return t(),n}function Rs(e){return ce({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function zs(e){let{select:t,...n}=e;return ce({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Bs(e){return ce({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 Vs(e){return ce({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Hs(e){let t=i();return gs.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Us(e){return ce({...e,select:t=>e.select?e.select(t.context):t.context})}var Ws=class extends Zn{constructor(e){super(e),this.useMatch=e=>ce({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Us({...e,from:this.id}),this.useSearch=e=>Vs({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Bs({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>zs({...e,from:this.id}),this.useLoaderData=e=>Rs({...e,from:this.id}),this.useNavigate=()=>Hs({from:this.fullPath}),this.Link=gs.forwardRef((e,t)=>(0,B.jsx)(le,{ref:t,from:this.fullPath,...e}))}};function Gs(e){return new Ws(e)}var Ks=class extends Qn{constructor(e){super(e),this.useMatch=e=>ce({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Us({...e,from:this.id}),this.useSearch=e=>Vs({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Bs({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>zs({...e,from:this.id}),this.useLoaderData=e=>Rs({...e,from:this.id}),this.useNavigate=()=>Hs({from:this.fullPath}),this.Link=gs.forwardRef((e,t)=>(0,B.jsx)(le,{ref:t,from:this.fullPath,...e}))}};function qs(e){return new Ks(e)}function Js(e){return e=>{let t=Gs(e);return t.isRoot=!1,t}}function Ys(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(c(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(Te)Te(a());else throw a()}return gs.createElement(r,e)};return o.preload=a,o}function Xs(e,t){let n=e[1];e.length=0,n?.(t)}function Zs({t:e}){let t=i(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{Xs(n,!1),n.push(i,a),e(t),gs.startTransition(r)}),ke(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(T(r.publicHref)!==T(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...zt(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function Qs(){let e=i(),t=e.routesById[_e],n=Oe(e,t),r=e.ssr?g:gs.Suspense,a=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Zs,{t:gs.useState()[1]}),(0,B.jsx)(r,{fallback:n,children:(0,B.jsx)($s,{})})]});return e.options.InnerWrap?(0,B.jsx)(e.options.InnerWrap,{children:a}):a}function $s(){let e=i(),t=e._rendered,n=ne(e.stores.matches,e=>t[0]??e),r=n[0],a=r?.routeId;ke(()=>{t[0]===n&&Xs(t,!0)},[t,n]);let o=a?(0,B.jsx)(h,{routeId:a}):null;return(0,B.jsx)(s.Provider,{value:a,children:e.options.disableGlobalCatchBoundary?o:(0,B.jsx)(je,{getResetKey:()=>r,onCatch:void 0,children:o})})}var ec=e=>({createMutableStore:Is,createReadonlyStore:Is,batch:Ns}),tc=e=>new nc(e),nc=class extends Ht{constructor(e){super(e,ec)}};function rc({router:e,children:t,...r}){ee(r)&&e.update({...e.options,...r,context:{...e.options.context,...r.context}});let i=(0,B.jsx)(n.Provider,{value:e,children:t});return e.options.Wrap?(0,B.jsx)(e.options.Wrap,{children:i}):i}function ic({router:e,...t}){return(0,B.jsx)(rc,{router:e,...t,children:(0,B.jsx)(Qs,{})})}function H(e,t){if(t)for(let[n,r]of Object.entries(t))n!==`suppressHydrationWarning`&&r!==void 0&&r!==!1&&e.setAttribute(n,typeof r==`boolean`?``:String(r))}function ac(e){let{attrs:t,children:n,nonce:r,preventScriptHoist:i}=e;switch(e.tag){case`title`:return(0,B.jsx)(`title`,{...t,suppressHydrationWarning:!0,children:n});case`meta`:return(0,B.jsx)(`meta`,{...t,suppressHydrationWarning:!0});case`link`:return(0,B.jsx)(`link`,{...t,precedence:t?.precedence??(t?.rel===`stylesheet`?`default`:void 0),nonce:r,suppressHydrationWarning:!0});case`style`:return e.inlineCss,(0,B.jsx)(`style`,{...t,dangerouslySetInnerHTML:{__html:n},nonce:r});case`script`:return(0,B.jsx)(oc,{attrs:t,preventScriptHoist:i,children:n});default:return null}}function oc({attrs:e,children:t,preventScriptHoist:n}){i();let r=he(),a=typeof e?.type==`string`&&e.type!==``&&e.type!==`text/javascript`&&e.type!==`module`;if(gs.useEffect(()=>{if(!a){if(e?.src){let t=(()=>{try{let t=document.baseURI||window.location.href;return new URL(e.src,t).href}catch{return e.src}})();for(let e of document.querySelectorAll(`script[src]`))if(e.src===t)return;let n=document.createElement(`script`);return H(n,e),document.head.appendChild(n),()=>n.remove()}if(typeof t==`string`){let n=typeof e?.type==`string`?e.type:`text/javascript`,r=typeof e?.nonce==`string`?e.nonce:void 0;for(let e of document.querySelectorAll(`script:not([src])`)){if(!(e instanceof HTMLScriptElement))continue;let i=e.getAttribute(`type`)??`text/javascript`,a=e.getAttribute(`nonce`)??void 0;if(e.textContent===t&&i===n&&a===r)return}let i=document.createElement(`script`);return i.textContent=t,H(i,e),document.head.appendChild(i),()=>i.remove()}}},[e,t,a]),a&&typeof t==`string`)return(0,B.jsx)(`script`,{...e,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:t}});if(!r){if(e?.src)return(0,B.jsx)(`script`,{...e,suppressHydrationWarning:!0});if(typeof t==`string`)return(0,B.jsx)(`script`,{...e,dangerouslySetInnerHTML:{__html:t},suppressHydrationWarning:!0})}return null}function sc(e,t,n,r){n=en(n);let i=n.map(e=>e.meta).filter(e=>e!==void 0),a=[],o={},s;for(let e=i.length-1;e>=0;e--){let n=i[e];for(let e=n.length-1;e>=0;e--){let r=n[e];if(r){if(r.title)s||={tag:`title`,children:r.title};else if(`script:ld+json`in r)try{let e=JSON.stringify(r[`script:ld+json`]);a.push({tag:`script`,attrs:{type:`application/ld+json`},children:m(e)})}catch{}else{let e=r.name??r.property;if(e){if(o[e])continue;o[e]=!0}a.push({tag:`meta`,attrs:{...r,nonce:t}})}}}}s&&a.push(s),t&&a.push({tag:`meta`,attrs:{property:`csp-nonce`,content:t}}),a.reverse();let c=n.flatMap(e=>e.links??[]).filter(e=>e!==void 0).map(e=>({tag:`link`,attrs:{...e,nonce:t}})),l=e.ssr?.manifest,u=[];l&&(n.forEach(e=>{(l.routes[e.routeId]?.css)?.forEach(e=>{let n=Xn(e);u.push({tag:`link`,attrs:{rel:`stylesheet`,...n,crossOrigin:Gn(r,`stylesheet`)??n.crossOrigin,suppressHydrationWarning:!0,nonce:t}})})}),l.inlineStyle&&u.push({tag:`style`,attrs:{...l.inlineStyle.attrs,nonce:t},children:l.inlineStyle.children,inlineCss:!0}));let d=[];l&&n.forEach(e=>{l.routes[e.routeId]?.preloads?.forEach(e=>{d.push({tag:`link`,attrs:{...qn(l,e,r),nonce:t}})})});let f=n.flatMap(e=>e.styles??[]).filter(e=>e!==void 0).map(({children:e,...n})=>({tag:`style`,attrs:{...n,nonce:t},children:e})),p=n.flatMap(e=>e.headScripts??[]).filter(e=>e!==void 0).map(({children:e,...n})=>({tag:`script`,attrs:{...n,nonce:t},children:e})),h=[];return Yn(h,a),h.push(...d),Yn(h,c),h.push(...u),Yn(h,f),Yn(h,p),h}var cc=e=>{let t=i(),n=t.options.ssr?.nonce,r=gs.useCallback(r=>sc(t,n,r,e),[e,n,t]);return ne(t.stores.matches,r,Ie)};function lc(e){let t=cc(e.assetCrossOrigin),n=i().options.ssr?.nonce;return(0,B.jsx)(B.Fragment,{children:t.map(e=>(0,gs.createElement)(ac,{...e,key:`tsr-meta-${JSON.stringify(e)}`,nonce:n}))})}var uc=()=>{let e=i(),t=e.options.ssr?.nonce;return dc(e,ne(e.stores.matches,n=>{n=en(n);let r=n.flatMap(e=>e.scripts??[]).filter(Boolean).map(({children:e,...n})=>({tag:`script`,attrs:{...n,suppressHydrationWarning:!0,nonce:t},children:e})),i=e.ssr?.manifest;if(!i)return r;for(let e of n){let n=i.routes[e.routeId]?.scripts;if(n)for(let e of n)r.push({tag:`script`,attrs:{...e.attrs,nonce:t},children:e.children,...typeof e.attrs?.src==`string`?{preventScriptHoist:!0}:{}})}return r},Ie))};function dc(e,t){return(0,B.jsx)(B.Fragment,{children:t.map((e,t)=>(0,gs.createElement)(ac,{...e,key:`tsr-scripts-${e.tag}-${t}`}))})}var fc=class extends ae{#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 Ne({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=pc(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=pc(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=pc(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=pc(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){u.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=>ve(t,e))}findAll(e={}){return this.getAll().filter(t=>ve(e,t))}notify(e){u.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return u.batch(()=>Promise.all(e.map(e=>e.continue().catch(b))))}};function pc(e){return e.options.scope?.id}var mc=class extends ae{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??be(r,t),a=this.get(i);return a||(a=new w({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(){u.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=>v(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>v(e,t)):t}notify(e){u.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){u.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){u.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},hc=new class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new mc,this.#t=e.mutationCache||new fc,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Fe.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=re.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(_(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=f(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return u.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;u.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return u.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=u.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(b).catch(b)}invalidateQueries(e,t={}){return u.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=u.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(b)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(b)}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(_(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(_(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(b).catch(b)}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(b).catch(b)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return re.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(S(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{te(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(S(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{te(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||=be(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===l&&(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()}}({defaultOptions:{queries:{retry:1,staleTime:1e3}}}),gc=``+new URL(`styles-CqgQt6-d.css`,import.meta.url).href,_c=qs({head:()=>({meta:[{charSet:`utf-8`},{name:`viewport`,content:`width=device-width, initial-scale=1`},{name:`theme-color`,content:`#111827`},{title:`headgate console`}],links:[{rel:`stylesheet`,href:gc},{rel:`icon`,href:`/favicon.svg`,type:`image/svg+xml`}]}),shellComponent:yc,notFoundComponent:vc});function vc(){return(0,B.jsx)(`main`,{className:`grid min-h-svh place-items-center p-6 text-center`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`404`}),(0,B.jsx)(`h1`,{className:`mt-2 text-balance font-semibold text-2xl`,children:`This console page does not exist`}),(0,B.jsx)(`p`,{className:`mt-2 text-muted-foreground text-sm`,children:`Use the operator navigation to return to a supported headgate view.`}),(0,B.jsx)(le,{className:`mt-5 inline-flex rounded-lg bg-primary px-4 py-2 font-medium text-primary-foreground text-sm hover:opacity-90`,to:`/overview`,children:`Open overview`})]})})}function yc({children:e}){return(0,B.jsxs)(`html`,{lang:`en`,suppressHydrationWarning:!0,children:[(0,B.jsxs)(`head`,{children:[(0,B.jsx)(lc,{}),(0,B.jsx)(`script`,{id:`headgate-theme`,suppressHydrationWarning:!0,children:de}),(0,B.jsx)(`script`,{id:`headgate-config`,suppressHydrationWarning:!0,children:`window.HEADGATE = window.HEADGATE || {apiBase:"/api/v1",readOnly:false};`})]}),(0,B.jsxs)(`body`,{children:[(0,B.jsx)(se,{client:hc,children:(0,B.jsx)(Se,{children:e})}),(0,B.jsx)(uc,{})]})]})}var bc=Js(`/`)({beforeLoad:()=>{throw yt({to:`/overview`})}}),xc=`modulepreload`,Sc=function(e,t){return new URL(e,t).href},Cc={},wc=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Sc(t,n),t=s(t),t in Cc)return;Cc[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:xc,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Tc=Js(`/_console`)({component:Ys(()=>wc(()=>import(`./_console-0Rv7Ejka.js`),__vite__mapDeps([0,1,2,3]),import.meta.url),`component`)}),Ec=Js(`/_console/jobs`)({validateSearch:e=>({q:typeof e.q==`string`&&e.q?e.q:void 0,queue:typeof e.queue==`string`&&e.queue?e.queue:void 0,state:typeof e.state==`string`&&e.state?e.state:void 0,cursor:typeof e.cursor==`string`&&e.cursor?e.cursor:void 0,cursorTrail:typeof e.cursorTrail==`string`&&e.cursorTrail?e.cursorTrail:void 0}),component:Ys(()=>wc(()=>import(`./_console.jobs-CcQsOwUN.js`),__vite__mapDeps([4,2,3,1,5,6,7,8,9,10,11,12,13]),import.meta.url),`component`)}),Dc=()=>wc(()=>import(`./_console.overview-Q11CjhGH.js`),__vite__mapDeps([14,2,3,1,15,16,9,7]),import.meta.url),Oc=new Set([`1h`,`6h`,`24h`,`7d`,`30d`]),kc=Js(`/_console/overview`)({validateSearch:e=>({queue:typeof e.queue==`string`&&e.queue?e.queue:void 0,range:typeof e.range==`string`&&Oc.has(e.range)?e.range:void 0}),component:Ys(Dc,`component`)}),Ac=Js(`/_console/periodic`)({validateSearch:e=>({events:typeof e.events==`string`&&e.events?e.events:void 0}),component:Ys(()=>wc(()=>import(`./_console.periodic-DY9l1h41.js`),__vite__mapDeps([17,2,3,1,10,13,7]),import.meta.url),`component`)}),jc=Js(`/_console/quarantine`)({component:Ys(()=>wc(()=>import(`./_console.quarantine-CeEEGrSn.js`),__vite__mapDeps([18,2,1,3,10,13,7]),import.meta.url),`component`)}),Mc=Js(`/_console/queues`)({component:Ys(()=>wc(()=>import(`./_console.queues-vpWNbWgx.js`),__vite__mapDeps([19,2,3,1,15,16,10,11,7]),import.meta.url),`component`)}),Nc=Js(`/_console/rate-classes`)({component:Ys(()=>wc(()=>import(`./_console.rate-classes-DhgcFmCM.js`),__vite__mapDeps([20,2,1,3,10,12,7]),import.meta.url),`component`)}),Pc=Js(`/_console/workers`)({component:Ys(()=>wc(()=>import(`./_console.workers-D-RyPU07.js`),__vite__mapDeps([21,2,1,3,10,13,7]),import.meta.url),`component`)}),Fc=Js(`/_console/workflows`)({validateSearch:e=>({cursor:typeof e.cursor==`string`&&e.cursor?e.cursor:void 0,cursorTrail:typeof e.cursorTrail==`string`&&e.cursorTrail?e.cursorTrail:void 0}),component:Ys(()=>wc(()=>import(`./_console.workflows-De2OTveu.js`),__vite__mapDeps([22,2,1,3,23,6,7,13]),import.meta.url),`component`)}),Ic=Js(`/_console/jobs/$jobId`)({component:Ys(()=>wc(()=>import(`./_console.jobs._jobId-w2X4oppA.js`),__vite__mapDeps([24,2,1,3,5,6,7,8,9,10,11,12,13]),import.meta.url),`component`)}),Lc=Js(`/_console/workflows_/$workflowId`)({validateSearch:e=>({selected:typeof e.selected==`string`&&e.selected?e.selected:void 0}),component:Ys(()=>wc(()=>import(`./_console.workflows_._workflowId-DZZPa3z2.js`),__vite__mapDeps([25,2,1,3,23,6,7,13,5,8,9,10,11,12]),import.meta.url),`component`)}),Rc=bc.update({id:`/`,path:`/`,getParentRoute:()=>_c}),U=Tc.update({id:`/_console`,getParentRoute:()=>_c}),zc=Ec.update({id:`/jobs`,path:`/jobs`,getParentRoute:()=>U}),Bc=kc.update({id:`/overview`,path:`/overview`,getParentRoute:()=>U}),Vc=Ac.update({id:`/periodic`,path:`/periodic`,getParentRoute:()=>U}),Hc=jc.update({id:`/quarantine`,path:`/quarantine`,getParentRoute:()=>U}),Uc=Mc.update({id:`/queues`,path:`/queues`,getParentRoute:()=>U}),Wc=Nc.update({id:`/rate-classes`,path:`/rate-classes`,getParentRoute:()=>U}),Gc=Pc.update({id:`/workers`,path:`/workers`,getParentRoute:()=>U}),Kc=Fc.update({id:`/workflows`,path:`/workflows`,getParentRoute:()=>U}),qc=Ic.update({id:`/$jobId`,path:`/$jobId`,getParentRoute:()=>zc}),Jc=Lc.update({id:`/workflows_/$workflowId`,path:`/workflows/$workflowId`,getParentRoute:()=>U}),Yc={ConsoleJobsJobIdRoute:qc},Xc={ConsoleJobsRoute:zc._addFileChildren(Yc),ConsoleOverviewRoute:Bc,ConsolePeriodicRoute:Vc,ConsoleQuarantineRoute:Hc,ConsoleQueuesRoute:Uc,ConsoleRateClassesRoute:Wc,ConsoleWorkersRoute:Gc,ConsoleWorkflowsRoute:Kc,ConsoleWorkflowsWorkflowIdRoute:Jc},Zc={IndexRoute:Rc,ConsoleRoute:U._addFileChildren(Xc)},Qc=_c._addFileChildren(Zc);function $c(){return tc({defaultPreload:`intent`,routeTree:Qc,scrollRestoration:!0})}async function el(){let e=await $c(),t=[];return window.__TSS_START_OPTIONS__={serializationAdapters:t},t.push(hs),e.options.serializationAdapters&&t.push(...e.options.serializationAdapters),e.update({basepath:`.`,serializationAdapters:t}),e.stores.ids.get().length||await Hn(e),e}var tl=el;function nl(){return tl().finally(()=>window.$_TSR?.h())}var rl;function il(){return rl||=nl(),(0,B.jsx)(vs,{promise:rl,children:e=>(0,B.jsx)(ic,{router:e})})}var al=He();(0,gs.startTransition)(()=>{(0,al.hydrateRoot)(document,(0,B.jsx)(gs.StrictMode,{children:(0,B.jsx)(il,{})}))});export{kc as a,Hs as c,Ac as i,Ic as n,Ec as o,Fc as r,wc as s,Lc as t}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/jobs-CWBl3QlV.js b/go/headgateui/dist/assets/jobs-CWBl3QlV.js deleted file mode 100644 index 7700a2c..0000000 --- a/go/headgateui/dist/assets/jobs-CWBl3QlV.js +++ /dev/null @@ -1 +0,0 @@ -import{c as e,d as t,o as n}from"./utils-o8v-URZ_.js";import{Jn as r,Un as i}from"./theme-6NkSfuJL.js";import{A as a,B as o,D as s,E as c,G as l,J as ee,N as u,O as d,T as f,U as p,X as m,_ as h,a as g,d as _,f as v,h as y,i as te,j as b,k as ne,l as x,m as S,n as C,o as w,p as T,r as re,u as E,w as D}from"./console-C2t3Lr2f.js";import{o as O}from"./index-B8M4ltzK.js";import{n as ie,t as k}from"./chevron-right-Dqi3i9r9.js";import{t as A}from"./clock-3-CrAcdu0a.js";import{t as j}from"./action-button-DtQnwrt0.js";import{t as M}from"./play-BC4ZZCx4.js";import{n as N,t as ae}from"./progress-BbTEfjhw.js";import{n as P,t as F}from"./relative-time-CtN3x3SY.js";import{a as I,c as L,i as R,n as z,o as oe,p as B,r as V,s as se,t as ce}from"./table-BngtkqYs.js";var le=m(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),H=m(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),U=m(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),W=m(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),G=m(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),K=m(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),q=m(`lock-keyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),ue=m(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),J=t(e(),1),de=[`debug`,`info`,`warn`,`error`];function fe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pe(e){return!fe(e)||typeof e.message!=`string`||!de.some(t=>t===e.level)||e.at_ms!==void 0&&(typeof e.at_ms!=`number`||!Number.isSafeInteger(e.at_ms))||e.fields!==void 0&&(!fe(e.fields)||Object.values(e.fields).some(e=>e!==null&&typeof e!=`string`&&typeof e!=`boolean`&&typeof e!=`number`))?!1:e.truncated===void 0||typeof e.truncated==`boolean`}function Y(e){if(e.startsWith(`headgate-log-v1:`)&&new TextEncoder().encode(e).length<=2048)try{let t=JSON.parse(e.slice(17));if(pe(t))return t}catch{}return{level:`info`,message:e}}var X=n(),Z={debug:le,error:H,info:G,warn:l},me={debug:`text-muted-foreground`,error:`text-destructive`,info:`text-blue-600 dark:text-blue-400`,warn:`text-amber-700 dark:text-amber-400`};function he({logs:e}){let[t,n]=(0,J.useState)(`all`),r=e.map((e,t)=>({...Y(e),id:t})),i=r.filter(e=>t===`all`||e.level===t);return(0,X.jsxs)(`section`,{"aria-label":`Attempt logs`,className:`mt-3 space-y-2`,children:[(0,X.jsxs)(`fieldset`,{"aria-label":`Filter logs by level`,className:`flex flex-wrap items-center gap-1`,children:[[`all`,...de].map(e=>(0,X.jsx)(o,{"aria-pressed":t===e,onClick:()=>n(e),size:`sm`,variant:t===e?`secondary`:`ghost`,children:e===`all`?`All logs`:e.toUpperCase()},e)),(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[i.length,` / `,r.length]})]}),(0,X.jsx)(`ol`,{className:`max-h-80 space-y-2 overflow-auto rounded-lg bg-muted/50 p-3`,children:i.map(e=>{let t=Z[e.level];return(0,X.jsxs)(`li`,{className:`space-y-1 text-xs`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(p,{className:me[e.level],variant:`outline`,children:[(0,X.jsx)(t,{"aria-hidden":`true`,className:`size-3`}),e.level.toUpperCase()]}),e.at_ms===void 0?null:(0,X.jsx)(F,{className:`text-muted-foreground`,value:e.at_ms}),e.truncated?(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Truncated`}):null]}),(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-words font-mono`,children:e.message}),e.fields&&Object.keys(e.fields).length>0?(0,X.jsxs)(`details`,{children:[(0,X.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:`Fields`}),(0,X.jsx)(`pre`,{className:`mt-1 overflow-x-auto whitespace-pre-wrap break-words`,children:JSON.stringify(e.fields,null,2)})]}):null]},e.id)})}),i.length===0?(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`No `,t,` logs in this attempt.`]}):null]})}var ge=new Set([`completed`,`archived`,`cancelled`,`undecodable`]);function _e(e){return(e.endsWith(`_at_ms`)?e.slice(0,-3):e).replaceAll(`_`,` `)}function ve(e,t){if(e.endsWith(`_at_ms`)){let n=typeof t==`number`?t:Number(t);if(Number.isSafeInteger(n)&&n>0)return{label:_e(e),timestamp:n}}return{label:_e(e),value:t==null?`—`:String(t)}}function Q(e,t){return e.estimated_admission_ms==null?t:`Expected to clear in about ${ye(e.estimated_admission_ms)}.`}function ye(e){return e<1e3?`${Math.max(0,e)}ms`:e<6e4?`${Math.ceil(e/1e3)}s`:e<36e5?`${Math.ceil(e/6e4)}m`:`${Math.ceil(e/36e5)}h`}function be(e,t){if(e===`running`)return{description:`This job is running, so the admission decision has already been applied.`,title:`Already admitted`,tone:`success`};if(e===`pending`)return{description:`Pending jobs are held outside the admission gate until their producer, such as a workflow coordinator, promotes them.`,title:`Waiting for promotion`,tone:`warning`};if(e===`quarantined`)return{description:`An operator must release the quarantined fingerprint before this job can run.`,title:`Blocked by quarantine`,tone:`destructive`};if(ge.has(e))return{description:`This job is ${e} and will not be considered by the admission gate.`,title:`Admission no longer applies`,tone:`muted`};if(t.admissible)return{description:`This job currently passes every admission policy.`,title:`Admissible now`,tone:`success`};switch(t.blocked_by){case`schedule`:return{description:Q(t,`The job will become eligible at its scheduled time.`),title:`Waiting for schedule`,tone:`warning`};case`quarantine`:return{description:`An operator must release the quarantined fingerprint before this job can run.`,title:`Blocked by quarantine`,tone:`destructive`};case`queue_paused`:return{description:`An operator must resume the queue before this job can run.`,title:`Queue is paused`,tone:`warning`};case`rate_class`:return{description:Q(t,`The rate class has no capacity; its configuration may require operator action.`),title:`Waiting for rate capacity`,tone:`warning`};case`concurrency_limit`:return{description:Q(t,`This will clear when another running job releases capacity.`),title:`Waiting for concurrency capacity`,tone:`warning`};case`fairness`:return{description:Q(t,`The job remains visible while other partitions receive their fair share.`),title:`Waiting for its partition turn`,tone:`warning`};default:return{description:`The API reported that this job is not admissible but did not identify a blocking policy.`,title:`Admission decision unavailable`,tone:`warning`}}}var xe=new Set([`pending`,`available`,`scheduled`,`retryable`,`running`,`completed`,`archived`,`cancelled`,`undecodable`,`quarantined`]),Se=new Set([`pending`,`available`,`scheduled`,`running`]);function Ce(e,t){if(!xe.has(e))return`Job state “${e}” is not recognized.`;switch(t){case`retry`:return e===`archived`||e===`cancelled`?null:`Retry is available only for archived or cancelled jobs.`;case`cancel`:return Se.has(e)?null:`Cancel is available only for pending, available, scheduled, or running jobs.`;case`reschedule`:return e===`scheduled`||e===`retryable`?null:`Reschedule is available only for scheduled or retryable jobs.`;case`delete`:return e===`running`?`Cancel a running job before deleting it.`:null;default:return`Unknown job action.`}}function we(e){try{let t=Uint8Array.from(atob(e),e=>e.charCodeAt(0));if(t.length>=7&&t[0]===72&&t[1]===71&&t[2]===69&&t[3]===67){let[,,,,n,r,i]=t,a=r*256+i,o=7+a;if(n===1&&a>0&&o+12+16<=t.length)return{content:e,encrypted:{keyId:new TextDecoder(`utf-8`,{fatal:!0}).decode(t.slice(7,o)),version:n},format:`Encrypted`}}let n=new TextDecoder(`utf-8`,{fatal:!0}).decode(t);try{return{content:JSON.stringify(JSON.parse(n),null,2),format:`JSON`}}catch{return{content:n,format:`Text`}}}catch{return{content:e,format:`Base64`}}}function Te(e){return e.completed_steps.length>0||e.in_progress_step!=null||e.cursor_step!=null||e.cursor!=null||e.schema_version>0||e.step_set_hash.length>0||Object.keys(e.crashes_by_step).length>0}var Ee=[`available`,`scheduled`,`retryable`,`running`,`completed`,`archived`,`cancelled`,`undecodable`,`quarantined`],De=new Set([`completed`,`archived`,`cancelled`,`undecodable`,`quarantined`]);function Oe(e,t){let n=De.has(e.state),r=e.state===`scheduled`&&(e.scheduled_at_ms??0)>t,i=!n&&e.state!==`running`&&!r,a=Math.max(e.enqueued_at_ms??0,e.scheduled_at_ms??0),o=e.claimed_at_ms??null,s=o&&a?Math.max(0,o-a):null,c=e.claimed_at_ms&&e.finalized_at_ms?Math.max(0,e.finalized_at_ms-e.claimed_at_ms):null;return[{at:e.enqueued_at_ms,icon:W,label:`Created`,status:`complete`},{at:e.scheduled_at_ms,detail:r?`Waiting for schedule`:void 0,icon:A,label:`Scheduled`,status:r?`waiting`:`complete`},{at:o,detail:s==null?i?B(Math.max(0,t-a)):void 0:B(s),icon:K,label:`Wait`,status:i?`waiting`:r?`pending`:`complete`},{at:e.claimed_at_ms,detail:c==null?e.state===`running`&&e.claimed_at_ms?B(t-e.claimed_at_ms):void 0:B(c),icon:M,label:`Running`,status:e.state===`running`?`active`:n?e.state===`completed`?`complete`:`failed`:`pending`},{at:e.finalized_at_ms,icon:ee,label:n?e.state[0].toUpperCase()+e.state.slice(1):`Complete`,status:n?e.state===`completed`?`complete`:`failed`:`pending`}]}function ke(e,t){return e?`${B(Math.max(0,t-e))} ago`:null}function Ae(e){return e===`complete`?{line:`bg-success`,node:`border-success bg-success text-white`}:e===`active`?{line:`bg-border`,node:`border-primary bg-primary text-primary-foreground`}:e===`waiting`?{line:`bg-border`,node:`border-warning bg-warning text-white`}:e===`failed`?{line:`bg-destructive`,node:`border-destructive bg-destructive text-white`}:{line:`bg-border`,node:`border-border bg-background text-muted-foreground`}}function $(e){return e===`running`?`success`:e===`retryable`||e===`scheduled`?`warning`:[`archived`,`cancelled`,`undecodable`,`quarantined`].includes(e)?`destructive`:`outline`}function je({id:e,open:t,setOpen:n,notify:r}){let i=e===null?null:`/jobs/${encodeURIComponent(e)}`,l=g(),u=P(),m=x([`api`,`job`,e],e=>i===null?Promise.reject(Error(`Job ID is required.`)):D(`${i}?include_payload=true`,{signal:e}),!!(e&&t)),h=x([`api`,`job-admission`,e],e=>i===null?Promise.reject(Error(`Job ID is required.`)):D(`${i}/admission`,{signal:e}),!!(e&&t)),_=m.data??null,v=x([`api`,`job-progress`,e],e=>i===null?Promise.reject(Error(`Job ID is required.`)):D(`${i}/progress`,{signal:e}),!!(e&&t&&_?.state===`running`)),y=x([`api`,`job-checkpoint`,e],e=>i===null?Promise.reject(Error(`Job ID is required.`)):D(`${i}/checkpoint`,{signal:e}),!!(e&&t)),S=h.data??null,C=v.data??null,w=y.data??null,T=y.error?y.error instanceof Error?y.error.message:String(y.error):null,E=m.error?m.error instanceof Error?m.error.message:String(m.error):null,O=l.variables?.path,ie=(0,J.useMemo)(()=>{if(!_?.errors)return[];if(Array.isArray(_.errors))return _.errors;try{return JSON.parse(_.errors)}catch{return[]}},[_?.errors]),k=(0,J.useMemo)(()=>_?.payload==null?null:we(_.payload),[_?.payload]),A=_?.metadata??null,N=(0,J.useMemo)(()=>_?Oe(_,u):[],[_,u]),I=(0,J.useMemo)(()=>_&&S?be(_.state,S):null,[_,S]),L=(0,J.useMemo)(()=>w?.cursor?we(w.cursor):null,[w?.cursor]),R=async(e,t)=>{try{await navigator.clipboard.writeText(t),r(`${e} copied`)}catch{r(`Could not copy ${e.toLowerCase()}`,`error`)}},z=async t=>{if(e&&!(t===`delete`&&!window.confirm(`Delete job ${e}? This cannot be undone.`)))try{await l.mutateAsync({method:t===`delete`?`DELETE`:`POST`,path:`/jobs/${encodeURIComponent(e)}${t===`delete`?``:`/${t}`}`}),r(t===`delete`?`Job deleted`:`Job ${t===`retry`?`retried`:`cancelled`}`),n(!1)}catch(e){r(e instanceof Error?e.message:String(e),`error`)}};return(0,X.jsx)(c,{onOpenChange:n,open:t,children:(0,X.jsxs)(s,{className:`w-full gap-0 overflow-hidden p-0 data-[side=left]:sm:max-w-2xl data-[side=right]:sm:max-w-2xl`,children:[(0,X.jsxs)(a,{className:`shrink-0 border-b p-4 pr-14`,children:[(0,X.jsx)(b,{className:`break-all font-mono`,children:e}),(0,X.jsx)(d,{children:`Job detail, admission decision, progress, and attempt history.`})]}),E?(0,X.jsx)(`div`,{className:`p-4`,children:(0,X.jsx)(re,{message:E})}):null,_||E?null:(0,X.jsx)(`div`,{className:`p-4`,children:(0,X.jsx)(te,{})}),_&&(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-4`,children:[(0,X.jsxs)(`dl`,{className:`grid grid-cols-[8rem_1fr] gap-x-3 gap-y-2 text-sm`,children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Kind`}),(0,X.jsxs)(`dd`,{children:[_.kind,` `,(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[`v`,_.schema_version]})]}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`State`}),(0,X.jsx)(`dd`,{children:(0,X.jsx)(p,{variant:$(_.state),children:_.state})}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Queue / partition`}),(0,X.jsxs)(`dd`,{children:[_.queue,` / `,_.partition_key||`—`]}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Rate class`}),(0,X.jsx)(`dd`,{children:_.rate_class||`—`}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Priority / weight`}),(0,X.jsxs)(`dd`,{children:[_.priority,` / `,_.weight??1]}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Sticky worker`}),(0,X.jsx)(`dd`,{className:`break-all font-mono text-xs`,children:_.sticky_worker||`—`}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Attempts`}),(0,X.jsxs)(`dd`,{children:[_.attempt,`/`,_.max_attempts,` · crashes`,` `,_.crash_attempt??0]}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Orphan provenance`}),(0,X.jsx)(`dd`,{children:_.orphaned?(0,X.jsx)(`span`,{className:`text-destructive`,children:`Reclaimed after an expired lease`}):`None`}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Fingerprint`}),(0,X.jsx)(`dd`,{className:`break-all font-mono text-xs`,children:_.fingerprint}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Enqueued`}),(0,X.jsx)(`dd`,{children:(0,X.jsx)(F,{value:_.enqueued_at_ms})}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Scheduled`}),(0,X.jsx)(`dd`,{children:(0,X.jsx)(F,{value:_.scheduled_at_ms})}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Finalized`}),(0,X.jsx)(`dd`,{children:(0,X.jsx)(F,{value:_.finalized_at_ms})}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Periodic origin`}),(0,X.jsx)(`dd`,{children:_.periodic_origin?(0,X.jsxs)(X.Fragment,{children:[_.periodic_origin.schedule_id,` ·`,` `,(0,X.jsx)(F,{value:_.periodic_origin.tick_ms})]}):`—`})]}),(0,X.jsxs)(`section`,{"aria-labelledby":`lifecycle-title`,children:[(0,X.jsx)(`h2`,{className:`mb-3 font-semibold text-sm`,id:`lifecycle-title`,children:`Lifecycle`}),(0,X.jsx)(`ol`,{className:`space-y-0`,children:N.map((e,t)=>{let n=e.icon,r=Ae(e.status);return(0,X.jsxs)(`li`,{"aria-current":[`active`,`waiting`].includes(e.status)?`step`:void 0,className:`fade-in slide-in-from-top-1 zoom-in-95 relative flex animate-in gap-3 pb-4 last:pb-0 motion-reduce:animate-none`,style:{animationDelay:`${t*90}ms`,animationFillMode:`both`},children:[tvoid R(k.encrypted?`Ciphertext`:`Payload`,k.content),size:`sm`,variant:`ghost`,children:[(0,X.jsx)(U,{}),`Copy`]})]}),k?.encrypted&&(0,X.jsxs)(`div`,{className:`mb-2 flex gap-3 rounded-lg border border-primary/20 bg-primary/5 p-3 text-sm`,children:[(0,X.jsx)(q,{className:`mt-0.5 size-4 shrink-0 text-primary`}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium`,children:`AES-256-GCM encrypted payload`}),(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Format v`,k.encrypted.version,` · key`,` `,(0,X.jsx)(`code`,{children:k.encrypted.keyId}),`. The console has no decryption keys; plaintext is available only inside the encrypted worker handler.`]})]})]}),k?(0,X.jsx)(`pre`,{className:`wrap-break-word max-h-80 overflow-auto whitespace-pre-wrap rounded-lg border bg-muted/50 p-3 font-mono text-xs`,children:k.content}):(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No payload stored.`})]}),(0,X.jsxs)(`section`,{"aria-labelledby":`metadata-title`,children:[(0,X.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`font-semibold text-sm`,id:`metadata-title`,children:`Metadata`}),A&&(0,X.jsxs)(o,{onClick:()=>void R(`Metadata`,JSON.stringify(A,null,2)),size:`sm`,variant:`ghost`,children:[(0,X.jsx)(U,{}),`Copy`]})]}),_.tags?.length?(0,X.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1`,children:_.tags.map(e=>(0,X.jsx)(p,{variant:`outline`,children:e},e))}):null,A&&Object.keys(A).length?(0,X.jsx)(`pre`,{className:`wrap-break-word max-h-80 overflow-auto whitespace-pre-wrap rounded-lg border bg-muted/50 p-3 font-mono text-xs`,children:JSON.stringify(A,null,2)}):(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No application metadata stored.`})]}),(0,X.jsxs)(`section`,{"aria-labelledby":`progress-title`,children:[(0,X.jsx)(`h2`,{className:`mb-2 font-semibold text-sm`,id:`progress-title`,children:`Progress`}),C?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-sm`,children:[(0,X.jsxs)(`strong`,{children:[(C.total>0?Math.min(100,Math.max(0,C.current*100/C.total)):0).toFixed(0),`%`]}),(0,X.jsxs)(`span`,{className:`font-mono text-xs`,children:[C.current,` / `,C.total]}),(0,X.jsx)(`span`,{children:C.message})]}),(0,X.jsx)(ae,{"aria-label":`Job progress`,value:C.total>0?C.current*100/C.total:0}),(0,X.jsxs)(`p`,{className:`mt-1 text-muted-foreground text-xs`,children:[`Updated `,(0,X.jsx)(F,{value:C.updated_at_ms}),` · attempt fence `,C.fence]})]}):(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No progress reported.`})]}),(0,X.jsxs)(`section`,{"aria-labelledby":`resumable-title`,children:[(0,X.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h2`,{className:`font-semibold text-sm`,id:`resumable-title`,children:`Resumable execution`}),w&&Te(w)&&(0,X.jsxs)(p,{variant:`outline`,children:[`checkpoint v`,w.schema_version||`—`]})]}),y.isPending?(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Loading checkpoint…`}):T?(0,X.jsx)(re,{message:T}):w&&Te(w)?(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsxs)(`ol`,{"aria-label":`Persisted resumable steps`,className:`space-y-2`,children:[w.completed_steps.map(e=>(0,X.jsxs)(`li`,{className:`flex items-center gap-2 text-sm`,children:[(0,X.jsx)(`span`,{className:`flex size-6 items-center justify-center rounded-full bg-success text-white`,children:(0,X.jsx)(ee,{className:`size-3.5`})}),(0,X.jsx)(`span`,{className:`font-medium`,children:e}),(0,X.jsx)(p,{variant:`success`,children:`completed`})]},`completed:${e}`)),w.in_progress_step&&(0,X.jsxs)(`li`,{className:`flex items-center gap-2 text-sm`,children:[(0,X.jsx)(`span`,{className:`flex size-6 items-center justify-center rounded-full bg-primary text-primary-foreground`,children:(0,X.jsx)(M,{className:`size-3.5`})}),(0,X.jsx)(`span`,{className:`font-medium`,children:w.in_progress_step}),(0,X.jsx)(p,{variant:`warning`,children:`checkpointed before side effects`})]})]}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Only persisted completed/current steps are shown. Future handler steps are not stored with the job.`}),(0,X.jsxs)(`dl`,{className:`grid grid-cols-[7rem_1fr] gap-x-3 gap-y-1 text-xs`,children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Last completed`}),(0,X.jsx)(`dd`,{children:w.last_completed_step??`—`}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Cursor step`}),(0,X.jsx)(`dd`,{children:w.cursor_step??`—`}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Step-set hash`}),(0,X.jsx)(`dd`,{className:`break-all font-mono`,children:w.step_set_hash||`—`})]}),Object.keys(w.crashes_by_step).length>0&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`mb-1 font-medium text-xs`,children:`Crashes by step`}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.entries(w.crashes_by_step).map(([e,t])=>(0,X.jsxs)(p,{variant:`destructive`,children:[e,`: `,t]},e))})]}),L&&(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[(0,X.jsxs)(`p`,{className:`font-medium text-xs`,children:[`Durable cursor`,` `,(0,X.jsx)(p,{variant:`outline`,children:L.format})]}),(0,X.jsxs)(o,{onClick:()=>void R(`Cursor`,L.content),size:`sm`,variant:`ghost`,children:[(0,X.jsx)(U,{}),`Copy`]})]}),(0,X.jsx)(`p`,{className:`mb-2 text-muted-foreground text-xs`,children:`Cursor data is explicitly loaded and may contain application-sensitive values.`}),(0,X.jsx)(`pre`,{className:`wrap-break-word max-h-52 overflow-auto whitespace-pre-wrap rounded-lg border bg-muted/50 p-3 font-mono text-xs`,children:L.content})]})]}):(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No resumable checkpoint has been recorded for this job.`})]}),S&&I&&(0,X.jsxs)(`section`,{"aria-labelledby":`admission-title`,children:[(0,X.jsx)(`h2`,{className:`mb-2 font-semibold text-sm`,id:`admission-title`,children:`Admission`}),(0,X.jsx)(`p`,{className:I.tone===`success`?`text-success`:I.tone===`destructive`?`text-destructive`:I.tone===`warning`?`text-warning`:`text-muted-foreground`,children:I.title}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:I.description}),(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:Object.entries(S.detail??{}).map(([e,t])=>{let n=ve(e,t);return(0,X.jsxs)(p,{variant:`outline`,children:[n.label,`:`,` `,n.timestamp===void 0?n.value:(0,X.jsx)(F,{value:n.timestamp})]},e)})})]}),(0,X.jsxs)(`section`,{"aria-labelledby":`timeline-title`,children:[(0,X.jsx)(`h2`,{className:`mb-2 font-semibold text-sm`,id:`timeline-title`,children:`Attempts`}),ie.length?(0,X.jsx)(`ol`,{className:`ml-1 border-l pl-4`,children:ie.map(e=>(0,X.jsxs)(`li`,{className:`mb-4 last:mb-0`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(p,{variant:$(e.outcome),children:e.outcome}),(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[(0,X.jsx)(F,{value:e.at_ms}),e.attempt==null?``:` · attempt ${e.attempt}`,e.crash_attempt==null?``:` · crash ${e.crash_attempt}`]})]}),e.error&&(0,X.jsx)(`p`,{className:`mt-1 text-sm`,children:e.error}),e.logs&&e.logs.length>0?(0,X.jsx)(he,{logs:e.logs}):null]},`${e.at_ms}:${e.outcome}:${e.attempt??`none`}:${e.crash_attempt??`none`}`))}):(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No attempts recorded.`})]})]}),_?(0,X.jsx)(ne,{className:`shrink-0 border-t bg-background p-4`,children:(0,X.jsxs)(`section`,{"aria-labelledby":`actions-title`,className:`w-full`,children:[(0,X.jsx)(`h2`,{className:`mb-2 font-semibold text-sm`,id:`actions-title`,children:`Actions`}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[{action:`retry`,label:`Retry`,pendingLabel:`Retrying…`,run:()=>z(`retry`),variant:`outline`},{action:`cancel`,label:`Cancel`,pendingLabel:`Cancelling…`,run:()=>z(`cancel`),variant:`outline`},{action:`reschedule`,label:`Reschedule`,pendingLabel:`Rescheduling…`,run:async()=>{if(!e)return;let t=window.prompt(`Run at (milliseconds since Unix epoch)`);if(t)try{await l.mutateAsync({body:{scheduled_at_ms:Number(t)},path:`/jobs/${encodeURIComponent(e)}/reschedule`}),r(`Job rescheduled`),n(!1)}catch(e){r(e instanceof Error?e.message:String(e),`error`)}},variant:`outline`},{action:`delete`,label:`Delete`,pendingLabel:`Deleting…`,run:()=>z(`delete`),variant:`destructive`}].map(t=>{let n=Ce(_.state,t.action),r=l.isPending&&(t.action===`delete`?O===`/jobs/${encodeURIComponent(e??``)}`:O?.endsWith(`/${t.action}`));return(0,X.jsx)(`span`,{title:n??void 0,children:(0,X.jsx)(j,{disabled:f.readOnly||l.isPending||!!n,onClick:()=>void t.run(),pending:r,pendingLabel:t.pendingLabel,variant:t.variant,children:t.label})},t.action)})})]})}):null]})})}function Me({notify:e}){let t=O.useSearch(),n=O.useNavigate(),a=i(),s=g(),c=g(),[l,ee]=(0,J.useState)(t.q??``),[d,m]=(0,J.useState)(t.queue??``),[b,ne]=(0,J.useState)(t.state??``),[x,A]=(0,J.useState)(()=>new Set),[M,ae]=(0,J.useState)(`retry`),[P,B]=(0,J.useState)(`cancel`),[le,H]=(0,J.useState)(``),[U,W]=(0,J.useState)(null),G=new URLSearchParams({limit:`50`});t.q&&G.set(`q`,t.q),t.queue&&G.set(`queue`,t.queue),t.state&&G.set(`state`,t.state),t.cursor&&G.set(`cursor`,t.cursor);let{data:K,error:q,loading:de}=w(`/jobs?${G}`),fe=t.queue?`?queue=${encodeURIComponent(t.queue)}`:``,pe=w(`/jobs/counts${fe}`),Y=(0,J.useMemo)(()=>{if(!t.cursorTrail)return[];try{let e=JSON.parse(t.cursorTrail);return Array.isArray(e)&&e.every(e=>e===null||typeof e==`string`)?e:[]}catch{return[]}},[t.cursorTrail]),Z=!!(t.queue||t.state),me=e=>{e.preventDefault(),n({search:{q:l||void 0,queue:d||void 0,state:b||void 0}})},he=()=>{if(!Y.length)return;let e=Y.at(-1)??void 0,t=Y.slice(0,-1);n({search:n=>({...n,cursor:e,cursorTrail:t.length?JSON.stringify(t):void 0})})},ge=()=>{K?.next_cursor&&n({search:e=>({...e,cursor:K.next_cursor,cursorTrail:JSON.stringify([...Y,t.cursor??null])})})},_e=async()=>{let t=[...x];if(t.length&&!([`delete`,`cancel`].includes(M)&&!window.confirm(`${M} ${t.length} selected job(s)?`)))try{let n=await s.mutateAsync({body:{action:M,ids:t},path:`/jobs/actions`}),r=n.succeeded?.length??0,i=n.failed?.length??0;e(`${M}: ${r} succeeded${i?`, ${i} failed`:``}`,i?`error`:`normal`),A(new Set)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},ve=async n=>{let r={};if(t.queue&&(r.queue=t.queue),t.state&&(r.state=t.state),!Object.keys(r).length){e(`Set a queue or state filter before using bulk actions.`,`error`);return}if(n||window.confirm(`${P.toUpperCase()} every job matching ${JSON.stringify(r)}?`)){W(n?`dry-run`:`apply`);try{let t=await c.mutateAsync({body:{action:P,dry_run:n,selector:r},path:`/jobs/bulk`});if(n){H(`Dry run: approximately ${t.total_estimated} job(s) match.`);return}H(`Operation ${t.id} is running…`);let i=Date.now();for(;Date.now()-i<6e4;){await new Promise(e=>window.setTimeout(e,800));let n=await a.fetchQuery({queryFn:({signal:e})=>D(`/operations/${encodeURIComponent(t.id)}`,{signal:e}),queryKey:[`api`,`operation`,t.id],staleTime:0});if(H(`${n.status} · ${n.affected} affected`),[`completed`,`failed`].includes(n.status)){e(n.status===`completed`?`Bulk ${P}: ${n.affected} affected`:`Bulk operation failed: ${n.error??`unknown error`}`,n.status===`failed`?`error`:`normal`);return}}e(`The operation is still running; check it again later.`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}finally{W(null)}}};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`mb-4`,children:[(0,X.jsx)(`h1`,{className:`font-semibold text-lg`,children:`Jobs`}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Search, inspect admission decisions, and perform bounded control actions.`})]}),(0,X.jsxs)(`nav`,{"aria-label":`Job state`,className:`mb-4 flex gap-2 overflow-x-auto pb-1`,children:[(0,X.jsx)(o,{onClick:()=>void n({search:e=>({...e,cursor:void 0,cursorTrail:void 0,state:void 0})}),size:`sm`,variant:t.state?`outline`:`secondary`,children:`All`}),Ee.map(e=>(0,X.jsxs)(o,{onClick:()=>void n({search:t=>({...t,cursor:void 0,cursorTrail:void 0,state:e})}),size:`sm`,variant:t.state===e?`secondary`:`outline`,children:[e,(0,X.jsx)(p,{variant:`outline`,children:pe.data?.counts[e]??0})]},e))]}),pe.data?.approximate&&(0,X.jsx)(`div`,{className:`flex`,children:(0,X.jsx)(`span`,{className:`self-center text-muted-foreground text-xs`,children:`Counts are approximate`})}),(0,X.jsx)(se,{children:(0,X.jsxs)(L,{className:`space-y-3 pt-4`,children:[(0,X.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:me,children:[(0,X.jsxs)(`div`,{className:`grid gap-1`,children:[(0,X.jsx)(h,{htmlFor:`job-query`,children:`Search`}),(0,X.jsx)(u,{autoComplete:`off`,className:`w-72`,id:`job-query`,name:`query`,onChange:e=>ee(e.target.value),placeholder:`e.g. kind:EmailSender queue:default…`,value:l})]}),(0,X.jsxs)(`div`,{className:`grid gap-1`,children:[(0,X.jsx)(h,{htmlFor:`job-queue`,children:`Queue`}),(0,X.jsx)(u,{autoComplete:`off`,className:`w-36`,id:`job-queue`,name:`queue`,onChange:e=>m(e.target.value),spellCheck:!1,value:d})]}),(0,X.jsxs)(`div`,{className:`grid gap-1`,children:[(0,X.jsx)(h,{htmlFor:`job-state`,children:`State`}),(0,X.jsxs)(E,{onValueChange:e=>ne(e===`all`||e==null?``:e),value:b||`all`,children:[(0,X.jsx)(S,{className:`w-40`,id:`job-state`,children:(0,X.jsx)(y,{children:b||`All states`})}),(0,X.jsx)(_,{children:(0,X.jsxs)(v,{children:[(0,X.jsx)(T,{value:`all`,children:`All states`}),Ee.map(e=>(0,X.jsx)(T,{value:e,children:e},e))]})})]})]}),(0,X.jsxs)(o,{type:`submit`,children:[(0,X.jsx)(ue,{}),`Search`]}),(0,X.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[(0,X.jsxs)(o,{disabled:!Y.length,onClick:he,variant:`outline`,children:[(0,X.jsx)(ie,{}),`Previous`]}),(0,X.jsxs)(o,{disabled:!K?.next_cursor,onClick:ge,variant:`outline`,children:[`Next`,(0,X.jsx)(k,{})]})]})]}),x.size>0?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t pt-3`,children:[(0,X.jsxs)(`strong`,{className:`mr-1 text-sm`,children:[`Actions for `,x.size,` selected job`,x.size===1?``:`s`]}),(0,X.jsxs)(E,{onValueChange:e=>e&&ae(e),value:M,children:[(0,X.jsx)(S,{"aria-label":`Action for selected jobs`,className:`w-36`,children:(0,X.jsx)(y,{children:M[0].toUpperCase()+M.slice(1)})}),(0,X.jsx)(_,{children:(0,X.jsxs)(v,{children:[(0,X.jsx)(T,{value:`retry`,children:`Retry`}),(0,X.jsx)(T,{value:`archive`,children:`Archive`}),(0,X.jsx)(T,{value:`cancel`,children:`Cancel`}),(0,X.jsx)(T,{value:`delete`,children:`Delete`})]})})]}),(0,X.jsx)(j,{disabled:f.readOnly,onClick:()=>void _e(),pending:s.isPending,pendingLabel:`Applying…`,size:`sm`,variant:[`cancel`,`delete`].includes(M)?`destructive`:`default`,children:`Apply to selected`}),(0,X.jsx)(o,{onClick:()=>A(new Set),size:`sm`,variant:`ghost`,children:`Clear selection`})]}):(0,X.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 border-t pt-3`,children:[(0,X.jsxs)(`div`,{className:`grid gap-1`,children:[(0,X.jsx)(h,{htmlFor:`bulk-action`,children:`Bulk action for current queue/state filter`}),(0,X.jsxs)(E,{onValueChange:e=>e&&B(e),value:P,children:[(0,X.jsx)(S,{className:`w-36`,id:`bulk-action`,children:(0,X.jsx)(y,{children:P[0].toUpperCase()+P.slice(1)})}),(0,X.jsx)(_,{children:(0,X.jsxs)(v,{children:[(0,X.jsx)(T,{value:`cancel`,children:`Cancel`}),(0,X.jsx)(T,{value:`retry`,children:`Retry`}),(0,X.jsx)(T,{value:`delete`,children:`Delete`})]})})]})]}),(0,X.jsx)(j,{disabled:f.readOnly||U!==null||!Z,onClick:()=>void ve(!0),pending:U===`dry-run`,pendingLabel:`Checking…`,variant:`outline`,children:`Dry run`}),(0,X.jsx)(j,{disabled:f.readOnly||U!==null||!Z,onClick:()=>void ve(!1),pending:U===`apply`,pendingLabel:`Applying…`,variant:[`cancel`,`delete`].includes(P)?`destructive`:`default`,children:`Apply`}),(0,X.jsx)(`p`,{"aria-live":`polite`,className:`text-muted-foreground text-sm`,children:Z?le:`Choose a queue or state filter to enable filter-wide actions.`})]}),de&&!K?(0,X.jsx)(te,{}):q?(0,X.jsx)(re,{message:q}):K?.jobs.length?(0,X.jsxs)(ce,{children:[(0,X.jsx)(I,{children:(0,X.jsxs)(oe,{children:[(0,X.jsx)(R,{children:(0,X.jsx)(N,{"aria-label":`Select all visible jobs`,checked:K.jobs.length>0&&K.jobs.every(e=>x.has(e.id)),onCheckedChange:e=>A(e?new Set(K.jobs.map(e=>e.id)):new Set)})}),(0,X.jsx)(R,{children:`ID`}),(0,X.jsx)(R,{children:`Kind`}),(0,X.jsx)(R,{children:`Queue`}),(0,X.jsx)(R,{children:`State`}),(0,X.jsx)(R,{children:`Attempt`}),(0,X.jsx)(R,{children:`Scheduled`})]})}),(0,X.jsx)(z,{children:K.jobs.map(e=>(0,X.jsxs)(oe,{children:[(0,X.jsx)(V,{children:(0,X.jsx)(N,{"aria-label":`Select job ${e.id}`,checked:x.has(e.id),onCheckedChange:t=>A(n=>{let r=new Set(n);return t?r.add(e.id):r.delete(e.id),r})})}),(0,X.jsx)(V,{children:(0,X.jsx)(r,{"aria-label":`Inspect job ${e.id}`,className:`font-mono text-primary text-xs hover:underline`,params:{jobId:e.id},search:e=>e,to:`/jobs/$jobId`,children:e.id})}),(0,X.jsx)(V,{children:e.kind}),(0,X.jsx)(V,{children:e.queue}),(0,X.jsxs)(V,{children:[(0,X.jsx)(p,{variant:$(e.state),children:e.state}),e.orphaned&&(0,X.jsx)(`span`,{className:`ml-2 text-destructive text-xs`,children:`orphan-reclaimed`})]}),(0,X.jsxs)(V,{children:[e.attempt,`/`,e.max_attempts,e.crash_attempt?(0,X.jsxs)(`span`,{className:`ml-1 text-destructive`,children:[`+`,e.crash_attempt,` crash`]}):null]}),(0,X.jsx)(V,{className:`text-muted-foreground`,children:(0,X.jsx)(F,{value:e.scheduled_at_ms})})]},e.id))})]}):(0,X.jsx)(C,{children:`No jobs match this search.`})]})})]})}export{Me as n,je as t}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/jobs-DEyFN2Bl.js b/go/headgateui/dist/assets/jobs-DEyFN2Bl.js new file mode 100644 index 0000000..85a8583 --- /dev/null +++ b/go/headgateui/dist/assets/jobs-DEyFN2Bl.js @@ -0,0 +1 @@ +import{a as e,s as t,u as n}from"./with-selector-hO0TNhHE.js";import{Wn as r,Yn as i}from"./theme-CN9-NrCi.js";import{A as a,C as o,D as s,E as c,G as l,J as u,M as d,O as f,P as p,T as m,V as h,X as g,_,a as ee,d as v,f as y,h as b,i as te,j as x,k as ne,l as S,m as C,n as w,o as T,p as E,r as D,u as O}from"./console-COYwGlau.js";import{o as k}from"./index-D8-0FUBj.js";import{a as A,i as j,o as M,r as N,s as re}from"./workflow-DSGFLdZh.js";import{i as P,n as F,r as I,t as L}from"./radio-DTs_-itw.js";import{t as R}from"./clock-3-CBdsf5xL.js";import{t as z}from"./action-button-DKldNPQD.js";import{t as B}from"./play-B9gqZXeA.js";import{n as ie,t as V}from"./progress-DIxv1Q_r.js";import{n as H,t as U}from"./relative-time-Bzc3eil5.js";import{a as ae,c as oe,i as W,n as se,o as ce,p as G,r as K,s as le,t as ue}from"./table-DtWJ0yY1.js";var de=g(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),fe=g(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),q=g(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),J=g(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Y=g(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),pe=g(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),me=g(`lock-keyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),he=g(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ge=g(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),X=n(t(),1),_e=[`debug`,`info`,`warn`,`error`];function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ve(e){return!Z(e)||typeof e.message!=`string`||!_e.some(t=>t===e.level)||e.at_ms!==void 0&&(typeof e.at_ms!=`number`||!Number.isSafeInteger(e.at_ms))||e.fields!==void 0&&(!Z(e.fields)||Object.values(e.fields).some(e=>e!==null&&typeof e!=`string`&&typeof e!=`boolean`&&typeof e!=`number`))?!1:e.truncated===void 0||typeof e.truncated==`boolean`}function ye(e){if(e.startsWith(`headgate-log-v1:`)&&new TextEncoder().encode(e).length<=2048)try{let t=JSON.parse(e.slice(17));if(ve(t))return t}catch{}return{level:`info`,message:e}}var Q=e(),be={debug:de,error:fe,info:Y,warn:l},xe={debug:`text-muted-foreground`,error:`text-destructive`,info:`text-blue-600 dark:text-blue-400`,warn:`text-amber-700 dark:text-amber-400`};function Se({logs:e}){let[t,n]=(0,X.useState)(`all`),r=e.map((e,t)=>({...ye(e),id:t})),i=r.filter(e=>t===`all`||e.level===t);return(0,Q.jsxs)(`section`,{"aria-label":`Attempt logs`,className:`mt-3 space-y-2`,children:[(0,Q.jsxs)(`fieldset`,{"aria-label":`Filter logs by level`,className:`flex flex-wrap items-center gap-1`,children:[[`all`,..._e].map(e=>(0,Q.jsx)(h,{"aria-pressed":t===e,onClick:()=>n(e),size:`sm`,variant:t===e?`secondary`:`ghost`,children:e===`all`?`All logs`:e.toUpperCase()},e)),(0,Q.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[i.length,` / `,r.length]})]}),(0,Q.jsx)(`ol`,{className:`max-h-80 space-y-2 overflow-auto rounded-lg bg-muted/50 p-3`,children:i.map(e=>{let t=be[e.level];return(0,Q.jsxs)(`li`,{className:`space-y-1 text-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(o,{className:xe[e.level],variant:`outline`,children:[(0,Q.jsx)(t,{"aria-hidden":`true`,className:`size-3`}),e.level.toUpperCase()]}),e.at_ms===void 0?null:(0,Q.jsx)(U,{className:`text-muted-foreground`,value:e.at_ms}),e.truncated?(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Truncated`}):null]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-words font-mono`,children:e.message}),e.fields&&Object.keys(e.fields).length>0?(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:`Fields`}),(0,Q.jsx)(`pre`,{className:`mt-1 overflow-x-auto whitespace-pre-wrap break-words`,children:JSON.stringify(e.fields,null,2)})]}):null]},e.id)})}),i.length===0?(0,Q.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`No `,t,` logs in this attempt.`]}):null]})}function Ce(e){return e.replace(`_`,` `)}function we({empty:e,nodes:t}){return t.length?(0,Q.jsx)(`ul`,{className:`space-y-2`,children:t.map(e=>(0,Q.jsxs)(`li`,{className:`flex min-w-0 items-center justify-between gap-3 rounded-md border bg-muted/20 px-3 py-2`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`truncate font-medium text-sm`,title:e.name,children:e.name}),(0,Q.jsxs)(`p`,{className:`text-muted-foreground text-xs capitalize`,children:[Ce(e.kind),e.completed_at_ms?(0,Q.jsxs)(Q.Fragment,{children:[` `,`· completed `,(0,Q.jsx)(U,{value:e.completed_at_ms})]}):null]})]}),(0,Q.jsx)(o,{className:`shrink-0`,variant:e.state===`completed`?`success`:`outline`,children:e.state})]},e.name))}):(0,Q.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:e})}function Te({jobId:e,workflowId:t}){let n=S([`api`,`workflow-snapshot`,t],async e=>N(await m(`/workflows/${encodeURIComponent(t)}`,{signal:e}))),r=S([`api`,`workflow-events`,t],e=>m(`/workflows/${encodeURIComponent(t)}/events`,{signal:e})),i=S([`api`,`workflow-signals`,t],e=>m(`/workflows/${encodeURIComponent(t)}/signals?limit=100`,{signal:e})),a=n.data,s=a?.nodes.find(t=>t.job_id===e),c=s?a?.nodes.filter(e=>s.dependencies.includes(e.name))??[]:[],l=s?a?.nodes.filter(e=>s.dependents.includes(e.name))??[]:[],u=new Set(s?A(a?.nodes??[],s):[]),d=(i.data?.signals??[]).filter(e=>u.has(e.signal)),f=s?j(s):null,p=(r.data?.events??[]).slice().reverse().find(e=>e.node===s?.name&&e.event===`node_completed`),h=n.error??r.error??i.error;if(n.isPending)return(0,Q.jsx)(te,{});if(h)return(0,Q.jsx)(D,{message:h instanceof Error?h.message:String(h)});if(!(a&&s))return null;let g=s.state===`completed`,_=c.filter(e=>e.state===`completed`).length,ee=c.length===0||_===c.length,v=s.kind===`signal`?L:s.kind===`timer`?ge:F;return(0,Q.jsxs)(`section`,{"aria-labelledby":`workflow-task-title`,className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h2`,{className:`font-semibold text-sm`,id:`workflow-task-title`,children:`Workflow Task`}),(0,Q.jsx)(o,{className:`capitalize`,variant:`outline`,children:Ce(s.kind)})]}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[7rem_1fr] gap-x-3 gap-y-2 text-sm`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Task`}),(0,Q.jsx)(`dd`,{className:`break-words font-medium`,children:s.name}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Workflow`}),(0,Q.jsx)(`dd`,{className:`break-all font-mono text-xs`,children:a.workflow_id}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Generation`}),(0,Q.jsx)(`dd`,{children:a.generation}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Completed`}),(0,Q.jsx)(`dd`,{children:(0,Q.jsx)(U,{value:s.completed_at_ms})})]}),f?(0,Q.jsx)(`div`,{className:`rounded-lg border bg-muted/20 p-3`,children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full ${g?`bg-success/15 text-success`:`bg-warning/15 text-warning`}`,children:(0,Q.jsx)(v,{"aria-hidden":`true`,className:`size-4`})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`font-medium text-sm`,children:f.label}),(0,Q.jsx)(o,{variant:g?`success`:`warning`,children:g?`resolved`:`waiting`})]}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-muted-foreground text-xs`,children:f.detail})]})]})}):null,u.size?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`mb-2 font-medium text-sm`,children:`Signal history`}),d.length?(0,Q.jsx)(`ul`,{className:`space-y-3`,children:d.map(e=>(0,Q.jsxs)(`li`,{className:`space-y-2 rounded-lg border bg-muted/20 p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`font-medium text-sm`,children:e.signal}),(0,Q.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[(0,Q.jsx)(U,{value:e.recorded_at_ms}),` · emission `,e.id]})]}),(0,Q.jsx)(o,{variant:`outline`,children:e.idempotency_key})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`mb-1 text-muted-foreground text-xs`,children:`Payload`}),(0,Q.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-md bg-muted p-2 text-xs`,children:JSON.stringify(e.payload,null,2)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`mb-1 text-muted-foreground text-xs`,children:`Source`}),(0,Q.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-md bg-muted p-2 text-xs`,children:JSON.stringify(e.source,null,2)})]})]})]},e.id))}):(0,Q.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No signal emissions recorded.`})]}):null,(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`mb-2 font-medium text-sm`,children:`Dependencies`}),(0,Q.jsx)(we,{empty:`This is a root task.`,nodes:c})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`mb-2 font-medium text-sm`,children:`Dependents`}),(0,Q.jsx)(we,{empty:`This is a terminal task.`,nodes:l})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`mb-2 font-medium text-sm`,children:`Workflow Timeline`}),(0,Q.jsxs)(`ol`,{className:`space-y-3`,children:[(0,Q.jsxs)(`li`,{className:`relative grid grid-cols-[0.875rem_1fr] gap-3 after:absolute after:top-[0.4375rem] after:left-[0.40625rem] after:h-[calc(100%+0.75rem)] after:w-px after:bg-border after:content-['']`,children:[ee?(0,Q.jsx)(P,{"aria-hidden":`true`,className:`relative z-10 size-3.5 bg-background text-success`}):(0,Q.jsx)(I,{"aria-hidden":`true`,className:`relative z-10 size-3.5 bg-background text-muted-foreground`}),(0,Q.jsx)(`p`,{className:`font-medium text-sm leading-3.5`,children:c.length?`${_} of ${c.length} dependencies completed`:`Root task staged`})]}),g?(0,Q.jsxs)(`li`,{className:`grid grid-cols-[0.875rem_1fr] gap-3`,children:[(0,Q.jsx)(P,{"aria-hidden":`true`,className:`relative z-10 size-3.5 bg-background text-success`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`font-medium text-sm leading-3.5`,children:f?.label??`Task completed`}),(0,Q.jsxs)(`p`,{className:`mt-1 text-muted-foreground text-xs`,children:[(0,Q.jsx)(U,{value:p?.at_ms??s.completed_at_ms}),p?` · revision ${p.revision}, generation ${p.generation}`:``]})]})]}):(0,Q.jsxs)(`li`,{className:`grid grid-cols-[0.875rem_1fr] gap-3`,children:[(0,Q.jsx)(I,{"aria-hidden":`true`,className:`relative z-10 size-3.5 bg-background text-warning`}),(0,Q.jsx)(`p`,{className:`font-medium text-sm leading-3.5`,children:`Waiting to complete`})]})]})]})]})}var Ee=new Set([`completed`,`archived`,`cancelled`,`undecodable`]);function De(e){return(e.endsWith(`_at_ms`)?e.slice(0,-3):e).replaceAll(`_`,` `)}function Oe(e,t){if(e.endsWith(`_at_ms`)){let n=typeof t==`number`?t:Number(t);if(Number.isSafeInteger(n)&&n>0)return{label:De(e),timestamp:n}}return{label:De(e),value:t==null?`—`:String(t)}}function $(e,t){return e.estimated_admission_ms==null?t:`Expected to clear in about ${ke(e.estimated_admission_ms)}.`}function ke(e){return e<1e3?`${Math.max(0,e)}ms`:e<6e4?`${Math.ceil(e/1e3)}s`:e<36e5?`${Math.ceil(e/6e4)}m`:`${Math.ceil(e/36e5)}h`}function Ae(e,t){if(e===`running`)return{description:`This job is running, so the admission decision has already been applied.`,title:`Already admitted`,tone:`success`};if(e===`pending`)return{description:`Pending jobs are held outside the admission gate until their producer, such as a workflow coordinator, promotes them.`,title:`Waiting for promotion`,tone:`warning`};if(e===`quarantined`)return{description:`An operator must release the quarantined fingerprint before this job can run.`,title:`Blocked by quarantine`,tone:`destructive`};if(Ee.has(e))return{description:`This job is ${e} and will not be considered by the admission gate.`,title:`Admission no longer applies`,tone:`muted`};if(t.admissible)return{description:`This job currently passes every admission policy.`,title:`Admissible now`,tone:`success`};switch(t.blocked_by){case`schedule`:return{description:$(t,`The job will become eligible at its scheduled time.`),title:`Waiting for schedule`,tone:`warning`};case`quarantine`:return{description:`An operator must release the quarantined fingerprint before this job can run.`,title:`Blocked by quarantine`,tone:`destructive`};case`queue_paused`:return{description:`An operator must resume the queue before this job can run.`,title:`Queue is paused`,tone:`warning`};case`rate_class`:return{description:$(t,`The rate class has no capacity; its configuration may require operator action.`),title:`Waiting for rate capacity`,tone:`warning`};case`concurrency_limit`:return{description:$(t,`This will clear when another running job releases capacity.`),title:`Waiting for concurrency capacity`,tone:`warning`};case`fairness`:return{description:$(t,`The job remains visible while other partitions receive their fair share.`),title:`Waiting for its partition turn`,tone:`warning`};default:return{description:`The API reported that this job is not admissible but did not identify a blocking policy.`,title:`Admission decision unavailable`,tone:`warning`}}}var je=new Set([`pending`,`available`,`scheduled`,`retryable`,`running`,`completed`,`archived`,`cancelled`,`undecodable`,`quarantined`]),Me=new Set([`pending`,`available`,`scheduled`,`running`]);function Ne(e,t){if(!je.has(e))return`Job state “${e}” is not recognized.`;switch(t){case`retry`:return e===`archived`||e===`cancelled`?null:`Retry is available only for archived or cancelled jobs.`;case`cancel`:return Me.has(e)?null:`Cancel is available only for pending, available, scheduled, or running jobs.`;case`reschedule`:return e===`scheduled`||e===`retryable`?null:`Reschedule is available only for scheduled or retryable jobs.`;case`delete`:return e===`running`?`Cancel a running job before deleting it.`:null;default:return`Unknown job action.`}}function Pe(e){try{let t=Uint8Array.from(atob(e),e=>e.charCodeAt(0));if(t.length>=7&&t[0]===72&&t[1]===71&&t[2]===69&&t[3]===67){let[,,,,n,r,i]=t,a=r*256+i,o=7+a;if(n===1&&a>0&&o+12+16<=t.length)return{content:e,encrypted:{keyId:new TextDecoder(`utf-8`,{fatal:!0}).decode(t.slice(7,o)),version:n},format:`Encrypted`}}let n=new TextDecoder(`utf-8`,{fatal:!0}).decode(t);try{return{content:JSON.stringify(JSON.parse(n),null,2),format:`JSON`}}catch{return{content:n,format:`Text`}}}catch{return{content:e,format:`Base64`}}}function Fe(e){return e.completed_steps.length>0||e.in_progress_step!=null||e.cursor_step!=null||e.cursor!=null||e.schema_version>0||e.step_set_hash.length>0||Object.keys(e.crashes_by_step).length>0}var Ie=[`available`,`scheduled`,`retryable`,`running`,`completed`,`archived`,`cancelled`,`undecodable`,`quarantined`],Le=new Set([`completed`,`archived`,`cancelled`,`undecodable`,`quarantined`]);function Re(e,t){let n=Le.has(e.state),r=e.state===`scheduled`&&(e.scheduled_at_ms??0)>t,i=!n&&e.state!==`running`&&!r,a=Math.max(e.enqueued_at_ms??0,e.scheduled_at_ms??0),o=e.claimed_at_ms??null,s=o&&a?Math.max(0,o-a):null,c=e.claimed_at_ms&&e.finalized_at_ms?Math.max(0,e.finalized_at_ms-e.claimed_at_ms):null;return[{at:e.enqueued_at_ms,icon:J,label:`Created`,status:`complete`},{at:e.scheduled_at_ms,detail:r?`Waiting for schedule`:void 0,icon:R,label:`Scheduled`,status:r?`waiting`:`complete`},{at:o,detail:s==null?i?G(Math.max(0,t-a)):void 0:G(s),icon:pe,label:`Wait`,status:i?`waiting`:r?`pending`:`complete`},{at:e.claimed_at_ms,detail:c==null?e.state===`running`&&e.claimed_at_ms?G(t-e.claimed_at_ms):void 0:G(c),icon:B,label:`Running`,status:e.state===`running`?`active`:n?e.state===`completed`?`complete`:`failed`:`pending`},{at:e.finalized_at_ms,icon:u,label:n?e.state[0].toUpperCase()+e.state.slice(1):`Complete`,status:n?e.state===`completed`?`complete`:`failed`:`pending`}]}function ze(e,t){return e?`${G(Math.max(0,t-e))} ago`:null}function Be(e){return e===`complete`?{line:`bg-success`,node:`border-success bg-success text-white`}:e===`active`?{line:`bg-border`,node:`border-primary bg-primary text-primary-foreground`}:e===`waiting`?{line:`bg-border`,node:`border-warning bg-warning text-white`}:e===`failed`?{line:`bg-destructive`,node:`border-destructive bg-destructive text-white`}:{line:`bg-border`,node:`border-border bg-background text-muted-foreground`}}function Ve(e){return e===`running`?`success`:e===`retryable`||e===`scheduled`?`warning`:[`archived`,`cancelled`,`undecodable`,`quarantined`].includes(e)?`destructive`:`outline`}function He({id:e,open:t,setOpen:n,notify:r,workflowId:i}){let l=e===null?null:`/jobs/${encodeURIComponent(e)}`,p=ee(),g=H(),_=S([`api`,`job`,e],e=>l===null?Promise.reject(Error(`Job ID is required.`)):m(`${l}?include_payload=true`,{signal:e}),!!(e&&t)),v=S([`api`,`job-admission`,e],e=>l===null?Promise.reject(Error(`Job ID is required.`)):m(`${l}/admission`,{signal:e}),!!(e&&t)),y=_.data??null,b=S([`api`,`job-progress`,e],e=>l===null?Promise.reject(Error(`Job ID is required.`)):m(`${l}/progress`,{signal:e}),!!(e&&t&&y?.state===`running`)),C=S([`api`,`job-checkpoint`,e],e=>l===null?Promise.reject(Error(`Job ID is required.`)):m(`${l}/checkpoint`,{signal:e}),!!(e&&t)),w=v.data??null,T=b.data??null,E=C.data??null,O=C.error?C.error instanceof Error?C.error.message:String(C.error):null,k=_.error?_.error instanceof Error?_.error.message:String(_.error):null,A=p.variables?.path,j=(0,X.useMemo)(()=>{if(!y?.errors)return[];if(Array.isArray(y.errors))return y.errors;try{return JSON.parse(y.errors)}catch{return[]}},[y?.errors]),M=(0,X.useMemo)(()=>y?.payload==null?null:Pe(y.payload),[y?.payload]),N=y?.metadata??null,re=(0,X.useMemo)(()=>y?Re(y,g):[],[y,g]),P=(0,X.useMemo)(()=>y&&w?Ae(y.state,w):null,[y,w]),F=(0,X.useMemo)(()=>E?.cursor?Pe(E.cursor):null,[E?.cursor]),I=async(e,t)=>{try{await navigator.clipboard.writeText(t),r(`${e} copied`)}catch{r(`Could not copy ${e.toLowerCase()}`,`error`)}},L=async t=>{if(e&&!(t===`delete`&&!window.confirm(`Delete job ${e}? This cannot be undone.`)))try{await p.mutateAsync({method:t===`delete`?`DELETE`:`POST`,path:`/jobs/${encodeURIComponent(e)}${t===`delete`?``:`/${t}`}`}),r(t===`delete`?`Job deleted`:`Job ${t===`retry`?`retried`:`cancelled`}`),n(!1)}catch(e){r(e instanceof Error?e.message:String(e),`error`)}};return(0,Q.jsx)(s,{onOpenChange:n,open:t,children:(0,Q.jsxs)(f,{className:`w-full gap-0 overflow-hidden p-0 data-[side=left]:sm:max-w-2xl data-[side=right]:sm:max-w-2xl`,children:[(0,Q.jsxs)(x,{className:`shrink-0 border-b p-4 pr-14`,children:[(0,Q.jsx)(d,{className:`break-all font-mono`,children:e}),(0,Q.jsx)(ne,{children:`Job detail, admission decision, progress, and attempt history.`})]}),k?(0,Q.jsx)(`div`,{className:`p-4`,children:(0,Q.jsx)(D,{message:k})}):null,y||k?null:(0,Q.jsx)(`div`,{className:`p-4`,children:(0,Q.jsx)(te,{})}),y&&(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-4`,children:[(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[8rem_1fr] gap-x-3 gap-y-2 text-sm`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Kind`}),(0,Q.jsxs)(`dd`,{children:[y.kind,` `,(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[`v`,y.schema_version]})]}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`State`}),(0,Q.jsx)(`dd`,{children:(0,Q.jsx)(o,{variant:Ve(y.state),children:y.state})}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Queue / partition`}),(0,Q.jsxs)(`dd`,{children:[y.queue,` / `,y.partition_key||`—`]}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Rate class`}),(0,Q.jsx)(`dd`,{children:y.rate_class||`—`}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Priority / weight`}),(0,Q.jsxs)(`dd`,{children:[y.priority,` / `,y.weight??1]}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Sticky worker`}),(0,Q.jsx)(`dd`,{className:`break-all font-mono text-xs`,children:y.sticky_worker||`—`}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Attempts`}),(0,Q.jsxs)(`dd`,{children:[y.attempt,`/`,y.max_attempts,` · crashes`,` `,y.crash_attempt??0]}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Orphan provenance`}),(0,Q.jsx)(`dd`,{children:y.orphaned?(0,Q.jsx)(`span`,{className:`text-destructive`,children:`Reclaimed after an expired lease`}):`None`}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Fingerprint`}),(0,Q.jsx)(`dd`,{className:`break-all font-mono text-xs`,children:y.fingerprint}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Enqueued`}),(0,Q.jsx)(`dd`,{children:(0,Q.jsx)(U,{value:y.enqueued_at_ms})}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Scheduled`}),(0,Q.jsx)(`dd`,{children:(0,Q.jsx)(U,{value:y.scheduled_at_ms})}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Finalized`}),(0,Q.jsx)(`dd`,{children:(0,Q.jsx)(U,{value:y.finalized_at_ms})}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Periodic origin`}),(0,Q.jsx)(`dd`,{children:y.periodic_origin?(0,Q.jsxs)(Q.Fragment,{children:[y.periodic_origin.schedule_id,` ·`,` `,(0,Q.jsx)(U,{value:y.periodic_origin.tick_ms})]}):`—`})]}),i&&e?(0,Q.jsx)(Te,{jobId:e,workflowId:i}):null,(0,Q.jsxs)(`section`,{"aria-labelledby":`lifecycle-title`,children:[(0,Q.jsx)(`h2`,{className:`mb-3 font-semibold text-sm`,id:`lifecycle-title`,children:`Lifecycle`}),(0,Q.jsx)(`ol`,{className:`space-y-0`,children:re.map((e,t)=>{let n=e.icon,r=Be(e.status);return(0,Q.jsxs)(`li`,{"aria-current":[`active`,`waiting`].includes(e.status)?`step`:void 0,className:`fade-in slide-in-from-top-1 zoom-in-95 relative flex animate-in gap-3 pb-4 last:pb-0 motion-reduce:animate-none`,style:{animationDelay:`${t*90}ms`,animationFillMode:`both`},children:[tvoid I(M.encrypted?`Ciphertext`:`Payload`,M.content),size:`sm`,variant:`ghost`,children:[(0,Q.jsx)(q,{}),`Copy`]})]}),M?.encrypted&&(0,Q.jsxs)(`div`,{className:`mb-2 flex gap-3 rounded-lg border border-primary/20 bg-primary/5 p-3 text-sm`,children:[(0,Q.jsx)(me,{className:`mt-0.5 size-4 shrink-0 text-primary`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`font-medium`,children:`AES-256-GCM encrypted payload`}),(0,Q.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Format v`,M.encrypted.version,` · key`,` `,(0,Q.jsx)(`code`,{children:M.encrypted.keyId}),`. The console has no decryption keys; plaintext is available only inside the encrypted worker handler.`]})]})]}),M?(0,Q.jsx)(`pre`,{className:`wrap-break-word max-h-80 overflow-auto whitespace-pre-wrap rounded-lg border bg-muted/50 p-3 font-mono text-xs`,children:M.content}):(0,Q.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No payload stored.`})]}),(0,Q.jsxs)(`section`,{"aria-labelledby":`metadata-title`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h2`,{className:`font-semibold text-sm`,id:`metadata-title`,children:`Metadata`}),N&&(0,Q.jsxs)(h,{onClick:()=>void I(`Metadata`,JSON.stringify(N,null,2)),size:`sm`,variant:`ghost`,children:[(0,Q.jsx)(q,{}),`Copy`]})]}),y.tags?.length?(0,Q.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1`,children:y.tags.map(e=>(0,Q.jsx)(o,{variant:`outline`,children:e},e))}):null,N&&Object.keys(N).length?(0,Q.jsx)(`pre`,{className:`wrap-break-word max-h-80 overflow-auto whitespace-pre-wrap rounded-lg border bg-muted/50 p-3 font-mono text-xs`,children:JSON.stringify(N,null,2)}):(0,Q.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No application metadata stored.`})]}),(0,Q.jsxs)(`section`,{"aria-labelledby":`progress-title`,children:[(0,Q.jsx)(`h2`,{className:`mb-2 font-semibold text-sm`,id:`progress-title`,children:`Progress`}),T?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-sm`,children:[(0,Q.jsxs)(`strong`,{children:[(T.total>0?Math.min(100,Math.max(0,T.current*100/T.total)):0).toFixed(0),`%`]}),(0,Q.jsxs)(`span`,{className:`font-mono text-xs`,children:[T.current,` / `,T.total]}),(0,Q.jsx)(`span`,{children:T.message})]}),(0,Q.jsx)(V,{"aria-label":`Job progress`,value:T.total>0?T.current*100/T.total:0}),(0,Q.jsxs)(`p`,{className:`mt-1 text-muted-foreground text-xs`,children:[`Updated `,(0,Q.jsx)(U,{value:T.updated_at_ms}),` · attempt fence `,T.fence]})]}):(0,Q.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No progress reported.`})]}),(0,Q.jsxs)(`section`,{"aria-labelledby":`resumable-title`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h2`,{className:`font-semibold text-sm`,id:`resumable-title`,children:`Resumable execution`}),E&&Fe(E)&&(0,Q.jsxs)(o,{variant:`outline`,children:[`checkpoint v`,E.schema_version||`—`]})]}),C.isPending?(0,Q.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Loading checkpoint…`}):O?(0,Q.jsx)(D,{message:O}):E&&Fe(E)?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`ol`,{"aria-label":`Persisted resumable steps`,className:`space-y-2`,children:[E.completed_steps.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`flex size-6 items-center justify-center rounded-full bg-success text-white`,children:(0,Q.jsx)(u,{className:`size-3.5`})}),(0,Q.jsx)(`span`,{className:`font-medium`,children:e}),(0,Q.jsx)(o,{variant:`success`,children:`completed`})]},`completed:${e}`)),E.in_progress_step&&(0,Q.jsxs)(`li`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`flex size-6 items-center justify-center rounded-full bg-primary text-primary-foreground`,children:(0,Q.jsx)(B,{className:`size-3.5`})}),(0,Q.jsx)(`span`,{className:`font-medium`,children:E.in_progress_step}),(0,Q.jsx)(o,{variant:`warning`,children:`checkpointed before side effects`})]})]}),(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Only persisted completed/current steps are shown. Future handler steps are not stored with the job.`}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[7rem_1fr] gap-x-3 gap-y-1 text-xs`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Last completed`}),(0,Q.jsx)(`dd`,{children:E.last_completed_step??`—`}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Cursor step`}),(0,Q.jsx)(`dd`,{children:E.cursor_step??`—`}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Step-set hash`}),(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:E.step_set_hash||`—`})]}),Object.keys(E.crashes_by_step).length>0&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`mb-1 font-medium text-xs`,children:`Crashes by step`}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.entries(E.crashes_by_step).map(([e,t])=>(0,Q.jsxs)(o,{variant:`destructive`,children:[e,`: `,t]},e))})]}),F&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(`p`,{className:`font-medium text-xs`,children:[`Durable cursor`,` `,(0,Q.jsx)(o,{variant:`outline`,children:F.format})]}),(0,Q.jsxs)(h,{onClick:()=>void I(`Cursor`,F.content),size:`sm`,variant:`ghost`,children:[(0,Q.jsx)(q,{}),`Copy`]})]}),(0,Q.jsx)(`p`,{className:`mb-2 text-muted-foreground text-xs`,children:`Cursor data is explicitly loaded and may contain application-sensitive values.`}),(0,Q.jsx)(`pre`,{className:`wrap-break-word max-h-52 overflow-auto whitespace-pre-wrap rounded-lg border bg-muted/50 p-3 font-mono text-xs`,children:F.content})]})]}):(0,Q.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No resumable checkpoint has been recorded for this job.`})]}),w&&P&&(0,Q.jsxs)(`section`,{"aria-labelledby":`admission-title`,children:[(0,Q.jsx)(`h2`,{className:`mb-2 font-semibold text-sm`,id:`admission-title`,children:`Admission`}),(0,Q.jsx)(`p`,{className:P.tone===`success`?`text-success`:P.tone===`destructive`?`text-destructive`:P.tone===`warning`?`text-warning`:`text-muted-foreground`,children:P.title}),(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:P.description}),(0,Q.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:Object.entries(w.detail??{}).map(([e,t])=>{let n=Oe(e,t);return(0,Q.jsxs)(o,{variant:`outline`,children:[n.label,`:`,` `,n.timestamp===void 0?n.value:(0,Q.jsx)(U,{value:n.timestamp})]},e)})})]}),(0,Q.jsxs)(`section`,{"aria-labelledby":`timeline-title`,children:[(0,Q.jsx)(`h2`,{className:`mb-2 font-semibold text-sm`,id:`timeline-title`,children:`Attempts`}),j.length?(0,Q.jsx)(`ol`,{className:`ml-1 border-l pl-4`,children:j.map(e=>(0,Q.jsxs)(`li`,{className:`mb-4 last:mb-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(o,{variant:Ve(e.outcome),children:e.outcome}),(0,Q.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[(0,Q.jsx)(U,{value:e.at_ms}),e.attempt==null?``:` · attempt ${e.attempt}`,e.crash_attempt==null?``:` · crash ${e.crash_attempt}`]})]}),e.error&&(0,Q.jsx)(`p`,{className:`mt-1 text-sm`,children:e.error}),e.logs&&e.logs.length>0?(0,Q.jsx)(Se,{logs:e.logs}):null]},`${e.at_ms}:${e.outcome}:${e.attempt??`none`}:${e.crash_attempt??`none`}`))}):(0,Q.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No attempts recorded.`})]})]}),y?(0,Q.jsx)(a,{className:`shrink-0 border-t bg-background p-4`,children:(0,Q.jsxs)(`section`,{"aria-labelledby":`actions-title`,className:`w-full`,children:[(0,Q.jsx)(`h2`,{className:`mb-2 font-semibold text-sm`,id:`actions-title`,children:`Actions`}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[{action:`retry`,label:`Retry`,pendingLabel:`Retrying…`,run:()=>L(`retry`),variant:`outline`},{action:`cancel`,label:`Cancel`,pendingLabel:`Cancelling…`,run:()=>L(`cancel`),variant:`outline`},{action:`reschedule`,label:`Reschedule`,pendingLabel:`Rescheduling…`,run:async()=>{if(!e)return;let t=window.prompt(`Run at (milliseconds since Unix epoch)`);if(t)try{await p.mutateAsync({body:{scheduled_at_ms:Number(t)},path:`/jobs/${encodeURIComponent(e)}/reschedule`}),r(`Job rescheduled`),n(!1)}catch(e){r(e instanceof Error?e.message:String(e),`error`)}},variant:`outline`},{action:`delete`,label:`Delete`,pendingLabel:`Deleting…`,run:()=>L(`delete`),variant:`destructive`}].map(t=>{let n=Ne(y.state,t.action),r=p.isPending&&(t.action===`delete`?A===`/jobs/${encodeURIComponent(e??``)}`:A?.endsWith(`/${t.action}`));return(0,Q.jsx)(`span`,{title:n??void 0,children:(0,Q.jsx)(z,{disabled:c.readOnly||p.isPending||!!n,onClick:()=>void t.run(),pending:r,pendingLabel:t.pendingLabel,variant:t.variant,children:t.label})},t.action)})})]})}):null]})})}function Ue({notify:e}){let t=k.useSearch(),n=k.useNavigate(),a=r(),s=ee(),l=ee(),[u,d]=(0,X.useState)(t.q??``),[f,g]=(0,X.useState)(t.queue??``),[x,ne]=(0,X.useState)(t.state??``),[S,A]=(0,X.useState)(()=>new Set),[j,N]=(0,X.useState)(`retry`),[P,F]=(0,X.useState)(`cancel`),[I,L]=(0,X.useState)(``),[R,B]=(0,X.useState)(null),V=new URLSearchParams({limit:`50`});t.q&&V.set(`q`,t.q),t.queue&&V.set(`queue`,t.queue),t.state&&V.set(`state`,t.state),t.cursor&&V.set(`cursor`,t.cursor);let{data:H,error:G,loading:de}=T(`/jobs?${V}`),fe=t.queue?`?queue=${encodeURIComponent(t.queue)}`:``,q=T(`/jobs/counts${fe}`),J=(0,X.useMemo)(()=>{if(!t.cursorTrail)return[];try{let e=JSON.parse(t.cursorTrail);return Array.isArray(e)&&e.every(e=>e===null||typeof e==`string`)?e:[]}catch{return[]}},[t.cursorTrail]),Y=!!(t.queue||t.state),pe=e=>{e.preventDefault(),n({search:{q:u||void 0,queue:f||void 0,state:x||void 0}})},me=()=>{if(!J.length)return;let e=J.at(-1)??void 0,t=J.slice(0,-1);n({search:n=>({...n,cursor:e,cursorTrail:t.length?JSON.stringify(t):void 0})})},ge=()=>{H?.next_cursor&&n({search:e=>({...e,cursor:H.next_cursor,cursorTrail:JSON.stringify([...J,t.cursor??null])})})},_e=async()=>{let t=[...S];if(t.length&&!([`delete`,`cancel`].includes(j)&&!window.confirm(`${j} ${t.length} selected job(s)?`)))try{let n=await s.mutateAsync({body:{action:j,ids:t},path:`/jobs/actions`}),r=n.succeeded?.length??0,i=n.failed?.length??0;e(`${j}: ${r} succeeded${i?`, ${i} failed`:``}`,i?`error`:`normal`),A(new Set)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},Z=async n=>{let r={};if(t.queue&&(r.queue=t.queue),t.state&&(r.state=t.state),!Object.keys(r).length){e(`Set a queue or state filter before using bulk actions.`,`error`);return}if(n||window.confirm(`${P.toUpperCase()} every job matching ${JSON.stringify(r)}?`)){B(n?`dry-run`:`apply`);try{let t=await l.mutateAsync({body:{action:P,dry_run:n,selector:r},path:`/jobs/bulk`});if(n){L(`Dry run: approximately ${t.total_estimated} job(s) match.`);return}L(`Operation ${t.id} is running…`);let i=Date.now();for(;Date.now()-i<6e4;){await new Promise(e=>window.setTimeout(e,800));let n=await a.fetchQuery({queryFn:({signal:e})=>m(`/operations/${encodeURIComponent(t.id)}`,{signal:e}),queryKey:[`api`,`operation`,t.id],staleTime:0});if(L(`${n.status} · ${n.affected} affected`),[`completed`,`failed`].includes(n.status)){e(n.status===`completed`?`Bulk ${P}: ${n.affected} affected`:`Bulk operation failed: ${n.error??`unknown error`}`,n.status===`failed`?`error`:`normal`);return}}e(`The operation is still running; check it again later.`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}finally{B(null)}}};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mb-4`,children:[(0,Q.jsx)(`h1`,{className:`font-semibold text-lg`,children:`Jobs`}),(0,Q.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Search, inspect admission decisions, and perform bounded control actions.`})]}),(0,Q.jsxs)(`nav`,{"aria-label":`Job state`,className:`mb-4 flex gap-2 overflow-x-auto pb-1`,children:[(0,Q.jsx)(h,{onClick:()=>void n({search:e=>({...e,cursor:void 0,cursorTrail:void 0,state:void 0})}),size:`sm`,variant:t.state?`outline`:`secondary`,children:`All`}),Ie.map(e=>(0,Q.jsxs)(h,{onClick:()=>void n({search:t=>({...t,cursor:void 0,cursorTrail:void 0,state:e})}),size:`sm`,variant:t.state===e?`secondary`:`outline`,children:[e,(0,Q.jsx)(o,{variant:`outline`,children:q.data?.counts[e]??0})]},e))]}),q.data?.approximate&&(0,Q.jsx)(`div`,{className:`flex`,children:(0,Q.jsx)(`span`,{className:`self-center text-muted-foreground text-xs`,children:`Counts are approximate`})}),(0,Q.jsx)(le,{children:(0,Q.jsxs)(oe,{className:`space-y-3 pt-4`,children:[(0,Q.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:pe,children:[(0,Q.jsxs)(`div`,{className:`grid gap-1`,children:[(0,Q.jsx)(_,{htmlFor:`job-query`,children:`Search`}),(0,Q.jsx)(p,{autoComplete:`off`,className:`w-72`,id:`job-query`,name:`query`,onChange:e=>d(e.target.value),placeholder:`e.g. kind:EmailSender queue:default…`,value:u})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1`,children:[(0,Q.jsx)(_,{htmlFor:`job-queue`,children:`Queue`}),(0,Q.jsx)(p,{autoComplete:`off`,className:`w-36`,id:`job-queue`,name:`queue`,onChange:e=>g(e.target.value),spellCheck:!1,value:f})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1`,children:[(0,Q.jsx)(_,{htmlFor:`job-state`,children:`State`}),(0,Q.jsxs)(O,{onValueChange:e=>ne(e===`all`||e==null?``:e),value:x||`all`,children:[(0,Q.jsx)(C,{className:`w-40`,id:`job-state`,children:(0,Q.jsx)(b,{children:x||`All states`})}),(0,Q.jsx)(v,{children:(0,Q.jsxs)(y,{children:[(0,Q.jsx)(E,{value:`all`,children:`All states`}),Ie.map(e=>(0,Q.jsx)(E,{value:e,children:e},e))]})})]})]}),(0,Q.jsxs)(h,{type:`submit`,children:[(0,Q.jsx)(he,{}),`Search`]}),(0,Q.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[(0,Q.jsxs)(h,{disabled:!J.length,onClick:me,variant:`outline`,children:[(0,Q.jsx)(re,{}),`Previous`]}),(0,Q.jsxs)(h,{disabled:!H?.next_cursor,onClick:ge,variant:`outline`,children:[`Next`,(0,Q.jsx)(M,{})]})]})]}),S.size>0?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t pt-3`,children:[(0,Q.jsxs)(`strong`,{className:`mr-1 text-sm`,children:[`Actions for `,S.size,` selected job`,S.size===1?``:`s`]}),(0,Q.jsxs)(O,{onValueChange:e=>e&&N(e),value:j,children:[(0,Q.jsx)(C,{"aria-label":`Action for selected jobs`,className:`w-36`,children:(0,Q.jsx)(b,{children:j[0].toUpperCase()+j.slice(1)})}),(0,Q.jsx)(v,{children:(0,Q.jsxs)(y,{children:[(0,Q.jsx)(E,{value:`retry`,children:`Retry`}),(0,Q.jsx)(E,{value:`archive`,children:`Archive`}),(0,Q.jsx)(E,{value:`cancel`,children:`Cancel`}),(0,Q.jsx)(E,{value:`delete`,children:`Delete`})]})})]}),(0,Q.jsx)(z,{disabled:c.readOnly,onClick:()=>void _e(),pending:s.isPending,pendingLabel:`Applying…`,size:`sm`,variant:[`cancel`,`delete`].includes(j)?`destructive`:`default`,children:`Apply to selected`}),(0,Q.jsx)(h,{onClick:()=>A(new Set),size:`sm`,variant:`ghost`,children:`Clear selection`})]}):(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 border-t pt-3`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-1`,children:[(0,Q.jsx)(_,{htmlFor:`bulk-action`,children:`Bulk action for current queue/state filter`}),(0,Q.jsxs)(O,{onValueChange:e=>e&&F(e),value:P,children:[(0,Q.jsx)(C,{className:`w-36`,id:`bulk-action`,children:(0,Q.jsx)(b,{children:P[0].toUpperCase()+P.slice(1)})}),(0,Q.jsx)(v,{children:(0,Q.jsxs)(y,{children:[(0,Q.jsx)(E,{value:`cancel`,children:`Cancel`}),(0,Q.jsx)(E,{value:`retry`,children:`Retry`}),(0,Q.jsx)(E,{value:`delete`,children:`Delete`})]})})]})]}),(0,Q.jsx)(z,{disabled:c.readOnly||R!==null||!Y,onClick:()=>void Z(!0),pending:R===`dry-run`,pendingLabel:`Checking…`,variant:`outline`,children:`Dry run`}),(0,Q.jsx)(z,{disabled:c.readOnly||R!==null||!Y,onClick:()=>void Z(!1),pending:R===`apply`,pendingLabel:`Applying…`,variant:[`cancel`,`delete`].includes(P)?`destructive`:`default`,children:`Apply`}),(0,Q.jsx)(`p`,{"aria-live":`polite`,className:`text-muted-foreground text-sm`,children:Y?I:`Choose a queue or state filter to enable filter-wide actions.`})]}),de&&!H?(0,Q.jsx)(te,{}):G?(0,Q.jsx)(D,{message:G}):H?.jobs.length?(0,Q.jsxs)(ue,{children:[(0,Q.jsx)(ae,{children:(0,Q.jsxs)(ce,{children:[(0,Q.jsx)(W,{children:(0,Q.jsx)(ie,{"aria-label":`Select all visible jobs`,checked:H.jobs.length>0&&H.jobs.every(e=>S.has(e.id)),onCheckedChange:e=>A(e?new Set(H.jobs.map(e=>e.id)):new Set)})}),(0,Q.jsx)(W,{children:`ID`}),(0,Q.jsx)(W,{children:`Kind`}),(0,Q.jsx)(W,{children:`Queue`}),(0,Q.jsx)(W,{children:`State`}),(0,Q.jsx)(W,{children:`Attempt`}),(0,Q.jsx)(W,{children:`Scheduled`})]})}),(0,Q.jsx)(se,{children:H.jobs.map(e=>(0,Q.jsxs)(ce,{children:[(0,Q.jsx)(K,{children:(0,Q.jsx)(ie,{"aria-label":`Select job ${e.id}`,checked:S.has(e.id),onCheckedChange:t=>A(n=>{let r=new Set(n);return t?r.add(e.id):r.delete(e.id),r})})}),(0,Q.jsx)(K,{children:(0,Q.jsx)(i,{"aria-label":`Inspect job ${e.id}`,className:`font-mono text-primary text-xs hover:underline`,params:{jobId:e.id},search:e=>e,to:`/jobs/$jobId`,children:e.id})}),(0,Q.jsx)(K,{children:e.kind}),(0,Q.jsx)(K,{children:e.queue}),(0,Q.jsxs)(K,{children:[(0,Q.jsx)(o,{variant:Ve(e.state),children:e.state}),e.orphaned&&(0,Q.jsx)(`span`,{className:`ml-2 text-destructive text-xs`,children:`orphan-reclaimed`})]}),(0,Q.jsxs)(K,{children:[e.attempt,`/`,e.max_attempts,e.crash_attempt?(0,Q.jsxs)(`span`,{className:`ml-1 text-destructive`,children:[`+`,e.crash_attempt,` crash`]}):null]}),(0,Q.jsx)(K,{className:`text-muted-foreground`,children:(0,Q.jsx)(U,{value:e.scheduled_at_ms})})]},e.id))})]}):(0,Q.jsx)(w,{children:`No jobs match this search.`})]})})]})}export{Ue as n,He as t}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/play-BC4ZZCx4.js b/go/headgateui/dist/assets/play-B9gqZXeA.js similarity index 64% rename from go/headgateui/dist/assets/play-BC4ZZCx4.js rename to go/headgateui/dist/assets/play-B9gqZXeA.js index 6330365..b092057 100644 --- a/go/headgateui/dist/assets/play-BC4ZZCx4.js +++ b/go/headgateui/dist/assets/play-B9gqZXeA.js @@ -1 +1 @@ -import{X as e}from"./console-C2t3Lr2f.js";var t=e(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]);export{t}; \ No newline at end of file +import{X as e}from"./console-COYwGlau.js";var t=e(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]);export{t}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/progress-BbTEfjhw.js b/go/headgateui/dist/assets/progress-BbTEfjhw.js deleted file mode 100644 index b6af281..0000000 --- a/go/headgateui/dist/assets/progress-BbTEfjhw.js +++ /dev/null @@ -1 +0,0 @@ -import{c as e,d as t,o as n,t as r}from"./utils-o8v-URZ_.js";import{Ft as i,I as a,L as o,Ot as s,Q as c,Tt as l,X as u,Zt as d,b as ee,dn as f,fn as p,gn as m,h,hn as g,mn as _,vt as v,yt as y}from"./theme-6NkSfuJL.js";import{F as b,H as x,I as te,J as S,L as ne,M as re,P as ie,R as ae,V as oe,g as C,z as se}from"./console-C2t3Lr2f.js";var w=t(e(),1);function ce(e,t,n,r=!0,i){let[a,o]=w.useState(),s=h(i?`${i}-label`:void 0),c=e??t??a;return p(()=>{let i=e||t||!r?void 0:le(n.current,s);a!==i&&o(i)}),c}function le(e,t){let n=ue(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function ue(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}var T=w.createContext({disabled:!1});function de(){return w.useContext(T)}function fe(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}function pe(e){return{checked(t){return e.indeterminate?{}:t?{"data-checked":``}:{"data-unchecked":``}},...se}}var E=w.createContext(void 0);function me(){return w.useContext(E)}var he=w.createContext(void 0);function ge(){let e=w.useContext(he);if(e===void 0)throw Error(f(14));return e}var D=n(),_e=`data-parent`,O=w.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:a=!1,"aria-labelledby":o,disabled:ee=!1,form:f,id:S,indeterminate:C=!1,inputRef:se,name:le,onCheckedChange:ue,parent:T=!1,readOnly:E=!1,render:ge,required:O=!1,uncheckedValue:k,value:A,nativeButton:j=!1,style:ve,...ye}=e,{clearErrors:M}=ne(),{disabled:be,name:N,setDirty:P,setFilled:F,setFocused:I,setTouched:xe,state:L,validationMode:Se,validityData:Ce,validation:we}=ae(),Te=de(),{labelId:Ee,controlId:De,registerControlId:R,getDescriptionProps:Oe}=te(),z=me(),B=z?.allValues===void 0?void 0:z.parent,V=B!==void 0,H=be||Te.disabled||z?.disabled||ee,U=N??le,W=A??U,ke=h(),Ae=h(),G=S||De;V&&(T?G=Ae:W===void 0?G||=Ae:G=`${B.id}-${W}`);let K={};V&&(T?K=B.getParentProps():W!==void 0&&(K=B.getChildProps(W)));let{checked:je=n,indeterminate:Me=C,onCheckedChange:Ne,...Pe}=K,q=z?.value,J=w.useRef(null),Y=m(()=>Symbol()),Fe=w.useRef(!1),{getButtonProps:Ie,buttonRef:Le}=oe({disabled:H,native:j}),X=z?.validation??we,[Z,Re]=b({controlled:W!==void 0&&q!==void 0&&!T?q.includes(W):je,default:a,name:`Checkbox`,state:`checked`}),ze=V?!!je:Z,Q=V&&Me||C;p(()=>{R!==g&&(Fe.current=!0,R(Y.current,G))},[G,R,Y]),w.useEffect(()=>{let e=Y.current;return()=>{!Fe.current||R===g||(Fe.current=!1,R(e,void 0))}},[R,Y]),ie(J,ke,Z,void 0,!z&&!H,le);let $=w.useRef(null),Be=X.registerInput,Ve=z?W:void 0,He=w.useCallback(e=>Be(e,{controlRef:J,value:Ve}),[Be,Ve]),Ue=l(se,$,T?void 0:He),We=ce(o,Ee,$,!j,G??void 0);p(()=>{$.current&&($.current.indeterminate=Q,Z&&F(!0))},[Z,Q,F]),re(Z,()=>{z||(M(U),F(Z),P(Z!==Ce.initialValue),X.change(Z))});let Ge=c({checked:Z,disabled:H,form:f,name:T?void 0:U,id:j?void 0:G??void 0,required:O,ref:Ue,style:U?y:v,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(E){e.preventDefault();return}let t=e.currentTarget.checked,n=s(i,e.nativeEvent);if(ue?.(t,n),!n.isCanceled&&(Ne?.(t,n),!n.isCanceled&&(Re(t),W!==void 0&&z!==void 0&&!T&&!V))){let e=t?[...z.value,W]:z.value.filter(e=>e!==W);z.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){J.current?.focus()}},A===void 0?_:{value:(z?Z&&A:A)||``},Oe,e=>X.getValidationProps(H,e));w.useEffect(()=>{if(!B||W===void 0)return;let e=B.disabledStatesRef.current;return e.set(W,H),()=>{e.delete(W)}},[B,H,W]);let Ke=w.useMemo(()=>({...L,checked:ze,disabled:H,readOnly:E,required:O,indeterminate:Q}),[L,ze,H,E,O,Q]),qe=pe(Ke),Je=u(`span`,e,{state:Ke,ref:[Le,J,t],props:[{id:j?G??void 0:ke,role:`checkbox`,"aria-checked":Q?`mixed`:ze,"aria-readonly":E||void 0,"aria-required":O||void 0,"aria-labelledby":We,[_e]:T?``:void 0,onFocus(){H||I(!0)},onBlur(){let e=$.current;e&&(xe(!0),I(!1),Se===`onBlur`&&X.commit(z?q:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=$.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),d(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||fe(t)?.click()})},onClick(e){if(E||H)return;e.preventDefault();let t=$.current;t&&x(t,e)}},ye,Pe,Ie,Oe,e=>X.getValidationProps(H,e)],stateAttributesMapping:qe});return(0,D.jsxs)(he.Provider,{value:Ke,children:[Je,!Z&&!z&&U&&!T&&k!==void 0&&(0,D.jsx)(`input`,{type:`hidden`,form:f,name:U,value:k,disabled:H}),(0,D.jsx)(`input`,{...Ge,suppressHydrationWarning:!0})]})}),k=w.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:s=!1,...c}=e,l=ge(),d=l.checked||l.indeterminate,{mounted:f,transitionStatus:p,setMounted:m}=o(d),h=w.useRef(null),g={...l,transitionStatus:p};a({open:d,ref:h,onComplete(){d||m(!1)}});let _={...pe(l),...ee},v=s||f,y=u(`span`,e,{ref:[t,h],state:g,stateAttributesMapping:_,props:c});return v?y:null});function A({className:e,...t}){return(0,D.jsx)(O,{className:r(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input outline-none transition-colors after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 group-has-[:focus-visible]/field-label:not-data-checked:border-input group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:bg-input/30 dark:data-checked:bg-primary dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),"data-slot":`checkbox`,...t,children:(0,D.jsx)(k,{className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,"data-slot":`checkbox-indicator`,children:(0,D.jsx)(S,{})})})}function j(e){return Array.isArray(e)?e.map(e=>j(e)).join(`,`):e==null?``:String(e)}var ve=new Map;function ye(e,t){let n=JSON.stringify({locale:j(e),options:t}),r=ve.get(n);if(r)return r;let i=new Intl.NumberFormat(e,t);return ve.set(n,i),i}function M(e,t,n){return e==null?``:ye(t,n).format(e)}function be(e,t,n){return(e-t)*100/(n-t)}var N=w.createContext(void 0);function P(){let e=w.useContext(N);if(e===void 0)throw Error(f(51));return e}var F={status(e){return{[`data-${e}`]:``}}},I=w.forwardRef(function(e,t){let{format:n,getAriaValueText:r,locale:i,max:a=100,min:o=0,value:s,render:c,className:l,children:d,style:ee,...f}=e,[p,m]=w.useState(),h=`indeterminate`,g=null,_=null,y=``,b=`indeterminate progress`;if(s!=null&&Number.isFinite(s)){let e=be(s,o,a);g=C(Number.isNaN(e)?0:e,0,100),_=C(s,o,a),h=_===a?`complete`:`progressing`,y=n?M(_,i,n):M(g/100,i,{style:`percent`}),b=y}let x=w.useMemo(()=>({status:h}),[h]),te={"aria-labelledby":p,"aria-valuemax":a,"aria-valuemin":o,"aria-valuenow":_??void 0,"aria-valuetext":r?r(y,s):b,role:`progressbar`,children:(0,D.jsxs)(w.Fragment,{children:[d,(0,D.jsx)(`span`,{role:`presentation`,style:v,children:`x`})]})},S=w.useMemo(()=>({formattedValue:y,percentageValue:g,setLabelId:m,state:x,value:s}),[y,g,m,x,s]),ne=u(`div`,e,{state:x,ref:t,props:[te,f],stateAttributesMapping:F});return(0,D.jsx)(N.Provider,{value:S,children:ne})}),xe=w.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=P();return u(`div`,e,{state:o,ref:t,props:a,stateAttributesMapping:F})}),L=w.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{percentageValue:o,state:s}=P(),c=o==null?{}:{insetInlineStart:0,height:`inherit`,width:`${o}%`};return u(`div`,e,{state:s,ref:t,props:[{style:c},a],stateAttributesMapping:F})});function Se({className:e,value:t,...n}){return(0,D.jsx)(I,{className:r(`w-full`,e),value:t,...n,children:(0,D.jsx)(xe,{className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,D.jsx)(L,{className:`h-full bg-primary transition-[width] motion-reduce:transition-none`})})})}export{A as n,Se as t}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/progress-DIxv1Q_r.js b/go/headgateui/dist/assets/progress-DIxv1Q_r.js new file mode 100644 index 0000000..3b982ca --- /dev/null +++ b/go/headgateui/dist/assets/progress-DIxv1Q_r.js @@ -0,0 +1 @@ +import{a as e,s as t,u as n}from"./with-selector-hO0TNhHE.js";import{$ as r,Et as i,It as a,L as o,Qt as s,R as c,Z as l,_n as u,bt as d,d as f,fn as p,g as m,gn as h,hn as g,kt as _,pn as v,x as y,yt as b}from"./theme-CN9-NrCi.js";import{B as x,F as S,H as ee,I as te,J as C,L as ne,N as re,R as ie,U as ae,g as w,z as oe}from"./console-COYwGlau.js";var T=n(t(),1);function se(e,t,n,r=!0,i){let[a,o]=T.useState(),s=m(i?`${i}-label`:void 0),c=e??t??a;return v(()=>{let i=e||t||!r?void 0:ce(n.current,s);a!==i&&o(i)}),c}function ce(e,t){let n=le(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function le(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}var E=T.createContext({disabled:!1});function ue(){return T.useContext(E)}function de(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}function fe(e){return{checked(t){return e.indeterminate?{}:t?{"data-checked":``}:{"data-unchecked":``}},...x}}var D=T.createContext(void 0);function pe(){return T.useContext(D)}var me=T.createContext(void 0);function he(){let e=T.useContext(me);if(e===void 0)throw Error(p(14));return e}var O=e(),ge=`data-parent`,k=T.forwardRef(function(e,t){let{checked:n,className:o,defaultChecked:c=!1,"aria-labelledby":f,disabled:p=!1,form:y,id:x,indeterminate:C=!1,inputRef:w,name:ce,onCheckedChange:le,parent:E=!1,readOnly:D=!1,render:he,required:k=!1,uncheckedValue:A,value:j,nativeButton:M=!1,style:_e,...ve}=e,{clearErrors:N}=ie(),{disabled:ye,name:P,setDirty:F,setFilled:I,setFocused:L,setTouched:be,state:R,validationMode:xe,validityData:Se,validation:Ce}=oe(),we=ue(),{labelId:Te,controlId:Ee,registerControlId:z,getDescriptionProps:De}=ne(),B=pe(),V=B?.allValues===void 0?void 0:B.parent,H=V!==void 0,U=ye||we.disabled||B?.disabled||p,W=P??ce,G=j??W,Oe=m(),ke=m(),K=x||Ee;H&&(E?K=ke:G===void 0?K||=ke:K=`${V.id}-${G}`);let q={};H&&(E?q=V.getParentProps():G!==void 0&&(q=V.getChildProps(G)));let{checked:Ae=n,indeterminate:je=C,onCheckedChange:Me,...Ne}=q,Pe=B?.value,J=T.useRef(null),Y=u(()=>Symbol()),Fe=T.useRef(!1),{getButtonProps:Ie,buttonRef:Le}=ee({disabled:U,native:M}),X=B?.validation??Ce,[Z,Re]=te({controlled:G!==void 0&&Pe!==void 0&&!E?Pe.includes(G):Ae,default:c,name:`Checkbox`,state:`checked`}),ze=H?!!Ae:Z,Q=H&&je||C;v(()=>{z!==h&&(Fe.current=!0,z(Y.current,K))},[K,z,Y]),T.useEffect(()=>{let e=Y.current;return()=>{!Fe.current||z===h||(Fe.current=!1,z(e,void 0))}},[z,Y]),S(J,Oe,Z,void 0,!B&&!U,ce);let $=T.useRef(null),Be=X.registerInput,Ve=B?G:void 0,He=T.useCallback(e=>Be(e,{controlRef:J,value:Ve}),[Be,Ve]),Ue=i(w,$,E?void 0:He),We=se(f,Te,$,!M,K??void 0);v(()=>{$.current&&($.current.indeterminate=Q,Z&&I(!0))},[Z,Q,I]),re(Z,()=>{B||(N(W),I(Z),F(Z!==Se.initialValue),X.change(Z))});let Ge=r({checked:Z,disabled:U,form:y,name:E?void 0:W,id:M?void 0:K??void 0,required:k,ref:Ue,style:W?d:b,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(D){e.preventDefault();return}let t=e.currentTarget.checked,n=_(a,e.nativeEvent);if(le?.(t,n),!n.isCanceled&&(Me?.(t,n),!n.isCanceled&&(Re(t),G!==void 0&&B!==void 0&&!E&&!H))){let e=t?[...B.value,G]:B.value.filter(e=>e!==G);B.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){J.current?.focus()}},j===void 0?g:{value:(B?Z&&j:j)||``},De,e=>X.getValidationProps(U,e));T.useEffect(()=>{if(!V||G===void 0)return;let e=V.disabledStatesRef.current;return e.set(G,U),()=>{e.delete(G)}},[V,U,G]);let Ke=T.useMemo(()=>({...R,checked:ze,disabled:U,readOnly:D,required:k,indeterminate:Q}),[R,ze,U,D,k,Q]),qe=fe(Ke),Je=l(`span`,e,{state:Ke,ref:[Le,J,t],props:[{id:M?K??void 0:Oe,role:`checkbox`,"aria-checked":Q?`mixed`:ze,"aria-readonly":D||void 0,"aria-required":k||void 0,"aria-labelledby":We,[ge]:E?``:void 0,onFocus(){U||L(!0)},onBlur(){let e=$.current;e&&(be(!0),L(!1),xe===`onBlur`&&X.commit(B?Pe:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=$.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),s(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||de(t)?.click()})},onClick(e){if(D||U)return;e.preventDefault();let t=$.current;t&&ae(t,e)}},ve,Ne,Ie,De,e=>X.getValidationProps(U,e)],stateAttributesMapping:qe});return(0,O.jsxs)(me.Provider,{value:Ke,children:[Je,!Z&&!B&&W&&!E&&A!==void 0&&(0,O.jsx)(`input`,{type:`hidden`,form:y,name:W,value:A,disabled:U}),(0,O.jsx)(`input`,{...Ge,suppressHydrationWarning:!0})]})}),A=T.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...s}=e,u=he(),d=u.checked||u.indeterminate,{mounted:f,transitionStatus:p,setMounted:m}=c(d),h=T.useRef(null),g={...u,transitionStatus:p};o({open:d,ref:h,onComplete(){d||m(!1)}});let _={...fe(u),...y},v=a||f,b=l(`span`,e,{ref:[t,h],state:g,stateAttributesMapping:_,props:s});return v?b:null});function j({className:e,...t}){return(0,O.jsx)(k,{className:f(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input outline-none transition-colors after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 group-has-[:focus-visible]/field-label:not-data-checked:border-input group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:bg-input/30 dark:data-checked:bg-primary dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),"data-slot":`checkbox`,...t,children:(0,O.jsx)(A,{className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,"data-slot":`checkbox-indicator`,children:(0,O.jsx)(C,{})})})}function M(e){return Array.isArray(e)?e.map(e=>M(e)).join(`,`):e==null?``:String(e)}var _e=new Map;function ve(e,t){let n=JSON.stringify({locale:M(e),options:t}),r=_e.get(n);if(r)return r;let i=new Intl.NumberFormat(e,t);return _e.set(n,i),i}function N(e,t,n){return e==null?``:ve(t,n).format(e)}function ye(e,t,n){return(e-t)*100/(n-t)}var P=T.createContext(void 0);function F(){let e=T.useContext(P);if(e===void 0)throw Error(p(51));return e}var I={status(e){return{[`data-${e}`]:``}}},L=T.forwardRef(function(e,t){let{format:n,getAriaValueText:r,locale:i,max:a=100,min:o=0,value:s,render:c,className:u,children:d,style:f,...p}=e,[m,h]=T.useState(),g=`indeterminate`,_=null,v=null,y=``,x=`indeterminate progress`;if(s!=null&&Number.isFinite(s)){let e=ye(s,o,a);_=w(Number.isNaN(e)?0:e,0,100),v=w(s,o,a),g=v===a?`complete`:`progressing`,y=n?N(v,i,n):N(_/100,i,{style:`percent`}),x=y}let S=T.useMemo(()=>({status:g}),[g]),ee={"aria-labelledby":m,"aria-valuemax":a,"aria-valuemin":o,"aria-valuenow":v??void 0,"aria-valuetext":r?r(y,s):x,role:`progressbar`,children:(0,O.jsxs)(T.Fragment,{children:[d,(0,O.jsx)(`span`,{role:`presentation`,style:b,children:`x`})]})},te=T.useMemo(()=>({formattedValue:y,percentageValue:_,setLabelId:h,state:S,value:s}),[y,_,h,S,s]),C=l(`div`,e,{state:S,ref:t,props:[ee,p],stateAttributesMapping:I});return(0,O.jsx)(P.Provider,{value:te,children:C})}),be=T.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=F();return l(`div`,e,{state:o,ref:t,props:a,stateAttributesMapping:I})}),R=T.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{percentageValue:o,state:s}=F(),c=o==null?{}:{insetInlineStart:0,height:`inherit`,width:`${o}%`};return l(`div`,e,{state:s,ref:t,props:[{style:c},a],stateAttributesMapping:I})});function xe({className:e,value:t,...n}){return(0,O.jsx)(L,{className:f(`w-full`,e),value:t,...n,children:(0,O.jsx)(be,{className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,O.jsx)(R,{className:`h-full bg-primary transition-[width] motion-reduce:transition-none`})})})}export{j as n,xe as t}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/radio-DTs_-itw.js b/go/headgateui/dist/assets/radio-DTs_-itw.js new file mode 100644 index 0000000..c517edf --- /dev/null +++ b/go/headgateui/dist/assets/radio-DTs_-itw.js @@ -0,0 +1 @@ +import{X as e}from"./console-COYwGlau.js";var t=e(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),n=e(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),r=e(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),i=e(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]);export{t as i,r as n,n as r,i as t}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/relative-time-Bzc3eil5.js b/go/headgateui/dist/assets/relative-time-Bzc3eil5.js new file mode 100644 index 0000000..605e17b --- /dev/null +++ b/go/headgateui/dist/assets/relative-time-Bzc3eil5.js @@ -0,0 +1 @@ +import{a as e,s as t,u as n}from"./with-selector-hO0TNhHE.js";import{f as r,h as i}from"./table-DtWJ0yY1.js";var a=n(t(),1),o=new Set,s=null,c=Date.now(),l=new Set,u=null,d=c;function f(e){return o.add(e),s??=(c=Date.now(),window.setInterval(()=>{c=Date.now();for(let e of o)e()},1e3)),()=>{o.delete(e),o.size===0&&s!=null&&(window.clearInterval(s),s=null)}}function p(){return(0,a.useSyncExternalStore)(f,()=>c,()=>c)}function m(e){return l.add(e),u??=(d=Date.now(),window.setInterval(()=>{d=Date.now();for(let e of l)e()},3e4)),()=>{l.delete(e),l.size===0&&u!=null&&(window.clearInterval(u),u=null)}}function h(){return(0,a.useSyncExternalStore)(m,()=>d,()=>d)}var g=e();function _({className:e,value:t}){let n=h();return t?(0,g.jsx)(`time`,{className:e,dateTime:new Date(t).toISOString(),suppressHydrationWarning:!0,title:r(t),children:i(t,n)}):(0,g.jsx)(`span`,{className:e,children:`—`})}export{p as n,_ as t}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/relative-time-CtN3x3SY.js b/go/headgateui/dist/assets/relative-time-CtN3x3SY.js deleted file mode 100644 index e898a32..0000000 --- a/go/headgateui/dist/assets/relative-time-CtN3x3SY.js +++ /dev/null @@ -1 +0,0 @@ -import{c as e,d as t,o as n}from"./utils-o8v-URZ_.js";import{f as r,h as i}from"./table-BngtkqYs.js";var a=t(e(),1),o=new Set,s=null,c=Date.now(),l=new Set,u=null,d=c;function f(e){return o.add(e),s??=(c=Date.now(),window.setInterval(()=>{c=Date.now();for(let e of o)e()},1e3)),()=>{o.delete(e),o.size===0&&s!=null&&(window.clearInterval(s),s=null)}}function p(){return(0,a.useSyncExternalStore)(f,()=>c,()=>c)}function m(e){return l.add(e),u??=(d=Date.now(),window.setInterval(()=>{d=Date.now();for(let e of l)e()},3e4)),()=>{l.delete(e),l.size===0&&u!=null&&(window.clearInterval(u),u=null)}}function h(){return(0,a.useSyncExternalStore)(m,()=>d,()=>d)}var g=n();function _({className:e,value:t}){let n=h();return t?(0,g.jsx)(`time`,{className:e,dateTime:new Date(t).toISOString(),suppressHydrationWarning:!0,title:r(t),children:i(t,n)}):(0,g.jsx)(`span`,{className:e,children:`—`})}export{p as n,_ as t}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/styles-CqgQt6-d.css b/go/headgateui/dist/assets/styles-CqgQt6-d.css new file mode 100644 index 0000000..e30b584 --- /dev/null +++ b/go/headgateui/dist/assets/styles-CqgQt6-d.css @@ -0,0 +1,2 @@ +/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-scroll-snap-strictness:proximity;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:"";--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-cyrillic-ext-wght-normal-DjL33-gN.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-cyrillic-wght-normal-BEAKL7Jp.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-vietnamese-wght-normal-6IgcOCM7.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-latin-ext-wght-normal-DC-KSUi6.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-latin-wght-normal-BgDaEnEv.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@layer theme{:root,:host{--color-amber-400:oklch(82.8% .189 84.429);--color-amber-700:oklch(55.5% .163 48.998);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-600:oklch(54.6% .245 262.881);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--leading-tight:1.25;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-in:cubic-bezier(.4, 0, 1, 1);--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-xs:4px;--aspect-video:16 / 9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:"Geist Variable", ui-sans-serif, system-ui, sans-serif;--default-mono-font-family:ui-monospace, "SFMono-Regular", Menlo, monospace;--color-border:var(--border)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.\@container{container-type:inline-size}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-auto{inset:auto}.inset-y-0{inset-block:0}.top-0{top:0}.top-1\.5{top:calc(var(--spacing) * 1.5)}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing) * 2)}.top-3{top:calc(var(--spacing) * 3)}.top-3\.5{top:calc(var(--spacing) * 3.5)}.top-8{top:calc(var(--spacing) * 8)}.right-1{right:var(--spacing)}.right-2{right:calc(var(--spacing) * 2)}.right-3{right:calc(var(--spacing) * 3)}.bottom-0{bottom:0}.bottom-4{bottom:calc(var(--spacing) * 4)}.left-1\/2{left:50%}.left-3{left:calc(var(--spacing) * 3)}.left-4{left:calc(var(--spacing) * 4)}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-70{z-index:70}.z-100{z-index:100}.float-left{float:left}.float-none{float:none}.float-right{float:right}.clear-end{clear:inline-end}.clear-left{clear:left}.clear-none{clear:none}.clear-right{clear:right}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.-mx-4{margin-inline:calc(var(--spacing) * -4)}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-3\.5{margin-inline:calc(var(--spacing) * 3.5)}.my-0\.5{margin-block:calc(var(--spacing) * .5)}.my-1{margin-block:var(--spacing)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-auto{margin-top:auto}.mr-1{margin-right:var(--spacing)}.mr-2{margin-right:calc(var(--spacing) * 2)}.-mb-4{margin-bottom:calc(var(--spacing) * -4)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.ml-1{margin-left:var(--spacing)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.hidden\!{display:none!important}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1}.aspect-video{aspect-ratio:var(--aspect-video)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\!{width:calc(var(--spacing) * 2)!important;height:calc(var(--spacing) * 2)!important}.size-2\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-9{width:calc(var(--spacing) * 9);height:calc(var(--spacing) * 9)}.size-full{width:100%;height:100%}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-12\!{height:calc(var(--spacing) * 12)!important}.h-13{height:calc(var(--spacing) * 13)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-72{height:calc(var(--spacing) * 72)}.h-\[calc\(100\%-2rem\)\]{height:calc(100% - 2rem)}.h-\[clamp\(26rem\,62dvh\,38rem\)\]{height:clamp(26rem,62dvh,38rem)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-svh{height:100svh}.max-h-\(--available-height\){max-height:var(--available-height)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-52{max-height:calc(var(--spacing) * 52)}.max-h-80{max-height:calc(var(--spacing) * 80)}.min-h-0{min-height:0}.min-h-48{min-height:calc(var(--spacing) * 48)}.min-h-96{min-height:calc(var(--spacing) * 96)}.min-h-svh{min-height:100svh}.w-\(--anchor-width\){width:var(--anchor-width)}.w-\(--sidebar-width\){width:var(--sidebar-width)}.w-0{width:0}.w-1{width:var(--spacing)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-18\!{width:calc(var(--spacing) * 18)!important}.w-36{width:calc(var(--spacing) * 36)}.w-40{width:calc(var(--spacing) * 40)}.w-44{width:calc(var(--spacing) * 44)}.w-72{width:calc(var(--spacing) * 72)}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-\(--skeleton-width\){max-width:var(--skeleton-width)}.max-w-64{max-width:calc(var(--spacing) * 64)}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:0}.min-w-5{min-width:calc(var(--spacing) * 5)}.min-w-32{min-width:calc(var(--spacing) * 32)}.min-w-36{min-width:calc(var(--spacing) * 36)}.min-w-48{min-width:calc(var(--spacing) * 48)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.origin-\(--transform-origin\){transform-origin:var(--transform-origin)}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-x-px{--tw-translate-x:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-px{--tw-translate-x:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-0{--tw-translate-y:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-2{--tw-translate-y:calc(var(--spacing) * 2);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[calc\(-50\%-2px\)\]{--tw-translate-y:calc(-50% - 2px);translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-45{rotate:45deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-in{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-pan-right{--tw-pan-x:pan-right;touch-action:var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,)}.touch-pan-up{--tw-pan-y:pan-up;touch-action:var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,)}.touch-manipulation{touch-action:manipulation}.resize{resize:both}.resize-none{resize:none}.resize-x{resize:horizontal}.snap-none{scroll-snap-type:none}.snap-x{scroll-snap-type:x var(--tw-scroll-snap-strictness)}.snap-center{scroll-snap-align:center}.snap-end{scroll-snap-align:end}.scroll-my-1{scroll-margin-block:var(--spacing)}.scroll-mt-16{scroll-margin-top:calc(var(--spacing) * 16)}.scrollbar-thin{scrollbar-width:thin}.break-before-auto{break-before:auto}.break-before-avoid{break-before:avoid}.break-before-avoid-page{break-before:avoid-page}.break-before-column{break-before:column}.break-before-left{break-before:left}.break-before-page{break-before:page}.break-inside-avoid{break-inside:avoid}.break-inside-avoid-column{break-inside:avoid-column}.break-after-auto{break-after:auto}.break-after-avoid{break-after:avoid}.break-after-avoid-page{break-after:avoid-page}.break-after-column{break-after:column}.break-after-left{break-after:left}.break-after-page{break-after:page}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[0\.875rem_1fr\]{grid-template-columns:.875rem 1fr}.grid-cols-\[7rem_1fr\]{grid-template-columns:7rem 1fr}.grid-cols-\[8rem_1fr\]{grid-template-columns:8rem 1fr}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-baseline{place-content:baseline start}.place-content-between{place-content:space-between}.place-content-center{place-content:center}.place-content-center-safe{place-content:safe center}.place-content-end{place-content:end}.place-content-end-safe{place-content:safe end}.place-content-evenly{place-content:space-evenly}.place-content-start{place-content:start}.place-items-center{place-items:center}.place-items-center-safe{place-items:safe center}.place-items-end{place-items:end}.place-items-end-safe{place-items:safe end}.place-items-start{place-items:start}.items-baseline-last{align-items:last baseline}.items-center{align-items:center}.items-center-safe{align-items:safe center}.items-end{align-items:flex-end}.items-end-safe{align-items:safe flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-baseline{justify-content:baseline}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-center-safe{justify-content:safe center}.justify-end{justify-content:flex-end}.justify-end-safe{justify-content:safe flex-end}.justify-evenly{justify-content:space-evenly}.justify-normal{justify-content:normal}.justify-start{justify-content:flex-start}.justify-items-center-safe{justify-items:safe center}.justify-items-end{justify-items:end}.justify-items-end-safe{justify-items:safe end}.justify-items-normal{justify-items:normal}.justify-items-start{justify-items:start}.gap-0{gap:0}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block:0}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-y-1{row-gap:var(--spacing)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}.place-self-center{place-self:center}.place-self-center-safe{place-self:safe center}.place-self-end{place-self:end}.place-self-end-safe{place-self:safe end}.place-self-start{place-self:start}.self-baseline{align-self:baseline}.self-baseline-last{align-self:last baseline}.self-center{align-self:center}.self-center-safe{align-self:safe center}.self-end{align-self:flex-end}.self-end-safe{align-self:safe flex-end}.self-start{align-self:flex-start}.justify-self-center{justify-self:center}.justify-self-center-safe{justify-self:safe center}.justify-self-end{justify-self:flex-end}.justify-self-end-safe{justify-self:safe flex-end}.justify-self-start{justify-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-clip{overflow:clip}.overflow-hidden{overflow:hidden}.overflow-hidden\!{overflow:hidden!important}.overflow-scroll{overflow:scroll}.overflow-x-auto{overflow-x:auto}.overflow-x-clip{overflow-x:clip}.overflow-x-hidden{overflow-x:hidden}.overflow-x-scroll{overflow-x:scroll}.overflow-y-auto{overflow-y:auto}.overflow-y-clip{overflow-y:clip}.overflow-y-hidden{overflow-y:hidden}.overflow-y-scroll{overflow-y:scroll}.overscroll-contain{overscroll-behavior:contain}.overscroll-x-contain{overscroll-behavior-x:contain}.overscroll-y-contain{overscroll-behavior-y:contain}.rounded-\[2px\]{border-radius:2px}.rounded-\[4px\]{border-radius:4px}.rounded-\[min\(var\(--radius-md\)\,10px\)\]{border-radius:min(var(--radius-md), 10px)}.rounded-\[min\(var\(--radius-md\)\,12px\)\]{border-radius:min(var(--radius-md), 12px)}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm\!{border-radius:var(--radius-sm)!important}.rounded-xl{border-radius:var(--radius-xl)}.rounded-b-xl{border-bottom-right-radius:var(--radius-xl);border-bottom-left-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border\!{border-style:var(--tw-border-style)!important;border-width:1px!important}.border-\[1\.5px\]{border-style:var(--tw-border-style);border-width:1.5px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\(--color-border\){border-color:var(--color-border)}.border-border{border-color:var(--border)}.border-border\!{border-color:var(--border)!important}.border-border\/50{border-color:var(--border)}@supports (color:color-mix(in lab, red, red)){.border-border\/50{border-color:color-mix(in oklab, var(--border) 50%, transparent)}}.border-border\/70\!{border-color:var(--border)!important}@supports (color:color-mix(in lab, red, red)){.border-border\/70\!{border-color:color-mix(in oklab, var(--border) 70%, transparent)!important}}.border-destructive,.border-destructive\/30{border-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.border-destructive\/30{border-color:color-mix(in oklab, var(--destructive) 30%, transparent)}}.border-destructive\/40{border-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.border-destructive\/40{border-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.border-input{border-color:var(--input)}.border-muted-foreground\/60{border-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.border-muted-foreground\/60{border-color:color-mix(in oklab, var(--muted-foreground) 60%, transparent)}}.border-primary,.border-primary\/20{border-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.border-primary\/20{border-color:color-mix(in oklab, var(--primary) 20%, transparent)}}.border-sidebar-border{border-color:var(--sidebar-border)}.border-success,.border-success\/35{border-color:var(--success)}@supports (color:color-mix(in lab, red, red)){.border-success\/35{border-color:color-mix(in oklab, var(--success) 35%, transparent)}}.border-success\/40{border-color:var(--success)}@supports (color:color-mix(in lab, red, red)){.border-success\/40{border-color:color-mix(in oklab, var(--success) 40%, transparent)}}.border-success\/60{border-color:var(--success)}@supports (color:color-mix(in lab, red, red)){.border-success\/60{border-color:color-mix(in oklab, var(--success) 60%, transparent)}}.border-transparent{border-color:#0000}.border-warning,.border-warning\/35{border-color:var(--warning)}@supports (color:color-mix(in lab, red, red)){.border-warning\/35{border-color:color-mix(in oklab, var(--warning) 35%, transparent)}}.bg-\(--color-bg\){background-color:var(--color-bg)}.bg-background{background-color:var(--background)}.bg-background\!,.bg-background\/80\!{background-color:var(--background)!important}@supports (color:color-mix(in lab, red, red)){.bg-background\/80\!{background-color:color-mix(in oklab, var(--background) 80%, transparent)!important}}.bg-background\/95{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.bg-background\/95{background-color:color-mix(in oklab, var(--background) 95%, transparent)}}.bg-black\/10{background-color:#0000001a}@supports (color:color-mix(in lab, red, red)){.bg-black\/10{background-color:color-mix(in oklab, var(--color-black) 10%, transparent)}}.bg-border{background-color:var(--border)}.bg-card{background-color:var(--card)}.bg-destructive,.bg-destructive\/5{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.bg-destructive\/5{background-color:color-mix(in oklab, var(--destructive) 5%, transparent)}}.bg-destructive\/10{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.bg-destructive\/10{background-color:color-mix(in oklab, var(--destructive) 10%, transparent)}}.bg-foreground{background-color:var(--foreground)}.bg-muted{background-color:var(--muted)}.bg-muted-foreground{background-color:var(--muted-foreground)}.bg-muted\/20{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\/20{background-color:color-mix(in oklab, var(--muted) 20%, transparent)}}.bg-muted\/25{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\/25{background-color:color-mix(in oklab, var(--muted) 25%, transparent)}}.bg-muted\/50{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\/50{background-color:color-mix(in oklab, var(--muted) 50%, transparent)}}.bg-popover{background-color:var(--popover)}.bg-primary,.bg-primary\/5{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.bg-primary\/5{background-color:color-mix(in oklab, var(--primary) 5%, transparent)}}.bg-primary\/10{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.bg-primary\/10{background-color:color-mix(in oklab, var(--primary) 10%, transparent)}}.bg-secondary{background-color:var(--secondary)}.bg-sidebar{background-color:var(--sidebar)}.bg-sidebar-border{background-color:var(--sidebar-border)}.bg-sidebar-primary{background-color:var(--sidebar-primary)}.bg-success,.bg-success\/5{background-color:var(--success)}@supports (color:color-mix(in lab, red, red)){.bg-success\/5{background-color:color-mix(in oklab, var(--success) 5%, transparent)}}.bg-success\/10{background-color:var(--success)}@supports (color:color-mix(in lab, red, red)){.bg-success\/10{background-color:color-mix(in oklab, var(--success) 10%, transparent)}}.bg-success\/15{background-color:var(--success)}@supports (color:color-mix(in lab, red, red)){.bg-success\/15{background-color:color-mix(in oklab, var(--success) 15%, transparent)}}.bg-transparent{background-color:#0000}.bg-warning,.bg-warning\/10{background-color:var(--warning)}@supports (color:color-mix(in lab, red, red)){.bg-warning\/10{background-color:color-mix(in oklab, var(--warning) 10%, transparent)}}.bg-warning\/15{background-color:var(--warning)}@supports (color:color-mix(in lab, red, red)){.bg-warning\/15{background-color:color-mix(in oklab, var(--warning) 15%, transparent)}}.bg-clip-padding{background-clip:padding-box}.fill-foreground{fill:var(--foreground)}.p-0{padding:0}.p-1{padding:var(--spacing)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-8{padding-block:calc(var(--spacing) * 8)}.pt-0\.5{padding-top:calc(var(--spacing) * .5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pr-14{padding-right:calc(var(--spacing) * 14)}.pb-1{padding-bottom:var(--spacing)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pl-1\.5{padding-left:calc(var(--spacing) * 1.5)}.pl-2\.5{padding-left:calc(var(--spacing) * 2.5)}.pl-4{padding-left:calc(var(--spacing) * 4)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[0\.8rem\]{font-size:.8rem}.text-\[9px\]{font-size:9px}.text-\[11px\]{font-size:11px}.leading-3{--tw-leading:calc(var(--spacing) * 3);line-height:calc(var(--spacing) * 3)}.leading-3\.5{--tw-leading:calc(var(--spacing) * 3.5);line-height:calc(var(--spacing) * 3.5)}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-none{--tw-leading:1;line-height:1}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.text-balance{text-wrap:balance}.break-normal{overflow-wrap:normal;word-break:normal}.break-words,.wrap-break-word{overflow-wrap:break-word}.break-all{word-break:break-all}.break-keep{word-break:keep-all}.hyphens-manual{-webkit-hyphens:manual;hyphens:manual}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-700{color:var(--color-amber-700)}.text-background{color:var(--background)}.text-blue-600{color:var(--color-blue-600)}.text-card-foreground{color:var(--card-foreground)}.text-current{color:currentColor}.text-destructive{color:var(--destructive)}.text-foreground{color:var(--foreground)}.text-muted-foreground{color:var(--muted-foreground)}.text-popover-foreground{color:var(--popover-foreground)}.text-primary{color:var(--primary)}.text-primary-foreground{color:var(--primary-foreground)}.text-secondary-foreground{color:var(--secondary-foreground)}.text-sidebar-foreground,.text-sidebar-foreground\/65{color:var(--sidebar-foreground)}@supports (color:color-mix(in lab, red, red)){.text-sidebar-foreground\/65{color:color-mix(in oklab, var(--sidebar-foreground) 65%, transparent)}}.text-sidebar-foreground\/70{color:var(--sidebar-foreground)}@supports (color:color-mix(in lab, red, red)){.text-sidebar-foreground\/70{color:color-mix(in oklab, var(--sidebar-foreground) 70%, transparent)}}.text-sidebar-primary-foreground{color:var(--sidebar-primary-foreground)}.text-success{color:var(--success)}.text-warning{color:var(--warning)}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline-offset-4{text-underline-offset:4px}.scheme-light{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}.scheme-light-dark{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light dark}@media (prefers-color-scheme:dark){.scheme-light-dark{--lightningcss-light: ;--lightningcss-dark:initial}}.scheme-normal{color-scheme:normal}.scheme-only-dark{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark only}.opacity-0{opacity:0}.opacity-100{opacity:1}.mix-blend-color-burn{mix-blend-mode:color-burn}.mix-blend-color-dodge{mix-blend-mode:color-dodge}.mix-blend-darken{mix-blend-mode:darken}.mix-blend-difference{mix-blend-mode:difference}.mix-blend-exclusion{mix-blend-mode:exclusion}.mix-blend-hard-light{mix-blend-mode:hard-light}.mix-blend-hue{mix-blend-mode:hue}.mix-blend-lighten{mix-blend-mode:lighten}.mix-blend-luminosity{mix-blend-mode:luminosity}.mix-blend-multiply{mix-blend-mode:multiply}.mix-blend-normal{mix-blend-mode:normal}.mix-blend-overlay{mix-blend-mode:overlay}.mix-blend-plus-darker{mix-blend-mode:plus-darker}.mix-blend-plus-lighter{mix-blend-mode:plus-lighter}.mix-blend-saturation{mix-blend-mode:saturation}.mix-blend-screen{mix-blend-mode:screen}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_0_1px_var\(--sidebar-border\)\]{--tw-shadow:0 0 0 1px var(--tw-shadow-color,var(--sidebar-border));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-foreground\/10{--tw-ring-color:var(--foreground)}@supports (color:color-mix(in lab, red, red)){.ring-foreground\/10{--tw-ring-color:color-mix(in oklab, var(--foreground) 10%, transparent)}}.ring-primary\/70{--tw-ring-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.ring-primary\/70{--tw-ring-color:color-mix(in oklab, var(--primary) 70%, transparent)}}.ring-sidebar-ring{--tw-ring-color:var(--sidebar-ring)}.ring-offset-1{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.outline-hidden{outline-offset:2px;outline:2px solid #0000}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[border-color\,box-shadow\,background-color\]{transition-property:border-color,box-shadow,background-color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[border-color\,box-shadow\,transform\]{transition-property:border-color,box-shadow,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[color\,background-color\,border-color\,box-shadow\,transform\,opacity\]{transition-property:color,background-color,border-color,box-shadow,transform,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[color\,background-color\,border-color\,transform\]{transition-property:color,background-color,border-color,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[left\,right\,width\]{transition-property:left,right,width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[margin\,opacity\]{transition-property:margin,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[opacity\,transform\]{transition-property:opacity,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\,height\,padding\]{transition-property:width,height,padding;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\,transform\,background-color\]{transition-property:width,transform,background-color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-none{transition-property:none}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.ease-\[cubic-bezier\(0\.23\,1\,0\.32\,1\)\]{--tw-ease:cubic-bezier(.23,1,.32,1);transition-timing-function:cubic-bezier(.23,1,.32,1)}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-linear{--tw-ease:linear;transition-timing-function:linear}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-auto{-webkit-user-select:auto;user-select:auto}.select-none{-webkit-user-select:none;user-select:none}.zoom-in-95{--tw-enter-scale:.95}.fade-in{--tw-enter-opacity:0}.paused{animation-play-state:paused}.running{animation-play-state:running}.slide-in-from-top-1{--tw-enter-translate-y:calc(1*var(--spacing)*-1)}.zoom-in{--tw-enter-scale:0}.group-focus-within\/menu-item\:opacity-100:is(:where(.group\/menu-item):focus-within *){opacity:1}@media (hover:hover){.group-hover\:translate-x-0\.5:is(:where(.group):hover *){--tw-translate-x:calc(var(--spacing) * .5);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-hover\:-translate-y-0\.5:is(:where(.group):hover *){--tw-translate-y:calc(var(--spacing) * -.5);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-hover\:border-primary\/35:is(:where(.group):hover *){border-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.group-hover\:border-primary\/35:is(:where(.group):hover *){border-color:color-mix(in oklab, var(--primary) 35%, transparent)}}.group-hover\:shadow-sm:is(:where(.group):hover *){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.group-hover\/menu-item\:opacity-100:is(:where(.group\/menu-item):hover *){opacity:1}}.group-has-disabled\/field\:opacity-50:is(:where(.group\/field):has(:disabled) *){opacity:.5}.group-has-data-\[sidebar\=menu-action\]\/menu-item\:pr-8:is(:where(.group\/menu-item):has([data-sidebar=menu-action]) *){padding-right:calc(var(--spacing) * 8)}.group-has-\[\:focus-visible\]\/field-label\:ring-0:is(:where(.group\/field-label):has(:focus-visible) *){--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.group-has-\[\:focus-visible\]\/field-label\:not-data-checked\:border-input:is(:where(.group\/field-label):has(:focus-visible) *):not([data-checked]){border-color:var(--input)}.group-data-\[collapsible\=icon\]\:-mt-8:is(:where(.group)[data-collapsible=icon] *){margin-top:calc(var(--spacing) * -8)}.group-data-\[collapsible\=icon\]\:hidden:is(:where(.group)[data-collapsible=icon] *){display:none}.group-data-\[collapsible\=icon\]\:size-8\!:is(:where(.group)[data-collapsible=icon] *){width:calc(var(--spacing) * 8)!important;height:calc(var(--spacing) * 8)!important}.group-data-\[collapsible\=icon\]\:w-\(--sidebar-width-icon\):is(:where(.group)[data-collapsible=icon] *){width:var(--sidebar-width-icon)}.group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)\+\(--spacing\(4\)\)\)\]:is(:where(.group)[data-collapsible=icon] *){width:calc(var(--sidebar-width-icon) + (calc(var(--spacing) * 4)))}.group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)\+\(--spacing\(4\)\)\+2px\)\]:is(:where(.group)[data-collapsible=icon] *){width:calc(var(--sidebar-width-icon) + (calc(var(--spacing) * 4)) + 2px)}.group-data-\[collapsible\=icon\]\:overflow-hidden:is(:where(.group)[data-collapsible=icon] *){overflow:hidden}.group-data-\[collapsible\=icon\]\:p-0\!:is(:where(.group)[data-collapsible=icon] *){padding:0!important}.group-data-\[collapsible\=icon\]\:p-2\!:is(:where(.group)[data-collapsible=icon] *){padding:calc(var(--spacing) * 2)!important}.group-data-\[collapsible\=icon\]\:opacity-0:is(:where(.group)[data-collapsible=icon] *){opacity:0}.group-data-\[collapsible\=offcanvas\]\:w-0:is(:where(.group)[data-collapsible=offcanvas] *){width:0}.group-data-\[collapsible\=offcanvas\]\:translate-x-0:is(:where(.group)[data-collapsible=offcanvas] *){--tw-translate-x:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.group-data-\[side\=left\]\:-right-4:is(:where(.group)[data-side=left] *){right:calc(var(--spacing) * -4)}.group-data-\[side\=left\]\:border-r:is(:where(.group)[data-side=left] *){border-right-style:var(--tw-border-style);border-right-width:1px}.group-data-\[side\=right\]\:left-0:is(:where(.group)[data-side=right] *){left:0}.group-data-\[side\=right\]\:rotate-180:is(:where(.group)[data-side=right] *){rotate:180deg}.group-data-\[side\=right\]\:border-l:is(:where(.group)[data-side=right] *){border-left-style:var(--tw-border-style);border-left-width:1px}.group-data-\[variant\=floating\]\:rounded-lg:is(:where(.group)[data-variant=floating] *){border-radius:var(--radius-lg)}.group-data-\[variant\=floating\]\:shadow-sm:is(:where(.group)[data-variant=floating] *){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.group-data-\[variant\=floating\]\:ring-1:is(:where(.group)[data-variant=floating] *){--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.group-data-\[variant\=floating\]\:ring-sidebar-border:is(:where(.group)[data-variant=floating] *){--tw-ring-color:var(--sidebar-border)}@media (hover:hover){.peer-hover\/menu-button\:text-sidebar-accent-foreground:is(:where(.peer\/menu-button):hover~*){color:var(--sidebar-accent-foreground)}}.peer-data-active\/menu-button\:text-sidebar-accent-foreground:is(:where(.peer\/menu-button)[data-active]~*){color:var(--sidebar-accent-foreground)}.peer-data-\[size\=default\]\/menu-button\:top-1\.5:is(:where(.peer\/menu-button)[data-size=default]~*){top:calc(var(--spacing) * 1.5)}.peer-data-\[size\=lg\]\/menu-button\:top-2\.5:is(:where(.peer\/menu-button)[data-size=lg]~*){top:calc(var(--spacing) * 2.5)}.peer-data-\[size\=sm\]\/menu-button\:top-1:is(:where(.peer\/menu-button)[data-size=sm]~*){top:var(--spacing)}.file\:inline-flex::file-selector-button{display:inline-flex}.file\:h-6::file-selector-button{height:calc(var(--spacing) * 6)}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.file\:text-foreground::file-selector-button{color:var(--foreground)}.placeholder\:text-muted-foreground::placeholder{color:var(--muted-foreground)}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:-inset-2:after{content:var(--tw-content);inset:calc(var(--spacing) * -2)}.after\:-inset-x-3:after{content:var(--tw-content);inset-inline:calc(var(--spacing) * -3)}.after\:-inset-y-2:after{content:var(--tw-content);inset-block:calc(var(--spacing) * -2)}.after\:inset-y-0:after{content:var(--tw-content);inset-block:0}.after\:start-1\/2:after{content:var(--tw-content);inset-inline-start:50%}.after\:top-\[0\.4375rem\]:after{content:var(--tw-content);top:.4375rem}.after\:left-\[0\.40625rem\]:after{content:var(--tw-content);left:.40625rem}.after\:h-\[calc\(100\%\+0\.75rem\)\]:after{content:var(--tw-content);height:calc(100% + .75rem)}.after\:w-\[2px\]:after{content:var(--tw-content);width:2px}.after\:w-px:after{content:var(--tw-content);width:1px}.after\:bg-border:after{content:var(--tw-content);background-color:var(--border)}.after\:content-\[\'\'\]:after{--tw-content:"";content:var(--tw-content)}.group-data-\[collapsible\=offcanvas\]\:after\:left-full:is(:where(.group)[data-collapsible=offcanvas] *):after{content:var(--tw-content);left:100%}.last\:mb-0:last-child{margin-bottom:0}.last\:pb-0:last-child{padding-bottom:0}@media (hover:hover){.hover\:border-primary\/60:hover{border-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\:border-primary\/60:hover{border-color:color-mix(in oklab, var(--primary) 60%, transparent)}}.hover\:bg-\[color-mix\(in_oklch\,var\(--secondary\)\,var\(--foreground\)_5\%\)\]:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-\[color-mix\(in_oklch\,var\(--secondary\)\,var\(--foreground\)_5\%\)\]:hover{background-color:color-mix(in oklch,var(--secondary),var(--foreground) 5%)}}.hover\:bg-destructive\/20:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-destructive\/20:hover{background-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.hover\:bg-muted:hover,.hover\:bg-muted\/50:hover{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-muted\/50:hover{background-color:color-mix(in oklab, var(--muted) 50%, transparent)}}.hover\:bg-primary\/80:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-primary\/80:hover{background-color:color-mix(in oklab, var(--primary) 80%, transparent)}}.hover\:bg-sidebar-accent:hover{background-color:var(--sidebar-accent)}.hover\:text-foreground:hover{color:var(--foreground)}.hover\:text-sidebar-accent-foreground:hover{color:var(--sidebar-accent-foreground)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-90:hover{opacity:.9}.hover\:shadow-\[0_0_0_1px_var\(--sidebar-accent\)\]:hover{--tw-shadow:0 0 0 1px var(--tw-shadow-color,var(--sidebar-accent));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:shadow-sm:hover{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:group-data-\[collapsible\=offcanvas\]\:bg-sidebar:hover:is(:where(.group)[data-collapsible=offcanvas] *){background-color:var(--sidebar)}.hover\:after\:bg-sidebar-border:hover:after{content:var(--tw-content);background-color:var(--sidebar-border)}}.focus\:not-sr-only:focus{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.focus\:bg-accent:focus{background-color:var(--accent)}.focus\:text-accent-foreground:focus,:is(.not-data-\[variant\=destructive\]\:focus\:\*\*\:text-accent-foreground:not([data-variant=destructive]):focus *){color:var(--accent-foreground)}.focus-visible\:border-destructive\/40:focus-visible{border-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.focus-visible\:border-destructive\/40:focus-visible{border-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.focus-visible\:border-ring:focus-visible{border-color:var(--ring)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-3:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.focus-visible\:ring-ring:focus-visible,.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:bg-sidebar-accent:active{background-color:var(--sidebar-accent)}.active\:text-sidebar-accent-foreground:active{color:var(--sidebar-accent-foreground)}.active\:not-aria-\[haspopup\]\:scale-\[0\.97\]:active:not([aria-haspopup]){scale:.97}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-input\/50:disabled{background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.disabled\:bg-input\/50:disabled{background-color:color-mix(in oklab, var(--input) 50%, transparent)}}.disabled\:opacity-50:disabled{opacity:.5}:where([data-side=left]) .in-data-\[side\=left\]\:cursor-w-resize{cursor:w-resize}:where([data-side=right]) .in-data-\[side\=right\]\:cursor-e-resize{cursor:e-resize}:where([data-slot=button-group]) .in-data-\[slot\=button-group\]\:rounded-lg{border-radius:var(--radius-lg)}.has-data-\[icon\=inline-end\]\:pr-1\.5:has([data-icon=inline-end]){padding-right:calc(var(--spacing) * 1.5)}.has-data-\[icon\=inline-end\]\:pr-2:has([data-icon=inline-end]){padding-right:calc(var(--spacing) * 2)}.has-data-\[icon\=inline-start\]\:pl-1\.5:has([data-icon=inline-start]){padding-left:calc(var(--spacing) * 1.5)}.has-data-\[icon\=inline-start\]\:pl-2:has([data-icon=inline-start]){padding-left:calc(var(--spacing) * 2)}.has-data-\[slot\=kbd\]\:pr-1\.5:has([data-slot=kbd]){padding-right:calc(var(--spacing) * 1.5)}.has-data-\[variant\=inset\]\:bg-sidebar:has([data-variant=inset]){background-color:var(--sidebar)}.aria-disabled\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-expanded\:bg-muted[aria-expanded=true]{background-color:var(--muted)}.aria-expanded\:bg-secondary[aria-expanded=true]{background-color:var(--secondary)}.aria-expanded\:text-foreground[aria-expanded=true]{color:var(--foreground)}.aria-expanded\:text-secondary-foreground[aria-expanded=true]{color:var(--secondary-foreground)}.aria-expanded\:opacity-100[aria-expanded=true]{opacity:1}.aria-invalid\:border-destructive[aria-invalid=true]{border-color:var(--destructive)}.aria-invalid\:ring-3[aria-invalid=true]{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.aria-invalid\:aria-checked\:border-primary[aria-invalid=true][aria-checked=true]{border-color:var(--primary)}.data-active\:bg-sidebar-accent[data-active]{background-color:var(--sidebar-accent)}.data-active\:font-medium[data-active]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-active\:text-sidebar-accent-foreground[data-active]{color:var(--sidebar-accent-foreground)}.data-checked\:border-primary[data-checked]{border-color:var(--primary)}.data-checked\:bg-primary[data-checked]{background-color:var(--primary)}.data-checked\:text-primary-foreground[data-checked]{color:var(--primary-foreground)}.group-has-\[\:focus-visible\]\/field-label\:data-checked\:border-primary:is(:where(.group\/field-label):has(:focus-visible) *)[data-checked]{border-color:var(--primary)}.data-closed\:animate-out[data-closed]{animation:exit var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.data-closed\:fade-out-0[data-closed]{--tw-exit-opacity:0}.data-closed\:zoom-out-95[data-closed]{--tw-exit-scale:.95}.data-disabled\:pointer-events-none[data-disabled]{pointer-events:none}.data-disabled\:opacity-50[data-disabled]{opacity:.5}.data-ending-style\:opacity-0[data-ending-style]{opacity:0}.data-horizontal\:h-px[data-horizontal]{height:1px}.data-horizontal\:w-full[data-horizontal]{width:100%}.data-open\:animate-in[data-open]{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.data-open\:fade-in-0[data-open]{--tw-enter-opacity:0}.data-open\:zoom-in-95[data-open]{--tw-enter-scale:.95}@media (hover:hover){.data-open\:hover\:bg-sidebar-accent[data-open]:hover{background-color:var(--sidebar-accent)}.data-open\:hover\:text-sidebar-accent-foreground[data-open]:hover{color:var(--sidebar-accent-foreground)}}.data-placeholder\:text-muted-foreground[data-placeholder]{color:var(--muted-foreground)}.data-starting-style\:opacity-0[data-starting-style]{opacity:0}.data-vertical\:w-px[data-vertical]{width:1px}.data-vertical\:self-stretch[data-vertical]{align-self:stretch}.data-\[align-trigger\=true\]\:animate-none[data-align-trigger=true]{animation:none}.data-\[side\=bottom\]\:inset-x-0[data-side=bottom]{inset-inline:0}.data-\[side\=bottom\]\:top-1[data-side=bottom]{top:var(--spacing)}.data-\[side\=bottom\]\:bottom-0[data-side=bottom]{bottom:0}.data-\[side\=bottom\]\:h-auto[data-side=bottom]{height:auto}.data-\[side\=bottom\]\:border-t[data-side=bottom]{border-top-style:var(--tw-border-style);border-top-width:1px}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:calc(2*var(--spacing)*-1)}.data-\[side\=bottom\]\:data-ending-style\:translate-y-\[2\.5rem\][data-side=bottom][data-ending-style],.data-\[side\=bottom\]\:data-starting-style\:translate-y-\[2\.5rem\][data-side=bottom][data-starting-style]{--tw-translate-y:2.5rem;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=inline-end\]\:top-1\/2\![data-side=inline-end]{top:50%!important}.data-\[side\=inline-end\]\:-left-1[data-side=inline-end]{left:calc(var(--spacing) * -1)}.data-\[side\=inline-end\]\:-translate-y-1\/2[data-side=inline-end]{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=inline-end\]\:slide-in-from-left-2[data-side=inline-end]{--tw-enter-translate-x:calc(2*var(--spacing)*-1)}.data-\[side\=inline-start\]\:top-1\/2\![data-side=inline-start]{top:50%!important}.data-\[side\=inline-start\]\:-right-1[data-side=inline-start]{right:calc(var(--spacing) * -1)}.data-\[side\=inline-start\]\:-translate-y-1\/2[data-side=inline-start]{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=inline-start\]\:slide-in-from-right-2[data-side=inline-start]{--tw-enter-translate-x:calc(2*var(--spacing))}.data-\[side\=left\]\:inset-y-0[data-side=left]{inset-block:0}.data-\[side\=left\]\:top-1\/2\![data-side=left]{top:50%!important}.data-\[side\=left\]\:-right-1[data-side=left]{right:calc(var(--spacing) * -1)}.data-\[side\=left\]\:left-0[data-side=left]{left:0}.data-\[side\=left\]\:h-full[data-side=left]{height:100%}.data-\[side\=left\]\:w-3\/4[data-side=left]{width:75%}.data-\[side\=left\]\:-translate-y-1\/2[data-side=left]{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=left\]\:border-r[data-side=left]{border-right-style:var(--tw-border-style);border-right-width:1px}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:calc(2*var(--spacing))}.data-\[side\=left\]\:group-data-\[collapsible\=offcanvas\]\:left-\[calc\(var\(--sidebar-width\)\*-1\)\][data-side=left]:is(:where(.group)[data-collapsible=offcanvas] *){left:calc(var(--sidebar-width) * -1)}.data-\[side\=left\]\:data-ending-style\:translate-x-\[-2\.5rem\][data-side=left][data-ending-style],.data-\[side\=left\]\:data-starting-style\:translate-x-\[-2\.5rem\][data-side=left][data-starting-style]{--tw-translate-x:-2.5rem;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=right\]\:inset-y-0[data-side=right]{inset-block:0}.data-\[side\=right\]\:top-1\/2\![data-side=right]{top:50%!important}.data-\[side\=right\]\:right-0[data-side=right]{right:0}.data-\[side\=right\]\:-left-1[data-side=right]{left:calc(var(--spacing) * -1)}.data-\[side\=right\]\:h-full[data-side=right]{height:100%}.data-\[side\=right\]\:w-3\/4[data-side=right]{width:75%}.data-\[side\=right\]\:-translate-y-1\/2[data-side=right]{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=right\]\:border-l[data-side=right]{border-left-style:var(--tw-border-style);border-left-width:1px}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:calc(2*var(--spacing)*-1)}.data-\[side\=right\]\:group-data-\[collapsible\=offcanvas\]\:right-\[calc\(var\(--sidebar-width\)\*-1\)\][data-side=right]:is(:where(.group)[data-collapsible=offcanvas] *){right:calc(var(--sidebar-width) * -1)}.data-\[side\=right\]\:data-ending-style\:translate-x-\[2\.5rem\][data-side=right][data-ending-style],.data-\[side\=right\]\:data-starting-style\:translate-x-\[2\.5rem\][data-side=right][data-starting-style]{--tw-translate-x:2.5rem;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=top\]\:inset-x-0[data-side=top]{inset-inline:0}.data-\[side\=top\]\:top-0[data-side=top]{top:0}.data-\[side\=top\]\:-bottom-2\.5[data-side=top]{bottom:calc(var(--spacing) * -2.5)}.data-\[side\=top\]\:h-auto[data-side=top]{height:auto}.data-\[side\=top\]\:border-b[data-side=top]{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:calc(2*var(--spacing))}.data-\[side\=top\]\:data-ending-style\:translate-y-\[-2\.5rem\][data-side=top][data-ending-style],.data-\[side\=top\]\:data-starting-style\:translate-y-\[-2\.5rem\][data-side=top][data-starting-style]{--tw-translate-y:-2.5rem;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[size\=default\]\:h-8[data-size=default]{height:calc(var(--spacing) * 8)}.data-\[size\=md\]\:text-sm[data-size=md]{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.data-\[size\=sm\]\:h-7[data-size=sm]{height:calc(var(--spacing) * 7)}.data-\[size\=sm\]\:rounded-\[min\(var\(--radius-md\)\,10px\)\][data-size=sm]{border-radius:min(var(--radius-md), 10px)}.data-\[size\=sm\]\:text-xs[data-size=sm]{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}:is(.\*\*\:data-\[slot\=kbd\]\:relative *)[data-slot=kbd]{position:relative}:is(.\*\*\:data-\[slot\=kbd\]\:isolate *)[data-slot=kbd]{isolation:isolate}:is(.\*\*\:data-\[slot\=kbd\]\:z-50 *)[data-slot=kbd]{z-index:50}:is(.\*\*\:data-\[slot\=kbd\]\:rounded-sm *)[data-slot=kbd]{border-radius:var(--radius-sm)}:is(.\*\:data-\[slot\=select-value\]\:line-clamp-1>*)[data-slot=select-value]{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}:is(.\*\:data-\[slot\=select-value\]\:flex>*)[data-slot=select-value]{display:flex}:is(.\*\:data-\[slot\=select-value\]\:items-center>*)[data-slot=select-value]{align-items:center}:is(.\*\:data-\[slot\=select-value\]\:gap-1\.5>*)[data-slot=select-value]{gap:calc(var(--spacing) * 1.5)}.data-\[state\=delayed-open\]\:animate-in[data-state=delayed-open]{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.data-\[state\=delayed-open\]\:fade-in-0[data-state=delayed-open]{--tw-enter-opacity:0}.data-\[state\=delayed-open\]\:zoom-in-95[data-state=delayed-open]{--tw-enter-scale:.95}@supports ((-webkit-backdrop-filter:var(--tw)) or (backdrop-filter:var(--tw))){.supports-backdrop-filter\:backdrop-blur-xs{--tw-backdrop-blur:blur(var(--blur-xs));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}}@media (prefers-reduced-motion:reduce){.motion-reduce\:transform-none{transform:none}.motion-reduce\:animate-none{animation:none}.motion-reduce\:transition-none{transition-property:none}.motion-reduce\:active\:not-aria-\[haspopup\]\:scale-100:active:not([aria-haspopup]){--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}}@media (width>=40rem){.sm\:block\!{display:block!important}.sm\:flex{display:flex}.sm\:max-w-sm{max-width:var(--container-sm)}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.data-\[side\=left\]\:sm\:max-w-2xl[data-side=left]{max-width:var(--container-2xl)}.data-\[side\=left\]\:sm\:max-w-sm[data-side=left]{max-width:var(--container-sm)}.data-\[side\=right\]\:sm\:max-w-2xl[data-side=right]{max-width:var(--container-2xl)}.data-\[side\=right\]\:sm\:max-w-sm[data-side=right]{max-width:var(--container-sm)}}@media (width>=48rem){.md\:block{display:block}.md\:flex{display:flex}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.md\:opacity-0{opacity:0}.md\:peer-data-\[variant\=inset\]\:m-2:is(:where(.peer)[data-variant=inset]~*){margin:calc(var(--spacing) * 2)}.md\:peer-data-\[variant\=inset\]\:ml-0:is(:where(.peer)[data-variant=inset]~*){margin-left:0}.md\:peer-data-\[variant\=inset\]\:rounded-xl:is(:where(.peer)[data-variant=inset]~*){border-radius:var(--radius-xl)}.md\:peer-data-\[variant\=inset\]\:shadow-sm:is(:where(.peer)[data-variant=inset]~*){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.md\:peer-data-\[variant\=inset\]\:peer-data-\[state\=collapsed\]\:ml-2:is(:where(.peer)[data-variant=inset]~*):is(:where(.peer)[data-state=collapsed]~*){margin-left:calc(var(--spacing) * 2)}.md\:after\:hidden:after{content:var(--tw-content);display:none}}@media (width>=64rem){.lg\:p-6{padding:calc(var(--spacing) * 6)}}@media (width>=80rem){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-\[minmax\(0\,2fr\)_minmax\(18rem\,1fr\)\]{grid-template-columns:minmax(0,2fr) minmax(18rem,1fr)}}@media (width>=96rem){.\32 xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.ltr\:-translate-x-1\/2:where(:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),[dir=ltr],[dir=ltr] *),.rtl\:-translate-x-1\/2:where(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),[dir=rtl],[dir=rtl] *){--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.dark\:border-input:where(.dark,.dark *){border-color:var(--input)}.dark\:bg-destructive\/20:where(.dark,.dark *){background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-destructive\/20:where(.dark,.dark *){background-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.dark\:bg-input\/30:where(.dark,.dark *){background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-input\/30:where(.dark,.dark *){background-color:color-mix(in oklab, var(--input) 30%, transparent)}}.dark\:text-amber-400:where(.dark,.dark *){color:var(--color-amber-400)}.dark\:text-blue-400:where(.dark,.dark *){color:var(--color-blue-400)}@media (hover:hover){.dark\:hover\:bg-destructive\/30:where(.dark,.dark *):hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-destructive\/30:where(.dark,.dark *):hover{background-color:color-mix(in oklab, var(--destructive) 30%, transparent)}}.dark\:hover\:bg-input\/50:where(.dark,.dark *):hover{background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-input\/50:where(.dark,.dark *):hover{background-color:color-mix(in oklab, var(--input) 50%, transparent)}}.dark\:hover\:bg-muted\/50:where(.dark,.dark *):hover{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-muted\/50:where(.dark,.dark *):hover{background-color:color-mix(in oklab, var(--muted) 50%, transparent)}}}.dark\:focus-visible\:ring-destructive\/40:where(.dark,.dark *):focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\:focus-visible\:ring-destructive\/40:where(.dark,.dark *):focus-visible{--tw-ring-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.dark\:disabled\:bg-input\/80:where(.dark,.dark *):disabled{background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\:disabled\:bg-input\/80:where(.dark,.dark *):disabled{background-color:color-mix(in oklab, var(--input) 80%, transparent)}}.dark\:aria-invalid\:border-destructive\/50:where(.dark,.dark *)[aria-invalid=true]{border-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\:aria-invalid\:border-destructive\/50:where(.dark,.dark *)[aria-invalid=true]{border-color:color-mix(in oklab, var(--destructive) 50%, transparent)}}.dark\:aria-invalid\:ring-destructive\/40:where(.dark,.dark *)[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\:aria-invalid\:ring-destructive\/40:where(.dark,.dark *)[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.dark\:data-checked\:bg-primary:where(.dark,.dark *)[data-checked]{background-color:var(--primary)}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:var(--muted-foreground)}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke=\#ccc]{stroke:var(--border)}@supports (color:color-mix(in lab, red, red)){.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke=\#ccc]{stroke:color-mix(in oklab, var(--border) 50%, transparent)}}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:var(--border)}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke=\#fff]{stroke:#0000}.\[\&_\.recharts-layer\]\:outline-hidden .recharts-layer{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.\[\&_\.recharts-layer\]\:outline-hidden .recharts-layer{outline-offset:2px;outline:2px solid #0000}}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke=\#ccc]{stroke:var(--border)}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:var(--muted)}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke=\#ccc]{stroke:var(--border)}.\[\&_\.recharts-sector\]\:outline-hidden .recharts-sector{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.\[\&_\.recharts-sector\]\:outline-hidden .recharts-sector{outline-offset:2px;outline:2px solid #0000}}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke=\#fff]{stroke:#0000}.\[\&_\.recharts-surface\]\:outline-hidden .recharts-surface{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.\[\&_\.recharts-surface\]\:outline-hidden .recharts-surface{outline-offset:2px;outline:2px solid #0000}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-3 svg:not([class*=size-]){width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-3\.5 svg:not([class*=size-]){width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}:is(.\*\:\[a\]\:underline>*):is(a){text-decoration-line:underline}:is(.\*\:\[a\]\:underline-offset-3>*):is(a){text-underline-offset:3px}@media (hover:hover){:is(.\*\:\[a\]\:hover\:text-foreground>*):is(a):hover{color:var(--foreground)}}:is(.\*\:\[span\]\:last\:flex>*):is(span):last-child{display:flex}:is(.\*\:\[span\]\:last\:items-center>*):is(span):last-child{align-items:center}:is(.\*\:\[span\]\:last\:gap-2>*):is(span):last-child{gap:calc(var(--spacing) * 2)}.\[\&\>button\]\:hidden>button{display:none}.\[\&\>span\:last-child\]\:truncate>span:last-child{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.\[\&\>svg\]\:size-3\.5>svg{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.\[\&\>svg\]\:size-4>svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&\>svg\]\:h-2\.5>svg{height:calc(var(--spacing) * 2.5)}.\[\&\>svg\]\:h-3>svg{height:calc(var(--spacing) * 3)}.\[\&\>svg\]\:w-2\.5>svg{width:calc(var(--spacing) * 2.5)}.\[\&\>svg\]\:w-3>svg{width:calc(var(--spacing) * 3)}.\[\&\>svg\]\:shrink-0>svg{flex-shrink:0}.\[\&\>svg\]\:text-muted-foreground>svg{color:var(--muted-foreground)}.\[\&\>svg\]\:text-sidebar-accent-foreground>svg{color:var(--sidebar-accent-foreground)}[data-side=left][data-collapsible=offcanvas] .\[\[data-side\=left\]\[data-collapsible\=offcanvas\]_\&\]\:-right-2{right:calc(var(--spacing) * -2)}[data-side=left][data-state=collapsed] .\[\[data-side\=left\]\[data-state\=collapsed\]_\&\]\:cursor-e-resize{cursor:e-resize}[data-side=right][data-collapsible=offcanvas] .\[\[data-side\=right\]\[data-collapsible\=offcanvas\]_\&\]\:-left-2{left:calc(var(--spacing) * -2)}[data-side=right][data-state=collapsed] .\[\[data-side\=right\]\[data-state\=collapsed\]_\&\]\:cursor-w-resize{cursor:w-resize}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}.react-flow{--xy-edge-stroke-default:#b1b1b7;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#555;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:#ffffff80;--xy-minimap-background-color-default:#fff;--xy-minimap-mask-background-color-default:#f0f0f099;--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#e2e2e2;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:transparent;--xy-background-pattern-dots-color-default:#91919a;--xy-background-pattern-lines-color-default:#eee;--xy-background-pattern-cross-color-default:#e2e2e2;background-color:var(--xy-background-color,var(--xy-background-color-default));--xy-node-color-default:inherit;--xy-node-border-default:1px solid #1a192b;--xy-node-background-color-default:#fff;--xy-node-group-background-color-default:#f0f0f040;--xy-node-boxshadow-hover-default:0 1px 4px 1px #00000014;--xy-node-boxshadow-selected-default:0 0 0 .5px #1a192b;--xy-node-border-radius-default:3px;--xy-handle-background-color-default:#1a192b;--xy-handle-border-color-default:#fff;--xy-selection-background-color-default:#0059dc14;--xy-selection-border-default:1px dotted #0059dccc;--xy-controls-button-background-color-default:#fefefe;--xy-controls-button-background-color-hover-default:#f4f4f4;--xy-controls-button-color-default:inherit;--xy-controls-button-color-hover-default:inherit;--xy-controls-button-border-color-default:#eee;--xy-controls-box-shadow-default:0 0 2px 1px #00000014;--xy-edge-label-background-color-default:#fff;--xy-edge-label-color-default:inherit;--xy-resize-background-color-default:#3367d9;direction:ltr}.react-flow.dark{--xy-edge-stroke-default:#3e3e3e;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#727272;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:#96969640;--xy-minimap-background-color-default:#141414;--xy-minimap-mask-background-color-default:#3c3c3c99;--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#2b2b2b;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:#141414;--xy-background-pattern-dots-color-default:#555;--xy-background-pattern-lines-color-default:#333;--xy-background-pattern-cross-color-default:#333;--xy-node-color-default:#f8f8f8;--xy-node-border-default:1px solid #3c3c3c;--xy-node-background-color-default:#1e1e1e;--xy-node-group-background-color-default:#f0f0f040;--xy-node-boxshadow-hover-default:0 1px 4px 1px #ffffff14;--xy-node-boxshadow-selected-default:0 0 0 .5px #999;--xy-handle-background-color-default:#bebebe;--xy-handle-border-color-default:#1e1e1e;--xy-selection-background-color-default:#c8c8dc14;--xy-selection-border-default:1px dotted #c8c8dccc;--xy-controls-button-background-color-default:#2b2b2b;--xy-controls-button-background-color-hover-default:#3e3e3e;--xy-controls-button-color-default:#f8f8f8;--xy-controls-button-color-hover-default:#fff;--xy-controls-button-border-color-default:#5b5b5b;--xy-controls-box-shadow-default:0 0 2px 1px #00000014;--xy-edge-label-background-color-default:#141414;--xy-edge-label-color-default:#f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props,var(--xy-background-color,var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width,var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke,var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width,var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{pointer-events:none;position:absolute;overflow:visible}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected,var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:.5s linear infinite dashdraw}svg.react-flow__connectionline{z-index:1001;position:absolute;overflow:visible}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{-webkit-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default;position:absolute}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:0 0;pointer-events:none}.react-flow__nodesselection-rect{pointer-events:all;cursor:grab;position:absolute}.react-flow__handle{pointer-events:none;background-color:var(--xy-handle-background-color,var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color,var(--xy-handle-border-color-default));border-radius:100%;width:6px;min-width:5px;height:6px;min-height:5px;position:absolute}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;bottom:0;left:50%;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{z-index:5;margin:15px;position:absolute}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px)translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px)translateY(-50%)}.react-flow__attribution{background:var(--xy-attribution-background-color,var(--xy-attribution-background-color-default));margin:0;padding:2px 3px;font-size:10px}.react-flow__attribution a{color:#999;text-decoration:none}@keyframes dashdraw{0%{stroke-dashoffset:10px}}.react-flow__edgelabel-renderer{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__viewport-portal{-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__minimap{background:var(--xy-minimap-background-color-props,var(--xy-minimap-background-color,var(--xy-minimap-background-color-default)))}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var(--xy-minimap-mask-background-color-props,var(--xy-minimap-mask-background-color,var(--xy-minimap-mask-background-color-default)));stroke:var(--xy-minimap-mask-stroke-color-props,var(--xy-minimap-mask-stroke-color,var(--xy-minimap-mask-stroke-color-default)));stroke-width:var(--xy-minimap-mask-stroke-width-props,var(--xy-minimap-mask-stroke-width,var(--xy-minimap-mask-stroke-width-default)))}.react-flow__minimap-node{fill:var(--xy-minimap-node-background-color-props,var(--xy-minimap-node-background-color,var(--xy-minimap-node-background-color-default)));stroke:var(--xy-minimap-node-stroke-color-props,var(--xy-minimap-node-stroke-color,var(--xy-minimap-node-stroke-color-default)));stroke-width:var(--xy-minimap-node-stroke-width-props,var(--xy-minimap-node-stroke-width,var(--xy-minimap-node-stroke-width-default)))}.react-flow__background-pattern.dots{fill:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-dots-color-default)))}.react-flow__background-pattern.lines{stroke:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-lines-color-default)))}.react-flow__background-pattern.cross{stroke:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-cross-color-default)))}.react-flow__controls{box-shadow:var(--xy-controls-box-shadow,var(--xy-controls-box-shadow-default));flex-direction:column;display:flex}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{background:var(--xy-controls-button-background-color,var(--xy-controls-button-background-color-default));border:none;border-bottom:1px solid var(--xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default)));width:26px;height:26px;color:var(--xy-controls-button-color-props,var(--xy-controls-button-color,var(--xy-controls-button-color-default)));cursor:pointer;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;padding:4px;display:flex}.react-flow__controls-button svg{fill:currentColor;width:100%;max-width:12px;max-height:12px}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{border-radius:var(--xy-node-border-radius,var(--xy-node-border-radius-default));width:150px;color:var(--xy-node-color,var(--xy-node-color-default));text-align:center;border:var(--xy-node-border,var(--xy-node-border-default));background-color:var(--xy-node-background-color,var(--xy-node-background-color-default));padding:10px;font-size:12px}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover,var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected,var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color,var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color,var(--xy-selection-background-color-default));border:var(--xy-selection-border,var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var(--xy-controls-button-background-color-hover-props,var(--xy-controls-button-background-color-hover,var(--xy-controls-button-background-color-hover-default)));color:var(--xy-controls-button-color-hover-props,var(--xy-controls-button-color-hover,var(--xy-controls-button-color-hover-default)))}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var(--xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default)))}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{background-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border:1px solid #fff;border-radius:1px;width:5px;height:5px;translate:-50% -50%}.react-flow__resize-control.handle.left{top:50%;left:0}.react-flow__resize-control.handle.right{top:50%;left:100%}.react-flow__resize-control.handle.top{top:0;left:50%}.react-flow__resize-control.handle.bottom{top:100%;left:50%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border-style:solid;border-width:0}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;height:100%;top:0;transform:translate(-50%)}.react-flow__resize-control.line.left{border-left-width:1px;left:0}.react-flow__resize-control.line.right{border-right-width:1px;left:100%}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{width:100%;height:1px;left:0;transform:translateY(-50%)}.react-flow__resize-control.line.top{border-top-width:1px;top:0}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color,var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color,var(--xy-edge-label-color-default))}:root{--background:oklch(98.5% .002 247);--foreground:oklch(19% .015 258);--card:oklch(100% 0 0);--card-foreground:var(--foreground);--popover:var(--card);--popover-foreground:var(--foreground);--primary:oklch(55% .19 254);--primary-foreground:oklch(99% 0 0);--secondary:oklch(95% .006 250);--secondary-foreground:var(--foreground);--accent:oklch(93% .012 250);--accent-foreground:var(--foreground);--muted:oklch(95% .006 250);--muted-foreground:oklch(50% .02 255);--border:oklch(90% .008 250);--input:var(--border);--ring:var(--primary);--destructive:oklch(58% .23 28);--success:oklch(54% .16 147);--warning:oklch(61% .15 67);--sidebar:oklch(97% .004 250);--sidebar-foreground:var(--foreground);--sidebar-primary:var(--primary);--sidebar-primary-foreground:var(--primary-foreground);--sidebar-accent:oklch(92% .014 250);--sidebar-accent-foreground:var(--foreground);--sidebar-border:var(--border);--sidebar-ring:var(--ring);--radius:.625rem}.dark{--background:oklch(17% .012 260);--foreground:oklch(94% .006 250);--card:oklch(21% .014 258);--muted:oklch(27% .015 258);--muted-foreground:oklch(70% .02 250);--border:oklch(31% .015 258);--primary:oklch(68% .16 251);--secondary:oklch(27% .015 258);--accent:oklch(30% .02 258);--sidebar:oklch(19% .014 258);--sidebar-accent:oklch(28% .02 258)}*{border-color:var(--border)}html{background:var(--background);--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;width:100%;height:100%}html.dark{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}body{width:100%;height:100%;color:var(--foreground);background:var(--background);overflow:hidden}button,a{-webkit-tap-highlight-color:transparent}button,a,input,select{touch-action:manipulation}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--ring);outline-offset:2px}::selection{background:var(--primary)}@supports (color:color-mix(in lab, red, red)){::selection{background:color-mix(in oklab, var(--primary) 25%, transparent)}}::-webkit-scrollbar-track{background:0 0}.console-scrollbar{scrollbar-color:var(--foreground) transparent}@supports (color:color-mix(in lab, red, red)){.console-scrollbar{scrollbar-color:color-mix(in oklab, var(--foreground) 30%, transparent) transparent}}.console-scrollbar::-webkit-scrollbar-track{background:0 0}@keyframes lifecycle-fill{0%{transform:scaleY(0)}to{transform:scaleY(1)}}.lifecycle-line-progress{transform-origin:top;animation:.45s cubic-bezier(.23,1,.32,1) both lifecycle-fill}@media (prefers-reduced-motion:reduce){.lifecycle-line-progress,.react-flow__edge.animated path{animation:none}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-scroll-snap-strictness{syntax:"*";inherits:false;initial-value:proximity}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0)scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1))rotate(var(--tw-enter-rotate,0));filter:blur(var(--tw-enter-blur,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0)scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1))rotate(var(--tw-exit-rotate,0));filter:blur(var(--tw-exit-blur,0))}} diff --git a/go/headgateui/dist/assets/styles-D_-Bc3ZW.css b/go/headgateui/dist/assets/styles-D_-Bc3ZW.css deleted file mode 100644 index 7e5b47d..0000000 --- a/go/headgateui/dist/assets/styles-D_-Bc3ZW.css +++ /dev/null @@ -1,2 +0,0 @@ -/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */ -@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-scroll-snap-strictness:proximity;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:"";--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-cyrillic-ext-wght-normal-DjL33-gN.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-cyrillic-wght-normal-BEAKL7Jp.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-vietnamese-wght-normal-6IgcOCM7.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-latin-ext-wght-normal-DC-KSUi6.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-latin-wght-normal-BgDaEnEv.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@layer theme{:root,:host{--color-amber-400:oklch(82.8% .189 84.429);--color-amber-700:oklch(55.5% .163 48.998);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-600:oklch(54.6% .245 262.881);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-wide:.025em;--leading-tight:1.25;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-in:cubic-bezier(.4, 0, 1, 1);--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-xs:4px;--aspect-video:16 / 9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:"Geist Variable", ui-sans-serif, system-ui, sans-serif;--default-mono-font-family:ui-monospace, "SFMono-Regular", Menlo, monospace;--color-border:var(--border)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.\@container{container-type:inline-size}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-auto{inset:auto}.inset-y-0{inset-block:0}.top-0{top:0}.top-1\.5{top:calc(var(--spacing) * 1.5)}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing) * 2)}.top-3{top:calc(var(--spacing) * 3)}.top-3\.5{top:calc(var(--spacing) * 3.5)}.top-8{top:calc(var(--spacing) * 8)}.right-1{right:var(--spacing)}.right-2{right:calc(var(--spacing) * 2)}.right-3{right:calc(var(--spacing) * 3)}.bottom-0{bottom:0}.bottom-4{bottom:calc(var(--spacing) * 4)}.left-1\/2{left:50%}.left-3{left:calc(var(--spacing) * 3)}.left-4{left:calc(var(--spacing) * 4)}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-70{z-index:70}.z-100{z-index:100}.float-left{float:left}.float-none{float:none}.float-right{float:right}.clear-end{clear:inline-end}.clear-left{clear:left}.clear-none{clear:none}.clear-right{clear:right}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.-mx-4{margin-inline:calc(var(--spacing) * -4)}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-3\.5{margin-inline:calc(var(--spacing) * 3.5)}.my-0\.5{margin-block:calc(var(--spacing) * .5)}.my-1{margin-block:var(--spacing)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-auto{margin-top:auto}.mr-1{margin-right:var(--spacing)}.mr-2{margin-right:calc(var(--spacing) * 2)}.-mb-4{margin-bottom:calc(var(--spacing) * -4)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.ml-1{margin-left:var(--spacing)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1}.aspect-video{aspect-ratio:var(--aspect-video)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-9{width:calc(var(--spacing) * 9);height:calc(var(--spacing) * 9)}.size-full{width:100%;height:100%}.size-px\!{width:1px!important;height:1px!important}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-20\!{height:calc(var(--spacing) * 20)!important}.h-31{height:calc(var(--spacing) * 31)}.h-72{height:calc(var(--spacing) * 72)}.h-128{height:calc(var(--spacing) * 128)}.h-\[calc\(100\%-2rem\)\]{height:calc(100% - 2rem)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-svh{height:100svh}.max-h-\(--available-height\){max-height:var(--available-height)}.max-h-52{max-height:calc(var(--spacing) * 52)}.max-h-80{max-height:calc(var(--spacing) * 80)}.min-h-0{min-height:0}.min-h-48{min-height:calc(var(--spacing) * 48)}.min-h-96{min-height:calc(var(--spacing) * 96)}.min-h-svh{min-height:100svh}.w-\(--anchor-width\){width:var(--anchor-width)}.w-\(--sidebar-width\){width:var(--sidebar-width)}.w-0{width:0}.w-1{width:var(--spacing)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-32\!{width:calc(var(--spacing) * 32)!important}.w-36{width:calc(var(--spacing) * 36)}.w-40{width:calc(var(--spacing) * 40)}.w-44{width:calc(var(--spacing) * 44)}.w-65{width:calc(var(--spacing) * 65)}.w-72{width:calc(var(--spacing) * 72)}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-\(--skeleton-width\){max-width:var(--skeleton-width)}.max-w-64{max-width:calc(var(--spacing) * 64)}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:0}.min-w-5{min-width:calc(var(--spacing) * 5)}.min-w-32{min-width:calc(var(--spacing) * 32)}.min-w-36{min-width:calc(var(--spacing) * 36)}.min-w-48{min-width:calc(var(--spacing) * 48)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.origin-\(--transform-origin\){transform-origin:var(--transform-origin)}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-x-px{--tw-translate-x:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-px{--tw-translate-x:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-0{--tw-translate-y:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-2{--tw-translate-y:calc(var(--spacing) * 2);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[calc\(-50\%-2px\)\]{--tw-translate-y:calc(-50% - 2px);translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-45{rotate:45deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-in{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-pan-right{--tw-pan-x:pan-right;touch-action:var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,)}.touch-pan-up{--tw-pan-y:pan-up;touch-action:var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,)}.touch-manipulation{touch-action:manipulation}.resize{resize:both}.resize-none{resize:none}.resize-x{resize:horizontal}.snap-none{scroll-snap-type:none}.snap-x{scroll-snap-type:x var(--tw-scroll-snap-strictness)}.snap-center{scroll-snap-align:center}.snap-end{scroll-snap-align:end}.scroll-my-1{scroll-margin-block:var(--spacing)}.scroll-mt-16{scroll-margin-top:calc(var(--spacing) * 16)}.scrollbar-thin{scrollbar-width:thin}.break-before-auto{break-before:auto}.break-before-avoid{break-before:avoid}.break-before-avoid-page{break-before:avoid-page}.break-before-column{break-before:column}.break-before-left{break-before:left}.break-before-page{break-before:page}.break-inside-avoid{break-inside:avoid}.break-inside-avoid-column{break-inside:avoid-column}.break-after-auto{break-after:auto}.break-after-avoid{break-after:avoid}.break-after-avoid-page{break-after:avoid-page}.break-after-column{break-after:column}.break-after-left{break-after:left}.break-after-page{break-after:page}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[7rem_1fr\]{grid-template-columns:7rem 1fr}.grid-cols-\[8rem_1fr\]{grid-template-columns:8rem 1fr}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-baseline{place-content:baseline start}.place-content-between{place-content:space-between}.place-content-center{place-content:center}.place-content-center-safe{place-content:safe center}.place-content-end{place-content:end}.place-content-end-safe{place-content:safe end}.place-content-evenly{place-content:space-evenly}.place-content-start{place-content:start}.place-items-center{place-items:center}.place-items-center-safe{place-items:safe center}.place-items-end{place-items:end}.place-items-end-safe{place-items:safe end}.place-items-start{place-items:start}.items-baseline-last{align-items:last baseline}.items-center{align-items:center}.items-center-safe{align-items:safe center}.items-end{align-items:flex-end}.items-end-safe{align-items:safe flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-baseline{justify-content:baseline}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-center-safe{justify-content:safe center}.justify-end{justify-content:flex-end}.justify-end-safe{justify-content:safe flex-end}.justify-evenly{justify-content:space-evenly}.justify-normal{justify-content:normal}.justify-start{justify-content:flex-start}.justify-items-center-safe{justify-items:safe center}.justify-items-end{justify-items:end}.justify-items-end-safe{justify-items:safe end}.justify-items-normal{justify-items:normal}.justify-items-start{justify-items:start}.gap-0{gap:0}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block:0}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-y-1{row-gap:var(--spacing)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}.place-self-center{place-self:center}.place-self-center-safe{place-self:safe center}.place-self-end{place-self:end}.place-self-end-safe{place-self:safe end}.place-self-start{place-self:start}.self-baseline{align-self:baseline}.self-baseline-last{align-self:last baseline}.self-center{align-self:center}.self-center-safe{align-self:safe center}.self-end{align-self:flex-end}.self-end-safe{align-self:safe flex-end}.self-start{align-self:flex-start}.justify-self-center{justify-self:center}.justify-self-center-safe{justify-self:safe center}.justify-self-end{justify-self:flex-end}.justify-self-end-safe{justify-self:safe flex-end}.justify-self-start{justify-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-clip{overflow:clip}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-x-auto{overflow-x:auto}.overflow-x-clip{overflow-x:clip}.overflow-x-hidden{overflow-x:hidden}.overflow-x-scroll{overflow-x:scroll}.overflow-y-auto{overflow-y:auto}.overflow-y-clip{overflow-y:clip}.overflow-y-hidden{overflow-y:hidden}.overflow-y-scroll{overflow-y:scroll}.overscroll-contain{overscroll-behavior:contain}.overscroll-x-contain{overscroll-behavior-x:contain}.overscroll-y-contain{overscroll-behavior-y:contain}.rounded-\[2px\]{border-radius:2px}.rounded-\[4px\]{border-radius:4px}.rounded-\[min\(var\(--radius-md\)\,10px\)\]{border-radius:min(var(--radius-md), 10px)}.rounded-\[min\(var\(--radius-md\)\,12px\)\]{border-radius:min(var(--radius-md), 12px)}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-b-xl{border-bottom-right-radius:var(--radius-xl);border-bottom-left-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border\!{border-style:var(--tw-border-style)!important;border-width:1px!important}.border-0\!{border-style:var(--tw-border-style)!important;border-width:0!important}.border-\[1\.5px\]{border-style:var(--tw-border-style);border-width:1.5px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\(--color-border\){border-color:var(--color-border)}.border-border{border-color:var(--border)}.border-border\!{border-color:var(--border)!important}.border-border\/50{border-color:var(--border)}@supports (color:color-mix(in lab, red, red)){.border-border\/50{border-color:color-mix(in oklab, var(--border) 50%, transparent)}}.border-destructive,.border-destructive\/30{border-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.border-destructive\/30{border-color:color-mix(in oklab, var(--destructive) 30%, transparent)}}.border-destructive\/40{border-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.border-destructive\/40{border-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.border-input{border-color:var(--input)}.border-muted-foreground\/60{border-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.border-muted-foreground\/60{border-color:color-mix(in oklab, var(--muted-foreground) 60%, transparent)}}.border-primary,.border-primary\/20{border-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.border-primary\/20{border-color:color-mix(in oklab, var(--primary) 20%, transparent)}}.border-sidebar-border{border-color:var(--sidebar-border)}.border-success,.border-success\/35{border-color:var(--success)}@supports (color:color-mix(in lab, red, red)){.border-success\/35{border-color:color-mix(in oklab, var(--success) 35%, transparent)}}.border-success\/40{border-color:var(--success)}@supports (color:color-mix(in lab, red, red)){.border-success\/40{border-color:color-mix(in oklab, var(--success) 40%, transparent)}}.border-success\/60{border-color:var(--success)}@supports (color:color-mix(in lab, red, red)){.border-success\/60{border-color:color-mix(in oklab, var(--success) 60%, transparent)}}.border-transparent{border-color:#0000}.border-warning,.border-warning\/35{border-color:var(--warning)}@supports (color:color-mix(in lab, red, red)){.border-warning\/35{border-color:color-mix(in oklab, var(--warning) 35%, transparent)}}.bg-\(--color-bg\){background-color:var(--color-bg)}.bg-background{background-color:var(--background)}.bg-background\/90\!{background-color:var(--background)!important}@supports (color:color-mix(in lab, red, red)){.bg-background\/90\!{background-color:color-mix(in oklab, var(--background) 90%, transparent)!important}}.bg-background\/95{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.bg-background\/95{background-color:color-mix(in oklab, var(--background) 95%, transparent)}}.bg-black\/10{background-color:#0000001a}@supports (color:color-mix(in lab, red, red)){.bg-black\/10{background-color:color-mix(in oklab, var(--color-black) 10%, transparent)}}.bg-border{background-color:var(--border)}.bg-card{background-color:var(--card)}.bg-destructive,.bg-destructive\/5{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.bg-destructive\/5{background-color:color-mix(in oklab, var(--destructive) 5%, transparent)}}.bg-destructive\/10{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.bg-destructive\/10{background-color:color-mix(in oklab, var(--destructive) 10%, transparent)}}.bg-foreground{background-color:var(--foreground)}.bg-muted{background-color:var(--muted)}.bg-muted-foreground{background-color:var(--muted-foreground)}.bg-muted\/20{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\/20{background-color:color-mix(in oklab, var(--muted) 20%, transparent)}}.bg-muted\/50{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\/50{background-color:color-mix(in oklab, var(--muted) 50%, transparent)}}.bg-popover{background-color:var(--popover)}.bg-primary,.bg-primary\/5{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.bg-primary\/5{background-color:color-mix(in oklab, var(--primary) 5%, transparent)}}.bg-primary\/10{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.bg-primary\/10{background-color:color-mix(in oklab, var(--primary) 10%, transparent)}}.bg-secondary{background-color:var(--secondary)}.bg-sidebar{background-color:var(--sidebar)}.bg-sidebar-border{background-color:var(--sidebar-border)}.bg-sidebar-primary{background-color:var(--sidebar-primary)}.bg-success,.bg-success\/5{background-color:var(--success)}@supports (color:color-mix(in lab, red, red)){.bg-success\/5{background-color:color-mix(in oklab, var(--success) 5%, transparent)}}.bg-success\/10{background-color:var(--success)}@supports (color:color-mix(in lab, red, red)){.bg-success\/10{background-color:color-mix(in oklab, var(--success) 10%, transparent)}}.bg-transparent{background-color:#0000}.bg-transparent\!{background-color:#0000!important}.bg-warning,.bg-warning\/10{background-color:var(--warning)}@supports (color:color-mix(in lab, red, red)){.bg-warning\/10{background-color:color-mix(in oklab, var(--warning) 10%, transparent)}}.bg-clip-padding{background-clip:padding-box}.fill-foreground{fill:var(--foreground)}.p-0{padding:0}.p-1{padding:var(--spacing)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-8{padding-block:calc(var(--spacing) * 8)}.pt-0\.5{padding-top:calc(var(--spacing) * .5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pr-14{padding-right:calc(var(--spacing) * 14)}.pb-1{padding-bottom:var(--spacing)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pl-1\.5{padding-left:calc(var(--spacing) * 1.5)}.pl-2\.5{padding-left:calc(var(--spacing) * 2.5)}.pl-4{padding-left:calc(var(--spacing) * 4)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[0\.8rem\]{font-size:.8rem}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.text-balance{text-wrap:balance}.break-normal{overflow-wrap:normal;word-break:normal}.break-words,.wrap-break-word{overflow-wrap:break-word}.break-all{word-break:break-all}.break-keep{word-break:keep-all}.hyphens-manual{-webkit-hyphens:manual;hyphens:manual}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-700{color:var(--color-amber-700)}.text-background{color:var(--background)}.text-blue-600{color:var(--color-blue-600)}.text-card-foreground{color:var(--card-foreground)}.text-current{color:currentColor}.text-destructive{color:var(--destructive)}.text-foreground{color:var(--foreground)}.text-muted-foreground{color:var(--muted-foreground)}.text-popover-foreground{color:var(--popover-foreground)}.text-primary{color:var(--primary)}.text-primary-foreground{color:var(--primary-foreground)}.text-secondary-foreground{color:var(--secondary-foreground)}.text-sidebar-foreground,.text-sidebar-foreground\/65{color:var(--sidebar-foreground)}@supports (color:color-mix(in lab, red, red)){.text-sidebar-foreground\/65{color:color-mix(in oklab, var(--sidebar-foreground) 65%, transparent)}}.text-sidebar-foreground\/70{color:var(--sidebar-foreground)}@supports (color:color-mix(in lab, red, red)){.text-sidebar-foreground\/70{color:color-mix(in oklab, var(--sidebar-foreground) 70%, transparent)}}.text-sidebar-primary-foreground{color:var(--sidebar-primary-foreground)}.text-success{color:var(--success)}.text-warning{color:var(--warning)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline-offset-4{text-underline-offset:4px}.scheme-light{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}.scheme-light-dark{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light dark}@media (prefers-color-scheme:dark){.scheme-light-dark{--lightningcss-light: ;--lightningcss-dark:initial}}.scheme-normal{color-scheme:normal}.scheme-only-dark{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark only}.opacity-0{opacity:0}.opacity-100{opacity:1}.mix-blend-color-burn{mix-blend-mode:color-burn}.mix-blend-color-dodge{mix-blend-mode:color-dodge}.mix-blend-darken{mix-blend-mode:darken}.mix-blend-difference{mix-blend-mode:difference}.mix-blend-exclusion{mix-blend-mode:exclusion}.mix-blend-hard-light{mix-blend-mode:hard-light}.mix-blend-hue{mix-blend-mode:hue}.mix-blend-lighten{mix-blend-mode:lighten}.mix-blend-luminosity{mix-blend-mode:luminosity}.mix-blend-multiply{mix-blend-mode:multiply}.mix-blend-normal{mix-blend-mode:normal}.mix-blend-overlay{mix-blend-mode:overlay}.mix-blend-plus-darker{mix-blend-mode:plus-darker}.mix-blend-plus-lighter{mix-blend-mode:plus-lighter}.mix-blend-saturation{mix-blend-mode:saturation}.mix-blend-screen{mix-blend-mode:screen}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_0_1px_var\(--sidebar-border\)\]{--tw-shadow:0 0 0 1px var(--tw-shadow-color,var(--sidebar-border));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-success\/10{--tw-shadow-color:var(--success)}@supports (color:color-mix(in lab, red, red)){.shadow-success\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--success) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-foreground\/10{--tw-ring-color:var(--foreground)}@supports (color:color-mix(in lab, red, red)){.ring-foreground\/10{--tw-ring-color:color-mix(in oklab, var(--foreground) 10%, transparent)}}.ring-primary{--tw-ring-color:var(--primary)}.ring-sidebar-ring{--tw-ring-color:var(--sidebar-ring)}.ring-offset-2{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.outline-hidden{outline-offset:2px;outline:2px solid #0000}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[border-color\,box-shadow\,background-color\,transform\]{transition-property:border-color,box-shadow,background-color,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[border-color\,box-shadow\,transform\]{transition-property:border-color,box-shadow,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[color\,background-color\,border-color\,box-shadow\,transform\,opacity\]{transition-property:color,background-color,border-color,box-shadow,transform,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[color\,background-color\,border-color\,transform\]{transition-property:color,background-color,border-color,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[left\,right\,width\]{transition-property:left,right,width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[margin\,opacity\]{transition-property:margin,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[opacity\,transform\]{transition-property:opacity,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\,height\,padding\]{transition-property:width,height,padding;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\,transform\,background-color\]{transition-property:width,transform,background-color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-none{transition-property:none}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.ease-\[cubic-bezier\(0\.23\,1\,0\.32\,1\)\]{--tw-ease:cubic-bezier(.23,1,.32,1);transition-timing-function:cubic-bezier(.23,1,.32,1)}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-linear{--tw-ease:linear;transition-timing-function:linear}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-auto{-webkit-user-select:auto;user-select:auto}.select-none{-webkit-user-select:none;user-select:none}.zoom-in-95{--tw-enter-scale:.95}.fade-in{--tw-enter-opacity:0}.paused{animation-play-state:paused}.running{animation-play-state:running}.slide-in-from-top-1{--tw-enter-translate-y:calc(1*var(--spacing)*-1)}.zoom-in{--tw-enter-scale:0}.group-focus-within\/menu-item\:opacity-100:is(:where(.group\/menu-item):focus-within *){opacity:1}@media (hover:hover){.group-hover\:translate-x-0\.5:is(:where(.group):hover *){--tw-translate-x:calc(var(--spacing) * .5);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-hover\:-translate-y-0\.5:is(:where(.group):hover *){--tw-translate-y:calc(var(--spacing) * -.5);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-hover\:border-primary\/35:is(:where(.group):hover *){border-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.group-hover\:border-primary\/35:is(:where(.group):hover *){border-color:color-mix(in oklab, var(--primary) 35%, transparent)}}.group-hover\:shadow-sm:is(:where(.group):hover *){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.group-hover\/menu-item\:opacity-100:is(:where(.group\/menu-item):hover *){opacity:1}}.group-has-disabled\/field\:opacity-50:is(:where(.group\/field):has(:disabled) *){opacity:.5}.group-has-data-\[sidebar\=menu-action\]\/menu-item\:pr-8:is(:where(.group\/menu-item):has([data-sidebar=menu-action]) *){padding-right:calc(var(--spacing) * 8)}.group-has-\[\:focus-visible\]\/field-label\:ring-0:is(:where(.group\/field-label):has(:focus-visible) *){--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.group-has-\[\:focus-visible\]\/field-label\:not-data-checked\:border-input:is(:where(.group\/field-label):has(:focus-visible) *):not([data-checked]){border-color:var(--input)}.group-data-\[collapsible\=icon\]\:-mt-8:is(:where(.group)[data-collapsible=icon] *){margin-top:calc(var(--spacing) * -8)}.group-data-\[collapsible\=icon\]\:hidden:is(:where(.group)[data-collapsible=icon] *){display:none}.group-data-\[collapsible\=icon\]\:size-8\!:is(:where(.group)[data-collapsible=icon] *){width:calc(var(--spacing) * 8)!important;height:calc(var(--spacing) * 8)!important}.group-data-\[collapsible\=icon\]\:w-\(--sidebar-width-icon\):is(:where(.group)[data-collapsible=icon] *){width:var(--sidebar-width-icon)}.group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)\+\(--spacing\(4\)\)\)\]:is(:where(.group)[data-collapsible=icon] *){width:calc(var(--sidebar-width-icon) + (calc(var(--spacing) * 4)))}.group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)\+\(--spacing\(4\)\)\+2px\)\]:is(:where(.group)[data-collapsible=icon] *){width:calc(var(--sidebar-width-icon) + (calc(var(--spacing) * 4)) + 2px)}.group-data-\[collapsible\=icon\]\:overflow-hidden:is(:where(.group)[data-collapsible=icon] *){overflow:hidden}.group-data-\[collapsible\=icon\]\:p-0\!:is(:where(.group)[data-collapsible=icon] *){padding:0!important}.group-data-\[collapsible\=icon\]\:p-2\!:is(:where(.group)[data-collapsible=icon] *){padding:calc(var(--spacing) * 2)!important}.group-data-\[collapsible\=icon\]\:opacity-0:is(:where(.group)[data-collapsible=icon] *){opacity:0}.group-data-\[collapsible\=offcanvas\]\:w-0:is(:where(.group)[data-collapsible=offcanvas] *){width:0}.group-data-\[collapsible\=offcanvas\]\:translate-x-0:is(:where(.group)[data-collapsible=offcanvas] *){--tw-translate-x:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.group-data-\[side\=left\]\:-right-4:is(:where(.group)[data-side=left] *){right:calc(var(--spacing) * -4)}.group-data-\[side\=left\]\:border-r:is(:where(.group)[data-side=left] *){border-right-style:var(--tw-border-style);border-right-width:1px}.group-data-\[side\=right\]\:left-0:is(:where(.group)[data-side=right] *){left:0}.group-data-\[side\=right\]\:rotate-180:is(:where(.group)[data-side=right] *){rotate:180deg}.group-data-\[side\=right\]\:border-l:is(:where(.group)[data-side=right] *){border-left-style:var(--tw-border-style);border-left-width:1px}.group-data-\[variant\=floating\]\:rounded-lg:is(:where(.group)[data-variant=floating] *){border-radius:var(--radius-lg)}.group-data-\[variant\=floating\]\:shadow-sm:is(:where(.group)[data-variant=floating] *){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.group-data-\[variant\=floating\]\:ring-1:is(:where(.group)[data-variant=floating] *){--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.group-data-\[variant\=floating\]\:ring-sidebar-border:is(:where(.group)[data-variant=floating] *){--tw-ring-color:var(--sidebar-border)}@media (hover:hover){.peer-hover\/menu-button\:text-sidebar-accent-foreground:is(:where(.peer\/menu-button):hover~*){color:var(--sidebar-accent-foreground)}}.peer-data-active\/menu-button\:text-sidebar-accent-foreground:is(:where(.peer\/menu-button)[data-active]~*){color:var(--sidebar-accent-foreground)}.peer-data-\[size\=default\]\/menu-button\:top-1\.5:is(:where(.peer\/menu-button)[data-size=default]~*){top:calc(var(--spacing) * 1.5)}.peer-data-\[size\=lg\]\/menu-button\:top-2\.5:is(:where(.peer\/menu-button)[data-size=lg]~*){top:calc(var(--spacing) * 2.5)}.peer-data-\[size\=sm\]\/menu-button\:top-1:is(:where(.peer\/menu-button)[data-size=sm]~*){top:var(--spacing)}.file\:inline-flex::file-selector-button{display:inline-flex}.file\:h-6::file-selector-button{height:calc(var(--spacing) * 6)}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.file\:text-foreground::file-selector-button{color:var(--foreground)}.placeholder\:text-muted-foreground::placeholder{color:var(--muted-foreground)}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:-inset-2:after{content:var(--tw-content);inset:calc(var(--spacing) * -2)}.after\:-inset-x-3:after{content:var(--tw-content);inset-inline:calc(var(--spacing) * -3)}.after\:-inset-y-2:after{content:var(--tw-content);inset-block:calc(var(--spacing) * -2)}.after\:inset-y-0:after{content:var(--tw-content);inset-block:0}.after\:start-1\/2:after{content:var(--tw-content);inset-inline-start:50%}.after\:w-\[2px\]:after{content:var(--tw-content);width:2px}.group-data-\[collapsible\=offcanvas\]\:after\:left-full:is(:where(.group)[data-collapsible=offcanvas] *):after{content:var(--tw-content);left:100%}.last\:mb-0:last-child{margin-bottom:0}.last\:pb-0:last-child{padding-bottom:0}@media (hover:hover){.hover\:-translate-y-0\.5:hover{--tw-translate-y:calc(var(--spacing) * -.5);translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:border-primary\/50:hover{border-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\:border-primary\/50:hover{border-color:color-mix(in oklab, var(--primary) 50%, transparent)}}.hover\:bg-\[color-mix\(in_oklch\,var\(--secondary\)\,var\(--foreground\)_5\%\)\]:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-\[color-mix\(in_oklch\,var\(--secondary\)\,var\(--foreground\)_5\%\)\]:hover{background-color:color-mix(in oklch,var(--secondary),var(--foreground) 5%)}}.hover\:bg-destructive\/20:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-destructive\/20:hover{background-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.hover\:bg-muted:hover,.hover\:bg-muted\/50:hover{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-muted\/50:hover{background-color:color-mix(in oklab, var(--muted) 50%, transparent)}}.hover\:bg-primary\/80:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\:bg-primary\/80:hover{background-color:color-mix(in oklab, var(--primary) 80%, transparent)}}.hover\:bg-sidebar-accent:hover{background-color:var(--sidebar-accent)}.hover\:text-foreground:hover{color:var(--foreground)}.hover\:text-sidebar-accent-foreground:hover{color:var(--sidebar-accent-foreground)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-90:hover{opacity:.9}.hover\:shadow-\[0_0_0_1px_var\(--sidebar-accent\)\]:hover{--tw-shadow:0 0 0 1px var(--tw-shadow-color,var(--sidebar-accent));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:group-data-\[collapsible\=offcanvas\]\:bg-sidebar:hover:is(:where(.group)[data-collapsible=offcanvas] *){background-color:var(--sidebar)}.hover\:after\:bg-sidebar-border:hover:after{content:var(--tw-content);background-color:var(--sidebar-border)}}.focus\:not-sr-only:focus{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.focus\:bg-accent:focus{background-color:var(--accent)}.focus\:text-accent-foreground:focus,:is(.not-data-\[variant\=destructive\]\:focus\:\*\*\:text-accent-foreground:not([data-variant=destructive]):focus *){color:var(--accent-foreground)}.focus-visible\:border-destructive\/40:focus-visible{border-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.focus-visible\:border-destructive\/40:focus-visible{border-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.focus-visible\:border-ring:focus-visible{border-color:var(--ring)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-3:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.focus-visible\:ring-ring:focus-visible,.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:bg-sidebar-accent:active{background-color:var(--sidebar-accent)}.active\:text-sidebar-accent-foreground:active{color:var(--sidebar-accent-foreground)}.active\:not-aria-\[haspopup\]\:scale-\[0\.97\]:active:not([aria-haspopup]){scale:.97}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-input\/50:disabled{background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.disabled\:bg-input\/50:disabled{background-color:color-mix(in oklab, var(--input) 50%, transparent)}}.disabled\:opacity-50:disabled{opacity:.5}:where([data-side=left]) .in-data-\[side\=left\]\:cursor-w-resize{cursor:w-resize}:where([data-side=right]) .in-data-\[side\=right\]\:cursor-e-resize{cursor:e-resize}:where([data-slot=button-group]) .in-data-\[slot\=button-group\]\:rounded-lg{border-radius:var(--radius-lg)}.has-data-\[icon\=inline-end\]\:pr-1\.5:has([data-icon=inline-end]){padding-right:calc(var(--spacing) * 1.5)}.has-data-\[icon\=inline-end\]\:pr-2:has([data-icon=inline-end]){padding-right:calc(var(--spacing) * 2)}.has-data-\[icon\=inline-start\]\:pl-1\.5:has([data-icon=inline-start]){padding-left:calc(var(--spacing) * 1.5)}.has-data-\[icon\=inline-start\]\:pl-2:has([data-icon=inline-start]){padding-left:calc(var(--spacing) * 2)}.has-data-\[slot\=kbd\]\:pr-1\.5:has([data-slot=kbd]){padding-right:calc(var(--spacing) * 1.5)}.has-data-\[variant\=inset\]\:bg-sidebar:has([data-variant=inset]){background-color:var(--sidebar)}.aria-disabled\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-expanded\:bg-muted[aria-expanded=true]{background-color:var(--muted)}.aria-expanded\:bg-secondary[aria-expanded=true]{background-color:var(--secondary)}.aria-expanded\:text-foreground[aria-expanded=true]{color:var(--foreground)}.aria-expanded\:text-secondary-foreground[aria-expanded=true]{color:var(--secondary-foreground)}.aria-expanded\:opacity-100[aria-expanded=true]{opacity:1}.aria-invalid\:border-destructive[aria-invalid=true]{border-color:var(--destructive)}.aria-invalid\:ring-3[aria-invalid=true]{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.aria-invalid\:aria-checked\:border-primary[aria-invalid=true][aria-checked=true]{border-color:var(--primary)}.data-active\:bg-sidebar-accent[data-active]{background-color:var(--sidebar-accent)}.data-active\:font-medium[data-active]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-active\:text-sidebar-accent-foreground[data-active]{color:var(--sidebar-accent-foreground)}.data-checked\:border-primary[data-checked]{border-color:var(--primary)}.data-checked\:bg-primary[data-checked]{background-color:var(--primary)}.data-checked\:text-primary-foreground[data-checked]{color:var(--primary-foreground)}.group-has-\[\:focus-visible\]\/field-label\:data-checked\:border-primary:is(:where(.group\/field-label):has(:focus-visible) *)[data-checked]{border-color:var(--primary)}.data-closed\:animate-out[data-closed]{animation:exit var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.data-closed\:fade-out-0[data-closed]{--tw-exit-opacity:0}.data-closed\:zoom-out-95[data-closed]{--tw-exit-scale:.95}.data-disabled\:pointer-events-none[data-disabled]{pointer-events:none}.data-disabled\:opacity-50[data-disabled]{opacity:.5}.data-ending-style\:opacity-0[data-ending-style]{opacity:0}.data-horizontal\:h-px[data-horizontal]{height:1px}.data-horizontal\:w-full[data-horizontal]{width:100%}.data-open\:animate-in[data-open]{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.data-open\:fade-in-0[data-open]{--tw-enter-opacity:0}.data-open\:zoom-in-95[data-open]{--tw-enter-scale:.95}@media (hover:hover){.data-open\:hover\:bg-sidebar-accent[data-open]:hover{background-color:var(--sidebar-accent)}.data-open\:hover\:text-sidebar-accent-foreground[data-open]:hover{color:var(--sidebar-accent-foreground)}}.data-placeholder\:text-muted-foreground[data-placeholder]{color:var(--muted-foreground)}.data-starting-style\:opacity-0[data-starting-style]{opacity:0}.data-vertical\:w-px[data-vertical]{width:1px}.data-vertical\:self-stretch[data-vertical]{align-self:stretch}.data-\[align-trigger\=true\]\:animate-none[data-align-trigger=true]{animation:none}.data-\[side\=bottom\]\:inset-x-0[data-side=bottom]{inset-inline:0}.data-\[side\=bottom\]\:top-1[data-side=bottom]{top:var(--spacing)}.data-\[side\=bottom\]\:bottom-0[data-side=bottom]{bottom:0}.data-\[side\=bottom\]\:h-auto[data-side=bottom]{height:auto}.data-\[side\=bottom\]\:border-t[data-side=bottom]{border-top-style:var(--tw-border-style);border-top-width:1px}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:calc(2*var(--spacing)*-1)}.data-\[side\=bottom\]\:data-ending-style\:translate-y-\[2\.5rem\][data-side=bottom][data-ending-style],.data-\[side\=bottom\]\:data-starting-style\:translate-y-\[2\.5rem\][data-side=bottom][data-starting-style]{--tw-translate-y:2.5rem;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=inline-end\]\:top-1\/2\![data-side=inline-end]{top:50%!important}.data-\[side\=inline-end\]\:-left-1[data-side=inline-end]{left:calc(var(--spacing) * -1)}.data-\[side\=inline-end\]\:-translate-y-1\/2[data-side=inline-end]{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=inline-end\]\:slide-in-from-left-2[data-side=inline-end]{--tw-enter-translate-x:calc(2*var(--spacing)*-1)}.data-\[side\=inline-start\]\:top-1\/2\![data-side=inline-start]{top:50%!important}.data-\[side\=inline-start\]\:-right-1[data-side=inline-start]{right:calc(var(--spacing) * -1)}.data-\[side\=inline-start\]\:-translate-y-1\/2[data-side=inline-start]{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=inline-start\]\:slide-in-from-right-2[data-side=inline-start]{--tw-enter-translate-x:calc(2*var(--spacing))}.data-\[side\=left\]\:inset-y-0[data-side=left]{inset-block:0}.data-\[side\=left\]\:top-1\/2\![data-side=left]{top:50%!important}.data-\[side\=left\]\:-right-1[data-side=left]{right:calc(var(--spacing) * -1)}.data-\[side\=left\]\:left-0[data-side=left]{left:0}.data-\[side\=left\]\:h-full[data-side=left]{height:100%}.data-\[side\=left\]\:w-3\/4[data-side=left]{width:75%}.data-\[side\=left\]\:-translate-y-1\/2[data-side=left]{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=left\]\:border-r[data-side=left]{border-right-style:var(--tw-border-style);border-right-width:1px}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:calc(2*var(--spacing))}.data-\[side\=left\]\:group-data-\[collapsible\=offcanvas\]\:left-\[calc\(var\(--sidebar-width\)\*-1\)\][data-side=left]:is(:where(.group)[data-collapsible=offcanvas] *){left:calc(var(--sidebar-width) * -1)}.data-\[side\=left\]\:data-ending-style\:translate-x-\[-2\.5rem\][data-side=left][data-ending-style],.data-\[side\=left\]\:data-starting-style\:translate-x-\[-2\.5rem\][data-side=left][data-starting-style]{--tw-translate-x:-2.5rem;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=right\]\:inset-y-0[data-side=right]{inset-block:0}.data-\[side\=right\]\:top-1\/2\![data-side=right]{top:50%!important}.data-\[side\=right\]\:right-0[data-side=right]{right:0}.data-\[side\=right\]\:-left-1[data-side=right]{left:calc(var(--spacing) * -1)}.data-\[side\=right\]\:h-full[data-side=right]{height:100%}.data-\[side\=right\]\:w-3\/4[data-side=right]{width:75%}.data-\[side\=right\]\:-translate-y-1\/2[data-side=right]{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=right\]\:border-l[data-side=right]{border-left-style:var(--tw-border-style);border-left-width:1px}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:calc(2*var(--spacing)*-1)}.data-\[side\=right\]\:group-data-\[collapsible\=offcanvas\]\:right-\[calc\(var\(--sidebar-width\)\*-1\)\][data-side=right]:is(:where(.group)[data-collapsible=offcanvas] *){right:calc(var(--sidebar-width) * -1)}.data-\[side\=right\]\:data-ending-style\:translate-x-\[2\.5rem\][data-side=right][data-ending-style],.data-\[side\=right\]\:data-starting-style\:translate-x-\[2\.5rem\][data-side=right][data-starting-style]{--tw-translate-x:2.5rem;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=top\]\:inset-x-0[data-side=top]{inset-inline:0}.data-\[side\=top\]\:top-0[data-side=top]{top:0}.data-\[side\=top\]\:-bottom-2\.5[data-side=top]{bottom:calc(var(--spacing) * -2.5)}.data-\[side\=top\]\:h-auto[data-side=top]{height:auto}.data-\[side\=top\]\:border-b[data-side=top]{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:calc(2*var(--spacing))}.data-\[side\=top\]\:data-ending-style\:translate-y-\[-2\.5rem\][data-side=top][data-ending-style],.data-\[side\=top\]\:data-starting-style\:translate-y-\[-2\.5rem\][data-side=top][data-starting-style]{--tw-translate-y:-2.5rem;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[size\=default\]\:h-8[data-size=default]{height:calc(var(--spacing) * 8)}.data-\[size\=md\]\:text-sm[data-size=md]{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.data-\[size\=sm\]\:h-7[data-size=sm]{height:calc(var(--spacing) * 7)}.data-\[size\=sm\]\:rounded-\[min\(var\(--radius-md\)\,10px\)\][data-size=sm]{border-radius:min(var(--radius-md), 10px)}.data-\[size\=sm\]\:text-xs[data-size=sm]{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}:is(.\*\*\:data-\[slot\=kbd\]\:relative *)[data-slot=kbd]{position:relative}:is(.\*\*\:data-\[slot\=kbd\]\:isolate *)[data-slot=kbd]{isolation:isolate}:is(.\*\*\:data-\[slot\=kbd\]\:z-50 *)[data-slot=kbd]{z-index:50}:is(.\*\*\:data-\[slot\=kbd\]\:rounded-sm *)[data-slot=kbd]{border-radius:var(--radius-sm)}:is(.\*\:data-\[slot\=select-value\]\:line-clamp-1>*)[data-slot=select-value]{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}:is(.\*\:data-\[slot\=select-value\]\:flex>*)[data-slot=select-value]{display:flex}:is(.\*\:data-\[slot\=select-value\]\:items-center>*)[data-slot=select-value]{align-items:center}:is(.\*\:data-\[slot\=select-value\]\:gap-1\.5>*)[data-slot=select-value]{gap:calc(var(--spacing) * 1.5)}.data-\[state\=delayed-open\]\:animate-in[data-state=delayed-open]{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.data-\[state\=delayed-open\]\:fade-in-0[data-state=delayed-open]{--tw-enter-opacity:0}.data-\[state\=delayed-open\]\:zoom-in-95[data-state=delayed-open]{--tw-enter-scale:.95}@supports ((-webkit-backdrop-filter:var(--tw)) or (backdrop-filter:var(--tw))){.supports-backdrop-filter\:backdrop-blur-xs{--tw-backdrop-blur:blur(var(--blur-xs));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}}@media (prefers-reduced-motion:reduce){.motion-reduce\:transform-none{transform:none}.motion-reduce\:animate-none{animation:none}.motion-reduce\:transition-none{transition-property:none}.motion-reduce\:active\:not-aria-\[haspopup\]\:scale-100:active:not([aria-haspopup]){--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}}@media (width>=40rem){.sm\:flex{display:flex}.sm\:max-w-sm{max-width:var(--container-sm)}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.data-\[side\=left\]\:sm\:max-w-2xl[data-side=left]{max-width:var(--container-2xl)}.data-\[side\=left\]\:sm\:max-w-sm[data-side=left]{max-width:var(--container-sm)}.data-\[side\=right\]\:sm\:max-w-2xl[data-side=right]{max-width:var(--container-2xl)}.data-\[side\=right\]\:sm\:max-w-sm[data-side=right]{max-width:var(--container-sm)}}@media (width>=48rem){.md\:block{display:block}.md\:flex{display:flex}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.md\:opacity-0{opacity:0}.md\:peer-data-\[variant\=inset\]\:m-2:is(:where(.peer)[data-variant=inset]~*){margin:calc(var(--spacing) * 2)}.md\:peer-data-\[variant\=inset\]\:ml-0:is(:where(.peer)[data-variant=inset]~*){margin-left:0}.md\:peer-data-\[variant\=inset\]\:rounded-xl:is(:where(.peer)[data-variant=inset]~*){border-radius:var(--radius-xl)}.md\:peer-data-\[variant\=inset\]\:shadow-sm:is(:where(.peer)[data-variant=inset]~*){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.md\:peer-data-\[variant\=inset\]\:peer-data-\[state\=collapsed\]\:ml-2:is(:where(.peer)[data-variant=inset]~*):is(:where(.peer)[data-state=collapsed]~*){margin-left:calc(var(--spacing) * 2)}.md\:after\:hidden:after{content:var(--tw-content);display:none}}@media (width>=64rem){.lg\:p-6{padding:calc(var(--spacing) * 6)}}@media (width>=80rem){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-\[minmax\(0\,2fr\)_minmax\(18rem\,1fr\)\]{grid-template-columns:minmax(0,2fr) minmax(18rem,1fr)}}@media (width>=96rem){.\32 xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.ltr\:-translate-x-1\/2:where(:not(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),[dir=ltr],[dir=ltr] *),.rtl\:-translate-x-1\/2:where(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),[dir=rtl],[dir=rtl] *){--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.dark\:border-input:where(.dark,.dark *){border-color:var(--input)}.dark\:bg-destructive\/20:where(.dark,.dark *){background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-destructive\/20:where(.dark,.dark *){background-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.dark\:bg-input\/30:where(.dark,.dark *){background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\:bg-input\/30:where(.dark,.dark *){background-color:color-mix(in oklab, var(--input) 30%, transparent)}}.dark\:text-amber-400:where(.dark,.dark *){color:var(--color-amber-400)}.dark\:text-blue-400:where(.dark,.dark *){color:var(--color-blue-400)}@media (hover:hover){.dark\:hover\:bg-destructive\/30:where(.dark,.dark *):hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-destructive\/30:where(.dark,.dark *):hover{background-color:color-mix(in oklab, var(--destructive) 30%, transparent)}}.dark\:hover\:bg-input\/50:where(.dark,.dark *):hover{background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-input\/50:where(.dark,.dark *):hover{background-color:color-mix(in oklab, var(--input) 50%, transparent)}}.dark\:hover\:bg-muted\/50:where(.dark,.dark *):hover{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-muted\/50:where(.dark,.dark *):hover{background-color:color-mix(in oklab, var(--muted) 50%, transparent)}}}.dark\:focus-visible\:ring-destructive\/40:where(.dark,.dark *):focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\:focus-visible\:ring-destructive\/40:where(.dark,.dark *):focus-visible{--tw-ring-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.dark\:disabled\:bg-input\/80:where(.dark,.dark *):disabled{background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\:disabled\:bg-input\/80:where(.dark,.dark *):disabled{background-color:color-mix(in oklab, var(--input) 80%, transparent)}}.dark\:aria-invalid\:border-destructive\/50:where(.dark,.dark *)[aria-invalid=true]{border-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\:aria-invalid\:border-destructive\/50:where(.dark,.dark *)[aria-invalid=true]{border-color:color-mix(in oklab, var(--destructive) 50%, transparent)}}.dark\:aria-invalid\:ring-destructive\/40:where(.dark,.dark *)[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\:aria-invalid\:ring-destructive\/40:where(.dark,.dark *)[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.dark\:data-checked\:bg-primary:where(.dark,.dark *)[data-checked]{background-color:var(--primary)}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:var(--muted-foreground)}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke=\#ccc]{stroke:var(--border)}@supports (color:color-mix(in lab, red, red)){.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke=\#ccc]{stroke:color-mix(in oklab, var(--border) 50%, transparent)}}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:var(--border)}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke=\#fff]{stroke:#0000}.\[\&_\.recharts-layer\]\:outline-hidden .recharts-layer{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.\[\&_\.recharts-layer\]\:outline-hidden .recharts-layer{outline-offset:2px;outline:2px solid #0000}}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke=\#ccc]{stroke:var(--border)}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:var(--muted)}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke=\#ccc]{stroke:var(--border)}.\[\&_\.recharts-sector\]\:outline-hidden .recharts-sector{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.\[\&_\.recharts-sector\]\:outline-hidden .recharts-sector{outline-offset:2px;outline:2px solid #0000}}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke=\#fff]{stroke:#0000}.\[\&_\.recharts-surface\]\:outline-hidden .recharts-surface{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.\[\&_\.recharts-surface\]\:outline-hidden .recharts-surface{outline-offset:2px;outline:2px solid #0000}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-3 svg:not([class*=size-]){width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-3\.5 svg:not([class*=size-]){width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}:is(.\*\:\[a\]\:underline>*):is(a){text-decoration-line:underline}:is(.\*\:\[a\]\:underline-offset-3>*):is(a){text-underline-offset:3px}@media (hover:hover){:is(.\*\:\[a\]\:hover\:text-foreground>*):is(a):hover{color:var(--foreground)}}:is(.\*\:\[span\]\:last\:flex>*):is(span):last-child{display:flex}:is(.\*\:\[span\]\:last\:items-center>*):is(span):last-child{align-items:center}:is(.\*\:\[span\]\:last\:gap-2>*):is(span):last-child{gap:calc(var(--spacing) * 2)}.\[\&\>button\]\:hidden>button{display:none}.\[\&\>span\:last-child\]\:truncate>span:last-child{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.\[\&\>svg\]\:size-3\.5>svg{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.\[\&\>svg\]\:size-4>svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&\>svg\]\:h-2\.5>svg{height:calc(var(--spacing) * 2.5)}.\[\&\>svg\]\:h-3>svg{height:calc(var(--spacing) * 3)}.\[\&\>svg\]\:w-2\.5>svg{width:calc(var(--spacing) * 2.5)}.\[\&\>svg\]\:w-3>svg{width:calc(var(--spacing) * 3)}.\[\&\>svg\]\:shrink-0>svg{flex-shrink:0}.\[\&\>svg\]\:text-muted-foreground>svg{color:var(--muted-foreground)}.\[\&\>svg\]\:text-sidebar-accent-foreground>svg{color:var(--sidebar-accent-foreground)}[data-side=left][data-collapsible=offcanvas] .\[\[data-side\=left\]\[data-collapsible\=offcanvas\]_\&\]\:-right-2{right:calc(var(--spacing) * -2)}[data-side=left][data-state=collapsed] .\[\[data-side\=left\]\[data-state\=collapsed\]_\&\]\:cursor-e-resize{cursor:e-resize}[data-side=right][data-collapsible=offcanvas] .\[\[data-side\=right\]\[data-collapsible\=offcanvas\]_\&\]\:-left-2{left:calc(var(--spacing) * -2)}[data-side=right][data-state=collapsed] .\[\[data-side\=right\]\[data-state\=collapsed\]_\&\]\:cursor-w-resize{cursor:w-resize}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}.react-flow{--xy-edge-stroke-default:#b1b1b7;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#555;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:#ffffff80;--xy-minimap-background-color-default:#fff;--xy-minimap-mask-background-color-default:#f0f0f099;--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#e2e2e2;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:transparent;--xy-background-pattern-dots-color-default:#91919a;--xy-background-pattern-lines-color-default:#eee;--xy-background-pattern-cross-color-default:#e2e2e2;background-color:var(--xy-background-color,var(--xy-background-color-default));--xy-node-color-default:inherit;--xy-node-border-default:1px solid #1a192b;--xy-node-background-color-default:#fff;--xy-node-group-background-color-default:#f0f0f040;--xy-node-boxshadow-hover-default:0 1px 4px 1px #00000014;--xy-node-boxshadow-selected-default:0 0 0 .5px #1a192b;--xy-node-border-radius-default:3px;--xy-handle-background-color-default:#1a192b;--xy-handle-border-color-default:#fff;--xy-selection-background-color-default:#0059dc14;--xy-selection-border-default:1px dotted #0059dccc;--xy-controls-button-background-color-default:#fefefe;--xy-controls-button-background-color-hover-default:#f4f4f4;--xy-controls-button-color-default:inherit;--xy-controls-button-color-hover-default:inherit;--xy-controls-button-border-color-default:#eee;--xy-controls-box-shadow-default:0 0 2px 1px #00000014;--xy-edge-label-background-color-default:#fff;--xy-edge-label-color-default:inherit;--xy-resize-background-color-default:#3367d9;direction:ltr}.react-flow.dark{--xy-edge-stroke-default:#3e3e3e;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#727272;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:#96969640;--xy-minimap-background-color-default:#141414;--xy-minimap-mask-background-color-default:#3c3c3c99;--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#2b2b2b;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:#141414;--xy-background-pattern-dots-color-default:#555;--xy-background-pattern-lines-color-default:#333;--xy-background-pattern-cross-color-default:#333;--xy-node-color-default:#f8f8f8;--xy-node-border-default:1px solid #3c3c3c;--xy-node-background-color-default:#1e1e1e;--xy-node-group-background-color-default:#f0f0f040;--xy-node-boxshadow-hover-default:0 1px 4px 1px #ffffff14;--xy-node-boxshadow-selected-default:0 0 0 .5px #999;--xy-handle-background-color-default:#bebebe;--xy-handle-border-color-default:#1e1e1e;--xy-selection-background-color-default:#c8c8dc14;--xy-selection-border-default:1px dotted #c8c8dccc;--xy-controls-button-background-color-default:#2b2b2b;--xy-controls-button-background-color-hover-default:#3e3e3e;--xy-controls-button-color-default:#f8f8f8;--xy-controls-button-color-hover-default:#fff;--xy-controls-button-border-color-default:#5b5b5b;--xy-controls-box-shadow-default:0 0 2px 1px #00000014;--xy-edge-label-background-color-default:#141414;--xy-edge-label-color-default:#f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props,var(--xy-background-color,var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width,var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke,var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width,var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{pointer-events:none;position:absolute;overflow:visible}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected,var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:.5s linear infinite dashdraw}svg.react-flow__connectionline{z-index:1001;position:absolute;overflow:visible}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{-webkit-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default;position:absolute}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:0 0;pointer-events:none}.react-flow__nodesselection-rect{pointer-events:all;cursor:grab;position:absolute}.react-flow__handle{pointer-events:none;background-color:var(--xy-handle-background-color,var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color,var(--xy-handle-border-color-default));border-radius:100%;width:6px;min-width:5px;height:6px;min-height:5px;position:absolute}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;bottom:0;left:50%;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{z-index:5;margin:15px;position:absolute}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px)translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px)translateY(-50%)}.react-flow__attribution{background:var(--xy-attribution-background-color,var(--xy-attribution-background-color-default));margin:0;padding:2px 3px;font-size:10px}.react-flow__attribution a{color:#999;text-decoration:none}@keyframes dashdraw{0%{stroke-dashoffset:10px}}.react-flow__edgelabel-renderer{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__viewport-portal{-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__minimap{background:var(--xy-minimap-background-color-props,var(--xy-minimap-background-color,var(--xy-minimap-background-color-default)))}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var(--xy-minimap-mask-background-color-props,var(--xy-minimap-mask-background-color,var(--xy-minimap-mask-background-color-default)));stroke:var(--xy-minimap-mask-stroke-color-props,var(--xy-minimap-mask-stroke-color,var(--xy-minimap-mask-stroke-color-default)));stroke-width:var(--xy-minimap-mask-stroke-width-props,var(--xy-minimap-mask-stroke-width,var(--xy-minimap-mask-stroke-width-default)))}.react-flow__minimap-node{fill:var(--xy-minimap-node-background-color-props,var(--xy-minimap-node-background-color,var(--xy-minimap-node-background-color-default)));stroke:var(--xy-minimap-node-stroke-color-props,var(--xy-minimap-node-stroke-color,var(--xy-minimap-node-stroke-color-default)));stroke-width:var(--xy-minimap-node-stroke-width-props,var(--xy-minimap-node-stroke-width,var(--xy-minimap-node-stroke-width-default)))}.react-flow__background-pattern.dots{fill:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-dots-color-default)))}.react-flow__background-pattern.lines{stroke:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-lines-color-default)))}.react-flow__background-pattern.cross{stroke:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-cross-color-default)))}.react-flow__controls{box-shadow:var(--xy-controls-box-shadow,var(--xy-controls-box-shadow-default));flex-direction:column;display:flex}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{background:var(--xy-controls-button-background-color,var(--xy-controls-button-background-color-default));border:none;border-bottom:1px solid var(--xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default)));width:26px;height:26px;color:var(--xy-controls-button-color-props,var(--xy-controls-button-color,var(--xy-controls-button-color-default)));cursor:pointer;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;padding:4px;display:flex}.react-flow__controls-button svg{fill:currentColor;width:100%;max-width:12px;max-height:12px}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{border-radius:var(--xy-node-border-radius,var(--xy-node-border-radius-default));width:150px;color:var(--xy-node-color,var(--xy-node-color-default));text-align:center;border:var(--xy-node-border,var(--xy-node-border-default));background-color:var(--xy-node-background-color,var(--xy-node-background-color-default));padding:10px;font-size:12px}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover,var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected,var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color,var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color,var(--xy-selection-background-color-default));border:var(--xy-selection-border,var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var(--xy-controls-button-background-color-hover-props,var(--xy-controls-button-background-color-hover,var(--xy-controls-button-background-color-hover-default)));color:var(--xy-controls-button-color-hover-props,var(--xy-controls-button-color-hover,var(--xy-controls-button-color-hover-default)))}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var(--xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default)))}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{background-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border:1px solid #fff;border-radius:1px;width:5px;height:5px;translate:-50% -50%}.react-flow__resize-control.handle.left{top:50%;left:0}.react-flow__resize-control.handle.right{top:50%;left:100%}.react-flow__resize-control.handle.top{top:0;left:50%}.react-flow__resize-control.handle.bottom{top:100%;left:50%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border-style:solid;border-width:0}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;height:100%;top:0;transform:translate(-50%)}.react-flow__resize-control.line.left{border-left-width:1px;left:0}.react-flow__resize-control.line.right{border-right-width:1px;left:100%}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{width:100%;height:1px;left:0;transform:translateY(-50%)}.react-flow__resize-control.line.top{border-top-width:1px;top:0}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color,var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color,var(--xy-edge-label-color-default))}:root{--background:oklch(98.5% .002 247);--foreground:oklch(19% .015 258);--card:oklch(100% 0 0);--card-foreground:var(--foreground);--popover:var(--card);--popover-foreground:var(--foreground);--primary:oklch(55% .19 254);--primary-foreground:oklch(99% 0 0);--secondary:oklch(95% .006 250);--secondary-foreground:var(--foreground);--accent:oklch(93% .012 250);--accent-foreground:var(--foreground);--muted:oklch(95% .006 250);--muted-foreground:oklch(50% .02 255);--border:oklch(90% .008 250);--input:var(--border);--ring:var(--primary);--destructive:oklch(58% .23 28);--success:oklch(54% .16 147);--warning:oklch(61% .15 67);--sidebar:oklch(97% .004 250);--sidebar-foreground:var(--foreground);--sidebar-primary:var(--primary);--sidebar-primary-foreground:var(--primary-foreground);--sidebar-accent:oklch(92% .014 250);--sidebar-accent-foreground:var(--foreground);--sidebar-border:var(--border);--sidebar-ring:var(--ring);--radius:.625rem}.dark{--background:oklch(17% .012 260);--foreground:oklch(94% .006 250);--card:oklch(21% .014 258);--muted:oklch(27% .015 258);--muted-foreground:oklch(70% .02 250);--border:oklch(31% .015 258);--primary:oklch(68% .16 251);--secondary:oklch(27% .015 258);--accent:oklch(30% .02 258);--sidebar:oklch(19% .014 258);--sidebar-accent:oklch(28% .02 258)}*{border-color:var(--border)}html{background:var(--background);--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;width:100%;height:100%}html.dark{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}body{width:100%;height:100%;color:var(--foreground);background:var(--background);overflow:hidden}button,a{-webkit-tap-highlight-color:transparent}button,a,input,select{touch-action:manipulation}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--ring);outline-offset:2px}::selection{background:var(--primary)}@supports (color:color-mix(in lab, red, red)){::selection{background:color-mix(in oklab, var(--primary) 25%, transparent)}}::-webkit-scrollbar-track{background:0 0}.console-scrollbar{scrollbar-color:var(--foreground) transparent}@supports (color:color-mix(in lab, red, red)){.console-scrollbar{scrollbar-color:color-mix(in oklab, var(--foreground) 30%, transparent) transparent}}.console-scrollbar::-webkit-scrollbar-track{background:0 0}@keyframes lifecycle-fill{0%{transform:scaleY(0)}to{transform:scaleY(1)}}.lifecycle-line-progress{transform-origin:top;animation:.45s cubic-bezier(.23,1,.32,1) both lifecycle-fill}@media (prefers-reduced-motion:reduce){.lifecycle-line-progress,.react-flow__edge.animated path{animation:none}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-scroll-snap-strictness{syntax:"*";inherits:false;initial-value:proximity}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0)scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1))rotate(var(--tw-enter-rotate,0));filter:blur(var(--tw-enter-blur,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0)scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1))rotate(var(--tw-exit-rotate,0));filter:blur(var(--tw-exit-blur,0))}} diff --git a/go/headgateui/dist/assets/table-BngtkqYs.js b/go/headgateui/dist/assets/table-BngtkqYs.js deleted file mode 100644 index d0e399b..0000000 --- a/go/headgateui/dist/assets/table-BngtkqYs.js +++ /dev/null @@ -1 +0,0 @@ -import{o as e,t}from"./utils-o8v-URZ_.js";var n=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}),r=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),i=new Intl.RelativeTimeFormat(void 0,{numeric:`auto`});function a(e){return e==null?`—`:e<1e3?`${n.format(e)} ms`:e<6e4?`${n.format(e/1e3)} s`:e<36e5?`${n.format(e/6e4)} min`:`${n.format(e/36e5)} hr`}function o(e){return e?r.format(new Date(e)):`—`}function s(e,t=Date.now()){if(!e)return`—`;let n=(e-t)/1e3,r=Math.abs(n);return r<60?i.format(Math.round(n),`second`):r<3600?i.format(Math.round(n/60),`minute`):r<86400?i.format(Math.round(n/3600),`hour`):r<604800?i.format(Math.round(n/86400),`day`):r<2629746?i.format(Math.round(n/604800),`week`):r<31556952?i.format(Math.round(n/2629746),`month`):i.format(Math.round(n/31556952),`year`)}function c(e){return new Intl.NumberFormat(void 0,{maximumFractionDigits:0,style:`percent`}).format(e??0)}var l=e();function u({className:e,...n}){return(0,l.jsx)(`section`,{className:t(`rounded-xl border bg-card text-card-foreground shadow-xs`,e),...n})}function d({className:e,...n}){return(0,l.jsx)(`header`,{className:t(`flex items-start gap-3 p-4 pb-2`,e),...n})}function f({className:e,...n}){return(0,l.jsx)(`h2`,{className:t(`font-semibold text-sm`,e),...n})}function p({className:e,...n}){return(0,l.jsx)(`p`,{className:t(`text-muted-foreground text-sm`,e),...n})}function m({className:e,...n}){return(0,l.jsx)(`div`,{className:t(`p-4 pt-2`,e),...n})}function h({className:e,...n}){return(0,l.jsx)(`div`,{className:`w-full overflow-x-auto`,children:(0,l.jsx)(`table`,{className:t(`w-full text-left text-sm`,e),...n})})}function g({className:e,...n}){return(0,l.jsx)(`thead`,{className:t(`border-b text-muted-foreground`,e),...n})}function _({className:e,...n}){return(0,l.jsx)(`tbody`,{className:t(`divide-y`,e),...n})}function v({className:e,...n}){return(0,l.jsx)(`tr`,{className:t(`transition-colors hover:bg-muted/50`,e),...n})}function y({className:e,...n}){return(0,l.jsx)(`th`,{className:t(`h-10 whitespace-nowrap px-2 font-medium`,e),...n})}function b({className:e,...n}){return(0,l.jsx)(`td`,{className:t(`p-2 align-top`,e),...n})}export{g as a,m as c,f as d,o as f,s as h,y as i,p as l,c as m,_ as n,v as o,a as p,b as r,u as s,h as t,d as u}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/table-DtWJ0yY1.js b/go/headgateui/dist/assets/table-DtWJ0yY1.js new file mode 100644 index 0000000..e1147d2 --- /dev/null +++ b/go/headgateui/dist/assets/table-DtWJ0yY1.js @@ -0,0 +1 @@ +import{a as e}from"./with-selector-hO0TNhHE.js";import{d as t}from"./theme-CN9-NrCi.js";var n=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}),r=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),i=new Intl.RelativeTimeFormat(void 0,{numeric:`auto`});function a(e){return e==null?`—`:e<1e3?`${n.format(e)} ms`:e<6e4?`${n.format(e/1e3)} s`:e<36e5?`${n.format(e/6e4)} min`:`${n.format(e/36e5)} hr`}function o(e){return e?r.format(new Date(e)):`—`}function s(e,t=Date.now()){if(!e)return`—`;let n=(e-t)/1e3,r=Math.abs(n);return r<60?i.format(Math.round(n),`second`):r<3600?i.format(Math.round(n/60),`minute`):r<86400?i.format(Math.round(n/3600),`hour`):r<604800?i.format(Math.round(n/86400),`day`):r<2629746?i.format(Math.round(n/604800),`week`):r<31556952?i.format(Math.round(n/2629746),`month`):i.format(Math.round(n/31556952),`year`)}function c(e){return new Intl.NumberFormat(void 0,{maximumFractionDigits:0,style:`percent`}).format(e??0)}var l=e();function u({className:e,...n}){return(0,l.jsx)(`section`,{className:t(`rounded-xl border bg-card text-card-foreground shadow-xs`,e),...n})}function d({className:e,...n}){return(0,l.jsx)(`header`,{className:t(`flex items-start gap-3 p-4 pb-2`,e),...n})}function f({className:e,...n}){return(0,l.jsx)(`h2`,{className:t(`font-semibold text-sm`,e),...n})}function p({className:e,...n}){return(0,l.jsx)(`p`,{className:t(`text-muted-foreground text-sm`,e),...n})}function m({className:e,...n}){return(0,l.jsx)(`div`,{className:t(`p-4 pt-2`,e),...n})}function h({className:e,...n}){return(0,l.jsx)(`div`,{className:`w-full overflow-x-auto`,children:(0,l.jsx)(`table`,{className:t(`w-full text-left text-sm`,e),...n})})}function g({className:e,...n}){return(0,l.jsx)(`thead`,{className:t(`border-b text-muted-foreground`,e),...n})}function _({className:e,...n}){return(0,l.jsx)(`tbody`,{className:t(`divide-y`,e),...n})}function v({className:e,...n}){return(0,l.jsx)(`tr`,{className:t(`transition-colors hover:bg-muted/50`,e),...n})}function y({className:e,...n}){return(0,l.jsx)(`th`,{className:t(`h-10 whitespace-nowrap px-2 font-medium`,e),...n})}function b({className:e,...n}){return(0,l.jsx)(`td`,{className:t(`p-2 align-top`,e),...n})}export{g as a,m as c,f as d,o as f,s as h,y as i,p as l,c as m,_ as n,v as o,a as p,b as r,u as s,h as t,d as u}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/theme-6NkSfuJL.js b/go/headgateui/dist/assets/theme-6NkSfuJL.js deleted file mode 100644 index d0fa1f1..0000000 --- a/go/headgateui/dist/assets/theme-6NkSfuJL.js +++ /dev/null @@ -1 +0,0 @@ -import{c as e,d as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./utils-o8v-URZ_.js";function c(e){return e[e.length-1]}function l(e,t){return typeof e==`function`?e(t):e}var u=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable;function f(e){for(let t in e)if(u.call(e,t))return!0;return!1}var p=()=>Object.create(null),m=(e,t)=>h(e,t,p);function h(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=y(e)&&y(i);if(!a&&!(_(e)&&_(i)))return i;let o=a?e:g(e);if(!o)return i;let s=a?i:g(i);if(!s)return i;let c=o.length,l=s.length,d=a?Array(l):n(),f=0;for(let t=0;ti||!b(e[o],t[o],n)))return!1;return i===a}return!1}function x(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 S=/[\x00-\x1f\x7f"<>`{}]/g;function C(e){return e.replace(S,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function w(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 C(t)}var T=[`http:`,`https:`,`mailto:`,`tel:`];function E(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}var D={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},O=/[&><\u2028\u2029]/g;function k(e){return e.replace(O,e=>D[e])}function A(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+=w(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=w(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function j(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function M(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 F=4,I=5;function ee(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=re(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=ne(r);e.kind=I,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=ne(r);e.kind=F,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)L(e,t,r,c,i,a,o,s)}function te(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 ne(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 re(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 ie(e,t){let n=ne(`/`),r=new Uint16Array(6),i=[];for(let t of e)L(!1,r,t,1,n,0,i);for(let e of i)e.sort(te);t.masksTree=n,t.flatCache=P(1e3)}function R(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=ce(e,t.masksTree);return t.flatCache.set(e,r),r}function z(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=ne(`/`),L(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),ce(r,o,n)}function ae(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=ce(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=ue(a.route)),t.matchCache.set(r,a),a}function oe(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function se(e,t=!1,n){let r=ne(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;L(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&N(),o[e.id]=e,c!==0&&e.path){let t=oe(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(te);return{processedTree:{segmentTree:r,singleCache:P(1e3),matchCache:P(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function ce(e,t,n=!1){let r=e.split(`/`),i=fe(e,r,t,n);if(!i)return null;let[a]=le(e,r,i);return{route:i.node.route,rawParams:a}}function le(e,t,n){let r=de(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(c).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:c,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:c,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(u)return u;if(r&&l){let n=l.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===F)>(e.node.kind===F)||t.node.kind===F==(e.node.kind===F)&&t.node.depth>e.node.depth)))}function ge(e){return _e(e.filter(e=>e!==void 0).join(`/`))}function _e(e){return e.replace(/\/{2,}/g,`/`)}function ve(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function ye(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function be(e){return ye(ve(e))}function xe(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Se(e,t,n){return xe(e,n)===xe(t,n)}function Ce({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=_e(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=_e(e)),o=e.split(`/`);o.length>1&&c(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&&(c(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),l=(i?_e(s):s)||`/`;return a&&r&&r.set(a,l),l}function we(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 Te(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>De(e,n)).join(`/`):De(r,n):r}function Ee({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{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 Pe(e){let t=V.useRef(null);return V.useImperativeHandle(e,()=>t.current,[]),t}var H=i(),Fe=class extends V.Component{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?V.createElement(this.props.errorComponent??Ie,{error:e,reset:this.reset}):this.props.children}};function Ie({error:e}){let[t,n]=V.useState(!1);return(0,H.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,H.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,H.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,H.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,H.jsx)(`div`,{children:(0,H.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,H.jsx)(`code`,{children:e.message}):null})}):null]})}function Le({children:e,fallback:t=null}){return(0,H.jsx)(V.Fragment,{children:Re()?e:t})}function Re(){return V.useSyncExternalStore(ze,()=>!0,()=>!1)}function ze(){return()=>{}}var Be=V.createContext(void 0),Ve=V.createContext(void 0),He=t(r(),1);function Ue(e,t){return e===t}function We(e,t,n=Ue){let r=(0,V.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,V.useCallback)(()=>e?.get(),[e]);return(0,He.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Ge={};function Ke(e,t){let n=V.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=h(n.current,i):i}}function qe(e){let t=n(),r=V.useContext(e.from?Ve:Be),i=e.from??r,a=t.stores.getMatchStore(i),o=Ke(e,t),s=We(a,e=>e?o(e):Ge);if(s!==Ge)return s;(e.shouldThrow??!0)&&N()}function Je(e){let t=V.useRef(e);return b(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function Ye(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Xe(e,t,n){if(e?.external)return E(e.href,n)?void 0:e.href;if(!st(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),E(t,n)?void 0:t}catch{}}function Ze(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!Se(e.pathname,t.pathname,r))return!1}else{let n=xe(e.pathname,r),i=xe(t.pathname,r);if(!(n.startsWith(i)&&(n.length===i.length||n[i.length]===`/`)))return!1}return(n?.includeSearch??!0)&&!b(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function Qe(e,t){let r=n(),i=Pe(t),{activeProps:a,inactiveProps:o,activeOptions:s,to:c,preload:u,preloadDelay:d,preloadIntentProximity:f,hashScrollIntoView:p,replace:m,startTransition:h,resetScroll:g,viewTransition:_,children:v,target:y,disabled:b,style:x,className:S,onClick:C,onBlur:w,onFocus:T,onMouseEnter:E,onMouseLeave:D,onTouchStart:O,ignoreBlocker:k,params:A,search:j,hash:M,state:N,mask:P,reloadDocument:F,unsafeRelative:I,from:ee,_fromLocation:L,...te}=e,ne=Re(),re=Je(e.search),ie=Je(e.params),R=Je(s),z=V.useMemo(()=>e,[r,e.from,e._fromLocation,e.hash,e.to,re,ie,e.state,e.mask,e.unsafeRelative]),ae=V.useCallback(e=>{let t=r.buildLocation({_fromLocation:e,...z}),n=ot(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,r.history,b),i=Xe(n,c,r.protocolAllowlist);return[n?.href,i,Ze(e,t,R,r.basepath,ne,i!==void 0)]},[R,b,ne,z,r,c]),[oe,se,ce]=We(r.stores.location,ae,Ye),le=ce?l(a,{})??et:$e,ue=ce?$e:l(o,{})??$e,de=[S,le.className,ue.className].filter(Boolean).join(` `),fe=(x||le.style||ue.style)&&{...x,...le.style,...ue.style},pe=V.useRef(!1),me=e.reloadDocument||se||b?!1:u??r.options.defaultPreload,he=d??r.options.defaultPreloadDelay??0,B=V.useCallback(()=>{r.preloadRoute(z).catch(e=>{console.warn(e),console.warn(Ae)})},[r,z]),ge=V.useCallback(e=>{if(!e){it(i);return}if(!(e.isIntersecting??me===`intent`)){e.isIntersecting===!1&&it(i);return}if(!he){B();return}rt.has(i)||rt.set(i,setTimeout(()=>{rt.delete(i),B()},he))},[B,i,me,he]);Ne(i,ge,me!==`viewport`),V.useEffect(()=>{pe.current||me===`render`&&(B(),pe.current=!0)},[B,me]);let _e=e=>{let t=e.currentTarget.getAttribute(`target`),n=y===void 0?t:y;!b&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!n||n===`_self`)&&e.button===0&&(e.preventDefault(),r.navigate({...z,replace:m,resetScroll:g,hashScrollIntoView:p,startTransition:h,viewTransition:_,ignoreBlocker:k}))};if(se)return{...te,ref:i,href:se,...v&&{children:v},...y&&{target:y},...b&&{disabled:b},...x&&{style:x},...S&&{className:S},...C&&{onClick:C},...w&&{onBlur:w},...T&&{onFocus:T},...E&&{onMouseEnter:E},...D&&{onMouseLeave:D},...O&&{onTouchStart:O}};let ve=()=>{me===`intent`&&B()},ye=()=>{me===`intent`&&it(i)};return{...te,...le,...ue,href:oe,ref:i,onClick:at([C,_e]),onBlur:at([w,ye]),onFocus:at([T,ge]),onMouseEnter:at([E,ge]),onMouseLeave:at([D,ye]),onTouchStart:at([O,ve]),disabled:!!b,target:y,...fe&&{style:fe},...de&&{className:de},...b&&tt,...ce&&nt}}var $e={},et={className:`active`},tt={role:`link`,"aria-disabled":!0},nt={"data-status":`active`,"aria-current":`page`},rt=new WeakMap,it=e=>{clearTimeout(rt.get(e)),rt.delete(e)},at=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function ot(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function st(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var ct=V.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Qe(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return V.createElement(`a`,t,o)}return V.createElement(n,a,o)});function lt(e){let t=n(),r=`not-found-${We(t.stores.location,e=>e.pathname)}-${We(t.stores.status,e=>e)}`;return(0,H.jsx)(Fe,{getResetKey:()=>r,onCatch:(t,n)=>{if(Oe(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Oe(t))return e.fallback?.(t);throw t},children:e.children})}function ut(){return(0,H.jsx)(`p`,{children:`Not Found`})}function dt(e){return(0,H.jsx)(H.Fragment,{children:e.children})}function ft(e,t,n){return t.options.notFoundComponent?(0,H.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,H.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,H.jsx)(ut,{})}function pt(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,H.jsx)(n,{}):null}var mt=(e,t)=>e[0]===t[0]&&e[1]===t[1],ht=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,gt=V.memo(function({routeId:e}){let t=n();return(0,H.jsx)(_t,{router:t,match:We(t.stores.getMatchStore(e),e=>e)})});function _t({router:e,match:t}){let n=e.routesById[t.routeId],r=pt(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=ht(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?V.Suspense:dt,l=i?Fe:dt,u=o?lt:dt;return(0,H.jsxs)(n.isRoot?n.options.shellComponent??dt:dt,{children:[(0,H.jsx)(Be.Provider,{value:t.routeId,children:(0,H.jsx)(c,{fallback:r,children:(0,H.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(Oe(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:(0,H.jsx)(u,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return V.createElement(o,e)},children:s?(0,H.jsx)(Le,{fallback:r,children:(0,H.jsx)(vt,{match:t})}):(0,H.jsx)(vt,{match:t})})})})}),null]})}var vt=V.memo(function({match:e}){let t=n(),r=e.routeId,i=t.routesById[r],a=V.useMemo(()=>{let n=(i.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:r,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return n?JSON.stringify(n):void 0},[r,e.loaderDeps,e._strictParams,e._strictSearch,i.options.remountDeps,t.options.defaultRemountDeps]),o=V.useMemo(()=>{let e=i.options.component??t.options.defaultComponent;return e?(0,H.jsx)(e,{},a):(0,H.jsx)(yt,{})},[a,i.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!ht(t,i,e.ssr))return o;if(t._tx)throw t._tx[5];return pt(t,i)}if(e.status===`notFound`)return ft(t,i,e.error);if(e.status===`error`)throw e.error;return o}),yt=V.memo(function(){let e=n(),t=V.useContext(Be),r,i,a;{let n=e.stores.getMatchStore(t);[r,i]=We(n,e=>[!!e._notFound,e.error],mt),a=We(e.stores.ids,e=>e[e.indexOf(t)+1])}if(r)return ft(e,e.routesById[t],i);if(!a)return null;let o=(0,H.jsx)(gt,{routeId:a});return t===`__root__`?(0,H.jsx)(V.Suspense,{fallback:pt(e),children:o}):o}),bt=V.createContext(void 0),xt=e=>{let t=V.useContext(bt);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},St=({client:e,children:t})=>(V.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,H.jsx)(bt.Provider,{value:e,children:t})),Ct={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},wt=new class{#e=Ct;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Tt(e){setTimeout(e,0)}var Et=typeof window>`u`||`Deno`in globalThis;function Dt(){}function Ot(e,t){return typeof e==`function`?e(t):e}function kt(e){return typeof e==`number`&&e>=0&&e!==1/0}function At(e,t){return Math.max(e+(t||0)-Date.now(),0)}function jt(e,t){return typeof e==`function`?e(t):e}function Mt(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Pt(o,t.options))return!1}else if(!It(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Nt(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Ft(t.options.mutationKey)!==Ft(a))return!1}else if(!It(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Pt(e,t){return(t?.queryKeyHashFn||Ft)(e)}function Ft(e){return JSON.stringify(e,(e,t)=>Vt(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function It(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n500)return t;let r=Bt(e)&&Bt(t);if(!r&&!(Vt(e)&&Vt(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{wt.setTimeout(t,e)})}function Wt(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Rt(e,t)}function Gt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Kt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var qt=Symbol();function Jt(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===qt?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Yt(e,t){return typeof e==`function`?e(...t):!!e}function Xt(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Zt=()=>Et,Qt=()=>Zt(),$t=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},en=new class extends $t{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},tn=Tt;function nn(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=tn,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var rn=nn(),an=new class extends $t{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function on(e){return Math.min(1e3*2**e,3e4)}function sn(e){return(e??`online`)!==`online`||an.isOnline()}var cn=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ln(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(Dt);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new cn(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>en.isFocused()&&(e.networkMode===`always`||an.isOnline())&&e.canRun(),p=()=>sn(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(Qt()?0:3),a=e.retryDelay??on,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&nf()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var un=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),kt(this.gcTime)&&(this.#e=wt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Qt()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(wt.clearTimeout(this.#e),this.#e=void 0)}};function dn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Xt(e,()=>t.signal,()=>n=!0)},u=Jt(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Kt:Gt;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?pn:fn,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:fn(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function fn(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function pn(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var mn=class extends un{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=_n(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=_n(this.options);e.data!==void 0&&(this.setState(gn(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Wt(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(Dt).catch(Dt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>jt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===qt||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>jt(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!At(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Jt(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?dn(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=ln({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof cn&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof cn){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...hn(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...gn(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),rn.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function hn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:sn(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function gn(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function _n(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var vn=class extends un{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||yn(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=ln({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),rn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function yn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var bn={};function xn(e,t){let n=V.useRef(bn);return n.current===bn&&(n.current=e(t)),n}var Sn=a(),Cn=[],wn=void 0;function Tn(){return wn}function En(e){Cn.push(e)}function Dn(e){let t=(t,n)=>{let r=xn(kn).current,i;try{wn=r;for(let e of Cn)e.before(r);i=e(t,n);for(let e of Cn)e.after(r);r.didInitialize=!0}finally{wn=void 0}return i};return t.displayName=e.displayName||e.name,t}function On(e){return V.forwardRef(Dn(e))}function kn(){return{didInitialize:!1}}function An(){}var jn=Object.freeze([]),U=Object.freeze({}),W=typeof document<`u`?V.useLayoutEffect:()=>{},Mn=t(o(),1);function Nn(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var Pn=Nn(`https://base-ui.com/production-error`,`Base UI`),Fn=V.createContext(void 0);function In(e){let t=V.useContext(Fn);if(t===void 0&&!e)throw Error(Pn(72));return t}function Ln(e){V.useEffect(e,jn)}var Rn=0,zn=class e{static create(){return new e}currentId=Rn;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Rn,t()},e)}isStarted(){return this.currentId!==Rn}clear=()=>{this.currentId!==Rn&&(clearTimeout(this.currentId),this.currentId=Rn)};disposeEffect=()=>this.clear};function Bn(){let e=xn(zn.create).current;return Ln(e.disposeEffect),e}function Vn(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:Hn,platform:Un,maxTouchPoints:Wn}=Vn(),Gn=Hn.toLowerCase(),Kn=Un.toLowerCase(),qn=/^i(os$|p)/.test(Kn)||Kn===`macintel`&&Wn>1,Jn=`android`,Yn=Kn===Jn||Gn.includes(Jn),Xn=!qn&&Kn.startsWith(`mac`);Kn.startsWith(`win`),!Yn&&/^(linux|chrome os)/.test(Kn);var Zn=Xn||qn,Qn=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!Qn&&Gn.includes(`firefox`),!Qn&&Gn.includes(`chrom`);var $n=Zn,er=/jsdom|happydom/.test(Gn);function tr(e){e.preventDefault(),e.stopPropagation()}function nr(e){return`nativeEvent`in e}function rr(e){return e.pointerType===``&&e.isTrusted?!0:Yn&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function ir(e){return er?!1:!Yn&&e.width===0&&e.height===0||Yn&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function ar(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function or(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function sr(){return typeof window<`u`}function G(e){return lr(e)?(e.nodeName||``).toLowerCase():`#document`}function K(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cr(e){return((lr(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function lr(e){return sr()?e instanceof Node||e instanceof K(e).Node:!1}function q(e){return sr()?e instanceof Element||e instanceof K(e).Element:!1}function J(e){return sr()?e instanceof HTMLElement||e instanceof K(e).HTMLElement:!1}function ur(e){return!sr()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof K(e).ShadowRoot}function dr(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Sr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function fr(e){return/^(table|td|th)$/.test(G(e))}function pr(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var mr=/transform|translate|scale|rotate|perspective|filter/,hr=/paint|layout|strict|content/,gr=e=>!!e&&e!==`none`,_r;function vr(e){let t=q(e)?Sr(e):e;return gr(t.transform)||gr(t.translate)||gr(t.scale)||gr(t.rotate)||gr(t.perspective)||!br()&&(gr(t.backdropFilter)||gr(t.filter))||mr.test(t.willChange||``)||hr.test(t.contain||``)}function yr(e){let t=wr(e);for(;J(t)&&!xr(t);){if(vr(t))return t;if(pr(t))return null;t=wr(t)}return null}function br(){return _r??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),_r}function xr(e){return/^(html|body|#document)$/.test(G(e))}function Sr(e){return K(e).getComputedStyle(e)}function Cr(e){return q(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function wr(e){if(G(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ur(e)&&e.host||cr(e);return ur(t)?t.host:t}function Tr(e){let t=wr(e);return xr(t)?(e.ownerDocument||e).body:J(t)&&dr(t)?t:Tr(t)}function Er(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Tr(e),i=r===e.ownerDocument?.body,a=K(r);if(i){let e=Dr(a);return t.concat(a,a.visualViewport||[],dr(r)?r:[],e&&n?Er(e):[])}return t.concat(r,Er(r,[],n))}function Dr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Or=`data-base-ui-focusable`,kr=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,Ar=`ArrowLeft`,jr=`ArrowRight`,Mr=`ArrowUp`,Nr=`ArrowDown`;function Pr(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Y(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&ur(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Fr(e){return`composedPath`in e?e.composedPath()[0]:e.target}function Ir(e,t){if(!q(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(Y(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function Lr(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Rr(e){return e.matches(`html,body`)}function zr(e){return J(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function Br(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${kr}`)!=null}function Vr(e){return e?e.getAttribute(`role`)===`combobox`&&zr(e):!1}function Hr(e){if(!e||er)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Ur(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Wr(e,t){return t!=null&&!ar(t)?0:typeof e==`function`?e():e}function Gr(e,t,n){let r=Wr(e,n);return typeof r==`number`?r:r?.[t]}function Kr(e){return typeof e==`function`?e():e}function qr(e,t){return t||e===`click`||e===`mousedown`}function Jr(e){return e?.includes(`mouse`)&&e!==`mousedown`}var Yr=`none`,Xr=`trigger-press`,Zr=`trigger-hover`,Qr=`trigger-focus`,$r=`outside-press`,ei=`item-press`,ti=`close-press`,ni=`focus-out`,ri=`escape-key`,ii=`list-navigation`,ai=`cancel-open`,oi=`disabled`,si=`imperative-action`,ci=`window-resize`;function X(e,t,n,r){let i=!1,a=!1,o=r??U;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var li=V.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new zn,currentIdRef:{current:null},currentContextRef:{current:null}});function ui(e,t){e.current=t.current}function di(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=V.useRef(n),a=V.useRef(n),o=V.useRef(null),s=V.useRef(null),c=Bn();return W(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:Gr(i.current,`open`),close:Gr(n,`close`)}},[n,o,i,a]),(0,H.jsx)(li.Provider,{value:V.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function fi(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=V.useContext(li),[f,p]=V.useState(!1),m=V.useRef(n);return W(()=>{m.current=n},[n]),W(()=>{function e(){l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,d.clear()}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(m.current||a.current!==t)&&d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),W(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:Gr(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,X(Yr))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),W(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,ui(o,c),d.clear()}},[l,a,o,i,c,d]),V.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function Z(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function pi(...e){return()=>{for(let t=0;te!==t[n])}function yi(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e{for(let e=0;e{t.current=t.next}};return t}var Si={...V},Ci=Si.useInsertionEffect,wi=Ci&&Ci!==Si.useLayoutEffect?Ci:e=>e();function Q(e){let t=xn(Ti).current;return t.next=e,wi(t.effect),t.trampoline}function Ti(){let e={next:void 0,callback:Ei,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Ei(){}var Di=null;globalThis.requestAnimationFrame;var Oi=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},ki=class e{static create(){return new e}static request(e){return Oi.request(e)}static cancel(e){return Oi.cancel(e)}currentId=Di;request(e){this.cancel(),this.currentId=Oi.request(()=>{this.currentId=Di,e()})}cancel=()=>{this.currentId!==Di&&(Oi.cancel(this.currentId),this.currentId=Di)};disposeEffect=()=>this.cancel};function Ai(){let e=xn(ki.create).current;return Ln(e.disposeEffect),e}function ji(e){return e?.ownerDocument||document}var Mi={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Ni={...Mi,position:`fixed`,top:0,left:0},Pi={...Mi,position:`absolute`},Fi=V.forwardRef(function(e,t){let[n,r]=V.useState();W(()=>{$n&&Qn&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,H.jsx)(`span`,{...e,ref:t,style:Ni,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),Ii=Math.min,Li=Math.max,Ri=Math.round,zi=Math.floor,Bi=e=>({x:e,y:e}),Vi={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Hi(e,t,n){return Li(e,Ii(t,n))}function Ui(e,t){return typeof e==`function`?e(t):e}function Wi(e){return e.split(`-`)[0]}function Gi(e){return e.split(`-`)[1]}function Ki(e){return e===`x`?`y`:`x`}function qi(e){return e===`y`?`height`:`width`}function Ji(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Yi(e){return Ki(Ji(e))}function Xi(e,t,n){n===void 0&&(n=!1);let r=Gi(e),i=Yi(e),a=qi(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=aa(o)),[o,aa(o)]}function Zi(e){let t=aa(e);return[Qi(e),t,Qi(t)]}function Qi(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var $i=[`left`,`right`],ea=[`right`,`left`],ta=[`top`,`bottom`],na=[`bottom`,`top`];function ra(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ea:$i:t?$i:ea;case`left`:case`right`:return t?ta:na;default:return[]}}function ia(e,t,n,r){let i=Gi(e),a=ra(Wi(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Qi)))),a}function aa(e){let t=Wi(e);return Vi[t]+e.slice(t.length)}function oa(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function sa(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:oa(e)}function ca(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function la(e,t){return t<0||t>=e.length}function ua(e,t){return fa(e.current,{disabledIndices:t})}function da(e,t){return fa(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function fa(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&pa(e,a,r));return a}function pa(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!ha(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function ma(e){return e.visibility===`hidden`||e.visibility===`collapse`}function ha(e,t=e?Sr(e):null){return!e||!e.isConnected||!t||ma(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var ga=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function _a(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return ur(n)?n.host:null}function va(e){for(let t of Array.from(e.children))if(G(t)===`summary`)return t;return null}function ya(e,t){let n=va(t);return!!n&&(e===n||Y(n,e))}function ba(e){let t=e?G(e):``;return e!=null&&e.matches(ga)&&(t!==`summary`||e.parentElement!=null&&G(e.parentElement)===`details`&&va(e.parentElement)===e)&&(t!==`details`||va(e)==null)&&(t!==`input`||e.type!==`hidden`)}function xa(e){if(!ba(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=_a(t)){let n=t!==e,r=G(t)===`slot`;if(t.hasAttribute(`inert`)||n&&G(t)===`details`&&!t.open&&!ya(e,t)||t.hasAttribute(`hidden`)||!r&&!Sa(t,n))return!1}return!0}function Sa(e,t){let n=Sr(e);return t?n.display!==`none`:ha(e,n)}function Ca(e){let t=e.tabIndex;if(t<0){let t=G(e);if(t===`details`||t===`audio`||t===`video`||J(e)&&e.isContentEditable)return 0}return t}function wa(e){if(G(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Ta(e,t){let n=wa(e);if(!n)return!0;let r=t.find(e=>{let t=wa(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=wa(e);return t?.name===n.name&&t.form===n.form})===n}function Ea(e){if(J(e)&&G(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return J(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Da(e,t){Ea(e).forEach(e=>{ba(e)&&t.push(e),Da(e,t)})}function Oa(e,t,n){Ea(e).forEach(e=>{J(e)&&e.matches(t)&&n.push(e),Oa(e,t,n)})}function ka(e){return xa(e)&&Ca(e)>=0}function Aa(e){let t=[];return Da(e,t),t.filter(xa)}function ja(e){let t=Aa(e);return t.filter(e=>Ca(e)>=0&&Ta(e,t))}function Ma(e,t){let n=ja(e),r=n.length;if(r===0)return;let i=Pr(ji(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Na(e){return Ma(ji(e).body,1)||e}function Pa(e){return Ma(ji(e).body,-1)||e}function Fa(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Y(n,r)}function Ia(e){ja(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function La(e){let t=[];Oa(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function Ra(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...Ra(e,t.id,n)])}function za(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function Ba(e){return`data-base-ui-${e}`}var Va=0;function Ha(e,t=`mui`){let[n,r]=V.useState(e),i=e||n;return V.useEffect(()=>{n??(Va+=1,r(`${t}-${Va}`))},[n,t]),i}var Ua=Si.useId;function Wa(e,t){if(Ua!==void 0){let n=Ua();return e??(t?`${t}-${n}`:n)}return Ha(e,t)}var Ga=19;function Ka(e){return Ga>=e}function qa(e){if(!V.isValidElement(e))return null;let t=e,n=t.props;return(Ka(19)?n?.ref:t.ref)??null}function Ja(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Ya(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function Xa(e,t){return typeof e==`function`?e(t):e}function Za(e,t){return typeof e==`function`?e(t):e}var Qa={};function $a(e,t,n,r,i){if(!n&&!r&&!i&&!e)return to(t);let a=to(e);return t&&(a=no(a,t)),n&&(a=no(a,n)),r&&(a=no(a,r)),i&&(a=no(a,i)),a}function eo(e){if(e.length===0)return Qa;if(e.length===1)return to(e[0]);let t=to(e[0]);for(let n=1;n=65&&i<=90&&(typeof t==`function`||t===void 0)}function oo(e){return typeof e==`function`}function so(e,t){return oo(e)?e(t):e??Qa}function co(e,t){return t?e?(...n)=>{let r=n[0];if(po(r)){let i=r;uo(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:lo(t):e}function lo(e){return e&&((...t)=>{let n=t[0];return po(n)&&uo(n),e(...t)})}function uo(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function fo(e,t){return t?e?t+` `+e:t:e}function po(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function mo(e,t,n={}){let r=t.render,i=ho(t,n);return n.enabled===!1?null:vo(e,r,i,n.state??U)}function ho(e,t={}){let{className:n,style:r,render:i}=e,{state:a=U,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?Xa(n,a):void 0,d=l?Za(r,a):void 0,f=l?Ya(a,c):U,p=l&&s?go(s):void 0,m=l?Ja(f,p)??{}:U;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?hi([m.ref,qa(i),...o]):mi(m.ref,qa(i),o):mi(null,null)),l?(u!==void 0&&(m.className=fo(m.className,u)),d!==void 0&&(m.style=Ja(m.style,d)),m):U}function go(e){return Array.isArray(e)?eo(e):$a(void 0,e)}var _o=Symbol.for(`react.lazy`);function vo(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=$a(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===_o&&(i=V.Children.toArray(t)[0]),V.cloneElement(i,e)}if(e&&typeof e==`string`)return yo(e,n);throw Error(Pn(8))}function yo(e,t){return e===`button`?(0,V.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,V.createElement)(`img`,{alt:``,...t,key:t.key}):V.createElement(e,t)}var bo={style:{transition:`none`}},xo=`data-base-ui-click-trigger`,So={fallbackAxisSide:`none`},Co={fallbackAxisSide:`end`},wo={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},To=V.createContext(null),Eo=()=>V.useContext(To),Do=Ba(`portal`);function Oo(e={}){let{ref:t,container:n,componentProps:r=U,elementProps:i}=e,a=Wa(),o=Eo()?.portalNode,[s,c]=V.useState(null),[l,u]=V.useState(null),d=Q(e=>{e!==null&&u(e)}),f=V.useRef(null);W(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(lr(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=mo(`div`,r,{ref:[t,d],props:[{id:a,[Do]:``},i]}),m=s&&p?Mn.createPortal(p,s):null;return{node:l,nodeId:V.isValidElement(p)?p.props.id:void 0,subtree:m}}var ko=V.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,...s}=e,{node:c,nodeId:l,subtree:u}=Oo({container:o,ref:t,componentProps:e,elementProps:s}),d=V.useRef(null),f=V.useRef(null),p=V.useRef(null),m=V.useRef(null),[h,g]=V.useState(null),_=V.useRef(!1),v=h?.modal,y=h?.open,b=!!h&&!h.modal&&h.open&&!!c;V.useEffect(()=>{if(!c||v)return;function e(e){c&&e.relatedTarget&&Fa(e)&&(e.type===`focusin`?_.current&&=(La(c),!1):(Ia(c),_.current=!0))}return pi(Z(c,`focusin`,e,!0),Z(c,`focusout`,e,!0))},[c,v]),W(()=>{!c||y!==!0||!_.current||(La(c),_.current=!1)},[y,c]);let x=V.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:c,setFocusManagerState:g}),[c]);return(0,H.jsxs)(V.Fragment,{children:[u,(0,H.jsxs)(To.Provider,{value:x,children:[b&&c&&(0,H.jsx)(Fi,{"data-type":`outside`,ref:d,onFocus:e=>{Fa(e,c)?p.current?.focus():Pa(h?h.domReference:null)?.focus()}}),b&&c&&(0,H.jsx)(`span`,{"aria-owns":l,style:wo}),c&&Mn.createPortal(a,c),b&&c&&(0,H.jsx)(Fi,{"data-type":`outside`,ref:f,onFocus:e=>{Fa(e,c)?m.current?.focus():(Na(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,X(`focus-out`,e.nativeEvent)))}})]})]})});function Ao(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var jo=V.createContext(null),Mo=V.createContext(null),No=()=>V.useContext(jo)?.id||null,Po=e=>{let t=V.useContext(Mo);return e??t};function Fo(e){return e==null?e:`current`in e?e.current:e}function Io(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function Lo(e){return e!=null&&e.clientX!=null}function Ro(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=V.useRef(!1),u=V.useRef(null),[d,f]=V.useState(),[p,m]=V.useState([]),h=Q(e=>{i.set(`positionReference`,e)}),g=Q((e,t,n)=>{l.current||c.current.openEvent&&!Lo(c.current.openEvent)||i.set(`positionReference`,Io(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=Q(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=ar(d)?o:a;V.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=K(o);function r(t){let n=Fr(t);Y(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||Lo(c.current.openEvent)?u.current=Z(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),V.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),V.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),V.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=V.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return V.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function zo(){return!1}function Bo(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function Vo(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=zo,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f}=l.context,p=Po(c),m=Q(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=Q(()=>a),{escapeKey:v,outsidePress:y}=Bo(s),b=V.useRef(!1),x=V.useRef(!1),S=V.useRef(!1),C=V.useRef(!1),w=V.useRef(``),T=V.useRef(null),E=Bn(),D=Bn(),O=Q(()=>{D.clear(),f.current.insideReactTree=!1}),k=Q(e=>{let t=f.current.floatingContext?.nodeId;return(p?Ra(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),A=Q(e=>Lr(e,l.select(`floatingElement`))||Lr(e,l.select(`domReferenceElement`))),j=Q(e=>{o()&&l.setOpen(!1,X(Xr,e.nativeEvent))}),M=Q(e=>{if(!u||!n||!r||e.key!==`Escape`||C.current||!v&&k(`__escapeKeyBubbles`))return;let t=X(ri,nr(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!v&&!t.isPropagationAllowed&&e.stopPropagation()}),N=Q(()=>{f.current.insideReactTree=!0,D.start(0,O)}),P=Q(e=>{if(!u||!n||e.button!==0)return;let t=Fr(e.nativeEvent);Y(l.select(`floatingElement`),t)&&(b.current||(b.current=!0,x.current=!1))}),F=Q(e=>{!u||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});V.useEffect(()=>{if(!u||!n)return O;f.current.__escapeKeyBubbles=v,f.current.__outsidePressBubbles=y;let e=new zn,t=new zn;function i(){e.clear(),C.current=!0}function a(){e.start(Qn?5:0,()=>{C.current=!1})}function o(){S.current=!0,t.start(0,()=>{S.current=!1})}function s(){b.current=!1,x.current=!1}function c(){let e=w.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function D(e){let t=f.current.floatingContext?.nodeId,n=p&&Ra(p.nodesRef.current,t).some(t=>Lr(e,t.context?.elements.floating));return A(e)||n}function j(e){if(m(e)){e.type!==`click`&&!A(e)&&(t.clear(),S.current=!1),O();return}if(f.current.insideReactTree){O();return}let n=Fr(e),r=`[${Ba(`inert`)}]`,i=q(n)?n.getRootNode():null,a=Array.from((ur(i)?i:ji(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>Y(e,n))))return;let s=q(n)?n:null;for(;s&&!xr(s);){let e=wr(s);if(xr(e)||!q(e))break;s=e}if(!(a.length&&q(n)&&!Rr(n)&&!Y(n,l.select(`floatingElement`))&&a.every(e=>!Y(s,e)))){if(J(n)&&!(`touches`in e)){let t=xr(n),r=Sr(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!D(e)){if(c()===`intentional`&&S.current){t.clear(),S.current=!1;return}typeof h==`function`&&!h(e)||k(`__outsidePressBubbles`)||(l.setOpen(!1,X($r,e)),O())}}}function N(e){c()!==`sloppy`||e.pointerType===`touch`||!l.select(`open`)||!n||A(e)||j(e)}function P(e){if(c()!==`sloppy`||!l.select(`open`)||!n||A(e))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function F(e,t){let n=Fr(e);if(!n)return;let r=Z(n,e.type,()=>{t(e),r()})}function I(e){w.current=`touch`,F(e,P)}function ee(e){E.clear(),e.type===`pointerdown`&&(w.current=e.pointerType),!(e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)&&F(e,e=>{e.type===`pointerdown`?N(e):j(e)})}function L(e){if(!b.current)return;let n=x.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!D(e)){if(n){o();return}typeof h==`function`&&!h(e)||(t.clear(),S.current=!0,O())}}}function te(e){if(c()!==`sloppy`||!T.current||A(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-T.current.startX),r=Math.abs(t.clientY-T.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(T.current.dismissOnTouchEnd=!0),i>10&&(j(e),E.clear(),T.current=null)}function ne(e){F(e,te)}function re(e){c()!==`sloppy`||!T.current||A(e)||(T.current.dismissOnTouchEnd&&j(e),E.clear(),T.current=null)}function ie(e){F(e,re)}let R=ji(d),z=pi(r&&pi(Z(R,`keydown`,M),Z(R,`compositionstart`,i),Z(R,`compositionend`,a)),g&&pi(Z(R,`click`,ee,!0),Z(R,`pointerdown`,ee,!0),Z(R,`pointerup`,L,!0),Z(R,`pointercancel`,L,!0),Z(R,`mousedown`,ee,!0),Z(R,`mouseup`,L,!0),Z(R,`touchstart`,I,!0),Z(R,`touchmove`,ne,!0),Z(R,`touchend`,ie,!0)));return()=>{z(),e.clear(),t.clear(),s(),S.current=!1,O()}},[f,d,r,g,h,u,n,v,y,M,O,_,k,A,p,l,E]);let I=V.useMemo(()=>({onKeyDown:M,onPointerDown:j,onClick:j}),[M,j]),ee=V.useMemo(()=>({onKeyDown:M,onPointerDown:F,onMouseDown:F,onClickCapture:N,onMouseDownCapture(e){N(),P(e)},onPointerDownCapture(e){N(),P(e)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[M,N,P,F]);return V.useMemo(()=>n?{reference:I,floating:ee,trigger:I}:{},[n,I,ee])}function Ho(e,t,n){let{reference:r,floating:i}=e,a=Ji(t),o=Yi(t),s=qi(o),c=Wi(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Gi(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Uo(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Ui(t,e),p=sa(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ca(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=ca(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Wo=50,Go=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Uo},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ho(l,r,c),f=r,p=0,m={};for(let n=0;ne<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Ji(t)||T.every(e=>Ji(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Ji(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},qo=new Set([`left`,`top`]);async function Jo(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Wi(n),s=Gi(n),c=Ji(n)===`y`,l=qo.has(o)?-1:1,u=a&&c?-1:1,d=Ui(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Yo=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Jo(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Xo=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Ui(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ji(i),p=Ki(f),m=u[p],h=u[f],g=(e,t)=>Hi(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Zo=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Ui(e,t),u={x:n,y:r},d=Ji(i),f=Ki(d),p=u[f],m=u[d],h=Ui(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;pn&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=qo.has(Wi(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);mr&&(m=r)}return{[f]:p,[d]:m}}}},Qo=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Ui(e,t),c=await i.detectOverflow(t,s),l=Wi(n),u=Gi(n),d=Ji(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Ii(p-c[m],g),y=Ii(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Li(c.left,c.right):S=p-2*Li(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function $o(e){let t=Sr(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=J(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ri(n)!==a||Ri(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function es(e){return q(e)?e:e.contextElement}function ts(e){let t=es(e);if(!J(t))return Bi(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=$o(t),o=(a?Ri(n.width):n.width)/r,s=(a?Ri(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ns=Bi(0);function rs(e){let t=K(e);return!br()||!t.visualViewport?ns:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function is(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===K(e)}function as(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=es(e),o=Bi(1);t&&(r?q(r)&&(o=ts(r)):o=ts(e));let s=is(a,n,r)?rs(a):Bi(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=K(a),t=q(r)?K(r):r,n=e,i=Dr(n);for(;i&&t!==n;){let e=ts(i),t=i.getBoundingClientRect(),r=Sr(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=K(i),i=Dr(n)}}return ca({width:u,height:d,x:c,y:l})}function os(e,t){let n=Cr(e).scrollLeft;return t?t.left+n:as(cr(e)).left+n}function ss(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-os(e,n),y:n.top+t.scrollTop}}function cs(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=cr(r),s=t?pr(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Bi(1),u=Bi(0),d=J(r);if((d||!a)&&((G(r)!==`body`||dr(o))&&(c=Cr(r)),d)){let e=as(r);l=ts(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?ss(o,c):Bi(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ls(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function us(e){let t=Cr(e),n=e.ownerDocument.body,r=Li(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Li(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+os(e),o=-t.scrollTop;return Sr(n).direction===`rtl`&&(a+=Li(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var ds=25;function fs(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=K(e),a=cr(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!br()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(os(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=ds&&(s-=o)}return{width:s,height:c,x:l,y:u}}function ps(e,t){let n=as(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=ts(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ms(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=fs(e,n,t);else if(t===`document`)r=us(cr(e));else if(q(t))r=ps(t,n);else{let n=rs(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ca(r)}function hs(e,t){let n=t.get(e);if(n)return n;let r=Er(e,[],!1).filter(e=>q(e)&&G(e)!==`body`),i=null,a=Sr(e).position===`fixed`,o=a?wr(e):e;for(;q(o)&&!xr(o);){let e=Sr(o),t=vr(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=wr(o)}return t.set(e,r),r}function gs(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?pr(t)?[]:hs(t,this._c):[].concat(n),r],o=ms(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=K(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Ds(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=es(e),u=i||a?[...l?Er(l):[],...t?Er(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Es(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?as(e):null;c&&g();function g(){let t=as(e);h&&!Ts(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Os=Yo,ks=Xo,As=Ko,js=Qo,Ms=Zo,Ns=(e,t,n)=>{let r=new Map,i=n??{},a={...ws,...i.platform,_c:r};return Go(e,t,{...i,platform:a})},Ps=typeof document<`u`?V.useLayoutEffect:function(){};function Fs(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Fs(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Fs(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Is(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ls(e,t){let n=Is(e);return Math.round(t*n)/n}function Rs(e){let t=V.useRef(e);return Ps(()=>{t.current=e}),t}function zs(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=V.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=V.useState(r);Fs(f,r)||p(r);let[m,h]=V.useState(null),[g,_]=V.useState(null),v=V.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=V.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=V.useRef(null),C=V.useRef(null),w=V.useRef(u),T=c!=null,E=Rs(c),D=Rs(i),O=Rs(l),k=V.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Ns(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Fs(w.current,t)&&(w.current=t,Mn.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Ps(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=V.useRef(!1);Ps(()=>(A.current=!0,()=>{A.current=!1}),[]),Ps(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=V.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=V.useMemo(()=>({reference:b,floating:x}),[b,x]),N=V.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Ls(M.floating,u.x),r=Ls(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Is(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return V.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Bs=(e,t)=>{let n=Os(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vs=(e,t)=>{let n=ks(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hs=(e,t)=>({fn:Ms(e).fn,options:[e,t]}),Us=(e,t)=>{let n=As(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ws=(e,t)=>{let n=js(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gs=Ka(19)?Js:Ys;function Ks(e,t,n,r,i){return Gs(e,t,n,r,i)}function qs(e,t,n,r,i){let a=V.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,Sn.useSyncExternalStore)(e.subscribe,a,a)}En({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,Sn.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Js(e,t,n,r,i){let a=Tn();if(!a)return qs(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function Ys(e,t,n,r,i){return(0,He.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Xs=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Ks(this,e,t,n,r)}},Zs=class extends Xs{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){V.useDebugValue(e);let n=this;W(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;W(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;W(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){V.useDebugValue(e);let n=this,r=t!==void 0;W(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return V.useDebugValue(e),Ks(this,this.selectors[e],t,n,r)}useContextCallback(e,t){V.useDebugValue(e);let n=Q(t??An);this.context[e]=n}useStateSetter(e){let t=V.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},Qs={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},$s=class extends Zs{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Ao(),nested:n,triggerElements:i},Qs),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&or(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function ec(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=V.useRef(null);r===void 0&&f.current===null&&(f.current=new $s({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),W(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};q(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function tc(e,t=!1,n=!1){let[r,i]=V.useState(e&&t?`idle`:void 0),[a,o]=V.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),W(()=>{if(!e&&a&&r!==`ending`&&n){let e=ki.request(()=>{i(`ending`)});return()=>{ki.cancel(e)}}},[e,a,r,n]),W(()=>{if(!e||t)return;let n=ki.request(()=>{i(void 0)});return()=>{ki.cancel(n)}},[t,e]),W(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=ki.request(()=>{i(`idle`)});return()=>{ki.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}function nc(e,t=!1){let n=Ai();return Q((r,i=null)=>{n.cancel();let a=Fo(e);if(a==null)return;let o=a,s=()=>{Mn.flushSync(r)};if(typeof o.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function c(){Promise.all(o.getAnimations().map(e=>e.finished)).then(()=>{i?.aborted||s()},()=>{if(!i?.aborted){if(o.getAnimations().some(e=>e.pending||e.playState!==`finished`)){c();return}s()}})}if(t){let e=`data-starting-style`;if(!o.hasAttribute(e)){n.request(c);return}let t=new MutationObserver(()=>{o.hasAttribute(e)||(t.disconnect(),c())});t.observe(o,{attributes:!0,attributeFilter:[e]}),i?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}n.request(c)})}function rc(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=Q(i),o=nc(r,n);V.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var ic={tabIndex:-1,[Or]:``};function ac(e){return t=>t!==`touch`||e.current}function oc(e,t=!1){let n=Wa(),r=No()!=null,i=xn(()=>e(n,r)).current;return ec({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function sc({handle:e,store:t}){return W(()=>e.attachStore(t),[e,t]),null}function cc(e,t){let n=V.useRef(null),r=V.useRef(null);return V.useCallback(i=>{if(e===void 0)return;let a=!1;if(n.current!==null){let e=n.current,i=r.current,o=t.context.triggerElements.getById(e);i&&o===i&&(t.context.triggerElements.delete(e),a=!0),n.current=null,r.current=null}if(i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i),a=!0),a){let e=t.context.triggerElements.size;t.select(`open`)&&t.state.triggerCount!==e&&t.set(`triggerCount`,e)}},[t,e])}function lc(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);let i=n?.id??null;(i||t)&&(e.activeTriggerId=i,e.activeTriggerElement=n??null)}function uc(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function dc(e,t,n,r={}){let i=n.reason,a=i===Zr,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=uc(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i={...r.extraState,open:t};o?i.instantType=`focus`:s?i.instantType=`dismiss`:a&&(i.instantType=void 0),lc(i,t,n.trigger,c()),e.update(i)};a?Mn.flushSync(l):l()}function fc(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=cc(e,n),o=Q(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){n.update({activeTriggerElement:t,...i?r:null});return}a==null&&i&&n.update({activeTriggerId:e,activeTriggerElement:t,...r})}),s=V.useCallback(e=>{a(e),e&&o(e)},[a,o]);return W(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function pc(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=V.useRef(null),i=e.useState(`open`);W(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=X(Yr);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function mc(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=tc(e),o=t.useState(`preventUnmountingOnClose`),s=!e&&o;t.useSyncedValues({mounted:r,transitionStatus:a,preventUnmountingOnClose:s});let c=Q(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return rc({enabled:r&&!e&&!s,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:a}}function hc(e,t){e.useSyncedValues(t),W(()=>()=>{e.update({activeTriggerProps:U,inactiveTriggerProps:U,popupProps:U})},[e])}function gc(e,t){W(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),W(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var _c=class{constructor(){this.idMap=new Map}add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};function vc(){return new $s({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new _c,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function yc(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:vc(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:U,inactiveTriggerProps:U,popupProps:U}}function bc(e,t,n=!1){return new $s({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var xc=e=>e.triggerIdProp??e.activeTriggerId,Sc=e=>e.openProp??e.open,Cc=e=>(e.popupElement?.id??e.floatingId)||void 0;function wc(e,t){return t!==void 0&&Sc(e)&&xc(e)===t}function Tc(e,t){return wc(e,t)?!0:t!==void 0&&Sc(e)&&xc(e)==null&&e.triggerCount===1}var Ec={open:Sc,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:xc,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Cc,isTriggerActive:(e,t)=>t!==void 0&&xc(e)===t,isOpenedByTrigger:(e,t)=>wc(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&xc(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Tc(e,t)?Cc(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Dc(e){let t=V.useCallback(t=>e===void 0?An:e.subscribeStore(t),[e]),n=V.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,Sn.useSyncExternalStore)(t,n,()=>e?.serverStore)}function Oc(e){return kc(e,e.rootContext)}function kc(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=V.useState(null),[d,f]=V.useState(void 0),[p,m]=V.useState(void 0),h=V.useRef(null),g=Po(r),_=V.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=zs({...e,elements:{..._,...l&&{reference:l}}}),y=q(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=V.useCallback(e=>{let t=q(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=V.useCallback(e=>{(q(e)||e===null)&&(h.current=e,f(e)),(q(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!q(e))&&v.refs.setReference(e)},[v.refs,f]),C=V.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=V.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=V.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=V.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return W(()=>{o&&(h.current=o)},[o]),W(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),V.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var Ac=Xn&&Qn;function jc(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=V.useRef(!1),c=V.useRef(null),l=V.useRef(!0),u=Bn();V.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=K(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&J(e)&&e===Pr(ji(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return pi(Z(t,`blur`,r),Ac&&Z(t,`keydown`,a,!0),Ac&&Z(t,`pointerdown`,o,!0))},[i,n]),V.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);q(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=V.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=Fr(t.nativeEvent);if(q(a)){if(Ac&&!t.relatedTarget){if(!l.current&&!zr(a))return}else if(!Hr(a))return}let o=Ir(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,X(Qr,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,X(Qr,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=q(n)&&n.hasAttribute(Ba(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=Pr(ji(e));!n&&t===e||Y(o.current.floatingContext?.refs.floating.current,t)||Y(e,t)||a||Ir(n??t,i.context.triggerElements)||i.setOpen(!1,X(Qr,r))})}}},[o,r,i,u]);return V.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var Mc=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new zn,this.restTimeout=new zn,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},Nc=new WeakMap;function Pc(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&Nc.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),Nc.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Fc(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=Nc.get(n);a&&a!==e&&Pc(a),Pc(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,Nc.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function Ic(e){let t=e.context.dataRef.current,n=xn(()=>t.hoverInteractionState??Mc.create()).current;return t.hoverInteractionState||=n,Ln(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Lc(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=Po(),d=No(),f=Ic(a),p=Bn(),m=Q(()=>qr(l.current.openEvent?.type,f.interactedInside)),h=Q(()=>Jr(l.current.openEvent?.type)),g=Q(()=>{Pc(f)});W(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),V.useEffect(()=>g,[g]),W(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&q(c)&&s){let e=c,t=s,n=ji(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return Fc(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),V.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&Ra(u.nodesRef.current,d).length>0)}function t(e){let t=Gr(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,X(Zr,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=Fr(e);if(!Br(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(Ir(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&q(o)&&Ra(u.nodesRef.current,r,!1).some(e=>Y(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}g(),h()&&!m()&&t(n)}}function v(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,X(Zr,t)),u.events.emit(`floating.closed`,t)})}let y=s;return pi(y&&Z(y,`mouseenter`,c),y&&Z(y,`mouseleave`,_),y&&Z(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var Rc={current:null};function zc(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=Rc,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,h=`rootStore`in e?e.rootStore:e,{dataRef:g,events:_}=h.context,v=Po(l),y=Ic(h),b=V.useRef(!1),x=bi(i),S=bi(r),C=bi(o),w=bi(n),T=bi(p),E=bi(f),D=Q(()=>qr(g.current.openEvent?.type,y.interactedInside)),O=Q(()=>T.current?.()!==!1),k=Q((e,t,n)=>{let r=h.context.triggerElements;if(r.hasElement(t))return!e||!Y(e,t);if(!q(n))return!1;let i=n;return r.hasMatchingElement(e=>Y(e,i))&&(!e||!Y(e,i))}),A=Q(()=>{y.handler&&=(ji(h.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),j=Q(()=>{Pc(y)});return u&&(y.handleCloseOptions=x.current?.__options),V.useEffect(()=>A,[A]),V.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===Zr,A(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return _.on(`openchange`,e),()=>{_.off(`openchange`,e)}},[n,_,y,A]),V.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Gr(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{h.setOpen(!1,X(Zr,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),h.setOpen(!1,X(Zr,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?h.select(`domReferenceElement`):null);if(!q(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!ar(y.pointerType))return;let t=Kr(C.current),n=Gr(S.current,`open`,y.pointerType),r=Fr(e),i=e.currentTarget??null,o=h.select(`domReferenceElement`),s=i;if(q(r)&&!h.context.triggerElements.hasElement(r)){for(let e of h.context.triggerElements.elements())if(Y(e,r)){s=e;break}}q(i)&&q(o)&&!h.context.triggerElements.hasElement(i)&&Y(i,o)&&(s=o);let c=s!=null&&k(o,s,r),l=h.select(`open`),u=E.current?.()??h.select(`transitionStatus`)===`ending`,d=!l&&u&&b.current,f=!c&&q(s)&&q(o)&&Y(o,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,g=!l||c;if(m){O()&&h.setOpen(!0,X(Zr,e,s));return}p||(n?y.openChangeTimeout.start(n,()=>{g&&O()&&h.setOpen(!0,X(Zr,e,s))}):g&&O()&&h.setOpen(!0,X(Zr,e,s)))}function i(t){if(D()){j();return}A();let n=ji(h.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=g.current.floatingContext??d?.();if(!Ir(t.relatedTarget,h.context.triggerElements)){if(x.current&&r){h.select(`open`)||y.openChangeTimeout.clear();let i=c.current;y.handler=x.current({...r,tree:v,x:t.clientX,y:t.clientY,onClose(){j(),A(),w.current&&!D()&&i===h.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,y.handler),y.handler(t);return}(y.pointerType!==`touch`||!Y(h.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){Y(t,e.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}let l=m?Z(t,`mouseout`,o):void 0;return s?pi(Z(t,`mousemove`,r,{once:!0}),Z(t,`mouseenter`,r),Z(t,`mouseleave`,i),l):pi(Z(t,`mouseenter`,r),Z(t,`mouseleave`,i),l)},[A,j,g,S,h,n,x,y,u,k,D,a,s,C,c,v,w,d,E,O,m]),V.useMemo(()=>{if(!n)return;function e(e){y.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=h.select(`domReferenceElement`),i=h.select(`open`),o=k(r,n,e.target);if(a&&!ar(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=h.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;Fc(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=Kr(C.current);if(i&&!o||s===0||!o&&y.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;y.restTimeout.clear();function c(){if(y.restTimeoutPending=!1,D())return;let e=h.select(`open`);!y.blockMouseMove&&(!e||o)&&O()&&h.setOpen(!0,X(Zr,t,n))}y.pointerType===`touch`?Mn.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,D,k,a,h,C,O])}var Bc=.1,Vc=Bc*Bc,$=.5;function Hc(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Uc(e,t,n,r,i,a,o,s,c,l){let u=!1;return Hc(e,t,n,r,i,a)&&(u=!u),Hc(e,t,i,a,o,s)&&(u=!u),Hc(e,t,o,s,c,l)&&(u=!u),Hc(e,t,c,l,n,r)&&(u=!u),u}function Wc(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Gc(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Kc(e={}){let{blockPointerEvents:t=!1}=e,n=new zn,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*Vc;return u=e,d=t,f=n,o0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=Gc(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=Gc(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=Gc(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=Gc(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!Wc(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?$/2:$*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+$+1,o=C||T?S.bottom-$:S.top,s=C?T?S.bottom-$:S.top:S.bottom-$;M=Uc(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?$/2:$*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-$,o=C||T?S.top+$:S.bottom,s=C?T?S.top+$:S.bottom:S.top+$;M=Uc(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?$/2:$*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+$+1,o=w||E?S.right-$:S.left,s=w?E?S.right-$:S.left:S.right-$;M=Uc(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?$/2:$*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-$,o=w||E?S.left+$:S.right,s=w?E?S.left+$:S.right:S.left+$;M=Uc(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var qc={...Ec,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},Jc=class extends Zs{constructor(e,t,n){let r=new _c;super(Yc(e,r,t,n),Xc(r),qc)}setOpen=(e,t)=>{dc(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,X(Xr,e))}};function Yc(e,t,n,r=!1){let i={...yc(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return i.floatingRootContext=bc(t,n,r),i}function Xc(e){return{popupRef:V.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var Zc=Dn(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=oc((e,t)=>new Jc({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),pc(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=mc(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=V.useRef(null);W(()=>{m&&t&&p.setOpen(!1,X(oi))},[m,t,p]),W(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),W(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),V.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,X(si))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,H.jsxs)(Fn.Provider,{value:p,children:[l&&(0,H.jsx)(sc,{handle:l,store:p}),T&&(0,H.jsx)(Qc,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function Qc({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=Vo(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=Ro(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=V.useMemo(()=>$a(a.reference,i.reference),[a.reference,i.reference]);return hc(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??U}),null}var $c=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),el={"data-starting-style":``},tl={"data-ending-style":``},nl={transitionStatus(e){return e===`starting`?el:e===`ending`?tl:null}};(function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=$c.startingStyle]=`startingStyle`,e[e.endingStyle=$c.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e})({});var rl={"data-popup-open":``},il={"data-popup-open":``,"data-pressed":``},al={"data-open":``},ol={"data-closed":``},sl={"data-anchor-hidden":``},cl={open(e){return e?rl:null}},ll={open(e){return e?il:null}},ul={open(e){return e?al:ol},anchorHidden(e){return e?sl:null}},dl={...ul,...nl};function fl(e){return Wa(e,`base-ui`)}var pl=V.createContext(void 0);function ml(){return V.useContext(pl)}var hl=`data-base-ui-tooltip-trigger`;function gl(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;em.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),re=jc(v,{enabled:!A}).reference,ie=e=>{let t=P.current,n=gl(e),r=te(n),i=y.current,a=i&&n&&Y(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`){m.setOpen(!1,X(Zr,e));return}if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&ar(I.current)){let t=()=>{!P.current&&!j.current&&!m.select(`open`)&&m.setOpen(!0,X(Zr,e,i))},n=ee();n===0?(F.clear(),t()):F.start(n,t)}},R=m.useState(`triggerProps`,C);return mo(`button`,e,{state:{open:_},ref:[t,S,y],props:[ne,re,C||M!==`none`?R:void 0,{onMouseOver(e){ie(e.nativeEvent)},onFocus(e){L(gl(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){P.current=!1,F.clear(),I.current=void 0},onPointerEnter(e){I.current=e.pointerType},onPointerDown(e){I.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,"data-trigger-disabled":A?``:void 0,[hl]:A?void 0:``},f],stateAttributesMapping:cl})}),yl=V.createContext(void 0);function bl(){let e=V.useContext(yl);if(e===void 0)throw Error(Pn(70));return e}var xl=V.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=Oo({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,H.jsxs)(V.Fragment,{children:[l,c&&Mn.createPortal(n,c)]})}),Sl=V.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return In().useState(`mounted`)||n?(0,H.jsx)(yl.Provider,{value:n,children:(0,H.jsx)(xl,{ref:t,...r})}):null}),Cl=V.createContext(void 0);function wl(){let e=V.useContext(Cl);if(e===void 0)throw Error(Pn(71));return e}var Tl=V.createContext(void 0);function El(){return V.useContext(Tl)?.direction??`ltr`}var Dl=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=Ui(e,t)||{};if(l==null)return{};let f=sa(u),p={x:n,y:r},m=Yi(i),h=qi(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=Hi(k,j,A),N=!c.arrow&&Gi(i)!=null&&j!==M&&a.reference[h]/2-(j({...Dl(e),options:[e,t]}),kl={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},Al={sideX:`left`,sideY:`top`},jl=`--available-width`,Ml=`--available-height`;function Nl(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function Pl(e,t,n){let{rects:r,placement:i}=e;return{side:Nl(t,Wi(i),n),align:Gi(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Fl(e){return Il(e,Oc)}function Il(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=V.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=v?.crossAxis??!1,k=v?.rootBoundary,A=typeof n==`function`?n:void 0,j=Q(A),M=A?j:n,N=bi(n),P=bi(g),F=El()===`rtl`,I=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":F?`left`:`right`,"inline-start":F?`right`:`left`}[i],ee=o===`center`?I:`${I}-${o}`,L=l;typeof L==`number`?L={top:L,right:L,bottom:L,left:L}:L&&={top:L.top||0,right:L.right||0,bottom:L.bottom||0,left:L.left||0};let te=+(i===`bottom`),ne=+(i===`top`),re=+(i===`right`),ie=+(i===`left`),R={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:L},z=V.useRef(null),ae=bi(a),oe=bi(s),se=typeof a==`function`?0:a,ce=typeof s==`function`?0:s,le=[];p&&le.push(p),le.push(Bs(e=>{let t=Pl(e,i,F),n=typeof ae.current==`function`?ae.current(t):ae.current,r=typeof oe.current==`function`?oe.current(t):oe.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[se,ce,F,i]));let ue=E===`none`&&T!==`shift`,de=!ue&&(u||O||T===`shift`),fe=T===`none`?null:Us({...R,padding:{top:L.top+1+te,right:L.right+1+ie,bottom:L.bottom+1+ne,left:L.left+1+re},mainAxis:!O&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:D}),pe=ue?null:Vs({...R,rootBoundary:k,mainAxis:E!==`none`,crossAxis:de,limiter:u||O?void 0:Hs(e=>{if(!z.current)return{};let{width:t,height:n}=z.current.getBoundingClientRect(),r=Ji(Wi(e.placement)),i=r===`y`?t:n,a=r===`y`?L.left+L.right:L.top+L.bottom;return{offset:i/2+a/2}})},[R,u,O,k,L,E]);T===`shift`||E===`shift`||o===`center`?le.push(pe,fe):le.push(fe,pe),le.push(Ws({...R,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(jl,`${t}px`),i.setProperty(Ml,`${n}px`);let a=K(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),Ol(e=>({element:z.current||ji(e.elements.floating).createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:r,rects:o,y:s}=e,c=Wi(r),l=Ji(c),u=z.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof a==`function`?a(Pl(e,i,F)):a,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,de&&l===`y`&&b?S:x),{}}},kl,b),W(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let me=V.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:he,elements:B,x:ge,y:_e,middlewareData:ve,update:ye,placement:be,context:xe,isPositioned:Se,floatingStyles:Ce}=t({rootContext:h,open:m?g:void 0,placement:ee,middleware:le,strategy:r,whileElementsMounted:m?void 0:(...e)=>Ds(...e,me),nodeId:y,externalTree:S}),{sideX:we,sideY:Te}=ve.adaptiveOrigin||Al,Ee=Se?r:`fixed`,De=V.useMemo(()=>{let e;return e=Se?b?{position:Ee,[we]:ge,[Te]:_e}:{...Ce,position:Ee}:{position:Ee,top:0,left:0},e[jl]=`100vw`,e[Ml]=`100vh`,Se||(e.opacity=0),e},[b,Ee,we,ge,Te,_e,Ce,Se]),Oe=V.useRef(null);W(()=>{if(!g)return;let e=N.current,t=typeof e==`function`?e():e,n=(Ll(t)?t.current:t)||null;n!==Oe.current&&(he.setPositionReference(n),Oe.current=n)},[g,he,M,N]),V.useEffect(()=>{if(!g)return;let e=N.current;typeof e!=`function`&&Ll(e)&&e.current!==Oe.current&&(he.setPositionReference(e.current),Oe.current=e.current)},[g,he,M,N]),V.useEffect(()=>{if(m&&g&&B.reference&&B.floating)return Ds(B.reference,B.floating,ye,me)},[m,g,B,ye,me]);let ke=Wi(be),Ae=Nl(i,ke,F),je=Gi(be)||`center`,Me=!!ve.hide?.referenceHidden;W(()=>{x&&g&&Se&&ke!==I&&w(ke)},[x,g,Se,ke,I]);let Ne=V.useMemo(()=>({position:`absolute`,top:ve.arrow?.y,left:ve.arrow?.x}),[ve.arrow]),Pe=ve.arrow?.centerOffset!==0;return V.useMemo(()=>({positionerStyles:De,arrowStyles:Ne,arrowRef:z,arrowUncentered:Pe,side:Ae,align:je,physicalSide:ke,anchorHidden:Me,refs:he,context:xe,isPositioned:Se,update:ye}),[De,Ne,z,Pe,Ae,je,ke,Me,he,xe,Se,ye])}function Ll(e){return e!=null&&`current`in e}function Rl(e){return e===`starting`?bo:U}function zl(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),mo(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Rl(r),i],stateAttributesMapping:ul})}var Bl=V.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Co,style:g,..._}=e,v=In(),y=bl(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=Fl({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`adaptiveOrigin`)}),O=zl(e,V.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),{styles:D.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,H.jsx)(Cl.Provider,{value:D,children:O})}),Vl=V.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=In(),{side:s,align:c}=wl(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);rc({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),Lc(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return mo(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[ic,f,Rl(d),a],stateAttributesMapping:dl})}),Hl=V.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=In(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=wl();return mo(`div`,e,{state:{open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)},ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:ul})}),Ul=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=V.useMemo(()=>({open:t,close:n}),[t,n]);return(0,H.jsx)(pl.Provider,{value:t,children:(0,H.jsx)(di,{delay:i,timeoutMs:r,children:e.children})})};function Wl({delay:e=0,...t}){return(0,H.jsx)(Ul,{"data-slot":`tooltip-provider`,delay:e,...t})}function Gl({...e}){return(0,H.jsx)(Zc,{"data-slot":`tooltip`,...e})}function Kl({...e}){return(0,H.jsx)(vl,{"data-slot":`tooltip-trigger`,...e})}function ql({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,H.jsx)(Sl,{children:(0,H.jsx)(Bl,{align:r,alignOffset:i,className:`isolate z-50`,side:t,sideOffset:n,children:(0,H.jsxs)(Vl,{className:s(`data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:fade-in-0 data-open:zoom-in-95 data-closed:fade-out-0 data-closed:zoom-out-95 z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-background text-xs has-data-[slot=kbd]:pr-1.5 data-[state=delayed-open]:animate-in data-closed:animate-out data-open:animate-in **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm`,e),"data-slot":`tooltip-content`,...o,children:[a,(0,H.jsx)(Hl,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-start]:top-1/2! data-[side=left]:top-1/2! data-[side=right]:top-1/2! data-[side=inline-start]:-right-1 data-[side=left]:-right-1 data-[side=top]:-bottom-2.5 data-[side=inline-end]:-left-1 data-[side=right]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:-translate-y-1/2 data-[side=right]:-translate-y-1/2`})]})})})}var Jl=`system`,Yl=`headgate.console.theme`,Xl=[{label:`System`,value:`system`},{label:`Light`,value:`light`},{label:`Dark`,value:`dark`}],Zl=new Set,Ql=Jl,$l=!1,eu=null;function tu(e){return e===`light`||e===`dark`?e:Jl}function nu(e,t){return e===`dark`||e===`system`&&t}function ru(e){if(typeof document>`u`||typeof window>`u`)return;let t=nu(e,typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches);document.documentElement.classList.toggle(`dark`,t),document.documentElement.style.colorScheme=t?`dark`:`light`;let n=document.querySelector(`meta[name="theme-color"]`);n&&(n.content=t?`#191b20`:`#fafafa`)}function iu(){for(let e of Zl)e()}function au(e){e.key===`headgate.console.theme`&&(Ql=tu(e.newValue),ru(Ql),iu())}function ou(){Ql===`system`&&ru(Ql)}function su(){if(typeof window>`u`)return Ql;try{Ql=tu(window.localStorage.getItem(Yl))}catch{}return Ql}function cu(e){return Zl.add(e),!$l&&typeof window<`u`&&(window.addEventListener(`storage`,au),typeof window.matchMedia==`function`&&(eu=window.matchMedia(`(prefers-color-scheme: dark)`),eu.addEventListener(`change`,ou)),$l=!0,ru(su())),()=>{Zl.delete(e),$l&&Zl.size===0&&(window.removeEventListener(`storage`,au),eu?.removeEventListener(`change`,ou),eu=null,$l=!1)}}function lu(e){Ql=tu(e);try{window.localStorage.setItem(Yl,Ql)}catch{}return ru(Ql),iu(),Ql}var uu=`(()=>{let t;try{t=localStorage.getItem("${Yl}")}catch{}try{const p=typeof matchMedia==="function"&&matchMedia("(prefers-color-scheme: dark)").matches;const d=t==="dark"||(t!=="light"&&p);document.documentElement.classList.toggle("dark",d);document.documentElement.style.colorScheme=d?"dark":"light";const m=document.querySelector('meta[name="theme-color"]');if(m)m.content=d?"#191b20":"#fafafa"}catch{}})();`;export{Ka as $,Re as $n,J as $t,pc as A,Nt as An,c as Ar,ti as At,Ks as B,At as Bn,Ur as Bt,bc as C,en as Cn,b as Cr,Q as Ct,sc as D,Ft as Dn,f as Dr,Z as Dt,ic as E,Ot as En,l as Er,pi as Et,fc as F,Rt as Fn,Yr as Ft,Po as G,yt as Gn,Fr as Gt,Vo as H,St as Hn,zr as Ht,rc as I,jt as In,$r as It,xo as J,ct as Jn,jr as Jt,ko as K,pt as Kn,Nr as Kt,tc as L,zt as Ln,Zr as Lt,hc as M,Dt as Mn,h as Mr,si as Mt,oc as N,It as Nn,ei as Nt,ac as O,Pt as On,E as Or,X as Ot,gc as P,Wt as Pn,ii as Pt,$a as Q,Be as Qn,q as Qt,$s as R,Yt as Rn,Xr as Rt,yc as S,rn as Sn,A as Sr,Ai as St,_c as T,Qt as Tn,k as Tr,mi as Tt,Fo as U,xt as Un,Pr as Ut,ws as V,wt as Vn,Vr as Vt,No as W,gt as Wn,Y as Wt,mo as X,Ke as Xn,G as Xt,So as Y,qe as Yn,Mr as Yt,uo as Z,We as Zn,K as Zt,dl as _,vn as _n,se as _r,Fi as _t,uu as a,tr as an,we as ar,Na as at,nl as b,hn as bn,T as br,ji as bt,ql as c,qn as cn,Ce as cr,ka as ct,zl as d,Pn as dn,ye as dr,da as dt,dr as en,Fe as er,Wa as et,Rl as f,W as fn,ue as fr,ua as ft,ul as g,xn as gn,ie as gr,ca as gt,fl as h,An as hn,z as hr,pa as ht,cu as i,ir as in,Oe as ir,Aa as it,mc as j,Mt as jn,m as jr,ni as jt,lc as k,kt as kn,x as kr,ai as kt,Wl as l,zn as ln,be as lr,ja as lt,El as m,U as mn,ae as mr,la as mt,su as n,ar as nn,Me as nr,za as nt,Xl as o,er as on,Ee as or,Pa as ot,Fl as p,jn as pn,R as pr,ha as pt,Eo as q,dt as qn,Ar as qt,lu as r,rr as rn,ke as rr,Ra as rt,Gl as s,Qn as sn,ge as sr,Fa as st,Jl as t,ur as tn,je as tr,Ba as tt,Kl as u,Bn as un,ve as ur,fa as ut,ll as v,yn as vn,P as vr,Ni as vt,Ec as w,$t as wn,j as wr,bi as wt,Dc as x,an as xn,M as xr,ki as xt,cl as y,mn as yn,N as yr,Pi as yt,Zs as z,qt as zn,ci as zt}; \ No newline at end of file diff --git a/go/headgateui/dist/assets/theme-CN9-NrCi.js b/go/headgateui/dist/assets/theme-CN9-NrCi.js new file mode 100644 index 0000000..63d41f3 --- /dev/null +++ b/go/headgateui/dist/assets/theme-CN9-NrCi.js @@ -0,0 +1 @@ +import{a as e,n as t,o as n,r,s as i,t as a,u as o}from"./with-selector-hO0TNhHE.js";function s(e){return e[e.length-1]}function c(e,t){return typeof e==`function`?e(t):e}var l=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;function d(e){for(let t in e)if(l.call(e,t))return!0;return!1}var f=()=>Object.create(null),p=(e,t)=>m(e,t,f);function m(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=v(e)&&v(i);if(!a&&!(g(e)&&g(i)))return i;let o=a?e:h(e);if(!o)return i;let s=a?i:h(i);if(!s)return i;let c=o.length,u=s.length,d=a?Array(u):n(),f=0;for(let t=0;ti||!y(e[o],t[o],n)))return!1;return i===a}return!1}function b(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 x=/[\x00-\x1f\x7f"<>`{}]/g;function S(e){return e.replace(x,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function C(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 S(t)}var w=[`http:`,`https:`,`mailto:`,`tel:`];function T(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}var E={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},D=/[&><\u2028\u2029]/g;function O(e){return e.replace(D,e=>E[e])}function k(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+=C(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=C(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function A(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function j(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 P=4,F=5;function I(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=ee(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=z(r);e.kind=F,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=z(r);e.kind=P,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)L(e,t,r,c,i,a,o,s)}function R(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 z(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 ee(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 te(e,t){let n=z(`/`),r=new Uint16Array(6),i=[];for(let t of e)L(!1,r,t,1,n,0,i);for(let e of i)e.sort(R);t.masksTree=n,t.flatCache=N(1e3)}function ne(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=ae(e,t.masksTree);return t.flatCache.set(e,r),r}function B(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=z(`/`),L(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),ae(r,o,n)}function V(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=ae(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=se(a.route)),t.matchCache.set(r,a),a}function re(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function ie(e,t=!1,n){let r=z(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;L(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&M(),o[e.id]=e,c!==0&&e.path){let t=re(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(R);return{processedTree:{segmentTree:r,singleCache:N(1e3),matchCache:N(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function ae(e,t,n=!1){let r=e.split(`/`),i=le(e,r,t,n);if(!i)return null;let[a]=oe(e,r,i);return{route:i.node.route,rawParams:a}}function oe(e,t,n){let r=ce(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(s).join(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length=0;t--){let n=i.optional[t];c.push({node:n,index:s,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];c.push({node:t,index:s,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(u)return u;if(r&&l){let n=l.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===P)>(e.node.kind===P)||t.node.kind===P==(e.node.kind===P)&&t.node.depth>e.node.depth)))}function me(e){return he(e.filter(e=>e!==void 0).join(`/`))}function he(e){return e.replace(/\/{2,}/g,`/`)}function ge(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function _e(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function ve(e){return _e(ge(e))}function ye(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function be(e,t,n){return ye(e,n)===ye(t,n)}function xe({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=he(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=he(e)),o=e.split(`/`);o.length>1&&s(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&&(s(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let c=o.join(`/`),l=(i?he(c):c)||`/`;return a&&r&&r.set(a,l),l}function Se(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 Ce(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>Te(e,n)).join(`/`):Te(r,n):r}function we({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{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 Me(e){let t=H.useRef(null);return H.useImperativeHandle(e,()=>t.current,[]),t}var U=e(),Ne=class extends H.Component{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?H.createElement(this.props.errorComponent??Pe,{error:e,reset:this.reset}):this.props.children}};function Pe({error:e}){let[t,n]=H.useState(!1);return(0,U.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,U.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,U.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,U.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,U.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,U.jsx)(`div`,{children:(0,U.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,U.jsx)(`code`,{children:e.message}):null})}):null]})}function Fe({children:e,fallback:t=null}){return(0,U.jsx)(H.Fragment,{children:Ie()?e:t})}function Ie(){return H.useSyncExternalStore(Le,()=>!0,()=>!1)}function Le(){return()=>{}}var Re=H.createContext(void 0),ze=H.createContext(void 0),Be=o(a(),1);function Ve(e,t){return e===t}function W(e,t,n=Ve){let r=(0,H.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,H.useCallback)(()=>e?.get(),[e]);return(0,Be.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var He={};function Ue(e,t){let n=H.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=m(n.current,i):i}}function We(e){let t=r(),n=H.useContext(e.from?ze:Re),i=e.from??n,a=t.stores.getMatchStore(i),o=Ue(e,t),s=W(a,e=>e?o(e):He);if(s!==He)return s;(e.shouldThrow??!0)&&M()}function Ge(e){let t=H.useRef(e);return y(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function Ke(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function qe(e,t,n){if(e?.external)return T(e.href,n)?void 0:e.href;if(!it(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),T(t,n)?void 0:t}catch{}}function Je(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!be(e.pathname,t.pathname,r))return!1}else{let n=ye(e.pathname,r),i=ye(t.pathname,r);if(!(n.startsWith(i)&&(n.length===i.length||n[i.length]===`/`)))return!1}return(n?.includeSearch??!0)&&!y(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function Ye(e,t){let n=r(),i=Me(t),{activeProps:a,inactiveProps:o,activeOptions:s,to:l,preload:u,preloadDelay:d,preloadIntentProximity:f,hashScrollIntoView:p,replace:m,startTransition:h,resetScroll:g,viewTransition:_,children:v,target:y,disabled:b,style:x,className:S,onClick:C,onBlur:w,onFocus:T,onMouseEnter:E,onMouseLeave:D,onTouchStart:O,ignoreBlocker:k,params:A,search:j,hash:M,state:N,mask:P,reloadDocument:F,unsafeRelative:I,from:L,_fromLocation:R,...z}=e,ee=Ie(),te=Ge(e.search),ne=Ge(e.params),B=Ge(s),V=H.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,te,ne,e.state,e.mask,e.unsafeRelative]),re=H.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...V}),r=rt(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,b),i=qe(r,l,n.protocolAllowlist);return[r?.href,i,Je(e,t,B,n.basepath,ee,i!==void 0)]},[B,b,ee,V,n,l]),[ie,ae,oe]=W(n.stores.location,re,Ke),se=oe?c(a,{})??Ze:Xe,ce=oe?Xe:c(o,{})??Xe,le=[S,se.className,ce.className].filter(Boolean).join(` `),ue=(x||se.style||ce.style)&&{...x,...se.style,...ce.style},de=H.useRef(!1),fe=e.reloadDocument||ae||b?!1:u??n.options.defaultPreload,pe=d??n.options.defaultPreloadDelay??0,me=H.useCallback(()=>{n.preloadRoute(V).catch(e=>{console.warn(e),console.warn(Oe)})},[n,V]),he=H.useCallback(e=>{if(!e){tt(i);return}if(!(e.isIntersecting??fe===`intent`)){e.isIntersecting===!1&&tt(i);return}if(!pe){me();return}et.has(i)||et.set(i,setTimeout(()=>{et.delete(i),me()},pe))},[me,i,fe,pe]);je(i,he,fe!==`viewport`),H.useEffect(()=>{de.current||fe===`render`&&(me(),de.current=!0)},[me,fe]);let ge=e=>{let t=e.currentTarget.getAttribute(`target`),r=y===void 0?t:y;!b&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0&&(e.preventDefault(),n.navigate({...V,replace:m,resetScroll:g,hashScrollIntoView:p,startTransition:h,viewTransition:_,ignoreBlocker:k}))};if(ae)return{...z,ref:i,href:ae,...v&&{children:v},...y&&{target:y},...b&&{disabled:b},...x&&{style:x},...S&&{className:S},...C&&{onClick:C},...w&&{onBlur:w},...T&&{onFocus:T},...E&&{onMouseEnter:E},...D&&{onMouseLeave:D},...O&&{onTouchStart:O}};let _e=()=>{fe===`intent`&&me()},ve=()=>{fe===`intent`&&tt(i)};return{...z,...se,...ce,href:ie,ref:i,onClick:nt([C,ge]),onBlur:nt([w,ve]),onFocus:nt([T,he]),onMouseEnter:nt([E,he]),onMouseLeave:nt([D,ve]),onTouchStart:nt([O,_e]),disabled:!!b,target:y,...ue&&{style:ue},...le&&{className:le},...b&&Qe,...oe&&$e}}var Xe={},Ze={className:`active`},Qe={role:`link`,"aria-disabled":!0},$e={"data-status":`active`,"aria-current":`page`},et=new WeakMap,tt=e=>{clearTimeout(et.get(e)),et.delete(e)},nt=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function rt(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function it(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var at=H.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Ye(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return H.createElement(`a`,t,o)}return H.createElement(n,a,o)});function ot(e){let t=r(),n=`not-found-${W(t.stores.location,e=>e.pathname)}-${W(t.stores.status,e=>e)}`;return(0,U.jsx)(Ne,{getResetKey:()=>n,onCatch:(t,n)=>{if(Ee(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Ee(t))return e.fallback?.(t);throw t},children:e.children})}function st(){return(0,U.jsx)(`p`,{children:`Not Found`})}function ct(e){return(0,U.jsx)(U.Fragment,{children:e.children})}function lt(e,t,n){return t.options.notFoundComponent?(0,U.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,U.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,U.jsx)(st,{})}function ut(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,U.jsx)(n,{}):null}var dt=(e,t)=>e[0]===t[0]&&e[1]===t[1],ft=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,pt=H.memo(function({routeId:e}){let t=r();return(0,U.jsx)(mt,{router:t,match:W(t.stores.getMatchStore(e),e=>e)})});function mt({router:e,match:t}){let n=e.routesById[t.routeId],r=ut(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=ft(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?H.Suspense:ct,l=i?Ne:ct,u=o?ot:ct;return(0,U.jsxs)(n.isRoot?n.options.shellComponent??ct:ct,{children:[(0,U.jsx)(Re.Provider,{value:t.routeId,children:(0,U.jsx)(c,{fallback:r,children:(0,U.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(Ee(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:(0,U.jsx)(u,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return H.createElement(o,e)},children:s?(0,U.jsx)(Fe,{fallback:r,children:(0,U.jsx)(ht,{match:t})}):(0,U.jsx)(ht,{match:t})})})})}),null]})}var ht=H.memo(function({match:e}){let t=r(),n=e.routeId,i=t.routesById[n],a=H.useMemo(()=>{let r=(i.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return r?JSON.stringify(r):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,i.options.remountDeps,t.options.defaultRemountDeps]),o=H.useMemo(()=>{let e=i.options.component??t.options.defaultComponent;return e?(0,U.jsx)(e,{},a):(0,U.jsx)(gt,{})},[a,i.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!ft(t,i,e.ssr))return o;if(t._tx)throw t._tx[5];return ut(t,i)}if(e.status===`notFound`)return lt(t,i,e.error);if(e.status===`error`)throw e.error;return o}),gt=H.memo(function(){let e=r(),t=H.useContext(Re),n,i,a;{let r=e.stores.getMatchStore(t);[n,i]=W(r,e=>[!!e._notFound,e.error],dt),a=W(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return lt(e,e.routesById[t],i);if(!a)return null;let o=(0,U.jsx)(pt,{routeId:a});return t===`__root__`?(0,U.jsx)(H.Suspense,{fallback:ut(e),children:o}):o}),_t=H.createContext(void 0),vt=e=>{let t=H.useContext(_t);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},yt=({client:e,children:t})=>(H.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,U.jsx)(_t.Provider,{value:e,children:t})),bt={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},xt=new class{#e=bt;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function St(e){setTimeout(e,0)}var Ct=typeof window>`u`||`Deno`in globalThis;function wt(){}function Tt(e,t){return typeof e==`function`?e(t):e}function Et(e){return typeof e==`number`&&e>=0&&e!==1/0}function Dt(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ot(e,t){return typeof e==`function`?e(t):e}function kt(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==jt(o,t.options))return!1}else if(!Nt(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function At(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Mt(t.options.mutationKey)!==Mt(a))return!1}else if(!Nt(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function jt(e,t){return(t?.queryKeyHashFn||Mt)(e)}function Mt(e){return JSON.stringify(e,(e,t)=>Rt(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Nt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n500)return t;let r=Lt(e)&&Lt(t);if(!r&&!(Rt(e)&&Rt(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{xt.setTimeout(t,e)})}function Vt(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Ft(e,t)}function Ht(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Ut(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Wt=Symbol();function Gt(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Wt?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Kt(e,t){return typeof e==`function`?e(...t):!!e}function qt(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Jt=()=>Ct,Yt=()=>Jt(),Xt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Zt=new class extends Xt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Qt=St;function $t(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Qt,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var en=$t(),tn=new class extends Xt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function nn(e){return Math.min(1e3*2**e,3e4)}function rn(e){return(e??`online`)!==`online`||tn.isOnline()}var an=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function on(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(wt);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new an(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Zt.isFocused()&&(e.networkMode===`always`||tn.isOnline())&&e.canRun(),p=()=>rn(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(Yt()?0:3),a=e.retryDelay??nn,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&nf()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var sn=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Et(this.gcTime)&&(this.#e=xt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Yt()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(xt.clearTimeout(this.#e),this.#e=void 0)}};function cn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{qt(e,()=>t.signal,()=>n=!0)},u=Gt(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Ut:Ht;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?un:ln,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:ln(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function ln(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function un(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var dn=class extends sn{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=mn(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=mn(this.options);e.data!==void 0&&(this.setState(pn(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Vt(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(wt).catch(wt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Ot(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Wt||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Ot(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Dt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Gt(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?cn(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=on({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof an&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof an){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...fn(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...pn(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),en.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function fn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:rn(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function pn(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function mn(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var hn=class extends sn{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||gn(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=on({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),en.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function gn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var _n={};function vn(e,t){let n=H.useRef(_n);return n.current===_n&&(n.current=e(t)),n}var yn=t(),bn=[],xn=void 0;function Sn(){return xn}function Cn(e){bn.push(e)}function wn(e){let t=(t,n)=>{let r=vn(En).current,i;try{xn=r;for(let e of bn)e.before(r);i=e(t,n);for(let e of bn)e.after(r);r.didInitialize=!0}finally{xn=void 0}return i};return t.displayName=e.displayName||e.name,t}function Tn(e){return H.forwardRef(wn(e))}function En(){return{didInitialize:!1}}function Dn(){}var On=Object.freeze([]),G=Object.freeze({}),K=typeof document<`u`?H.useLayoutEffect:()=>{},kn=o(n(),1);function An(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var jn=An(`https://base-ui.com/production-error`,`Base UI`),Mn=H.createContext(void 0);function Nn(e){let t=H.useContext(Mn);if(t===void 0&&!e)throw Error(jn(72));return t}function Pn(e){H.useEffect(e,On)}var Fn=0,In=class e{static create(){return new e}currentId=Fn;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Fn,t()},e)}isStarted(){return this.currentId!==Fn}clear=()=>{this.currentId!==Fn&&(clearTimeout(this.currentId),this.currentId=Fn)};disposeEffect=()=>this.clear};function Ln(){let e=vn(In.create).current;return Pn(e.disposeEffect),e}function Rn(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:zn,platform:Bn,maxTouchPoints:Vn}=Rn(),Hn=zn.toLowerCase(),Un=Bn.toLowerCase(),Wn=/^i(os$|p)/.test(Un)||Un===`macintel`&&Vn>1,Gn=`android`,Kn=Un===Gn||Hn.includes(Gn),qn=!Wn&&Un.startsWith(`mac`);Un.startsWith(`win`),!Kn&&/^(linux|chrome os)/.test(Un);var Jn=qn||Wn,Yn=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!Yn&&Hn.includes(`firefox`),!Yn&&Hn.includes(`chrom`);var Xn=Jn,Zn=/jsdom|happydom/.test(Hn);function Qn(e){e.preventDefault(),e.stopPropagation()}function $n(e){return`nativeEvent`in e}function er(e){return e.pointerType===``&&e.isTrusted?!0:Kn&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function tr(e){return Zn?!1:!Kn&&e.width===0&&e.height===0||Kn&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function nr(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function rr(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function ir(){return typeof window<`u`}function ar(e){return sr(e)?(e.nodeName||``).toLowerCase():`#document`}function q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function or(e){return((sr(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function sr(e){return ir()?e instanceof Node||e instanceof q(e).Node:!1}function J(e){return ir()?e instanceof Element||e instanceof q(e).Element:!1}function cr(e){return ir()?e instanceof HTMLElement||e instanceof q(e).HTMLElement:!1}function lr(e){return!ir()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof q(e).ShadowRoot}function ur(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=xr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function dr(e){return/^(table|td|th)$/.test(ar(e))}function fr(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var pr=/transform|translate|scale|rotate|perspective|filter/,mr=/paint|layout|strict|content/,hr=e=>!!e&&e!==`none`,gr;function _r(e){let t=J(e)?xr(e):e;return hr(t.transform)||hr(t.translate)||hr(t.scale)||hr(t.rotate)||hr(t.perspective)||!yr()&&(hr(t.backdropFilter)||hr(t.filter))||pr.test(t.willChange||``)||mr.test(t.contain||``)}function vr(e){let t=Cr(e);for(;cr(t)&&!br(t);){if(_r(t))return t;if(fr(t))return null;t=Cr(t)}return null}function yr(){return gr??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),gr}function br(e){return/^(html|body|#document)$/.test(ar(e))}function xr(e){return q(e).getComputedStyle(e)}function Sr(e){return J(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Cr(e){if(ar(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||lr(e)&&e.host||or(e);return lr(t)?t.host:t}function wr(e){let t=Cr(e);return br(t)?(e.ownerDocument||e).body:cr(t)&&ur(t)?t:wr(t)}function Tr(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=wr(e),i=r===e.ownerDocument?.body,a=q(r);if(i){let e=Er(a);return t.concat(a,a.visualViewport||[],ur(r)?r:[],e&&n?Tr(e):[])}return t.concat(r,Tr(r,[],n))}function Er(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Dr=`data-base-ui-focusable`,Or=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,kr=`ArrowLeft`,Ar=`ArrowRight`,jr=`ArrowUp`,Mr=`ArrowDown`;function Nr(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Y(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&lr(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Pr(e){return`composedPath`in e?e.composedPath()[0]:e.target}function Fr(e,t){if(!J(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(Y(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function Ir(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Lr(e){return e.matches(`html,body`)}function Rr(e){return cr(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function zr(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Or}`)!=null}function Br(e){return e?e.getAttribute(`role`)===`combobox`&&Rr(e):!1}function Vr(e){if(!e||Zn)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Hr(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Ur(e,t){return t!=null&&!nr(t)?0:typeof e==`function`?e():e}function Wr(e,t,n){let r=Ur(e,n);return typeof r==`number`?r:r?.[t]}function Gr(e){return typeof e==`function`?e():e}function Kr(e,t){return t||e===`click`||e===`mousedown`}function qr(e){return e?.includes(`mouse`)&&e!==`mousedown`}var Jr=`none`,Yr=`trigger-press`,Xr=`trigger-hover`,Zr=`trigger-focus`,Qr=`outside-press`,$r=`item-press`,ei=`close-press`,ti=`focus-out`,ni=`escape-key`,ri=`list-navigation`,ii=`cancel-open`,ai=`disabled`,oi=`imperative-action`,si=`window-resize`;function X(e,t,n,r){let i=!1,a=!1,o=r??G;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var ci=H.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new In,currentIdRef:{current:null},currentContextRef:{current:null}});function li(e,t){e.current=t.current}function ui(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=H.useRef(n),a=H.useRef(n),o=H.useRef(null),s=H.useRef(null),c=Ln();return K(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:Wr(i.current,`open`),close:Wr(n,`close`)}},[n,o,i,a]),(0,U.jsx)(ci.Provider,{value:H.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function di(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=H.useContext(ci),[f,p]=H.useState(!1),m=H.useRef(n);return K(()=>{m.current=n},[n]),K(()=>{function e(){l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,d.clear()}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(m.current||a.current!==t)&&d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),K(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:Wr(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,X(Jr))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),K(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,li(o,c),d.clear()}},[l,a,o,i,c,d]),H.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function Z(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function fi(...e){return()=>{for(let t=0;te!==t[n])}function vi(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e{for(let e=0;e{t.current=t.next}};return t}var xi={...H},Si=xi.useInsertionEffect,Ci=Si&&Si!==xi.useLayoutEffect?Si:e=>e();function Q(e){let t=vn(wi).current;return t.next=e,Ci(t.effect),t.trampoline}function wi(){let e={next:void 0,callback:Ti,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Ti(){}var Ei=null;globalThis.requestAnimationFrame;var Di=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},Oi=class e{static create(){return new e}static request(e){return Di.request(e)}static cancel(e){return Di.cancel(e)}currentId=Ei;request(e){this.cancel(),this.currentId=Di.request(()=>{this.currentId=Ei,e()})}cancel=()=>{this.currentId!==Ei&&(Di.cancel(this.currentId),this.currentId=Ei)};disposeEffect=()=>this.cancel};function ki(){let e=vn(Oi.create).current;return Pn(e.disposeEffect),e}function Ai(e){return e?.ownerDocument||document}var ji={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Mi={...ji,position:`fixed`,top:0,left:0},Ni={...ji,position:`absolute`},Pi=H.forwardRef(function(e,t){let[n,r]=H.useState();K(()=>{Xn&&Yn&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,U.jsx)(`span`,{...e,ref:t,style:Mi,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),Fi=Math.min,Ii=Math.max,Li=Math.round,Ri=Math.floor,zi=e=>({x:e,y:e}),Bi={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Vi(e,t,n){return Ii(e,Fi(t,n))}function Hi(e,t){return typeof e==`function`?e(t):e}function Ui(e){return e.split(`-`)[0]}function Wi(e){return e.split(`-`)[1]}function Gi(e){return e===`x`?`y`:`x`}function Ki(e){return e===`y`?`height`:`width`}function qi(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ji(e){return Gi(qi(e))}function Yi(e,t,n){n===void 0&&(n=!1);let r=Wi(e),i=Ji(e),a=Ki(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ia(o)),[o,ia(o)]}function Xi(e){let t=ia(e);return[Zi(e),t,Zi(t)]}function Zi(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Qi=[`left`,`right`],$i=[`right`,`left`],ea=[`top`,`bottom`],ta=[`bottom`,`top`];function na(e,t,n){switch(e){case`top`:case`bottom`:return n?t?$i:Qi:t?Qi:$i;case`left`:case`right`:return t?ea:ta;default:return[]}}function ra(e,t,n,r){let i=Wi(e),a=na(Ui(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Zi)))),a}function ia(e){let t=Ui(e);return Bi[t]+e.slice(t.length)}function aa(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function oa(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:aa(e)}function sa(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ca(e,t){return t<0||t>=e.length}function la(e,t){return da(e.current,{disabledIndices:t})}function ua(e,t){return da(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function da(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&fa(e,a,r));return a}function fa(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!ma(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function pa(e){return e.visibility===`hidden`||e.visibility===`collapse`}function ma(e,t=e?xr(e):null){return!e||!e.isConnected||!t||pa(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var ha=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function ga(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return lr(n)?n.host:null}function _a(e){for(let t of Array.from(e.children))if(ar(t)===`summary`)return t;return null}function va(e,t){let n=_a(t);return!!n&&(e===n||Y(n,e))}function ya(e){let t=e?ar(e):``;return e!=null&&e.matches(ha)&&(t!==`summary`||e.parentElement!=null&&ar(e.parentElement)===`details`&&_a(e.parentElement)===e)&&(t!==`details`||_a(e)==null)&&(t!==`input`||e.type!==`hidden`)}function ba(e){if(!ya(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=ga(t)){let n=t!==e,r=ar(t)===`slot`;if(t.hasAttribute(`inert`)||n&&ar(t)===`details`&&!t.open&&!va(e,t)||t.hasAttribute(`hidden`)||!r&&!xa(t,n))return!1}return!0}function xa(e,t){let n=xr(e);return t?n.display!==`none`:ma(e,n)}function Sa(e){let t=e.tabIndex;if(t<0){let t=ar(e);if(t===`details`||t===`audio`||t===`video`||cr(e)&&e.isContentEditable)return 0}return t}function Ca(e){if(ar(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function wa(e,t){let n=Ca(e);if(!n)return!0;let r=t.find(e=>{let t=Ca(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Ca(e);return t?.name===n.name&&t.form===n.form})===n}function Ta(e){if(cr(e)&&ar(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return cr(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Ea(e,t){Ta(e).forEach(e=>{ya(e)&&t.push(e),Ea(e,t)})}function Da(e,t,n){Ta(e).forEach(e=>{cr(e)&&e.matches(t)&&n.push(e),Da(e,t,n)})}function Oa(e){return ba(e)&&Sa(e)>=0}function ka(e){let t=[];return Ea(e,t),t.filter(ba)}function Aa(e){let t=ka(e);return t.filter(e=>Sa(e)>=0&&wa(e,t))}function ja(e,t){let n=Aa(e),r=n.length;if(r===0)return;let i=Nr(Ai(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Ma(e){return ja(Ai(e).body,1)||e}function Na(e){return ja(Ai(e).body,-1)||e}function Pa(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Y(n,r)}function Fa(e){Aa(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Ia(e){let t=[];Da(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function La(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...La(e,t.id,n)])}function Ra(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function za(e){return`data-base-ui-${e}`}var Ba=0;function Va(e,t=`mui`){let[n,r]=H.useState(e),i=e||n;return H.useEffect(()=>{n??(Ba+=1,r(`${t}-${Ba}`))},[n,t]),i}var Ha=xi.useId;function Ua(e,t){if(Ha!==void 0){let n=Ha();return e??(t?`${t}-${n}`:n)}return Va(e,t)}var Wa=19;function Ga(e){return Wa>=e}function Ka(e){if(!H.isValidElement(e))return null;let t=e,n=t.props;return(Ga(19)?n?.ref:t.ref)??null}function qa(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Ja(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function Ya(e,t){return typeof e==`function`?e(t):e}function Xa(e,t){return typeof e==`function`?e(t):e}var Za={};function Qa(e,t,n,r,i){if(!n&&!r&&!i&&!e)return eo(t);let a=eo(e);return t&&(a=to(a,t)),n&&(a=to(a,n)),r&&(a=to(a,r)),i&&(a=to(a,i)),a}function $a(e){if(e.length===0)return Za;if(e.length===1)return eo(e[0]);let t=eo(e[0]);for(let n=1;n=65&&i<=90&&(typeof t==`function`||t===void 0)}function ao(e){return typeof e==`function`}function oo(e,t){return ao(e)?e(t):e??Za}function so(e,t){return t?e?(...n)=>{let r=n[0];if(fo(r)){let i=r;lo(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:co(t):e}function co(e){return e&&((...t)=>{let n=t[0];return fo(n)&&lo(n),e(...t)})}function lo(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function uo(e,t){return t?e?t+` `+e:t:e}function fo(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function po(e,t,n={}){let r=t.render,i=mo(t,n);return n.enabled===!1?null:_o(e,r,i,n.state??G)}function mo(e,t={}){let{className:n,style:r,render:i}=e,{state:a=G,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?Ya(n,a):void 0,d=l?Xa(r,a):void 0,f=l?Ja(a,c):G,p=l&&s?ho(s):void 0,m=l?qa(f,p)??{}:G;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?mi([m.ref,Ka(i),...o]):pi(m.ref,Ka(i),o):pi(null,null)),l?(u!==void 0&&(m.className=uo(m.className,u)),d!==void 0&&(m.style=qa(m.style,d)),m):G}function ho(e){return Array.isArray(e)?$a(e):Qa(void 0,e)}var go=Symbol.for(`react.lazy`);function _o(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=Qa(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===go&&(i=H.Children.toArray(t)[0]),H.cloneElement(i,e)}if(e&&typeof e==`string`)return vo(e,n);throw Error(jn(8))}function vo(e,t){return e===`button`?(0,H.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,H.createElement)(`img`,{alt:``,...t,key:t.key}):H.createElement(e,t)}var yo={style:{transition:`none`}},bo=`data-base-ui-click-trigger`,xo={fallbackAxisSide:`none`},So={fallbackAxisSide:`end`},Co={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},wo=H.createContext(null),To=()=>H.useContext(wo),Eo=za(`portal`);function Do(e={}){let{ref:t,container:n,componentProps:r=G,elementProps:i}=e,a=Ua(),o=To()?.portalNode,[s,c]=H.useState(null),[l,u]=H.useState(null),d=Q(e=>{e!==null&&u(e)}),f=H.useRef(null);K(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(sr(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=po(`div`,r,{ref:[t,d],props:[{id:a,[Eo]:``},i]}),m=s&&p?kn.createPortal(p,s):null;return{node:l,nodeId:H.isValidElement(p)?p.props.id:void 0,subtree:m}}var Oo=H.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,...s}=e,{node:c,nodeId:l,subtree:u}=Do({container:o,ref:t,componentProps:e,elementProps:s}),d=H.useRef(null),f=H.useRef(null),p=H.useRef(null),m=H.useRef(null),[h,g]=H.useState(null),_=H.useRef(!1),v=h?.modal,y=h?.open,b=!!h&&!h.modal&&h.open&&!!c;H.useEffect(()=>{if(!c||v)return;function e(e){c&&e.relatedTarget&&Pa(e)&&(e.type===`focusin`?_.current&&=(Ia(c),!1):(Fa(c),_.current=!0))}return fi(Z(c,`focusin`,e,!0),Z(c,`focusout`,e,!0))},[c,v]),K(()=>{!c||y!==!0||!_.current||(Ia(c),_.current=!1)},[y,c]);let x=H.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:c,setFocusManagerState:g}),[c]);return(0,U.jsxs)(H.Fragment,{children:[u,(0,U.jsxs)(wo.Provider,{value:x,children:[b&&c&&(0,U.jsx)(Pi,{"data-type":`outside`,ref:d,onFocus:e=>{Pa(e,c)?p.current?.focus():Na(h?h.domReference:null)?.focus()}}),b&&c&&(0,U.jsx)(`span`,{"aria-owns":l,style:Co}),c&&kn.createPortal(a,c),b&&c&&(0,U.jsx)(Pi,{"data-type":`outside`,ref:f,onFocus:e=>{Pa(e,c)?m.current?.focus():(Ma(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,X(`focus-out`,e.nativeEvent)))}})]})]})});function ko(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var Ao=H.createContext(null),jo=H.createContext(null),Mo=()=>H.useContext(Ao)?.id||null,No=e=>{let t=H.useContext(jo);return e??t};function Po(e){return e==null?e:`current`in e?e.current:e}function Fo(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function Io(e){return e!=null&&e.clientX!=null}function Lo(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=H.useRef(!1),u=H.useRef(null),[d,f]=H.useState(),[p,m]=H.useState([]),h=Q(e=>{i.set(`positionReference`,e)}),g=Q((e,t,n)=>{l.current||c.current.openEvent&&!Io(c.current.openEvent)||i.set(`positionReference`,Fo(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=Q(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=nr(d)?o:a;H.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=q(o);function r(t){let n=Pr(t);Y(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||Io(c.current.openEvent)?u.current=Z(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),H.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),H.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),H.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=H.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return H.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function Ro(){return!1}function zo(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function Bo(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=Ro,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f}=l.context,p=No(c),m=Q(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=Q(()=>a),{escapeKey:v,outsidePress:y}=zo(s),b=H.useRef(!1),x=H.useRef(!1),S=H.useRef(!1),C=H.useRef(!1),w=H.useRef(``),T=H.useRef(null),E=Ln(),D=Ln(),O=Q(()=>{D.clear(),f.current.insideReactTree=!1}),k=Q(e=>{let t=f.current.floatingContext?.nodeId;return(p?La(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),A=Q(e=>Ir(e,l.select(`floatingElement`))||Ir(e,l.select(`domReferenceElement`))),j=Q(e=>{o()&&l.setOpen(!1,X(Yr,e.nativeEvent))}),M=Q(e=>{if(!u||!n||!r||e.key!==`Escape`||C.current||!v&&k(`__escapeKeyBubbles`))return;let t=X(ni,$n(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!v&&!t.isPropagationAllowed&&e.stopPropagation()}),N=Q(()=>{f.current.insideReactTree=!0,D.start(0,O)}),P=Q(e=>{if(!u||!n||e.button!==0)return;let t=Pr(e.nativeEvent);Y(l.select(`floatingElement`),t)&&(b.current||(b.current=!0,x.current=!1))}),F=Q(e=>{!u||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});H.useEffect(()=>{if(!u||!n)return O;f.current.__escapeKeyBubbles=v,f.current.__outsidePressBubbles=y;let e=new In,t=new In;function i(){e.clear(),C.current=!0}function a(){e.start(Yn?5:0,()=>{C.current=!1})}function o(){S.current=!0,t.start(0,()=>{S.current=!1})}function s(){b.current=!1,x.current=!1}function c(){let e=w.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function D(e){let t=f.current.floatingContext?.nodeId,n=p&&La(p.nodesRef.current,t).some(t=>Ir(e,t.context?.elements.floating));return A(e)||n}function j(e){if(m(e)){e.type!==`click`&&!A(e)&&(t.clear(),S.current=!1),O();return}if(f.current.insideReactTree){O();return}let n=Pr(e),r=`[${za(`inert`)}]`,i=J(n)?n.getRootNode():null,a=Array.from((lr(i)?i:Ai(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>Y(e,n))))return;let s=J(n)?n:null;for(;s&&!br(s);){let e=Cr(s);if(br(e)||!J(e))break;s=e}if(!(a.length&&J(n)&&!Lr(n)&&!Y(n,l.select(`floatingElement`))&&a.every(e=>!Y(s,e)))){if(cr(n)&&!(`touches`in e)){let t=br(n),r=xr(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!D(e)){if(c()===`intentional`&&S.current){t.clear(),S.current=!1;return}typeof h==`function`&&!h(e)||k(`__outsidePressBubbles`)||(l.setOpen(!1,X(Qr,e)),O())}}}function N(e){c()!==`sloppy`||e.pointerType===`touch`||!l.select(`open`)||!n||A(e)||j(e)}function P(e){if(c()!==`sloppy`||!l.select(`open`)||!n||A(e))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function F(e,t){let n=Pr(e);if(!n)return;let r=Z(n,e.type,()=>{t(e),r()})}function I(e){w.current=`touch`,F(e,P)}function L(e){E.clear(),e.type===`pointerdown`&&(w.current=e.pointerType),!(e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)&&F(e,e=>{e.type===`pointerdown`?N(e):j(e)})}function R(e){if(!b.current)return;let n=x.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!D(e)){if(n){o();return}typeof h==`function`&&!h(e)||(t.clear(),S.current=!0,O())}}}function z(e){if(c()!==`sloppy`||!T.current||A(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-T.current.startX),r=Math.abs(t.clientY-T.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(T.current.dismissOnTouchEnd=!0),i>10&&(j(e),E.clear(),T.current=null)}function ee(e){F(e,z)}function te(e){c()!==`sloppy`||!T.current||A(e)||(T.current.dismissOnTouchEnd&&j(e),E.clear(),T.current=null)}function ne(e){F(e,te)}let B=Ai(d),V=fi(r&&fi(Z(B,`keydown`,M),Z(B,`compositionstart`,i),Z(B,`compositionend`,a)),g&&fi(Z(B,`click`,L,!0),Z(B,`pointerdown`,L,!0),Z(B,`pointerup`,R,!0),Z(B,`pointercancel`,R,!0),Z(B,`mousedown`,L,!0),Z(B,`mouseup`,R,!0),Z(B,`touchstart`,I,!0),Z(B,`touchmove`,ee,!0),Z(B,`touchend`,ne,!0)));return()=>{V(),e.clear(),t.clear(),s(),S.current=!1,O()}},[f,d,r,g,h,u,n,v,y,M,O,_,k,A,p,l,E]);let I=H.useMemo(()=>({onKeyDown:M,onPointerDown:j,onClick:j}),[M,j]),L=H.useMemo(()=>({onKeyDown:M,onPointerDown:F,onMouseDown:F,onClickCapture:N,onMouseDownCapture(e){N(),P(e)},onPointerDownCapture(e){N(),P(e)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[M,N,P,F]);return H.useMemo(()=>n?{reference:I,floating:L,trigger:I}:{},[n,I,L])}function Vo(e,t,n){let{reference:r,floating:i}=e,a=qi(t),o=Ji(t),s=Ki(o),c=Ui(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Wi(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Ho(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Hi(t,e),p=oa(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=sa(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=sa(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Uo=50,Wo=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ho},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Vo(l,r,c),f=r,p=0,m={};for(let n=0;ne<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===qi(t)||T.every(e=>qi(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=qi(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},Ko=new Set([`left`,`top`]);async function qo(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ui(n),s=Wi(n),c=qi(n)===`y`,l=Ko.has(o)?-1:1,u=a&&c?-1:1,d=Hi(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Jo=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await qo(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Yo=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Hi(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=qi(i),p=Gi(f),m=u[p],h=u[f],g=(e,t)=>Vi(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Xo=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Hi(e,t),u={x:n,y:r},d=qi(i),f=Gi(d),p=u[f],m=u[d],h=Hi(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;pn&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ko.has(Ui(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);mr&&(m=r)}return{[f]:p,[d]:m}}}},Zo=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Hi(e,t),c=await i.detectOverflow(t,s),l=Ui(n),u=Wi(n),d=qi(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Fi(p-c[m],g),y=Fi(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Ii(c.left,c.right):S=p-2*Ii(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Qo(e){let t=xr(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=cr(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Li(n)!==a||Li(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function $o(e){return J(e)?e:e.contextElement}function es(e){let t=$o(e);if(!cr(t))return zi(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Qo(t),o=(a?Li(n.width):n.width)/r,s=(a?Li(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ts=zi(0);function ns(e){let t=q(e);return!yr()||!t.visualViewport?ts:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function rs(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===q(e)}function is(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=$o(e),o=zi(1);t&&(r?J(r)&&(o=es(r)):o=es(e));let s=rs(a,n,r)?ns(a):zi(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=q(a),t=J(r)?q(r):r,n=e,i=Er(n);for(;i&&t!==n;){let e=es(i),t=i.getBoundingClientRect(),r=xr(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=q(i),i=Er(n)}}return sa({width:u,height:d,x:c,y:l})}function as(e,t){let n=Sr(e).scrollLeft;return t?t.left+n:is(or(e)).left+n}function os(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-as(e,n),y:n.top+t.scrollTop}}function ss(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=or(r),s=t?fr(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=zi(1),u=zi(0),d=cr(r);if((d||!a)&&((ar(r)!==`body`||ur(o))&&(c=Sr(r)),d)){let e=is(r);l=es(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?os(o,c):zi(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function cs(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function ls(e){let t=Sr(e),n=e.ownerDocument.body,r=Ii(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Ii(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+as(e),o=-t.scrollTop;return xr(n).direction===`rtl`&&(a+=Ii(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var us=25;function ds(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=q(e),a=or(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!yr()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(as(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=us&&(s-=o)}return{width:s,height:c,x:l,y:u}}function fs(e,t){let n=is(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=es(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ps(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=ds(e,n,t);else if(t===`document`)r=ls(or(e));else if(J(t))r=fs(t,n);else{let n=ns(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return sa(r)}function ms(e,t){let n=t.get(e);if(n)return n;let r=Tr(e,[],!1).filter(e=>J(e)&&ar(e)!==`body`),i=null,a=xr(e).position===`fixed`,o=a?Cr(e):e;for(;J(o)&&!br(o);){let e=xr(o),t=_r(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Cr(o)}return t.set(e,r),r}function hs(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?fr(t)?[]:ms(t,this._c):[].concat(n),r],o=ps(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=q(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Es(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=$o(e),u=i||a?[...l?Tr(l):[],...t?Tr(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ts(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?is(e):null;c&&g();function g(){let t=is(e);h&&!ws(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ds=Jo,Os=Yo,ks=Go,As=Zo,js=Xo,Ms=(e,t,n)=>{let r=new Map,i=n??{},a={...Cs,...i.platform,_c:r};return Wo(e,t,{...i,platform:a})},Ns=typeof document<`u`?H.useLayoutEffect:function(){};function Ps(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ps(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ps(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Fs(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Is(e,t){let n=Fs(e);return Math.round(t*n)/n}function Ls(e){let t=H.useRef(e);return Ns(()=>{t.current=e}),t}function Rs(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=H.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=H.useState(r);Ps(f,r)||p(r);let[m,h]=H.useState(null),[g,_]=H.useState(null),v=H.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=H.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=H.useRef(null),C=H.useRef(null),w=H.useRef(u),T=c!=null,E=Ls(c),D=Ls(i),O=Ls(l),k=H.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Ms(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Ps(w.current,t)&&(w.current=t,kn.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Ns(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=H.useRef(!1);Ns(()=>(A.current=!0,()=>{A.current=!1}),[]),Ns(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=H.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=H.useMemo(()=>({reference:b,floating:x}),[b,x]),N=H.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Is(M.floating,u.x),r=Is(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Fs(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return H.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var zs=(e,t)=>{let n=Ds(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bs=(e,t)=>{let n=Os(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vs=(e,t)=>({fn:js(e).fn,options:[e,t]}),Hs=(e,t)=>{let n=ks(e);return{name:n.name,fn:n.fn,options:[e,t]}},Us=(e,t)=>{let n=As(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ws=Ga(19)?qs:Js;function Gs(e,t,n,r,i){return Ws(e,t,n,r,i)}function Ks(e,t,n,r,i){let a=H.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,yn.useSyncExternalStore)(e.subscribe,a,a)}Cn({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,yn.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function qs(e,t,n,r,i){let a=Sn();if(!a)return Ks(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function Js(e,t,n,r,i){return(0,Be.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Ys=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Gs(this,e,t,n,r)}},Xs=class extends Ys{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){H.useDebugValue(e);let n=this;K(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;K(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;K(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){H.useDebugValue(e);let n=this,r=t!==void 0;K(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return H.useDebugValue(e),Gs(this,this.selectors[e],t,n,r)}useContextCallback(e,t){H.useDebugValue(e);let n=Q(t??Dn);this.context[e]=n}useStateSetter(e){let t=H.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},Zs={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},Qs=class extends Xs{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:ko(),nested:n,triggerElements:i},Zs),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&rr(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function $s(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=H.useRef(null);r===void 0&&f.current===null&&(f.current=new Qs({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),K(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};J(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function ec(e,t=!1,n=!1){let[r,i]=H.useState(e&&t?`idle`:void 0),[a,o]=H.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),K(()=>{if(!e&&a&&r!==`ending`&&n){let e=Oi.request(()=>{i(`ending`)});return()=>{Oi.cancel(e)}}},[e,a,r,n]),K(()=>{if(!e||t)return;let n=Oi.request(()=>{i(void 0)});return()=>{Oi.cancel(n)}},[t,e]),K(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=Oi.request(()=>{i(`idle`)});return()=>{Oi.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}function tc(e,t=!1){let n=ki();return Q((r,i=null)=>{n.cancel();let a=Po(e);if(a==null)return;let o=a,s=()=>{kn.flushSync(r)};if(typeof o.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function c(){Promise.all(o.getAnimations().map(e=>e.finished)).then(()=>{i?.aborted||s()},()=>{if(!i?.aborted){if(o.getAnimations().some(e=>e.pending||e.playState!==`finished`)){c();return}s()}})}if(t){let e=`data-starting-style`;if(!o.hasAttribute(e)){n.request(c);return}let t=new MutationObserver(()=>{o.hasAttribute(e)||(t.disconnect(),c())});t.observe(o,{attributes:!0,attributeFilter:[e]}),i?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}n.request(c)})}function nc(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=Q(i),o=tc(r,n);H.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var rc={tabIndex:-1,[Dr]:``};function ic(e){return t=>t!==`touch`||e.current}function ac(e,t=!1){let n=Ua(),r=Mo()!=null,i=vn(()=>e(n,r)).current;return $s({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function oc({handle:e,store:t}){return K(()=>e.attachStore(t),[e,t]),null}function sc(e,t){let n=H.useRef(null),r=H.useRef(null);return H.useCallback(i=>{if(e===void 0)return;let a=!1;if(n.current!==null){let e=n.current,i=r.current,o=t.context.triggerElements.getById(e);i&&o===i&&(t.context.triggerElements.delete(e),a=!0),n.current=null,r.current=null}if(i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i),a=!0),a){let e=t.context.triggerElements.size;t.select(`open`)&&t.state.triggerCount!==e&&t.set(`triggerCount`,e)}},[t,e])}function cc(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);let i=n?.id??null;(i||t)&&(e.activeTriggerId=i,e.activeTriggerElement=n??null)}function lc(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function uc(e,t,n,r={}){let i=n.reason,a=i===Xr,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=lc(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i={...r.extraState,open:t};o?i.instantType=`focus`:s?i.instantType=`dismiss`:a&&(i.instantType=void 0),cc(i,t,n.trigger,c()),e.update(i)};a?kn.flushSync(l):l()}function dc(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=sc(e,n),o=Q(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){n.update({activeTriggerElement:t,...i?r:null});return}a==null&&i&&n.update({activeTriggerId:e,activeTriggerElement:t,...r})}),s=H.useCallback(e=>{a(e),e&&o(e)},[a,o]);return K(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function fc(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=H.useRef(null),i=e.useState(`open`);K(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=X(Jr);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function pc(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=ec(e),o=t.useState(`preventUnmountingOnClose`),s=!e&&o;t.useSyncedValues({mounted:r,transitionStatus:a,preventUnmountingOnClose:s});let c=Q(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return nc({enabled:r&&!e&&!s,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:a}}function mc(e,t){e.useSyncedValues(t),K(()=>()=>{e.update({activeTriggerProps:G,inactiveTriggerProps:G,popupProps:G})},[e])}function hc(e,t){K(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),K(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var gc=class{constructor(){this.idMap=new Map}add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};function _c(){return new Qs({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new gc,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function vc(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:_c(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:G,inactiveTriggerProps:G,popupProps:G}}function yc(e,t,n=!1){return new Qs({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var bc=e=>e.triggerIdProp??e.activeTriggerId,xc=e=>e.openProp??e.open,Sc=e=>(e.popupElement?.id??e.floatingId)||void 0;function Cc(e,t){return t!==void 0&&xc(e)&&bc(e)===t}function wc(e,t){return Cc(e,t)?!0:t!==void 0&&xc(e)&&bc(e)==null&&e.triggerCount===1}var Tc={open:xc,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:bc,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Sc,isTriggerActive:(e,t)=>t!==void 0&&bc(e)===t,isOpenedByTrigger:(e,t)=>Cc(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&bc(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>wc(e,t)?Sc(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Ec(e){let t=H.useCallback(t=>e===void 0?Dn:e.subscribeStore(t),[e]),n=H.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,yn.useSyncExternalStore)(t,n,()=>e?.serverStore)}function Dc(e){return Oc(e,e.rootContext)}function Oc(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=H.useState(null),[d,f]=H.useState(void 0),[p,m]=H.useState(void 0),h=H.useRef(null),g=No(r),_=H.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=Rs({...e,elements:{..._,...l&&{reference:l}}}),y=J(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=H.useCallback(e=>{let t=J(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=H.useCallback(e=>{(J(e)||e===null)&&(h.current=e,f(e)),(J(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!J(e))&&v.refs.setReference(e)},[v.refs,f]),C=H.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=H.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=H.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=H.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return K(()=>{o&&(h.current=o)},[o]),K(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),H.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var kc=qn&&Yn;function Ac(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=H.useRef(!1),c=H.useRef(null),l=H.useRef(!0),u=Ln();H.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=q(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&cr(e)&&e===Nr(Ai(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return fi(Z(t,`blur`,r),kc&&Z(t,`keydown`,a,!0),kc&&Z(t,`pointerdown`,o,!0))},[i,n]),H.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);J(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=H.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=Pr(t.nativeEvent);if(J(a)){if(kc&&!t.relatedTarget){if(!l.current&&!Rr(a))return}else if(!Vr(a))return}let o=Fr(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,X(Zr,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,X(Zr,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=J(n)&&n.hasAttribute(za(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=Nr(Ai(e));!n&&t===e||Y(o.current.floatingContext?.refs.floating.current,t)||Y(e,t)||a||Fr(n??t,i.context.triggerElements)||i.setOpen(!1,X(Zr,r))})}}},[o,r,i,u]);return H.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var jc=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new In,this.restTimeout=new In,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},Mc=new WeakMap;function Nc(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&Mc.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),Mc.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Pc(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=Mc.get(n);a&&a!==e&&Nc(a),Nc(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,Mc.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function Fc(e){let t=e.context.dataRef.current,n=vn(()=>t.hoverInteractionState??jc.create()).current;return t.hoverInteractionState||=n,Pn(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Ic(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=No(),d=Mo(),f=Fc(a),p=Ln(),m=Q(()=>Kr(l.current.openEvent?.type,f.interactedInside)),h=Q(()=>qr(l.current.openEvent?.type)),g=Q(()=>{Nc(f)});K(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),H.useEffect(()=>g,[g]),K(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&J(c)&&s){let e=c,t=s,n=Ai(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return Pc(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),H.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&La(u.nodesRef.current,d).length>0)}function t(e){let t=Wr(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,X(Xr,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=Pr(e);if(!zr(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(Fr(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&J(o)&&La(u.nodesRef.current,r,!1).some(e=>Y(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}g(),h()&&!m()&&t(n)}}function v(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,X(Xr,t)),u.events.emit(`floating.closed`,t)})}let y=s;return fi(y&&Z(y,`mouseenter`,c),y&&Z(y,`mouseleave`,_),y&&Z(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var Lc={current:null};function Rc(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=Lc,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,h=`rootStore`in e?e.rootStore:e,{dataRef:g,events:_}=h.context,v=No(l),y=Fc(h),b=H.useRef(!1),x=yi(i),S=yi(r),C=yi(o),w=yi(n),T=yi(p),E=yi(f),D=Q(()=>Kr(g.current.openEvent?.type,y.interactedInside)),O=Q(()=>T.current?.()!==!1),k=Q((e,t,n)=>{let r=h.context.triggerElements;if(r.hasElement(t))return!e||!Y(e,t);if(!J(n))return!1;let i=n;return r.hasMatchingElement(e=>Y(e,i))&&(!e||!Y(e,i))}),A=Q(()=>{y.handler&&=(Ai(h.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),j=Q(()=>{Nc(y)});return u&&(y.handleCloseOptions=x.current?.__options),H.useEffect(()=>A,[A]),H.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===Xr,A(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return _.on(`openchange`,e),()=>{_.off(`openchange`,e)}},[n,_,y,A]),H.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Wr(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{h.setOpen(!1,X(Xr,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),h.setOpen(!1,X(Xr,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?h.select(`domReferenceElement`):null);if(!J(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!nr(y.pointerType))return;let t=Gr(C.current),n=Wr(S.current,`open`,y.pointerType),r=Pr(e),i=e.currentTarget??null,o=h.select(`domReferenceElement`),s=i;if(J(r)&&!h.context.triggerElements.hasElement(r)){for(let e of h.context.triggerElements.elements())if(Y(e,r)){s=e;break}}J(i)&&J(o)&&!h.context.triggerElements.hasElement(i)&&Y(i,o)&&(s=o);let c=s!=null&&k(o,s,r),l=h.select(`open`),u=E.current?.()??h.select(`transitionStatus`)===`ending`,d=!l&&u&&b.current,f=!c&&J(s)&&J(o)&&Y(o,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,g=!l||c;if(m){O()&&h.setOpen(!0,X(Xr,e,s));return}p||(n?y.openChangeTimeout.start(n,()=>{g&&O()&&h.setOpen(!0,X(Xr,e,s))}):g&&O()&&h.setOpen(!0,X(Xr,e,s)))}function i(t){if(D()){j();return}A();let n=Ai(h.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=g.current.floatingContext??d?.();if(!Fr(t.relatedTarget,h.context.triggerElements)){if(x.current&&r){h.select(`open`)||y.openChangeTimeout.clear();let i=c.current;y.handler=x.current({...r,tree:v,x:t.clientX,y:t.clientY,onClose(){j(),A(),w.current&&!D()&&i===h.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,y.handler),y.handler(t);return}(y.pointerType!==`touch`||!Y(h.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){Y(t,e.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}let l=m?Z(t,`mouseout`,o):void 0;return s?fi(Z(t,`mousemove`,r,{once:!0}),Z(t,`mouseenter`,r),Z(t,`mouseleave`,i),l):fi(Z(t,`mouseenter`,r),Z(t,`mouseleave`,i),l)},[A,j,g,S,h,n,x,y,u,k,D,a,s,C,c,v,w,d,E,O,m]),H.useMemo(()=>{if(!n)return;function e(e){y.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=h.select(`domReferenceElement`),i=h.select(`open`),o=k(r,n,e.target);if(a&&!nr(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=h.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;Pc(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=Gr(C.current);if(i&&!o||s===0||!o&&y.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;y.restTimeout.clear();function c(){if(y.restTimeoutPending=!1,D())return;let e=h.select(`open`);!y.blockMouseMove&&(!e||o)&&O()&&h.setOpen(!0,X(Xr,t,n))}y.pointerType===`touch`?kn.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,D,k,a,h,C,O])}var zc=.1,Bc=zc*zc,$=.5;function Vc(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Hc(e,t,n,r,i,a,o,s,c,l){let u=!1;return Vc(e,t,n,r,i,a)&&(u=!u),Vc(e,t,i,a,o,s)&&(u=!u),Vc(e,t,o,s,c,l)&&(u=!u),Vc(e,t,c,l,n,r)&&(u=!u),u}function Uc(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Wc(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Gc(e={}){let{blockPointerEvents:t=!1}=e,n=new In,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*Bc;return u=e,d=t,f=n,o0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=Wc(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=Wc(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=Wc(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=Wc(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!Uc(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?$/2:$*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+$+1,o=C||T?S.bottom-$:S.top,s=C?T?S.bottom-$:S.top:S.bottom-$;M=Hc(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?$/2:$*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-$,o=C||T?S.top+$:S.bottom,s=C?T?S.top+$:S.bottom:S.top+$;M=Hc(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?$/2:$*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+$+1,o=w||E?S.right-$:S.left,s=w?E?S.right-$:S.left:S.right-$;M=Hc(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?$/2:$*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-$,o=w||E?S.left+$:S.right,s=w?E?S.left+$:S.right:S.left+$;M=Hc(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var Kc={...Tc,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},qc=class extends Xs{constructor(e,t,n){let r=new gc;super(Jc(e,r,t,n),Yc(r),Kc)}setOpen=(e,t)=>{uc(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,X(Yr,e))}};function Jc(e,t,n,r=!1){let i={...vc(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return i.floatingRootContext=yc(t,n,r),i}function Yc(e){return{popupRef:H.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var Xc=wn(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=ac((e,t)=>new qc({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),fc(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=pc(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=H.useRef(null);K(()=>{m&&t&&p.setOpen(!1,X(ai))},[m,t,p]),K(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),K(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),H.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,X(oi))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,U.jsxs)(Mn.Provider,{value:p,children:[l&&(0,U.jsx)(oc,{handle:l,store:p}),T&&(0,U.jsx)(Zc,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function Zc({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=Bo(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=Lo(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=H.useMemo(()=>Qa(a.reference,i.reference),[a.reference,i.reference]);return mc(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??G}),null}var Qc=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),$c={"data-starting-style":``},el={"data-ending-style":``},tl={transitionStatus(e){return e===`starting`?$c:e===`ending`?el:null}};(function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Qc.startingStyle]=`startingStyle`,e[e.endingStyle=Qc.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e})({});var nl={"data-popup-open":``},rl={"data-popup-open":``,"data-pressed":``},il={"data-open":``},al={"data-closed":``},ol={"data-anchor-hidden":``},sl={open(e){return e?nl:null}},cl={open(e){return e?rl:null}},ll={open(e){return e?il:al},anchorHidden(e){return e?ol:null}},ul={...ll,...tl};function dl(e){return Ua(e,`base-ui`)}var fl=H.createContext(void 0);function pl(){return H.useContext(fl)}var ml=`data-base-ui-tooltip-trigger`;function hl(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;em.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),te=Ac(v,{enabled:!A}).reference,ne=e=>{let t=P.current,n=hl(e),r=z(n),i=y.current,a=i&&n&&Y(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`){m.setOpen(!1,X(Xr,e));return}if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&nr(I.current)){let t=()=>{!P.current&&!j.current&&!m.select(`open`)&&m.setOpen(!0,X(Xr,e,i))},n=L();n===0?(F.clear(),t()):F.start(n,t)}},B=m.useState(`triggerProps`,C);return po(`button`,e,{state:{open:_},ref:[t,S,y],props:[ee,te,C||M!==`none`?B:void 0,{onMouseOver(e){ne(e.nativeEvent)},onFocus(e){R(hl(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){P.current=!1,F.clear(),I.current=void 0},onPointerEnter(e){I.current=e.pointerType},onPointerDown(e){I.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,"data-trigger-disabled":A?``:void 0,[ml]:A?void 0:``},f],stateAttributesMapping:sl})}),vl=H.createContext(void 0);function yl(){let e=H.useContext(vl);if(e===void 0)throw Error(jn(70));return e}var bl=H.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=Do({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,U.jsxs)(H.Fragment,{children:[l,c&&kn.createPortal(n,c)]})}),xl=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Nn().useState(`mounted`)||n?(0,U.jsx)(vl.Provider,{value:n,children:(0,U.jsx)(bl,{ref:t,...r})}):null}),Sl=H.createContext(void 0);function Cl(){let e=H.useContext(Sl);if(e===void 0)throw Error(jn(71));return e}var wl=H.createContext(void 0);function Tl(){return H.useContext(wl)?.direction??`ltr`}var El=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=Hi(e,t)||{};if(l==null)return{};let f=oa(u),p={x:n,y:r},m=Ji(i),h=Ki(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=Vi(k,j,A),N=!c.arrow&&Wi(i)!=null&&j!==M&&a.reference[h]/2-(j({...El(e),options:[e,t]}),Ol={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},kl={sideX:`left`,sideY:`top`},Al=`--available-width`,jl=`--available-height`;function Ml(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function Nl(e,t,n){let{rects:r,placement:i}=e;return{side:Ml(t,Ui(i),n),align:Wi(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Pl(e){return Fl(e,Dc)}function Fl(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=H.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=v?.crossAxis??!1,k=v?.rootBoundary,A=typeof n==`function`?n:void 0,j=Q(A),M=A?j:n,N=yi(n),P=yi(g),F=Tl()===`rtl`,I=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":F?`left`:`right`,"inline-start":F?`right`:`left`}[i],L=o===`center`?I:`${I}-${o}`,R=l;typeof R==`number`?R={top:R,right:R,bottom:R,left:R}:R&&={top:R.top||0,right:R.right||0,bottom:R.bottom||0,left:R.left||0};let z=+(i===`bottom`),ee=+(i===`top`),te=+(i===`right`),ne=+(i===`left`),B={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:R},V=H.useRef(null),re=yi(a),ie=yi(s),ae=typeof a==`function`?0:a,oe=typeof s==`function`?0:s,se=[];p&&se.push(p),se.push(zs(e=>{let t=Nl(e,i,F),n=typeof re.current==`function`?re.current(t):re.current,r=typeof ie.current==`function`?ie.current(t):ie.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[ae,oe,F,i]));let ce=E===`none`&&T!==`shift`,le=!ce&&(u||O||T===`shift`),ue=T===`none`?null:Hs({...B,padding:{top:R.top+1+z,right:R.right+1+ne,bottom:R.bottom+1+ee,left:R.left+1+te},mainAxis:!O&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:D}),de=ce?null:Bs({...B,rootBoundary:k,mainAxis:E!==`none`,crossAxis:le,limiter:u||O?void 0:Vs(e=>{if(!V.current)return{};let{width:t,height:n}=V.current.getBoundingClientRect(),r=qi(Ui(e.placement)),i=r===`y`?t:n,a=r===`y`?R.left+R.right:R.top+R.bottom;return{offset:i/2+a/2}})},[B,u,O,k,R,E]);T===`shift`||E===`shift`||o===`center`?se.push(de,ue):se.push(ue,de),se.push(Us({...B,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(Al,`${t}px`),i.setProperty(jl,`${n}px`);let a=q(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),Dl(e=>({element:V.current||Ai(e.elements.floating).createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:r,rects:o,y:s}=e,c=Ui(r),l=qi(c),u=V.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof a==`function`?a(Nl(e,i,F)):a,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,le&&l===`y`&&b?S:x),{}}},Ol,b),K(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let fe=H.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:pe,elements:me,x:he,y:ge,middlewareData:_e,update:ve,placement:ye,context:be,isPositioned:xe,floatingStyles:Se}=t({rootContext:h,open:m?g:void 0,placement:L,middleware:se,strategy:r,whileElementsMounted:m?void 0:(...e)=>Es(...e,fe),nodeId:y,externalTree:S}),{sideX:Ce,sideY:we}=_e.adaptiveOrigin||kl,Te=xe?r:`fixed`,Ee=H.useMemo(()=>{let e;return e=xe?b?{position:Te,[Ce]:he,[we]:ge}:{...Se,position:Te}:{position:Te,top:0,left:0},e[Al]=`100vw`,e[jl]=`100vh`,xe||(e.opacity=0),e},[b,Te,Ce,he,we,ge,Se,xe]),De=H.useRef(null);K(()=>{if(!g)return;let e=N.current,t=typeof e==`function`?e():e,n=(Il(t)?t.current:t)||null;n!==De.current&&(pe.setPositionReference(n),De.current=n)},[g,pe,M,N]),H.useEffect(()=>{if(!g)return;let e=N.current;typeof e!=`function`&&Il(e)&&e.current!==De.current&&(pe.setPositionReference(e.current),De.current=e.current)},[g,pe,M,N]),H.useEffect(()=>{if(m&&g&&me.reference&&me.floating)return Es(me.reference,me.floating,ve,fe)},[m,g,me,ve,fe]);let Oe=Ui(ye),ke=Ml(i,Oe,F),Ae=Wi(ye)||`center`,je=!!_e.hide?.referenceHidden;K(()=>{x&&g&&xe&&Oe!==I&&w(Oe)},[x,g,xe,Oe,I]);let Me=H.useMemo(()=>({position:`absolute`,top:_e.arrow?.y,left:_e.arrow?.x}),[_e.arrow]),U=_e.arrow?.centerOffset!==0;return H.useMemo(()=>({positionerStyles:Ee,arrowStyles:Me,arrowRef:V,arrowUncentered:U,side:ke,align:Ae,physicalSide:Oe,anchorHidden:je,refs:pe,context:be,isPositioned:xe,update:ve}),[Ee,Me,V,U,ke,Ae,Oe,je,pe,be,xe,ve])}function Il(e){return e!=null&&`current`in e}function Ll(e){return e===`starting`?yo:G}function Rl(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),po(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Ll(r),i],stateAttributesMapping:ll})}var zl=H.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=So,style:g,..._}=e,v=Nn(),y=yl(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=Pl({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`adaptiveOrigin`)}),O=Rl(e,H.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),{styles:D.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,U.jsx)(Sl.Provider,{value:D,children:O})}),Bl=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Nn(),{side:s,align:c}=Cl(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);nc({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),Ic(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return po(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[rc,f,Ll(d),a],stateAttributesMapping:ul})}),Vl=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Nn(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=Cl();return po(`div`,e,{state:{open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)},ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:ll})}),Hl=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=H.useMemo(()=>({open:t,close:n}),[t,n]);return(0,U.jsx)(fl.Provider,{value:t,children:(0,U.jsx)(ui,{delay:i,timeoutMs:r,children:e.children})})},Ul=48,Wl=(e,t=0)=>{let n=new Int32Array(e.length);for(let r=0;r{let t=new Int32Array(e.length+1);for(let n=0;n{let t=new Int32Array(e.length),n=0;for(let r=0;r>>1^-(i&1),t[r]=n}return t},ql=379,Jl=[],Yl=Gl(Wl(`E050000200528200000000200015000002002182000001120000000302220200020004200120000200420001200021200301200010400162000010000220021010:2192001200220012000220012000200200200400010200040000000000400200108200110100000022010313000162002000020020012020080213000228200000000082000000000120002000120020020040101020300130001001010`)),Xl=Gl(Wl(`:11111111211111119311546544411119731869:67139741568643244111111111116111415121431343415:78311132233313187211117221449443411141111151152226611131111112212518142224214215421421542142424242516171151615616347111111111197911327451111111111111111111113134714133513411111311111111111111111111112444411111342312715245411117:3`)),Zl=`@containerabcdefghinlmoprstunderlineviawzccentlignnimatespectuto-colsrowsaglorightnessckdrop-sisbcontrastfiltergrayscalehue-rotateinvertopacityslurrightnessaturateepia-coniclinearpositionradialsizeockurrderttom-belrstxyespacing-xyaretoursorlnt-umnsendspantartentrasteividerop-shadowurationcorationlay-xyasendillexontromlter-featuresstretchapr-xyayscaleidow-colsrowsue-rotatedentlinesetvert-beringsxyeshadoweiadingftnest-clamp-imageabein-lrstxyskx--b-coniclpositionrsizet-x-y-fromto-fromto-inearfromto-fromto-adialfromto-fromtofromtofromtofromtoblockhinlinew-screenesblockhinlinewbjectpacityrutlinederigin-offsetbelrstxyesrspective-originaceholderioghtng-offsettateundedw-xyz-belrstlreseslr-endspantartaturatecepiahizekewpace-taleroll-xyz-barmpbelrstxyesbelrstxyes-thumbrackadowrink-xyxyartrokeabextora-shadowpckingnsformitionlate-xyz-offsetill-changeoom`,Ql=(()=>{let e=Yl.length-1,t=new Int32Array(e);for(let n=e-1;n>=0;n--){let e=1,r=n+1;for(let i=Yl[n];iE?F@03263243255B:032325523853:0325B:8GA032542HE?3257D>03258432585:0325B:;0328B:032`),nu=Wl(`01211311455155555567811194::::::::;;;:::952888<151=52>>?51921@ABCD;;;588595;9999:9?995;9E11;FGGHGGGGHGG1GG1GG1GGGGGG999IJ;;;;999I;;;;;;1581:5;;;;;11;2;;;;;9:K555544444444444444488855555;;;;;;;;;;;;;;;;;;;;;;225?59555;;L8M?D911199995DI188`),ru=Kl(`0202002020200202020020020020200200200200200200200002020202001003040106000200200200200200200200200200200200200200200200200200200200200200200200200200200200020020020020020020002020020200200200200200200200200200202000200202002020022020020020020020020020020020020002002002000200020002000200200200020020020002000200200200020020202002020202000200200020022000200200020020002002000200220002002000200W0Z00020020002002020002002000200g0j00020020002002000200200020020002002000200200020002000200000200200200200200020002000200002002002002002002002020020020200200200200200200200200202020020020020020020020020002002002020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020002002002002002002000200200200200200200200200200020202020002000200020002002002002000020200200`),iu=(()=>{let e=new Int32Array(318).fill(-1),t=Kl(`02422242:22222224222422224244222222242222224444224226224222426222422442462222422622222222626222462242622422622422424242422222222422222222242422222222222222222622442224222222222222224424442262222222222222222222226224222424242422224422422422222`),n=Kl(`0222222222222222222220222222222222222222222222142222222222222222222222222222222222Y\\222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221422222222222222222222222222222222222222Ŀł222222222222222222`);for(let r=0;r