@lunora/studio 1.0.0-alpha.24 → 1.0.0-alpha.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1323,7 +1323,7 @@ declare const useDebounced: <T>(value: T, delayMs?: number) => T;
1323
1323
  * sibling catalog (for example `de.ts`) mapping each id to its translation and
1324
1324
  * register it via `createStudioI18n(locale, { en: enMessages, de: deMessages })`.
1325
1325
  */
1326
- declare const MESSAGE_IDS: readonly ["Lunora AI rules aren't installed.", "lets your coding agent use Lunora correctly.", "Dismiss", ", changed", "(no subject)", "(root)", "{count} active", "{count} calls", "{count} failed", "{total} total", "No subscriptions yet", "Payments", "Plan", "Provider", "Recent webhook events", "Renews", "State", "Subscriptions", "Synced customers, subscriptions, and webhook events.", "{count} messages", "{count} pending changes", "{count} running", "{name} ({rowCount})", "{rangeStart}-{rangeEnd} of {total}", "{rate} ({count} entries)", "{reachable} reachable", "{reachable} reachable, {failed} unreachable", "{status} — processed", "{title} failed", "Actions", "Actions have no React hook — call them through the client.", "Add a widget to chart a saved SQL query on this browser.", "Add index on {table}", "Add row", "Add widget", "admin token", "Aggregating…", "all", "All shards", "API", "API reference unavailable", "API resources", "API usage snippets", "API view", "Arguments", "Auth", "Auth failures", "Auth failures over time", "Cache hit rate", "Call this {kind} from your app.", "Cancel", "Cancel job?", "Cc", "changed", "Chart widgets backed by saved read-only SQL queries.", "Lunora surfaces slow functions, error spikes, and cache problems here.", "Clear", "Clear inbox", "Columns unavailable", "CLI", "Client", "collecting samples…", "Combined cache hit rate", "Commit", "Committing…", "Breadcrumb", "Confirm", "Connect", "Connect to Lunora Studio", "Connected", "Connecting…", "Enter your admin token to access the studio.", "From your worker's LUNORA_ADMIN_TOKEN — your project's .dev.vars in dev, or a deployment secret in production.", "Local", "Not connected", "content-type", "Copy", "Copy link", "Copy-paste snippets for calling your functions and tables.", "created", "Cron triggers", "Dashboards", "Data", "Data migrations you run against this shard will be tracked here.", "Data model", "Database", "Database size", "db size", "Delete", "Delete saved query {name}", "Delete?", "direction", "Direction", "Discard", "down", "Dry run", "Dry run: ", "Edit", "Edit widget", "email", "Email preview", "Email your app sends in dev is captured here — nothing is delivered.", "Email your app sent, captured in dev.", "Enter a migration id", "error", "Error rate", "errors", "Errors", "Errors over time", "expires", "Export", "PNG", "SVG", "Export / Import", "Exported {count} rows.", "Facets", "file:function", "Files", "Filter messages", "Filter tables", "Find table…", "Foreign key", "From", "function", "Function", "Function path", "Functions", "Functions by error rate", "Graph", "Headers", "Health", "Indexes", "Hide", "HTML", "id", "Idle", "Import", "Import (writes rows)?", "Inserted {inserted}, {conflicts} conflicts, {errors} errors.", "Interactive OpenAPI reference and copy-paste snippets for your functions.", "Invalid JSON args: {message}", "Invalid JSON: {message}", "Invalid NDJSON: {message}", "ip", "Jobs queued with runAfter / runAt will appear here.", "JSON", "key", "Key prefix", "key prefix (optional)", "Level filter", "line {line} ({table}): {message}", "List", "Live", "Live — changes stream in automatically", "Live unavailable", "Live unavailable: {liveError}", "Live: on", "Load", "Load more", "Load tables", "Logic", "Logs", "Mail", "Mask sensitive columns", "Metrics", "migration id", "Migration id", "Migrations", "Missing index", "name", "Next", "no", "No active sessions.", "no cache configured", "No captured email.", "No cron triggers.", "No function activity yet.", "No functions or tables to document yet.", "No global tables.", "No headers.", "No HTML body.", "No logs.", "No migrations have run on this shard.", "No objects.", "No recent errors.", "No scheduled jobs.", "No tables to graph.", "No tables match your filter.", "No text body.", "No users.", "No widgets yet", "Objects you upload to your R2 buckets will appear here.", "Observability", "of {pages}", "off", "Offline", "ok", "OK", "on", "Open {target} {id}", "Open in new tab", "Outcome filter", "Page", "Plain text", "Prefill", "Previous", "Primary key", "processed", "React", "Read and write this table through the typed data model.", "Recent errors", "Recent logs", "Recently visited shards — click to switch", "Refresh", "Reload tables", "Remove widget", "RLS Policies", "Policies", "No policies defined", "No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows.", "Read", "Insert", "Update", "Guarded by", "Guarded", "Roles", "No roles defined", "No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks.", "Permissions", "Run as identity (userId)", "Leave empty to run as admin", "Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.", "as {userId}", "No policy", "Covered by {procedure}", "Uncovered — reachable without a policy", "Masked columns", "No tables in this deployment's schema.", "Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix.", "Pick a function and an identity, then run it to see the access outcome.", "Probe", "Probe this", "Run as (userId)", "Identity (userId) to run as", "Run probe", "Allowed", "Denied", "Probing…", "Set `runAsIdentity` to forge an identity and probe access.", "Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS.", "Inspect access policies per table, and probe a function as any identity.", "Scaffold access rules", "Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only.", "New policy file", "Wire into a procedure", "Policy name", "Create policy file", "Procedure file path", "Exported procedure", "Policy set identifier", "Wire RLS", "Creating…", "Wiring…", "Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.", "This change must be made by hand — the scaffolder only adds new, deny-by-default rules.", "requests", "Requests", "Requests / interval", "Requests over time", "Requests per interval over time", "Row actions", "Row document JSON", "Rows per page", "Run", "Run migration", "Run migration?", "Running…", "Query name", "Save", "Save query", "Save widget", "Saved", "schedule", "target", "workflow", "Run now", "Run now?", "Running…", "ran", "attempts", "backlog", "Dead letter", "Drop", "Drop job?", "in flight", "Jobs that exhaust their retry budget are parked here instead of being dropped.", "last tried", "max concurrency", "No dead-letter jobs.", "No workpools.", "pool", "Pools", "pools", "Pools created with createWorkpool appear here once they have activity.", "queued", "Retry", "Schedule view", "Scheduled", "scheduled for", "Scheduled jobs", "Scheduler backlog", "Schema", "Schema graph", "Schema view", "search message", "Search messages", "Search rows", "search table…", "Search…", "Select a function or table to see how to call it from your app.", "Select all rows", "Select row", "Send test", "Sent", "Service level", "Sessions", "Sessions for {userId}", "shard", "Shard", "Shard key", "shard key (optional)", "Shard key (optional)", "Shards", "Shards seen", "Signature", "size", "Snippet flavour", "State-changing admin operations are recorded here.", "status", "Storage", "Storage tier", "Storage tiers", "Studio", "Studio areas", "Studio failed", "Switch to dark theme", "Switch to light theme", "Table", "Table list", "Table touched", "Tables", "To", "Token rides the WebSocket URL — it can surface in browser DevTools and server logs. Use a dev-only token.", "Total database size", "Total errors", "Total requests", "Triggers declared with the cronJobs() builder appear here.", "Try again", "unreachable", "up", "updated", "Uptime", "user agent", "User id", "userId", "Users", "Users who sign up to your app will appear here.", "verified", "Widget title", "yes", "A live stream of recent function logs.", "Browse and edit rows across your shard and global tables.", "Browse auth users and their active sessions.", "Browse objects in your R2 storage buckets.", "Export a shard to NDJSON, or import rows from it.", "At-a-glance connection, error, and shard signals.", "Inspect and cancel scheduled jobs.", "Inspect each table and its columns.", "Inspect row-level-security policies and roles, per table.", "Per-shard health and aggregate metrics.", "Review migration status and run them.", "Run registered queries, mutations, and actions.", "Global tables (D1)", "Shard tables", "{shard} tables", "Tables marked .global() (D1-backed, region-replicated) will appear here.", "Select a table to browse its rows.", "Shared across every tenant, stored once in D1. Includes auth tables.", "Partitioned per shard key into separate Durable Objects — scoped to the shard above.", "avg", "calls", "conflicts", "kind", "last error", "last run", "max", "Most called", "No functions have run on this shard yet.", "Recent", "Slowest", "Insights", "Surface slow functions, error spikes, and cache problems.", "No issues detected.", "Low cache hit rate", "High cache eviction rate", "Slow function", "High error rate", "High write contention", "{rate} hit rate over recent traffic.", "{count} entries evicted recently.", "Slowest call took {duration}.", "Slowest call took {duration} — it full-scanned {tables} with no index.", "{rate} of calls failed.", "{rate} of calls hit a write conflict — consider sharding to cut contention.", "Home", "Reports", "SQL / Functions", "Table editor", "Connection, health, and advisor summary for your deployment.", "Collapse sidebar", "Expand sidebar", "SQL editor", "Run read-only SQL against a shard.", "Run", "SQL query", "{count} rows", "Showing the first {max} of {count} rows.", "Showing the {n} most common values.", "No rows returned.", "Private", "Reference", "Search queries…", "New query", "Untitled query", "Delete query", "No saved queries yet — they save to this browser as you type.", "Results", "Explain", "Chart", "History", "Format", "Clear history", "No numeric column to chart.", "Click Run to execute your query.", "Untitled", "New tab", "Close tab", "Tab title", "Double-click to rename", "Discard?", "Discard changes", "Keep editing", "Close other tabs", "Close tabs to the right", "Close all tabs", "Discard unsaved tabs?", "column", "keyword", "Columns", "Show all", "Hide all", "Transpose", "Swap rows and columns", "Field", "Row {n}", "Loading…", "No matching row.", "CSV", "{count} selected", "Delete {count}", "Delete {count} rows?", "Copy", "Copied", "Cell value", "Close", "Form", "Invalid JSON", "Command palette", "No results.", "Quick links", "Security findings", "Performance issues", "View", "All clear", "No data yet", "Get connected", "No issues found", "No security or performance issues detected.", "Client SDK", "React", "CLI", "Advisors", "Security", "Performance", "Warnings", "Info", "Issue type", "Entity/item", "Description", "{count} errors", "{count} warnings", "{count} suggestions", "No errors detected", "No warnings detected", "No suggestions", "Nothing to report for this deployment.", "Security and performance findings for your deployment.", "Review admin gates, credentials, and log redaction.", "Lunora checks admin-token strength, the live-subscription gate, and request-log redaction here.", "No security issues detected.", "Weak admin token", "Weak auth secret", "Session cookies are not Secure", "Wildcard CORS with credentials", "CSRF/origin guard is off", "Security headers are off", "Live admin subscriptions are ungated", "Request log keeps un-redacted args", "Unknown security finding", "Update your worker to a version of Lunora that describes this finding.", "Your admin token is {length} characters — use at least {min} for a brute-force-resistant secret.", "Your auth secret is {length} characters — use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.", "BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production.", "LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed — browsers reject this and it defeats the allowlist. Name explicit origins instead of *.", "LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable.", "LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production.", "Apply index", "Apply index on {table}", "Apply?", "CREATE INDEX SQL copied to clipboard.", "LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: live admin subscriptions need no credential. Set it to gate them like the HTTP admin RPCs.", "This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy.", "Audit", "A durable log of admin state-changing operations.", "Filter audit log", "filter op, table, id", "No audit entries.", "time", "op", "table", "detail", "Settings", "Deployment", "Read-only deployment config — vars, secrets, and bindings.", "Environment & bindings", "No environment variables or bindings.", "Open in Cloudflare", "Remove filter", "View-only — values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard.", "URL", "Environment", "Version", "value", "Cascade impact", "Delete preview — rows that would cascade or be blocked", "No related rows found.", "Restrict relations will block this delete.", "Generate rows", "Generate dummy rows", "Seed {table} with Faker-generated rows. Existing rows are not affected.", "Row count", "(max {max})", "Columns to seed", "FK: no rows in {ref} — will skip", "→ {ref}", "No rows generated — all columns were skipped.", "Inserted {count} rows. Skipped FK columns: {cols}", "Inserted {count} rows successfully.", "Generate & insert", "Inserting…", "Time Travel", "Restore a shard to a point in the last 30 days.", "root", "In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier.", "Current bookmark", "Restore", "Time (ISO or epoch-ms, last 30 days)", "Preview", "Bookmark for that time", "Or an explicit bookmark (wins over time)", "bookmark string", "Restart the shard now so recovery applies immediately", "Confirm restore", "restarted now", "on next restart", "Restore armed", "Restored to", "Undo bookmark", "Confirm undo", "Undo restore", "role", "Role", "Role (optional)", "Active", "Banned", "unverified", "Manage", "New user", "Create", "Create user", "Creating…", "Password (optional)", "Search users", "Search by email or name…", "Filter by role", "Set role", "Ban user", "Ban reason (optional)", "Days", "Unban", "New password", "Set password", "Impersonate", "Impersonation token", "Revoke", "Revoke all sessions", "Delete user", "Confirm delete", "User details", "Fields", "Linked accounts", "No linked accounts.", "provider", "Unlink", "Security", "Disable two-factor", "No passkeys.", "Operations", "Organizations", "slug", "Members", "Invitations", "Remove", "No organizations.", "Select an organization to view its members and invitations.", "Organizations are not enabled.", "Enable the organization() plugin in your auth config to manage organizations here.", "Browse and manage organizations, members, and invitations.", "Reload", "Manage auth users — roles, bans, sessions, and identity.", "Auth config", "Configuration", "Enabled plugins and session config (read-only).", "Enabled capabilities", "Loading auth configuration…", "Accounts", "Admin", "Passkeys", "Two-factor", "Enabled", "Disabled", "OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.", "Sessions", "Browse and revoke active sessions across all users.", "user", "impersonated by", "Log drains", "Forward logs to Logpush, Tail Workers, or a webhook collector.", "Cloudflare destinations", "Lunora does not ship logs itself — forwarding is handled by Cloudflare. Configure a destination below, then test your collector.", "Logpush", "Stream every request log to R2, a SIEM, or a third-party log service.", "Tail Workers", "Send logs programmatically to a Worker for custom capture and forwarding.", "Workers Logs", "Retain and query recent request logs directly in Cloudflare's dashboard.", "Webhook test", "POST a sample Lunora request-log envelope to your collector to confirm it is reachable.", "https://example.com/logs", "Send test event", "Delivered — status {status} in {latency}ms", "Failed: {message}", "fetch is unavailable in this environment.", "Realtime", "Active WebSocket subscriptions on this shard.", "{count} connections", "{count} subscriptions", "No active subscriptions.", "Connection", "admin", "Folder path", "Grid", "Sort", "Name", "Type", "Modified", "Toggle sort direction", "Thumbnail size", "Link expiry", "15m", "1h", "24h", "7d", "Upload", "Uploading…", "Copy URL", "Download", "Delete object?", "Uploaded {key}", "Deleted {key}", "Summary", "Time range", "All time", "Last 5m", "Last 15m", "Last hour", "filter path", "By level", "By function", "Count", "{count} entries", "Snippets", "Couldn't load the OpenAPI spec: {message}", "No OpenAPI spec configured", "Run `lunora codegen` and wire `_generated/openapi.json` to the worker to render the API reference here.", "API operations", "Filter operations", "No operations match your filter.", "Try it", "Request arguments", "Response body", "Response", "application/json", "Arguments (JSON)", "Send", "Sending…", "Send a request to see the response.", "No example for this response.", "Error", "{ms} ms", "Range", "Value in", "relation", "API spec format", "OpenAPI", "OpenRPC", "Params", "Result", "Field", "Required", "JSON-RPC request", "Couldn't load the OpenRPC spec: {message}", "No OpenRPC spec configured", "Run `lunora codegen --api-spec openrpc` and wire `_generated/openrpc.json` to the worker to render the OpenRPC reference here.", "used by", "Orphan", "1 record", "{count} records", "References shard", "Which shard's records are checked for references to these files. Empty = root shard.", "Orphaned objects", "Find records whose file reference points at an object the bucket no longer has.", "Check for orphans", "Checking…", "No dangling references.", "Every record's file reference points at an object that exists in the bucket.", "Missing object", "→", "Showing the first {count} dangling references — the scan was truncated.", "Per-function call counts, error rates, and latency land here after your first request.", "Function and request logs for this shard show up here as your app handles traffic.", "No tables in this shard.", "Browse Vectorize indexes and run similarity searches.", "dimensions", "field", "Indexes declared with .vectorize() or defineVectorIndex() appear here.", "metadata", "metric", "No matches.", "No vector indexes.", "score", "Search", "Search by similarity…", "Searching…", "vectors", "Vectors", "vs. prev.", "Top functions", "No functions called yet.", "Calls", "Avg", "Err", "Avg latency", "cache hit", "Live connections", "sockets", "active subscriptions", "Recent activity", "No recent activity.", "last interval", "{rate} error rate", "cache entries", "Critical", "Degraded", "All systems healthy", "One or more service levels are breached.", "Some service levels need attention.", "All service levels are within target.", "Analytics", "Analytics is not configured.", "Hot shards", "Latency p50 / p95 per function", "No data points yet.", "Request volume per function", "Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (Analytics Read) in your .dev.vars to enable usage panels.", "Usage and latency from Analytics Engine — request volume, p50/p95, and hot shards.", "(whole bucket)", "Access Rules", "Bucket", "Inspect storage access rules — per bucket, operation, and key prefix.", "No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix.", "No storage rules defined", "Operation", "Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only.", "Write", "Queues", "Queue", "Mode", "Dead-letter", "No queues defined", "Inspect declared Cloudflare Queues — their producer bindings, consumer mode, and dead-letter queue.", "No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue.", "Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker.", "Flags", "Inspect feature flags and their live evaluation under a targeting context.", "Feature flags are read in code with ctx.flags.<type>(\"key\", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.", "Targeting context (JSON)", "Targeting context must be a JSON object.", "Targeting context is not valid JSON.", "Live updates unavailable; showing the last evaluation.", "No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags.", "No flags provider configured", "A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean(\"key\", false) in a query, mutation, or action.", "No flags read", "Key", "Value", "Reason", "Variant", "Workflows", "Inspect declared Cloudflare Workflows and their bindings.", "Binding", "Class", "No workflows defined", "No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow.", "Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. This view is read-only.", "Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.", "Start instance", "Starting…", "Workflow", "Instance id", "Instance id (optional)", "Params (JSON)", "Params (JSON, optional)", "Params must be valid JSON", "Instances", "Status", "Output", "Refresh", "Refreshing…", "Instance history", "Filter by status", "All statuses", "Workflow inspection not configured", "Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history.", "No instances", "No instances match this filter for the selected workflow.", "Created", "Ended", "Steps", "Step", "Attempts", "Started", "This instance has no recorded steps yet.", "pause", "resume", "terminate", ">100ms avg execution", "50–100ms avg execution", "<50ms avg execution", "{count} tracked statements", "Avg time", "avg", "avg time", "avgTime", "Critical queries", "Exec count", "exec count", "execCount", "Execution count", "Fast queries", "Full statement", "Moderate queries", "No query insights yet", "Overview", "P90 latency", "P95 latency", "Query insights", "Query insights appear once statements are executed against this shard.", "Query leaderboard", "Rows read", "Rows written", "rowsRead", "Slow queries sorted by {sortField}", "Sort by", "Sort queries by", "Statements", "total", "Total time", "total time", "totalTime", "Edit schema", "Add table", "Add column", "Add index", "Rename / drop / change type…", "Table name", "Column name", "Column type", "Index name", "Index fields (comma-separated)", "Optional", "Unique", "Cancel", "Apply", "Applying…", "This edit changes stored data and must go through a migration. Review the migration before applying.", "Open Migrations", "Schema updated.", "Codegen reported diagnostics:", "Editing the schema is only available in local dev.", "Adds a table, column, or index to lunora/schema.ts and reruns codegen.", "Theme", "Dark theme", "Light theme", "System theme", "Integrity", "Fan-out", "auto-scaled: {relayCount}/{maxRelays} relays", "Realtime fan-out cost and per-topic subscriber counts for this shard.", "No fan-out activity yet.", "peak {count} subscribers", "Hot topics", "Topic", "Kind", "Subscribers", "Fan-out cost since this instance woke", "Shape pokes", "Whisper broadcasts", "Passes", "Sockets iterated", "Delivered", "Peak width", "Max time"];
1326
+ declare const MESSAGE_IDS: readonly ["Lunora AI rules aren't installed.", "lets your coding agent use Lunora correctly.", "Dismiss", ", changed", "(no subject)", "(root)", "{count} active", "{count} calls", "{count} failed", "{total} total", "No subscriptions yet", "Payments", "Plan", "Provider", "Recent webhook events", "Renews", "State", "Subscriptions", "Synced customers, subscriptions, and webhook events.", "{count} messages", "{count} pending changes", "{count} running", "{name} ({rowCount})", "{rangeStart}-{rangeEnd} of {total}", "{rate} ({count} entries)", "{reachable} reachable", "{reachable} reachable, {failed} unreachable", "{status} — processed", "{title} failed", "Actions", "Actions have no React hook — call them through the client.", "Add a widget to chart a saved SQL query on this browser.", "Add index on {table}", "Add row", "Add widget", "admin token", "Aggregating…", "all", "All shards", "API", "API reference unavailable", "API resources", "API usage snippets", "API view", "Arguments", "Auth", "Auth failures", "Auth failures over time", "Cache hit rate", "Call this {kind} from your app.", "Cancel", "Cancel job?", "Cc", "changed", "Chart widgets backed by saved read-only SQL queries.", "Lunora surfaces slow functions, error spikes, and cache problems here.", "Clear", "Clear inbox", "Columns unavailable", "CLI", "Client", "collecting samples…", "Combined cache hit rate", "Commit", "Committing…", "Breadcrumb", "Confirm", "Connect", "Connect to Lunora Studio", "Connected", "Connecting…", "Enter your admin token to access the studio.", "From your worker's LUNORA_ADMIN_TOKEN — your project's .dev.vars in dev, or a deployment secret in production.", "Local", "Not connected", "content-type", "Copy", "Copy link", "Copy-paste snippets for calling your functions and tables.", "created", "Cron triggers", "Dashboards", "Data", "Data migrations you run against this shard will be tracked here.", "Data model", "Database", "Database size", "db size", "Delete", "Delete saved query {name}", "Delete?", "direction", "Direction", "Discard", "down", "Dry run", "Dry run: ", "Edit", "Edit widget", "email", "Email preview", "Email your app sends in dev is captured here — nothing is delivered.", "Email your app sent, captured in dev.", "Enter a migration id", "error", "Error rate", "errors", "Errors", "Errors over time", "expires", "Export", "PNG", "SVG", "Export / Import", "Exported {count} rows.", "Facets", "file:function", "Files", "Filter messages", "Filter tables", "Find table…", "Foreign key", "From", "function", "Function", "Function path", "Functions", "Functions by error rate", "Graph", "Headers", "Health", "Indexes", "Hide", "HTML", "id", "Idle", "Import", "Import (writes rows)?", "Inserted {inserted}, {conflicts} conflicts, {errors} errors.", "Interactive OpenAPI reference and copy-paste snippets for your functions.", "Invalid JSON args: {message}", "Invalid JSON: {message}", "Invalid NDJSON: {message}", "ip", "Jobs queued with runAfter / runAt will appear here.", "JSON", "key", "Key prefix", "key prefix (optional)", "Level filter", "line {line} ({table}): {message}", "List", "Live", "Live — changes stream in automatically", "Live unavailable", "Live unavailable: {liveError}", "Live: on", "Load", "Load more", "Load tables", "Logic", "Logs", "Mail", "Mask sensitive columns", "Metrics", "migration id", "Migration id", "Migrations", "Missing index", "name", "Next", "no", "No active sessions.", "no cache configured", "No captured email.", "No cron triggers.", "No function activity yet.", "No functions or tables to document yet.", "No global tables.", "No headers.", "No HTML body.", "No logs.", "No migrations have run on this shard.", "No objects.", "No recent errors.", "No scheduled jobs.", "No tables to graph.", "No tables match your filter.", "No text body.", "No users.", "No widgets yet", "Objects you upload to your R2 buckets will appear here.", "Observability", "of {pages}", "off", "Offline", "ok", "OK", "on", "Open {target} {id}", "Open in new tab", "Outcome filter", "Page", "Plain text", "Prefill", "Previous", "Primary key", "processed", "React", "Read and write this table through the typed data model.", "Recent errors", "Recent logs", "Recently visited shards — click to switch", "Refresh", "Reload tables", "Remove widget", "RLS Policies", "Policies", "No policies defined", "No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows.", "Read", "Insert", "Update", "Guarded by", "Guarded", "Roles", "No roles defined", "No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks.", "Permissions", "Run as identity (userId)", "Leave empty to run as admin", "Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.", "as {userId}", "No policy", "Covered by {procedure}", "Uncovered — reachable without a policy", "Masked columns", "No tables in this deployment's schema.", "Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix.", "Pick a function and an identity, then run it to see the access outcome.", "Probe", "Probe this", "Run as (userId)", "Identity (userId) to run as", "Run probe", "Allowed", "Denied", "Probing…", "Set `runAsIdentity` to forge an identity and probe access.", "Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS.", "Inspect access policies per table, and probe a function as any identity.", "Scaffold access rules", "Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only.", "New policy file", "Wire into a procedure", "Policy name", "Create policy file", "Procedure file path", "Exported procedure", "Policy set identifier", "Wire RLS", "Creating…", "Wiring…", "Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.", "This change must be made by hand — the scaffolder only adds new, deny-by-default rules.", "requests", "Requests", "Requests / interval", "Requests over time", "Requests per interval over time", "Row actions", "Row document JSON", "Rows per page", "Run", "Run migration", "Run migration?", "Running…", "Query name", "Save", "Save query", "Save widget", "Saved", "schedule", "target", "workflow", "Run now", "Run now?", "Running…", "ran", "attempts", "backlog", "Dead letter", "Drop", "Drop job?", "in flight", "Jobs that exhaust their retry budget are parked here instead of being dropped.", "last tried", "max concurrency", "No dead-letter jobs.", "No workpools.", "pool", "Pools", "pools", "Pools created with createWorkpool appear here once they have activity.", "queued", "Retry", "Schedule view", "Scheduled", "scheduled for", "Scheduled jobs", "Scheduler backlog", "Schema", "Schema graph", "Schema view", "search message", "Search messages", "Search rows", "search table…", "Search…", "Select a function or table to see how to call it from your app.", "Select all rows", "Select row", "Send test", "Sent", "Service level", "Sessions", "Sessions for {userId}", "shard", "Shard", "Shard key", "shard key (optional)", "Shard key (optional)", "Shards", "Shards seen", "Signature", "size", "Snippet flavour", "State-changing admin operations are recorded here.", "status", "Storage", "Storage tier", "Storage tiers", "Studio", "Studio areas", "Studio failed", "Switch to dark theme", "Switch to light theme", "Table", "Table list", "Table touched", "Tables", "To", "Token rides the WebSocket URL — it can surface in browser DevTools and server logs. Use a dev-only token.", "Total database size", "Total errors", "Total requests", "Triggers declared with the cronJobs() builder appear here.", "Try again", "unreachable", "up", "updated", "Uptime", "user agent", "User id", "userId", "Users", "Users who sign up to your app will appear here.", "verified", "Widget title", "yes", "A live stream of recent function logs.", "Browse and edit rows across your shard and global tables.", "Browse auth users and their active sessions.", "Browse objects in your R2 storage buckets.", "Export a shard to NDJSON, or import rows from it.", "At-a-glance connection, error, and shard signals.", "Inspect and cancel scheduled jobs.", "Inspect each table and its columns.", "Inspect row-level-security policies and roles, per table.", "Per-shard health and aggregate metrics.", "Review migration status and run them.", "Run registered queries, mutations, and actions.", "Global tables (D1)", "Shard tables", "{shard} tables", "Tables marked .global() (D1-backed, region-replicated) will appear here.", "Select a table to browse its rows.", "Shared across every tenant, stored once in D1. Includes auth tables.", "Partitioned per shard key into separate Durable Objects — scoped to the shard above.", "avg", "calls", "conflicts", "kind", "last error", "last run", "max", "Most called", "No functions have run on this shard yet.", "Recent", "Slowest", "Insights", "Surface slow functions, error spikes, and cache problems.", "No issues detected.", "Low cache hit rate", "High cache eviction rate", "Slow function", "High error rate", "High write contention", "{rate} hit rate over recent traffic.", "{count} entries evicted recently.", "Slowest call took {duration}.", "Slowest call took {duration} — it full-scanned {tables} with no index.", "{rate} of calls failed.", "{rate} of calls hit a write conflict — consider sharding to cut contention.", "Home", "Reports", "SQL / Functions", "Table editor", "Connection, health, and advisor summary for your deployment.", "Collapse sidebar", "Expand sidebar", "SQL editor", "Run read-only SQL against a shard.", "Run", "SQL query", "{count} rows", "Showing the first {max} of {count} rows.", "Showing the {n} most common values.", "No rows returned.", "Private", "Reference", "Search queries…", "New query", "Untitled query", "Delete query", "No saved queries yet — they save to this browser as you type.", "Results", "Explain", "Chart", "History", "Format", "Clear history", "No numeric column to chart.", "Click Run to execute your query.", "Untitled", "New tab", "Close tab", "Tab title", "Double-click to rename", "Discard?", "Discard changes", "Keep editing", "Close other tabs", "Close tabs to the right", "Close all tabs", "Discard unsaved tabs?", "column", "keyword", "Columns", "Show all", "Hide all", "Transpose", "Swap rows and columns", "Field", "Row {n}", "Loading…", "No matching row.", "CSV", "{count} selected", "Delete {count}", "Delete {count} rows?", "Copy", "Copied", "Cell value", "Close", "Form", "Invalid JSON", "Command palette", "No results.", "Quick links", "Security findings", "Performance issues", "View", "All clear", "No data yet", "Get connected", "No issues found", "No security or performance issues detected.", "Client SDK", "React", "CLI", "Advisors", "Security", "Performance", "Warnings", "Info", "Issue type", "Entity/item", "Description", "{count} errors", "{count} warnings", "{count} suggestions", "No errors detected", "No warnings detected", "No suggestions", "Nothing to report for this deployment.", "Security and performance findings for your deployment.", "Review admin gates, credentials, and log redaction.", "Lunora checks admin-token strength, the live-subscription gate, and request-log redaction here.", "No security issues detected.", "Weak admin token", "Weak auth secret", "Session cookies are not Secure", "Wildcard CORS with credentials", "CSRF/origin guard is off", "Security headers are off", "Live admin subscriptions are ungated", "Request log keeps un-redacted args", "Unknown security finding", "Update your worker to a version of Lunora that describes this finding.", "Your admin token is {length} characters — use at least {min} for a brute-force-resistant secret.", "Your auth secret is {length} characters — use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.", "BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production.", "LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed — browsers reject this and it defeats the allowlist. Name explicit origins instead of *.", "LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable.", "LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production.", "Apply index", "Apply index on {table}", "Apply?", "CREATE INDEX SQL copied to clipboard.", "LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: live admin subscriptions need no credential. Set it to gate them like the HTTP admin RPCs.", "This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy.", "Audit", "A durable log of admin state-changing operations.", "Filter audit log", "filter op, table, id", "No audit entries.", "time", "op", "table", "detail", "Settings", "Deployment", "Read-only deployment config — vars, secrets, and bindings.", "Environment & bindings", "No environment variables or bindings.", "Open in Cloudflare", "Remove filter", "View-only — values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard.", "URL", "Environment", "Version", "value", "Cascade impact", "Delete preview — rows that would cascade or be blocked", "No related rows found.", "Restrict relations will block this delete.", "Generate rows", "Generate dummy rows", "Seed {table} with Faker-generated rows. Existing rows are not affected.", "Row count", "(max {max})", "Columns to seed", "FK: no rows in {ref} — will skip", "→ {ref}", "No rows generated — all columns were skipped.", "Inserted {count} rows. Skipped FK columns: {cols}", "Inserted {count} rows successfully.", "Generate & insert", "Inserting…", "Time Travel", "Restore a shard to a point in the last 30 days.", "root", "In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier.", "Current bookmark", "Restore", "Time (ISO or epoch-ms, last 30 days)", "Preview", "Bookmark for that time", "Or an explicit bookmark (wins over time)", "bookmark string", "Restart the shard now so recovery applies immediately", "Confirm restore", "restarted now", "on next restart", "Restore armed", "Restored to", "Undo bookmark", "Confirm undo", "Undo restore", "role", "Role", "Role (optional)", "Active", "Banned", "unverified", "Manage", "New user", "Create", "Create user", "Creating…", "Password (optional)", "Search users", "Search by email or name…", "Filter by role", "Set role", "Ban user", "Ban reason (optional)", "Days", "Unban", "New password", "Set password", "Impersonate", "Impersonation token", "Revoke", "Revoke all sessions", "Delete user", "Confirm delete", "User details", "Fields", "Linked accounts", "No linked accounts.", "provider", "Unlink", "Security", "Disable two-factor", "No passkeys.", "Operations", "Organizations", "slug", "Members", "Invitations", "Remove", "No organizations.", "Select an organization to view its members and invitations.", "Organizations are not enabled.", "Enable the organization() plugin in your auth config to manage organizations here.", "Browse and manage organizations, members, and invitations.", "Reload", "Manage auth users — roles, bans, sessions, and identity.", "Auth config", "Configuration", "Enabled plugins and session config (read-only).", "Enabled capabilities", "Loading auth configuration…", "Accounts", "Admin", "Passkeys", "Two-factor", "Enabled", "Disabled", "OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.", "Sessions", "Browse and revoke active sessions across all users.", "user", "impersonated by", "Log drains", "Forward logs to Logpush, Tail Workers, or a webhook collector.", "Cloudflare destinations", "Lunora does not ship logs itself — forwarding is handled by Cloudflare. Configure a destination below, then test your collector.", "Logpush", "Stream every request log to R2, a SIEM, or a third-party log service.", "Tail Workers", "Send logs programmatically to a Worker for custom capture and forwarding.", "Workers Logs", "Retain and query recent request logs directly in Cloudflare's dashboard.", "Webhook test", "POST a sample Lunora request-log envelope to your collector to confirm it is reachable.", "https://example.com/logs", "Send test event", "Delivered — status {status} in {latency}ms", "Failed: {message}", "fetch is unavailable in this environment.", "Realtime", "Active WebSocket subscriptions on this shard.", "{count} connections", "{count} subscriptions", "No active subscriptions.", "Connection", "admin", "Folder path", "Grid", "Sort", "Name", "Type", "Modified", "Toggle sort direction", "Thumbnail size", "Link expiry", "15m", "1h", "24h", "7d", "Upload", "Uploading…", "Copy URL", "Download", "Delete object?", "Uploaded {key}", "Deleted {key}", "Summary", "Time range", "All time", "Last 5m", "Last 15m", "Last hour", "filter path", "By level", "By function", "Count", "{count} entries", "Snippets", "Couldn't load the OpenAPI spec: {message}", "No OpenAPI spec configured", "Run `lunora codegen` and wire `_generated/openapi.json` to the worker to render the API reference here.", "API operations", "Filter operations", "No operations match your filter.", "Try it", "Request arguments", "Response body", "Response", "application/json", "Arguments (JSON)", "Send", "Sending…", "Send a request to see the response.", "No example for this response.", "Error", "{ms} ms", "Range", "Value in", "relation", "API spec format", "OpenAPI", "OpenRPC", "Params", "Result", "Field", "Required", "JSON-RPC request", "Couldn't load the OpenRPC spec: {message}", "No OpenRPC spec configured", "Run `lunora codegen --api-spec openrpc` and wire `_generated/openrpc.json` to the worker to render the OpenRPC reference here.", "used by", "Orphan", "1 record", "{count} records", "References shard", "Which shard's records are checked for references to these files. Empty = root shard.", "Orphaned objects", "Find records whose file reference points at an object the bucket no longer has.", "Check for orphans", "Checking…", "No dangling references.", "Every record's file reference points at an object that exists in the bucket.", "Missing object", "→", "Showing the first {count} dangling references — the scan was truncated.", "Per-function call counts, error rates, and latency land here after your first request.", "Function and request logs for this shard show up here as your app handles traffic.", "No tables in this shard.", "Browse Vectorize indexes and run similarity searches.", "dimensions", "field", "Indexes declared with .vectorize() or defineVectorIndex() appear here.", "metadata", "metric", "No matches.", "No vector indexes.", "score", "Search", "Search by similarity…", "Searching…", "vectors", "Vectors", "vs. prev.", "Top functions", "No functions called yet.", "Calls", "Avg", "Err", "Avg latency", "cache hit", "Live connections", "sockets", "active subscriptions", "Recent activity", "No recent activity.", "last interval", "{rate} error rate", "cache entries", "Critical", "Degraded", "All systems healthy", "One or more service levels are breached.", "Some service levels need attention.", "All service levels are within target.", "Analytics", "Analytics is not configured.", "Hot shards", "Latency p50 / p95 per function", "No data points yet.", "Request volume per function", "Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (Analytics Read) in your .dev.vars to enable usage panels.", "Usage and latency from Analytics Engine — request volume, p50/p95, and hot shards.", "(whole bucket)", "Access Rules", "Bucket", "Inspect storage access rules — per bucket, operation, and key prefix.", "No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix.", "No storage rules defined", "Operation", "Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only.", "Write", "Queues", "Queue", "Mode", "Dead-letter", "No queues defined", "Inspect declared Cloudflare Queues — their producer bindings, consumer mode, and dead-letter queue.", "No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue.", "Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker.", "Flags", "Inspect feature flags and their live evaluation under a targeting context.", "Feature flags are read in code with ctx.flags.<type>(\"key\", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.", "Targeting context (JSON)", "Targeting context must be a JSON object.", "Targeting context is not valid JSON.", "Live updates unavailable; showing the last evaluation.", "No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags.", "No flags provider configured", "A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean(\"key\", false) in a query, mutation, or action.", "No flags read", "Key", "Value", "Reason", "Variant", "Workflows", "Inspect declared Cloudflare Workflows and their bindings.", "Binding", "Class", "No workflows defined", "No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow.", "Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. This view is read-only.", "Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.", "Start instance", "Starting…", "Workflow", "Instance id", "Instance id (optional)", "Params (JSON)", "Params (JSON, optional)", "Params must be valid JSON", "Instances", "Status", "Output", "Refresh", "Refreshing…", "Instance history", "Filter by status", "All statuses", "Workflow inspection not configured", "Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history.", "No instances", "No instances match this filter for the selected workflow.", "Created", "Ended", "Steps", "Step", "Attempts", "Started", "This instance has no recorded steps yet.", "pause", "resume", "terminate", ">100ms avg execution", "50–100ms avg execution", "<50ms avg execution", "{count} tracked statements", "Avg time", "avg", "avg time", "avgTime", "Critical queries", "Exec count", "exec count", "execCount", "Execution count", "Fast queries", "Full statement", "Moderate queries", "No query insights yet", "Overview", "P90 latency", "P95 latency", "Query insights", "Query insights appear once statements are executed against this shard.", "Query leaderboard", "Rows read", "Rows written", "rowsRead", "Slow queries sorted by {sortField}", "Sort by", "Sort queries by", "Statements", "total", "Total time", "total time", "totalTime", "Edit schema", "Add table", "Add column", "Add index", "Rename / drop / change type…", "Table name", "Column name", "Column type", "Index name", "Index fields (comma-separated)", "Optional", "Unique", "Cancel", "Apply", "Applying…", "This edit changes stored data and must go through a migration. Review the migration before applying.", "Open Migrations", "Schema updated.", "Codegen reported diagnostics:", "Editing the schema is only available in local dev.", "Adds a table, column, or index to lunora/schema.ts and reruns codegen.", "Theme", "Dark theme", "Light theme", "System theme", "Integrity", "Fan-out", "auto-scaled: {relayCount}/{maxRelays} relays", "auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)", "Realtime fan-out cost and per-topic subscriber counts for this shard.", "No fan-out activity yet.", "peak {count} subscribers", "Hot topics", "Topic", "Kind", "Subscribers", "Fan-out cost since this instance woke", "Shape pokes", "Whisper broadcasts", "Passes", "Sockets iterated", "Delivered", "Peak width", "Max time"];
1327
1327
  /** A known studio message id — one of the entries in {@link MESSAGE_IDS}. */
1328
1328
  type MessageId = (typeof MESSAGE_IDS)[number];
1329
1329
  /**
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export { StudioApp } from './packem_shared/StudioApp-TEElspKL.js';
1
+ export { StudioApp } from './packem_shared/StudioApp-sRWTipvw.js';
2
2
  export { CommandPalette, openCommandPalette } from './packem_shared/CommandPalette-BtgkBzZI.js';
3
- export { S as Studio } from './packem_shared/studio-c5Vf7kSh.js';
3
+ export { S as Studio } from './packem_shared/studio-r7cJPJ__.js';
4
4
  export { ConfirmButton } from './packem_shared/ConfirmButton-C2eVi2Qv.js';
5
5
  export { default as ConnectionBadge } from './packem_shared/ConnectionBadge-B2DDM2Tn.js';
6
6
  export { ErrorBoundary } from './packem_shared/ErrorBoundary-BzAApI7J.js';
package/dist/mount.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createRoot } from 'react-dom/client';
2
- import { StudioApp } from './packem_shared/StudioApp-TEElspKL.js';
2
+ import { StudioApp } from './packem_shared/StudioApp-sRWTipvw.js';
3
3
  import { jsxDEV } from 'react/jsx-dev-runtime';
4
4
 
5
5
  const mountStudio = (options = {}) => {
@@ -1,7 +1,7 @@
1
1
  import 'react/compiler-runtime';
2
2
  import '@tanstack/react-router';
3
3
  import 'react';
4
- export { S as Studio } from './studio-c5Vf7kSh.js';
4
+ export { S as Studio } from './studio-r7cJPJ__.js';
5
5
  import './ErrorBoundary-BzAApI7J.js';
6
6
  import './badge-B2PKA1-5.js';
7
7
  import './input-XH4r1Pt1.js';
@@ -3,7 +3,7 @@ import { LunoraClient } from '@lunora/client';
3
3
  import { LunoraProvider } from '@lunora/react';
4
4
  import { useState, useEffect } from 'react';
5
5
  import { ErrorBoundary } from './ErrorBoundary-BzAApI7J.js';
6
- import { u as useTheme, B as BrandMark, T as ThemeProvider, a as TooltipProvider, S as Studio } from './studio-c5Vf7kSh.js';
6
+ import { u as useTheme, B as BrandMark, T as ThemeProvider, a as TooltipProvider, S as Studio } from './studio-r7cJPJ__.js';
7
7
  import useDebounced from './useDebounced-Dxncpg6z.js';
8
8
  import { useT, createStudioI18n } from './DEFAULT_LOCALE-CiX4W7Kr.js';
9
9
  import { StudioI18nProvider } from './StudioI18nProvider-B-tDCZIi.js';
@@ -8074,8 +8074,11 @@ const FanoutPanel = (t0) => {
8074
8074
  "data-testid": "fanout-count",
8075
8075
  children: [result.promoted && /* @__PURE__ */ jsxDEV(Badge, {
8076
8076
  "data-testid": "fanout-promoted",
8077
- variant: "default",
8078
- children: t("auto-scaled: {relayCount}/{maxRelays} relays", {
8077
+ variant: result.relayCount >= result.maxRelays ? "destructive" : "default",
8078
+ children: result.relayCount >= result.maxRelays ? t("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)", {
8079
+ maxRelays: result.maxRelays,
8080
+ relayCount: result.relayCount
8081
+ }) : t("auto-scaled: {relayCount}/{maxRelays} relays", {
8079
8082
  maxRelays: result.maxRelays,
8080
8083
  relayCount: result.relayCount
8081
8084
  })
@@ -375,4 +375,4 @@ ${t}`})),Wft=n(t=>{let e=[],r=t.replaceAll(/'(?:[^']|'')*'/gu,a=>(e.push(a),`${K
375
375
  `);if(Ce.length===0){V({});return}let Ye={current:!0};return ot((async()=>{try{let it=await o.query(IIt,{keys:Ce},lo(L));Ye.current&&(V(it.references??{}),N(Object.keys(it.storageColumns??{}).length>0))}catch{Ye.current&&(V({}),N(!1))}})()),()=>{Ye.current=!1}},[o,ue,L]);let he=n(Ce=>Ce.key,"keyOf"),{allSelected:Re,clear:Ae,selected:ye,someSelected:ge,toggle:Te,toggleAll:ze}=yIt(de,he),Ze=n(()=>{a(s),Ae(),ot(J(s,void 0,!1))},"listFirst"),_e=n(()=>{ot(J(r,D,!0))},"loadMore"),Ie=n(Ce=>{a(Ce),i(Ce),Ae(),ot(J(Ce,void 0,!1))},"navigate"),ke=n(Ce=>{Ie(`${r}${Ce}`)},"enterFolder"),Be=n(Ce=>se.signedUrl(Ce,{expiresInSeconds:wIt}),"resolveUrl"),Me=n(()=>{p("list")},"showList"),je=n(()=>{p("grid")},"showGrid"),mt=n(Ce=>{x(Ce)},"onSortKeyChange"),ht=n(()=>{b(Ce=>Ce==="asc"?"desc":"asc")},"toggleSortDirection"),yt=n(Ce=>{h(Ce)},"onThumbSizeChange"),Et=n(Ce=>{d(Ce)},"onExpiryChange"),St=n(()=>{F(void 0),E(!0),ot((async()=>{try{for(let Ce of ye)await se.remove(Ce);await J(r,void 0,!1),Ae()}catch(Ce){F(Jt(Ce))}finally{E(!1)}})())},"bulkDelete"),jt=n(Ce=>{F(void 0),ot((async()=>{try{let Ye=await se.signedUrl(Ce,{expiresInSeconds:c});await FIt(Ye),O(Ce)}catch(Ye){F(Jt(Ye))}})())},"onCopy"),At=n(Ce=>{F(void 0),ot((async()=>{try{let Ye=await se.signedUrl(Ce,{expiresInSeconds:c}),it=Ce.slice(Ce.lastIndexOf("/")+1)||Ce;CIt(Ye,it)}catch(Ye){F(Jt(Ye))}})())},"onDownload");(0,lr.useEffect)(()=>{if(k===void 0)return;let Ce=globalThis.setTimeout(()=>{O(void 0)},2e3);return()=>{globalThis.clearTimeout(Ce)}},[k]);let ee=n(Ce=>{F(void 0),E(!0),ot((async()=>{try{await se.remove(Ce),await J(r,void 0,!1)}catch(Ye){F(Jt(Ye))}finally{E(!1)}})())},"onDelete"),ce=n(Ce=>{let Ye=`${r}${Ce.name}`;F(void 0),E(!0),ot((async()=>{try{let it=await Ce.arrayBuffer();await se.upload({body:it,contentType:Ce.type===""?void 0:Ce.type,key:Ye}),await J(r,void 0,!1)}catch(it){F(Jt(it))}finally{E(!1)}})())},"onFile");(0,lr.useEffect)(()=>{B(void 0),Y(!1)},[L]);let Ee=n(()=>{F(void 0),q(!0),ot((async()=>{try{let Ce=[],Ye;do{let ft=await se.list({cursor:Ye,limit:SIt});for(let ct of ft.objects)Ce.push(ct.key);Ye=Ce.length>=pOe?void 0:ft.cursor}while(Ye!==void 0);if(Ce.length>=pOe)B([]),Y(!0);else{let ft=await o.query(bIt,{liveKeys:Ce},lo(L));B(ft.references??[]),Y(ft.truncated===!0)}}catch(Ce){B([]),Y(!1),F(Jt(Ce))}finally{q(!1)}})())},"checkOrphans"),Oe=n(Ce=>{ae(Ce),a(t??""),i(t??""),w(void 0),Ae()},"selectBucket");return{allSelected:Re,bucket:te,buckets:Q,bulkDelete:St,busy:T,checkOrphans:Ee,clearSelection:Ae,copiedKey:k,danglingBusy:z,danglingReferences:_,danglingTruncated:$,draftPrefix:s,enterFolder:ke,error:C,expiry:c,files:de,folders:le,hasObjects:S!==void 0&&S.length>0,hasStorageColumns:j,listFirst:Ze,loaded:S!==void 0,loadMore:_e,navigate:Ie,nextCursor:D,onCopy:jt,onDelete:ee,onDownload:At,onExpiryChange:Et,onFile:ce,onSortKeyChange:mt,onThumbSizeChange:yt,prefix:r,referenceShard:L,references:W,resolveUrl:Be,selectBucket:Oe,selected:ye,setDraftPrefix:i,setReferenceShard:U,showGrid:je,showList:Me,someSelected:ge,sortDirection:y,sortKey:v,tagKeys:ie,thumbSize:m,toggleSelect:Te,toggleSelectAll:ze,toggleSortDirection:ht,view:f}},"useFileBrowser"),EIt=100,mOe=n(t=>{let e=(0,Ja.c)(6),{label:o,onNavigate:r,target:a}=t,s;e[0]!==r||e[1]!==a?(s=n(()=>{r(a)},"t1"),e[0]=r,e[1]=a,e[2]=s):s=e[2];let i=s,c;return e[3]!==i||e[4]!==o?(c=(0,et.jsxDEV)("button",{className:"rounded px-1 text-muted-foreground outline-none hover:text-foreground focus-visible:text-foreground",onClick:i,type:"button",children:o},void 0,!1),e[3]=i,e[4]=o,e[5]=c):c=e[5],c},"Crumb"),AIt=n(t=>{let e=(0,Ja.c)(11),{onNavigate:o,prefix:r,t:a}=t,s;if(e[0]!==o||e[1]!==r||e[2]!==a){let i=r.split("/").filter(TIt),c;e[4]!==a?(c=a("Folder path"),e[4]=a,e[5]=c):c=e[5];let d;e[6]!==a?(d=a("root"),e[6]=a,e[7]=d):d=e[7];let f;e[8]!==o||e[9]!==d?(f=(0,et.jsxDEV)(mOe,{label:d,onNavigate:o,target:""},void 0,!1),e[8]=o,e[9]=d,e[10]=f):f=e[10],s=(0,et.jsxDEV)("nav",{"aria-label":c,className:"flex flex-wrap items-center gap-0.5 text-xs","data-testid":"fb-breadcrumbs",children:[f,i.map((p,m)=>(0,et.jsxDEV)("span",{className:"flex items-center gap-0.5",children:[(0,et.jsxDEV)("span",{className:"text-muted-foreground/50",children:"/"},void 0,!1),(0,et.jsxDEV)(mOe,{label:p,onNavigate:o,target:`${i.slice(0,m+1).join("/")}/`},void 0,!1)]},`${p}-${m.toString()}`,!0))]},void 0,!0),e[0]=o,e[1]=r,e[2]=a,e[3]=s}else s=e[3];return s},"Breadcrumbs"),yOe=n(({initialPrefix:t,pageSize:e=EIt})=>{let o=Ve(),r=RIt({initialPrefix:t,pageSize:e}),a=(0,lr.useRef)(null),{onCopy:s,onDelete:i,onDownload:c,onFile:d,toggleSelect:f}=r,p={onCopy:s,onDelete:i,onDownload:c,onToggleSelect:f},m=n(()=>{a.current?.click()},"onUploadClick"),h=n(x=>{let y=x.target,b=y.files?.[0];y.value="",b&&d(b)},"onFileChange"),v=r.loaded&&!r.hasObjects;return(0,et.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-file-browser",children:[(0,et.jsxDEV)(sIt,{bucket:r.bucket,buckets:r.buckets,busy:r.busy,draftPrefix:r.draftPrefix,expiry:r.expiry,fileInputRef:a,onBucketChange:r.selectBucket,onExpiryChange:r.onExpiryChange,onFileChange:h,onList:r.listFirst,onPrefixChange:r.setDraftPrefix,onUploadClick:m,t:o},void 0,!1),r.loaded&&(0,et.jsxDEV)(AIt,{onNavigate:r.navigate,prefix:r.prefix,t:o},void 0,!1),r.hasObjects&&(0,et.jsxDEV)(iIt,{onSortKeyChange:r.onSortKeyChange,onThumbSizeChange:r.onThumbSizeChange,showGrid:r.showGrid,showList:r.showList,sortDirection:r.sortDirection,sortKey:r.sortKey,t:o,tagKeys:r.tagKeys,thumbSize:r.thumbSize,toggleSortDirection:r.toggleSortDirection,view:r.view},void 0,!1),r.hasStorageColumns&&(0,et.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"fb-references-shard",children:[(0,et.jsxDEV)("label",{className:"text-xs text-muted-foreground",htmlFor:"fb-reference-shard-input",children:o("References shard")},void 0,!1),(0,et.jsxDEV)(Qr,{id:"fb-reference-shard-input",onChange:r.setReferenceShard,testId:"fb-reference-shard-input",value:r.referenceShard},void 0,!1),(0,et.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:o("Which shard's records are checked for references to these files. Empty = root shard.")},void 0,!1)]},void 0,!0),r.hasStorageColumns&&(0,et.jsxDEV)(xIt,{busy:r.danglingBusy,onCheck:r.checkOrphans,references:r.danglingReferences,t:o,truncated:r.danglingTruncated},void 0,!1),r.selected.size>0&&(0,et.jsxDEV)(oq,{count:r.selected.size,editable:!0,onClear:r.clearSelection,onDelete:r.bulkDelete},void 0,!1),r.error!==void 0&&(0,et.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"storage-error",role:"alert",children:r.error},void 0,!1),v&&(0,et.jsxDEV)(co,{description:o("Objects you upload to your R2 buckets will appear here."),icon:(0,et.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,et.jsxDEV)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"},void 0,!1),(0,et.jsxDEV)("path",{d:"M12 11v5m-2.5-2.5h5"},void 0,!1)]},void 0,!0),testId:"fb-empty",title:o("No objects.")},void 0,!1),r.hasObjects&&r.view==="list"&&(0,et.jsxDEV)(tIt,{allSelected:r.allSelected,busy:r.busy,copiedKey:r.copiedKey,files:r.files,folders:r.folders,handlers:p,onEnterFolder:r.enterFolder,prefix:r.prefix,references:r.references,selected:r.selected,showReferences:r.hasStorageColumns,someSelected:r.someSelected,t:o,toggleSelectAll:r.toggleSelectAll},void 0,!1),r.hasObjects&&r.view==="grid"&&(0,et.jsxDEV)(gIt,{busy:r.busy,copiedKey:r.copiedKey,files:r.files,folders:r.folders,handlers:p,onEnterFolder:r.enterFolder,prefix:r.prefix,references:r.references,resolveUrl:r.resolveUrl,selected:r.selected,showReferences:r.hasStorageColumns,size:r.thumbSize,t:o},void 0,!1),r.nextCursor!==void 0&&(0,et.jsxDEV)("div",{children:(0,et.jsxDEV)(dt,{"data-testid":"fb-next",disabled:r.busy,onClick:r.loadMore,size:"sm",type:"button",variant:"outline",children:o("Load more")},void 0,!1)},void 0,!1)]},void 0,!0)},"FileBrowser");function TIt(t){return t!==""}n(TIt,"_temp");var IOe=K(Eo(),1);var bOe=K(po(),1);var kIt=n((t,e,o)=>t!==void 0?t:e===void 0&&o===void 0?pH:BF(e,o),"resolveInstance"),YA=n(t=>{let e=(0,IOe.c)(7),{catalogs:o,children:r,i18n:a,locale:s}=t,i;e[0]!==o||e[1]!==a||e[2]!==s?(i=kIt(a,s,o),e[0]=o,e[1]=a,e[2]=s,e[3]=i):i=e[3];let c=i,d;return e[4]!==r||e[5]!==c?(d=(0,bOe.jsxDEV)(mH,{value:c,children:r},void 0,!1),e[4]=r,e[5]=c,e[6]=d):d=e[6],d},"StudioI18nProvider");var UZ=K(Eo(),1);var _0=K(oe(),1);var Ds=K(po(),1);var VZ="lunora:command-palette",SOe=n(()=>{"window"in globalThis&&globalThis.dispatchEvent(new Event(VZ))},"openCommandPalette"),MIt=n(t=>{let e=(0,UZ.c)(18),{active:o,index:r,item:a,onActivate:s,onSelect:i}=t,c;e[0]!==a||e[1]!==i?(c=n(()=>{i(a)},"t1"),e[0]=a,e[1]=i,e[2]=c):c=e[2];let d=c,f;e[3]!==r||e[4]!==s?(f=n(()=>{s(r)},"t2"),e[3]=r,e[4]=s,e[5]=f):f=e[5];let p=f,m=o?"bg-accent text-accent-foreground":"text-foreground",h;e[6]!==m?(h=tt("flex w-full items-center justify-between gap-3 rounded-md px-3 py-2 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground",m),e[6]=m,e[7]=h):h=e[7];let v;e[8]!==a.label?(v=(0,Ds.jsxDEV)("span",{children:a.label},void 0,!1),e[8]=a.label,e[9]=v):v=e[9];let x;e[10]!==a.group?(x=(0,Ds.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:a.group},void 0,!1),e[10]=a.group,e[11]=x):x=e[11];let y;return e[12]!==d||e[13]!==p||e[14]!==h||e[15]!==v||e[16]!==x?(y=(0,Ds.jsxDEV)("li",{children:(0,Ds.jsxDEV)("button",{className:h,onClick:d,onMouseEnter:p,type:"button",children:[v,x]},void 0,!0)},void 0,!1),e[12]=d,e[13]=p,e[14]=h,e[15]=v,e[16]=x,e[17]=y):y=e[17],y},"CommandRow"),wOe=n(t=>{let e=(0,UZ.c)(39),{items:o}=t,r=Ve(),a=zs(),[s,i]=(0,_0.useState)(!1),[c,d]=(0,_0.useState)(""),[f,p]=(0,_0.useState)(0),m=(0,_0.useRef)(null),h,v;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n(()=>{let B=n(q=>{(q.metaKey||q.ctrlKey)&&q.key.toLowerCase()==="k"&&(q.preventDefault(),i(!0))},"onKeyDown"),z=n(()=>{i(!0)},"onOpen");return globalThis.addEventListener("keydown",B),globalThis.addEventListener(VZ,z),()=>{globalThis.removeEventListener("keydown",B),globalThis.removeEventListener(VZ,z)}},"t1"),v=[],e[0]=h,e[1]=v):(h=e[0],v=e[1]),(0,_0.useEffect)(h,v);let x;if(e[2]!==o||e[3]!==c){e:{let B=c.trim().toLowerCase();if(B===""){x=o;break e}x=o.filter(z=>z.label.toLowerCase().includes(B)||z.group.toLowerCase().includes(B))}e[2]=o,e[3]=c,e[4]=x}else x=e[4];let y=x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=n(B=>{i(B),B||(d(""),p(0))},"t4"),e[5]=b):b=e[5];let S=b,w;e[6]!==a?(w=n(B=>{S(!1),ot(a({to:B.to}))},"t5"),e[6]=a,e[7]=w):w=e[7];let C=w,F;e[8]===Symbol.for("react.memo_cache_sentinel")?(F=n(B=>{d(B.target.value),p(0)},"t6"),e[8]=F):F=e[8];let T=F,E;e[9]!==f||e[10]!==y||e[11]!==C?(E=n(B=>{e:switch(B.key){case"ArrowDown":{B.preventDefault(),p(z=>y.length===0?0:(z+1)%y.length);break e}case"ArrowUp":{B.preventDefault(),p(z=>y.length===0?0:(z-1+y.length)%y.length);break e}case"Enter":{B.preventDefault();let z=y[f];z!==void 0&&C(z);break e}}},"t7"),e[9]=f,e[10]=y,e[11]=C,e[12]=E):E=e[12];let k=E,O;e[13]===Symbol.for("react.memo_cache_sentinel")?(O=(0,Ds.jsxDEV)(pi.Backdrop,{className:"fixed inset-0 z-50 bg-black/40 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0"},void 0,!1),e[13]=O):O=e[13];let D;e[14]!==r?(D=r("Command palette"),e[14]=r,e[15]=D):D=e[15];let M;e[16]!==D?(M=(0,Ds.jsxDEV)(pi.Title,{className:"sr-only",children:D},void 0,!1),e[16]=D,e[17]=M):M=e[17];let L;e[18]===Symbol.for("react.memo_cache_sentinel")?(L=(0,Ds.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.8,viewBox:"0 0 24 24",children:[(0,Ds.jsxDEV)("circle",{cx:"11",cy:"11",r:"7"},void 0,!1),(0,Ds.jsxDEV)("path",{d:"m21 21-4.3-4.3",strokeLinecap:"round"},void 0,!1)]},void 0,!0),e[18]=L):L=e[18];let U;e[19]!==r?(U=r("Search\u2026"),e[19]=r,e[20]=U):U=e[20];let W;e[21]!==k||e[22]!==c||e[23]!==U?(W=(0,Ds.jsxDEV)("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[L,(0,Ds.jsxDEV)("input",{className:"h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground","data-testid":"dash-command-input",onChange:T,onKeyDown:k,placeholder:U,ref:m,type:"text",value:c},void 0,!1)]},void 0,!0),e[21]=k,e[22]=c,e[23]=U,e[24]=W):W=e[24];let V;e[25]!==f||e[26]!==y||e[27]!==C||e[28]!==r?(V=y.length===0?(0,Ds.jsxDEV)("li",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:r("No results.")},void 0,!1):y.map((B,z)=>(0,Ds.jsxDEV)(MIt,{active:z===f,index:z,item:B,onActivate:p,onSelect:C},B.to,!1)),e[25]=f,e[26]=y,e[27]=C,e[28]=r,e[29]=V):V=e[29];let j;e[30]!==V?(j=(0,Ds.jsxDEV)("ul",{className:"max-h-80 overflow-y-auto p-1.5","data-testid":"dash-command-list",children:V},void 0,!1),e[30]=V,e[31]=j):j=e[31];let N;e[32]!==M||e[33]!==W||e[34]!==j?(N=(0,Ds.jsxDEV)(pi.Portal,{children:[O,(0,Ds.jsxDEV)(pi.Popup,{className:"fixed start-1/2 top-24 z-50 w-[36rem] max-w-[90vw] -translate-x-1/2 overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-lg outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","data-testid":"dash-command-palette",initialFocus:m,children:[M,W,j]},void 0,!0)]},void 0,!0),e[32]=M,e[33]=W,e[34]=j,e[35]=N):N=e[35];let _;return e[36]!==s||e[37]!==N?(_=(0,Ds.jsxDEV)(pi.Root,{onOpenChange:S,open:s,children:N},void 0,!1),e[36]=s,e[37]=N,e[38]=_):_=e[38],_},"CommandPalette");var VOe="(prefers-color-scheme: dark)",UOe=n(()=>{try{return globalThis.localStorage}catch{return}},"store"),PIt=n(t=>t==="system"||t==="light"||t==="dark","isPreference"),zOe=n(()=>globalThis.matchMedia,"matchMedia"),$Oe="lunora-studio-theme",zZ=["system","light","dark"],OIt=n((t="system")=>{try{let e=UOe()?.getItem($Oe);return PIt(e)?e:t}catch{return t}},"loadThemePreference"),COe=n(t=>{let e=UOe();if(e!==void 0)try{e.setItem($Oe,t)}catch{}},"saveThemePreference"),NIt=n(()=>{try{return zOe()?.(VOe).matches?"dark":"light"}catch{return"light"}},"getSystemTheme"),DIt=n((t,e)=>t==="system"?e:t,"resolveTheme"),_It=n(t=>{let e;try{e=zOe()?.(VOe)}catch{e=void 0}if(e===void 0)return()=>{};let o=n(r=>{t(r.matches?"dark":"light")},"handler");return e.addEventListener("change",o),()=>{e.removeEventListener("change",o)}},"subscribeSystemTheme"),HOe=(0,st.createContext)(null),jOe=n(({children:t,defaultTheme:e="system"})=>{let[o,r]=(0,st.useState)(()=>OIt(e)),[a,s]=(0,st.useState)(()=>NIt());(0,st.useEffect)(()=>_It(s),[]);let i=n(f=>{COe(f),r(f)},"setTheme"),d={cycleTheme:n(()=>{r(f=>{let p=zZ[(zZ.indexOf(f)+1)%zZ.length]??f;return COe(p),p})},"cycleTheme"),resolvedTheme:DIt(o,a),setTheme:i,systemTheme:a,theme:o};return(0,P.jsxDEV)(HOe,{value:d,children:t},void 0,!1)},"ThemeProvider"),aV=n(()=>{let t=(0,st.use)(HOe);if(t===null)throw new Error("useTheme must be used within a <ThemeProvider>");return t},"useTheme");function qOe({delay:t=0,...e}){return(0,P.jsxDEV)(wf.Provider,{"data-slot":"tooltip-provider",delay:t,...e},void 0,!1)}n(qOe,"TooltipProvider");function LIt(t){let e=(0,Yt.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=(0,P.jsxDEV)(wf.Root,{"data-slot":"tooltip",...o},void 0,!1),e[2]=o,e[3]=r):r=e[3],r}n(LIt,"Tooltip");function BIt(t){let e=(0,Yt.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=(0,P.jsxDEV)(wf.Trigger,{"data-slot":"tooltip-trigger",...o},void 0,!1),e[2]=o,e[3]=r):r=e[3],r}n(BIt,"TooltipTrigger");function VIt({className:t,side:e="top",sideOffset:o=4,align:r="center",alignOffset:a=0,children:s,...i}){return(0,P.jsxDEV)(wf.Portal,{children:(0,P.jsxDEV)(wf.Positioner,{align:r,alignOffset:a,side:e,sideOffset:o,className:"isolate z-50",children:(0,P.jsxDEV)(wf.Popup,{"data-slot":"tooltip-content",className:tt("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-xs text-background has-data-[slot=kbd]:pe-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-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-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-md data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...i,children:[s,(0,P.jsxDEV)(wf.Arrow,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-md bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-start-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-end-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)}n(VIt,"TooltipContent");var GZ=n(t=>{let e=(0,Yt.c)(5),{className:o}=t,r;e[0]!==o?(r=tt("h-full w-full text-foreground",o),e[0]=o,e[1]=r):r=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,P.jsxDEV)("path",{d:"M 259.500 10.552 C 220.080 15.859, 182.424 32.566, 152.500 58.025 C 110.179 94.031, 85.380 137.183, 77.518 188.500 C 75.410 202.255, 74.569 225.677, 75.796 236.466 C 76.757 244.917, 76.683 245.692, 74.518 249.966 C 63.118 272.466, 53.141 303.876, 51.382 322.799 L 50.718 329.943 71.960 320.471 C 83.643 315.262, 93.326 311, 93.478 311 C 93.630 311, 96.547 316.063, 99.959 322.250 C 103.371 328.438, 107.249 334.850, 108.577 336.500 L 110.990 339.500 110.981 336 C 110.977 334.075, 111.499 324.991, 112.143 315.813 L 113.312 299.127 121.406 293.336 C 132.495 285.403, 149.593 271.554, 161 261.268 C 171.556 251.748, 189.116 235, 188.540 235 C 188.337 235, 183.069 238.648, 176.835 243.106 C 142.318 267.789, 68.537 314, 63.646 314 C 61.843 314, 72.791 281.179, 80.905 262.259 C 92.233 235.845, 107.473 212.389, 132.106 183.453 L 138.451 176 148.268 176 C 176.192 176, 197.512 187.154, 212.868 209.797 C 216.470 215.108, 217.035 216.595, 216.477 219.297 C 211.386 243.968, 202.359 274.496, 193.797 296 C 183.898 320.861, 167.147 352.101, 152.395 373.215 L 147.004 380.930 152.891 385.830 C 161.400 392.911, 165.563 396, 166.594 395.998 C 167.092 395.998, 168.772 391.641, 170.327 386.317 C 176.279 365.934, 188.422 338.749, 200.942 317.778 C 223.060 280.731, 256.432 244.369, 294.500 215.836 C 309.956 204.252, 313.937 201.603, 314.719 202.385 C 315.116 202.783, 315.449 213.096, 315.460 225.304 C 315.474 241.855, 315.021 250.405, 313.680 258.924 C 307.009 301.272, 291.175 336.677, 263.112 372 C 255.259 381.883, 227.182 410.673, 218.516 417.727 L 213.532 421.783 223.439 424.880 C 281.705 443.093, 349.165 436.018, 398.616 406.508 C 446.728 377.797, 483.322 331.466, 497.366 281.481 C 503.381 260.075, 504.480 250.741, 504.491 221 C 504.501 191.997, 503.598 184.047, 497.987 163.732 C 484.768 115.871, 452.505 72.708, 407.718 42.964 C 381.051 25.254, 352.818 14.828, 319.695 10.460 C 305.932 8.645, 273.298 8.695, 259.500 10.552",fillRule:"evenodd"},void 0,!1),e[2]=a):a=e[2];let s;return e[3]!==r?(s=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:r,fill:"currentColor",viewBox:"0 0 543 446",children:a},void 0,!1),e[3]=r,e[4]=s):s=e[4],s},"BrandMark"),WOe="lunora.studio.rulesBannerDismissed",UIt=n(()=>{try{return globalThis.localStorage.getItem(WOe)==="1"}catch{return!1}},"readBannerDismissed"),zIt=n(()=>{try{globalThis.localStorage.setItem(WOe,"1")}catch{}},"writeBannerDismissed"),$It=n(()=>{let t=(0,Yt.c)(18),e=Ve(),[o,r]=(0,st.useState)(HIt),a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=n(()=>{r(!0),zIt()},"t0"),t[0]=a):a=t[0];let s=a;if(o)return null;let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=(0,P.jsxDEV)("span",{"aria-hidden":"true",className:"text-warning",children:"\u26A0"},void 0,!1),t[1]=i):i=t[1];let c;t[2]!==e?(c=e("Lunora AI rules aren't installed."),t[2]=e,t[3]=c):c=t[3];let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d=(0,P.jsxDEV)("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px]",children:"lunora rules install"},void 0,!1),t[4]=d):d=t[4];let f;t[5]!==e?(f=e("lets your coding agent use Lunora correctly."),t[5]=e,t[6]=f):f=t[6];let p;t[7]!==c||t[8]!==f?(p=(0,P.jsxDEV)("span",{children:[c," ",d," ",f]},void 0,!0),t[7]=c,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==e?(m=e("Dismiss"),t[10]=e,t[11]=m):m=t[11];let h;t[12]===Symbol.for("react.memo_cache_sentinel")?(h=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M18 6 6 18M6 6l12 12"},void 0,!1)},void 0,!1),t[12]=h):h=t[12];let v;t[13]!==m?(v=(0,P.jsxDEV)("button",{"aria-label":m,className:"ms-auto flex size-5 items-center justify-center rounded text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent","data-testid":"dash-app-rules-banner-dismiss",onClick:s,type:"button",children:h},void 0,!1),t[13]=m,t[14]=v):v=t[14];let x;return t[15]!==p||t[16]!==v?(x=(0,P.jsxDEV)("div",{className:"flex shrink-0 items-center gap-2 border-b border-warning/30 bg-warning/10 px-6 py-2 text-[12px] text-foreground","data-testid":"dash-app-rules-banner",role:"note",children:[i,p,v]},void 0,!0),t[15]=p,t[16]=v,t[17]=x):x=t[17],x},"RulesBanner");function HIt(){return UIt()}n(HIt,"_temp$9");var jIt=n(()=>{let t=(0,Yt.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:[(0,P.jsxDEV)("rect",{height:"14",rx:"2",width:"20",x:"2",y:"3"},void 0,!1),(0,P.jsxDEV)("path",{d:"M8 21h8M12 17v4"},void 0,!1)]},void 0,!0),t[0]=e):e=t[0],e},"MonitorIcon"),qIt=n(()=>{let t=(0,Yt.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:[(0,P.jsxDEV)("circle",{cx:"12",cy:"12",r:"4"},void 0,!1),(0,P.jsxDEV)("path",{d:"M12 2v2m0 16v2M4.9 4.9l1.4 1.4m11.4 11.4 1.4 1.4M2 12h2m16 0h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"},void 0,!1)]},void 0,!0),t[0]=e):e=t[0],e},"SunIcon"),WIt=n(()=>{let t=(0,Yt.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z"},void 0,!1)},void 0,!1),t[0]=e):e=t[0],e},"MoonIcon"),GIt=[{Icon:jIt,value:"system"},{Icon:qIt,value:"light"},{Icon:WIt,value:"dark"}],KIt=n(()=>{let t=(0,Yt.c)(19),{theme:e,setTheme:o}=aV(),r=Ve(),a;t[0]!==r?(a=r("Dark theme"),t[0]=r,t[1]=a):a=t[1];let s;t[2]!==r?(s=r("Light theme"),t[2]=r,t[3]=s):s=t[3];let i;t[4]!==r?(i=r("System theme"),t[4]=r,t[5]=i):i=t[5];let c;t[6]!==a||t[7]!==s||t[8]!==i?(c={dark:a,light:s,system:i},t[6]=a,t[7]=s,t[8]=i,t[9]=c):c=t[9];let d=c,f;t[10]!==r?(f=r("Theme"),t[10]=r,t[11]=f):f=t[11];let p;t[12]!==d||t[13]!==o||t[14]!==e?(p=GIt.map(h=>{let{Icon:v,value:x}=h,y=e===x;return(0,P.jsxDEV)("button",{"aria-checked":y,"aria-label":d[x],className:tt("relative flex size-7 cursor-pointer items-center justify-center rounded-md outline-none transition-colors focus-visible:bg-accent",y?"text-foreground":"text-muted-foreground hover:text-foreground"),"data-testid":`dash-app-theme-${x}`,onClick:n(()=>{o(x)},"onClick"),role:"radio",title:d[x],type:"button",children:[y&&(0,P.jsxDEV)(Up.span,{className:"absolute inset-0 rounded-md border border-muted-foreground/40 bg-background/40",layoutId:"studio-theme-active",transition:{bounce:.1,duration:.45,type:"spring"}},void 0,!1),(0,P.jsxDEV)("span",{className:"relative",children:(0,P.jsxDEV)(v,{},void 0,!1)},void 0,!1)]},x,!0)}),t[12]=d,t[13]=o,t[14]=e,t[15]=p):p=t[15];let m;return t[16]!==f||t[17]!==p?(m=(0,P.jsxDEV)("div",{"aria-label":f,className:"inline-flex items-center gap-0.5 overflow-hidden rounded-md border border-border bg-muted/60 p-0.5","data-testid":"dash-app-theme",role:"radiogroup",children:p},void 0,!1),t[16]=f,t[17]=p,t[18]=m):m=t[18],m},"ThemeToggle");function GOe(t){let e=(0,Yt.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=(0,P.jsxDEV)(Dg.Root,{"data-slot":"popover",...o},void 0,!1),e[2]=o,e[3]=r):r=e[3],r}n(GOe,"Popover");function KOe(t){let e=(0,Yt.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=(0,P.jsxDEV)(Dg.Trigger,{"data-slot":"popover-trigger",...o},void 0,!1),e[2]=o,e[3]=r):r=e[3],r}n(KOe,"PopoverTrigger");function YOe({align:t="end",alignOffset:e=0,className:o,keepMounted:r=!1,side:a="bottom",sideOffset:s=6,...i}){return(0,P.jsxDEV)(Dg.Portal,{keepMounted:r,children:(0,P.jsxDEV)(Dg.Positioner,{align:t,alignOffset:e,className:"isolate z-50 outline-none",side:a,sideOffset:s,children:(0,P.jsxDEV)(Dg.Popup,{className:tt("z-50 w-72 origin-(--transform-origin) rounded-lg border border-border bg-popover p-3 text-popover-foreground shadow-md outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",o),"data-slot":"popover-content",...i},void 0,!1)},void 0,!1)},void 0,!1)}n(YOe,"PopoverContent");var $Z=768;function YIt(){let t=(0,Yt.c)(2),[e,o]=(0,st.useState)(void 0),r,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=n(()=>{let s=globalThis.matchMedia(`(max-width: ${$Z-1}px)`),i=n(()=>{o(globalThis.innerWidth<$Z)},"onChange");return s.addEventListener("change",i),o(globalThis.innerWidth<$Z),()=>{s.removeEventListener("change",i)}},"t0"),a=[],t[0]=r,t[1]=a):(r=t[0],a=t[1]),(0,st.useEffect)(r,a),!!e}n(YIt,"useIsMobile");function XIt(t){let e=(0,Yt.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=(0,P.jsxDEV)(pi.Root,{"data-slot":"sheet",...o},void 0,!1),e[2]=o,e[3]=r):r=e[3],r}n(XIt,"Sheet");function QIt(t){let e=(0,Yt.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=(0,P.jsxDEV)(pi.Portal,{"data-slot":"sheet-portal",...o},void 0,!1),e[2]=o,e[3]=r):r=e[3],r}n(QIt,"SheetPortal");function ZIt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("fixed inset-0 z-50 bg-black/10 text-xs/relaxed transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)(pi.Backdrop,{"data-slot":"sheet-overlay",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(ZIt,"SheetOverlay");function JIt({className:t,children:e,side:o="right",showCloseButton:r=!0,...a}){return(0,P.jsxDEV)(QIt,{children:[(0,P.jsxDEV)(ZIt,{},void 0,!1),(0,P.jsxDEV)(pi.Popup,{"data-slot":"sheet-content","data-side":o,className:tt("fixed z-50 flex flex-col bg-popover bg-clip-padding text-xs/relaxed text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-e data-[side=left]:data-ending-style:translate-x-[-2.5rem] rtl:data-[side=left]:data-ending-style:-translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] rtl:data-[side=left]:data-starting-style:-translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-s data-[side=right]:data-ending-style:translate-x-[2.5rem] rtl:data-[side=right]:data-ending-style:-translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] rtl:data-[side=right]:data-starting-style:-translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",t),...a,children:[e,r&&(0,P.jsxDEV)(pi.Close,{"data-slot":"sheet-close",render:(0,P.jsxDEV)(dt,{variant:"ghost",className:"absolute top-3 end-3",size:"icon-sm"},void 0,!1),children:[(0,P.jsxDEV)(Ya,{icon:Zp,strokeWidth:2},void 0,!1),(0,P.jsxDEV)("span",{className:"sr-only",children:"Close"},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)}n(JIt,"SheetContent");function ebt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("flex flex-col gap-0.5 p-4",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("div",{"data-slot":"sheet-header",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(ebt,"SheetHeader");function tbt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("text-sm font-medium text-foreground",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)(pi.Title,{"data-slot":"sheet-title",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(tbt,"SheetTitle");function obt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("text-xs/relaxed text-muted-foreground",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)(pi.Description,{"data-slot":"sheet-description",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(obt,"SheetDescription");var rbt="sidebar_state",nbt=3600*24*7,abt="16rem",sbt="18rem",ibt="3rem",lbt="b",XOe=Um.createContext(null);function sV(){let t=Um.useContext(XOe);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}n(sV,"useSidebar");function cbt({defaultOpen:t=!0,open:e,onOpenChange:o,className:r,style:a,children:s,...i}){let c=YIt(),[d,f]=Um.useState(!1),[p,m]=Um.useState(t),h=e??p,v=n(S=>{let w=typeof S=="function"?S(h):S;o?o(w):m(w),document.cookie=`${rbt}=${w}; path=/; max-age=${nbt}`},"setOpen"),x=n(()=>c?f(S=>!S):v(S=>!S),"toggleSidebar");Um.useEffect(()=>{let S=n(w=>{w.key===lbt&&(w.metaKey||w.ctrlKey)&&(w.preventDefault(),x())},"handleKeyDown");return globalThis.addEventListener("keydown",S),()=>globalThis.removeEventListener("keydown",S)},[x]);let b={state:h?"expanded":"collapsed",open:h,setOpen:v,isMobile:c,openMobile:d,setOpenMobile:f,toggleSidebar:x};return(0,P.jsxDEV)(XOe.Provider,{value:b,children:(0,P.jsxDEV)("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":abt,"--sidebar-width-icon":ibt,...a},className:tt("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",r),...i,children:s},void 0,!1)},void 0,!1)}n(cbt,"SidebarProvider");function ubt({side:t="left",variant:e="sidebar",collapsible:o="offcanvas",className:r,children:a,dir:s,...i}){let{isMobile:c,state:d,openMobile:f,setOpenMobile:p}=sV();return o==="none"?(0,P.jsxDEV)("div",{"data-slot":"sidebar",className:tt("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",r),...i,children:a},void 0,!1):c?(0,P.jsxDEV)(XIt,{open:f,onOpenChange:p,...i,children:(0,P.jsxDEV)(JIt,{dir:s,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":sbt},side:t,children:[(0,P.jsxDEV)(ebt,{className:"sr-only",children:[(0,P.jsxDEV)(tbt,{children:"Sidebar"},void 0,!1),(0,P.jsxDEV)(obt,{children:"Displays the mobile sidebar."},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex h-full w-full flex-col",children:a},void 0,!1)]},void 0,!0)},void 0,!1):(0,P.jsxDEV)("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":d,"data-collapsible":d==="collapsed"?o:"","data-variant":e,"data-side":t,"data-slot":"sidebar",children:[(0,P.jsxDEV)("div",{"data-slot":"sidebar-gap",className:tt("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",e==="floating"||e==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")},void 0,!1),(0,P.jsxDEV)("div",{"data-slot":"sidebar-container","data-side":t,className:tt("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",e==="floating"||e==="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-e group-data-[side=right]:border-s",r),...i,children:(0,P.jsxDEV)("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-none group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:a},void 0,!1)},void 0,!1)]},void 0,!0)}n(ubt,"Sidebar");function dbt(t){let e=(0,Yt.c)(15),o,r,a;e[0]!==t?({className:o,onClick:r,...a}=t,e[0]=t,e[1]=o,e[2]=r,e[3]=a):(o=e[1],r=e[2],a=e[3]);let{toggleSidebar:s}=sV(),i;e[4]!==o?(i=tt(o),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==r||e[7]!==s?(c=n(m=>{r?.(m),s()},"t2"),e[6]=r,e[7]=s,e[8]=c):c=e[8];let d,f;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=(0,P.jsxDEV)(Ya,{icon:hE,strokeWidth:2,className:"rtl:rotate-180"},void 0,!1),f=(0,P.jsxDEV)("span",{className:"sr-only",children:"Toggle Sidebar"},void 0,!1),e[9]=d,e[10]=f):(d=e[9],f=e[10]);let p;return e[11]!==a||e[12]!==i||e[13]!==c?(p=(0,P.jsxDEV)(dt,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:i,onClick:c,...a,children:[d,f]},void 0,!0),e[11]=a,e[12]=i,e[13]=c,e[14]=p):p=e[14],p}n(dbt,"SidebarTrigger");function fbt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ms-0 md:peer-data-[variant=inset]:rounded-none md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ms-2",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("main",{"data-slot":"sidebar-inset",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(fbt,"SidebarInset");function pbt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("flex flex-col gap-2 p-2",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(pbt,"SidebarHeader");function mbt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("flex flex-col gap-2 p-2",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(mbt,"SidebarFooter");function hbt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("flex min-h-0 flex-1 flex-col gap-0 overflow-x-hidden overflow-y-auto [scrollbar-color:color-mix(in_oklch,var(--muted-foreground)_25%,transparent)_transparent] [scrollbar-width:thin] [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-muted-foreground/25 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar]:w-1.5 hover:[scrollbar-color:color-mix(in_oklch,var(--muted-foreground)_50%,transparent)_transparent] hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/50",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(hbt,"SidebarContent");function gbt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("relative flex w-full min-w-0 flex-col p-2",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(gbt,"SidebarGroup");function vbt(t){let e=(0,Yt.c)(10),o,r,a,s;if(e[0]!==t){let{className:d,render:f,...p}=t;o=f,s=MR,r="div",a=yr({className:tt("flex h-8 shrink-0 items-center rounded-none px-2 text-xs text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",d)},p),e[0]=t,e[1]=o,e[2]=r,e[3]=a,e[4]=s}else o=e[1],r=e[2],a=e[3],s=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i={slot:"sidebar-group-label",sidebar:"group-label"},e[5]=i):i=e[5];let c;return e[6]!==o||e[7]!==r||e[8]!==a?(c={defaultTagName:r,props:a,render:o,state:i},e[6]=o,e[7]=r,e[8]=a,e[9]=c):c=e[9],s(c)}n(vbt,"SidebarGroupLabel");function xbt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("w-full text-xs",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(xbt,"SidebarGroupContent");function FOe(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("flex w-full min-w-0 flex-col gap-0",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(FOe,"SidebarMenu");function ROe(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("group/menu-item relative",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(ROe,"SidebarMenuItem");var ybt=fg("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-none p-2 text-start text-xs ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pe-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! 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 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{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)]"},size:{default:"h-8 text-xs",sm:"h-7 text-xs",lg:"h-12 text-xs group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function QOe({render:t,isActive:e=!1,variant:o="default",size:r="default",tooltip:a,className:s,...i}){let{isMobile:c,state:d}=sV(),f=MR({defaultTagName:"button",props:yr({className:tt(ybt({variant:o,size:r}),s)},i),render:a?(0,P.jsxDEV)(BIt,{render:t},void 0,!1):t,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:r,active:e}});return a?(typeof a=="string"&&(a={children:a}),(0,P.jsxDEV)(LIt,{children:[f,(0,P.jsxDEV)(VIt,{side:"right",align:"center",hidden:d!=="collapsed"||c,...a},void 0,!1)]},void 0,!0)):f}n(QOe,"SidebarMenuButton");var EOe=["read","insert","update","delete"],Ibt=n((t,e)=>({delete:t("Delete"),insert:t("Insert"),read:t("Read"),update:t("Update")})[e],"operationLabel$2"),bbt=n(t=>{let e=new Map;for(let o of t){let r=e.get(o.table)??{operations:new Set,procedures:[],table:o.table};r.operations.add(o.on),r.procedures.includes(o.procedure)||r.procedures.push(o.procedure),e.set(o.table,r)}return[...e.values()].toSorted((o,r)=>o.table.localeCompare(r.table))},"groupByTable"),Sbt=n(()=>{let t=(0,Yt.c)(47),e=Ve(),o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={},t[0]=o):o=t[0];let{data:r,error:a}=_o(vt.rlsPolicies,o),s=r!==void 0,i,c,d,f,p,m,h,v,x;if(t[1]!==r||t[2]!==a||t[3]!==s||t[4]!==e){let E=bbt(Array.isArray(r?.policies)?r.policies:[]),k;t[14]!==r?(k=Array.isArray(r?.roles)?r.roles:[],t[14]=r,t[15]=k):k=t[15],c=k,h="flex flex-col gap-6",v="lunora-rls-panel",t[16]!==a?(x=a!==null&&(0,P.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"rls-error",role:"alert",children:a},void 0,!1),t[16]=a,t[17]=x):x=t[17],m="flex flex-col gap-2",i=Rt,d="overflow-hidden py-0";let O;t[18]!==e?(O=e("Policies"),t[18]=e,t[19]=O):O=t[19],t[20]!==O?(f=(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:O},void 0,!1)},void 0,!1),t[20]=O,t[21]=f):f=t[21],p=s&&E.length===0?(0,P.jsxDEV)(co,{description:e("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:e("No policies defined")},void 0,!1):(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"rls-policies-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Table")},void 0,!1),EOe.map(D=>(0,P.jsxDEV)(Le,{children:Ibt(e,D)},D,!1)),(0,P.jsxDEV)(Le,{children:e("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:E.map(D=>(0,P.jsxDEV)(It,{"data-testid":`rls-table-${D.table}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:D.table},void 0,!1),EOe.map(M=>(0,P.jsxDEV)(Ne,{children:D.operations.has(M)?(0,P.jsxDEV)(Pt,{variant:"secondary",children:e("Guarded")},void 0,!1):(0,P.jsxDEV)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"},void 0,!1)},M,!1)),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:D.procedures.join(", ")},void 0,!1)]},D.table,!0))},void 0,!1)]},void 0,!0)},void 0,!1),t[1]=r,t[2]=a,t[3]=s,t[4]=e,t[5]=i,t[6]=c,t[7]=d,t[8]=f,t[9]=p,t[10]=m,t[11]=h,t[12]=v,t[13]=x}else i=t[5],c=t[6],d=t[7],f=t[8],p=t[9],m=t[10],h=t[11],v=t[12],x=t[13];let y;t[22]!==i||t[23]!==d||t[24]!==f||t[25]!==p?(y=(0,P.jsxDEV)(i,{className:d,children:[f,p]},void 0,!0),t[22]=i,t[23]=d,t[24]=f,t[25]=p,t[26]=y):y=t[26];let b;t[27]!==m||t[28]!==y?(b=(0,P.jsxDEV)("section",{className:m,children:y},void 0,!1),t[27]=m,t[28]=y,t[29]=b):b=t[29];let S;t[30]!==e?(S=e("Roles"),t[30]=e,t[31]=S):S=t[31];let w;t[32]!==S?(w=(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S},void 0,!1)},void 0,!1),t[32]=S,t[33]=w):w=t[33];let C;t[34]!==s||t[35]!==c||t[36]!==e?(C=s&&c.length===0?(0,P.jsxDEV)(co,{description:e("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:e("No roles defined")},void 0,!1):(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"rls-roles-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Role")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Description")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Permissions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(Cbt)},void 0,!1)]},void 0,!0)},void 0,!1),t[34]=s,t[35]=c,t[36]=e,t[37]=C):C=t[37];let F;t[38]!==w||t[39]!==C?(F=(0,P.jsxDEV)("section",{className:"flex flex-col gap-2",children:(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:[w,C]},void 0,!0)},void 0,!1),t[38]=w,t[39]=C,t[40]=F):F=t[40];let T;return t[41]!==F||t[42]!==h||t[43]!==v||t[44]!==x||t[45]!==b?(T=(0,P.jsxDEV)("div",{className:h,"data-testid":v,children:[x,b,F]},void 0,!0),t[41]=F,t[42]=h,t[43]=v,t[44]=x,t[45]=b,t[46]=T):T=t[46],T},"RlsPanel");function wbt(t){return(0,P.jsxDEV)(Pt,{variant:"outline",children:t},t,!1)}n(wbt,"_temp$8");function Cbt(t){return(0,P.jsxDEV)(It,{"data-testid":`rls-role-${t.name}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:t.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground",children:t.description??""},void 0,!1),(0,P.jsxDEV)(Ne,{children:t.permissions.length===0?(0,P.jsxDEV)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,P.jsxDEV)("span",{className:"flex flex-wrap gap-1",children:t.permissions.map(wbt)},void 0,!1)},void 0,!1)]},t.name,!0)}n(Cbt,"_temp2$4");var Fbt="ANALYTICS",AOe=[{key:"volume",sql:n(t=>`SELECT blob2 AS fn, count() AS calls FROM ${t} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY calls DESC LIMIT 25`,"sql"),title:"Request volume per function"},{key:"latency",sql:n(t=>`SELECT blob2 AS fn, quantileWeighted(0.50)(double1, _sample_interval) AS p50, quantileWeighted(0.95)(double1, _sample_interval) AS p95 FROM ${t} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY p95 DESC LIMIT 25`,"sql"),title:"Latency p50 / p95 per function"},{key:"hotShards",sql:n(t=>`SELECT blob3 AS shard, count() AS calls FROM ${t} WHERE blob1 = 'function_call' GROUP BY shard ORDER BY calls DESC LIMIT 25`,"sql"),title:"Hot shards"}],Rbt={error:null,loading:!0,result:null},Ebt=n(t=>{let e=(0,Yt.c)(27),{state:o,title:r}=t,a=Ve(),{error:s,loading:i,result:c}=o,d=`analytics-panel-${r}`,f;e[0]!==a||e[1]!==r?(f=a(r),e[0]=a,e[1]=r,e[2]=f):f=e[2];let p;e[3]!==f?(p=(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f},void 0,!1)},void 0,!1),e[3]=f,e[4]=p):p=e[4];let m;e[5]!==i||e[6]!==a?(m=i&&(0,P.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-loading",children:a("Loading\u2026")},void 0,!1),e[5]=i,e[6]=a,e[7]=m):m=e[7];let h;e[8]!==s||e[9]!==i?(h=!i&&s!==null&&(0,P.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"analytics-error",role:"alert",children:s},void 0,!1),e[8]=s,e[9]=i,e[10]=h):h=e[10];let v;e[11]!==s||e[12]!==i||e[13]!==c||e[14]!==a?(v=!i&&s===null&&c!==null&&c.rows.length===0&&(0,P.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-empty-rows",children:a("No data points yet.")},void 0,!1),e[11]=s,e[12]=i,e[13]=c,e[14]=a,e[15]=v):v=e[15];let x;e[16]!==s||e[17]!==i||e[18]!==c?(x=!i&&s===null&&c!==null&&c.rows.length>0&&(0,P.jsxDEV)(Ao,{children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:c.columns.map(Tbt)},void 0,!1)},void 0,!1),(0,P.jsxDEV)(To,{children:c.rows.map((b,S)=>(0,P.jsxDEV)(It,{children:c.columns.map(w=>(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:jr(b[w.name])},w.name,!1))},S,!1))},void 0,!1)]},void 0,!0),e[16]=s,e[17]=i,e[18]=c,e[19]=x):x=e[19];let y;return e[20]!==d||e[21]!==p||e[22]!==m||e[23]!==h||e[24]!==v||e[25]!==x?(y=(0,P.jsxDEV)(Rt,{className:"gap-0 py-0","data-testid":d,children:[p,m,h,v,x]},void 0,!0),e[20]=d,e[21]=p,e[22]=m,e[23]=h,e[24]=v,e[25]=x,e[26]=y):y=e[26],y},"PanelResult"),Abt=n(({config:t,dataset:e=Fbt,runQuery:o}={})=>{let r=Ve(),[a,s]=(0,st.useState)({}),i=(0,st.useMemo)(()=>{if(o!==void 0)return o;if(t===void 0)return null;let d=E9({accountId:t.accountId,apiToken:t.apiToken});return f=>d.query(f)},[t,o]),c=(0,st.useCallback)(async d=>{if(i!==null)for(let f of AOe){if(d.cancelled)return;s(p=>({...p,[f.key]:{error:null,loading:!0,result:null}}));try{let p=await i(f.sql(e));d.cancelled||s(m=>({...m,[f.key]:{error:null,loading:!1,result:p}}))}catch(p){d.cancelled||s(m=>({...m,[f.key]:{error:Jt(p),loading:!1,result:null}}))}}},[i,e]);return(0,st.useEffect)(()=>{let d={cancelled:!1};return ot(c(d)),()=>{d.cancelled=!0}},[c]),i===null?(0,P.jsxDEV)(co,{description:r("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (Analytics Read) in your .dev.vars to enable usage panels."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"},void 0,!1)},void 0,!1),testId:"analytics-not-configured",title:r("Analytics is not configured.")},void 0,!1):(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-analytics-panel",children:AOe.map(d=>(0,P.jsxDEV)(Ebt,{state:a[d.key]??Rbt,title:d.title},d.key,!1))},void 0,!1)},"AnalyticsPanel");function Tbt(t){return(0,P.jsxDEV)(Le,{children:t.name},t.name,!1)}n(Tbt,"_temp$7");var kbt=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],Mbt=n(()=>{let t=(0,Yt.c)(29),e=Wt(),o=Ve(),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=["lunora-auth-capabilities"],t[0]=r):r=t[0];let a;t[1]!==e?(a=n(()=>e.getAuthCapabilities(),"t1"),t[1]=e,t[2]=a):a=t[2];let{data:s,error:i}=mi(r,a),c;t[3]!==o?(c=o("Enabled capabilities"),t[3]=o,t[4]=c):c=t[4];let d;t[5]!==c?(d=(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c},void 0,!1)},void 0,!1),t[5]=c,t[6]=d):d=t[6];let f;t[7]!==i?(f=i!==null&&(0,P.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:i},void 0,!1),t[7]=i,t[8]=f):f=t[8];let p;t[9]!==s||t[10]!==i||t[11]!==o?(p=i===null&&s===void 0&&(0,P.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:o("Loading auth configuration\u2026")},void 0,!1),t[9]=s,t[10]=i,t[11]=o,t[12]=p):p=t[12];let m;t[13]!==s||t[14]!==i||t[15]!==o?(m=i===null&&s!==void 0&&(0,P.jsxDEV)(Xt,{className:"p-3",children:(0,P.jsxDEV)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:kbt.map(b=>{let S=s[b.key];return(0,P.jsxDEV)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${b.key}`,children:[(0,P.jsxDEV)("span",{className:"text-sm",children:o(b.label)},void 0,!1),(0,P.jsxDEV)(Pt,{variant:S?"success":"outline",children:o(S?"Enabled":"Disabled")},void 0,!1)]},b.key,!0)})},void 0,!1)},void 0,!1),t[13]=s,t[14]=i,t[15]=o,t[16]=m):m=t[16];let h;t[17]!==d||t[18]!==f||t[19]!==p||t[20]!==m?(h=(0,P.jsxDEV)(Rt,{className:"gap-0 py-0",children:[d,f,p,m]},void 0,!0),t[17]=d,t[18]=f,t[19]=p,t[20]=m,t[21]=h):h=t[21];let v;t[22]!==o?(v=o("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output."),t[22]=o,t[23]=v):v=t[23];let x;t[24]!==v?(x=(0,P.jsxDEV)(Rt,{className:"gap-0 py-0",children:(0,P.jsxDEV)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:v},void 0,!1)},void 0,!1),t[24]=v,t[25]=x):x=t[25];let y;return t[26]!==h||t[27]!==x?(y=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[h,x]},void 0,!0),t[26]=h,t[27]=x,t[28]=y):y=t[28],y},"AuthConfigPanel"),TOe=200,Pbt=n(()=>{let t=(0,Yt.c)(21),e=Wt(),o=Ve(),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=["lunora-auth-sessions",TOe],t[0]=r):r=t[0];let a;t[1]!==e?(a=n(()=>e.listAuthSessions({limit:TOe}),"t1"),t[1]=e,t[2]=a):a=t[2];let s=mi(r,a),{error:i}=s,c=s.data?.rows??null,d;t[3]!==s?(d=n(()=>{s.refetch()},"t2"),t[3]=s,t[4]=d):d=t[4],us(d,!0);let f;t[5]!==e||t[6]!==s?(f=n(y=>{ot((async()=>{await e.revokeAuthSession({sessionId:y}),s.refetch()})())},"t3"),t[5]=e,t[6]=s,t[7]=f):f=t[7];let p=f,m;t[8]!==i?(m=i!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:i},void 0,!1),t[8]=i,t[9]=m):m=t[9];let h;t[10]!==c||t[11]!==o?(h=c!==null&&c.length===0&&(0,P.jsxDEV)(co,{testId:"auth-sessions-empty",title:o("No active sessions.")},void 0,!1),t[10]=c,t[11]=o,t[12]=h):h=t[12];let v;t[13]!==p||t[14]!==c||t[15]!==o?(v=c!==null&&c.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"auth-sessions-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:o("user")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("expires")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("ip")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("user agent")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("impersonated by")},void 0,!1),(0,P.jsxDEV)(Le,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(y=>(0,P.jsxDEV)(It,{"data-testid":`auth-session-${y.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:y.userId},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:pn(y.expiresAt)},void 0,!1),(0,P.jsxDEV)(Ne,{children:y.ipAddress??""},void 0,!1),(0,P.jsxDEV)(Ne,{className:"max-w-40 truncate",children:y.userAgent??""},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:y.impersonatedBy??""},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"data-testid":`auth-session-revoke-${y.id}`,onClick:n(()=>{p(y.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Revoke")},void 0,!1)},void 0,!1)]},y.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[13]=p,t[14]=c,t[15]=o,t[16]=v):v=t[16];let x;return t[17]!==m||t[18]!==h||t[19]!==v?(x=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[m,h,v]},void 0,!0),t[17]=m,t[18]=h,t[19]=v,t[20]=x):x=t[20],x},"AuthSessionsPanel"),Obt={accounts:!0,admin:!0,organization:!1,passkey:!1,twoFactor:!1},ZOe=n(()=>{let t=Wt(),[e,o]=(0,st.useState)(Obt),[r,a]=(0,st.useState)(!1);return(0,st.useEffect)(()=>{ot((async()=>{try{o(await t.getAuthCapabilities())}catch{}finally{a(!0)}})())},[t]),{capabilities:e,ready:r}},"useAuthCapabilities"),kOe=n(t=>{let e=(0,Yt.c)(35),{actionLabel:o,actionPrefix:r,columns:a,heading:s,onAction:i,rowPrefix:c,rows:d,testId:f}=t,p=Ve(),m;e[0]!==s?(m=(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s},void 0,!1)},void 0,!1),e[0]=s,e[1]=m):m=e[1];let h;e[2]!==a?(h=a.map(Dbt),e[2]=a,e[3]=h):h=e[3];let v;e[4]!==p?(v=p("Actions"),e[4]=p,e[5]=v):v=e[5];let x;e[6]!==v?(x=(0,P.jsxDEV)(Le,{"aria-label":v},void 0,!1),e[6]=v,e[7]=x):x=e[7];let y;e[8]!==h||e[9]!==x?(y=(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[h,x]},void 0,!0)},void 0,!1),e[8]=h,e[9]=x,e[10]=y):y=e[10];let b;if(e[11]!==o||e[12]!==r||e[13]!==a||e[14]!==i||e[15]!==c||e[16]!==d){let T;e[18]!==o||e[19]!==r||e[20]!==a||e[21]!==i||e[22]!==c?(T=n(E=>{let k=jr(E.id);return(0,P.jsxDEV)(It,{"data-testid":`${c}-${k}`,children:[a.map(O=>(0,P.jsxDEV)(Ne,{children:O.render(E)},O.head,!1)),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"data-testid":`${r}-${k}`,onClick:n(()=>{i(k)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o},void 0,!1)},void 0,!1)]},k,!0)},"t72"),e[18]=o,e[19]=r,e[20]=a,e[21]=i,e[22]=c,e[23]=T):T=e[23],b=d.map(T),e[11]=o,e[12]=r,e[13]=a,e[14]=i,e[15]=c,e[16]=d,e[17]=b}else b=e[17];let S;e[24]!==b?(S=(0,P.jsxDEV)(To,{children:b},void 0,!1),e[24]=b,e[25]=S):S=e[25];let w;e[26]!==y||e[27]!==S?(w=(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{children:[y,S]},void 0,!0)},void 0,!1),e[26]=y,e[27]=S,e[28]=w):w=e[28];let C;e[29]!==m||e[30]!==w?(C=(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:[m,w]},void 0,!0),e[29]=m,e[30]=w,e[31]=C):C=e[31];let F;return e[32]!==C||e[33]!==f?(F=(0,P.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":f,children:C},void 0,!1),e[32]=C,e[33]=f,e[34]=F):F=e[34],F},"OrgRowTable"),Nbt=n(()=>{let t=(0,Yt.c)(95),e=Wt(),o=Ve(),{capabilities:r,ready:a}=ZOe(),[s,i]=(0,st.useState)(null),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-auth-orgs"],t[0]=c):c=t[0];let d;t[1]!==e?(d=n(()=>e.listAuthOrganizations({limit:100}),"t1"),t[1]=e,t[2]=d):d=t[2];let f;t[3]!==r.organization?(f={enabled:r.organization},t[3]=r.organization,t[4]=f):f=t[4];let p=mi(c,d,f),m=p.data?.rows??null,h;t[5]!==s?(h=["lunora-auth-org-members",s],t[5]=s,t[6]=h):h=t[6];let v;t[7]!==e||t[8]!==s?(v=n(()=>e.listAuthOrgMembers({limit:200,organizationId:s??""}),"t4"),t[7]=e,t[8]=s,t[9]=v):v=t[9];let x=s!==null,y;t[10]!==x?(y={enabled:x},t[10]=x,t[11]=y):y=t[11];let b=mi(h,v,y),S;t[12]!==s?(S=["lunora-auth-org-invitations",s],t[12]=s,t[13]=S):S=t[13];let w;t[14]!==e||t[15]!==s?(w=n(()=>e.listAuthOrgInvitations({limit:200,organizationId:s??""}),"t8"),t[14]=e,t[15]=s,t[16]=w):w=t[16];let C=s!==null,F;t[17]!==C?(F={enabled:C},t[17]=C,t[18]=F):F=t[18];let T=mi(S,w,F),E=s===null?null:b.data?.rows??null,k=s===null?null:T.data?.rows??null,O=p.error??b.error??T.error,D;t[19]!==T||t[20]!==b||t[21]!==p||t[22]!==s?(D=n(()=>{p.refetch(),s!==null&&(b.refetch(),T.refetch())},"t11"),t[19]=T,t[20]=b,t[21]=p,t[22]=s,t[23]=D):D=t[23],us(D,r.organization);let M;t[24]===Symbol.for("react.memo_cache_sentinel")?(M=n(ye=>{i(ye)},"t12"),t[24]=M):M=t[24];let L=M,U;t[25]!==T||t[26]!==b?(U=n(ye=>{ot((async()=>{await ye(),b.refetch(),T.refetch()})())},"t13"),t[25]=T,t[26]=b,t[27]=U):U=t[27];let W=U,V;t[28]!==e||t[29]!==W?(V=n(ye=>{W(()=>e.removeAuthOrgMember({memberId:ye}))},"t14"),t[28]=e,t[29]=W,t[30]=V):V=t[30];let j=V,N;t[31]!==e||t[32]!==W?(N=n(ye=>{W(()=>e.cancelAuthOrgInvitation({invitationId:ye}))},"t15"),t[31]=e,t[32]=W,t[33]=N):N=t[33];let _=N,B;t[34]!==o?(B=o("userId"),t[34]=o,t[35]=B):B=t[35];let z;t[36]!==B?(z={head:B,render:_bt},t[36]=B,t[37]=z):z=t[37];let q;t[38]!==o?(q=o("role"),t[38]=o,t[39]=q):q=t[39];let $;t[40]!==q?($={head:q,render:Lbt},t[40]=q,t[41]=$):$=t[41];let Y;t[42]!==z||t[43]!==$?(Y=[z,$],t[42]=z,t[43]=$,t[44]=Y):Y=t[44];let Q=Y,X;t[45]!==o?(X=o("email"),t[45]=o,t[46]=X):X=t[46];let te;t[47]!==X?(te={head:X,render:Bbt},t[47]=X,t[48]=te):te=t[48];let ae;t[49]!==o?(ae=o("role"),t[49]=o,t[50]=ae):ae=t[50];let se;t[51]!==ae?(se={head:ae,render:Vbt},t[51]=ae,t[52]=se):se=t[52];let J;t[53]!==o?(J=o("status"),t[53]=o,t[54]=J):J=t[54];let ne;t[55]!==J?(ne={head:J,render:Ubt},t[55]=J,t[56]=ne):ne=t[56];let pe;t[57]!==te||t[58]!==se||t[59]!==ne?(pe=[te,se,ne],t[57]=te,t[58]=se,t[59]=ne,t[60]=pe):pe=t[60];let le=pe;if(a&&!r.organization){let ye;t[61]!==o?(ye=o("Enable the organization() plugin in your auth config to manage organizations here."),t[61]=o,t[62]=ye):ye=t[62];let ge;t[63]!==o?(ge=o("Organizations are not enabled."),t[63]=o,t[64]=ge):ge=t[64];let Te;return t[65]!==ye||t[66]!==ge?(Te=(0,P.jsxDEV)(co,{description:ye,testId:"org-disabled",title:ge},void 0,!1),t[65]=ye,t[66]=ge,t[67]=Te):Te=t[67],Te}let ie;t[68]!==O?(ie=O!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:O},void 0,!1),t[68]=O,t[69]=ie):ie=t[69];let de;t[70]!==m||t[71]!==o?(de=m!==null&&m.length===0&&(0,P.jsxDEV)(co,{testId:"org-empty",title:o("No organizations.")},void 0,!1),t[70]=m,t[71]=o,t[72]=de):de=t[72];let ue;t[73]!==m||t[74]!==s||t[75]!==o?(ue=m!==null&&m.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"org-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:o("id")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("name")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("slug")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("created")},void 0,!1),(0,P.jsxDEV)(Le,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:m.map(ye=>{let ge=jr(ye.id);return(0,P.jsxDEV)(It,{"data-testid":`org-row-${ge}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:ge},void 0,!1),(0,P.jsxDEV)(Ne,{children:jr(ye.name)},void 0,!1),(0,P.jsxDEV)(Ne,{children:jr(ye.slug)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:pn(ye.createdAt)},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"aria-pressed":s===ge,"data-testid":`org-select-${ge}`,onClick:n(()=>{L(ge)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Members")},void 0,!1)},void 0,!1)]},ge,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[73]=m,t[74]=s,t[75]=o,t[76]=ue):ue=t[76];let he;t[77]!==Q||t[78]!==E||t[79]!==j||t[80]!==s||t[81]!==o?(he=s!==null&&E!==null&&(0,P.jsxDEV)(kOe,{actionLabel:o("Remove"),actionPrefix:"org-remove-member",columns:Q,heading:o("Members"),onAction:j,rowPrefix:"org-member",rows:E,testId:"org-members"},void 0,!1),t[77]=Q,t[78]=E,t[79]=j,t[80]=s,t[81]=o,t[82]=he):he=t[82];let Re;t[83]!==le||t[84]!==k||t[85]!==_||t[86]!==s||t[87]!==o?(Re=s!==null&&k!==null&&k.length>0&&(0,P.jsxDEV)(kOe,{actionLabel:o("Cancel"),actionPrefix:"org-cancel-invitation",columns:le,heading:o("Invitations"),onAction:_,rowPrefix:"org-invitation",rows:k,testId:"org-invitations"},void 0,!1),t[83]=le,t[84]=k,t[85]=_,t[86]=s,t[87]=o,t[88]=Re):Re=t[88];let Ae;return t[89]!==ie||t[90]!==de||t[91]!==ue||t[92]!==he||t[93]!==Re?(Ae=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[ie,de,ue,he,Re]},void 0,!0),t[89]=ie,t[90]=de,t[91]=ue,t[92]=he,t[93]=Re,t[94]=Ae):Ae=t[94],Ae},"OrganizationsPanel");function Dbt(t){return(0,P.jsxDEV)(Le,{children:t.head},t.head,!1)}n(Dbt,"_temp$6");function _bt(t){return jr(t.userId)}n(_bt,"_temp2$3");function Lbt(t){return jr(t.role)}n(Lbt,"_temp3");function Bbt(t){return jr(t.email)}n(Bbt,"_temp4");function Vbt(t){return jr(t.role)}n(Vbt,"_temp5");function Ubt(t){return jr(t.status)}n(Ubt,"_temp6");var zbt=n(({onClose:t,onCreated:e})=>{let o=Wt(),r=Ve(),[a,s]=(0,st.useState)(""),[i,c]=(0,st.useState)(""),[d,f]=(0,st.useState)(""),[p,m]=(0,st.useState)(""),[h,v]=(0,st.useState)(!1),[x,y]=(0,st.useState)(null),b=n(E=>{s(E.target.value)},"onEmailChange"),S=n(E=>{c(E.target.value)},"onNameChange"),w=n(E=>{f(E.target.value)},"onPasswordChange"),C=n(E=>{m(E.target.value)},"onRoleChange"),F=n(async()=>{v(!0),y(null);try{await o.createAuthUser({email:a.trim(),name:i.trim(),password:d===""?void 0:d,role:p.trim()===""?void 0:p.trim()}),e(),t()}catch(E){y(Jt(E))}finally{v(!1)}},"submit"),T=n(()=>{ot(F())},"onSubmit");return(0,P.jsxDEV)(Px,{label:r("Create user"),onClose:t,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[(0,P.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:r("Create user")},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,P.jsxDEV)(Go,{htmlFor:"uc-email",children:r("email")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"uc-email",id:"uc-email",onChange:b,type:"email",value:a},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,P.jsxDEV)(Go,{htmlFor:"uc-name",children:r("name")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"uc-name",id:"uc-name",onChange:S,value:i},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,P.jsxDEV)(Go,{htmlFor:"uc-password",children:r("Password (optional)")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"uc-password",id:"uc-password",onChange:w,type:"password",value:d},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,P.jsxDEV)(Go,{htmlFor:"uc-role",children:r("Role (optional)")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"uc-role",id:"uc-role",onChange:C,value:p},void 0,!1)]},void 0,!0),x!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:x},void 0,!1),(0,P.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,P.jsxDEV)(dt,{"data-testid":"uc-cancel",onClick:t,size:"sm",type:"button",variant:"outline",children:r("Cancel")},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"uc-submit",disabled:h||a.trim()===""||i.trim()==="",onClick:T,size:"sm",type:"button",children:r(h?"Creating\u2026":"Create")},void 0,!1)]},void 0,!0)]},void 0,!0)},"UserCreateDialog"),KZ=n(t=>{let e=(0,Yt.c)(2),{children:o}=t,r;return e[0]!==o?(r=(0,P.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o},void 0,!1),e[0]=o,e[1]=r):r=e[1],r},"SectionHeading"),$bt=n(t=>{let e=(0,Yt.c)(29),{busy:o,runAction:r,userId:a,version:s}=t,i=Wt(),c=Ve(),[d,f]=(0,st.useState)(null),[p,m]=(0,st.useState)(null),h;e[0]!==i||e[1]!==a?(h=n(()=>{ot((async()=>{m(null);try{let E=await i.listAuthSessions({limit:50,userId:a});f(E.rows)}catch(E){let k=E;f(null),m(Jt(k))}})())},"t1"),e[0]=i,e[1]=a,e[2]=h):h=e[2];let v;e[3]!==i||e[4]!==a||e[5]!==s?(v=[i,a,s],e[3]=i,e[4]=a,e[5]=s,e[6]=v):v=e[6],(0,st.useEffect)(h,v);let x;e[7]!==i||e[8]!==r?(x=n(E=>{r(()=>i.revokeAuthSession({sessionId:E}))},"t3"),e[7]=i,e[8]=r,e[9]=x):x=e[9];let y=x,b;e[10]!==c?(b=c("Sessions"),e[10]=c,e[11]=b):b=e[11];let S;e[12]!==b?(S=(0,P.jsxDEV)(KZ,{children:b},void 0,!1),e[12]=b,e[13]=S):S=e[13];let w;e[14]!==p?(w=p!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:p},void 0,!1),e[14]=p,e[15]=w):w=e[15];let C;e[16]!==d||e[17]!==c?(C=d!==null&&d.length===0&&(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:c("No active sessions.")},void 0,!1),e[16]=d,e[17]=c,e[18]=C):C=e[18];let F;e[19]!==o||e[20]!==y||e[21]!==d||e[22]!==c?(F=d!==null&&d.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"ud-sessions-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:c("expires")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("ip")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("user agent")},void 0,!1),(0,P.jsxDEV)(Le,{"aria-label":c("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:d.map(E=>(0,P.jsxDEV)(It,{"data-testid":`ud-session-${E.id}`,children:[(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:pn(E.expiresAt)},void 0,!1),(0,P.jsxDEV)(Ne,{children:E.ipAddress??""},void 0,!1),(0,P.jsxDEV)(Ne,{className:"max-w-40 truncate",children:E.userAgent??""},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"data-testid":`ud-revoke-${E.id}`,disabled:o,onClick:n(()=>{y(E.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:c("Revoke")},void 0,!1)},void 0,!1)]},E.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[19]=o,e[20]=y,e[21]=d,e[22]=c,e[23]=F):F=e[23];let T;return e[24]!==S||e[25]!==w||e[26]!==C||e[27]!==F?(T=(0,P.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[S,w,C,F]},void 0,!0),e[24]=S,e[25]=w,e[26]=C,e[27]=F,e[28]=T):T=e[28],T},"UserSessionsPanel"),Hbt=n(t=>{let e=(0,Yt.c)(30),{busy:o,runAction:r,userId:a,version:s}=t,i=Wt(),c=Ve(),[d,f]=(0,st.useState)(null),[p,m]=(0,st.useState)(null),h;e[0]!==i||e[1]!==a?(h=n(()=>{ot((async()=>{m(null);try{f(await i.listAuthAccounts({userId:a}))}catch(E){let k=E;f(null),m(Jt(k))}})())},"t1"),e[0]=i,e[1]=a,e[2]=h):h=e[2];let v;e[3]!==i||e[4]!==a||e[5]!==s?(v=[i,a,s],e[3]=i,e[4]=a,e[5]=s,e[6]=v):v=e[6],(0,st.useEffect)(h,v);let x;e[7]!==i||e[8]!==r||e[9]!==a?(x=n(E=>{r(()=>i.unlinkAuthAccount({accountId:E,userId:a}))},"t3"),e[7]=i,e[8]=r,e[9]=a,e[10]=x):x=e[10];let y=x,b;e[11]!==c?(b=c("Linked accounts"),e[11]=c,e[12]=b):b=e[12];let S;e[13]!==b?(S=(0,P.jsxDEV)(KZ,{children:b},void 0,!1),e[13]=b,e[14]=S):S=e[14];let w;e[15]!==p?(w=p!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive",role:"alert",children:p},void 0,!1),e[15]=p,e[16]=w):w=e[16];let C;e[17]!==d||e[18]!==c?(C=d!==null&&d.length===0&&(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:c("No linked accounts.")},void 0,!1),e[17]=d,e[18]=c,e[19]=C):C=e[19];let F;e[20]!==d||e[21]!==o||e[22]!==y||e[23]!==c?(F=d!==null&&d.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"ud-accounts-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:c("provider")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("created")},void 0,!1),(0,P.jsxDEV)(Le,{"aria-label":c("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:d.map(E=>{let k=jr(E.id);return(0,P.jsxDEV)(It,{"data-testid":`ud-account-${k}`,children:[(0,P.jsxDEV)(Ne,{children:jr(E.providerId)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:pn(E.createdAt)},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"data-testid":`ud-unlink-${k}`,disabled:o,onClick:n(()=>{y(k)},"onClick"),size:"xs",type:"button",variant:"ghost",children:c("Unlink")},void 0,!1)},void 0,!1)]},k,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[20]=d,e[21]=o,e[22]=y,e[23]=c,e[24]=F):F=e[24];let T;return e[25]!==S||e[26]!==w||e[27]!==C||e[28]!==F?(T=(0,P.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[S,w,C,F]},void 0,!0),e[25]=S,e[26]=w,e[27]=C,e[28]=F,e[29]=T):T=e[29],T},"UserAccountsPanel"),jbt=n(t=>{let e=(0,Yt.c)(40),{busy:o,capabilities:r,runAction:a,userId:s,version:i}=t,c=Wt(),d=Ve(),[f,p]=(0,st.useState)(null),m;e[0]!==r.passkey||e[1]!==c||e[2]!==s?(m=n(()=>{r.passkey&&ot((async()=>{try{p(await c.listAuthPasskeys({userId:s}))}catch{p(null)}})())},"t1"),e[0]=r.passkey,e[1]=c,e[2]=s,e[3]=m):m=e[3];let h;e[4]!==r.passkey||e[5]!==c||e[6]!==s||e[7]!==i?(h=[r.passkey,c,s,i],e[4]=r.passkey,e[5]=c,e[6]=s,e[7]=i,e[8]=h):h=e[8],(0,st.useEffect)(m,h);let v;e[9]!==c||e[10]!==a||e[11]!==s?(v=n(()=>{a(()=>c.disableAuthTwoFactor({userId:s}))},"t3"),e[9]=c,e[10]=a,e[11]=s,e[12]=v):v=e[12];let x=v,y;e[13]!==c||e[14]!==a?(y=n(k=>{a(()=>c.deleteAuthPasskey({passkeyId:k}))},"t4"),e[13]=c,e[14]=a,e[15]=y):y=e[15];let b=y,S;e[16]!==d?(S=d("Security"),e[16]=d,e[17]=S):S=e[17];let w;e[18]!==S?(w=(0,P.jsxDEV)(KZ,{children:S},void 0,!1),e[18]=S,e[19]=w):w=e[19];let C;e[20]!==o||e[21]!==r.twoFactor||e[22]!==x||e[23]!==d?(C=r.twoFactor&&(0,P.jsxDEV)(dt,{"data-testid":"ud-disable-2fa",disabled:o,onClick:x,size:"sm",type:"button",variant:"outline",children:d("Disable two-factor")},void 0,!1),e[20]=o,e[21]=r.twoFactor,e[22]=x,e[23]=d,e[24]=C):C=e[24];let F;e[25]!==r.passkey||e[26]!==f||e[27]!==d?(F=r.passkey&&f!==null&&f.length===0&&(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:d("No passkeys.")},void 0,!1),e[25]=r.passkey,e[26]=f,e[27]=d,e[28]=F):F=e[28];let T;e[29]!==o||e[30]!==r.passkey||e[31]!==b||e[32]!==f||e[33]!==d?(T=r.passkey&&f!==null&&f.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"ud-passkeys-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:d("name")},void 0,!1),(0,P.jsxDEV)(Le,{children:d("created")},void 0,!1),(0,P.jsxDEV)(Le,{"aria-label":d("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:f.map(k=>{let O=jr(k.id);return(0,P.jsxDEV)(It,{"data-testid":`ud-passkey-${O}`,children:[(0,P.jsxDEV)(Ne,{children:jr(k.name)||O},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:pn(k.createdAt)},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"data-testid":`ud-delete-passkey-${O}`,disabled:o,onClick:n(()=>{b(O)},"onClick"),size:"xs",type:"button",variant:"ghost",children:d("Delete")},void 0,!1)},void 0,!1)]},O,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[29]=o,e[30]=r.passkey,e[31]=b,e[32]=f,e[33]=d,e[34]=T):T=e[34];let E;return e[35]!==w||e[36]!==C||e[37]!==F||e[38]!==T?(E=(0,P.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[w,C,F,T]},void 0,!0),e[35]=w,e[36]=C,e[37]=F,e[38]=T,e[39]=E):E=e[39],E},"UserSecurityPanel"),qbt=/(?:at|expires)$/iu,Wbt=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),Gbt=n((t,e)=>typeof e=="number"&&qbt.test(t)?pn(e):jr(e),"formatField"),Kbt=n(({capabilities:t,onChanged:e,onClose:o,user:r})=>{let a=Wt(),s=Ve(),i=r.banned===!0,[c,d]=(0,st.useState)(null),[f,p]=(0,st.useState)(!1),[m,h]=(0,st.useState)(0),[v,x]=(0,st.useState)(typeof r.role=="string"?r.role:""),[y,b]=(0,st.useState)(""),[S,w]=(0,st.useState)(""),[C,F]=(0,st.useState)(""),[T,E]=(0,st.useState)(null),[k,O]=(0,st.useState)(!1),D=n((X,te)=>{ot((async()=>{p(!0),d(null);try{let ae=await X();te?.refresh!==!1&&(h(se=>se+1),e()),te?.onResult?.(ae)}catch(ae){d(Jt(ae))}finally{p(!1)}})())},"runAction"),M=n(X=>{x(X.target.value)},"onRoleInputChange"),L=n(X=>{b(X.target.value)},"onBanReasonChange"),U=n(X=>{w(X.target.value)},"onBanDaysChange"),W=n(X=>{F(X.target.value)},"onNewPasswordChange"),V=n(()=>{let X=v.trim();X!==""&&D(async()=>{await a.setAuthUserRole({role:X,userId:r.id})})},"onSetRole"),j=n(()=>{let X=Number.parseInt(S,10),te=Number.isFinite(X)&&X>0?X*86400:void 0;D(async()=>{await a.banAuthUser({expiresInSeconds:te,reason:y.trim()===""?void 0:y.trim(),userId:r.id})})},"onBan"),N=n(()=>{D(async()=>{await a.unbanAuthUser({userId:r.id})})},"onUnban"),_=n(()=>{D(async()=>{await a.setAuthUserPassword({newPassword:C,userId:r.id}),F("")})},"onSetPassword"),B=n(()=>{D(()=>a.impersonateAuthUser({userId:r.id}),{onResult:n(X=>{E(X.token)},"onResult"),refresh:!1})},"onImpersonate"),z=n(()=>{D(async()=>{await a.revokeAuthUserSessions({userId:r.id})})},"onRevokeAll"),q=n(()=>{D(async()=>{await a.removeAuthUser({userId:r.id}),o()})},"onDelete"),$=n(()=>{O(!0)},"onConfirmDelete"),Y=n(()=>{O(!1)},"onCancelDelete"),Q=Object.entries(r).filter(([X])=>!Wbt.has(X));return(0,P.jsxDEV)(Px,{label:s("User details"),onClose:o,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,P.jsxDEV)("div",{className:"flex items-start justify-between gap-2",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,P.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:r.name??r.email??r.id},void 0,!1),(0,P.jsxDEV)("p",{className:"font-mono text-xs text-muted-foreground",children:r.id},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof r.role=="string"&&r.role!==""&&(0,P.jsxDEV)(Pt,{variant:"secondary",children:r.role},void 0,!1),i?(0,P.jsxDEV)(Pt,{variant:"destructive",children:s("Banned")},void 0,!1):(0,P.jsxDEV)(Pt,{variant:"outline",children:s("Active")},void 0,!1),r.emailVerified===!0?(0,P.jsxDEV)(Pt,{variant:"secondary",children:s("verified")},void 0,!1):(0,P.jsxDEV)(Pt,{variant:"outline",children:s("unverified")},void 0,!1)]},void 0,!0)]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"ud-close",onClick:o,size:"sm",type:"button",variant:"ghost",children:s("Close")},void 0,!1)]},void 0,!0),c!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:c},void 0,!1),t.admin&&(0,P.jsxDEV)(Rt,{className:"gap-0 py-0",children:[(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Actions")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Xt,{className:"flex flex-col gap-3 p-3",children:[(0,P.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,P.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,P.jsxDEV)(Go,{htmlFor:"ud-role",children:s("Role")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"ud-role-input",id:"ud-role",onChange:M,value:v},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"ud-set-role",disabled:f||v.trim()==="",onClick:V,size:"sm",type:"button",variant:"outline",children:s("Set role")},void 0,!1)]},void 0,!0),i?(0,P.jsxDEV)(dt,{"data-testid":"ud-unban",disabled:f,onClick:N,size:"sm",type:"button",variant:"outline",children:s("Unban")},void 0,!1):(0,P.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,P.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,P.jsxDEV)(Go,{htmlFor:"ud-ban-reason",children:s("Ban reason (optional)")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:L,value:y},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex w-24 flex-col gap-1",children:[(0,P.jsxDEV)(Go,{htmlFor:"ud-ban-days",children:s("Days")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:U,type:"number",value:S},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"ud-ban",disabled:f,onClick:j,size:"sm",type:"button",variant:"destructive",children:s("Ban user")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,P.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,P.jsxDEV)(Go,{htmlFor:"ud-password",children:s("New password")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"ud-password",id:"ud-password",onChange:W,type:"password",value:C},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"ud-set-password",disabled:f||C==="",onClick:_,size:"sm",type:"button",variant:"outline",children:s("Set password")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,P.jsxDEV)(dt,{"data-testid":"ud-impersonate",disabled:f,onClick:B,size:"sm",type:"button",variant:"outline",children:s("Impersonate")},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"ud-revoke-all",disabled:f,onClick:z,size:"sm",type:"button",variant:"outline",children:s("Revoke all sessions")},void 0,!1),k?(0,P.jsxDEV)(P.Fragment,{children:[(0,P.jsxDEV)(dt,{"data-testid":"ud-delete-confirm",disabled:f,onClick:q,size:"sm",type:"button",variant:"destructive",children:s("Confirm delete")},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"ud-delete-cancel",onClick:Y,size:"sm",type:"button",variant:"ghost",children:s("Cancel")},void 0,!1)]},void 0,!0):(0,P.jsxDEV)(dt,{"data-testid":"ud-delete",disabled:f,onClick:$,size:"sm",type:"button",variant:"destructive",children:s("Delete user")},void 0,!1)]},void 0,!0),T!==null&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,P.jsxDEV)(Go,{htmlFor:"ud-token",children:s("Impersonation token")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:T},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),(0,P.jsxDEV)($bt,{busy:f,runAction:D,userId:r.id,version:m},void 0,!1),t.accounts&&(0,P.jsxDEV)(Hbt,{busy:f,runAction:D,userId:r.id,version:m},void 0,!1),(t.twoFactor||t.passkey)&&(0,P.jsxDEV)(jbt,{busy:f,capabilities:t,runAction:D,userId:r.id,version:m},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,P.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Fields")},void 0,!1),(0,P.jsxDEV)("dl",{className:"flex flex-col",children:Q.map(([X,te])=>(0,P.jsxDEV)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,P.jsxDEV)("dt",{className:"text-xs font-semibold text-muted-foreground",children:X},void 0,!1),(0,P.jsxDEV)("dd",{className:"m-0 font-mono text-xs break-words",children:Gbt(X,te)},void 0,!1)]},X,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},"UserDetailDrawer"),Ybt=50,Xbt=n(({pageSize:t=Ybt}={})=>{let e=Wt(),o=Ve(),[r,a]=(0,st.useState)(""),[s,i]=(0,st.useState)(""),c=na(r),[d,f]=(0,st.useState)(null),[p,m]=(0,st.useState)(!1),{capabilities:h}=ZOe(),v=c.trim(),x=s.trim(),y=mi(["lunora-auth-users",v,x,t],()=>e.listAuthUsers({filterField:x===""?void 0:"role",filterValue:x===""?void 0:x,limit:t,search:v===""?void 0:v}),{keepPreviousData:!0}),b=y.data?.rows??null,S=y.error,w=n(()=>{y.refetch()},"reloadUsers");us(()=>{y.refetch()},!0);let C=d===null?null:b?.find(F=>F.id===d)??null;return(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,P.jsxDEV)(mo,{"aria-label":o("Search users"),className:"w-56","data-testid":"us-search",onChange:n(F=>{a(F.target.value)},"onChange"),placeholder:o("Search by email or name\u2026"),value:r},void 0,!1),(0,P.jsxDEV)(mo,{"aria-label":o("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:n(F=>{i(F.target.value)},"onChange"),placeholder:o("Filter by role"),value:s},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"us-new",onClick:n(()=>{m(!0)},"onClick"),size:"sm",type:"button",children:o("New user")},void 0,!1)]},void 0,!0),S!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:S},void 0,!1),b!==null&&b.length===0&&(0,P.jsxDEV)(co,{description:o("Users who sign up to your app will appear here."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"},void 0,!1)},void 0,!1),testId:"us-empty",title:o("No users.")},void 0,!1),b!==null&&b.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"us-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:o("id")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("email")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("name")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("role")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("status")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("verified")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("created")},void 0,!1),(0,P.jsxDEV)(Le,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:b.map(F=>(0,P.jsxDEV)(It,{"data-testid":`us-row-${F.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:F.id},void 0,!1),(0,P.jsxDEV)(Ne,{children:F.email??""},void 0,!1),(0,P.jsxDEV)(Ne,{children:F.name??""},void 0,!1),(0,P.jsxDEV)(Ne,{children:typeof F.role=="string"&&F.role!==""?(0,P.jsxDEV)(Pt,{variant:"secondary",children:F.role},void 0,!1):""},void 0,!1),(0,P.jsxDEV)(Ne,{children:F.banned===!0?(0,P.jsxDEV)(Pt,{variant:"destructive",children:o("Banned")},void 0,!1):(0,P.jsxDEV)(Pt,{variant:"success",children:o("Active")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{children:F.emailVerified===!0?(0,P.jsxDEV)(Pt,{variant:"success",children:o("yes")},void 0,!1):(0,P.jsxDEV)(Pt,{variant:"outline",children:o("no")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:pn(F.createdAt)},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"data-testid":`us-manage-${F.id}`,onClick:n(()=>{f(F.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Manage")},void 0,!1)},void 0,!1)]},F.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),C!==null&&(0,P.jsxDEV)(Kbt,{capabilities:h,onChanged:w,onClose:n(()=>{f(null)},"onClose"),user:C},void 0,!1),p&&(0,P.jsxDEV)(zbt,{onClose:n(()=>{m(!1)},"onClose"),onCreated:w},void 0,!1)]},void 0,!0)},"UsersPanel"),Qbt=n(t=>{let e=t.trim();if(e.length===0)return{context:void 0,error:null};try{let o=JSON.parse(e);return o===null||typeof o!="object"||Array.isArray(o)?{context:void 0,error:"Targeting context must be a JSON object."}:{context:o,error:null}}catch{return{context:void 0,error:"Targeting context is not valid JSON."}}},"parseContext"),Zbt='{ "targetingKey": "user-123", "plan": "premium" }',Jbt=n(t=>t.type==="object"?JSON.stringify(t.value):String(t.value),"formatValue$1"),e1t=n(({initialShardKey:t=""})=>{let e=Ve(),[o,r]=(0,st.useState)(""),{context:a,error:s}=Qbt(o),i=(0,st.useMemo)(()=>a===void 0?{}:{context:a},[a]),{data:c,error:d,liveError:f}=_o(vt.listFlags,i,{live:!0,shardKey:t}),p=c!==void 0,m=c?.configured??!1,h=(0,st.useMemo)(()=>Array.isArray(c?.flags)?[...c.flags].toSorted((x,y)=>x.key.localeCompare(y.key)):[],[c]),v;return p&&!m?v=(0,P.jsxDEV)(co,{description:e("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),testId:"flags-unconfigured",title:e("No flags provider configured")},void 0,!1):p&&h.length===0?v=(0,P.jsxDEV)(co,{description:e('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),testId:"flags-empty",title:e("No flags read")},void 0,!1):v=(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"flags-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Key")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Type")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Value")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Reason")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Variant")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:h.map(x=>(0,P.jsxDEV)(It,{"data-testid":`flags-row-${x.key}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:x.key},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:x.type},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:Jbt(x)},void 0,!1),(0,P.jsxDEV)(Ne,{children:x.errorCode===void 0?(0,P.jsxDEV)("span",{className:"font-mono text-xs text-muted-foreground",children:x.reason??"\u2014"},void 0,!1):(0,P.jsxDEV)(Pt,{"data-testid":`flags-error-${x.key}`,variant:"destructive",children:x.errorCode},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:x.variant??"\u2014"},void 0,!1)]},x.key,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-flags-panel",children:[d!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"flags-error",role:"alert",children:d},void 0,!1),(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:e('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,P.jsxDEV)(Go,{htmlFor:"flags-targeting-context",children:e("Targeting context (JSON)")},void 0,!1),(0,P.jsxDEV)(Ff,{className:"font-mono text-xs","data-testid":"flags-context-input",id:"flags-targeting-context",onChange:n(x=>{r(x.target.value)},"onChange"),placeholder:Zbt,rows:3,value:o},void 0,!1),s!==null&&(0,P.jsxDEV)("p",{className:"text-xs text-destructive","data-testid":"flags-context-error",role:"alert",children:e(s)},void 0,!1),f!==void 0&&(0,P.jsxDEV)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"flags-live-error",role:"alert",children:e("Live updates unavailable; showing the last evaluation.")},void 0,!1)]},void 0,!0),v]},void 0,!0)},"FlagsPanel"),t1t=n(t=>{let e=(0,Yt.c)(23),{destination:o}=t,r=Ve(),a;e[0]!==o.snippet?(a=n(()=>{em(o.snippet)},"t1"),e[0]=o.snippet,e[1]=a):a=e[1];let s=a,i;e[2]!==o.title?(i=(0,P.jsxDEV)("h4",{className:"text-sm font-semibold",children:o.title},void 0,!1),e[2]=o.title,e[3]=i):i=e[3];let c;e[4]!==o.description?(c=(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:o.description},void 0,!1),e[4]=o.description,e[5]=c):c=e[5];let d;e[6]!==i||e[7]!==c?(d=(0,P.jsxDEV)("div",{children:[i,c]},void 0,!0),e[6]=i,e[7]=c,e[8]=d):d=e[8];let f=`drain-copy-${o.id}`,p;e[9]!==r?(p=r("Copy"),e[9]=r,e[10]=p):p=e[10];let m;e[11]!==s||e[12]!==f||e[13]!==p?(m=(0,P.jsxDEV)(dt,{"data-testid":f,onClick:s,size:"sm",variant:"outline",children:p},void 0,!1),e[11]=s,e[12]=f,e[13]=p,e[14]=m):m=e[14];let h;e[15]!==d||e[16]!==m?(h=(0,P.jsxDEV)("div",{className:"flex items-start justify-between gap-3",children:[d,m]},void 0,!0),e[15]=d,e[16]=m,e[17]=h):h=e[17];let v;e[18]!==o.snippet?(v=(0,P.jsxDEV)("pre",{className:"mt-2 overflow-x-auto rounded bg-muted p-2 font-mono text-xs",children:o.snippet},void 0,!1),e[18]=o.snippet,e[19]=v):v=e[19];let x;return e[20]!==h||e[21]!==v?(x=(0,P.jsxDEV)(Rt,{className:"py-0","data-testid":"drain-card",children:(0,P.jsxDEV)(Xt,{className:"p-3",children:[h,v]},void 0,!0)},void 0,!1),e[20]=h,e[21]=v,e[22]=x):x=e[22],x},"DestinationRow"),o1t=n(()=>{let t=Ve(),e=[{description:t("Stream every request log to R2, a SIEM, or a third-party log service."),id:"logpush",snippet:["{",' "logpush": true',"}"].join(`
376
376
  `),title:t("Logpush")},{description:t("Send logs programmatically to a Worker for custom capture and forwarding."),id:"tail-worker",snippet:["{",' "tail_consumers": [{ "service": "my-log-forwarder" }]',"}"].join(`
377
377
  `),title:t("Tail Workers")},{description:t("Retain and query recent request logs directly in Cloudflare's dashboard."),id:"workers-logs",snippet:["{",' "observability": { "enabled": true }',"}"].join(`
378
- `),title:t("Workers Logs")}],[o,r]=(0,st.useState)(""),[a,s]=(0,st.useState)(!1),[i,c]=(0,st.useState)(null),d=n(async()=>{let m=o.trim();if(m==="")return;let h="fetch"in globalThis?globalThis.fetch:void 0;if(h===void 0){c({kind:"error",message:t("fetch is unavailable in this environment.")});return}let v={durationMs:12,function:"messages:list",outcome:"ok",shard:"root",source:"lunora",tablesRead:["messages"],tablesWritten:[],ts:new Date().toISOString(),type:"request"};s(!0),c(null);let x=performance.now();try{let y=await h(m,{body:JSON.stringify(v),headers:{"Content-Type":"application/json"},method:"POST"});c({kind:"success",latencyMs:Math.round(performance.now()-x),status:y.status})}catch(y){c({kind:"error",message:Jt(y)})}finally{s(!1)}},"sendTest"),f=n(()=>{ot(d())},"onSendTest"),p=n(m=>{r(m.target.value)},"onWebhookUrlChange");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"log-drains",children:[(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-3",children:(0,P.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"drain-cf-link",href:$_,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")},void 0,!1)},void 0,!1),(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"drain-readonly-note",children:t("Lunora does not ship logs itself \u2014 forwarding is handled by Cloudflare. Configure a destination below, then test your collector.")},void 0,!1),(0,P.jsxDEV)("section",{className:"flex flex-col gap-3","data-testid":"drain-destinations",children:[(0,P.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Cloudflare destinations")},void 0,!1),e.map(m=>(0,P.jsxDEV)(t1t,{destination:m},m.id,!1))]},void 0,!0),(0,P.jsxDEV)(Rt,{className:"py-0",children:(0,P.jsxDEV)(Xt,{className:"p-3",children:(0,P.jsxDEV)("section",{"data-testid":"drain-webhook",children:[(0,P.jsxDEV)("h3",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Webhook test")},void 0,!1),(0,P.jsxDEV)("p",{className:"mb-2 text-sm text-muted-foreground",children:t("POST a sample Lunora request-log envelope to your collector to confirm it is reachable.")},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,P.jsxDEV)(mo,{className:"min-w-[20rem] flex-1","data-testid":"drain-webhook-url",onChange:p,placeholder:t("https://example.com/logs"),type:"url",value:o},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"drain-webhook-test",disabled:a||o.trim()==="",onClick:f,children:t(a?"Sending\u2026":"Send test event")},void 0,!1)]},void 0,!0),i!==null&&(0,P.jsxDEV)("p",{className:i.kind==="success"?"mt-2 text-sm text-muted-foreground":"mt-2 text-sm text-destructive","data-testid":"drain-webhook-result",role:i.kind==="error"?"alert":void 0,children:i.kind==="success"?t("Delivered \u2014 status {status} in {latency}ms",{latency:i.latencyMs,status:i.status}):t("Failed: {message}",{message:i.message})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"LogDrainsPanel"),r1t={kind:"idle"},n1t=n(({loadCronJobs:t,runCronJob:e}={})=>{let o=Wt(),r=Ve(),[a,s]=(0,st.useState)({}),i=mi(["lunora-cron-jobs",t?"custom":"default"],()=>(t??(()=>o.getCronJobs()))()),{data:c,error:d}=i,f=(0,st.useMemo)(()=>e!==void 0?e:t===void 0?m=>o.runCronJob(m):void 0,[o,t,e]),p=n(async m=>{if(f!==void 0){s(h=>({...h,[m]:{kind:"running"}}));try{await f(m),s(h=>({...h,[m]:{kind:"ok"}})),i.refetch()}catch(h){s(v=>({...v,[m]:{kind:"error",message:Jt(h)}}))}}},"run");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[d!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:d},void 0,!1),c?.length===0&&(0,P.jsxDEV)(co,{description:r("Triggers declared with the cronJobs() builder appear here."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,P.jsxDEV)("circle",{cx:"12",cy:"12",r:"9"},void 0,!1),(0,P.jsxDEV)("path",{d:"M12 7.5V12l4 2"},void 0,!1)]},void 0,!0),testId:"cron-empty",title:r("No cron triggers.")},void 0,!1),c!==void 0&&c.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"cron-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("name")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("schedule")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("target")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("shard")},void 0,!1),f!==void 0&&(0,P.jsxDEV)(Le,{"aria-label":r("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(m=>{let h=a[m.name]??r1t;return(0,P.jsxDEV)(It,{"data-testid":`cron-row-${m.name}`,children:[(0,P.jsxDEV)(Ne,{children:m.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs tabular-nums",children:m.cron},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)("span",{className:"flex items-center gap-2",children:[m.workflow===void 0?(0,P.jsxDEV)(Pt,{variant:"outline",children:r("function")},void 0,!1):(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("workflow")},void 0,!1),(0,P.jsxDEV)("span",{className:"font-mono text-xs",children:m.workflow??m.functionPath},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(Ne,{children:m.shardKey??""},void 0,!1),f!==void 0&&(0,P.jsxDEV)(Ne,{className:"text-right",children:(0,P.jsxDEV)("span",{className:"flex items-center justify-end gap-2",children:[h.kind==="ok"&&(0,P.jsxDEV)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${m.name}`,children:r("ran")},void 0,!1),h.kind==="error"&&(0,P.jsxDEV)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${m.name}`,role:"alert",children:h.message},void 0,!1),(0,P.jsxDEV)(pa,{confirmLabel:r("Run now?"),disabled:h.kind==="running",onConfirm:n(()=>{ot(p(m.name))},"onConfirm"),testId:`cron-run-${m.name}`,children:h.kind==="running"?r("Running\u2026"):r("Run now")},void 0,!1)]},void 0,!0)},void 0,!1)]},`${m.cron}:${m.name}`,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"CronTriggersPanel"),a1t=n(t=>Number.isFinite(t)?pn(t,"\u2014"):"\u2014","formatScheduledFor"),s1t=n(t=>{let e=(0,Yt.c)(34),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{loadJobs:r,removeJob:a,retryJob:s}=o,i=Wt(),c=Ve(),d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-dead-jobs"],e[2]=d):d=e[2];let f;e[3]!==i||e[4]!==r?(f=n(async()=>(await(r??(()=>i.listDeadJobs()))()).toSorted(i1t),"t3"),e[3]=i,e[4]=r,e[5]=f):f=e[5];let p=mi(d,f),m=p.data,[h,v]=(0,st.useState)(void 0),x=p.error??h,y=r===void 0,b;e[6]!==i||e[7]!==y||e[8]!==s?(b=s??(y?U=>i.retryDeadJob(U):void 0),e[6]=i,e[7]=y,e[8]=s,e[9]=b):b=e[9];let S=b,w;e[10]!==i||e[11]!==y||e[12]!==a?(w=a??(y?U=>i.removeDeadJob(U):void 0),e[10]=i,e[11]=y,e[12]=a,e[13]=w):w=e[13];let C=w,F;e[14]!==p?(F=n(()=>{p.refetch()},"t6"),e[14]=p,e[15]=F):F=e[15],us(F,!0);let T;e[16]!==p?(T=n(async U=>{v(void 0);try{await U,p.refetch()}catch(W){v(Jt(W))}},"t7"),e[16]=p,e[17]=T):T=e[17];let E=T,k=S!==void 0||C!==void 0,O;e[18]!==x?(O=x!==void 0&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:x},void 0,!1),e[18]=x,e[19]=O):O=e[19];let D;e[20]!==m?.length||e[21]!==c?(D=m?.length===0&&(0,P.jsxDEV)(co,{description:c("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"},void 0,!1)},void 0,!1),testId:"dlq-empty",title:c("No dead-letter jobs.")},void 0,!1),e[20]=m?.length,e[21]=c,e[22]=D):D=e[22];let M;e[23]!==E||e[24]!==k||e[25]!==m||e[26]!==C||e[27]!==S||e[28]!==c?(M=m!==void 0&&m.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"dlq-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:c("function")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("attempts")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("last tried")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("pool")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("shard")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("id")},void 0,!1),k&&(0,P.jsxDEV)(Le,{"aria-label":c("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:m.map(U=>(0,P.jsxDEV)(It,{"data-testid":`dlq-row-${U.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:U.functionPath},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:U.attempts??0},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:a1t(U.scheduledFor)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:U.pool??""},void 0,!1),(0,P.jsxDEV)(Ne,{children:U.shardKey??""},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:U.id},void 0,!1),k&&(0,P.jsxDEV)(Ne,{className:"text-right",children:(0,P.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[S!==void 0&&(0,P.jsxDEV)(dt,{"data-testid":`dlq-retry-${U.id}`,onClick:n(()=>{ot(E(S(U.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:c("Retry")},void 0,!1),C!==void 0&&(0,P.jsxDEV)(pa,{confirmLabel:c("Drop job?"),onConfirm:n(()=>{ot(E(C(U.id)))},"onConfirm"),testId:`dlq-remove-${U.id}`,children:c("Drop")},void 0,!1)]},void 0,!0)},void 0,!1)]},U.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[23]=E,e[24]=k,e[25]=m,e[26]=C,e[27]=S,e[28]=c,e[29]=M):M=e[29];let L;return e[30]!==M||e[31]!==O||e[32]!==D?(L=(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[O,D,M]},void 0,!0),e[30]=M,e[31]=O,e[32]=D,e[33]=L):L=e[33],L},"DeadLetterJobs");function i1t(t,e){return(e.attempts??0)-(t.attempts??0)}n(i1t,"_temp$5");var HZ=n(t=>{let e=(0,Yt.c)(8),{label:o,testId:r,value:a}=t,s;e[0]!==o?(s=(0,P.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:o},void 0,!1),e[0]=o,e[1]=s):s=e[1];let i;e[2]!==r||e[3]!==a?(i=(0,P.jsxDEV)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":r,children:a},void 0,!1),e[2]=r,e[3]=a,e[4]=i):i=e[4];let c;return e[5]!==s||e[6]!==i?(c=(0,P.jsxDEV)(Rt,{className:"flex-1 py-0",children:(0,P.jsxDEV)(Xt,{className:"flex flex-col gap-1 p-4",children:[s,i]},void 0,!0)},void 0,!1),e[5]=s,e[6]=i,e[7]=c):c=e[7],c},"StatTile"),l1t=n(t=>{let e=(0,Yt.c)(25),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{loadStatus:r}=o,a=Wt(),s=Ve(),i=r===void 0,c;e[2]!==i?(c=["lunora-scheduler-status",i],e[2]=i,e[3]=c):c=e[3];let d;e[4]!==a||e[5]!==r?(d=n(async()=>{let w=await(r??(()=>a.schedulerStatus()))();return{...w,pools:w.pools.toSorted(c1t)}},"t4"),e[4]=a,e[5]=r,e[6]=d):d=e[6];let f=mi(c,d),{data:p,error:m}=f,h;e[7]!==f?(h=n(()=>{f.refetch()},"t5"),e[7]=f,e[8]=h):h=e[8],us(h,!0);let v;e[9]!==m?(v=m!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:m},void 0,!1),e[9]=m,e[10]=v):v=e[10];let x;e[11]!==p||e[12]!==s?(x=p!==void 0&&(0,P.jsxDEV)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,P.jsxDEV)(HZ,{label:s("backlog"),testId:"pools-backlog",value:p.backlog},void 0,!1),(0,P.jsxDEV)(HZ,{label:s("in flight"),testId:"pools-inflight",value:p.inFlight},void 0,!1),(0,P.jsxDEV)(HZ,{label:s("pools"),testId:"pools-count",value:p.pools.length},void 0,!1)]},void 0,!0),e[11]=p,e[12]=s,e[13]=x):x=e[13];let y;e[14]!==p?.pools.length||e[15]!==s?(y=p?.pools.length===0&&(0,P.jsxDEV)(co,{description:s("Pools created with createWorkpool appear here once they have activity."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M4 7h16M4 12h16M4 17h16"},void 0,!1)},void 0,!1),testId:"pools-empty",title:s("No workpools.")},void 0,!1),e[14]=p?.pools.length,e[15]=s,e[16]=y):y=e[16];let b;e[17]!==p||e[18]!==s?(b=p!==void 0&&p.pools.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"pools-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:s("pool")},void 0,!1),(0,P.jsxDEV)(Le,{children:s("queued")},void 0,!1),(0,P.jsxDEV)(Le,{children:s("in flight")},void 0,!1),(0,P.jsxDEV)(Le,{children:s("max concurrency")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:p.pools.map(u1t)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[17]=p,e[18]=s,e[19]=b):b=e[19];let S;return e[20]!==v||e[21]!==x||e[22]!==y||e[23]!==b?(S=(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[v,x,y,b]},void 0,!0),e[20]=v,e[21]=x,e[22]=y,e[23]=b,e[24]=S):S=e[24],S},"SchedulerPoolsPanel");function c1t(t,e){return e.queued-t.queued}n(c1t,"_temp$4");function u1t(t){return(0,P.jsxDEV)(It,{"data-testid":`pools-row-${t.name}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:t.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:t.queued},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:[t.inFlight," / ",t.maxConcurrency]},void 0,!0),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:t.maxConcurrency},void 0,!1)]},t.name,!0)}n(u1t,"_temp2$2");var d1t=["jobs","dead","pools","cron"],f1t=n(t=>{let e=(0,Yt.c)(41),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{loadCronJobs:r,scheduledCancel:a,scheduledLoad:s}=o,i=Ve(),[c,d]=(0,st.useState)("jobs"),f;e[2]!==i?(f=i("Cron triggers"),e[2]=i,e[3]=f):f=e[3];let p;e[4]!==i?(p=i("Dead letter"),e[4]=i,e[5]=p):p=e[5];let m;e[6]!==i?(m=i("Scheduled jobs"),e[6]=i,e[7]=m):m=e[7];let h;e[8]!==i?(h=i("Pools"),e[8]=i,e[9]=h):h=e[9];let v;e[10]!==f||e[11]!==p||e[12]!==m||e[13]!==h?(v={cron:f,dead:p,jobs:m,pools:h},e[10]=f,e[11]=p,e[12]=m,e[13]=h,e[14]=v):v=e[14];let x=v,y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=n(D=>{d(D.currentTarget.dataset.view)},"t7"),e[15]=y):y=e[15];let b=y,S;e[16]!==i?(S=i("Schedule view"),e[16]=i,e[17]=S):S=e[17];let w;e[18]!==c||e[19]!==x?(w=d1t.map(D=>(0,P.jsxDEV)(dt,{"aria-selected":c===D,"data-testid":`schedule-view-${D}`,"data-view":D,onClick:b,role:"tab",size:"sm",type:"button",variant:c===D?"default":"outline",children:x[D]},D,!1)),e[18]=c,e[19]=x,e[20]=w):w=e[20];let C;e[21]!==S||e[22]!==w?(C=(0,P.jsxDEV)("div",{"aria-label":S,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:w},void 0,!1),e[21]=S,e[22]=w,e[23]=C):C=e[23];let F;e[24]!==a||e[25]!==s||e[26]!==c?(F=c==="jobs"&&(0,P.jsxDEV)(eTe,{cancelJob:a,loadJobs:s},void 0,!1),e[24]=a,e[25]=s,e[26]=c,e[27]=F):F=e[27];let T;e[28]!==c?(T=c==="dead"&&(0,P.jsxDEV)(s1t,{},void 0,!1),e[28]=c,e[29]=T):T=e[29];let E;e[30]!==c?(E=c==="pools"&&(0,P.jsxDEV)(l1t,{},void 0,!1),e[30]=c,e[31]=E):E=e[31];let k;e[32]!==r||e[33]!==c?(k=c==="cron"&&(0,P.jsxDEV)(n1t,{loadCronJobs:r},void 0,!1),e[32]=r,e[33]=c,e[34]=k):k=e[34];let O;return e[35]!==C||e[36]!==F||e[37]!==T||e[38]!==E||e[39]!==k?(O=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[C,F,T,E,k]},void 0,!0),e[35]=C,e[36]=F,e[37]=T,e[38]=E,e[39]=k,e[40]=O):O=e[40],O},"SchedulePanel"),MOe=80,p1t=n(t=>{if(t===void 0)return"";let e=JSON.stringify(t);return e.length>MOe?`${e.slice(0,MOe)}\u2026`:e},"formatArguments"),m1t=n(t=>{let e=[];for(let o of t){let r=o.id.toString();if(o.subscriptions.length===0){e.push({admin:o.admin,connectionId:o.id,key:`c${r}`,subscription:null});continue}o.subscriptions.forEach((a,s)=>{e.push({admin:o.admin,connectionId:o.id,key:`c${r}-s${s.toString()}`,subscription:a})})}return e},"toRows"),jZ=(0,P.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1),h1t=n(t=>{let e=(0,Yt.c)(20),{initialShardKey:o}=t,r=Ve(),[a,s]=(0,st.useState)(o??""),i;e[0]!==a?(i=a.trim(),e[0]=a,e[1]=i):i=e[1];let c=na(i,400),d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d={},e[2]=d):d=e[2];let f;e[3]!==c?(f={keepPreviousData:!0,shardKey:c},e[3]=c,e[4]=f):f=e[4];let{data:p,error:m,refetch:h}=_o(vt.listSubscriptions,d,f);us(h,!0);let v;if(e[5]!==m||e[6]!==p||e[7]!==a||e[8]!==r){let x=p===void 0?[]:m1t(p.connections),y;e[10]!==a?(y=(0,P.jsxDEV)(Qr,{onChange:s,testId:"subs-shard-input",value:a},void 0,!1),e[10]=a,e[11]=y):y=e[11];let b;e[12]!==p||e[13]!==r?(b=p!==void 0&&(0,P.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("{count} connections",{count:p.totalConnections})},void 0,!1),(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("{count} subscriptions",{count:p.totalSubscriptions})},void 0,!1)]},void 0,!0),e[12]=p,e[13]=r,e[14]=b):b=e[14];let S;e[15]!==y||e[16]!==b?(S=(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[y,b]},void 0,!0),e[15]=y,e[16]=b,e[17]=S):S=e[17];let w;e[18]!==m?(w=m!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"subs-error",role:"alert",children:m},void 0,!1),e[18]=m,e[19]=w):w=e[19],v=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[S,w,m===null&&p!==void 0&&x.length===0&&(0,P.jsxDEV)(co,{description:r("Active WebSocket subscriptions on this shard."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},void 0,!1)},void 0,!1),testId:"subs-empty",title:r("No active subscriptions.")},void 0,!1),m===null&&x.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"subs-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("Connection")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("Function path")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("Table")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("Arguments")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:x.map(C=>{let{subscription:F}=C,T=p1t(F?.args);return(0,P.jsxDEV)(It,{"data-testid":"subs-row",children:[(0,P.jsxDEV)(Ne,{className:"font-medium tabular-nums",children:(0,P.jsxDEV)("span",{className:"inline-flex items-center gap-1.5",children:["#",C.connectionId,C.admin&&(0,P.jsxDEV)(Pt,{variant:"outline",children:r("admin")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:F?.functionPath??jZ},void 0,!1),(0,P.jsxDEV)(Ne,{children:F?.table??jZ},void 0,!1),(0,P.jsxDEV)(Ne,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:T||void 0,children:T||jZ},void 0,!1)]},C.key,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[5]=m,e[6]=p,e[7]=a,e[8]=r,e[9]=v}else v=e[9];return v},"SubscriptionsPanel"),JOe=new Set(["active","trialing"]),g1t=new Set(["past_due","unpaid"]),Nl=n((t,e)=>{if(t[e]!==void 0)return t[e];let o=t.__doc__;if(typeof o=="string")try{let r=JSON.parse(o);if(r!==null&&typeof r=="object"&&!Array.isArray(r))return r[e]}catch{}},"readField"),Xf=n(t=>typeof t=="string"?t:typeof t=="number"||typeof t=="bigint"||typeof t=="boolean"?String(t):"","text"),v1t=n(t=>JOe.has(t)?"default":g1t.has(t)?"destructive":"outline","badgeVariant"),x1t=n(({limit:t=100})=>{let e=Ve(),o=_o(vt.readTablePage,{filters:[],limit:t,offset:0,orderBy:[],search:"",table:"subscriptions"}),r=_o(vt.readTablePage,{filters:[],limit:25,offset:0,orderBy:[],search:"",table:"events"});us(()=>{o.refetch(),r.refetch()},!0);let a=o.data?.rows??[],s=r.data?.rows??[],i=o.error??r.error,c=a.filter(f=>JOe.has(Xf(Nl(f,"state")))).length,d=s.toSorted((f,p)=>Number(Nl(p,"processedAt")??0)-Number(Nl(f,"processedAt")??0));return(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,P.jsxDEV)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,P.jsxDEV)(Rt,{className:"justify-between gap-0 py-0",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("Subscriptions")},void 0,!1),(0,P.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,P.jsxDEV)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:c},void 0,!1),(0,P.jsxDEV)(Pt,{variant:"default",children:e("{count} active",{count:c})},void 0,!1)]},void 0,!0)]},void 0,!0),(0,P.jsxDEV)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:e("{total} total",{total:a.length})},void 0,!1)]},void 0,!0)},void 0,!1),i===null?void 0:(0,P.jsxDEV)("p",{className:"text-sm text-destructive",children:i},void 0,!1),a.length===0&&!o.isLoading?(0,P.jsxDEV)(co,{testId:"payments-empty",title:e("No subscriptions yet")},void 0,!1):(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Provider")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Reference")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Plan")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("State")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Renews")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:a.map(f=>{let p=Xf(Nl(f,"state"));return(0,P.jsxDEV)(It,{"data-testid":"payment-subscription-row",children:[(0,P.jsxDEV)(Ne,{children:Xf(Nl(f,"provider"))},void 0,!1),(0,P.jsxDEV)(Ne,{children:Xf(Nl(f,"referenceId"))},void 0,!1),(0,P.jsxDEV)(Ne,{children:Xf(Nl(f,"priceId"))},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(Pt,{variant:v1t(p),children:p},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{children:pn(Nl(f,"currentPeriodEnd"))},void 0,!1)]},Xf(Nl(f,"providerSubscriptionId")),!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:[(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("Recent webhook events")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{children:(0,P.jsxDEV)(To,{children:d.map(f=>(0,P.jsxDEV)(It,{"data-testid":"payment-event-row",children:[(0,P.jsxDEV)(Ne,{children:Xf(Nl(f,"provider"))},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-medium",children:Xf(Nl(f,"type"))},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground",children:Xf(Nl(f,"providerEventId"))},void 0,!1),(0,P.jsxDEV)(Ne,{children:pn(Nl(f,"processedAt"))},void 0,!1)]},Xf(Nl(f,"providerEventId")),!0))},void 0,!1)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"PaymentsPanel"),POe=["read","insert","update","delete"],y1t=n((t,e)=>({delete:t("Delete"),insert:t("Insert"),read:t("Read"),update:t("Update")})[e],"operationLabel$1"),I1t=n(t=>{let e=new Set;for(let o of t?.advisories??[])if(o.name==="rls_uncovered_table"){let{table:r}=o.metadata;typeof r=="string"&&r!==""&&e.add(r)}return e},"uncoveredTables"),b1t=n((t,e,o)=>{let r=new Map,a=n(s=>{let i=r.get(s);if(i!==void 0)return i;let c={cells:{delete:{},insert:{},read:{},update:{}},maskedColumns:[],table:s,uncovered:o.has(s)};return r.set(s,c),c},"ensure");for(let s of t)a(s.table).cells[s.on]={procedure:s.procedure};for(let s of e){let i=a(s.table);i.maskedColumns.includes(s.column)||i.maskedColumns.push(s.column)}for(let s of o)a(s);return[...r.values()].toSorted((s,i)=>s.table.localeCompare(i.table))},"buildRows"),S1t=n(t=>{let e=(0,Yt.c)(16),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{onProbe:r}=o,a=Ve(),s,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(s={},i={live:!0},e[2]=s,e[3]=i):(s=e[2],i=e[3]);let c=_o(vt.rlsPolicies,s,i),d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d={},e[4]=d):d=e[4];let f=_o(vt.maskPolicies,d),p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p={},e[5]=p):p=e[5];let m=_o(vt.getAdvisories,p),h;if(e[6]!==m.data||e[7]!==f.data||e[8]!==r||e[9]!==c||e[10]!==a){let v=null;c.data!==void 0&&(v=Array.isArray(c.data.policies)?c.data.policies:[]);let x=Array.isArray(f.data?.columns)?f.data.columns:[],y=m.data??null,{error:b,liveError:S}=c,w=v===null?[]:b1t(v,x,I1t(y)),C;e[12]!==S?(C=(0,P.jsxDEV)("div",{className:"flex items-center justify-end",children:(0,P.jsxDEV)(Rl,{message:S,prefix:"pm"},void 0,!1)},void 0,!1),e[12]=S,e[13]=C):C=e[13];let F;e[14]!==b?(F=b!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pm-error",role:"alert",children:b},void 0,!1),e[14]=b,e[15]=F):F=e[15],h=(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-matrix",children:[C,F,v!==null&&w.length===0?(0,P.jsxDEV)(co,{description:a("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),testId:"pm-empty",title:a("No policy")},void 0,!1):(0,P.jsxDEV)(Ao,{"data-testid":"pm-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:a("Table")},void 0,!1),POe.map(T=>(0,P.jsxDEV)(Le,{children:y1t(a,T)},T,!1)),(0,P.jsxDEV)(Le,{children:a("Masked columns")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:w.map(T=>(0,P.jsxDEV)(It,{"data-testid":`pm-row-${T.table}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:(0,P.jsxDEV)("span",{className:"flex items-center gap-1.5",children:[T.table,T.uncovered&&(0,P.jsxDEV)(Pt,{"data-testid":`pm-uncovered-${T.table}`,title:a("Uncovered \u2014 reachable without a policy"),variant:"destructive",children:a("Uncovered \u2014 reachable without a policy")},void 0,!1)]},void 0,!0)},void 0,!1),POe.map(E=>{let k=T.cells[E];return(0,P.jsxDEV)(Ne,{"data-testid":`pm-cell-${T.table}-${E}`,children:k.procedure===void 0?(0,P.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:a("No policy")},void 0,!1):(0,P.jsxDEV)("span",{className:"flex flex-col gap-1",children:[(0,P.jsxDEV)(Pt,{variant:"secondary",children:a("Covered by {procedure}",{procedure:k.procedure})},void 0,!1),r!==void 0&&(0,P.jsxDEV)(dt,{className:"h-auto justify-start p-0 text-[11px]","data-testid":`pm-probe-${T.table}-${E}`,onClick:n(()=>{r(T.table,E,k.procedure??"")},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Probe this")},void 0,!1)]},void 0,!0)},E,!1)}),(0,P.jsxDEV)(Ne,{children:T.maskedColumns.length===0?(0,P.jsxDEV)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,P.jsxDEV)("span",{className:"flex flex-wrap gap-1",children:T.maskedColumns.map(w1t)},void 0,!1)},void 0,!1)]},T.table,!0))},void 0,!1)]},void 0,!0)]},void 0,!0),e[6]=m.data,e[7]=f.data,e[8]=r,e[9]=c,e[10]=a,e[11]=h}else h=e[11];return h},"PermissionsMatrix");function w1t(t){return(0,P.jsxDEV)(Pt,{variant:"outline",children:t},t,!1)}n(w1t,"_temp$3");var C1t=ro(vt.runAs),F1t=n(()=>{let t=Wt();return async({args:e,functionPath:o,shardKey:r="",userId:a})=>{let s=C1t;try{return{kind:"allowed",value:await t.query(s,{args:e,functionPath:o,userId:a},lo(r))}}catch(i){return{kind:"denied",message:i instanceof Error?i.message:String(i)}}}},"useRunAsProbe"),R1t=n(t=>t===void 0?"undefined":JSON.stringify(t,null,2),"formatValue"),E1t=n(({functions:t,prefill:e,runAsIdentity:o=!1}={})=>{let r=Wt(),a=Ve(),s=F1t(),[i,c]=(0,st.useState)(null),[d,f]=(0,st.useState)(null),p=t??i??[],[m,h]=(0,st.useState)(""),[v,x]=(0,st.useState)("{}"),[y,b]=(0,st.useState)(""),[S,w]=(0,st.useState)(""),[C,F]=(0,st.useState)(!1),[T,E]=(0,st.useState)(null),[k,O]=(0,st.useState)(null),D=(0,st.useRef)(-1);(0,st.useEffect)(()=>{if(t!==void 0)return;let N=!1;return r.listFunctions().then(_=>(N||c(_),_)).catch(_=>{N||f(Jt(_))}),()=>{N=!0}},[r,t]),(0,st.useEffect)(()=>{if(e===void 0||D.current===e.nonce)return;D.current=e.nonce;let N=e.functionPath;queueMicrotask(()=>{h(N),E(null)})},[e]);let M=m===""?p[0]?.path??"":m,L=n(async()=>{if(M==="")return;let N;try{N=v.trim()===""?{}:JSON.parse(v)}catch(_){O(a("Invalid JSON args: {message}",{message:_.message})),E(null);return}O(null),F(!0);try{let _=await s({args:N,functionPath:M,shardKey:y.trim(),userId:S.trim()});E(_)}finally{F(!1)}},"run"),U=n(()=>{ot(L())},"runOnce"),W=n(N=>{h(N.target.value)},"onSelectChange"),V=n(N=>{x(N.target.value)},"onArgsChange"),j=n(N=>{w(N.target.value)},"onUserIdChange");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-playground",children:[d!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pp-discover-error",role:"alert",children:d},void 0,!1),!o&&(0,P.jsxDEV)(co,{description:a("Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS."),testId:"pp-gate",title:a("Set `runAsIdentity` to forge an identity and probe access.")},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,P.jsxDEV)(Go,{htmlFor:"pp-function",children:a("Function")},void 0,!1),(0,P.jsxDEV)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","data-testid":"pp-function",id:"pp-function",onChange:W,value:M,children:p.map(N=>(0,P.jsxDEV)("option",{value:N.path,children:[N.path," (",N.kind,")"]},N.path,!0))},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,P.jsxDEV)(Go,{htmlFor:"pp-args",children:a("Arguments")},void 0,!1),(0,P.jsxDEV)(Ff,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"pp-args",id:"pp-args",onChange:V,value:v},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Qr,{onChange:b,testId:"pp-shard",value:y},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,P.jsxDEV)(Go,{htmlFor:"pp-user",children:a("Run as (userId)")},void 0,!1),(0,P.jsxDEV)(mo,{"aria-label":a("Identity (userId) to run as"),className:"font-mono text-xs","data-testid":"pp-user",id:"pp-user",onChange:j,placeholder:a("Leave empty to run as admin"),value:S},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,P.jsxDEV)(dt,{"data-testid":"pp-run",disabled:!o||C||M==="",onClick:U,type:"button",children:a(C?"Probing\u2026":"Run probe")},void 0,!1),S.trim()!==""&&(0,P.jsxDEV)(Pt,{"data-testid":"pp-as-badge",variant:"secondary",children:a("as {userId}",{userId:S.trim()})},void 0,!1)]},void 0,!0)]},void 0,!0),k!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pp-args-error",role:"alert",children:k},void 0,!1),T!==null&&T.kind==="allowed"&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-allowed",children:[(0,P.jsxDEV)(Pt,{variant:"secondary",children:a("Allowed")},void 0,!1),(0,P.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-result",children:R1t(T.value)},void 0,!1)]},void 0,!0),T!==null&&T.kind==="denied"&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-denied",children:[(0,P.jsxDEV)(Pt,{variant:"destructive",children:a("Denied")},void 0,!1),(0,P.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"pp-denied",role:"alert",children:T.message},void 0,!1)]},void 0,!0)]},void 0,!0)},"PermissionsPlayground"),A1t="/__lunora/policy-scaffold",T1t={"already-wired":"That procedure already has an rls(...) policy wired in.","file-exists":"A policy file with that name already exists \u2014 pick another name or edit it by hand.","invalid-identifier":"Name, table, and policy-set must be plain identifiers (letters, digits, _ or $).","unknown-procedure":"No exported procedure was found at that file path.","unsupported-procedure-shape":"That procedure uses the bare query({\u2026}) form \u2014 convert it to the builder form (c.use(\u2026).query(\u2026)) before wiring RLS."},k1t=n(async t=>{let e=await fetch(A1t,{body:JSON.stringify(t),headers:{"Content-Type":"application/json"},method:"POST"}),o=await e.json();if(o.needsManualEdit===!0)return{kind:"needs-manual-edit",message:o.message??"This change must be made by hand."};if(e.ok)return{diagnostics:o.diagnostics??[],kind:"ok",label:o.fileName??o.exportName??""};let r=o.error;return{kind:"error",message:r===void 0?`policy scaffold failed (${String(e.status)})`:T1t[r]??r}},"applyPolicyScaffold"),OOe={exportName:"",filePath:"",policyName:"",policies:"",tableName:""},M1t=n(()=>{let t=Ve(),[e,o]=(0,st.useState)(null),[r,a]=(0,st.useState)(!1),[s,i]=(0,st.useState)(null),[c,d]=(0,st.useState)(OOe),f=n(b=>{let S=b.target.name,{value:w}=b.target;d(C=>({...C,[S]:w}))},"onFieldChange"),p=n(()=>{o(null),d(OOe)},"reset"),m=n(async b=>{a(!0),i(null);try{let S=await k1t(b);i(S),S.kind==="ok"&&p()}catch(S){i({kind:"error",message:S instanceof Error?S.message:String(S)})}finally{a(!1)}},"submit"),h=n(()=>{ot(m({kind:"scaffoldPolicy",name:c.policyName.trim(),table:c.tableName.trim()}))},"onSubmitScaffold"),v=n(()=>{ot(m({exportName:c.exportName.trim(),filePath:c.filePath.trim(),kind:"wireRls",policies:c.policies.trim()}))},"onSubmitWire"),x=n(()=>{i(null),o("scaffold")},"openScaffold"),y=n(()=>{i(null),o("wire")},"openWire");return(0,P.jsxDEV)(Rt,{"data-testid":"policy-scaffolder",size:"sm",children:[(0,P.jsxDEV)(nu,{children:[(0,P.jsxDEV)(au,{children:t("Scaffold access rules")},void 0,!1),(0,P.jsxDEV)(Vg,{children:t("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only.")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Xt,{children:[(0,P.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,P.jsxDEV)(dt,{"data-testid":"policy-scaffolder-new",onClick:x,size:"xs",type:"button",variant:e==="scaffold"?"default":"outline",children:t("New policy file")},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"policy-scaffolder-wire",onClick:y,size:"xs",type:"button",variant:e==="wire"?"default":"outline",children:t("Wire into a procedure")},void 0,!1)]},void 0,!0),e==="scaffold"&&(0,P.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-new-form",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-name",children:t("Policy name")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-name",id:"policy-scaffolder-name",name:"policyName",onChange:f,value:c.policyName},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-table",children:t("Table name")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-table",id:"policy-scaffolder-table",name:"tableName",onChange:f,value:c.tableName},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"policy-scaffolder-create",disabled:r||c.policyName.trim()===""||c.tableName.trim()==="",onClick:h,size:"xs",type:"button",children:t(r?"Creating\u2026":"Create policy file")},void 0,!1),(0,P.jsxDEV)(dt,{onClick:p,size:"xs",type:"button",variant:"ghost",children:t("Cancel")},void 0,!1)]},void 0,!0),e==="wire"&&(0,P.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-wire-form",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-file",children:t("Procedure file path")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-file",id:"policy-scaffolder-file",name:"filePath",onChange:f,value:c.filePath},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-export",children:t("Exported procedure")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-export",id:"policy-scaffolder-export",name:"exportName",onChange:f,value:c.exportName},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-policies",children:t("Policy set identifier")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-policies",id:"policy-scaffolder-policies",name:"policies",onChange:f,value:c.policies},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"policy-scaffolder-apply",disabled:r||c.filePath.trim()===""||c.exportName.trim()===""||c.policies.trim()==="",onClick:v,size:"xs",type:"button",children:t(r?"Wiring\u2026":"Wire RLS")},void 0,!1),(0,P.jsxDEV)(dt,{onClick:p,size:"xs",type:"button",variant:"ghost",children:t("Cancel")},void 0,!1)]},void 0,!0),s?.kind==="error"&&(0,P.jsxDEV)("p",{className:"mt-3 text-sm text-destructive","data-testid":"policy-scaffolder-error",role:"alert",children:s.message},void 0,!1),s?.kind==="needs-manual-edit"&&(0,P.jsxDEV)("p",{className:"mt-3 text-sm text-amber-600 dark:text-amber-500","data-testid":"policy-scaffolder-manual",role:"alert",children:t("This change must be made by hand \u2014 the scaffolder only adds new, deny-by-default rules.")},void 0,!1),s?.kind==="ok"&&(0,P.jsxDEV)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"policy-scaffolder-ok",children:[(0,P.jsxDEV)("p",{className:"text-sm text-emerald-600 dark:text-emerald-500",children:t("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.",{label:s.label})},void 0,!1),s.diagnostics.length>0&&(0,P.jsxDEV)("ul",{className:"flex flex-col gap-0.5","data-testid":"policy-scaffolder-diagnostics",children:s.diagnostics.map(b=>(0,P.jsxDEV)("li",{className:"font-mono text-[11px] text-destructive",children:b},b,!1))},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)},"PolicyScaffolder"),P1t=n(({functions:t,runAsIdentity:e=!1,schemaEditable:o=!1}={})=>{let r=Ve(),[a,s]=(0,st.useState)(void 0),i=n((c,d,f)=>{f!==""&&s(p=>({functionPath:f,nonce:(p?.nonce??0)+1}))},"onProbe");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-8","data-testid":"lunora-permissions",children:[(0,P.jsxDEV)("section",{className:"flex flex-col gap-3",children:[(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Permissions")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(S1t,{onProbe:i},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("section",{className:"flex flex-col gap-3",children:(0,P.jsxDEV)(Rt,{className:"gap-0 py-0",children:[(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Probe")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Xt,{className:"px-4 py-4",children:[(0,P.jsxDEV)("p",{className:"mb-3 text-sm text-muted-foreground",children:r("Pick a function and an identity, then run it to see the access outcome.")},void 0,!1),(0,P.jsxDEV)(E1t,{functions:t,prefill:a,runAsIdentity:e},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1),o&&(0,P.jsxDEV)("section",{className:"flex flex-col gap-2",children:(0,P.jsxDEV)(M1t,{},void 0,!1)},void 0,!1)]},void 0,!0)},"PermissionsPanel"),O1t=n(()=>{let t=(0,Yt.c)(17),e=Ve(),o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={},t[0]=o):o=t[0];let{data:r,error:a}=_o(vt.listQueues,o),s=r!==void 0,i;t[1]!==r?(i=Array.isArray(r?.queues)?[...r.queues].toSorted(N1t):[],t[1]=r,t[2]=i):i=t[2];let c=i,d;t[3]!==a?(d=a!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"queues-error",role:"alert",children:a},void 0,!1),t[3]=a,t[4]=d):d=t[4];let f;t[5]!==e?(f=e("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),t[5]=e,t[6]=f):f=t[6];let p;t[7]!==f?(p=(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:f},void 0,!1),t[7]=f,t[8]=p):p=t[8];let m;t[9]!==s||t[10]!==c||t[11]!==e?(m=s&&c.length===0?(0,P.jsxDEV)(co,{description:e("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:e("No queues defined")},void 0,!1):(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"queues-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Export")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Queue")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Mode")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Binding")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Dead-letter")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(D1t)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[9]=s,t[10]=c,t[11]=e,t[12]=m):m=t[12];let h;return t[13]!==d||t[14]!==p||t[15]!==m?(h=(0,P.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-queues-panel",children:[d,p,m]},void 0,!0),t[13]=d,t[14]=p,t[15]=m,t[16]=h):h=t[16],h},"QueuesPanel");function N1t(t,e){return t.exportName.localeCompare(e.exportName)}n(N1t,"_temp$2");function D1t(t){return(0,P.jsxDEV)(It,{"data-testid":`queues-row-${t.exportName}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:t.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:t.mode},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:t.binding},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:t.deadLetterQueue??"\u2014"},void 0,!1)]},t.exportName,!0)}n(D1t,"_temp2$1");var _1t=ro(vt.runSql),L1t=n((t,e)=>{let o=Wt(),[r,a]=(0,st.useState)(void 0),[s,i]=(0,st.useState)(void 0),[c,d]=(0,st.useState)(!0),f=(0,st.useCallback)(async p=>{d(!0);try{let m=await o.query(_1t,{sql:t},lo(e));p.cancelled||(a(m),i(void 0))}catch(m){p.cancelled||(a(void 0),i(Jt(m)))}finally{p.cancelled||d(!1)}},[o,t,e]);return(0,st.useEffect)(()=>{let p={cancelled:!1};return ot(f(p)),()=>{p.cancelled=!0}},[f]),{error:s,loading:c,result:r}},"useRunSql"),B1t="lunora-studio-dashboards",qZ={shardKey:"",sql:"",title:""},V1t=n(t=>{let e=(0,Yt.c)(54),{onEdit:o,onRemove:r,widget:a}=t,s=Ve(),{error:i,loading:c,result:d}=L1t(a.sql,a.shardKey??""),f;e[0]!==o||e[1]!==a.id?(f=n(()=>{o(a.id)},"t1"),e[0]=o,e[1]=a.id,e[2]=f):f=e[2];let p=f,m;e[3]!==r||e[4]!==a.id?(m=n(()=>{r(a.id)},"t2"),e[3]=r,e[4]=a.id,e[5]=m):m=e[5];let h=m,v=`dashboards-widget-${a.id}`,x;e[6]!==a.title?(x=(0,P.jsxDEV)(au,{className:"min-w-0 truncate",title:a.title,children:a.title},void 0,!1),e[6]=a.title,e[7]=x):x=e[7];let y;e[8]!==s?(y=s("Edit widget"),e[8]=s,e[9]=y):y=e[9];let b=`dashboards-widget-edit-${a.id}`,S;e[10]!==s?(S=s("Edit widget"),e[10]=s,e[11]=S):S=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"},void 0,!1)},void 0,!1),e[12]=w):w=e[12];let C;e[13]!==p||e[14]!==y||e[15]!==b||e[16]!==S?(C=(0,P.jsxDEV)(dt,{"aria-label":y,"data-testid":b,onClick:p,size:"icon-xs",title:S,type:"button",variant:"ghost",children:w},void 0,!1),e[13]=p,e[14]=y,e[15]=b,e[16]=S,e[17]=C):C=e[17];let F;e[18]!==s?(F=s("Remove widget"),e[18]=s,e[19]=F):F=e[19];let T=`dashboards-widget-remove-${a.id}`,E;e[20]!==s?(E=s("Remove widget"),e[20]=s,e[21]=E):E=e[21];let k;e[22]===Symbol.for("react.memo_cache_sentinel")?(k=(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"},void 0,!1)},void 0,!1),e[22]=k):k=e[22];let O;e[23]!==h||e[24]!==F||e[25]!==T||e[26]!==E?(O=(0,P.jsxDEV)(dt,{"aria-label":F,"data-testid":T,onClick:h,size:"icon-xs",title:E,type:"button",variant:"ghost",children:k},void 0,!1),e[23]=h,e[24]=F,e[25]=T,e[26]=E,e[27]=O):O=e[27];let D;e[28]!==O||e[29]!==C?(D=(0,P.jsxDEV)("div",{className:"flex shrink-0 items-center gap-1",children:[C,O]},void 0,!0),e[28]=O,e[29]=C,e[30]=D):D=e[30];let M;e[31]!==D||e[32]!==x?(M=(0,P.jsxDEV)(nu,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[x,D]},void 0,!0),e[31]=D,e[32]=x,e[33]=M):M=e[33];let L;e[34]!==i||e[35]!==a.id?(L=i!==void 0&&(0,P.jsxDEV)(vX,{className:"font-mono text-xs",testId:`dashboards-widget-error-${a.id}`,variant:"destructive",children:i},void 0,!1),e[34]=i,e[35]=a.id,e[36]=L):L=e[36];let U;e[37]!==i||e[38]!==c||e[39]!==d||e[40]!==s||e[41]!==a.id?(U=i===void 0&&c&&d===void 0&&(0,P.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${a.id}`,children:s("Running\u2026")},void 0,!1),e[37]=i,e[38]=c,e[39]=d,e[40]=s,e[41]=a.id,e[42]=U):U=e[42];let W;e[43]!==i||e[44]!==d?(W=i===void 0&&d!==void 0&&(0,P.jsxDEV)(gX,{result:d},void 0,!1),e[43]=i,e[44]=d,e[45]=W):W=e[45];let V;e[46]!==L||e[47]!==U||e[48]!==W?(V=(0,P.jsxDEV)(Xt,{className:"min-h-32 py-2",children:[L,U,W]},void 0,!0),e[46]=L,e[47]=U,e[48]=W,e[49]=V):V=e[49];let j;return e[50]!==M||e[51]!==V||e[52]!==v?(j=(0,P.jsxDEV)(Rt,{"data-testid":v,children:[M,V]},void 0,!0),e[50]=M,e[51]=V,e[52]=v,e[53]=j):j=e[53],j},"WidgetCard"),U1t=n(t=>{let e=(0,Yt.c)(58),{draft:o,editing:r,onCancel:a,onChange:s,onSubmit:i}=t,c=Ve(),d;e[0]!==o||e[1]!==s?(d=n(_=>{s({...o,title:_.target.value})},"t1"),e[0]=o,e[1]=s,e[2]=d):d=e[2];let f=d,p;e[3]!==o||e[4]!==s?(p=n(_=>{s({...o,sql:_.target.value})},"t2"),e[3]=o,e[4]=s,e[5]=p):p=e[5];let m=p,h;e[6]!==o||e[7]!==s?(h=n(_=>{s({...o,shardKey:_.target.value})},"t3"),e[6]=o,e[7]=s,e[8]=h):h=e[8];let v=h,x;e[9]!==i?(x=n(()=>{i()},"t4"),e[9]=i,e[10]=x):x=e[10];let y=x,b;e[11]!==o.sql||e[12]!==o.title?(b=o.title.trim()!==""&&o.sql.trim()!=="",e[11]=o.sql,e[12]=o.title,e[13]=b):b=e[13];let S=b,w;e[14]!==c?(w=c("Widget title"),e[14]=c,e[15]=w):w=e[15];let C;e[16]!==c?(C=c("Widget title"),e[16]=c,e[17]=C):C=e[17];let F;e[18]!==o.title||e[19]!==f||e[20]!==w||e[21]!==C?(F=(0,P.jsxDEV)("input",{"aria-label":w,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-title",onChange:f,placeholder:C,type:"text",value:o.title},void 0,!1),e[18]=o.title,e[19]=f,e[20]=w,e[21]=C,e[22]=F):F=e[22];let T;e[23]!==c?(T=c("SQL query"),e[23]=c,e[24]=T):T=e[24];let E;e[25]!==o.sql||e[26]!==m||e[27]!==T?(E=(0,P.jsxDEV)("textarea",{"aria-label":T,className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-sql",onChange:m,placeholder:"SELECT author, COUNT(*) AS messages FROM \u2026",spellCheck:!1,value:o.sql},void 0,!1),e[25]=o.sql,e[26]=m,e[27]=T,e[28]=E):E=e[28];let k;e[29]!==c?(k=c("Shard key (optional)"),e[29]=c,e[30]=k):k=e[30];let O;e[31]!==c?(O=c("Shard key (optional)"),e[31]=c,e[32]=O):O=e[32];let D;e[33]!==o.shardKey||e[34]!==v||e[35]!==k||e[36]!==O?(D=(0,P.jsxDEV)("input",{"aria-label":k,className:"h-8 rounded-md border border-border bg-background px-2 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-shard",onChange:v,placeholder:O,type:"text",value:o.shardKey},void 0,!1),e[33]=o.shardKey,e[34]=v,e[35]=k,e[36]=O,e[37]=D):D=e[37];let M;e[38]!==c?(M=c("Cancel"),e[38]=c,e[39]=M):M=e[39];let L;e[40]!==a||e[41]!==M?(L=(0,P.jsxDEV)(dt,{"data-testid":"dashboards-form-cancel",onClick:a,size:"sm",type:"button",variant:"outline",children:M},void 0,!1),e[40]=a,e[41]=M,e[42]=L):L=e[42];let U=!S,W;e[43]!==r||e[44]!==c?(W=c(r?"Save widget":"Add widget"),e[43]=r,e[44]=c,e[45]=W):W=e[45];let V;e[46]!==y||e[47]!==U||e[48]!==W?(V=(0,P.jsxDEV)(dt,{"data-testid":"dashboards-form-save",disabled:U,onClick:y,size:"sm",type:"button",children:W},void 0,!1),e[46]=y,e[47]=U,e[48]=W,e[49]=V):V=e[49];let j;e[50]!==L||e[51]!==V?(j=(0,P.jsxDEV)("div",{className:"flex items-center justify-end gap-2",children:[L,V]},void 0,!0),e[50]=L,e[51]=V,e[52]=j):j=e[52];let N;return e[53]!==E||e[54]!==D||e[55]!==j||e[56]!==F?(N=(0,P.jsxDEV)(Rt,{"data-testid":"dashboards-form",children:(0,P.jsxDEV)(Xt,{className:"flex flex-col gap-3 py-4",children:[F,E,D,j]},void 0,!0)},void 0,!1),e[53]=E,e[54]=D,e[55]=j,e[56]=F,e[57]=N):N=e[57],N},"WidgetForm"),z1t=n(t=>{let e=(0,Yt.c)(39),{initialShardKey:o}=t,r=Ve(),[a,s]=rw(B1t),[i,c]=(0,st.useState)(qZ),[d,f]=(0,st.useState)(null),[p,m]=(0,st.useState)(!1),h;e[0]!==o?(h=n(()=>{f(null),c({...qZ,shardKey:o??""}),m(!0)},"t1"),e[0]=o,e[1]=h):h=e[1];let v=h,x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=n(()=>{m(!1),f(null),c(qZ)},"t2"),e[2]=x):x=e[2];let y=x,b;e[3]!==a?(b=n(W=>{let V=a.find(j=>j.id===W);V!==void 0&&(f(W),c({shardKey:V.shardKey??"",sql:V.sql,title:V.title}),m(!0))},"t3"),e[3]=a,e[4]=b):b=e[4];let S=b,w;e[5]!==s?(w=n(W=>{s(V=>V.filter(j=>j.id!==W))},"t4"),e[5]=s,e[6]=w):w=e[6];let C=w,F;e[7]!==i.shardKey||e[8]!==i.sql||e[9]!==i.title||e[10]!==d||e[11]!==s?(F=n(()=>{let W=i.title.trim(),V=i.sql.trim();if(W===""||V==="")return;let j=i.shardKey.trim();s(d===null?N=>[...N,{id:Y4("w"),shardKey:j,sql:V,title:W}]:N=>N.map(_=>_.id===d?{..._,shardKey:j,sql:V,title:W}:_)),y()},"t5"),e[7]=i.shardKey,e[8]=i.sql,e[9]=i.title,e[10]=d,e[11]=s,e[12]=F):F=e[12];let T=F,E;e[13]!==r?(E=r("Chart widgets backed by saved read-only SQL queries."),e[13]=r,e[14]=E):E=e[14];let k;e[15]!==E?(k=(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:E},void 0,!1),e[15]=E,e[16]=k):k=e[16];let O;e[17]!==p||e[18]!==v||e[19]!==r?(O=!p&&(0,P.jsxDEV)(dt,{"data-testid":"dashboards-add",onClick:v,size:"sm",type:"button",children:r("Add widget")},void 0,!1),e[17]=p,e[18]=v,e[19]=r,e[20]=O):O=e[20];let D;e[21]!==k||e[22]!==O?(D=(0,P.jsxDEV)("div",{className:"flex items-center justify-between",children:[k,O]},void 0,!0),e[21]=k,e[22]=O,e[23]=D):D=e[23];let M;e[24]!==i||e[25]!==d||e[26]!==p||e[27]!==T?(M=p&&(0,P.jsxDEV)(U1t,{draft:i,editing:d!==null,onCancel:y,onChange:c,onSubmit:T},void 0,!1),e[24]=i,e[25]=d,e[26]=p,e[27]=T,e[28]=M):M=e[28];let L;e[29]!==p||e[30]!==S||e[31]!==C||e[32]!==r||e[33]!==a?(L=a.length===0&&!p?(0,P.jsxDEV)(co,{description:r("Add a widget to chart a saved SQL query on this browser."),testId:"dashboards-empty",title:r("No widgets yet")},void 0,!1):(0,P.jsxDEV)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:a.map(W=>(0,P.jsxDEV)(V1t,{onEdit:S,onRemove:C,widget:W},W.id,!1))},void 0,!1),e[29]=p,e[30]=S,e[31]=C,e[32]=r,e[33]=a,e[34]=L):L=e[34];let U;return e[35]!==M||e[36]!==L||e[37]!==D?(U=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[D,M,L]},void 0,!0),e[35]=M,e[36]=L,e[37]=D,e[38]=U):U=e[38],U},"DashboardsPanel"),NOe=n(t=>`${t.toString()} ms`,"formatMs"),$1t=n(t=>t.totalConnections===0&&t.shapePoke.passes===0&&t.whisper.passes===0,"isFanoutIdle"),Ow=n(t=>{let e=(0,Yt.c)(8),{label:o,testId:r,value:a}=t,s;e[0]!==o?(s=(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o},void 0,!1),e[0]=o,e[1]=s):s=e[1];let i;e[2]!==r||e[3]!==a?(i=(0,P.jsxDEV)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":r,children:a},void 0,!1),e[2]=r,e[3]=a,e[4]=i):i=e[4];let c;return e[5]!==s||e[6]!==i?(c=(0,P.jsxDEV)(Rt,{className:"gap-0 py-0",children:(0,P.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[s,i]},void 0,!0)},void 0,!1),e[5]=s,e[6]=i,e[7]=c):c=e[7],c},"StatCard"),DOe=n(t=>{let e=(0,Yt.c)(48),{counters:o,includeTiming:r,prefix:a,t:s,title:i}=t,c=`${a}-section`,d;e[0]!==i?(d=(0,P.jsxDEV)("h3",{className:"text-sm font-medium text-foreground",children:i},void 0,!1),e[0]=i,e[1]=d):d=e[1];let f=`${a}-stats`,p;e[2]!==s?(p=s("Passes"),e[2]=s,e[3]=p):p=e[3];let m=`${a}-passes`,h;e[4]!==o.passes||e[5]!==p||e[6]!==m?(h=(0,P.jsxDEV)(Ow,{label:p,testId:m,value:o.passes},void 0,!1),e[4]=o.passes,e[5]=p,e[6]=m,e[7]=h):h=e[7];let v;e[8]!==s?(v=s("Sockets iterated"),e[8]=s,e[9]=v):v=e[9];let x=`${a}-iterated`,y;e[10]!==o.socketsIterated||e[11]!==v||e[12]!==x?(y=(0,P.jsxDEV)(Ow,{label:v,testId:x,value:o.socketsIterated},void 0,!1),e[10]=o.socketsIterated,e[11]=v,e[12]=x,e[13]=y):y=e[13];let b;e[14]!==s?(b=s("Delivered"),e[14]=s,e[15]=b):b=e[15];let S=`${a}-delivered`,w;e[16]!==o.socketsDelivered||e[17]!==b||e[18]!==S?(w=(0,P.jsxDEV)(Ow,{label:b,testId:S,value:o.socketsDelivered},void 0,!1),e[16]=o.socketsDelivered,e[17]=b,e[18]=S,e[19]=w):w=e[19];let C;e[20]!==s?(C=s("Peak width"),e[20]=s,e[21]=C):C=e[21];let F=`${a}-peak`,T;e[22]!==o.peakSocketsIterated||e[23]!==C||e[24]!==F?(T=(0,P.jsxDEV)(Ow,{label:C,testId:F,value:o.peakSocketsIterated},void 0,!1),e[22]=o.peakSocketsIterated,e[23]=C,e[24]=F,e[25]=T):T=e[25];let E;e[26]!==o.totalMs||e[27]!==r||e[28]!==a||e[29]!==s?(E=r&&(0,P.jsxDEV)(Ow,{label:s("Total time"),testId:`${a}-total-ms`,value:NOe(o.totalMs)},void 0,!1),e[26]=o.totalMs,e[27]=r,e[28]=a,e[29]=s,e[30]=E):E=e[30];let k;e[31]!==o.maxMs||e[32]!==r||e[33]!==a||e[34]!==s?(k=r&&(0,P.jsxDEV)(Ow,{label:s("Max time"),testId:`${a}-max-ms`,value:NOe(o.maxMs)},void 0,!1),e[31]=o.maxMs,e[32]=r,e[33]=a,e[34]=s,e[35]=k):k=e[35];let O;e[36]!==w||e[37]!==T||e[38]!==E||e[39]!==k||e[40]!==f||e[41]!==h||e[42]!==y?(O=(0,P.jsxDEV)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":f,children:[h,y,w,T,E,k]},void 0,!0),e[36]=w,e[37]=T,e[38]=E,e[39]=k,e[40]=f,e[41]=h,e[42]=y,e[43]=O):O=e[43];let D;return e[44]!==c||e[45]!==O||e[46]!==d?(D=(0,P.jsxDEV)("section",{className:"flex flex-col gap-2","data-testid":c,children:[d,O]},void 0,!0),e[44]=c,e[45]=O,e[46]=d,e[47]=D):D=e[47],D},"PathCounters"),H1t=n(t=>{let e=(0,Yt.c)(31),{initialShardKey:o}=t,r=Ve(),[a,s]=(0,st.useState)(o??""),i;e[0]!==a?(i=a.trim(),e[0]=a,e[1]=i):i=e[1];let c=na(i,400),d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d={},e[2]=d):d=e[2];let f;e[3]!==c?(f={keepPreviousData:!0,shardKey:c},e[3]=c,e[4]=f):f=e[4];let{data:p,error:m,refetch:h}=_o(vt.getFanoutMetrics,d,f);us(h,!0);let v;e[5]!==p?(v=p!==void 0&&$1t(p),e[5]=p,e[6]=v):v=e[6];let x=v,y;e[7]!==a?(y=(0,P.jsxDEV)(Qr,{onChange:s,testId:"fanout-shard-input",value:a},void 0,!1),e[7]=a,e[8]=y):y=e[8];let b;e[9]!==p||e[10]!==r?(b=p!==void 0&&(0,P.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[p.promoted&&(0,P.jsxDEV)(Pt,{"data-testid":"fanout-promoted",variant:"default",children:r("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:p.maxRelays,relayCount:p.relayCount})},void 0,!1),(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("{count} connections",{count:p.totalConnections})},void 0,!1),(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("peak {count} subscribers",{count:p.peakSubscribers})},void 0,!1)]},void 0,!0),e[9]=p,e[10]=r,e[11]=b):b=e[11];let S;e[12]!==y||e[13]!==b?(S=(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[y,b]},void 0,!0),e[12]=y,e[13]=b,e[14]=S):S=e[14];let w;e[15]!==m?(w=m!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"fanout-error",role:"alert",children:m},void 0,!1),e[15]=m,e[16]=w):w=e[16];let C;e[17]!==m||e[18]!==x||e[19]!==r?(C=m===null&&x&&(0,P.jsxDEV)(co,{description:r("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M4 12h4l3 7 4-14 3 7h2"},void 0,!1)},void 0,!1),testId:"fanout-empty",title:r("No fan-out activity yet.")},void 0,!1),e[17]=m,e[18]=x,e[19]=r,e[20]=C):C=e[20];let F;e[21]!==m||e[22]!==x||e[23]!==p||e[24]!==r?(F=m===null&&p!==void 0&&!x&&(0,P.jsxDEV)(P.Fragment,{children:[p.topics.length>0&&(0,P.jsxDEV)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,P.jsxDEV)("h3",{className:"text-sm font-medium text-foreground",children:r("Hot topics")},void 0,!1),(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"fanout-topics-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("Topic")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("Kind")},void 0,!1),(0,P.jsxDEV)(Le,{className:"text-right",children:r("Subscribers")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:p.topics.map(j1t)},void 0,!1)]},void 0,!0)},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,P.jsxDEV)("h2",{className:"text-sm font-medium text-muted-foreground",children:r("Fan-out cost since this instance woke")},void 0,!1),(0,P.jsxDEV)(DOe,{counters:p.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:r,title:r("Shape pokes")},void 0,!1),(0,P.jsxDEV)(DOe,{counters:p.whisper,includeTiming:!1,prefix:"fanout-whisper",t:r,title:r("Whisper broadcasts")},void 0,!1)]},void 0,!0)]},void 0,!0),e[21]=m,e[22]=x,e[23]=p,e[24]=r,e[25]=F):F=e[25];let T;return e[26]!==F||e[27]!==S||e[28]!==w||e[29]!==C?(T=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[S,w,C,F]},void 0,!0),e[26]=F,e[27]=S,e[28]=w,e[29]=C,e[30]=T):T=e[30],T},"FanoutPanel");function j1t(t){return(0,P.jsxDEV)(It,{"data-testid":"fanout-topic-row",children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:t.topic},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(Pt,{variant:"outline",children:t.kind},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-right font-medium tabular-nums",children:t.subscribers},void 0,!1)]},`${t.kind}:${t.topic}`,!0)}n(j1t,"_temp$1");var q1t=n((t,e)=>({delete:t("Delete"),list:t("List"),read:t("Read"),write:t("Write")})[e],"operationLabel"),_Oe={delete:2,list:3,read:0,write:1},W1t=n(t=>[...t].toSorted((e,o)=>e.bucket.localeCompare(o.bucket)||_Oe[e.on]-_Oe[o.on]||(e.prefix??"").localeCompare(o.prefix??"")),"sortRules"),G1t=n(()=>{let t=(0,Yt.c)(12),e=Ve(),o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={},t[0]=o):o=t[0];let{data:r,error:a}=_o(vt.storageRules,o),s=r!==void 0,i;if(t[1]!==r||t[2]!==a||t[3]!==s||t[4]!==e){let c=W1t(Array.isArray(r?.rules)?r.rules:[]),d;t[6]!==a?(d=a!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"storage-rules-error",role:"alert",children:a},void 0,!1),t[6]=a,t[7]=d):d=t[7];let f;t[8]!==e?(f=e("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),t[8]=e,t[9]=f):f=t[9];let p;t[10]!==f?(p=(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:f},void 0,!1),t[10]=f,t[11]=p):p=t[11],i=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[d,p,s&&c.length===0?(0,P.jsxDEV)(co,{description:e("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:e("No storage rules defined")},void 0,!1):(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"storage-rules-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Bucket")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Operation")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Key prefix")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(m=>(0,P.jsxDEV)(It,{"data-testid":`storage-rule-${m.bucket}-${m.on}-${m.prefix??""}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:m.bucket},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(Pt,{variant:"secondary",children:q1t(e,m.on)},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:m.prefix??(0,P.jsxDEV)("span",{className:"text-muted-foreground",children:e("(whole bucket)")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:m.procedure},void 0,!1)]},`${m.bucket}:${m.on}:${m.prefix??""}:${m.procedure}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),t[1]=r,t[2]=a,t[3]=s,t[4]=e,t[5]=i}else i=t[5];return i},"StorageRulesPanel"),K1t=10,nV=n(t=>{let e=(0,Yt.c)(7),{label:o,value:r}=t,a;e[0]!==o?(a=(0,P.jsxDEV)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:o},void 0,!1),e[0]=o,e[1]=a):a=e[1];let s=r??"\u2014",i;e[2]!==s?(i=(0,P.jsxDEV)("span",{className:"font-mono text-sm",children:s},void 0,!1),e[2]=s,e[3]=i):i=e[3];let c;return e[4]!==a||e[5]!==i?(c=(0,P.jsxDEV)("div",{className:"flex flex-col gap-0.5",children:[a,i]},void 0,!0),e[4]=a,e[5]=i,e[6]=c):c=e[6],c},"Detail"),Y1t=n(({loadIndexes:t,runQuery:e}={})=>{let o=Wt(),r=Ve(),[a,s]=(0,st.useState)(null),[i,c]=(0,st.useState)(null),[d,f]=(0,st.useState)(null),[p,m]=(0,st.useState)(""),[h,v]=(0,st.useState)(null),[x,y]=(0,st.useState)(null),[b,S]=(0,st.useState)(!1);(0,st.useEffect)(()=>{let k={cancelled:!1};return ot((async()=>{try{let O=await(t??(()=>o.listVectorIndexes()))();k.cancelled||(s(O),c(null),f(D=>D??O[0]?.name??null))}catch(O){k.cancelled||(s(null),c(Jt(O)))}})()),()=>{k.cancelled=!0}},[o,t]);let w=a?.find(k=>k.name===d)??null,C=n(k=>{f(k.currentTarget.dataset.index??null),v(null),y(null)},"onSelect"),F=n(k=>{m(k.target.value)},"onQueryTextChange"),T=n(async()=>{let k=p.trim();if(!(d===null||k==="")){S(!0),y(null);try{let O=await(e??(D=>o.queryVectorIndex(D)))({name:d,text:k,topK:K1t});v(O)}catch(O){v(null),y(Jt(O))}finally{S(!1)}}},"search"),E=n(()=>{ot(T())},"onSearch");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[i!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:i},void 0,!1),a!==null&&a.length===0&&(0,P.jsxDEV)(co,{description:r("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"},void 0,!1)},void 0,!1),testId:"vector-empty",title:r("No vector indexes.")},void 0,!1),a!==null&&a.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"vector-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("name")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("table")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("dimensions")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("metric")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("vectors")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:a.map(k=>(0,P.jsxDEV)(It,{className:k.name===d?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":k.name,"data-testid":`vector-row-${k.name}`,onClick:C,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:k.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:k.table},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:k.dimensions??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{children:k.metric??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:k.vectorsCount??"\u2014"},void 0,!1)]},k.name,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),w!==null&&(0,P.jsxDEV)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,P.jsxDEV)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,P.jsxDEV)(nV,{label:r("field"),value:w.field},void 0,!1),(0,P.jsxDEV)(nV,{label:r("dimensions"),value:w.dimensions},void 0,!1),(0,P.jsxDEV)(nV,{label:r("metric"),value:w.metric},void 0,!1),(0,P.jsxDEV)(nV,{label:r("vectors"),value:w.vectorsCount},void 0,!1)]},void 0,!0),w.metadata!==void 0&&w.metadata.length>0&&(0,P.jsxDEV)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[r("metadata"),": ",(0,P.jsxDEV)("span",{className:"font-mono",children:w.metadata.join(", ")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,P.jsxDEV)(mo,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:F,placeholder:r("Search by similarity\u2026"),value:p},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"vector-search",disabled:b||p.trim()==="",onClick:E,children:r(b?"Searching\u2026":"Search")},void 0,!1)]},void 0,!0),x!==null&&(0,P.jsxDEV)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:x},void 0,!1),h!==null&&h.length===0&&(0,P.jsxDEV)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:r("No matches.")},void 0,!1),h!==null&&h.length>0&&(0,P.jsxDEV)(Rt,{className:"mt-3 overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"vector-matches",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("id")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("score")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("metadata")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:h.map(k=>(0,P.jsxDEV)(It,{"data-testid":`vector-match-${k.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:k.id},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:k.score.toFixed(4)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"max-w-md truncate font-mono text-xs",children:k.metadata===void 0?"\u2014":jr(k.metadata)},void 0,!1)]},k.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"VectorBrowser"),X1t=["queued","running","paused","waiting","complete","errored","terminated"],Q1t=["pause","resume","terminate"],Z1t="WORKFLOWS_NOT_CONFIGURED",J1t=n(t=>typeof t=="object"&&t!==null&&t.code===Z1t,"isNotConfigured"),eSt=n(t=>{let e=t.error??t.output;if(e===void 0)return"\u2014";try{return JSON.stringify(e)}catch{return"(unserializable)"}},"formatStepPayload"),tSt=n(({loadDetail:t,loadInstances:e,readOnly:o,runAction:r,workflowName:a})=>{let s=Wt(),i=Ve(),[c,d]=(0,st.useState)(null),[f,p]=(0,st.useState)(null),[m,h]=(0,st.useState)(""),[v,x]=(0,st.useState)(null),[y,b]=(0,st.useState)(!1),[S,w]=(0,st.useState)(null),C=t??(M=>s.getWorkflowInstance(M)),E=o?void 0:r??(e===void 0?M=>s.setWorkflowInstanceStatus(M):void 0),k=n(async()=>{x(null),b(!1);let M=m===""?void 0:m;try{if(e===void 0){let L=await s.listWorkflowInstances({name:a,status:M});if(L.configured===!1){d(null),b(!0);return}d(L.instances);return}d(await e({name:a,status:M}))}catch(L){d(null),J1t(L)?b(!0):x(Jt(L))}},"load");(0,st.useEffect)(()=>{p(null),ot(k())},[a,m]);let O=n(async M=>{x(null);try{p(await C({id:M,name:a}))}catch(L){x(Jt(L))}},"openDetail"),D=n(async(M,L)=>{if(E!==void 0){w(M),x(null);try{await E({action:L,id:M,name:a}),await k()}catch(U){x(Jt(U))}finally{w(null)}}},"act");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,P.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,P.jsxDEV)("h3",{className:"text-sm font-medium",children:i("Instance history")},void 0,!1),(0,P.jsxDEV)("select",{"aria-label":i("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:n(M=>{h(M.target.value)},"onChange"),value:m,children:[(0,P.jsxDEV)("option",{value:"",children:i("All statuses")},void 0,!1),X1t.map(M=>(0,P.jsxDEV)("option",{value:M,children:M},M,!1))]},void 0,!0)]},void 0,!0),v!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:v},void 0,!1),y&&(0,P.jsxDEV)(co,{description:i("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:i("Workflow inspection not configured")},void 0,!1),!y&&c!==null&&c.length===0&&(0,P.jsxDEV)(co,{description:i("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:i("No instances")},void 0,!1),c!==null&&c.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"workflow-instances-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:i("Instance id")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Status")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Created")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Ended")},void 0,!1),(0,P.jsxDEV)(Le,{"aria-label":i("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(M=>(0,P.jsxDEV)(It,{"data-testid":`workflow-instance-${M.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:M.id},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:M.status},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:M.createdOn??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:M.endedOn??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-right",children:(0,P.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[(0,P.jsxDEV)(dt,{"data-testid":`workflow-instance-steps-${M.id}`,onClick:n(()=>{ot(O(M.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:i("Steps")},void 0,!1),E!==void 0&&Q1t.map(L=>(0,P.jsxDEV)(dt,{"data-testid":`workflow-instance-${L}-${M.id}`,disabled:S===M.id,onClick:n(()=>{ot(D(M.id,L))},"onClick"),size:"sm",type:"button",variant:"ghost",children:i(L)},L,!1))]},void 0,!0)},void 0,!1)]},M.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),f!==null&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,P.jsxDEV)(Xt,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,P.jsxDEV)("div",{className:"flex items-center justify-between",children:[(0,P.jsxDEV)("span",{className:"font-mono text-xs",children:[i("Steps")," \xB7 ",f.id]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"workflow-instance-detail-close",onClick:n(()=>{p(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Close")},void 0,!1)]},void 0,!0),f.steps.length===0?(0,P.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:i("This instance has no recorded steps yet.")},void 0,!1):(0,P.jsxDEV)(Ao,{"data-testid":"workflow-instance-steps",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:i("Step")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Type")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Attempts")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Started")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Output")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:f.steps.map((M,L)=>(0,P.jsxDEV)(It,{"data-testid":`workflow-step-${String(L)}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:M.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-xs text-muted-foreground",children:M.type??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:M.attempts??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:M.start??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:eSt(M)},void 0,!1)]},`${M.name}:${String(L)}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0)},"WorkflowInstanceHistory"),oSt=ro(vt.createWorkflowInstance),rSt=ro(vt.getWorkflowInstanceStatus),nSt=n(t=>{if(t.error)return`${t.error.name}: ${t.error.message}`;if(t.output===void 0)return"\u2014";try{return JSON.stringify(t.output)}catch{return"(unserializable)"}},"formatPayload"),aSt=n(()=>{let t=Wt(),e=Ve(),{data:o,error:r}=_o(vt.listWorkflows,{}),[a,s]=(0,st.useState)(""),[i,c]=(0,st.useState)(""),[d,f]=(0,st.useState)(""),[p,m]=(0,st.useState)(!1),[h,v]=(0,st.useState)(null),[x,y]=(0,st.useState)([]),[b,S]=(0,st.useState)(null),w=o!==void 0,C=(0,st.useMemo)(()=>Array.isArray(o?.workflows)?[...o.workflows].toSorted((V,j)=>V.exportName.localeCompare(j.exportName)):[],[o]),F=(0,st.useMemo)(()=>C.some(V=>V.exportName===a)?a:C[0]?.exportName??"",[C,a]),T=(0,st.useMemo)(()=>C.find(V=>V.exportName===F),[C,F]),E=n(V=>{y(j=>{let N=j.filter(_=>!(_.exportName===V.exportName&&_.id===V.id));return[V,...N]})},"upsertInstance"),k=n(async()=>{let V=F;if(V==="")return;let j,N=d.trim();if(N!=="")try{j=JSON.parse(N)}catch{v(e("Params must be valid JSON"));return}m(!0),v(null);try{let _=i.trim(),B=await t.query(oSt,{exportName:V,id:_===""?void 0:_,params:j},lo(""));E({exportName:V,id:B.id,status:B.status}),c("")}catch(_){v(Jt(_))}finally{m(!1)}},"start"),O=n(()=>{ot(k())},"startInstance"),D=n(async(V,j)=>{S(j);try{let N=await t.query(rSt,{exportName:V,id:j},lo(""));E({error:N.error,exportName:V,id:N.id,output:N.output,status:N.status})}catch(N){v(Jt(N))}finally{S(null)}},"refreshInstance"),M=n(V=>{s(V.target.value)},"onSelectedExportChange"),L=n(V=>{c(V.target.value)},"onInstanceIdChange"),U=n(V=>{f(V.target.value)},"onParamsChange"),W=n(V=>{let{export:j,id:N}=V.currentTarget.dataset;j!==void 0&&N!==void 0&&ot(D(j,N))},"onRefreshClick");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[r!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:r},void 0,!1),(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:e("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")},void 0,!1),w&&C.length===0?(0,P.jsxDEV)(co,{description:e("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:e("No workflows defined")},void 0,!1):(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"workflows-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Export")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Name")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Class")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Binding")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:C.map(V=>(0,P.jsxDEV)(It,{"data-testid":`workflows-row-${V.exportName}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:V.exportName},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:V.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:V.className},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:V.binding},void 0,!1)]},V.exportName,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),C.length>0&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,P.jsxDEV)("h3",{className:"text-sm font-medium",children:e("Start instance")},void 0,!1),h!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:h},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,P.jsxDEV)("select",{"aria-label":e("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:M,value:F,children:C.map(V=>(0,P.jsxDEV)("option",{value:V.exportName,children:V.exportName},V.exportName,!1))},void 0,!1),(0,P.jsxDEV)(mo,{"aria-label":e("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:L,placeholder:e("Instance id (optional)"),value:i},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"workflows-start-button",disabled:p||F==="",onClick:O,children:e(p?"Starting\u2026":"Start instance")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Ff,{"aria-label":e("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:U,placeholder:e("Params (JSON, optional)"),value:d},void 0,!1)]},void 0,!0),x.length>0&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,P.jsxDEV)("h3",{className:"text-sm font-medium",children:e("Instances")},void 0,!1),(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"workflows-instances-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Workflow")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Instance id")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Status")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Output")},void 0,!1),(0,P.jsxDEV)(Le,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:x.map(V=>(0,P.jsxDEV)(It,{"data-testid":`workflows-instance-${V.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:V.exportName},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:V.id},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:V.status},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:nSt(V)},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"data-export":V.exportName,"data-id":V.id,"data-testid":`workflows-instance-refresh-${V.id}`,disabled:b===V.id,onClick:W,size:"xs",variant:"outline",children:b===V.id?e("Refreshing\u2026"):e("Refresh")},void 0,!1)},void 0,!1)]},`${V.exportName}:${V.id}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),T!==void 0&&(0,P.jsxDEV)(tSt,{workflowName:T.name},void 0,!1)]},void 0,!0)},"WorkflowsPanel"),sSt=ro(vt.studioFeatures),eNe={flags:!0,mail:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},iSt=n(t=>{if(t===null||typeof t!="object")return eNe;let e=t,o=n(r=>typeof e[r]=="boolean"?e[r]:!0,"flag");return{flags:o("flags"),mail:o("mail"),payments:o("payments"),queues:o("queues"),scheduler:o("scheduler"),storage:o("storage"),vectors:o("vectors"),workflows:o("workflows")}},"coerceFeatures"),lSt=n(()=>{let t=(0,Yt.c)(3),e=Wt(),[o,r]=(0,st.useState)(eNe),a,s;return t[0]!==e?(a=n(()=>{ot((async()=>{try{r(iSt(await e.query(sSt,{},lo(""))))}catch{}})())},"t0"),s=[e],t[0]=e,t[1]=a,t[2]=s):(a=t[1],s=t[2]),(0,st.useEffect)(a,s),o},"useStudioFeatures"),tNe=(0,st.createContext)(null),cSt={analytics:(0,P.jsxDEV)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"},void 0,!1),api:(0,P.jsxDEV)("path",{d:"m9 8-4 4 4 4m6-8 4 4-4 4M13 5l-2 14"},void 0,!1),audit:(0,P.jsxDEV)("path",{d:"M7 4h7l4 4v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1Zm6 0v5h5M9 13h6M9 16h6M9 10h2"},void 0,!1),authConfig:(0,P.jsxDEV)("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm7.4-3a7.4 7.4 0 0 0-.1-1.2l2-1.6-2-3.4-2.4 1a7.3 7.3 0 0 0-2-1.2l-.4-2.6h-3.6l-.4 2.6a7.3 7.3 0 0 0-2 1.2l-2.4-1-2 3.4 2 1.6a7.4 7.4 0 0 0 0 2.4l-2 1.6 2 3.4 2.4-1a7.3 7.3 0 0 0 2 1.2l.4 2.6h3.6l.4-2.6a7.3 7.3 0 0 0 2-1.2l2.4 1 2-3.4-2-1.6a7.4 7.4 0 0 0 .1-1.2Z"},void 0,!1),authSessions:(0,P.jsxDEV)("path",{d:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-13.5V12l4 2"},void 0,!1),dashboards:(0,P.jsxDEV)("path",{d:"M4 5h7v6H4V5Zm9 0h7v4h-7V5ZM4 14h7v5H4v-5Zm9-1h7v6h-7v-6Z"},void 0,!1),drains:(0,P.jsxDEV)("path",{d:"M5 5h14M7 5v6a5 5 0 0 0 10 0V5M10 16h4v3h-4zM12 19v2"},void 0,!1),data:(0,P.jsxDEV)("path",{d:"M5 6c0-1.4 3.1-2.5 7-2.5s7 1.1 7 2.5-3.1 2.5-7 2.5S5 7.4 5 6Zm0 0v12c0 1.4 3.1 2.5 7 2.5s7-1.1 7-2.5V6M5 12c0 1.4 3.1 2.5 7 2.5s7-1.1 7-2.5"},void 0,!1),export:(0,P.jsxDEV)("path",{d:"M12 3v11m0 0 4-4m-4 4-4-4M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"},void 0,!1),fanout:(0,P.jsxDEV)("path",{d:"M12 5a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm-7 16a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm14 0a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM12 7v3.5M12 10.5 6 17m6-6.5 6 6.5"},void 0,!1),files:(0,P.jsxDEV)("path",{d:"M4 7a2 2 0 0 1 2-2h3l2 2.5h7a2 2 0 0 1 2 2V18a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7Z"},void 0,!1),flags:(0,P.jsxDEV)("path",{d:"M6 21V4m0 0h11l-2 3 2 3H6"},void 0,!1),functions:(0,P.jsxDEV)("path",{d:"m9 8-4 4 4 4m6-8 4 4-4 4"},void 0,!1),health:(0,P.jsxDEV)("path",{d:"M3 12h4l2 6 4-14 2 8h6"},void 0,!1),home:(0,P.jsxDEV)("path",{d:"M3 11.5 12 4l9 7.5M5 10v9a1 1 0 0 0 1 1h4v-6h4v6h4a1 1 0 0 0 1-1v-9"},void 0,!1),insights:(0,P.jsxDEV)("path",{d:"M12 3a6 6 0 0 0-3.6 10.8c.5.4.8.9.9 1.5l.2 1.2h5l.2-1.2c.1-.6.4-1.1.9-1.5A6 6 0 0 0 12 3ZM9.5 20.5h5M10 18h4"},void 0,!1),logs:(0,P.jsxDEV)("path",{d:"M5 6h14M5 10h14M5 14h9M5 18h11"},void 0,!1),mail:(0,P.jsxDEV)("path",{d:"M4 5h16v14H4V5Zm0 1.5 8 6 8-6"},void 0,!1),payments:(0,P.jsxDEV)("path",{d:"M3 7h18v10H3V7Zm0 3h18M7 14h4"},void 0,!1),metrics:(0,P.jsxDEV)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"},void 0,!1),migrations:(0,P.jsxDEV)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"},void 0,!1),organizations:(0,P.jsxDEV)("path",{d:"M3 21V8l6-4 6 4v13M9 21v-5h2v5M15 11h6v10M18 14v.01M18 17v.01M6 9v.01M6 12v.01M6 15v.01"},void 0,!1),permissions:(0,P.jsxDEV)("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3Zm-3 8 2.2 2.2L15 9.5M8.5 16h7"},void 0,!1),pitr:(0,P.jsxDEV)("path",{d:"M12 21a9 9 0 1 0-9-9M12 7.5V12l3 2M3 12l-2-2m2 2 2-2"},void 0,!1),queues:(0,P.jsxDEV)("path",{d:"M4 6h16M4 10h16M4 14h10M4 18h10m4-2 3 2-3 2v-4Z"},void 0,!1),realtime:(0,P.jsxDEV)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},void 0,!1),rls:(0,P.jsxDEV)("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3ZM8.5 10h7M8.5 13h7"},void 0,!1),schedule:(0,P.jsxDEV)("path",{d:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-13.5V12l4 2"},void 0,!1),schema:(0,P.jsxDEV)("path",{d:"M4 5h16v14H4V5Zm0 5h16M10 10v9M4 14.5h16"},void 0,!1),sql:(0,P.jsxDEV)("path",{d:"M4 5h16v14H4V5Zm3 4 3 3-3 3m6 0h4"},void 0,!1),storageRules:(0,P.jsxDEV)("path",{d:"M7 10V7a5 5 0 0 1 10 0v3m-11 0h12a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1Zm6 4v2"},void 0,!1),security:(0,P.jsxDEV)("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3Zm-2.5 8.5 2 2 4-4"},void 0,!1),settings:(0,P.jsxDEV)("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm7.4-3a7.4 7.4 0 0 0-.1-1.2l2-1.6-2-3.4-2.4 1a7.3 7.3 0 0 0-2-1.2l-.4-2.6H10.5l-.4 2.6a7.3 7.3 0 0 0-2 1.2l-2.4-1-2 3.4 2 1.6a7.4 7.4 0 0 0 0 2.4l-2 1.6 2 3.4 2.4-1a7.3 7.3 0 0 0 2 1.2l.4 2.6h3.6l.4-2.6a7.3 7.3 0 0 0 2-1.2l2.4 1 2-3.4-2-1.6a7.4 7.4 0 0 0 .1-1.2Z"},void 0,!1),users:(0,P.jsxDEV)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85M16 3.13A4 4 0 0 1 16 11"},void 0,!1),vectors:(0,P.jsxDEV)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"},void 0,!1),workflows:(0,P.jsxDEV)("path",{d:"M5 5h5v5H5V5Zm9 9h5v5h-5v-5ZM7.5 10v2a2 2 0 0 0 2 2H14m2.5-4V8a2 2 0 0 0-2-2H10"},void 0,!1)},LOe=[{key:"overview",tabs:["home","dashboards"]},{key:"database",tabs:["data","sql","schema","migrations","vectors","pitr","export"]},{key:"functions",tabs:["functions","api","workflows","queues"]},{key:"auth",tabs:["users","organizations","authSessions","authConfig"]},{key:"storage",tabs:["files","storageRules"]},{key:"observability",tabs:["logs","audit","realtime","fanout","metrics","analytics","health"]},{key:"advisors",tabs:["security","rls","permissions","insights"]},{key:"operations",tabs:["schedule","mail","drains","payments","flags"]},{key:"settings",tabs:["settings"]}],uSt={files:"storage",flags:"flags",mail:"mail",payments:"payments",queues:"queues",schedule:"scheduler",storageRules:"storage",vectors:"vectors",workflows:"workflows"},BOe=n((t,e)=>{let o=uSt[t];return o===void 0||e[o]},"isTabVisible"),WZ=n(t=>{let e=(0,Yt.c)(2),{tab:o}=t,r=cSt[o],a;return e[0]!==r?(a=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4 shrink-0",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:r},void 0,!1),e[0]=r,e[1]=a):a=e[1],a},"TabIcon"),oNe=["home","data","sql","functions","api","workflows","queues","schema","migrations","vectors","export","pitr","users","organizations","authSessions","authConfig","files","storageRules","dashboards","metrics","analytics","health","security","rls","permissions","insights","logs","realtime","mail","payments","audit","schedule","drains","flags","settings"],dSt=new Set(["api","data","sql"]),fSt=n(t=>{let e=t.split("/").findLast(Boolean)??"";return oNe.includes(e)?e:"home"},"tabFromPathname"),pSt=n(t=>{let e=(0,Yt.c)(19),{chrome:o,connected:r}=t,a=Ve(),s;e[0]!==a?(s=a("admin token"),e[0]=a,e[1]=s):s=e[1];let i;e[2]!==s?(i=(0,P.jsxDEV)("label",{className:"text-xs font-medium text-foreground",htmlFor:"dash-app-token",children:s},void 0,!1),e[2]=s,e[3]=i):i=e[3];let c;e[4]!==o.onTokenChange||e[5]!==o.token?(c=(0,P.jsxDEV)(mo,{className:"h-8","data-testid":"dash-app-token",id:"dash-app-token",onChange:o.onTokenChange,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:o.token},void 0,!1),e[4]=o.onTokenChange,e[5]=o.token,e[6]=c):c=e[6];let d;e[7]!==r||e[8]!==a?(d=r&&(0,P.jsxDEV)("p",{className:"flex items-start gap-1.5 text-[11px] text-muted-foreground","data-testid":"dash-app-token-warning",role:"note",children:[(0,P.jsxDEV)("span",{"aria-hidden":"true",className:"text-warning",children:"\u26A0"},void 0,!1),a("Token rides the WebSocket URL \u2014 it can surface in browser DevTools and server logs. Use a dev-only token.")]},void 0,!0),e[7]=r,e[8]=a,e[9]=d):d=e[9];let f;e[10]!==o.clearToken||e[11]!==r||e[12]!==a?(f=r&&(0,P.jsxDEV)("button",{className:"self-start rounded-md border border-border px-2.5 py-1 text-xs font-medium outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"dash-app-clear-token",onClick:o.clearToken,type:"button",children:a("Clear")},void 0,!1),e[10]=o.clearToken,e[11]=r,e[12]=a,e[13]=f):f=e[13];let p;return e[14]!==i||e[15]!==c||e[16]!==d||e[17]!==f?(p=(0,P.jsxDEV)("div",{className:"flex flex-col gap-2",children:[i,c,d,f]},void 0,!0),e[14]=i,e[15]=c,e[16]=d,e[17]=f,e[18]=p):p=e[18],p},"ConnectPopoverContent"),mSt=n(t=>{let e=(0,Yt.c)(25),{current:o,group:r,groupLabel:a,selectTab:s,tabDescription:i,tabLabel:c}=t,d=r.tabs.includes(o)?"page":void 0,f=a[r.key],p=r.tabs[0],m;e[0]!==p?(m=(0,P.jsxDEV)(WZ,{tab:p},void 0,!1),e[0]=p,e[1]=m):m=e[1];let h;e[2]!==d||e[3]!==f||e[4]!==m?(h=(0,P.jsxDEV)(KOe,{"aria-current":d,"aria-label":f,className:"mx-auto flex size-8 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent data-[popup-open]:bg-sidebar-accent data-[popup-open]:text-sidebar-accent-foreground data-[popup-open]:shadow-xs aria-[current=page]:bg-sidebar-accent aria-[current=page]:text-sidebar-accent-foreground aria-[current=page]:shadow-xs",delay:120,openOnHover:!0,children:m},void 0,!1),e[2]=d,e[3]=f,e[4]=m,e[5]=h):h=e[5];let v=a[r.key],x;e[6]!==v?(x=(0,P.jsxDEV)("div",{className:"px-2 py-1.5 text-[11px] font-medium tracking-wider text-muted-foreground uppercase",children:v},void 0,!1),e[6]=v,e[7]=x):x=e[7];let y;if(e[8]!==o||e[9]!==r.tabs||e[10]!==s||e[11]!==i||e[12]!==c){let w;e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c?(w=n(C=>(0,P.jsxDEV)("button",{"aria-current":o===C?"page":void 0,className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent aria-[current=page]:bg-accent aria-[current=page]:font-medium [&_svg]:opacity-70 aria-[current=page]:[&_svg]:opacity-100","data-tab":C,"data-testid":`dash-tab-${C}`,onClick:s,title:i[C],type:"button",children:[(0,P.jsxDEV)(WZ,{tab:C},void 0,!1),(0,P.jsxDEV)("span",{children:c[C]},void 0,!1)]},C,!0),"t92"),e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=w):w=e[18],y=r.tabs.map(w),e[8]=o,e[9]=r.tabs,e[10]=s,e[11]=i,e[12]=c,e[13]=y}else y=e[13];let b;e[19]!==x||e[20]!==y?(b=(0,P.jsxDEV)(YOe,{align:"start",className:"w-56 p-1",side:"right",sideOffset:8,children:[x,y]},void 0,!0),e[19]=x,e[20]=y,e[21]=b):b=e[21];let S;return e[22]!==h||e[23]!==b?(S=(0,P.jsxDEV)(GOe,{children:[h,b]},void 0,!0),e[22]=h,e[23]=b,e[24]=S):S=e[24],S},"CollapsedGroupNav"),hSt=n(t=>{let e=(0,Yt.c)(45),{chrome:o,collapsed:r,connected:a}=t,s=Ve();if(o===null){let C;e[0]!==s?(C=s("Admin"),e[0]=s,e[1]=C):C=e[1];let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=(0,P.jsxDEV)("span",{className:"flex size-8 items-center justify-center rounded-full bg-sidebar-accent text-[11px] font-medium",children:"C"},void 0,!1),e[2]=F):F=e[2];let T;e[3]!==s?(T=s("Admin"),e[3]=s,e[4]=T):T=e[4];let E;e[5]!==T?(E=(0,P.jsxDEV)("span",{className:"truncate text-[13px] font-medium",children:T},void 0,!1),e[5]=T,e[6]=E):E=e[6];let k;e[7]!==s?(k=s("Studio"),e[7]=s,e[8]=k):k=e[8];let O;e[9]!==k?(O=(0,P.jsxDEV)("span",{className:"truncate text-[11px] text-muted-foreground",children:k},void 0,!1),e[9]=k,e[10]=O):O=e[10];let D;e[11]!==E||e[12]!==O?(D=(0,P.jsxDEV)("span",{className:"grid flex-1 text-start leading-tight",children:[E,O]},void 0,!0),e[11]=E,e[12]=O,e[13]=D):D=e[13];let M;return e[14]!==C||e[15]!==D?(M=(0,P.jsxDEV)(QOe,{className:"data-active:bg-transparent",size:"lg",tooltip:C,children:[F,D]},void 0,!0),e[14]=C,e[15]=D,e[16]=M):M=e[16],M}let i=r?"mx-auto size-8 justify-center":"w-full p-2",c;e[17]!==i?(c=tt("flex items-center gap-2 rounded-md text-start outline-none transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent",i),e[17]=i,e[18]=c):c=e[18];let d;e[19]!==a||e[20]!==s?(d=s(a?"Connected":"Not connected"),e[19]=a,e[20]=s,e[21]=d):d=e[21];let f=a?"bg-success":"bg-muted-foreground/50",p;e[22]!==f?(p=tt("absolute -end-0.5 -bottom-0.5 size-2.5 rounded-full border-2 border-sidebar",f),e[22]=f,e[23]=p):p=e[23];let m;e[24]!==p?(m=(0,P.jsxDEV)("span",{className:"relative flex size-8 shrink-0 items-center justify-center rounded-full bg-sidebar-accent text-[11px] font-medium",children:["C",(0,P.jsxDEV)("span",{"aria-hidden":"true",className:p},void 0,!1)]},void 0,!0),e[24]=p,e[25]=m):m=e[25];let h;e[26]!==r||e[27]!==a||e[28]!==s?(h=!r&&(0,P.jsxDEV)(P.Fragment,{children:[(0,P.jsxDEV)("span",{className:"grid flex-1 text-start leading-tight",children:[(0,P.jsxDEV)("span",{className:"truncate text-[13px] font-medium",children:s("Admin")},void 0,!1),(0,P.jsxDEV)("span",{className:"truncate text-[11px] text-muted-foreground",children:s(a?"Connected":"Not connected")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"m8 9 4-4 4 4M8 15l4 4 4-4",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1)},void 0,!1)]},void 0,!0),e[26]=r,e[27]=a,e[28]=s,e[29]=h):h=e[29];let v;e[30]!==c||e[31]!==d||e[32]!==m||e[33]!==h?(v=(0,P.jsxDEV)(KOe,{className:c,"data-testid":"dash-app-connect",title:d,children:[m,h]},void 0,!0),e[30]=c,e[31]=d,e[32]=m,e[33]=h,e[34]=v):v=e[34];let x=r?"end":"start",y=r?"right":"top",b;e[35]!==o||e[36]!==a?(b=(0,P.jsxDEV)(pSt,{chrome:o,connected:a},void 0,!1),e[35]=o,e[36]=a,e[37]=b):b=e[37];let S;e[38]!==y||e[39]!==b||e[40]!==x?(S=(0,P.jsxDEV)(YOe,{align:x,keepMounted:!0,side:y,children:b},void 0,!1),e[38]=y,e[39]=b,e[40]=x,e[41]=S):S=e[41];let w;return e[42]!==S||e[43]!==v?(w=(0,P.jsxDEV)(GOe,{children:[v,S]},void 0,!0),e[42]=S,e[43]=v,e[44]=w):w=e[44],w},"SidebarFooterProfile"),gSt=n(t=>{let e=(0,Yt.c)(28),{chrome:o,connected:r,current:a,groupLabel:s,groups:i,selectTab:c,tabDescription:d,tabLabel:f}=t,p=Ve(),{state:m}=sV(),h=m==="collapsed",v=h&&"justify-center px-0",x;e[0]!==v?(x=tt("flex items-center gap-2.5 px-1.5 py-1",v),e[0]=v,e[1]=x):x=e[1];let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=(0,P.jsxDEV)(GZ,{className:"size-9 shrink-0 text-foreground"},void 0,!1),e[2]=y):y=e[2];let b;e[3]!==h||e[4]!==r||e[5]!==p?(b=!h&&(0,P.jsxDEV)(P.Fragment,{children:[(0,P.jsxDEV)("span",{className:"grid flex-1 leading-tight",children:[(0,P.jsxDEV)("span",{className:"truncate text-sm font-semibold text-foreground",children:"lunora"},void 0,!1),(0,P.jsxDEV)("span",{className:"truncate text-[11px] text-muted-foreground",children:p("Studio")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Pt,{className:"px-1.5 text-[10px] tracking-wider uppercase",variant:"secondary",children:p(r?"Live":"Local")},void 0,!1)]},void 0,!0),e[3]=h,e[4]=r,e[5]=p,e[6]=b):b=e[6];let S;e[7]!==x||e[8]!==b?(S=(0,P.jsxDEV)(pbt,{children:(0,P.jsxDEV)("div",{className:x,children:[y,b]},void 0,!0)},void 0,!1),e[7]=x,e[8]=b,e[9]=S):S=e[9];let w;e[10]!==h||e[11]!==a||e[12]!==s||e[13]!==i||e[14]!==c||e[15]!==d||e[16]!==f?(w=h?i.map(E=>(0,P.jsxDEV)(mSt,{current:a,group:E,groupLabel:s,selectTab:c,tabDescription:d,tabLabel:f},E.key,!1)):i.map(E=>(0,P.jsxDEV)(gbt,{children:[(0,P.jsxDEV)(vbt,{className:"text-[11px] font-medium tracking-wider uppercase",children:s[E.key]},void 0,!1),(0,P.jsxDEV)(xbt,{children:(0,P.jsxDEV)(FOe,{children:E.tabs.map(k=>(0,P.jsxDEV)(ROe,{children:(0,P.jsxDEV)(QOe,{className:"data-active:text-foreground dark:data-active:text-royal-amethyst data-active:shadow-[inset_2px_0_0_0_var(--royal-amethyst)]","data-tab":k,"data-testid":`dash-tab-${k}`,isActive:a===k,onClick:c,title:d[k],tooltip:d[k],children:[(0,P.jsxDEV)(WZ,{tab:k},void 0,!1),(0,P.jsxDEV)("span",{children:f[k]},void 0,!1)]},void 0,!0)},k,!1))},void 0,!1)},void 0,!1)]},E.key,!0)),e[10]=h,e[11]=a,e[12]=s,e[13]=i,e[14]=c,e[15]=d,e[16]=f,e[17]=w):w=e[17];let C;e[18]!==w?(C=(0,P.jsxDEV)(hbt,{children:w},void 0,!1),e[18]=w,e[19]=C):C=e[19];let F;e[20]!==o||e[21]!==h||e[22]!==r?(F=(0,P.jsxDEV)(mbt,{children:(0,P.jsxDEV)(FOe,{children:(0,P.jsxDEV)(ROe,{children:(0,P.jsxDEV)(hSt,{chrome:o,collapsed:h,connected:r},void 0,!1)},void 0,!1)},void 0,!1)},void 0,!1),e[20]=o,e[21]=h,e[22]=r,e[23]=F):F=e[23];let T;return e[24]!==S||e[25]!==C||e[26]!==F?(T=(0,P.jsxDEV)(ubt,{collapsible:"icon",variant:"inset",children:[S,C,F]},void 0,!0),e[24]=S,e[25]=C,e[26]=F,e[27]=T):T=e[27],T},"StudioSidebar"),vSt=n(()=>{let t=(0,Yt.c)(282),e=Ve(),o=zs(),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={select:wSt},t[0]=r):r=t[0];let a=J$(r),s,i;t[1]!==a?(s=fSt(a),i=dSt.has(s),t[1]=a,t[2]=s,t[3]=i):(s=t[2],i=t[3]);let c=i,d=lSt(),f;t[4]!==d?(f=n(al=>({...al,tabs:al.tabs.filter(tp=>BOe(tp,d))}),"t2"),t[4]=d,t[5]=f):f=t[5];let p=LOe.map(f).filter(CSt),m,h;t[6]!==s||t[7]!==d||t[8]!==o?(m=n(()=>{BOe(s,d)||ot(o({replace:!0,to:"/home"}))},"t3"),h=[s,d,o],t[6]=s,t[7]=d,t[8]=o,t[9]=m,t[10]=h):(m=t[9],h=t[10]),(0,st.useEffect)(m,h);let v;t[11]!==e?(v=e("Analytics"),t[11]=e,t[12]=v):v=t[12];let x;t[13]!==e?(x=e("API"),t[13]=e,t[14]=x):x=t[14];let y;t[15]!==e?(y=e("Audit"),t[15]=e,t[16]=y):y=t[16];let b;t[17]!==e?(b=e("Configuration"),t[17]=e,t[18]=b):b=t[18];let S;t[19]!==e?(S=e("Sessions"),t[19]=e,t[20]=S):S=t[20];let w;t[21]!==e?(w=e("Dashboards"),t[21]=e,t[22]=w):w=t[22];let C;t[23]!==e?(C=e("Data"),t[23]=e,t[24]=C):C=t[24];let F;t[25]!==e?(F=e("Log drains"),t[25]=e,t[26]=F):F=t[26];let T;t[27]!==e?(T=e("Export / Import"),t[27]=e,t[28]=T):T=t[28];let E;t[29]!==e?(E=e("Fan-out"),t[29]=e,t[30]=E):E=t[30];let k;t[31]!==e?(k=e("Files"),t[31]=e,t[32]=k):k=t[32];let O;t[33]!==e?(O=e("Flags"),t[33]=e,t[34]=O):O=t[34];let D;t[35]!==e?(D=e("Functions"),t[35]=e,t[36]=D):D=t[36];let M;t[37]!==e?(M=e("Health"),t[37]=e,t[38]=M):M=t[38];let L;t[39]!==e?(L=e("Home"),t[39]=e,t[40]=L):L=t[40];let U;t[41]!==e?(U=e("Performance"),t[41]=e,t[42]=U):U=t[42];let W;t[43]!==e?(W=e("Logs"),t[43]=e,t[44]=W):W=t[44];let V;t[45]!==e?(V=e("Metrics"),t[45]=e,t[46]=V):V=t[46];let j;t[47]!==e?(j=e("Migrations"),t[47]=e,t[48]=j):j=t[48];let N;t[49]!==e?(N=e("Organizations"),t[49]=e,t[50]=N):N=t[50];let _;t[51]!==e?(_=e("Time Travel"),t[51]=e,t[52]=_):_=t[52];let B;t[53]!==e?(B=e("Mail"),t[53]=e,t[54]=B):B=t[54];let z;t[55]!==e?(z=e("Payments"),t[55]=e,t[56]=z):z=t[56];let q;t[57]!==e?(q=e("Permissions"),t[57]=e,t[58]=q):q=t[58];let $;t[59]!==e?($=e("Queues"),t[59]=e,t[60]=$):$=t[60];let Y;t[61]!==e?(Y=e("Realtime"),t[61]=e,t[62]=Y):Y=t[62];let Q;t[63]!==e?(Q=e("RLS Policies"),t[63]=e,t[64]=Q):Q=t[64];let X;t[65]!==e?(X=e("Scheduled"),t[65]=e,t[66]=X):X=t[66];let te;t[67]!==e?(te=e("Schema"),t[67]=e,t[68]=te):te=t[68];let ae;t[69]!==e?(ae=e("Security"),t[69]=e,t[70]=ae):ae=t[70];let se;t[71]!==e?(se=e("Settings"),t[71]=e,t[72]=se):se=t[72];let J;t[73]!==e?(J=e("SQL editor"),t[73]=e,t[74]=J):J=t[74];let ne;t[75]!==e?(ne=e("Access Rules"),t[75]=e,t[76]=ne):ne=t[76];let pe;t[77]!==e?(pe=e("Users"),t[77]=e,t[78]=pe):pe=t[78];let le;t[79]!==e?(le=e("Vectors"),t[79]=e,t[80]=le):le=t[80];let ie;t[81]!==e?(ie=e("Workflows"),t[81]=e,t[82]=ie):ie=t[82];let de;t[83]!==w||t[84]!==C||t[85]!==F||t[86]!==T||t[87]!==E||t[88]!==k||t[89]!==O||t[90]!==D||t[91]!==M||t[92]!==L||t[93]!==U||t[94]!==W||t[95]!==V||t[96]!==j||t[97]!==N||t[98]!==_||t[99]!==B||t[100]!==z||t[101]!==q||t[102]!==$||t[103]!==Y||t[104]!==Q||t[105]!==X||t[106]!==te||t[107]!==ae||t[108]!==se||t[109]!==J||t[110]!==ne||t[111]!==pe||t[112]!==le||t[113]!==ie||t[114]!==v||t[115]!==x||t[116]!==y||t[117]!==b||t[118]!==S?(de={analytics:v,api:x,audit:y,authConfig:b,authSessions:S,dashboards:w,data:C,drains:F,export:T,fanout:E,files:k,flags:O,functions:D,health:M,home:L,insights:U,logs:W,metrics:V,migrations:j,organizations:N,pitr:_,mail:B,payments:z,permissions:q,queues:$,realtime:Y,rls:Q,schedule:X,schema:te,security:ae,settings:se,sql:J,storageRules:ne,users:pe,vectors:le,workflows:ie},t[83]=w,t[84]=C,t[85]=F,t[86]=T,t[87]=E,t[88]=k,t[89]=O,t[90]=D,t[91]=M,t[92]=L,t[93]=U,t[94]=W,t[95]=V,t[96]=j,t[97]=N,t[98]=_,t[99]=B,t[100]=z,t[101]=q,t[102]=$,t[103]=Y,t[104]=Q,t[105]=X,t[106]=te,t[107]=ae,t[108]=se,t[109]=J,t[110]=ne,t[111]=pe,t[112]=le,t[113]=ie,t[114]=v,t[115]=x,t[116]=y,t[117]=b,t[118]=S,t[119]=de):de=t[119];let ue=de,he={advisors:e("Advisors"),auth:e("Auth"),database:e("Database"),functions:e("Functions"),observability:e("Observability"),operations:e("Operations"),overview:e("Overview"),settings:e("Settings"),storage:e("Storage")},Re;t[120]!==e?(Re=e("Usage and latency from Analytics Engine \u2014 request volume, p50/p95, and hot shards."),t[120]=e,t[121]=Re):Re=t[121];let Ae;t[122]!==e?(Ae=e("Interactive OpenAPI reference and copy-paste snippets for your functions."),t[122]=e,t[123]=Ae):Ae=t[123];let ye;t[124]!==e?(ye=e("A durable log of admin state-changing operations."),t[124]=e,t[125]=ye):ye=t[125];let ge;t[126]!==e?(ge=e("Enabled plugins and session config (read-only)."),t[126]=e,t[127]=ge):ge=t[127];let Te;t[128]!==e?(Te=e("Browse and revoke active sessions across all users."),t[128]=e,t[129]=Te):Te=t[129];let ze;t[130]!==e?(ze=e("Chart widgets backed by saved read-only SQL queries."),t[130]=e,t[131]=ze):ze=t[131];let Ze;t[132]!==e?(Ze=e("Browse and edit rows across your shard and global tables."),t[132]=e,t[133]=Ze):Ze=t[133];let _e;t[134]!==e?(_e=e("Forward logs to Logpush, Tail Workers, or a webhook collector."),t[134]=e,t[135]=_e):_e=t[135];let Ie;t[136]!==e?(Ie=e("Export a shard to NDJSON, or import rows from it."),t[136]=e,t[137]=Ie):Ie=t[137];let ke;t[138]!==e?(ke=e("Realtime fan-out cost and per-topic subscriber counts for this shard."),t[138]=e,t[139]=ke):ke=t[139];let Be;t[140]!==e?(Be=e("Browse objects in your R2 storage buckets."),t[140]=e,t[141]=Be):Be=t[141];let Me;t[142]!==e?(Me=e("Inspect feature flags and their live evaluation under a targeting context."),t[142]=e,t[143]=Me):Me=t[143];let je;t[144]!==e?(je=e("Run registered queries, mutations, and actions."),t[144]=e,t[145]=je):je=t[145];let mt;t[146]!==e?(mt=e("At-a-glance connection, error, and shard signals."),t[146]=e,t[147]=mt):mt=t[147];let ht;t[148]!==e?(ht=e("Connection, health, and advisor summary for your deployment."),t[148]=e,t[149]=ht):ht=t[149];let yt;t[150]!==e?(yt=e("Surface slow functions, error spikes, and cache problems."),t[150]=e,t[151]=yt):yt=t[151];let Et;t[152]!==e?(Et=e("A live stream of recent function logs."),t[152]=e,t[153]=Et):Et=t[153];let St;t[154]!==e?(St=e("Per-shard health and aggregate metrics."),t[154]=e,t[155]=St):St=t[155];let jt;t[156]!==e?(jt=e("Review migration status and run them."),t[156]=e,t[157]=jt):jt=t[157];let At;t[158]!==e?(At=e("Browse and manage organizations, members, and invitations."),t[158]=e,t[159]=At):At=t[159];let ee;t[160]!==e?(ee=e("Restore a shard to a point in the last 30 days."),t[160]=e,t[161]=ee):ee=t[161];let ce;t[162]!==e?(ce=e("Email your app sent, captured in dev."),t[162]=e,t[163]=ce):ce=t[163];let Ee;t[164]!==e?(Ee=e("Synced customers, subscriptions, and webhook events."),t[164]=e,t[165]=Ee):Ee=t[165];let Oe;t[166]!==e?(Oe=e("Inspect access policies per table, and probe a function as any identity."),t[166]=e,t[167]=Oe):Oe=t[167];let Ce;t[168]!==e?(Ce=e("Inspect declared Cloudflare Queues \u2014 their producer bindings, consumer mode, and dead-letter queue."),t[168]=e,t[169]=Ce):Ce=t[169];let Ye;t[170]!==e?(Ye=e("Active WebSocket subscriptions on this shard."),t[170]=e,t[171]=Ye):Ye=t[171];let it;t[172]!==e?(it=e("Inspect row-level-security policies and roles, per table."),t[172]=e,t[173]=it):it=t[173];let ft;t[174]!==e?(ft=e("Inspect and cancel scheduled jobs."),t[174]=e,t[175]=ft):ft=t[175];let ct;t[176]!==e?(ct=e("Inspect each table and its columns."),t[176]=e,t[177]=ct):ct=t[177];let Zt;t[178]!==e?(Zt=e("Review admin gates, credentials, and log redaction."),t[178]=e,t[179]=Zt):Zt=t[179];let ao;t[180]!==e?(ao=e("Read-only deployment config \u2014 vars, secrets, and bindings."),t[180]=e,t[181]=ao):ao=t[181];let Vt;t[182]!==e?(Vt=e("Run read-only SQL against a shard."),t[182]=e,t[183]=Vt):Vt=t[183];let Ko;t[184]!==e?(Ko=e("Inspect storage access rules \u2014 per bucket, operation, and key prefix."),t[184]=e,t[185]=Ko):Ko=t[185];let Po;t[186]!==e?(Po=e("Manage auth users \u2014 roles, bans, sessions, and identity."),t[186]=e,t[187]=Po):Po=t[187];let Ge;t[188]!==e?(Ge=e("Browse Vectorize indexes and run similarity searches."),t[188]=e,t[189]=Ge):Ge=t[189];let wt;t[190]!==e?(wt=e("Inspect declared Cloudflare Workflows and their bindings."),t[190]=e,t[191]=wt):wt=t[191];let Ut;t[192]!==Re||t[193]!==Ae||t[194]!==ye||t[195]!==ge||t[196]!==Te||t[197]!==ze||t[198]!==Ze||t[199]!==_e||t[200]!==Ie||t[201]!==ke||t[202]!==Be||t[203]!==Me||t[204]!==je||t[205]!==mt||t[206]!==ht||t[207]!==yt||t[208]!==Et||t[209]!==St||t[210]!==jt||t[211]!==At||t[212]!==ee||t[213]!==ce||t[214]!==Ee||t[215]!==Oe||t[216]!==Ce||t[217]!==Ye||t[218]!==it||t[219]!==ft||t[220]!==ct||t[221]!==Zt||t[222]!==ao||t[223]!==Vt||t[224]!==Ko||t[225]!==Po||t[226]!==Ge||t[227]!==wt?(Ut={analytics:Re,api:Ae,audit:ye,authConfig:ge,authSessions:Te,dashboards:ze,data:Ze,drains:_e,export:Ie,fanout:ke,files:Be,flags:Me,functions:je,health:mt,home:ht,insights:yt,logs:Et,metrics:St,migrations:jt,organizations:At,pitr:ee,mail:ce,payments:Ee,permissions:Oe,queues:Ce,realtime:Ye,rls:it,schedule:ft,schema:ct,security:Zt,settings:ao,sql:Vt,storageRules:Ko,users:Po,vectors:Ge,workflows:wt},t[192]=Re,t[193]=Ae,t[194]=ye,t[195]=ge,t[196]=Te,t[197]=ze,t[198]=Ze,t[199]=_e,t[200]=Ie,t[201]=ke,t[202]=Be,t[203]=Me,t[204]=je,t[205]=mt,t[206]=ht,t[207]=yt,t[208]=Et,t[209]=St,t[210]=jt,t[211]=At,t[212]=ee,t[213]=ce,t[214]=Ee,t[215]=Oe,t[216]=Ce,t[217]=Ye,t[218]=it,t[219]=ft,t[220]=ct,t[221]=Zt,t[222]=ao,t[223]=Vt,t[224]=Ko,t[225]=Po,t[226]=Ge,t[227]=wt,t[228]=Ut):Ut=t[228];let So=Ut,to;t[229]!==o?(to=n(al=>{ot(o({to:`/${al.currentTarget.dataset.tab??""}`}))},"t79"),t[229]=o,t[230]=to):to=t[230];let $o=to,Ho,gr;t[231]!==s||t[232]!==ue?(Ho=n(()=>{typeof document<"u"&&(document.title=`${ue[s]} \xB7 lunora`)},"t80"),gr=[s,ue],t[231]=s,t[232]=ue,t[233]=Ho,t[234]=gr):(Ho=t[233],gr=t[234]),(0,st.useEffect)(Ho,gr);let Ct=p.find(al=>al.tabs.includes(s))??LOe[0],so=p.flatMap(al=>al.tabs.map(tp=>({group:he[al.key],label:ue[tp],to:`/${tp}`}))),Uo=(0,st.use)(tNe),Wr=Uo!==null&&Uo.token!=="",Dr;t[235]!==so?(Dr=(0,P.jsxDEV)(wOe,{items:so},void 0,!1),t[235]=so,t[236]=Dr):Dr=t[236];let Ot;t[237]===Symbol.for("react.memo_cache_sentinel")?(Ot=(0,P.jsxDEV)(dbt,{className:"-ms-1"},void 0,!1),t[237]=Ot):Ot=t[237];let wo;t[238]!==e?(wo=e("Breadcrumb"),t[238]=e,t[239]=wo):wo=t[239];let _r=he[Ct.key],Co;t[240]!==_r?(Co=(0,P.jsxDEV)("span",{className:"text-muted-foreground",children:_r},void 0,!1),t[240]=_r,t[241]=Co):Co=t[241];let fr;t[242]===Symbol.for("react.memo_cache_sentinel")?(fr=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5 text-muted-foreground/60",fill:"none",stroke:"currentColor",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1)},void 0,!1),t[242]=fr):fr=t[242];let Qs=ue[s],rl;t[243]!==Qs?(rl=(0,P.jsxDEV)("span",{className:"font-medium text-foreground",children:Qs},void 0,!1),t[243]=Qs,t[244]=rl):rl=t[244];let Ec;t[245]!==wo||t[246]!==Co||t[247]!==rl?(Ec=(0,P.jsxDEV)("nav",{"aria-label":wo,className:"flex items-center gap-1.5 text-[13px]",children:[Co,fr,rl]},void 0,!0),t[245]=wo,t[246]=Co,t[247]=rl,t[248]=Ec):Ec=t[248];let Qf;t[249]===Symbol.for("react.memo_cache_sentinel")?(Qf=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeWidth:1.8,viewBox:"0 0 24 24",children:[(0,P.jsxDEV)("circle",{cx:"11",cy:"11",r:"7"},void 0,!1),(0,P.jsxDEV)("path",{d:"m21 21-4.3-4.3",strokeLinecap:"round"},void 0,!1)]},void 0,!0),t[249]=Qf):Qf=t[249];let ia;t[250]!==e?(ia=e("Search\u2026"),t[250]=e,t[251]=ia):ia=t[251];let Dl;t[252]===Symbol.for("react.memo_cache_sentinel")?(Dl=(0,P.jsxDEV)("kbd",{className:"ms-auto rounded border border-border bg-background px-1 font-sans text-[10px] text-muted-foreground",children:"\u2318K"},void 0,!1),t[252]=Dl):Dl=t[252];let Zs;t[253]!==ia?(Zs=(0,P.jsxDEV)("button",{className:"mx-auto hidden h-8 w-72 items-center gap-2 rounded-lg border border-border bg-muted/40 px-3 text-xs text-muted-foreground transition-colors hover:bg-muted md:flex","data-testid":"dash-app-search",onClick:SOe,type:"button",children:[Qf,ia,Dl]},void 0,!0),t[253]=ia,t[254]=Zs):Zs=t[254];let Zf;t[255]===Symbol.for("react.memo_cache_sentinel")?(Zf=(0,P.jsxDEV)("div",{className:"ms-auto flex items-center gap-1.5 md:ms-0",children:(0,P.jsxDEV)(KIt,{},void 0,!1)},void 0,!1),t[255]=Zf):Zf=t[255];let nl;t[256]!==Ec||t[257]!==Zs?(nl=(0,P.jsxDEV)("header",{className:"flex h-11 shrink-0 items-center gap-2 border-b border-border px-4","data-testid":"dash-app-header",children:[Ot,Ec,Zs,Zf]},void 0,!0),t[256]=Ec,t[257]=Zs,t[258]=nl):nl=t[258];let _l;t[259]!==Uo?.rulesInstalled?(_l=Uo?.rulesInstalled===!1&&(0,P.jsxDEV)($It,{},void 0,!1),t[259]=Uo?.rulesInstalled,t[260]=_l):_l=t[260];let Jf=`dash-tab-${s}`,Ac=c?"flex min-w-0 flex-1 flex-col overflow-hidden":"min-w-0 flex-1 overflow-auto p-6",Tc=ue[s],kc;t[261]!==e||t[262]!==Tc?(kc=e("{title} failed",{title:Tc}),t[261]=e,t[262]=Tc,t[263]=kc):kc=t[263];let L0=ue[s],gd;t[264]!==e?(gd=e("Try again"),t[264]=e,t[265]=gd):gd=t[265];let ep;t[266]===Symbol.for("react.memo_cache_sentinel")?(ep=(0,P.jsxDEV)(OF,{},void 0,!1),t[266]=ep):ep=t[266];let Mc;t[267]!==s||t[268]!==kc||t[269]!==L0||t[270]!==gd?(Mc=(0,P.jsxDEV)(tb,{fallbackTitle:kc,label:L0,retryLabel:gd,children:ep},s,!1),t[267]=s,t[268]=kc,t[269]=L0,t[270]=gd,t[271]=Mc):Mc=t[271];let Pc;t[272]!==Mc||t[273]!==Ac?(Pc=(0,P.jsxDEV)("div",{className:Ac,children:Mc},void 0,!1),t[272]=Mc,t[273]=Ac,t[274]=Pc):Pc=t[274];let ku;t[275]!==Pc||t[276]!==Jf?(ku=(0,P.jsxDEV)("div",{"aria-labelledby":Jf,className:"flex min-w-0 flex-1 flex-col overflow-hidden","data-testid":"dash-panel",id:"dash-panel",role:"tabpanel",children:Pc},void 0,!1),t[275]=Pc,t[276]=Jf,t[277]=ku):ku=t[277];let vd;return t[278]!==ku||t[279]!==nl||t[280]!==_l?(vd=(0,P.jsxDEV)(fbt,{className:"overflow-hidden md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm",children:[nl,_l,ku]},void 0,!0),t[278]=ku,t[279]=nl,t[280]=_l,t[281]=vd):vd=t[281],(0,P.jsxDEV)(cbt,{className:"min-h-0 flex-1","data-testid":"lunora-studio",children:[Dr,(0,P.jsxDEV)(gSt,{chrome:Uo,connected:Wr,current:s,groupLabel:he,groups:p,selectTab:$o,tabDescription:So,tabLabel:ue},void 0,!1),vd]},void 0,!0)},"StudioLayout"),xSt=n(()=>{let t=(0,Yt.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"dash-pending",children:[(0,P.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,P.jsxDEV)(Rf,{className:"h-8 w-40"},void 0,!1),(0,P.jsxDEV)(Rf,{className:"h-8 w-24"},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Rf,{className:"h-72 w-full"},void 0,!1)]},void 0,!0),t[0]=e):e=t[0],e},"RoutePending"),ySt=n(t=>{let e=(0,Yt.c)(5),{initialShardKey:o,schemaEditable:r}=t,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];let s=zh(a),{table:i}=s,c=typeof i=="string"?i:void 0,d;return e[1]!==o||e[2]!==c||e[3]!==r?(d=(0,P.jsxDEV)(cOe,{initialShardKey:o,initialTable:c,schemaEditable:r},void 0,!1),e[1]=o,e[2]=c,e[3]=r,e[4]=d):d=e[4],d},"SchemaRoutePanel"),ISt=n(()=>{let t=(0,Yt.c)(3),e=zs(),o,r;return t[0]!==e?(o=n(()=>{ot(e({replace:!0,to:"/home"}))},"t0"),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),(0,st.useEffect)(o,r),null},"NotFoundRedirect"),bSt=n(({basePath:t,dataEditable:e=!1,functions:o,initialShardKey:r,openApiSpec:a,openRpcSpec:s,runAsIdentity:i=!1,schemaEditable:c=!1,scheduledCancel:d,scheduledCron:f,scheduledLoad:p})=>{let m=X$({component:vSt}),h={analytics:(0,P.jsxDEV)(Abt,{},void 0,!1),api:(0,P.jsxDEV)(Gge,{functions:o,initialShardKey:r,openApiSpec:a,openRpcSpec:s},void 0,!1),audit:(0,P.jsxDEV)(kAe,{initialShardKey:r},void 0,!1),authConfig:(0,P.jsxDEV)(Mbt,{},void 0,!1),authSessions:(0,P.jsxDEV)(Pbt,{},void 0,!1),dashboards:(0,P.jsxDEV)(z1t,{initialShardKey:r},void 0,!1),data:(0,P.jsxDEV)(zve,{editable:e,initialShardKey:r},void 0,!1),drains:(0,P.jsxDEV)(o1t,{},void 0,!1),export:(0,P.jsxDEV)($ve,{initialShardKey:r},void 0,!1),fanout:(0,P.jsxDEV)(H1t,{initialShardKey:r},void 0,!1),files:(0,P.jsxDEV)(yOe,{},void 0,!1),flags:(0,P.jsxDEV)(e1t,{initialShardKey:r},void 0,!1),functions:(0,P.jsxDEV)("div",{className:"flex flex-col gap-8",children:[(0,P.jsxDEV)(Xve,{functions:o,initialShardKey:r},void 0,!1),(0,P.jsxDEV)(Gve,{functions:o,runAsIdentity:i},void 0,!1)]},void 0,!0),health:(0,P.jsxDEV)(CTe,{initialShardKey:r},void 0,!1),home:(0,P.jsxDEV)(RAe,{initialShardKey:r},void 0,!1),insights:(0,P.jsxDEV)(Mge,{initialShardKey:r},void 0,!1),logs:(0,P.jsxDEV)(_Ae,{initialShardKey:r},void 0,!1),metrics:(0,P.jsxDEV)(nke,{initialShardKey:r},void 0,!1),migrations:(0,P.jsxDEV)(qve,{initialShardKey:r},void 0,!1),organizations:(0,P.jsxDEV)(Nbt,{},void 0,!1),permissions:(0,P.jsxDEV)(P1t,{functions:o,runAsIdentity:i,schemaEditable:c},void 0,!1),pitr:(0,P.jsxDEV)(Wve,{initialShardKey:r},void 0,!1),mail:(0,P.jsxDEV)(QAe,{},void 0,!1),payments:(0,P.jsxDEV)(x1t,{},void 0,!1),queues:(0,P.jsxDEV)(O1t,{},void 0,!1),realtime:(0,P.jsxDEV)(h1t,{initialShardKey:r},void 0,!1),rls:(0,P.jsxDEV)(Sbt,{},void 0,!1),schedule:(0,P.jsxDEV)(f1t,{loadCronJobs:f,scheduledCancel:d,scheduledLoad:p},void 0,!1),schema:(0,P.jsxDEV)(ySt,{initialShardKey:r,schemaEditable:c},void 0,!1),security:(0,P.jsxDEV)(Dge,{},void 0,!1),settings:(0,P.jsxDEV)(dOe,{initialShardKey:r},void 0,!1),sql:(0,P.jsxDEV)(cTe,{initialShardKey:r},void 0,!1),storageRules:(0,P.jsxDEV)(G1t,{},void 0,!1),users:(0,P.jsxDEV)(Xbt,{},void 0,!1),vectors:(0,P.jsxDEV)(Y1t,{},void 0,!1),workflows:(0,P.jsxDEV)(aSt,{},void 0,!1)},v=PF({component:n(()=>h.home,"component"),getParentRoute:n(()=>m,"getParentRoute"),path:"/"}),x=oNe.map(S=>S==="data"?PF({component:n(()=>h[S],"component"),getParentRoute:n(()=>m,"getParentRoute"),path:`/${S}`,validateSearch:Lve}):PF({component:n(()=>h[S],"component"),getParentRoute:n(()=>m,"getParentRoute"),path:`/${S}`})),y=m.addChildren([v,...x]),b="window"in globalThis?EF():F$({initialEntries:["/home"]});return Q$({...t===void 0||t==="/"?{}:{basepath:t},defaultNotFoundComponent:ISt,defaultPendingComponent:xSt,defaultPendingMinMs:0,defaultPendingMs:0,history:b,routeTree:y})},"buildRouter"),SSt=n(t=>{let e=(0,Yt.c)(17),{basePath:o,chrome:r,dataEditable:a,functions:s,initialShardKey:i,openApiSpec:c,openRpcSpec:d,runAsIdentity:f,schemaEditable:p,scheduledCancel:m,scheduledCron:h,scheduledLoad:v}=t,x;e[0]!==o||e[1]!==a||e[2]!==s||e[3]!==i||e[4]!==c||e[5]!==d||e[6]!==f||e[7]!==m||e[8]!==h||e[9]!==v||e[10]!==p?(x=bSt({basePath:o,dataEditable:a,functions:s,initialShardKey:i,openApiSpec:c,openRpcSpec:d,runAsIdentity:f,schemaEditable:p,scheduledCancel:m,scheduledCron:h,scheduledLoad:v}),e[0]=o,e[1]=a,e[2]=s,e[3]=i,e[4]=c,e[5]=d,e[6]=f,e[7]=m,e[8]=h,e[9]=v,e[10]=p,e[11]=x):x=e[11];let y=x,b=r??null,S;e[12]!==y?(S=(0,P.jsxDEV)(Z$,{router:y},void 0,!1),e[12]=y,e[13]=S):S=e[13];let w;return e[14]!==b||e[15]!==S?(w=(0,P.jsxDEV)(tNe,{value:b,children:S},void 0,!1),e[14]=b,e[15]=S,e[16]=w):w=e[16],w},"StudioShell"),rNe=n(t=>{let e=(0,Yt.c)(17),{basePath:o,chrome:r,dataEditable:a,functions:s,i18n:i,initialShardKey:c,locale:d,openApiSpec:f,openRpcSpec:p,runAsIdentity:m,schemaEditable:h,scheduledCancel:v,scheduledCron:x,scheduledLoad:y}=t,b;e[0]!==o||e[1]!==r||e[2]!==a||e[3]!==s||e[4]!==c||e[5]!==f||e[6]!==p||e[7]!==m||e[8]!==v||e[9]!==x||e[10]!==y||e[11]!==h?(b=(0,P.jsxDEV)(SSt,{basePath:o,chrome:r,dataEditable:a,functions:s,initialShardKey:c,openApiSpec:f,openRpcSpec:p,runAsIdentity:m,scheduledCancel:v,scheduledCron:x,scheduledLoad:y,schemaEditable:h},void 0,!1),e[0]=o,e[1]=r,e[2]=a,e[3]=s,e[4]=c,e[5]=f,e[6]=p,e[7]=m,e[8]=v,e[9]=x,e[10]=y,e[11]=h,e[12]=b):b=e[12];let S=b;if(i===void 0&&d===void 0)return S;let w;return e[13]!==i||e[14]!==d||e[15]!==S?(w=(0,P.jsxDEV)(YA,{i18n:i,locale:d,children:S},void 0,!1),e[13]=i,e[14]=d,e[15]=S,e[16]=w):w=e[16],w},"Studio");function wSt(t){return t.location.pathname}n(wSt,"_temp");function CSt(t){return t.tabs.length>0}n(CSt,"_temp2");var YZ="lunora-studio-root";var On=K(po(),1);var XZ="lunora-studio-admin-token",nNe=n(()=>{try{return globalThis.sessionStorage}catch{return}},"store"),FSt=n(()=>{try{return nNe()?.getItem(XZ)??""}catch{return""}},"loadToken"),RSt=n(t=>{let e=nNe();if(e!==void 0)try{t===""?e.removeItem(XZ):e.setItem(XZ,t)}catch{}},"saveToken"),ESt=n(t=>{let e=(0,Dw.c)(42),{onSubmit:o}=t,r=Ve(),[a,s]=(0,Nw.useState)(""),i;e[0]!==a?(i=a.trim(),e[0]=a,e[1]=i):i=e[1];let c=i,d;e[2]!==o||e[3]!==c?(d=n(L=>{L.preventDefault(),c!==""&&o(c)},"t2"),e[2]=o,e[3]=c,e[4]=d):d=e[4];let f=d,p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,On.jsxDEV)("div",{className:"h-10 w-10 text-foreground",children:(0,On.jsxDEV)(GZ,{},void 0,!1)},void 0,!1),e[5]=p):p=e[5];let m;e[6]!==r?(m=r("Connect to Lunora Studio"),e[6]=r,e[7]=m):m=e[7];let h;e[8]!==m?(h=(0,On.jsxDEV)("h1",{className:"text-base font-semibold text-foreground",children:m},void 0,!1),e[8]=m,e[9]=h):h=e[9];let v;e[10]!==r?(v=r("Enter your admin token to access the studio."),e[10]=r,e[11]=v):v=e[11];let x;e[12]!==v?(x=(0,On.jsxDEV)("p",{className:"text-[13px] text-muted-foreground",children:v},void 0,!1),e[12]=v,e[13]=x):x=e[13];let y;e[14]!==h||e[15]!==x?(y=(0,On.jsxDEV)("div",{className:"flex flex-col items-center gap-3 text-center",children:[p,(0,On.jsxDEV)("div",{className:"flex flex-col gap-1",children:[h,x]},void 0,!0)]},void 0,!0),e[14]=h,e[15]=x,e[16]=y):y=e[16];let b;e[17]!==r?(b=r("admin token"),e[17]=r,e[18]=b):b=e[18];let S;e[19]!==b?(S=(0,On.jsxDEV)("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:b},void 0,!1),e[19]=b,e[20]=S):S=e[20];let w;e[21]===Symbol.for("react.memo_cache_sentinel")?(w=n(L=>{s(L.target.value)},"t11"),e[21]=w):w=e[21];let C;e[22]!==a?(C=(0,On.jsxDEV)(mo,{autoComplete:"off",autoFocus:!0,"data-testid":"lunora-studio-login-token",id:"lunora-studio-login-token",onChange:w,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:a},void 0,!1),e[22]=a,e[23]=C):C=e[23];let F;e[24]!==r?(F=r("From your worker's LUNORA_ADMIN_TOKEN \u2014 your project's .dev.vars in dev, or a deployment secret in production."),e[24]=r,e[25]=F):F=e[25];let T;e[26]!==F?(T=(0,On.jsxDEV)("p",{className:"text-[11px] text-muted-foreground",children:F},void 0,!1),e[26]=F,e[27]=T):T=e[27];let E;e[28]!==S||e[29]!==C||e[30]!==T?(E=(0,On.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[S,C,T]},void 0,!0),e[28]=S,e[29]=C,e[30]=T,e[31]=E):E=e[31];let k=c==="",O;e[32]!==r?(O=r("Connect"),e[32]=r,e[33]=O):O=e[33];let D;e[34]!==k||e[35]!==O?(D=(0,On.jsxDEV)(dt,{"data-testid":"lunora-studio-login-submit",disabled:k,type:"submit",children:O},void 0,!1),e[34]=k,e[35]=O,e[36]=D):D=e[36];let M;return e[37]!==f||e[38]!==E||e[39]!==D||e[40]!==y?(M=(0,On.jsxDEV)("form",{className:"flex w-full max-w-sm flex-col gap-5 rounded-xl border border-border bg-card p-7 shadow-lg","data-testid":"lunora-studio-login",onSubmit:f,children:[y,E,D]},void 0,!0),e[37]=f,e[38]=E,e[39]=D,e[40]=y,e[41]=M):M=e[41],M},"StudioLoginForm"),ASt=n(t=>{let e=(0,Dw.c)(10),{i18n:o,onSubmit:r}=t,{resolvedTheme:a}=aV(),s=a==="dark"&&"dark",i;e[0]!==s?(i=tt(YZ,s,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=s,e[1]=i):i=e[1];let c;e[2]!==r?(c=(0,On.jsxDEV)(ESt,{onSubmit:r},void 0,!1),e[2]=r,e[3]=c):c=e[3];let d;e[4]!==o||e[5]!==c?(d=(0,On.jsxDEV)(YA,{i18n:o,children:c},void 0,!1),e[4]=o,e[5]=c,e[6]=d):d=e[6];let f;return e[7]!==i||e[8]!==d?(f=(0,On.jsxDEV)("div",{className:i,"data-testid":"lunora-studio-login-root",children:d},void 0,!1),e[7]=i,e[8]=d,e[9]=f):f=e[9],f},"StudioLogin"),TSt=n(t=>{if(t!==void 0&&t!=="")return t;let e=globalThis.location;return e?.origin!==void 0&&e.origin!==""?e.origin:"http://localhost:5173"},"resolveBaseUrl"),kSt=n(t=>{let e=(0,Dw.c)(23),{basePath:o,chrome:r,studio:a}=t,s=Ve(),i;e[0]!==s?(i=s("Studio failed"),e[0]=s,e[1]=i):i=e[1];let c;e[2]!==s?(c=s("Studio"),e[2]=s,e[3]=c):c=e[3];let d;e[4]!==s?(d=s("Try again"),e[4]=s,e[5]=d):d=e[5];let f=a?.dataEditable,p=a?.functions,m=a?.initialShardKey,h=a?.openApiSpec,v=a?.openRpcSpec,x=a?.runAsIdentity,y=a?.scheduledCancel,b=a?.scheduledLoad,S=a?.schemaEditable,w;e[6]!==o||e[7]!==r||e[8]!==y||e[9]!==b||e[10]!==S||e[11]!==f||e[12]!==p||e[13]!==m||e[14]!==h||e[15]!==v||e[16]!==x?(w=(0,On.jsxDEV)(rNe,{basePath:o,chrome:r,dataEditable:f,functions:p,initialShardKey:m,openApiSpec:h,openRpcSpec:v,runAsIdentity:x,scheduledCancel:y,scheduledLoad:b,schemaEditable:S},void 0,!1),e[6]=o,e[7]=r,e[8]=y,e[9]=b,e[10]=S,e[11]=f,e[12]=p,e[13]=m,e[14]=h,e[15]=v,e[16]=x,e[17]=w):w=e[17];let C;return e[18]!==i||e[19]!==w||e[20]!==c||e[21]!==d?(C=(0,On.jsxDEV)(tb,{fallbackTitle:i,label:c,retryLabel:d,children:w},void 0,!1),e[18]=i,e[19]=w,e[20]=c,e[21]=d,e[22]=C):C=e[22],C},"StudioAppBody"),MSt=n(t=>{let e=(0,Dw.c)(20),{basePath:o,clearToken:r,client:a,i18n:s,onTokenChange:i,rulesInstalled:c,studio:d,token:f}=t,{resolvedTheme:p}=aV(),m;e[0]!==r||e[1]!==i||e[2]!==c||e[3]!==f?(m={clearToken:r,onTokenChange:i,rulesInstalled:c,token:f},e[0]=r,e[1]=i,e[2]=c,e[3]=f,e[4]=m):m=e[4];let h=m,v=p==="dark"&&"dark",x;e[5]!==v?(x=tt(YZ,v,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=v,e[6]=x):x=e[6];let y;e[7]!==o||e[8]!==h||e[9]!==d?(y=(0,On.jsxDEV)(qOe,{children:(0,On.jsxDEV)(kSt,{basePath:o,chrome:h,studio:d},void 0,!1)},void 0,!1),e[7]=o,e[8]=h,e[9]=d,e[10]=y):y=e[10];let b;e[11]!==s||e[12]!==y?(b=(0,On.jsxDEV)(YA,{i18n:s,children:y},void 0,!1),e[11]=s,e[12]=y,e[13]=b):b=e[13];let S;e[14]!==a||e[15]!==b?(S=(0,On.jsxDEV)(r$,{client:a,children:b},void 0,!1),e[14]=a,e[15]=b,e[16]=S):S=e[16];let w;return e[17]!==x||e[18]!==S?(w=(0,On.jsxDEV)("div",{className:x,"data-testid":"lunora-studio-app",children:S},void 0,!1),e[17]=x,e[18]=S,e[19]=w):w=e[19],w},"StudioShell"),aNe=n(t=>{let e=(0,Dw.c)(25),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{adminToken:r,basePath:a,baseUrl:s,client:i,rulesInstalled:c,studio:d,locale:f}=o,p;e[2]!==r?(p=n(()=>r??FSt(),"t2"),e[2]=r,e[3]=p):p=e[3];let[m,h]=(0,Nw.useState)(p),v,x;e[4]!==m?(v=n(()=>{RSt(m)},"t3"),x=[m],e[4]=m,e[5]=v,e[6]=x):(v=e[5],x=e[6]),(0,Nw.useEffect)(v,x);let y=na(m,300),b;e:{if(i!==void 0){b=i;break e}let L;e[7]!==s||e[8]!==y?(L=new hF({url:TSt(s),...y===""?{}:{wsToken:y}}),y!==""&&L.setAuthToken(y),e[7]=s,e[8]=y,e[9]=L):L=e[9],b=L}let S=b,w,C;e[10]!==S||e[11]!==i?(w=n(()=>()=>{i===void 0&&S.close()},"t6"),C=[S,i],e[10]=S,e[11]=i,e[12]=w,e[13]=C):(w=e[12],C=e[13]),(0,Nw.useEffect)(w,C);let F;e[14]===Symbol.for("react.memo_cache_sentinel")?(F=n(L=>{h(L.target.value)},"t8"),e[14]=F):F=e[14];let T=F,E;e[15]===Symbol.for("react.memo_cache_sentinel")?(E=n(()=>{h("")},"t9"),e[15]=E):E=e[15];let k=E,O;e[16]!==f?(O=BF(f),e[16]=f,e[17]=O):O=e[17];let D=O,M;return e[18]!==a||e[19]!==S||e[20]!==D||e[21]!==c||e[22]!==d||e[23]!==m?(M=(0,On.jsxDEV)(jOe,{children:m===""?(0,On.jsxDEV)(ASt,{i18n:D,onSubmit:h},void 0,!1):(0,On.jsxDEV)(MSt,{basePath:a,clearToken:k,client:S,i18n:D,onTokenChange:T,rulesInstalled:c,studio:d,token:m},void 0,!1)},void 0,!1),e[18]=a,e[19]=S,e[20]=D,e[21]=c,e[22]=d,e[23]=m,e[24]=M):M=e[24],M},"StudioApp");var iNe=K(po(),1);var lNe=n((t={})=>{let{container:e="#root",...o}=t,r=typeof e=="string"?document.querySelector(e):e;if(r===null)throw new Error(`mountStudio: container ${typeof e=="string"?e:"element"} not found`);let a=(0,sNe.createRoot)(r);return a.render((0,iNe.jsxDEV)(aNe,{adminToken:o.adminToken,basePath:o.basePath,baseUrl:o.baseUrl,locale:o.locale,rulesInstalled:o.rulesInstalled,studio:o.studio},void 0,!1)),a},"mountStudio");var zm=globalThis;lNe({basePath:typeof zm.__LUNORA_BASE_PATH__=="string"?zm.__LUNORA_BASE_PATH__:"/",adminToken:typeof zm.__LUNORA_ADMIN_TOKEN__=="string"&&zm.__LUNORA_ADMIN_TOKEN__!==""?zm.__LUNORA_ADMIN_TOKEN__:void 0,studio:{dataEditable:zm.__LUNORA_DATA_EDITABLE__===!0,runAsIdentity:zm.__LUNORA_RUN_AS_IDENTITY__===!0,schemaEditable:zm.__LUNORA_SCHEMA_EDITABLE__===!0},rulesInstalled:zm.__LUNORA_RULES_INSTALLED__!==!1});
378
+ `),title:t("Workers Logs")}],[o,r]=(0,st.useState)(""),[a,s]=(0,st.useState)(!1),[i,c]=(0,st.useState)(null),d=n(async()=>{let m=o.trim();if(m==="")return;let h="fetch"in globalThis?globalThis.fetch:void 0;if(h===void 0){c({kind:"error",message:t("fetch is unavailable in this environment.")});return}let v={durationMs:12,function:"messages:list",outcome:"ok",shard:"root",source:"lunora",tablesRead:["messages"],tablesWritten:[],ts:new Date().toISOString(),type:"request"};s(!0),c(null);let x=performance.now();try{let y=await h(m,{body:JSON.stringify(v),headers:{"Content-Type":"application/json"},method:"POST"});c({kind:"success",latencyMs:Math.round(performance.now()-x),status:y.status})}catch(y){c({kind:"error",message:Jt(y)})}finally{s(!1)}},"sendTest"),f=n(()=>{ot(d())},"onSendTest"),p=n(m=>{r(m.target.value)},"onWebhookUrlChange");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"log-drains",children:[(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-3",children:(0,P.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"drain-cf-link",href:$_,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")},void 0,!1)},void 0,!1),(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"drain-readonly-note",children:t("Lunora does not ship logs itself \u2014 forwarding is handled by Cloudflare. Configure a destination below, then test your collector.")},void 0,!1),(0,P.jsxDEV)("section",{className:"flex flex-col gap-3","data-testid":"drain-destinations",children:[(0,P.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Cloudflare destinations")},void 0,!1),e.map(m=>(0,P.jsxDEV)(t1t,{destination:m},m.id,!1))]},void 0,!0),(0,P.jsxDEV)(Rt,{className:"py-0",children:(0,P.jsxDEV)(Xt,{className:"p-3",children:(0,P.jsxDEV)("section",{"data-testid":"drain-webhook",children:[(0,P.jsxDEV)("h3",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Webhook test")},void 0,!1),(0,P.jsxDEV)("p",{className:"mb-2 text-sm text-muted-foreground",children:t("POST a sample Lunora request-log envelope to your collector to confirm it is reachable.")},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,P.jsxDEV)(mo,{className:"min-w-[20rem] flex-1","data-testid":"drain-webhook-url",onChange:p,placeholder:t("https://example.com/logs"),type:"url",value:o},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"drain-webhook-test",disabled:a||o.trim()==="",onClick:f,children:t(a?"Sending\u2026":"Send test event")},void 0,!1)]},void 0,!0),i!==null&&(0,P.jsxDEV)("p",{className:i.kind==="success"?"mt-2 text-sm text-muted-foreground":"mt-2 text-sm text-destructive","data-testid":"drain-webhook-result",role:i.kind==="error"?"alert":void 0,children:i.kind==="success"?t("Delivered \u2014 status {status} in {latency}ms",{latency:i.latencyMs,status:i.status}):t("Failed: {message}",{message:i.message})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"LogDrainsPanel"),r1t={kind:"idle"},n1t=n(({loadCronJobs:t,runCronJob:e}={})=>{let o=Wt(),r=Ve(),[a,s]=(0,st.useState)({}),i=mi(["lunora-cron-jobs",t?"custom":"default"],()=>(t??(()=>o.getCronJobs()))()),{data:c,error:d}=i,f=(0,st.useMemo)(()=>e!==void 0?e:t===void 0?m=>o.runCronJob(m):void 0,[o,t,e]),p=n(async m=>{if(f!==void 0){s(h=>({...h,[m]:{kind:"running"}}));try{await f(m),s(h=>({...h,[m]:{kind:"ok"}})),i.refetch()}catch(h){s(v=>({...v,[m]:{kind:"error",message:Jt(h)}}))}}},"run");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[d!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:d},void 0,!1),c?.length===0&&(0,P.jsxDEV)(co,{description:r("Triggers declared with the cronJobs() builder appear here."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,P.jsxDEV)("circle",{cx:"12",cy:"12",r:"9"},void 0,!1),(0,P.jsxDEV)("path",{d:"M12 7.5V12l4 2"},void 0,!1)]},void 0,!0),testId:"cron-empty",title:r("No cron triggers.")},void 0,!1),c!==void 0&&c.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"cron-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("name")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("schedule")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("target")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("shard")},void 0,!1),f!==void 0&&(0,P.jsxDEV)(Le,{"aria-label":r("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(m=>{let h=a[m.name]??r1t;return(0,P.jsxDEV)(It,{"data-testid":`cron-row-${m.name}`,children:[(0,P.jsxDEV)(Ne,{children:m.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs tabular-nums",children:m.cron},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)("span",{className:"flex items-center gap-2",children:[m.workflow===void 0?(0,P.jsxDEV)(Pt,{variant:"outline",children:r("function")},void 0,!1):(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("workflow")},void 0,!1),(0,P.jsxDEV)("span",{className:"font-mono text-xs",children:m.workflow??m.functionPath},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(Ne,{children:m.shardKey??""},void 0,!1),f!==void 0&&(0,P.jsxDEV)(Ne,{className:"text-right",children:(0,P.jsxDEV)("span",{className:"flex items-center justify-end gap-2",children:[h.kind==="ok"&&(0,P.jsxDEV)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${m.name}`,children:r("ran")},void 0,!1),h.kind==="error"&&(0,P.jsxDEV)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${m.name}`,role:"alert",children:h.message},void 0,!1),(0,P.jsxDEV)(pa,{confirmLabel:r("Run now?"),disabled:h.kind==="running",onConfirm:n(()=>{ot(p(m.name))},"onConfirm"),testId:`cron-run-${m.name}`,children:h.kind==="running"?r("Running\u2026"):r("Run now")},void 0,!1)]},void 0,!0)},void 0,!1)]},`${m.cron}:${m.name}`,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"CronTriggersPanel"),a1t=n(t=>Number.isFinite(t)?pn(t,"\u2014"):"\u2014","formatScheduledFor"),s1t=n(t=>{let e=(0,Yt.c)(34),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{loadJobs:r,removeJob:a,retryJob:s}=o,i=Wt(),c=Ve(),d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-dead-jobs"],e[2]=d):d=e[2];let f;e[3]!==i||e[4]!==r?(f=n(async()=>(await(r??(()=>i.listDeadJobs()))()).toSorted(i1t),"t3"),e[3]=i,e[4]=r,e[5]=f):f=e[5];let p=mi(d,f),m=p.data,[h,v]=(0,st.useState)(void 0),x=p.error??h,y=r===void 0,b;e[6]!==i||e[7]!==y||e[8]!==s?(b=s??(y?U=>i.retryDeadJob(U):void 0),e[6]=i,e[7]=y,e[8]=s,e[9]=b):b=e[9];let S=b,w;e[10]!==i||e[11]!==y||e[12]!==a?(w=a??(y?U=>i.removeDeadJob(U):void 0),e[10]=i,e[11]=y,e[12]=a,e[13]=w):w=e[13];let C=w,F;e[14]!==p?(F=n(()=>{p.refetch()},"t6"),e[14]=p,e[15]=F):F=e[15],us(F,!0);let T;e[16]!==p?(T=n(async U=>{v(void 0);try{await U,p.refetch()}catch(W){v(Jt(W))}},"t7"),e[16]=p,e[17]=T):T=e[17];let E=T,k=S!==void 0||C!==void 0,O;e[18]!==x?(O=x!==void 0&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:x},void 0,!1),e[18]=x,e[19]=O):O=e[19];let D;e[20]!==m?.length||e[21]!==c?(D=m?.length===0&&(0,P.jsxDEV)(co,{description:c("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"},void 0,!1)},void 0,!1),testId:"dlq-empty",title:c("No dead-letter jobs.")},void 0,!1),e[20]=m?.length,e[21]=c,e[22]=D):D=e[22];let M;e[23]!==E||e[24]!==k||e[25]!==m||e[26]!==C||e[27]!==S||e[28]!==c?(M=m!==void 0&&m.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"dlq-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:c("function")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("attempts")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("last tried")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("pool")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("shard")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("id")},void 0,!1),k&&(0,P.jsxDEV)(Le,{"aria-label":c("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:m.map(U=>(0,P.jsxDEV)(It,{"data-testid":`dlq-row-${U.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:U.functionPath},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:U.attempts??0},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:a1t(U.scheduledFor)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:U.pool??""},void 0,!1),(0,P.jsxDEV)(Ne,{children:U.shardKey??""},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:U.id},void 0,!1),k&&(0,P.jsxDEV)(Ne,{className:"text-right",children:(0,P.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[S!==void 0&&(0,P.jsxDEV)(dt,{"data-testid":`dlq-retry-${U.id}`,onClick:n(()=>{ot(E(S(U.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:c("Retry")},void 0,!1),C!==void 0&&(0,P.jsxDEV)(pa,{confirmLabel:c("Drop job?"),onConfirm:n(()=>{ot(E(C(U.id)))},"onConfirm"),testId:`dlq-remove-${U.id}`,children:c("Drop")},void 0,!1)]},void 0,!0)},void 0,!1)]},U.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[23]=E,e[24]=k,e[25]=m,e[26]=C,e[27]=S,e[28]=c,e[29]=M):M=e[29];let L;return e[30]!==M||e[31]!==O||e[32]!==D?(L=(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[O,D,M]},void 0,!0),e[30]=M,e[31]=O,e[32]=D,e[33]=L):L=e[33],L},"DeadLetterJobs");function i1t(t,e){return(e.attempts??0)-(t.attempts??0)}n(i1t,"_temp$5");var HZ=n(t=>{let e=(0,Yt.c)(8),{label:o,testId:r,value:a}=t,s;e[0]!==o?(s=(0,P.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:o},void 0,!1),e[0]=o,e[1]=s):s=e[1];let i;e[2]!==r||e[3]!==a?(i=(0,P.jsxDEV)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":r,children:a},void 0,!1),e[2]=r,e[3]=a,e[4]=i):i=e[4];let c;return e[5]!==s||e[6]!==i?(c=(0,P.jsxDEV)(Rt,{className:"flex-1 py-0",children:(0,P.jsxDEV)(Xt,{className:"flex flex-col gap-1 p-4",children:[s,i]},void 0,!0)},void 0,!1),e[5]=s,e[6]=i,e[7]=c):c=e[7],c},"StatTile"),l1t=n(t=>{let e=(0,Yt.c)(25),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{loadStatus:r}=o,a=Wt(),s=Ve(),i=r===void 0,c;e[2]!==i?(c=["lunora-scheduler-status",i],e[2]=i,e[3]=c):c=e[3];let d;e[4]!==a||e[5]!==r?(d=n(async()=>{let w=await(r??(()=>a.schedulerStatus()))();return{...w,pools:w.pools.toSorted(c1t)}},"t4"),e[4]=a,e[5]=r,e[6]=d):d=e[6];let f=mi(c,d),{data:p,error:m}=f,h;e[7]!==f?(h=n(()=>{f.refetch()},"t5"),e[7]=f,e[8]=h):h=e[8],us(h,!0);let v;e[9]!==m?(v=m!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:m},void 0,!1),e[9]=m,e[10]=v):v=e[10];let x;e[11]!==p||e[12]!==s?(x=p!==void 0&&(0,P.jsxDEV)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,P.jsxDEV)(HZ,{label:s("backlog"),testId:"pools-backlog",value:p.backlog},void 0,!1),(0,P.jsxDEV)(HZ,{label:s("in flight"),testId:"pools-inflight",value:p.inFlight},void 0,!1),(0,P.jsxDEV)(HZ,{label:s("pools"),testId:"pools-count",value:p.pools.length},void 0,!1)]},void 0,!0),e[11]=p,e[12]=s,e[13]=x):x=e[13];let y;e[14]!==p?.pools.length||e[15]!==s?(y=p?.pools.length===0&&(0,P.jsxDEV)(co,{description:s("Pools created with createWorkpool appear here once they have activity."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M4 7h16M4 12h16M4 17h16"},void 0,!1)},void 0,!1),testId:"pools-empty",title:s("No workpools.")},void 0,!1),e[14]=p?.pools.length,e[15]=s,e[16]=y):y=e[16];let b;e[17]!==p||e[18]!==s?(b=p!==void 0&&p.pools.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"pools-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:s("pool")},void 0,!1),(0,P.jsxDEV)(Le,{children:s("queued")},void 0,!1),(0,P.jsxDEV)(Le,{children:s("in flight")},void 0,!1),(0,P.jsxDEV)(Le,{children:s("max concurrency")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:p.pools.map(u1t)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[17]=p,e[18]=s,e[19]=b):b=e[19];let S;return e[20]!==v||e[21]!==x||e[22]!==y||e[23]!==b?(S=(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[v,x,y,b]},void 0,!0),e[20]=v,e[21]=x,e[22]=y,e[23]=b,e[24]=S):S=e[24],S},"SchedulerPoolsPanel");function c1t(t,e){return e.queued-t.queued}n(c1t,"_temp$4");function u1t(t){return(0,P.jsxDEV)(It,{"data-testid":`pools-row-${t.name}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:t.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:t.queued},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:[t.inFlight," / ",t.maxConcurrency]},void 0,!0),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:t.maxConcurrency},void 0,!1)]},t.name,!0)}n(u1t,"_temp2$2");var d1t=["jobs","dead","pools","cron"],f1t=n(t=>{let e=(0,Yt.c)(41),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{loadCronJobs:r,scheduledCancel:a,scheduledLoad:s}=o,i=Ve(),[c,d]=(0,st.useState)("jobs"),f;e[2]!==i?(f=i("Cron triggers"),e[2]=i,e[3]=f):f=e[3];let p;e[4]!==i?(p=i("Dead letter"),e[4]=i,e[5]=p):p=e[5];let m;e[6]!==i?(m=i("Scheduled jobs"),e[6]=i,e[7]=m):m=e[7];let h;e[8]!==i?(h=i("Pools"),e[8]=i,e[9]=h):h=e[9];let v;e[10]!==f||e[11]!==p||e[12]!==m||e[13]!==h?(v={cron:f,dead:p,jobs:m,pools:h},e[10]=f,e[11]=p,e[12]=m,e[13]=h,e[14]=v):v=e[14];let x=v,y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=n(D=>{d(D.currentTarget.dataset.view)},"t7"),e[15]=y):y=e[15];let b=y,S;e[16]!==i?(S=i("Schedule view"),e[16]=i,e[17]=S):S=e[17];let w;e[18]!==c||e[19]!==x?(w=d1t.map(D=>(0,P.jsxDEV)(dt,{"aria-selected":c===D,"data-testid":`schedule-view-${D}`,"data-view":D,onClick:b,role:"tab",size:"sm",type:"button",variant:c===D?"default":"outline",children:x[D]},D,!1)),e[18]=c,e[19]=x,e[20]=w):w=e[20];let C;e[21]!==S||e[22]!==w?(C=(0,P.jsxDEV)("div",{"aria-label":S,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:w},void 0,!1),e[21]=S,e[22]=w,e[23]=C):C=e[23];let F;e[24]!==a||e[25]!==s||e[26]!==c?(F=c==="jobs"&&(0,P.jsxDEV)(eTe,{cancelJob:a,loadJobs:s},void 0,!1),e[24]=a,e[25]=s,e[26]=c,e[27]=F):F=e[27];let T;e[28]!==c?(T=c==="dead"&&(0,P.jsxDEV)(s1t,{},void 0,!1),e[28]=c,e[29]=T):T=e[29];let E;e[30]!==c?(E=c==="pools"&&(0,P.jsxDEV)(l1t,{},void 0,!1),e[30]=c,e[31]=E):E=e[31];let k;e[32]!==r||e[33]!==c?(k=c==="cron"&&(0,P.jsxDEV)(n1t,{loadCronJobs:r},void 0,!1),e[32]=r,e[33]=c,e[34]=k):k=e[34];let O;return e[35]!==C||e[36]!==F||e[37]!==T||e[38]!==E||e[39]!==k?(O=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[C,F,T,E,k]},void 0,!0),e[35]=C,e[36]=F,e[37]=T,e[38]=E,e[39]=k,e[40]=O):O=e[40],O},"SchedulePanel"),MOe=80,p1t=n(t=>{if(t===void 0)return"";let e=JSON.stringify(t);return e.length>MOe?`${e.slice(0,MOe)}\u2026`:e},"formatArguments"),m1t=n(t=>{let e=[];for(let o of t){let r=o.id.toString();if(o.subscriptions.length===0){e.push({admin:o.admin,connectionId:o.id,key:`c${r}`,subscription:null});continue}o.subscriptions.forEach((a,s)=>{e.push({admin:o.admin,connectionId:o.id,key:`c${r}-s${s.toString()}`,subscription:a})})}return e},"toRows"),jZ=(0,P.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1),h1t=n(t=>{let e=(0,Yt.c)(20),{initialShardKey:o}=t,r=Ve(),[a,s]=(0,st.useState)(o??""),i;e[0]!==a?(i=a.trim(),e[0]=a,e[1]=i):i=e[1];let c=na(i,400),d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d={},e[2]=d):d=e[2];let f;e[3]!==c?(f={keepPreviousData:!0,shardKey:c},e[3]=c,e[4]=f):f=e[4];let{data:p,error:m,refetch:h}=_o(vt.listSubscriptions,d,f);us(h,!0);let v;if(e[5]!==m||e[6]!==p||e[7]!==a||e[8]!==r){let x=p===void 0?[]:m1t(p.connections),y;e[10]!==a?(y=(0,P.jsxDEV)(Qr,{onChange:s,testId:"subs-shard-input",value:a},void 0,!1),e[10]=a,e[11]=y):y=e[11];let b;e[12]!==p||e[13]!==r?(b=p!==void 0&&(0,P.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("{count} connections",{count:p.totalConnections})},void 0,!1),(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("{count} subscriptions",{count:p.totalSubscriptions})},void 0,!1)]},void 0,!0),e[12]=p,e[13]=r,e[14]=b):b=e[14];let S;e[15]!==y||e[16]!==b?(S=(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[y,b]},void 0,!0),e[15]=y,e[16]=b,e[17]=S):S=e[17];let w;e[18]!==m?(w=m!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"subs-error",role:"alert",children:m},void 0,!1),e[18]=m,e[19]=w):w=e[19],v=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[S,w,m===null&&p!==void 0&&x.length===0&&(0,P.jsxDEV)(co,{description:r("Active WebSocket subscriptions on this shard."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},void 0,!1)},void 0,!1),testId:"subs-empty",title:r("No active subscriptions.")},void 0,!1),m===null&&x.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"subs-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("Connection")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("Function path")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("Table")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("Arguments")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:x.map(C=>{let{subscription:F}=C,T=p1t(F?.args);return(0,P.jsxDEV)(It,{"data-testid":"subs-row",children:[(0,P.jsxDEV)(Ne,{className:"font-medium tabular-nums",children:(0,P.jsxDEV)("span",{className:"inline-flex items-center gap-1.5",children:["#",C.connectionId,C.admin&&(0,P.jsxDEV)(Pt,{variant:"outline",children:r("admin")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:F?.functionPath??jZ},void 0,!1),(0,P.jsxDEV)(Ne,{children:F?.table??jZ},void 0,!1),(0,P.jsxDEV)(Ne,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:T||void 0,children:T||jZ},void 0,!1)]},C.key,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[5]=m,e[6]=p,e[7]=a,e[8]=r,e[9]=v}else v=e[9];return v},"SubscriptionsPanel"),JOe=new Set(["active","trialing"]),g1t=new Set(["past_due","unpaid"]),Nl=n((t,e)=>{if(t[e]!==void 0)return t[e];let o=t.__doc__;if(typeof o=="string")try{let r=JSON.parse(o);if(r!==null&&typeof r=="object"&&!Array.isArray(r))return r[e]}catch{}},"readField"),Xf=n(t=>typeof t=="string"?t:typeof t=="number"||typeof t=="bigint"||typeof t=="boolean"?String(t):"","text"),v1t=n(t=>JOe.has(t)?"default":g1t.has(t)?"destructive":"outline","badgeVariant"),x1t=n(({limit:t=100})=>{let e=Ve(),o=_o(vt.readTablePage,{filters:[],limit:t,offset:0,orderBy:[],search:"",table:"subscriptions"}),r=_o(vt.readTablePage,{filters:[],limit:25,offset:0,orderBy:[],search:"",table:"events"});us(()=>{o.refetch(),r.refetch()},!0);let a=o.data?.rows??[],s=r.data?.rows??[],i=o.error??r.error,c=a.filter(f=>JOe.has(Xf(Nl(f,"state")))).length,d=s.toSorted((f,p)=>Number(Nl(p,"processedAt")??0)-Number(Nl(f,"processedAt")??0));return(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,P.jsxDEV)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,P.jsxDEV)(Rt,{className:"justify-between gap-0 py-0",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("Subscriptions")},void 0,!1),(0,P.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,P.jsxDEV)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:c},void 0,!1),(0,P.jsxDEV)(Pt,{variant:"default",children:e("{count} active",{count:c})},void 0,!1)]},void 0,!0)]},void 0,!0),(0,P.jsxDEV)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:e("{total} total",{total:a.length})},void 0,!1)]},void 0,!0)},void 0,!1),i===null?void 0:(0,P.jsxDEV)("p",{className:"text-sm text-destructive",children:i},void 0,!1),a.length===0&&!o.isLoading?(0,P.jsxDEV)(co,{testId:"payments-empty",title:e("No subscriptions yet")},void 0,!1):(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Provider")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Reference")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Plan")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("State")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Renews")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:a.map(f=>{let p=Xf(Nl(f,"state"));return(0,P.jsxDEV)(It,{"data-testid":"payment-subscription-row",children:[(0,P.jsxDEV)(Ne,{children:Xf(Nl(f,"provider"))},void 0,!1),(0,P.jsxDEV)(Ne,{children:Xf(Nl(f,"referenceId"))},void 0,!1),(0,P.jsxDEV)(Ne,{children:Xf(Nl(f,"priceId"))},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(Pt,{variant:v1t(p),children:p},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{children:pn(Nl(f,"currentPeriodEnd"))},void 0,!1)]},Xf(Nl(f,"providerSubscriptionId")),!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:[(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("Recent webhook events")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{children:(0,P.jsxDEV)(To,{children:d.map(f=>(0,P.jsxDEV)(It,{"data-testid":"payment-event-row",children:[(0,P.jsxDEV)(Ne,{children:Xf(Nl(f,"provider"))},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-medium",children:Xf(Nl(f,"type"))},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground",children:Xf(Nl(f,"providerEventId"))},void 0,!1),(0,P.jsxDEV)(Ne,{children:pn(Nl(f,"processedAt"))},void 0,!1)]},Xf(Nl(f,"providerEventId")),!0))},void 0,!1)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"PaymentsPanel"),POe=["read","insert","update","delete"],y1t=n((t,e)=>({delete:t("Delete"),insert:t("Insert"),read:t("Read"),update:t("Update")})[e],"operationLabel$1"),I1t=n(t=>{let e=new Set;for(let o of t?.advisories??[])if(o.name==="rls_uncovered_table"){let{table:r}=o.metadata;typeof r=="string"&&r!==""&&e.add(r)}return e},"uncoveredTables"),b1t=n((t,e,o)=>{let r=new Map,a=n(s=>{let i=r.get(s);if(i!==void 0)return i;let c={cells:{delete:{},insert:{},read:{},update:{}},maskedColumns:[],table:s,uncovered:o.has(s)};return r.set(s,c),c},"ensure");for(let s of t)a(s.table).cells[s.on]={procedure:s.procedure};for(let s of e){let i=a(s.table);i.maskedColumns.includes(s.column)||i.maskedColumns.push(s.column)}for(let s of o)a(s);return[...r.values()].toSorted((s,i)=>s.table.localeCompare(i.table))},"buildRows"),S1t=n(t=>{let e=(0,Yt.c)(16),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{onProbe:r}=o,a=Ve(),s,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(s={},i={live:!0},e[2]=s,e[3]=i):(s=e[2],i=e[3]);let c=_o(vt.rlsPolicies,s,i),d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d={},e[4]=d):d=e[4];let f=_o(vt.maskPolicies,d),p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p={},e[5]=p):p=e[5];let m=_o(vt.getAdvisories,p),h;if(e[6]!==m.data||e[7]!==f.data||e[8]!==r||e[9]!==c||e[10]!==a){let v=null;c.data!==void 0&&(v=Array.isArray(c.data.policies)?c.data.policies:[]);let x=Array.isArray(f.data?.columns)?f.data.columns:[],y=m.data??null,{error:b,liveError:S}=c,w=v===null?[]:b1t(v,x,I1t(y)),C;e[12]!==S?(C=(0,P.jsxDEV)("div",{className:"flex items-center justify-end",children:(0,P.jsxDEV)(Rl,{message:S,prefix:"pm"},void 0,!1)},void 0,!1),e[12]=S,e[13]=C):C=e[13];let F;e[14]!==b?(F=b!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pm-error",role:"alert",children:b},void 0,!1),e[14]=b,e[15]=F):F=e[15],h=(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-matrix",children:[C,F,v!==null&&w.length===0?(0,P.jsxDEV)(co,{description:a("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),testId:"pm-empty",title:a("No policy")},void 0,!1):(0,P.jsxDEV)(Ao,{"data-testid":"pm-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:a("Table")},void 0,!1),POe.map(T=>(0,P.jsxDEV)(Le,{children:y1t(a,T)},T,!1)),(0,P.jsxDEV)(Le,{children:a("Masked columns")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:w.map(T=>(0,P.jsxDEV)(It,{"data-testid":`pm-row-${T.table}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:(0,P.jsxDEV)("span",{className:"flex items-center gap-1.5",children:[T.table,T.uncovered&&(0,P.jsxDEV)(Pt,{"data-testid":`pm-uncovered-${T.table}`,title:a("Uncovered \u2014 reachable without a policy"),variant:"destructive",children:a("Uncovered \u2014 reachable without a policy")},void 0,!1)]},void 0,!0)},void 0,!1),POe.map(E=>{let k=T.cells[E];return(0,P.jsxDEV)(Ne,{"data-testid":`pm-cell-${T.table}-${E}`,children:k.procedure===void 0?(0,P.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:a("No policy")},void 0,!1):(0,P.jsxDEV)("span",{className:"flex flex-col gap-1",children:[(0,P.jsxDEV)(Pt,{variant:"secondary",children:a("Covered by {procedure}",{procedure:k.procedure})},void 0,!1),r!==void 0&&(0,P.jsxDEV)(dt,{className:"h-auto justify-start p-0 text-[11px]","data-testid":`pm-probe-${T.table}-${E}`,onClick:n(()=>{r(T.table,E,k.procedure??"")},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Probe this")},void 0,!1)]},void 0,!0)},E,!1)}),(0,P.jsxDEV)(Ne,{children:T.maskedColumns.length===0?(0,P.jsxDEV)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,P.jsxDEV)("span",{className:"flex flex-wrap gap-1",children:T.maskedColumns.map(w1t)},void 0,!1)},void 0,!1)]},T.table,!0))},void 0,!1)]},void 0,!0)]},void 0,!0),e[6]=m.data,e[7]=f.data,e[8]=r,e[9]=c,e[10]=a,e[11]=h}else h=e[11];return h},"PermissionsMatrix");function w1t(t){return(0,P.jsxDEV)(Pt,{variant:"outline",children:t},t,!1)}n(w1t,"_temp$3");var C1t=ro(vt.runAs),F1t=n(()=>{let t=Wt();return async({args:e,functionPath:o,shardKey:r="",userId:a})=>{let s=C1t;try{return{kind:"allowed",value:await t.query(s,{args:e,functionPath:o,userId:a},lo(r))}}catch(i){return{kind:"denied",message:i instanceof Error?i.message:String(i)}}}},"useRunAsProbe"),R1t=n(t=>t===void 0?"undefined":JSON.stringify(t,null,2),"formatValue"),E1t=n(({functions:t,prefill:e,runAsIdentity:o=!1}={})=>{let r=Wt(),a=Ve(),s=F1t(),[i,c]=(0,st.useState)(null),[d,f]=(0,st.useState)(null),p=t??i??[],[m,h]=(0,st.useState)(""),[v,x]=(0,st.useState)("{}"),[y,b]=(0,st.useState)(""),[S,w]=(0,st.useState)(""),[C,F]=(0,st.useState)(!1),[T,E]=(0,st.useState)(null),[k,O]=(0,st.useState)(null),D=(0,st.useRef)(-1);(0,st.useEffect)(()=>{if(t!==void 0)return;let N=!1;return r.listFunctions().then(_=>(N||c(_),_)).catch(_=>{N||f(Jt(_))}),()=>{N=!0}},[r,t]),(0,st.useEffect)(()=>{if(e===void 0||D.current===e.nonce)return;D.current=e.nonce;let N=e.functionPath;queueMicrotask(()=>{h(N),E(null)})},[e]);let M=m===""?p[0]?.path??"":m,L=n(async()=>{if(M==="")return;let N;try{N=v.trim()===""?{}:JSON.parse(v)}catch(_){O(a("Invalid JSON args: {message}",{message:_.message})),E(null);return}O(null),F(!0);try{let _=await s({args:N,functionPath:M,shardKey:y.trim(),userId:S.trim()});E(_)}finally{F(!1)}},"run"),U=n(()=>{ot(L())},"runOnce"),W=n(N=>{h(N.target.value)},"onSelectChange"),V=n(N=>{x(N.target.value)},"onArgsChange"),j=n(N=>{w(N.target.value)},"onUserIdChange");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-playground",children:[d!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pp-discover-error",role:"alert",children:d},void 0,!1),!o&&(0,P.jsxDEV)(co,{description:a("Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS."),testId:"pp-gate",title:a("Set `runAsIdentity` to forge an identity and probe access.")},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,P.jsxDEV)(Go,{htmlFor:"pp-function",children:a("Function")},void 0,!1),(0,P.jsxDEV)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","data-testid":"pp-function",id:"pp-function",onChange:W,value:M,children:p.map(N=>(0,P.jsxDEV)("option",{value:N.path,children:[N.path," (",N.kind,")"]},N.path,!0))},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,P.jsxDEV)(Go,{htmlFor:"pp-args",children:a("Arguments")},void 0,!1),(0,P.jsxDEV)(Ff,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"pp-args",id:"pp-args",onChange:V,value:v},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Qr,{onChange:b,testId:"pp-shard",value:y},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,P.jsxDEV)(Go,{htmlFor:"pp-user",children:a("Run as (userId)")},void 0,!1),(0,P.jsxDEV)(mo,{"aria-label":a("Identity (userId) to run as"),className:"font-mono text-xs","data-testid":"pp-user",id:"pp-user",onChange:j,placeholder:a("Leave empty to run as admin"),value:S},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,P.jsxDEV)(dt,{"data-testid":"pp-run",disabled:!o||C||M==="",onClick:U,type:"button",children:a(C?"Probing\u2026":"Run probe")},void 0,!1),S.trim()!==""&&(0,P.jsxDEV)(Pt,{"data-testid":"pp-as-badge",variant:"secondary",children:a("as {userId}",{userId:S.trim()})},void 0,!1)]},void 0,!0)]},void 0,!0),k!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pp-args-error",role:"alert",children:k},void 0,!1),T!==null&&T.kind==="allowed"&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-allowed",children:[(0,P.jsxDEV)(Pt,{variant:"secondary",children:a("Allowed")},void 0,!1),(0,P.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-result",children:R1t(T.value)},void 0,!1)]},void 0,!0),T!==null&&T.kind==="denied"&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-denied",children:[(0,P.jsxDEV)(Pt,{variant:"destructive",children:a("Denied")},void 0,!1),(0,P.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"pp-denied",role:"alert",children:T.message},void 0,!1)]},void 0,!0)]},void 0,!0)},"PermissionsPlayground"),A1t="/__lunora/policy-scaffold",T1t={"already-wired":"That procedure already has an rls(...) policy wired in.","file-exists":"A policy file with that name already exists \u2014 pick another name or edit it by hand.","invalid-identifier":"Name, table, and policy-set must be plain identifiers (letters, digits, _ or $).","unknown-procedure":"No exported procedure was found at that file path.","unsupported-procedure-shape":"That procedure uses the bare query({\u2026}) form \u2014 convert it to the builder form (c.use(\u2026).query(\u2026)) before wiring RLS."},k1t=n(async t=>{let e=await fetch(A1t,{body:JSON.stringify(t),headers:{"Content-Type":"application/json"},method:"POST"}),o=await e.json();if(o.needsManualEdit===!0)return{kind:"needs-manual-edit",message:o.message??"This change must be made by hand."};if(e.ok)return{diagnostics:o.diagnostics??[],kind:"ok",label:o.fileName??o.exportName??""};let r=o.error;return{kind:"error",message:r===void 0?`policy scaffold failed (${String(e.status)})`:T1t[r]??r}},"applyPolicyScaffold"),OOe={exportName:"",filePath:"",policyName:"",policies:"",tableName:""},M1t=n(()=>{let t=Ve(),[e,o]=(0,st.useState)(null),[r,a]=(0,st.useState)(!1),[s,i]=(0,st.useState)(null),[c,d]=(0,st.useState)(OOe),f=n(b=>{let S=b.target.name,{value:w}=b.target;d(C=>({...C,[S]:w}))},"onFieldChange"),p=n(()=>{o(null),d(OOe)},"reset"),m=n(async b=>{a(!0),i(null);try{let S=await k1t(b);i(S),S.kind==="ok"&&p()}catch(S){i({kind:"error",message:S instanceof Error?S.message:String(S)})}finally{a(!1)}},"submit"),h=n(()=>{ot(m({kind:"scaffoldPolicy",name:c.policyName.trim(),table:c.tableName.trim()}))},"onSubmitScaffold"),v=n(()=>{ot(m({exportName:c.exportName.trim(),filePath:c.filePath.trim(),kind:"wireRls",policies:c.policies.trim()}))},"onSubmitWire"),x=n(()=>{i(null),o("scaffold")},"openScaffold"),y=n(()=>{i(null),o("wire")},"openWire");return(0,P.jsxDEV)(Rt,{"data-testid":"policy-scaffolder",size:"sm",children:[(0,P.jsxDEV)(nu,{children:[(0,P.jsxDEV)(au,{children:t("Scaffold access rules")},void 0,!1),(0,P.jsxDEV)(Vg,{children:t("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only.")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Xt,{children:[(0,P.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,P.jsxDEV)(dt,{"data-testid":"policy-scaffolder-new",onClick:x,size:"xs",type:"button",variant:e==="scaffold"?"default":"outline",children:t("New policy file")},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"policy-scaffolder-wire",onClick:y,size:"xs",type:"button",variant:e==="wire"?"default":"outline",children:t("Wire into a procedure")},void 0,!1)]},void 0,!0),e==="scaffold"&&(0,P.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-new-form",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-name",children:t("Policy name")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-name",id:"policy-scaffolder-name",name:"policyName",onChange:f,value:c.policyName},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-table",children:t("Table name")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-table",id:"policy-scaffolder-table",name:"tableName",onChange:f,value:c.tableName},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"policy-scaffolder-create",disabled:r||c.policyName.trim()===""||c.tableName.trim()==="",onClick:h,size:"xs",type:"button",children:t(r?"Creating\u2026":"Create policy file")},void 0,!1),(0,P.jsxDEV)(dt,{onClick:p,size:"xs",type:"button",variant:"ghost",children:t("Cancel")},void 0,!1)]},void 0,!0),e==="wire"&&(0,P.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-wire-form",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-file",children:t("Procedure file path")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-file",id:"policy-scaffolder-file",name:"filePath",onChange:f,value:c.filePath},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-export",children:t("Exported procedure")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-export",id:"policy-scaffolder-export",name:"exportName",onChange:f,value:c.exportName},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-policies",children:t("Policy set identifier")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-policies",id:"policy-scaffolder-policies",name:"policies",onChange:f,value:c.policies},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"policy-scaffolder-apply",disabled:r||c.filePath.trim()===""||c.exportName.trim()===""||c.policies.trim()==="",onClick:v,size:"xs",type:"button",children:t(r?"Wiring\u2026":"Wire RLS")},void 0,!1),(0,P.jsxDEV)(dt,{onClick:p,size:"xs",type:"button",variant:"ghost",children:t("Cancel")},void 0,!1)]},void 0,!0),s?.kind==="error"&&(0,P.jsxDEV)("p",{className:"mt-3 text-sm text-destructive","data-testid":"policy-scaffolder-error",role:"alert",children:s.message},void 0,!1),s?.kind==="needs-manual-edit"&&(0,P.jsxDEV)("p",{className:"mt-3 text-sm text-amber-600 dark:text-amber-500","data-testid":"policy-scaffolder-manual",role:"alert",children:t("This change must be made by hand \u2014 the scaffolder only adds new, deny-by-default rules.")},void 0,!1),s?.kind==="ok"&&(0,P.jsxDEV)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"policy-scaffolder-ok",children:[(0,P.jsxDEV)("p",{className:"text-sm text-emerald-600 dark:text-emerald-500",children:t("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.",{label:s.label})},void 0,!1),s.diagnostics.length>0&&(0,P.jsxDEV)("ul",{className:"flex flex-col gap-0.5","data-testid":"policy-scaffolder-diagnostics",children:s.diagnostics.map(b=>(0,P.jsxDEV)("li",{className:"font-mono text-[11px] text-destructive",children:b},b,!1))},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)},"PolicyScaffolder"),P1t=n(({functions:t,runAsIdentity:e=!1,schemaEditable:o=!1}={})=>{let r=Ve(),[a,s]=(0,st.useState)(void 0),i=n((c,d,f)=>{f!==""&&s(p=>({functionPath:f,nonce:(p?.nonce??0)+1}))},"onProbe");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-8","data-testid":"lunora-permissions",children:[(0,P.jsxDEV)("section",{className:"flex flex-col gap-3",children:[(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Permissions")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(S1t,{onProbe:i},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("section",{className:"flex flex-col gap-3",children:(0,P.jsxDEV)(Rt,{className:"gap-0 py-0",children:[(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Probe")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Xt,{className:"px-4 py-4",children:[(0,P.jsxDEV)("p",{className:"mb-3 text-sm text-muted-foreground",children:r("Pick a function and an identity, then run it to see the access outcome.")},void 0,!1),(0,P.jsxDEV)(E1t,{functions:t,prefill:a,runAsIdentity:e},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1),o&&(0,P.jsxDEV)("section",{className:"flex flex-col gap-2",children:(0,P.jsxDEV)(M1t,{},void 0,!1)},void 0,!1)]},void 0,!0)},"PermissionsPanel"),O1t=n(()=>{let t=(0,Yt.c)(17),e=Ve(),o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={},t[0]=o):o=t[0];let{data:r,error:a}=_o(vt.listQueues,o),s=r!==void 0,i;t[1]!==r?(i=Array.isArray(r?.queues)?[...r.queues].toSorted(N1t):[],t[1]=r,t[2]=i):i=t[2];let c=i,d;t[3]!==a?(d=a!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"queues-error",role:"alert",children:a},void 0,!1),t[3]=a,t[4]=d):d=t[4];let f;t[5]!==e?(f=e("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),t[5]=e,t[6]=f):f=t[6];let p;t[7]!==f?(p=(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:f},void 0,!1),t[7]=f,t[8]=p):p=t[8];let m;t[9]!==s||t[10]!==c||t[11]!==e?(m=s&&c.length===0?(0,P.jsxDEV)(co,{description:e("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:e("No queues defined")},void 0,!1):(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"queues-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Export")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Queue")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Mode")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Binding")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Dead-letter")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(D1t)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[9]=s,t[10]=c,t[11]=e,t[12]=m):m=t[12];let h;return t[13]!==d||t[14]!==p||t[15]!==m?(h=(0,P.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-queues-panel",children:[d,p,m]},void 0,!0),t[13]=d,t[14]=p,t[15]=m,t[16]=h):h=t[16],h},"QueuesPanel");function N1t(t,e){return t.exportName.localeCompare(e.exportName)}n(N1t,"_temp$2");function D1t(t){return(0,P.jsxDEV)(It,{"data-testid":`queues-row-${t.exportName}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:t.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:t.mode},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:t.binding},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:t.deadLetterQueue??"\u2014"},void 0,!1)]},t.exportName,!0)}n(D1t,"_temp2$1");var _1t=ro(vt.runSql),L1t=n((t,e)=>{let o=Wt(),[r,a]=(0,st.useState)(void 0),[s,i]=(0,st.useState)(void 0),[c,d]=(0,st.useState)(!0),f=(0,st.useCallback)(async p=>{d(!0);try{let m=await o.query(_1t,{sql:t},lo(e));p.cancelled||(a(m),i(void 0))}catch(m){p.cancelled||(a(void 0),i(Jt(m)))}finally{p.cancelled||d(!1)}},[o,t,e]);return(0,st.useEffect)(()=>{let p={cancelled:!1};return ot(f(p)),()=>{p.cancelled=!0}},[f]),{error:s,loading:c,result:r}},"useRunSql"),B1t="lunora-studio-dashboards",qZ={shardKey:"",sql:"",title:""},V1t=n(t=>{let e=(0,Yt.c)(54),{onEdit:o,onRemove:r,widget:a}=t,s=Ve(),{error:i,loading:c,result:d}=L1t(a.sql,a.shardKey??""),f;e[0]!==o||e[1]!==a.id?(f=n(()=>{o(a.id)},"t1"),e[0]=o,e[1]=a.id,e[2]=f):f=e[2];let p=f,m;e[3]!==r||e[4]!==a.id?(m=n(()=>{r(a.id)},"t2"),e[3]=r,e[4]=a.id,e[5]=m):m=e[5];let h=m,v=`dashboards-widget-${a.id}`,x;e[6]!==a.title?(x=(0,P.jsxDEV)(au,{className:"min-w-0 truncate",title:a.title,children:a.title},void 0,!1),e[6]=a.title,e[7]=x):x=e[7];let y;e[8]!==s?(y=s("Edit widget"),e[8]=s,e[9]=y):y=e[9];let b=`dashboards-widget-edit-${a.id}`,S;e[10]!==s?(S=s("Edit widget"),e[10]=s,e[11]=S):S=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"},void 0,!1)},void 0,!1),e[12]=w):w=e[12];let C;e[13]!==p||e[14]!==y||e[15]!==b||e[16]!==S?(C=(0,P.jsxDEV)(dt,{"aria-label":y,"data-testid":b,onClick:p,size:"icon-xs",title:S,type:"button",variant:"ghost",children:w},void 0,!1),e[13]=p,e[14]=y,e[15]=b,e[16]=S,e[17]=C):C=e[17];let F;e[18]!==s?(F=s("Remove widget"),e[18]=s,e[19]=F):F=e[19];let T=`dashboards-widget-remove-${a.id}`,E;e[20]!==s?(E=s("Remove widget"),e[20]=s,e[21]=E):E=e[21];let k;e[22]===Symbol.for("react.memo_cache_sentinel")?(k=(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"},void 0,!1)},void 0,!1),e[22]=k):k=e[22];let O;e[23]!==h||e[24]!==F||e[25]!==T||e[26]!==E?(O=(0,P.jsxDEV)(dt,{"aria-label":F,"data-testid":T,onClick:h,size:"icon-xs",title:E,type:"button",variant:"ghost",children:k},void 0,!1),e[23]=h,e[24]=F,e[25]=T,e[26]=E,e[27]=O):O=e[27];let D;e[28]!==O||e[29]!==C?(D=(0,P.jsxDEV)("div",{className:"flex shrink-0 items-center gap-1",children:[C,O]},void 0,!0),e[28]=O,e[29]=C,e[30]=D):D=e[30];let M;e[31]!==D||e[32]!==x?(M=(0,P.jsxDEV)(nu,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[x,D]},void 0,!0),e[31]=D,e[32]=x,e[33]=M):M=e[33];let L;e[34]!==i||e[35]!==a.id?(L=i!==void 0&&(0,P.jsxDEV)(vX,{className:"font-mono text-xs",testId:`dashboards-widget-error-${a.id}`,variant:"destructive",children:i},void 0,!1),e[34]=i,e[35]=a.id,e[36]=L):L=e[36];let U;e[37]!==i||e[38]!==c||e[39]!==d||e[40]!==s||e[41]!==a.id?(U=i===void 0&&c&&d===void 0&&(0,P.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${a.id}`,children:s("Running\u2026")},void 0,!1),e[37]=i,e[38]=c,e[39]=d,e[40]=s,e[41]=a.id,e[42]=U):U=e[42];let W;e[43]!==i||e[44]!==d?(W=i===void 0&&d!==void 0&&(0,P.jsxDEV)(gX,{result:d},void 0,!1),e[43]=i,e[44]=d,e[45]=W):W=e[45];let V;e[46]!==L||e[47]!==U||e[48]!==W?(V=(0,P.jsxDEV)(Xt,{className:"min-h-32 py-2",children:[L,U,W]},void 0,!0),e[46]=L,e[47]=U,e[48]=W,e[49]=V):V=e[49];let j;return e[50]!==M||e[51]!==V||e[52]!==v?(j=(0,P.jsxDEV)(Rt,{"data-testid":v,children:[M,V]},void 0,!0),e[50]=M,e[51]=V,e[52]=v,e[53]=j):j=e[53],j},"WidgetCard"),U1t=n(t=>{let e=(0,Yt.c)(58),{draft:o,editing:r,onCancel:a,onChange:s,onSubmit:i}=t,c=Ve(),d;e[0]!==o||e[1]!==s?(d=n(_=>{s({...o,title:_.target.value})},"t1"),e[0]=o,e[1]=s,e[2]=d):d=e[2];let f=d,p;e[3]!==o||e[4]!==s?(p=n(_=>{s({...o,sql:_.target.value})},"t2"),e[3]=o,e[4]=s,e[5]=p):p=e[5];let m=p,h;e[6]!==o||e[7]!==s?(h=n(_=>{s({...o,shardKey:_.target.value})},"t3"),e[6]=o,e[7]=s,e[8]=h):h=e[8];let v=h,x;e[9]!==i?(x=n(()=>{i()},"t4"),e[9]=i,e[10]=x):x=e[10];let y=x,b;e[11]!==o.sql||e[12]!==o.title?(b=o.title.trim()!==""&&o.sql.trim()!=="",e[11]=o.sql,e[12]=o.title,e[13]=b):b=e[13];let S=b,w;e[14]!==c?(w=c("Widget title"),e[14]=c,e[15]=w):w=e[15];let C;e[16]!==c?(C=c("Widget title"),e[16]=c,e[17]=C):C=e[17];let F;e[18]!==o.title||e[19]!==f||e[20]!==w||e[21]!==C?(F=(0,P.jsxDEV)("input",{"aria-label":w,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-title",onChange:f,placeholder:C,type:"text",value:o.title},void 0,!1),e[18]=o.title,e[19]=f,e[20]=w,e[21]=C,e[22]=F):F=e[22];let T;e[23]!==c?(T=c("SQL query"),e[23]=c,e[24]=T):T=e[24];let E;e[25]!==o.sql||e[26]!==m||e[27]!==T?(E=(0,P.jsxDEV)("textarea",{"aria-label":T,className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-sql",onChange:m,placeholder:"SELECT author, COUNT(*) AS messages FROM \u2026",spellCheck:!1,value:o.sql},void 0,!1),e[25]=o.sql,e[26]=m,e[27]=T,e[28]=E):E=e[28];let k;e[29]!==c?(k=c("Shard key (optional)"),e[29]=c,e[30]=k):k=e[30];let O;e[31]!==c?(O=c("Shard key (optional)"),e[31]=c,e[32]=O):O=e[32];let D;e[33]!==o.shardKey||e[34]!==v||e[35]!==k||e[36]!==O?(D=(0,P.jsxDEV)("input",{"aria-label":k,className:"h-8 rounded-md border border-border bg-background px-2 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-shard",onChange:v,placeholder:O,type:"text",value:o.shardKey},void 0,!1),e[33]=o.shardKey,e[34]=v,e[35]=k,e[36]=O,e[37]=D):D=e[37];let M;e[38]!==c?(M=c("Cancel"),e[38]=c,e[39]=M):M=e[39];let L;e[40]!==a||e[41]!==M?(L=(0,P.jsxDEV)(dt,{"data-testid":"dashboards-form-cancel",onClick:a,size:"sm",type:"button",variant:"outline",children:M},void 0,!1),e[40]=a,e[41]=M,e[42]=L):L=e[42];let U=!S,W;e[43]!==r||e[44]!==c?(W=c(r?"Save widget":"Add widget"),e[43]=r,e[44]=c,e[45]=W):W=e[45];let V;e[46]!==y||e[47]!==U||e[48]!==W?(V=(0,P.jsxDEV)(dt,{"data-testid":"dashboards-form-save",disabled:U,onClick:y,size:"sm",type:"button",children:W},void 0,!1),e[46]=y,e[47]=U,e[48]=W,e[49]=V):V=e[49];let j;e[50]!==L||e[51]!==V?(j=(0,P.jsxDEV)("div",{className:"flex items-center justify-end gap-2",children:[L,V]},void 0,!0),e[50]=L,e[51]=V,e[52]=j):j=e[52];let N;return e[53]!==E||e[54]!==D||e[55]!==j||e[56]!==F?(N=(0,P.jsxDEV)(Rt,{"data-testid":"dashboards-form",children:(0,P.jsxDEV)(Xt,{className:"flex flex-col gap-3 py-4",children:[F,E,D,j]},void 0,!0)},void 0,!1),e[53]=E,e[54]=D,e[55]=j,e[56]=F,e[57]=N):N=e[57],N},"WidgetForm"),z1t=n(t=>{let e=(0,Yt.c)(39),{initialShardKey:o}=t,r=Ve(),[a,s]=rw(B1t),[i,c]=(0,st.useState)(qZ),[d,f]=(0,st.useState)(null),[p,m]=(0,st.useState)(!1),h;e[0]!==o?(h=n(()=>{f(null),c({...qZ,shardKey:o??""}),m(!0)},"t1"),e[0]=o,e[1]=h):h=e[1];let v=h,x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=n(()=>{m(!1),f(null),c(qZ)},"t2"),e[2]=x):x=e[2];let y=x,b;e[3]!==a?(b=n(W=>{let V=a.find(j=>j.id===W);V!==void 0&&(f(W),c({shardKey:V.shardKey??"",sql:V.sql,title:V.title}),m(!0))},"t3"),e[3]=a,e[4]=b):b=e[4];let S=b,w;e[5]!==s?(w=n(W=>{s(V=>V.filter(j=>j.id!==W))},"t4"),e[5]=s,e[6]=w):w=e[6];let C=w,F;e[7]!==i.shardKey||e[8]!==i.sql||e[9]!==i.title||e[10]!==d||e[11]!==s?(F=n(()=>{let W=i.title.trim(),V=i.sql.trim();if(W===""||V==="")return;let j=i.shardKey.trim();s(d===null?N=>[...N,{id:Y4("w"),shardKey:j,sql:V,title:W}]:N=>N.map(_=>_.id===d?{..._,shardKey:j,sql:V,title:W}:_)),y()},"t5"),e[7]=i.shardKey,e[8]=i.sql,e[9]=i.title,e[10]=d,e[11]=s,e[12]=F):F=e[12];let T=F,E;e[13]!==r?(E=r("Chart widgets backed by saved read-only SQL queries."),e[13]=r,e[14]=E):E=e[14];let k;e[15]!==E?(k=(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:E},void 0,!1),e[15]=E,e[16]=k):k=e[16];let O;e[17]!==p||e[18]!==v||e[19]!==r?(O=!p&&(0,P.jsxDEV)(dt,{"data-testid":"dashboards-add",onClick:v,size:"sm",type:"button",children:r("Add widget")},void 0,!1),e[17]=p,e[18]=v,e[19]=r,e[20]=O):O=e[20];let D;e[21]!==k||e[22]!==O?(D=(0,P.jsxDEV)("div",{className:"flex items-center justify-between",children:[k,O]},void 0,!0),e[21]=k,e[22]=O,e[23]=D):D=e[23];let M;e[24]!==i||e[25]!==d||e[26]!==p||e[27]!==T?(M=p&&(0,P.jsxDEV)(U1t,{draft:i,editing:d!==null,onCancel:y,onChange:c,onSubmit:T},void 0,!1),e[24]=i,e[25]=d,e[26]=p,e[27]=T,e[28]=M):M=e[28];let L;e[29]!==p||e[30]!==S||e[31]!==C||e[32]!==r||e[33]!==a?(L=a.length===0&&!p?(0,P.jsxDEV)(co,{description:r("Add a widget to chart a saved SQL query on this browser."),testId:"dashboards-empty",title:r("No widgets yet")},void 0,!1):(0,P.jsxDEV)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:a.map(W=>(0,P.jsxDEV)(V1t,{onEdit:S,onRemove:C,widget:W},W.id,!1))},void 0,!1),e[29]=p,e[30]=S,e[31]=C,e[32]=r,e[33]=a,e[34]=L):L=e[34];let U;return e[35]!==M||e[36]!==L||e[37]!==D?(U=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[D,M,L]},void 0,!0),e[35]=M,e[36]=L,e[37]=D,e[38]=U):U=e[38],U},"DashboardsPanel"),NOe=n(t=>`${t.toString()} ms`,"formatMs"),$1t=n(t=>t.totalConnections===0&&t.shapePoke.passes===0&&t.whisper.passes===0,"isFanoutIdle"),Ow=n(t=>{let e=(0,Yt.c)(8),{label:o,testId:r,value:a}=t,s;e[0]!==o?(s=(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o},void 0,!1),e[0]=o,e[1]=s):s=e[1];let i;e[2]!==r||e[3]!==a?(i=(0,P.jsxDEV)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":r,children:a},void 0,!1),e[2]=r,e[3]=a,e[4]=i):i=e[4];let c;return e[5]!==s||e[6]!==i?(c=(0,P.jsxDEV)(Rt,{className:"gap-0 py-0",children:(0,P.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[s,i]},void 0,!0)},void 0,!1),e[5]=s,e[6]=i,e[7]=c):c=e[7],c},"StatCard"),DOe=n(t=>{let e=(0,Yt.c)(48),{counters:o,includeTiming:r,prefix:a,t:s,title:i}=t,c=`${a}-section`,d;e[0]!==i?(d=(0,P.jsxDEV)("h3",{className:"text-sm font-medium text-foreground",children:i},void 0,!1),e[0]=i,e[1]=d):d=e[1];let f=`${a}-stats`,p;e[2]!==s?(p=s("Passes"),e[2]=s,e[3]=p):p=e[3];let m=`${a}-passes`,h;e[4]!==o.passes||e[5]!==p||e[6]!==m?(h=(0,P.jsxDEV)(Ow,{label:p,testId:m,value:o.passes},void 0,!1),e[4]=o.passes,e[5]=p,e[6]=m,e[7]=h):h=e[7];let v;e[8]!==s?(v=s("Sockets iterated"),e[8]=s,e[9]=v):v=e[9];let x=`${a}-iterated`,y;e[10]!==o.socketsIterated||e[11]!==v||e[12]!==x?(y=(0,P.jsxDEV)(Ow,{label:v,testId:x,value:o.socketsIterated},void 0,!1),e[10]=o.socketsIterated,e[11]=v,e[12]=x,e[13]=y):y=e[13];let b;e[14]!==s?(b=s("Delivered"),e[14]=s,e[15]=b):b=e[15];let S=`${a}-delivered`,w;e[16]!==o.socketsDelivered||e[17]!==b||e[18]!==S?(w=(0,P.jsxDEV)(Ow,{label:b,testId:S,value:o.socketsDelivered},void 0,!1),e[16]=o.socketsDelivered,e[17]=b,e[18]=S,e[19]=w):w=e[19];let C;e[20]!==s?(C=s("Peak width"),e[20]=s,e[21]=C):C=e[21];let F=`${a}-peak`,T;e[22]!==o.peakSocketsIterated||e[23]!==C||e[24]!==F?(T=(0,P.jsxDEV)(Ow,{label:C,testId:F,value:o.peakSocketsIterated},void 0,!1),e[22]=o.peakSocketsIterated,e[23]=C,e[24]=F,e[25]=T):T=e[25];let E;e[26]!==o.totalMs||e[27]!==r||e[28]!==a||e[29]!==s?(E=r&&(0,P.jsxDEV)(Ow,{label:s("Total time"),testId:`${a}-total-ms`,value:NOe(o.totalMs)},void 0,!1),e[26]=o.totalMs,e[27]=r,e[28]=a,e[29]=s,e[30]=E):E=e[30];let k;e[31]!==o.maxMs||e[32]!==r||e[33]!==a||e[34]!==s?(k=r&&(0,P.jsxDEV)(Ow,{label:s("Max time"),testId:`${a}-max-ms`,value:NOe(o.maxMs)},void 0,!1),e[31]=o.maxMs,e[32]=r,e[33]=a,e[34]=s,e[35]=k):k=e[35];let O;e[36]!==w||e[37]!==T||e[38]!==E||e[39]!==k||e[40]!==f||e[41]!==h||e[42]!==y?(O=(0,P.jsxDEV)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":f,children:[h,y,w,T,E,k]},void 0,!0),e[36]=w,e[37]=T,e[38]=E,e[39]=k,e[40]=f,e[41]=h,e[42]=y,e[43]=O):O=e[43];let D;return e[44]!==c||e[45]!==O||e[46]!==d?(D=(0,P.jsxDEV)("section",{className:"flex flex-col gap-2","data-testid":c,children:[d,O]},void 0,!0),e[44]=c,e[45]=O,e[46]=d,e[47]=D):D=e[47],D},"PathCounters"),H1t=n(t=>{let e=(0,Yt.c)(31),{initialShardKey:o}=t,r=Ve(),[a,s]=(0,st.useState)(o??""),i;e[0]!==a?(i=a.trim(),e[0]=a,e[1]=i):i=e[1];let c=na(i,400),d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d={},e[2]=d):d=e[2];let f;e[3]!==c?(f={keepPreviousData:!0,shardKey:c},e[3]=c,e[4]=f):f=e[4];let{data:p,error:m,refetch:h}=_o(vt.getFanoutMetrics,d,f);us(h,!0);let v;e[5]!==p?(v=p!==void 0&&$1t(p),e[5]=p,e[6]=v):v=e[6];let x=v,y;e[7]!==a?(y=(0,P.jsxDEV)(Qr,{onChange:s,testId:"fanout-shard-input",value:a},void 0,!1),e[7]=a,e[8]=y):y=e[8];let b;e[9]!==p||e[10]!==r?(b=p!==void 0&&(0,P.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[p.promoted&&(0,P.jsxDEV)(Pt,{"data-testid":"fanout-promoted",variant:p.relayCount>=p.maxRelays?"destructive":"default",children:p.relayCount>=p.maxRelays?r("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:p.maxRelays,relayCount:p.relayCount}):r("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:p.maxRelays,relayCount:p.relayCount})},void 0,!1),(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("{count} connections",{count:p.totalConnections})},void 0,!1),(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("peak {count} subscribers",{count:p.peakSubscribers})},void 0,!1)]},void 0,!0),e[9]=p,e[10]=r,e[11]=b):b=e[11];let S;e[12]!==y||e[13]!==b?(S=(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[y,b]},void 0,!0),e[12]=y,e[13]=b,e[14]=S):S=e[14];let w;e[15]!==m?(w=m!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"fanout-error",role:"alert",children:m},void 0,!1),e[15]=m,e[16]=w):w=e[16];let C;e[17]!==m||e[18]!==x||e[19]!==r?(C=m===null&&x&&(0,P.jsxDEV)(co,{description:r("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M4 12h4l3 7 4-14 3 7h2"},void 0,!1)},void 0,!1),testId:"fanout-empty",title:r("No fan-out activity yet.")},void 0,!1),e[17]=m,e[18]=x,e[19]=r,e[20]=C):C=e[20];let F;e[21]!==m||e[22]!==x||e[23]!==p||e[24]!==r?(F=m===null&&p!==void 0&&!x&&(0,P.jsxDEV)(P.Fragment,{children:[p.topics.length>0&&(0,P.jsxDEV)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,P.jsxDEV)("h3",{className:"text-sm font-medium text-foreground",children:r("Hot topics")},void 0,!1),(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"fanout-topics-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("Topic")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("Kind")},void 0,!1),(0,P.jsxDEV)(Le,{className:"text-right",children:r("Subscribers")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:p.topics.map(j1t)},void 0,!1)]},void 0,!0)},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,P.jsxDEV)("h2",{className:"text-sm font-medium text-muted-foreground",children:r("Fan-out cost since this instance woke")},void 0,!1),(0,P.jsxDEV)(DOe,{counters:p.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:r,title:r("Shape pokes")},void 0,!1),(0,P.jsxDEV)(DOe,{counters:p.whisper,includeTiming:!1,prefix:"fanout-whisper",t:r,title:r("Whisper broadcasts")},void 0,!1)]},void 0,!0)]},void 0,!0),e[21]=m,e[22]=x,e[23]=p,e[24]=r,e[25]=F):F=e[25];let T;return e[26]!==F||e[27]!==S||e[28]!==w||e[29]!==C?(T=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[S,w,C,F]},void 0,!0),e[26]=F,e[27]=S,e[28]=w,e[29]=C,e[30]=T):T=e[30],T},"FanoutPanel");function j1t(t){return(0,P.jsxDEV)(It,{"data-testid":"fanout-topic-row",children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:t.topic},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(Pt,{variant:"outline",children:t.kind},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-right font-medium tabular-nums",children:t.subscribers},void 0,!1)]},`${t.kind}:${t.topic}`,!0)}n(j1t,"_temp$1");var q1t=n((t,e)=>({delete:t("Delete"),list:t("List"),read:t("Read"),write:t("Write")})[e],"operationLabel"),_Oe={delete:2,list:3,read:0,write:1},W1t=n(t=>[...t].toSorted((e,o)=>e.bucket.localeCompare(o.bucket)||_Oe[e.on]-_Oe[o.on]||(e.prefix??"").localeCompare(o.prefix??"")),"sortRules"),G1t=n(()=>{let t=(0,Yt.c)(12),e=Ve(),o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={},t[0]=o):o=t[0];let{data:r,error:a}=_o(vt.storageRules,o),s=r!==void 0,i;if(t[1]!==r||t[2]!==a||t[3]!==s||t[4]!==e){let c=W1t(Array.isArray(r?.rules)?r.rules:[]),d;t[6]!==a?(d=a!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"storage-rules-error",role:"alert",children:a},void 0,!1),t[6]=a,t[7]=d):d=t[7];let f;t[8]!==e?(f=e("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),t[8]=e,t[9]=f):f=t[9];let p;t[10]!==f?(p=(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:f},void 0,!1),t[10]=f,t[11]=p):p=t[11],i=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[d,p,s&&c.length===0?(0,P.jsxDEV)(co,{description:e("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:e("No storage rules defined")},void 0,!1):(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"storage-rules-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Bucket")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Operation")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Key prefix")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(m=>(0,P.jsxDEV)(It,{"data-testid":`storage-rule-${m.bucket}-${m.on}-${m.prefix??""}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:m.bucket},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(Pt,{variant:"secondary",children:q1t(e,m.on)},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:m.prefix??(0,P.jsxDEV)("span",{className:"text-muted-foreground",children:e("(whole bucket)")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:m.procedure},void 0,!1)]},`${m.bucket}:${m.on}:${m.prefix??""}:${m.procedure}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),t[1]=r,t[2]=a,t[3]=s,t[4]=e,t[5]=i}else i=t[5];return i},"StorageRulesPanel"),K1t=10,nV=n(t=>{let e=(0,Yt.c)(7),{label:o,value:r}=t,a;e[0]!==o?(a=(0,P.jsxDEV)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:o},void 0,!1),e[0]=o,e[1]=a):a=e[1];let s=r??"\u2014",i;e[2]!==s?(i=(0,P.jsxDEV)("span",{className:"font-mono text-sm",children:s},void 0,!1),e[2]=s,e[3]=i):i=e[3];let c;return e[4]!==a||e[5]!==i?(c=(0,P.jsxDEV)("div",{className:"flex flex-col gap-0.5",children:[a,i]},void 0,!0),e[4]=a,e[5]=i,e[6]=c):c=e[6],c},"Detail"),Y1t=n(({loadIndexes:t,runQuery:e}={})=>{let o=Wt(),r=Ve(),[a,s]=(0,st.useState)(null),[i,c]=(0,st.useState)(null),[d,f]=(0,st.useState)(null),[p,m]=(0,st.useState)(""),[h,v]=(0,st.useState)(null),[x,y]=(0,st.useState)(null),[b,S]=(0,st.useState)(!1);(0,st.useEffect)(()=>{let k={cancelled:!1};return ot((async()=>{try{let O=await(t??(()=>o.listVectorIndexes()))();k.cancelled||(s(O),c(null),f(D=>D??O[0]?.name??null))}catch(O){k.cancelled||(s(null),c(Jt(O)))}})()),()=>{k.cancelled=!0}},[o,t]);let w=a?.find(k=>k.name===d)??null,C=n(k=>{f(k.currentTarget.dataset.index??null),v(null),y(null)},"onSelect"),F=n(k=>{m(k.target.value)},"onQueryTextChange"),T=n(async()=>{let k=p.trim();if(!(d===null||k==="")){S(!0),y(null);try{let O=await(e??(D=>o.queryVectorIndex(D)))({name:d,text:k,topK:K1t});v(O)}catch(O){v(null),y(Jt(O))}finally{S(!1)}}},"search"),E=n(()=>{ot(T())},"onSearch");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[i!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:i},void 0,!1),a!==null&&a.length===0&&(0,P.jsxDEV)(co,{description:r("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"},void 0,!1)},void 0,!1),testId:"vector-empty",title:r("No vector indexes.")},void 0,!1),a!==null&&a.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"vector-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("name")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("table")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("dimensions")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("metric")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("vectors")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:a.map(k=>(0,P.jsxDEV)(It,{className:k.name===d?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":k.name,"data-testid":`vector-row-${k.name}`,onClick:C,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:k.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:k.table},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:k.dimensions??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{children:k.metric??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:k.vectorsCount??"\u2014"},void 0,!1)]},k.name,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),w!==null&&(0,P.jsxDEV)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,P.jsxDEV)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,P.jsxDEV)(nV,{label:r("field"),value:w.field},void 0,!1),(0,P.jsxDEV)(nV,{label:r("dimensions"),value:w.dimensions},void 0,!1),(0,P.jsxDEV)(nV,{label:r("metric"),value:w.metric},void 0,!1),(0,P.jsxDEV)(nV,{label:r("vectors"),value:w.vectorsCount},void 0,!1)]},void 0,!0),w.metadata!==void 0&&w.metadata.length>0&&(0,P.jsxDEV)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[r("metadata"),": ",(0,P.jsxDEV)("span",{className:"font-mono",children:w.metadata.join(", ")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,P.jsxDEV)(mo,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:F,placeholder:r("Search by similarity\u2026"),value:p},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"vector-search",disabled:b||p.trim()==="",onClick:E,children:r(b?"Searching\u2026":"Search")},void 0,!1)]},void 0,!0),x!==null&&(0,P.jsxDEV)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:x},void 0,!1),h!==null&&h.length===0&&(0,P.jsxDEV)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:r("No matches.")},void 0,!1),h!==null&&h.length>0&&(0,P.jsxDEV)(Rt,{className:"mt-3 overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"vector-matches",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("id")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("score")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("metadata")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:h.map(k=>(0,P.jsxDEV)(It,{"data-testid":`vector-match-${k.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:k.id},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:k.score.toFixed(4)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"max-w-md truncate font-mono text-xs",children:k.metadata===void 0?"\u2014":jr(k.metadata)},void 0,!1)]},k.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"VectorBrowser"),X1t=["queued","running","paused","waiting","complete","errored","terminated"],Q1t=["pause","resume","terminate"],Z1t="WORKFLOWS_NOT_CONFIGURED",J1t=n(t=>typeof t=="object"&&t!==null&&t.code===Z1t,"isNotConfigured"),eSt=n(t=>{let e=t.error??t.output;if(e===void 0)return"\u2014";try{return JSON.stringify(e)}catch{return"(unserializable)"}},"formatStepPayload"),tSt=n(({loadDetail:t,loadInstances:e,readOnly:o,runAction:r,workflowName:a})=>{let s=Wt(),i=Ve(),[c,d]=(0,st.useState)(null),[f,p]=(0,st.useState)(null),[m,h]=(0,st.useState)(""),[v,x]=(0,st.useState)(null),[y,b]=(0,st.useState)(!1),[S,w]=(0,st.useState)(null),C=t??(M=>s.getWorkflowInstance(M)),E=o?void 0:r??(e===void 0?M=>s.setWorkflowInstanceStatus(M):void 0),k=n(async()=>{x(null),b(!1);let M=m===""?void 0:m;try{if(e===void 0){let L=await s.listWorkflowInstances({name:a,status:M});if(L.configured===!1){d(null),b(!0);return}d(L.instances);return}d(await e({name:a,status:M}))}catch(L){d(null),J1t(L)?b(!0):x(Jt(L))}},"load");(0,st.useEffect)(()=>{p(null),ot(k())},[a,m]);let O=n(async M=>{x(null);try{p(await C({id:M,name:a}))}catch(L){x(Jt(L))}},"openDetail"),D=n(async(M,L)=>{if(E!==void 0){w(M),x(null);try{await E({action:L,id:M,name:a}),await k()}catch(U){x(Jt(U))}finally{w(null)}}},"act");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,P.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,P.jsxDEV)("h3",{className:"text-sm font-medium",children:i("Instance history")},void 0,!1),(0,P.jsxDEV)("select",{"aria-label":i("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:n(M=>{h(M.target.value)},"onChange"),value:m,children:[(0,P.jsxDEV)("option",{value:"",children:i("All statuses")},void 0,!1),X1t.map(M=>(0,P.jsxDEV)("option",{value:M,children:M},M,!1))]},void 0,!0)]},void 0,!0),v!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:v},void 0,!1),y&&(0,P.jsxDEV)(co,{description:i("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:i("Workflow inspection not configured")},void 0,!1),!y&&c!==null&&c.length===0&&(0,P.jsxDEV)(co,{description:i("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:i("No instances")},void 0,!1),c!==null&&c.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"workflow-instances-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:i("Instance id")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Status")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Created")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Ended")},void 0,!1),(0,P.jsxDEV)(Le,{"aria-label":i("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(M=>(0,P.jsxDEV)(It,{"data-testid":`workflow-instance-${M.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:M.id},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:M.status},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:M.createdOn??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:M.endedOn??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-right",children:(0,P.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[(0,P.jsxDEV)(dt,{"data-testid":`workflow-instance-steps-${M.id}`,onClick:n(()=>{ot(O(M.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:i("Steps")},void 0,!1),E!==void 0&&Q1t.map(L=>(0,P.jsxDEV)(dt,{"data-testid":`workflow-instance-${L}-${M.id}`,disabled:S===M.id,onClick:n(()=>{ot(D(M.id,L))},"onClick"),size:"sm",type:"button",variant:"ghost",children:i(L)},L,!1))]},void 0,!0)},void 0,!1)]},M.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),f!==null&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,P.jsxDEV)(Xt,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,P.jsxDEV)("div",{className:"flex items-center justify-between",children:[(0,P.jsxDEV)("span",{className:"font-mono text-xs",children:[i("Steps")," \xB7 ",f.id]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"workflow-instance-detail-close",onClick:n(()=>{p(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Close")},void 0,!1)]},void 0,!0),f.steps.length===0?(0,P.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:i("This instance has no recorded steps yet.")},void 0,!1):(0,P.jsxDEV)(Ao,{"data-testid":"workflow-instance-steps",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:i("Step")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Type")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Attempts")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Started")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Output")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:f.steps.map((M,L)=>(0,P.jsxDEV)(It,{"data-testid":`workflow-step-${String(L)}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:M.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-xs text-muted-foreground",children:M.type??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:M.attempts??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:M.start??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:eSt(M)},void 0,!1)]},`${M.name}:${String(L)}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0)},"WorkflowInstanceHistory"),oSt=ro(vt.createWorkflowInstance),rSt=ro(vt.getWorkflowInstanceStatus),nSt=n(t=>{if(t.error)return`${t.error.name}: ${t.error.message}`;if(t.output===void 0)return"\u2014";try{return JSON.stringify(t.output)}catch{return"(unserializable)"}},"formatPayload"),aSt=n(()=>{let t=Wt(),e=Ve(),{data:o,error:r}=_o(vt.listWorkflows,{}),[a,s]=(0,st.useState)(""),[i,c]=(0,st.useState)(""),[d,f]=(0,st.useState)(""),[p,m]=(0,st.useState)(!1),[h,v]=(0,st.useState)(null),[x,y]=(0,st.useState)([]),[b,S]=(0,st.useState)(null),w=o!==void 0,C=(0,st.useMemo)(()=>Array.isArray(o?.workflows)?[...o.workflows].toSorted((V,j)=>V.exportName.localeCompare(j.exportName)):[],[o]),F=(0,st.useMemo)(()=>C.some(V=>V.exportName===a)?a:C[0]?.exportName??"",[C,a]),T=(0,st.useMemo)(()=>C.find(V=>V.exportName===F),[C,F]),E=n(V=>{y(j=>{let N=j.filter(_=>!(_.exportName===V.exportName&&_.id===V.id));return[V,...N]})},"upsertInstance"),k=n(async()=>{let V=F;if(V==="")return;let j,N=d.trim();if(N!=="")try{j=JSON.parse(N)}catch{v(e("Params must be valid JSON"));return}m(!0),v(null);try{let _=i.trim(),B=await t.query(oSt,{exportName:V,id:_===""?void 0:_,params:j},lo(""));E({exportName:V,id:B.id,status:B.status}),c("")}catch(_){v(Jt(_))}finally{m(!1)}},"start"),O=n(()=>{ot(k())},"startInstance"),D=n(async(V,j)=>{S(j);try{let N=await t.query(rSt,{exportName:V,id:j},lo(""));E({error:N.error,exportName:V,id:N.id,output:N.output,status:N.status})}catch(N){v(Jt(N))}finally{S(null)}},"refreshInstance"),M=n(V=>{s(V.target.value)},"onSelectedExportChange"),L=n(V=>{c(V.target.value)},"onInstanceIdChange"),U=n(V=>{f(V.target.value)},"onParamsChange"),W=n(V=>{let{export:j,id:N}=V.currentTarget.dataset;j!==void 0&&N!==void 0&&ot(D(j,N))},"onRefreshClick");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[r!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:r},void 0,!1),(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:e("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")},void 0,!1),w&&C.length===0?(0,P.jsxDEV)(co,{description:e("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:e("No workflows defined")},void 0,!1):(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"workflows-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Export")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Name")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Class")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Binding")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:C.map(V=>(0,P.jsxDEV)(It,{"data-testid":`workflows-row-${V.exportName}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:V.exportName},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:V.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:V.className},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:V.binding},void 0,!1)]},V.exportName,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),C.length>0&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,P.jsxDEV)("h3",{className:"text-sm font-medium",children:e("Start instance")},void 0,!1),h!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:h},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,P.jsxDEV)("select",{"aria-label":e("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:M,value:F,children:C.map(V=>(0,P.jsxDEV)("option",{value:V.exportName,children:V.exportName},V.exportName,!1))},void 0,!1),(0,P.jsxDEV)(mo,{"aria-label":e("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:L,placeholder:e("Instance id (optional)"),value:i},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"workflows-start-button",disabled:p||F==="",onClick:O,children:e(p?"Starting\u2026":"Start instance")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Ff,{"aria-label":e("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:U,placeholder:e("Params (JSON, optional)"),value:d},void 0,!1)]},void 0,!0),x.length>0&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,P.jsxDEV)("h3",{className:"text-sm font-medium",children:e("Instances")},void 0,!1),(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"workflows-instances-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Workflow")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Instance id")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Status")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Output")},void 0,!1),(0,P.jsxDEV)(Le,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:x.map(V=>(0,P.jsxDEV)(It,{"data-testid":`workflows-instance-${V.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:V.exportName},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:V.id},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:V.status},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:nSt(V)},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"data-export":V.exportName,"data-id":V.id,"data-testid":`workflows-instance-refresh-${V.id}`,disabled:b===V.id,onClick:W,size:"xs",variant:"outline",children:b===V.id?e("Refreshing\u2026"):e("Refresh")},void 0,!1)},void 0,!1)]},`${V.exportName}:${V.id}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),T!==void 0&&(0,P.jsxDEV)(tSt,{workflowName:T.name},void 0,!1)]},void 0,!0)},"WorkflowsPanel"),sSt=ro(vt.studioFeatures),eNe={flags:!0,mail:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},iSt=n(t=>{if(t===null||typeof t!="object")return eNe;let e=t,o=n(r=>typeof e[r]=="boolean"?e[r]:!0,"flag");return{flags:o("flags"),mail:o("mail"),payments:o("payments"),queues:o("queues"),scheduler:o("scheduler"),storage:o("storage"),vectors:o("vectors"),workflows:o("workflows")}},"coerceFeatures"),lSt=n(()=>{let t=(0,Yt.c)(3),e=Wt(),[o,r]=(0,st.useState)(eNe),a,s;return t[0]!==e?(a=n(()=>{ot((async()=>{try{r(iSt(await e.query(sSt,{},lo(""))))}catch{}})())},"t0"),s=[e],t[0]=e,t[1]=a,t[2]=s):(a=t[1],s=t[2]),(0,st.useEffect)(a,s),o},"useStudioFeatures"),tNe=(0,st.createContext)(null),cSt={analytics:(0,P.jsxDEV)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"},void 0,!1),api:(0,P.jsxDEV)("path",{d:"m9 8-4 4 4 4m6-8 4 4-4 4M13 5l-2 14"},void 0,!1),audit:(0,P.jsxDEV)("path",{d:"M7 4h7l4 4v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1Zm6 0v5h5M9 13h6M9 16h6M9 10h2"},void 0,!1),authConfig:(0,P.jsxDEV)("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm7.4-3a7.4 7.4 0 0 0-.1-1.2l2-1.6-2-3.4-2.4 1a7.3 7.3 0 0 0-2-1.2l-.4-2.6h-3.6l-.4 2.6a7.3 7.3 0 0 0-2 1.2l-2.4-1-2 3.4 2 1.6a7.4 7.4 0 0 0 0 2.4l-2 1.6 2 3.4 2.4-1a7.3 7.3 0 0 0 2 1.2l.4 2.6h3.6l.4-2.6a7.3 7.3 0 0 0 2-1.2l2.4 1 2-3.4-2-1.6a7.4 7.4 0 0 0 .1-1.2Z"},void 0,!1),authSessions:(0,P.jsxDEV)("path",{d:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-13.5V12l4 2"},void 0,!1),dashboards:(0,P.jsxDEV)("path",{d:"M4 5h7v6H4V5Zm9 0h7v4h-7V5ZM4 14h7v5H4v-5Zm9-1h7v6h-7v-6Z"},void 0,!1),drains:(0,P.jsxDEV)("path",{d:"M5 5h14M7 5v6a5 5 0 0 0 10 0V5M10 16h4v3h-4zM12 19v2"},void 0,!1),data:(0,P.jsxDEV)("path",{d:"M5 6c0-1.4 3.1-2.5 7-2.5s7 1.1 7 2.5-3.1 2.5-7 2.5S5 7.4 5 6Zm0 0v12c0 1.4 3.1 2.5 7 2.5s7-1.1 7-2.5V6M5 12c0 1.4 3.1 2.5 7 2.5s7-1.1 7-2.5"},void 0,!1),export:(0,P.jsxDEV)("path",{d:"M12 3v11m0 0 4-4m-4 4-4-4M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"},void 0,!1),fanout:(0,P.jsxDEV)("path",{d:"M12 5a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm-7 16a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm14 0a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM12 7v3.5M12 10.5 6 17m6-6.5 6 6.5"},void 0,!1),files:(0,P.jsxDEV)("path",{d:"M4 7a2 2 0 0 1 2-2h3l2 2.5h7a2 2 0 0 1 2 2V18a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7Z"},void 0,!1),flags:(0,P.jsxDEV)("path",{d:"M6 21V4m0 0h11l-2 3 2 3H6"},void 0,!1),functions:(0,P.jsxDEV)("path",{d:"m9 8-4 4 4 4m6-8 4 4-4 4"},void 0,!1),health:(0,P.jsxDEV)("path",{d:"M3 12h4l2 6 4-14 2 8h6"},void 0,!1),home:(0,P.jsxDEV)("path",{d:"M3 11.5 12 4l9 7.5M5 10v9a1 1 0 0 0 1 1h4v-6h4v6h4a1 1 0 0 0 1-1v-9"},void 0,!1),insights:(0,P.jsxDEV)("path",{d:"M12 3a6 6 0 0 0-3.6 10.8c.5.4.8.9.9 1.5l.2 1.2h5l.2-1.2c.1-.6.4-1.1.9-1.5A6 6 0 0 0 12 3ZM9.5 20.5h5M10 18h4"},void 0,!1),logs:(0,P.jsxDEV)("path",{d:"M5 6h14M5 10h14M5 14h9M5 18h11"},void 0,!1),mail:(0,P.jsxDEV)("path",{d:"M4 5h16v14H4V5Zm0 1.5 8 6 8-6"},void 0,!1),payments:(0,P.jsxDEV)("path",{d:"M3 7h18v10H3V7Zm0 3h18M7 14h4"},void 0,!1),metrics:(0,P.jsxDEV)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"},void 0,!1),migrations:(0,P.jsxDEV)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"},void 0,!1),organizations:(0,P.jsxDEV)("path",{d:"M3 21V8l6-4 6 4v13M9 21v-5h2v5M15 11h6v10M18 14v.01M18 17v.01M6 9v.01M6 12v.01M6 15v.01"},void 0,!1),permissions:(0,P.jsxDEV)("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3Zm-3 8 2.2 2.2L15 9.5M8.5 16h7"},void 0,!1),pitr:(0,P.jsxDEV)("path",{d:"M12 21a9 9 0 1 0-9-9M12 7.5V12l3 2M3 12l-2-2m2 2 2-2"},void 0,!1),queues:(0,P.jsxDEV)("path",{d:"M4 6h16M4 10h16M4 14h10M4 18h10m4-2 3 2-3 2v-4Z"},void 0,!1),realtime:(0,P.jsxDEV)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},void 0,!1),rls:(0,P.jsxDEV)("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3ZM8.5 10h7M8.5 13h7"},void 0,!1),schedule:(0,P.jsxDEV)("path",{d:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-13.5V12l4 2"},void 0,!1),schema:(0,P.jsxDEV)("path",{d:"M4 5h16v14H4V5Zm0 5h16M10 10v9M4 14.5h16"},void 0,!1),sql:(0,P.jsxDEV)("path",{d:"M4 5h16v14H4V5Zm3 4 3 3-3 3m6 0h4"},void 0,!1),storageRules:(0,P.jsxDEV)("path",{d:"M7 10V7a5 5 0 0 1 10 0v3m-11 0h12a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1Zm6 4v2"},void 0,!1),security:(0,P.jsxDEV)("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3Zm-2.5 8.5 2 2 4-4"},void 0,!1),settings:(0,P.jsxDEV)("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm7.4-3a7.4 7.4 0 0 0-.1-1.2l2-1.6-2-3.4-2.4 1a7.3 7.3 0 0 0-2-1.2l-.4-2.6H10.5l-.4 2.6a7.3 7.3 0 0 0-2 1.2l-2.4-1-2 3.4 2 1.6a7.4 7.4 0 0 0 0 2.4l-2 1.6 2 3.4 2.4-1a7.3 7.3 0 0 0 2 1.2l.4 2.6h3.6l.4-2.6a7.3 7.3 0 0 0 2-1.2l2.4 1 2-3.4-2-1.6a7.4 7.4 0 0 0 .1-1.2Z"},void 0,!1),users:(0,P.jsxDEV)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85M16 3.13A4 4 0 0 1 16 11"},void 0,!1),vectors:(0,P.jsxDEV)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"},void 0,!1),workflows:(0,P.jsxDEV)("path",{d:"M5 5h5v5H5V5Zm9 9h5v5h-5v-5ZM7.5 10v2a2 2 0 0 0 2 2H14m2.5-4V8a2 2 0 0 0-2-2H10"},void 0,!1)},LOe=[{key:"overview",tabs:["home","dashboards"]},{key:"database",tabs:["data","sql","schema","migrations","vectors","pitr","export"]},{key:"functions",tabs:["functions","api","workflows","queues"]},{key:"auth",tabs:["users","organizations","authSessions","authConfig"]},{key:"storage",tabs:["files","storageRules"]},{key:"observability",tabs:["logs","audit","realtime","fanout","metrics","analytics","health"]},{key:"advisors",tabs:["security","rls","permissions","insights"]},{key:"operations",tabs:["schedule","mail","drains","payments","flags"]},{key:"settings",tabs:["settings"]}],uSt={files:"storage",flags:"flags",mail:"mail",payments:"payments",queues:"queues",schedule:"scheduler",storageRules:"storage",vectors:"vectors",workflows:"workflows"},BOe=n((t,e)=>{let o=uSt[t];return o===void 0||e[o]},"isTabVisible"),WZ=n(t=>{let e=(0,Yt.c)(2),{tab:o}=t,r=cSt[o],a;return e[0]!==r?(a=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4 shrink-0",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:r},void 0,!1),e[0]=r,e[1]=a):a=e[1],a},"TabIcon"),oNe=["home","data","sql","functions","api","workflows","queues","schema","migrations","vectors","export","pitr","users","organizations","authSessions","authConfig","files","storageRules","dashboards","metrics","analytics","health","security","rls","permissions","insights","logs","realtime","mail","payments","audit","schedule","drains","flags","settings"],dSt=new Set(["api","data","sql"]),fSt=n(t=>{let e=t.split("/").findLast(Boolean)??"";return oNe.includes(e)?e:"home"},"tabFromPathname"),pSt=n(t=>{let e=(0,Yt.c)(19),{chrome:o,connected:r}=t,a=Ve(),s;e[0]!==a?(s=a("admin token"),e[0]=a,e[1]=s):s=e[1];let i;e[2]!==s?(i=(0,P.jsxDEV)("label",{className:"text-xs font-medium text-foreground",htmlFor:"dash-app-token",children:s},void 0,!1),e[2]=s,e[3]=i):i=e[3];let c;e[4]!==o.onTokenChange||e[5]!==o.token?(c=(0,P.jsxDEV)(mo,{className:"h-8","data-testid":"dash-app-token",id:"dash-app-token",onChange:o.onTokenChange,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:o.token},void 0,!1),e[4]=o.onTokenChange,e[5]=o.token,e[6]=c):c=e[6];let d;e[7]!==r||e[8]!==a?(d=r&&(0,P.jsxDEV)("p",{className:"flex items-start gap-1.5 text-[11px] text-muted-foreground","data-testid":"dash-app-token-warning",role:"note",children:[(0,P.jsxDEV)("span",{"aria-hidden":"true",className:"text-warning",children:"\u26A0"},void 0,!1),a("Token rides the WebSocket URL \u2014 it can surface in browser DevTools and server logs. Use a dev-only token.")]},void 0,!0),e[7]=r,e[8]=a,e[9]=d):d=e[9];let f;e[10]!==o.clearToken||e[11]!==r||e[12]!==a?(f=r&&(0,P.jsxDEV)("button",{className:"self-start rounded-md border border-border px-2.5 py-1 text-xs font-medium outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"dash-app-clear-token",onClick:o.clearToken,type:"button",children:a("Clear")},void 0,!1),e[10]=o.clearToken,e[11]=r,e[12]=a,e[13]=f):f=e[13];let p;return e[14]!==i||e[15]!==c||e[16]!==d||e[17]!==f?(p=(0,P.jsxDEV)("div",{className:"flex flex-col gap-2",children:[i,c,d,f]},void 0,!0),e[14]=i,e[15]=c,e[16]=d,e[17]=f,e[18]=p):p=e[18],p},"ConnectPopoverContent"),mSt=n(t=>{let e=(0,Yt.c)(25),{current:o,group:r,groupLabel:a,selectTab:s,tabDescription:i,tabLabel:c}=t,d=r.tabs.includes(o)?"page":void 0,f=a[r.key],p=r.tabs[0],m;e[0]!==p?(m=(0,P.jsxDEV)(WZ,{tab:p},void 0,!1),e[0]=p,e[1]=m):m=e[1];let h;e[2]!==d||e[3]!==f||e[4]!==m?(h=(0,P.jsxDEV)(KOe,{"aria-current":d,"aria-label":f,className:"mx-auto flex size-8 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent data-[popup-open]:bg-sidebar-accent data-[popup-open]:text-sidebar-accent-foreground data-[popup-open]:shadow-xs aria-[current=page]:bg-sidebar-accent aria-[current=page]:text-sidebar-accent-foreground aria-[current=page]:shadow-xs",delay:120,openOnHover:!0,children:m},void 0,!1),e[2]=d,e[3]=f,e[4]=m,e[5]=h):h=e[5];let v=a[r.key],x;e[6]!==v?(x=(0,P.jsxDEV)("div",{className:"px-2 py-1.5 text-[11px] font-medium tracking-wider text-muted-foreground uppercase",children:v},void 0,!1),e[6]=v,e[7]=x):x=e[7];let y;if(e[8]!==o||e[9]!==r.tabs||e[10]!==s||e[11]!==i||e[12]!==c){let w;e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c?(w=n(C=>(0,P.jsxDEV)("button",{"aria-current":o===C?"page":void 0,className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent aria-[current=page]:bg-accent aria-[current=page]:font-medium [&_svg]:opacity-70 aria-[current=page]:[&_svg]:opacity-100","data-tab":C,"data-testid":`dash-tab-${C}`,onClick:s,title:i[C],type:"button",children:[(0,P.jsxDEV)(WZ,{tab:C},void 0,!1),(0,P.jsxDEV)("span",{children:c[C]},void 0,!1)]},C,!0),"t92"),e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=w):w=e[18],y=r.tabs.map(w),e[8]=o,e[9]=r.tabs,e[10]=s,e[11]=i,e[12]=c,e[13]=y}else y=e[13];let b;e[19]!==x||e[20]!==y?(b=(0,P.jsxDEV)(YOe,{align:"start",className:"w-56 p-1",side:"right",sideOffset:8,children:[x,y]},void 0,!0),e[19]=x,e[20]=y,e[21]=b):b=e[21];let S;return e[22]!==h||e[23]!==b?(S=(0,P.jsxDEV)(GOe,{children:[h,b]},void 0,!0),e[22]=h,e[23]=b,e[24]=S):S=e[24],S},"CollapsedGroupNav"),hSt=n(t=>{let e=(0,Yt.c)(45),{chrome:o,collapsed:r,connected:a}=t,s=Ve();if(o===null){let C;e[0]!==s?(C=s("Admin"),e[0]=s,e[1]=C):C=e[1];let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=(0,P.jsxDEV)("span",{className:"flex size-8 items-center justify-center rounded-full bg-sidebar-accent text-[11px] font-medium",children:"C"},void 0,!1),e[2]=F):F=e[2];let T;e[3]!==s?(T=s("Admin"),e[3]=s,e[4]=T):T=e[4];let E;e[5]!==T?(E=(0,P.jsxDEV)("span",{className:"truncate text-[13px] font-medium",children:T},void 0,!1),e[5]=T,e[6]=E):E=e[6];let k;e[7]!==s?(k=s("Studio"),e[7]=s,e[8]=k):k=e[8];let O;e[9]!==k?(O=(0,P.jsxDEV)("span",{className:"truncate text-[11px] text-muted-foreground",children:k},void 0,!1),e[9]=k,e[10]=O):O=e[10];let D;e[11]!==E||e[12]!==O?(D=(0,P.jsxDEV)("span",{className:"grid flex-1 text-start leading-tight",children:[E,O]},void 0,!0),e[11]=E,e[12]=O,e[13]=D):D=e[13];let M;return e[14]!==C||e[15]!==D?(M=(0,P.jsxDEV)(QOe,{className:"data-active:bg-transparent",size:"lg",tooltip:C,children:[F,D]},void 0,!0),e[14]=C,e[15]=D,e[16]=M):M=e[16],M}let i=r?"mx-auto size-8 justify-center":"w-full p-2",c;e[17]!==i?(c=tt("flex items-center gap-2 rounded-md text-start outline-none transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent",i),e[17]=i,e[18]=c):c=e[18];let d;e[19]!==a||e[20]!==s?(d=s(a?"Connected":"Not connected"),e[19]=a,e[20]=s,e[21]=d):d=e[21];let f=a?"bg-success":"bg-muted-foreground/50",p;e[22]!==f?(p=tt("absolute -end-0.5 -bottom-0.5 size-2.5 rounded-full border-2 border-sidebar",f),e[22]=f,e[23]=p):p=e[23];let m;e[24]!==p?(m=(0,P.jsxDEV)("span",{className:"relative flex size-8 shrink-0 items-center justify-center rounded-full bg-sidebar-accent text-[11px] font-medium",children:["C",(0,P.jsxDEV)("span",{"aria-hidden":"true",className:p},void 0,!1)]},void 0,!0),e[24]=p,e[25]=m):m=e[25];let h;e[26]!==r||e[27]!==a||e[28]!==s?(h=!r&&(0,P.jsxDEV)(P.Fragment,{children:[(0,P.jsxDEV)("span",{className:"grid flex-1 text-start leading-tight",children:[(0,P.jsxDEV)("span",{className:"truncate text-[13px] font-medium",children:s("Admin")},void 0,!1),(0,P.jsxDEV)("span",{className:"truncate text-[11px] text-muted-foreground",children:s(a?"Connected":"Not connected")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"m8 9 4-4 4 4M8 15l4 4 4-4",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1)},void 0,!1)]},void 0,!0),e[26]=r,e[27]=a,e[28]=s,e[29]=h):h=e[29];let v;e[30]!==c||e[31]!==d||e[32]!==m||e[33]!==h?(v=(0,P.jsxDEV)(KOe,{className:c,"data-testid":"dash-app-connect",title:d,children:[m,h]},void 0,!0),e[30]=c,e[31]=d,e[32]=m,e[33]=h,e[34]=v):v=e[34];let x=r?"end":"start",y=r?"right":"top",b;e[35]!==o||e[36]!==a?(b=(0,P.jsxDEV)(pSt,{chrome:o,connected:a},void 0,!1),e[35]=o,e[36]=a,e[37]=b):b=e[37];let S;e[38]!==y||e[39]!==b||e[40]!==x?(S=(0,P.jsxDEV)(YOe,{align:x,keepMounted:!0,side:y,children:b},void 0,!1),e[38]=y,e[39]=b,e[40]=x,e[41]=S):S=e[41];let w;return e[42]!==S||e[43]!==v?(w=(0,P.jsxDEV)(GOe,{children:[v,S]},void 0,!0),e[42]=S,e[43]=v,e[44]=w):w=e[44],w},"SidebarFooterProfile"),gSt=n(t=>{let e=(0,Yt.c)(28),{chrome:o,connected:r,current:a,groupLabel:s,groups:i,selectTab:c,tabDescription:d,tabLabel:f}=t,p=Ve(),{state:m}=sV(),h=m==="collapsed",v=h&&"justify-center px-0",x;e[0]!==v?(x=tt("flex items-center gap-2.5 px-1.5 py-1",v),e[0]=v,e[1]=x):x=e[1];let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=(0,P.jsxDEV)(GZ,{className:"size-9 shrink-0 text-foreground"},void 0,!1),e[2]=y):y=e[2];let b;e[3]!==h||e[4]!==r||e[5]!==p?(b=!h&&(0,P.jsxDEV)(P.Fragment,{children:[(0,P.jsxDEV)("span",{className:"grid flex-1 leading-tight",children:[(0,P.jsxDEV)("span",{className:"truncate text-sm font-semibold text-foreground",children:"lunora"},void 0,!1),(0,P.jsxDEV)("span",{className:"truncate text-[11px] text-muted-foreground",children:p("Studio")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Pt,{className:"px-1.5 text-[10px] tracking-wider uppercase",variant:"secondary",children:p(r?"Live":"Local")},void 0,!1)]},void 0,!0),e[3]=h,e[4]=r,e[5]=p,e[6]=b):b=e[6];let S;e[7]!==x||e[8]!==b?(S=(0,P.jsxDEV)(pbt,{children:(0,P.jsxDEV)("div",{className:x,children:[y,b]},void 0,!0)},void 0,!1),e[7]=x,e[8]=b,e[9]=S):S=e[9];let w;e[10]!==h||e[11]!==a||e[12]!==s||e[13]!==i||e[14]!==c||e[15]!==d||e[16]!==f?(w=h?i.map(E=>(0,P.jsxDEV)(mSt,{current:a,group:E,groupLabel:s,selectTab:c,tabDescription:d,tabLabel:f},E.key,!1)):i.map(E=>(0,P.jsxDEV)(gbt,{children:[(0,P.jsxDEV)(vbt,{className:"text-[11px] font-medium tracking-wider uppercase",children:s[E.key]},void 0,!1),(0,P.jsxDEV)(xbt,{children:(0,P.jsxDEV)(FOe,{children:E.tabs.map(k=>(0,P.jsxDEV)(ROe,{children:(0,P.jsxDEV)(QOe,{className:"data-active:text-foreground dark:data-active:text-royal-amethyst data-active:shadow-[inset_2px_0_0_0_var(--royal-amethyst)]","data-tab":k,"data-testid":`dash-tab-${k}`,isActive:a===k,onClick:c,title:d[k],tooltip:d[k],children:[(0,P.jsxDEV)(WZ,{tab:k},void 0,!1),(0,P.jsxDEV)("span",{children:f[k]},void 0,!1)]},void 0,!0)},k,!1))},void 0,!1)},void 0,!1)]},E.key,!0)),e[10]=h,e[11]=a,e[12]=s,e[13]=i,e[14]=c,e[15]=d,e[16]=f,e[17]=w):w=e[17];let C;e[18]!==w?(C=(0,P.jsxDEV)(hbt,{children:w},void 0,!1),e[18]=w,e[19]=C):C=e[19];let F;e[20]!==o||e[21]!==h||e[22]!==r?(F=(0,P.jsxDEV)(mbt,{children:(0,P.jsxDEV)(FOe,{children:(0,P.jsxDEV)(ROe,{children:(0,P.jsxDEV)(hSt,{chrome:o,collapsed:h,connected:r},void 0,!1)},void 0,!1)},void 0,!1)},void 0,!1),e[20]=o,e[21]=h,e[22]=r,e[23]=F):F=e[23];let T;return e[24]!==S||e[25]!==C||e[26]!==F?(T=(0,P.jsxDEV)(ubt,{collapsible:"icon",variant:"inset",children:[S,C,F]},void 0,!0),e[24]=S,e[25]=C,e[26]=F,e[27]=T):T=e[27],T},"StudioSidebar"),vSt=n(()=>{let t=(0,Yt.c)(282),e=Ve(),o=zs(),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={select:wSt},t[0]=r):r=t[0];let a=J$(r),s,i;t[1]!==a?(s=fSt(a),i=dSt.has(s),t[1]=a,t[2]=s,t[3]=i):(s=t[2],i=t[3]);let c=i,d=lSt(),f;t[4]!==d?(f=n(al=>({...al,tabs:al.tabs.filter(tp=>BOe(tp,d))}),"t2"),t[4]=d,t[5]=f):f=t[5];let p=LOe.map(f).filter(CSt),m,h;t[6]!==s||t[7]!==d||t[8]!==o?(m=n(()=>{BOe(s,d)||ot(o({replace:!0,to:"/home"}))},"t3"),h=[s,d,o],t[6]=s,t[7]=d,t[8]=o,t[9]=m,t[10]=h):(m=t[9],h=t[10]),(0,st.useEffect)(m,h);let v;t[11]!==e?(v=e("Analytics"),t[11]=e,t[12]=v):v=t[12];let x;t[13]!==e?(x=e("API"),t[13]=e,t[14]=x):x=t[14];let y;t[15]!==e?(y=e("Audit"),t[15]=e,t[16]=y):y=t[16];let b;t[17]!==e?(b=e("Configuration"),t[17]=e,t[18]=b):b=t[18];let S;t[19]!==e?(S=e("Sessions"),t[19]=e,t[20]=S):S=t[20];let w;t[21]!==e?(w=e("Dashboards"),t[21]=e,t[22]=w):w=t[22];let C;t[23]!==e?(C=e("Data"),t[23]=e,t[24]=C):C=t[24];let F;t[25]!==e?(F=e("Log drains"),t[25]=e,t[26]=F):F=t[26];let T;t[27]!==e?(T=e("Export / Import"),t[27]=e,t[28]=T):T=t[28];let E;t[29]!==e?(E=e("Fan-out"),t[29]=e,t[30]=E):E=t[30];let k;t[31]!==e?(k=e("Files"),t[31]=e,t[32]=k):k=t[32];let O;t[33]!==e?(O=e("Flags"),t[33]=e,t[34]=O):O=t[34];let D;t[35]!==e?(D=e("Functions"),t[35]=e,t[36]=D):D=t[36];let M;t[37]!==e?(M=e("Health"),t[37]=e,t[38]=M):M=t[38];let L;t[39]!==e?(L=e("Home"),t[39]=e,t[40]=L):L=t[40];let U;t[41]!==e?(U=e("Performance"),t[41]=e,t[42]=U):U=t[42];let W;t[43]!==e?(W=e("Logs"),t[43]=e,t[44]=W):W=t[44];let V;t[45]!==e?(V=e("Metrics"),t[45]=e,t[46]=V):V=t[46];let j;t[47]!==e?(j=e("Migrations"),t[47]=e,t[48]=j):j=t[48];let N;t[49]!==e?(N=e("Organizations"),t[49]=e,t[50]=N):N=t[50];let _;t[51]!==e?(_=e("Time Travel"),t[51]=e,t[52]=_):_=t[52];let B;t[53]!==e?(B=e("Mail"),t[53]=e,t[54]=B):B=t[54];let z;t[55]!==e?(z=e("Payments"),t[55]=e,t[56]=z):z=t[56];let q;t[57]!==e?(q=e("Permissions"),t[57]=e,t[58]=q):q=t[58];let $;t[59]!==e?($=e("Queues"),t[59]=e,t[60]=$):$=t[60];let Y;t[61]!==e?(Y=e("Realtime"),t[61]=e,t[62]=Y):Y=t[62];let Q;t[63]!==e?(Q=e("RLS Policies"),t[63]=e,t[64]=Q):Q=t[64];let X;t[65]!==e?(X=e("Scheduled"),t[65]=e,t[66]=X):X=t[66];let te;t[67]!==e?(te=e("Schema"),t[67]=e,t[68]=te):te=t[68];let ae;t[69]!==e?(ae=e("Security"),t[69]=e,t[70]=ae):ae=t[70];let se;t[71]!==e?(se=e("Settings"),t[71]=e,t[72]=se):se=t[72];let J;t[73]!==e?(J=e("SQL editor"),t[73]=e,t[74]=J):J=t[74];let ne;t[75]!==e?(ne=e("Access Rules"),t[75]=e,t[76]=ne):ne=t[76];let pe;t[77]!==e?(pe=e("Users"),t[77]=e,t[78]=pe):pe=t[78];let le;t[79]!==e?(le=e("Vectors"),t[79]=e,t[80]=le):le=t[80];let ie;t[81]!==e?(ie=e("Workflows"),t[81]=e,t[82]=ie):ie=t[82];let de;t[83]!==w||t[84]!==C||t[85]!==F||t[86]!==T||t[87]!==E||t[88]!==k||t[89]!==O||t[90]!==D||t[91]!==M||t[92]!==L||t[93]!==U||t[94]!==W||t[95]!==V||t[96]!==j||t[97]!==N||t[98]!==_||t[99]!==B||t[100]!==z||t[101]!==q||t[102]!==$||t[103]!==Y||t[104]!==Q||t[105]!==X||t[106]!==te||t[107]!==ae||t[108]!==se||t[109]!==J||t[110]!==ne||t[111]!==pe||t[112]!==le||t[113]!==ie||t[114]!==v||t[115]!==x||t[116]!==y||t[117]!==b||t[118]!==S?(de={analytics:v,api:x,audit:y,authConfig:b,authSessions:S,dashboards:w,data:C,drains:F,export:T,fanout:E,files:k,flags:O,functions:D,health:M,home:L,insights:U,logs:W,metrics:V,migrations:j,organizations:N,pitr:_,mail:B,payments:z,permissions:q,queues:$,realtime:Y,rls:Q,schedule:X,schema:te,security:ae,settings:se,sql:J,storageRules:ne,users:pe,vectors:le,workflows:ie},t[83]=w,t[84]=C,t[85]=F,t[86]=T,t[87]=E,t[88]=k,t[89]=O,t[90]=D,t[91]=M,t[92]=L,t[93]=U,t[94]=W,t[95]=V,t[96]=j,t[97]=N,t[98]=_,t[99]=B,t[100]=z,t[101]=q,t[102]=$,t[103]=Y,t[104]=Q,t[105]=X,t[106]=te,t[107]=ae,t[108]=se,t[109]=J,t[110]=ne,t[111]=pe,t[112]=le,t[113]=ie,t[114]=v,t[115]=x,t[116]=y,t[117]=b,t[118]=S,t[119]=de):de=t[119];let ue=de,he={advisors:e("Advisors"),auth:e("Auth"),database:e("Database"),functions:e("Functions"),observability:e("Observability"),operations:e("Operations"),overview:e("Overview"),settings:e("Settings"),storage:e("Storage")},Re;t[120]!==e?(Re=e("Usage and latency from Analytics Engine \u2014 request volume, p50/p95, and hot shards."),t[120]=e,t[121]=Re):Re=t[121];let Ae;t[122]!==e?(Ae=e("Interactive OpenAPI reference and copy-paste snippets for your functions."),t[122]=e,t[123]=Ae):Ae=t[123];let ye;t[124]!==e?(ye=e("A durable log of admin state-changing operations."),t[124]=e,t[125]=ye):ye=t[125];let ge;t[126]!==e?(ge=e("Enabled plugins and session config (read-only)."),t[126]=e,t[127]=ge):ge=t[127];let Te;t[128]!==e?(Te=e("Browse and revoke active sessions across all users."),t[128]=e,t[129]=Te):Te=t[129];let ze;t[130]!==e?(ze=e("Chart widgets backed by saved read-only SQL queries."),t[130]=e,t[131]=ze):ze=t[131];let Ze;t[132]!==e?(Ze=e("Browse and edit rows across your shard and global tables."),t[132]=e,t[133]=Ze):Ze=t[133];let _e;t[134]!==e?(_e=e("Forward logs to Logpush, Tail Workers, or a webhook collector."),t[134]=e,t[135]=_e):_e=t[135];let Ie;t[136]!==e?(Ie=e("Export a shard to NDJSON, or import rows from it."),t[136]=e,t[137]=Ie):Ie=t[137];let ke;t[138]!==e?(ke=e("Realtime fan-out cost and per-topic subscriber counts for this shard."),t[138]=e,t[139]=ke):ke=t[139];let Be;t[140]!==e?(Be=e("Browse objects in your R2 storage buckets."),t[140]=e,t[141]=Be):Be=t[141];let Me;t[142]!==e?(Me=e("Inspect feature flags and their live evaluation under a targeting context."),t[142]=e,t[143]=Me):Me=t[143];let je;t[144]!==e?(je=e("Run registered queries, mutations, and actions."),t[144]=e,t[145]=je):je=t[145];let mt;t[146]!==e?(mt=e("At-a-glance connection, error, and shard signals."),t[146]=e,t[147]=mt):mt=t[147];let ht;t[148]!==e?(ht=e("Connection, health, and advisor summary for your deployment."),t[148]=e,t[149]=ht):ht=t[149];let yt;t[150]!==e?(yt=e("Surface slow functions, error spikes, and cache problems."),t[150]=e,t[151]=yt):yt=t[151];let Et;t[152]!==e?(Et=e("A live stream of recent function logs."),t[152]=e,t[153]=Et):Et=t[153];let St;t[154]!==e?(St=e("Per-shard health and aggregate metrics."),t[154]=e,t[155]=St):St=t[155];let jt;t[156]!==e?(jt=e("Review migration status and run them."),t[156]=e,t[157]=jt):jt=t[157];let At;t[158]!==e?(At=e("Browse and manage organizations, members, and invitations."),t[158]=e,t[159]=At):At=t[159];let ee;t[160]!==e?(ee=e("Restore a shard to a point in the last 30 days."),t[160]=e,t[161]=ee):ee=t[161];let ce;t[162]!==e?(ce=e("Email your app sent, captured in dev."),t[162]=e,t[163]=ce):ce=t[163];let Ee;t[164]!==e?(Ee=e("Synced customers, subscriptions, and webhook events."),t[164]=e,t[165]=Ee):Ee=t[165];let Oe;t[166]!==e?(Oe=e("Inspect access policies per table, and probe a function as any identity."),t[166]=e,t[167]=Oe):Oe=t[167];let Ce;t[168]!==e?(Ce=e("Inspect declared Cloudflare Queues \u2014 their producer bindings, consumer mode, and dead-letter queue."),t[168]=e,t[169]=Ce):Ce=t[169];let Ye;t[170]!==e?(Ye=e("Active WebSocket subscriptions on this shard."),t[170]=e,t[171]=Ye):Ye=t[171];let it;t[172]!==e?(it=e("Inspect row-level-security policies and roles, per table."),t[172]=e,t[173]=it):it=t[173];let ft;t[174]!==e?(ft=e("Inspect and cancel scheduled jobs."),t[174]=e,t[175]=ft):ft=t[175];let ct;t[176]!==e?(ct=e("Inspect each table and its columns."),t[176]=e,t[177]=ct):ct=t[177];let Zt;t[178]!==e?(Zt=e("Review admin gates, credentials, and log redaction."),t[178]=e,t[179]=Zt):Zt=t[179];let ao;t[180]!==e?(ao=e("Read-only deployment config \u2014 vars, secrets, and bindings."),t[180]=e,t[181]=ao):ao=t[181];let Vt;t[182]!==e?(Vt=e("Run read-only SQL against a shard."),t[182]=e,t[183]=Vt):Vt=t[183];let Ko;t[184]!==e?(Ko=e("Inspect storage access rules \u2014 per bucket, operation, and key prefix."),t[184]=e,t[185]=Ko):Ko=t[185];let Po;t[186]!==e?(Po=e("Manage auth users \u2014 roles, bans, sessions, and identity."),t[186]=e,t[187]=Po):Po=t[187];let Ge;t[188]!==e?(Ge=e("Browse Vectorize indexes and run similarity searches."),t[188]=e,t[189]=Ge):Ge=t[189];let wt;t[190]!==e?(wt=e("Inspect declared Cloudflare Workflows and their bindings."),t[190]=e,t[191]=wt):wt=t[191];let Ut;t[192]!==Re||t[193]!==Ae||t[194]!==ye||t[195]!==ge||t[196]!==Te||t[197]!==ze||t[198]!==Ze||t[199]!==_e||t[200]!==Ie||t[201]!==ke||t[202]!==Be||t[203]!==Me||t[204]!==je||t[205]!==mt||t[206]!==ht||t[207]!==yt||t[208]!==Et||t[209]!==St||t[210]!==jt||t[211]!==At||t[212]!==ee||t[213]!==ce||t[214]!==Ee||t[215]!==Oe||t[216]!==Ce||t[217]!==Ye||t[218]!==it||t[219]!==ft||t[220]!==ct||t[221]!==Zt||t[222]!==ao||t[223]!==Vt||t[224]!==Ko||t[225]!==Po||t[226]!==Ge||t[227]!==wt?(Ut={analytics:Re,api:Ae,audit:ye,authConfig:ge,authSessions:Te,dashboards:ze,data:Ze,drains:_e,export:Ie,fanout:ke,files:Be,flags:Me,functions:je,health:mt,home:ht,insights:yt,logs:Et,metrics:St,migrations:jt,organizations:At,pitr:ee,mail:ce,payments:Ee,permissions:Oe,queues:Ce,realtime:Ye,rls:it,schedule:ft,schema:ct,security:Zt,settings:ao,sql:Vt,storageRules:Ko,users:Po,vectors:Ge,workflows:wt},t[192]=Re,t[193]=Ae,t[194]=ye,t[195]=ge,t[196]=Te,t[197]=ze,t[198]=Ze,t[199]=_e,t[200]=Ie,t[201]=ke,t[202]=Be,t[203]=Me,t[204]=je,t[205]=mt,t[206]=ht,t[207]=yt,t[208]=Et,t[209]=St,t[210]=jt,t[211]=At,t[212]=ee,t[213]=ce,t[214]=Ee,t[215]=Oe,t[216]=Ce,t[217]=Ye,t[218]=it,t[219]=ft,t[220]=ct,t[221]=Zt,t[222]=ao,t[223]=Vt,t[224]=Ko,t[225]=Po,t[226]=Ge,t[227]=wt,t[228]=Ut):Ut=t[228];let So=Ut,to;t[229]!==o?(to=n(al=>{ot(o({to:`/${al.currentTarget.dataset.tab??""}`}))},"t79"),t[229]=o,t[230]=to):to=t[230];let $o=to,Ho,gr;t[231]!==s||t[232]!==ue?(Ho=n(()=>{typeof document<"u"&&(document.title=`${ue[s]} \xB7 lunora`)},"t80"),gr=[s,ue],t[231]=s,t[232]=ue,t[233]=Ho,t[234]=gr):(Ho=t[233],gr=t[234]),(0,st.useEffect)(Ho,gr);let Ct=p.find(al=>al.tabs.includes(s))??LOe[0],so=p.flatMap(al=>al.tabs.map(tp=>({group:he[al.key],label:ue[tp],to:`/${tp}`}))),Uo=(0,st.use)(tNe),Wr=Uo!==null&&Uo.token!=="",Dr;t[235]!==so?(Dr=(0,P.jsxDEV)(wOe,{items:so},void 0,!1),t[235]=so,t[236]=Dr):Dr=t[236];let Ot;t[237]===Symbol.for("react.memo_cache_sentinel")?(Ot=(0,P.jsxDEV)(dbt,{className:"-ms-1"},void 0,!1),t[237]=Ot):Ot=t[237];let wo;t[238]!==e?(wo=e("Breadcrumb"),t[238]=e,t[239]=wo):wo=t[239];let _r=he[Ct.key],Co;t[240]!==_r?(Co=(0,P.jsxDEV)("span",{className:"text-muted-foreground",children:_r},void 0,!1),t[240]=_r,t[241]=Co):Co=t[241];let fr;t[242]===Symbol.for("react.memo_cache_sentinel")?(fr=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5 text-muted-foreground/60",fill:"none",stroke:"currentColor",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1)},void 0,!1),t[242]=fr):fr=t[242];let Qs=ue[s],rl;t[243]!==Qs?(rl=(0,P.jsxDEV)("span",{className:"font-medium text-foreground",children:Qs},void 0,!1),t[243]=Qs,t[244]=rl):rl=t[244];let Ec;t[245]!==wo||t[246]!==Co||t[247]!==rl?(Ec=(0,P.jsxDEV)("nav",{"aria-label":wo,className:"flex items-center gap-1.5 text-[13px]",children:[Co,fr,rl]},void 0,!0),t[245]=wo,t[246]=Co,t[247]=rl,t[248]=Ec):Ec=t[248];let Qf;t[249]===Symbol.for("react.memo_cache_sentinel")?(Qf=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeWidth:1.8,viewBox:"0 0 24 24",children:[(0,P.jsxDEV)("circle",{cx:"11",cy:"11",r:"7"},void 0,!1),(0,P.jsxDEV)("path",{d:"m21 21-4.3-4.3",strokeLinecap:"round"},void 0,!1)]},void 0,!0),t[249]=Qf):Qf=t[249];let ia;t[250]!==e?(ia=e("Search\u2026"),t[250]=e,t[251]=ia):ia=t[251];let Dl;t[252]===Symbol.for("react.memo_cache_sentinel")?(Dl=(0,P.jsxDEV)("kbd",{className:"ms-auto rounded border border-border bg-background px-1 font-sans text-[10px] text-muted-foreground",children:"\u2318K"},void 0,!1),t[252]=Dl):Dl=t[252];let Zs;t[253]!==ia?(Zs=(0,P.jsxDEV)("button",{className:"mx-auto hidden h-8 w-72 items-center gap-2 rounded-lg border border-border bg-muted/40 px-3 text-xs text-muted-foreground transition-colors hover:bg-muted md:flex","data-testid":"dash-app-search",onClick:SOe,type:"button",children:[Qf,ia,Dl]},void 0,!0),t[253]=ia,t[254]=Zs):Zs=t[254];let Zf;t[255]===Symbol.for("react.memo_cache_sentinel")?(Zf=(0,P.jsxDEV)("div",{className:"ms-auto flex items-center gap-1.5 md:ms-0",children:(0,P.jsxDEV)(KIt,{},void 0,!1)},void 0,!1),t[255]=Zf):Zf=t[255];let nl;t[256]!==Ec||t[257]!==Zs?(nl=(0,P.jsxDEV)("header",{className:"flex h-11 shrink-0 items-center gap-2 border-b border-border px-4","data-testid":"dash-app-header",children:[Ot,Ec,Zs,Zf]},void 0,!0),t[256]=Ec,t[257]=Zs,t[258]=nl):nl=t[258];let _l;t[259]!==Uo?.rulesInstalled?(_l=Uo?.rulesInstalled===!1&&(0,P.jsxDEV)($It,{},void 0,!1),t[259]=Uo?.rulesInstalled,t[260]=_l):_l=t[260];let Jf=`dash-tab-${s}`,Ac=c?"flex min-w-0 flex-1 flex-col overflow-hidden":"min-w-0 flex-1 overflow-auto p-6",Tc=ue[s],kc;t[261]!==e||t[262]!==Tc?(kc=e("{title} failed",{title:Tc}),t[261]=e,t[262]=Tc,t[263]=kc):kc=t[263];let L0=ue[s],gd;t[264]!==e?(gd=e("Try again"),t[264]=e,t[265]=gd):gd=t[265];let ep;t[266]===Symbol.for("react.memo_cache_sentinel")?(ep=(0,P.jsxDEV)(OF,{},void 0,!1),t[266]=ep):ep=t[266];let Mc;t[267]!==s||t[268]!==kc||t[269]!==L0||t[270]!==gd?(Mc=(0,P.jsxDEV)(tb,{fallbackTitle:kc,label:L0,retryLabel:gd,children:ep},s,!1),t[267]=s,t[268]=kc,t[269]=L0,t[270]=gd,t[271]=Mc):Mc=t[271];let Pc;t[272]!==Mc||t[273]!==Ac?(Pc=(0,P.jsxDEV)("div",{className:Ac,children:Mc},void 0,!1),t[272]=Mc,t[273]=Ac,t[274]=Pc):Pc=t[274];let ku;t[275]!==Pc||t[276]!==Jf?(ku=(0,P.jsxDEV)("div",{"aria-labelledby":Jf,className:"flex min-w-0 flex-1 flex-col overflow-hidden","data-testid":"dash-panel",id:"dash-panel",role:"tabpanel",children:Pc},void 0,!1),t[275]=Pc,t[276]=Jf,t[277]=ku):ku=t[277];let vd;return t[278]!==ku||t[279]!==nl||t[280]!==_l?(vd=(0,P.jsxDEV)(fbt,{className:"overflow-hidden md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm",children:[nl,_l,ku]},void 0,!0),t[278]=ku,t[279]=nl,t[280]=_l,t[281]=vd):vd=t[281],(0,P.jsxDEV)(cbt,{className:"min-h-0 flex-1","data-testid":"lunora-studio",children:[Dr,(0,P.jsxDEV)(gSt,{chrome:Uo,connected:Wr,current:s,groupLabel:he,groups:p,selectTab:$o,tabDescription:So,tabLabel:ue},void 0,!1),vd]},void 0,!0)},"StudioLayout"),xSt=n(()=>{let t=(0,Yt.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"dash-pending",children:[(0,P.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,P.jsxDEV)(Rf,{className:"h-8 w-40"},void 0,!1),(0,P.jsxDEV)(Rf,{className:"h-8 w-24"},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Rf,{className:"h-72 w-full"},void 0,!1)]},void 0,!0),t[0]=e):e=t[0],e},"RoutePending"),ySt=n(t=>{let e=(0,Yt.c)(5),{initialShardKey:o,schemaEditable:r}=t,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];let s=zh(a),{table:i}=s,c=typeof i=="string"?i:void 0,d;return e[1]!==o||e[2]!==c||e[3]!==r?(d=(0,P.jsxDEV)(cOe,{initialShardKey:o,initialTable:c,schemaEditable:r},void 0,!1),e[1]=o,e[2]=c,e[3]=r,e[4]=d):d=e[4],d},"SchemaRoutePanel"),ISt=n(()=>{let t=(0,Yt.c)(3),e=zs(),o,r;return t[0]!==e?(o=n(()=>{ot(e({replace:!0,to:"/home"}))},"t0"),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),(0,st.useEffect)(o,r),null},"NotFoundRedirect"),bSt=n(({basePath:t,dataEditable:e=!1,functions:o,initialShardKey:r,openApiSpec:a,openRpcSpec:s,runAsIdentity:i=!1,schemaEditable:c=!1,scheduledCancel:d,scheduledCron:f,scheduledLoad:p})=>{let m=X$({component:vSt}),h={analytics:(0,P.jsxDEV)(Abt,{},void 0,!1),api:(0,P.jsxDEV)(Gge,{functions:o,initialShardKey:r,openApiSpec:a,openRpcSpec:s},void 0,!1),audit:(0,P.jsxDEV)(kAe,{initialShardKey:r},void 0,!1),authConfig:(0,P.jsxDEV)(Mbt,{},void 0,!1),authSessions:(0,P.jsxDEV)(Pbt,{},void 0,!1),dashboards:(0,P.jsxDEV)(z1t,{initialShardKey:r},void 0,!1),data:(0,P.jsxDEV)(zve,{editable:e,initialShardKey:r},void 0,!1),drains:(0,P.jsxDEV)(o1t,{},void 0,!1),export:(0,P.jsxDEV)($ve,{initialShardKey:r},void 0,!1),fanout:(0,P.jsxDEV)(H1t,{initialShardKey:r},void 0,!1),files:(0,P.jsxDEV)(yOe,{},void 0,!1),flags:(0,P.jsxDEV)(e1t,{initialShardKey:r},void 0,!1),functions:(0,P.jsxDEV)("div",{className:"flex flex-col gap-8",children:[(0,P.jsxDEV)(Xve,{functions:o,initialShardKey:r},void 0,!1),(0,P.jsxDEV)(Gve,{functions:o,runAsIdentity:i},void 0,!1)]},void 0,!0),health:(0,P.jsxDEV)(CTe,{initialShardKey:r},void 0,!1),home:(0,P.jsxDEV)(RAe,{initialShardKey:r},void 0,!1),insights:(0,P.jsxDEV)(Mge,{initialShardKey:r},void 0,!1),logs:(0,P.jsxDEV)(_Ae,{initialShardKey:r},void 0,!1),metrics:(0,P.jsxDEV)(nke,{initialShardKey:r},void 0,!1),migrations:(0,P.jsxDEV)(qve,{initialShardKey:r},void 0,!1),organizations:(0,P.jsxDEV)(Nbt,{},void 0,!1),permissions:(0,P.jsxDEV)(P1t,{functions:o,runAsIdentity:i,schemaEditable:c},void 0,!1),pitr:(0,P.jsxDEV)(Wve,{initialShardKey:r},void 0,!1),mail:(0,P.jsxDEV)(QAe,{},void 0,!1),payments:(0,P.jsxDEV)(x1t,{},void 0,!1),queues:(0,P.jsxDEV)(O1t,{},void 0,!1),realtime:(0,P.jsxDEV)(h1t,{initialShardKey:r},void 0,!1),rls:(0,P.jsxDEV)(Sbt,{},void 0,!1),schedule:(0,P.jsxDEV)(f1t,{loadCronJobs:f,scheduledCancel:d,scheduledLoad:p},void 0,!1),schema:(0,P.jsxDEV)(ySt,{initialShardKey:r,schemaEditable:c},void 0,!1),security:(0,P.jsxDEV)(Dge,{},void 0,!1),settings:(0,P.jsxDEV)(dOe,{initialShardKey:r},void 0,!1),sql:(0,P.jsxDEV)(cTe,{initialShardKey:r},void 0,!1),storageRules:(0,P.jsxDEV)(G1t,{},void 0,!1),users:(0,P.jsxDEV)(Xbt,{},void 0,!1),vectors:(0,P.jsxDEV)(Y1t,{},void 0,!1),workflows:(0,P.jsxDEV)(aSt,{},void 0,!1)},v=PF({component:n(()=>h.home,"component"),getParentRoute:n(()=>m,"getParentRoute"),path:"/"}),x=oNe.map(S=>S==="data"?PF({component:n(()=>h[S],"component"),getParentRoute:n(()=>m,"getParentRoute"),path:`/${S}`,validateSearch:Lve}):PF({component:n(()=>h[S],"component"),getParentRoute:n(()=>m,"getParentRoute"),path:`/${S}`})),y=m.addChildren([v,...x]),b="window"in globalThis?EF():F$({initialEntries:["/home"]});return Q$({...t===void 0||t==="/"?{}:{basepath:t},defaultNotFoundComponent:ISt,defaultPendingComponent:xSt,defaultPendingMinMs:0,defaultPendingMs:0,history:b,routeTree:y})},"buildRouter"),SSt=n(t=>{let e=(0,Yt.c)(17),{basePath:o,chrome:r,dataEditable:a,functions:s,initialShardKey:i,openApiSpec:c,openRpcSpec:d,runAsIdentity:f,schemaEditable:p,scheduledCancel:m,scheduledCron:h,scheduledLoad:v}=t,x;e[0]!==o||e[1]!==a||e[2]!==s||e[3]!==i||e[4]!==c||e[5]!==d||e[6]!==f||e[7]!==m||e[8]!==h||e[9]!==v||e[10]!==p?(x=bSt({basePath:o,dataEditable:a,functions:s,initialShardKey:i,openApiSpec:c,openRpcSpec:d,runAsIdentity:f,schemaEditable:p,scheduledCancel:m,scheduledCron:h,scheduledLoad:v}),e[0]=o,e[1]=a,e[2]=s,e[3]=i,e[4]=c,e[5]=d,e[6]=f,e[7]=m,e[8]=h,e[9]=v,e[10]=p,e[11]=x):x=e[11];let y=x,b=r??null,S;e[12]!==y?(S=(0,P.jsxDEV)(Z$,{router:y},void 0,!1),e[12]=y,e[13]=S):S=e[13];let w;return e[14]!==b||e[15]!==S?(w=(0,P.jsxDEV)(tNe,{value:b,children:S},void 0,!1),e[14]=b,e[15]=S,e[16]=w):w=e[16],w},"StudioShell"),rNe=n(t=>{let e=(0,Yt.c)(17),{basePath:o,chrome:r,dataEditable:a,functions:s,i18n:i,initialShardKey:c,locale:d,openApiSpec:f,openRpcSpec:p,runAsIdentity:m,schemaEditable:h,scheduledCancel:v,scheduledCron:x,scheduledLoad:y}=t,b;e[0]!==o||e[1]!==r||e[2]!==a||e[3]!==s||e[4]!==c||e[5]!==f||e[6]!==p||e[7]!==m||e[8]!==v||e[9]!==x||e[10]!==y||e[11]!==h?(b=(0,P.jsxDEV)(SSt,{basePath:o,chrome:r,dataEditable:a,functions:s,initialShardKey:c,openApiSpec:f,openRpcSpec:p,runAsIdentity:m,scheduledCancel:v,scheduledCron:x,scheduledLoad:y,schemaEditable:h},void 0,!1),e[0]=o,e[1]=r,e[2]=a,e[3]=s,e[4]=c,e[5]=f,e[6]=p,e[7]=m,e[8]=v,e[9]=x,e[10]=y,e[11]=h,e[12]=b):b=e[12];let S=b;if(i===void 0&&d===void 0)return S;let w;return e[13]!==i||e[14]!==d||e[15]!==S?(w=(0,P.jsxDEV)(YA,{i18n:i,locale:d,children:S},void 0,!1),e[13]=i,e[14]=d,e[15]=S,e[16]=w):w=e[16],w},"Studio");function wSt(t){return t.location.pathname}n(wSt,"_temp");function CSt(t){return t.tabs.length>0}n(CSt,"_temp2");var YZ="lunora-studio-root";var On=K(po(),1);var XZ="lunora-studio-admin-token",nNe=n(()=>{try{return globalThis.sessionStorage}catch{return}},"store"),FSt=n(()=>{try{return nNe()?.getItem(XZ)??""}catch{return""}},"loadToken"),RSt=n(t=>{let e=nNe();if(e!==void 0)try{t===""?e.removeItem(XZ):e.setItem(XZ,t)}catch{}},"saveToken"),ESt=n(t=>{let e=(0,Dw.c)(42),{onSubmit:o}=t,r=Ve(),[a,s]=(0,Nw.useState)(""),i;e[0]!==a?(i=a.trim(),e[0]=a,e[1]=i):i=e[1];let c=i,d;e[2]!==o||e[3]!==c?(d=n(L=>{L.preventDefault(),c!==""&&o(c)},"t2"),e[2]=o,e[3]=c,e[4]=d):d=e[4];let f=d,p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,On.jsxDEV)("div",{className:"h-10 w-10 text-foreground",children:(0,On.jsxDEV)(GZ,{},void 0,!1)},void 0,!1),e[5]=p):p=e[5];let m;e[6]!==r?(m=r("Connect to Lunora Studio"),e[6]=r,e[7]=m):m=e[7];let h;e[8]!==m?(h=(0,On.jsxDEV)("h1",{className:"text-base font-semibold text-foreground",children:m},void 0,!1),e[8]=m,e[9]=h):h=e[9];let v;e[10]!==r?(v=r("Enter your admin token to access the studio."),e[10]=r,e[11]=v):v=e[11];let x;e[12]!==v?(x=(0,On.jsxDEV)("p",{className:"text-[13px] text-muted-foreground",children:v},void 0,!1),e[12]=v,e[13]=x):x=e[13];let y;e[14]!==h||e[15]!==x?(y=(0,On.jsxDEV)("div",{className:"flex flex-col items-center gap-3 text-center",children:[p,(0,On.jsxDEV)("div",{className:"flex flex-col gap-1",children:[h,x]},void 0,!0)]},void 0,!0),e[14]=h,e[15]=x,e[16]=y):y=e[16];let b;e[17]!==r?(b=r("admin token"),e[17]=r,e[18]=b):b=e[18];let S;e[19]!==b?(S=(0,On.jsxDEV)("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:b},void 0,!1),e[19]=b,e[20]=S):S=e[20];let w;e[21]===Symbol.for("react.memo_cache_sentinel")?(w=n(L=>{s(L.target.value)},"t11"),e[21]=w):w=e[21];let C;e[22]!==a?(C=(0,On.jsxDEV)(mo,{autoComplete:"off",autoFocus:!0,"data-testid":"lunora-studio-login-token",id:"lunora-studio-login-token",onChange:w,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:a},void 0,!1),e[22]=a,e[23]=C):C=e[23];let F;e[24]!==r?(F=r("From your worker's LUNORA_ADMIN_TOKEN \u2014 your project's .dev.vars in dev, or a deployment secret in production."),e[24]=r,e[25]=F):F=e[25];let T;e[26]!==F?(T=(0,On.jsxDEV)("p",{className:"text-[11px] text-muted-foreground",children:F},void 0,!1),e[26]=F,e[27]=T):T=e[27];let E;e[28]!==S||e[29]!==C||e[30]!==T?(E=(0,On.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[S,C,T]},void 0,!0),e[28]=S,e[29]=C,e[30]=T,e[31]=E):E=e[31];let k=c==="",O;e[32]!==r?(O=r("Connect"),e[32]=r,e[33]=O):O=e[33];let D;e[34]!==k||e[35]!==O?(D=(0,On.jsxDEV)(dt,{"data-testid":"lunora-studio-login-submit",disabled:k,type:"submit",children:O},void 0,!1),e[34]=k,e[35]=O,e[36]=D):D=e[36];let M;return e[37]!==f||e[38]!==E||e[39]!==D||e[40]!==y?(M=(0,On.jsxDEV)("form",{className:"flex w-full max-w-sm flex-col gap-5 rounded-xl border border-border bg-card p-7 shadow-lg","data-testid":"lunora-studio-login",onSubmit:f,children:[y,E,D]},void 0,!0),e[37]=f,e[38]=E,e[39]=D,e[40]=y,e[41]=M):M=e[41],M},"StudioLoginForm"),ASt=n(t=>{let e=(0,Dw.c)(10),{i18n:o,onSubmit:r}=t,{resolvedTheme:a}=aV(),s=a==="dark"&&"dark",i;e[0]!==s?(i=tt(YZ,s,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=s,e[1]=i):i=e[1];let c;e[2]!==r?(c=(0,On.jsxDEV)(ESt,{onSubmit:r},void 0,!1),e[2]=r,e[3]=c):c=e[3];let d;e[4]!==o||e[5]!==c?(d=(0,On.jsxDEV)(YA,{i18n:o,children:c},void 0,!1),e[4]=o,e[5]=c,e[6]=d):d=e[6];let f;return e[7]!==i||e[8]!==d?(f=(0,On.jsxDEV)("div",{className:i,"data-testid":"lunora-studio-login-root",children:d},void 0,!1),e[7]=i,e[8]=d,e[9]=f):f=e[9],f},"StudioLogin"),TSt=n(t=>{if(t!==void 0&&t!=="")return t;let e=globalThis.location;return e?.origin!==void 0&&e.origin!==""?e.origin:"http://localhost:5173"},"resolveBaseUrl"),kSt=n(t=>{let e=(0,Dw.c)(23),{basePath:o,chrome:r,studio:a}=t,s=Ve(),i;e[0]!==s?(i=s("Studio failed"),e[0]=s,e[1]=i):i=e[1];let c;e[2]!==s?(c=s("Studio"),e[2]=s,e[3]=c):c=e[3];let d;e[4]!==s?(d=s("Try again"),e[4]=s,e[5]=d):d=e[5];let f=a?.dataEditable,p=a?.functions,m=a?.initialShardKey,h=a?.openApiSpec,v=a?.openRpcSpec,x=a?.runAsIdentity,y=a?.scheduledCancel,b=a?.scheduledLoad,S=a?.schemaEditable,w;e[6]!==o||e[7]!==r||e[8]!==y||e[9]!==b||e[10]!==S||e[11]!==f||e[12]!==p||e[13]!==m||e[14]!==h||e[15]!==v||e[16]!==x?(w=(0,On.jsxDEV)(rNe,{basePath:o,chrome:r,dataEditable:f,functions:p,initialShardKey:m,openApiSpec:h,openRpcSpec:v,runAsIdentity:x,scheduledCancel:y,scheduledLoad:b,schemaEditable:S},void 0,!1),e[6]=o,e[7]=r,e[8]=y,e[9]=b,e[10]=S,e[11]=f,e[12]=p,e[13]=m,e[14]=h,e[15]=v,e[16]=x,e[17]=w):w=e[17];let C;return e[18]!==i||e[19]!==w||e[20]!==c||e[21]!==d?(C=(0,On.jsxDEV)(tb,{fallbackTitle:i,label:c,retryLabel:d,children:w},void 0,!1),e[18]=i,e[19]=w,e[20]=c,e[21]=d,e[22]=C):C=e[22],C},"StudioAppBody"),MSt=n(t=>{let e=(0,Dw.c)(20),{basePath:o,clearToken:r,client:a,i18n:s,onTokenChange:i,rulesInstalled:c,studio:d,token:f}=t,{resolvedTheme:p}=aV(),m;e[0]!==r||e[1]!==i||e[2]!==c||e[3]!==f?(m={clearToken:r,onTokenChange:i,rulesInstalled:c,token:f},e[0]=r,e[1]=i,e[2]=c,e[3]=f,e[4]=m):m=e[4];let h=m,v=p==="dark"&&"dark",x;e[5]!==v?(x=tt(YZ,v,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=v,e[6]=x):x=e[6];let y;e[7]!==o||e[8]!==h||e[9]!==d?(y=(0,On.jsxDEV)(qOe,{children:(0,On.jsxDEV)(kSt,{basePath:o,chrome:h,studio:d},void 0,!1)},void 0,!1),e[7]=o,e[8]=h,e[9]=d,e[10]=y):y=e[10];let b;e[11]!==s||e[12]!==y?(b=(0,On.jsxDEV)(YA,{i18n:s,children:y},void 0,!1),e[11]=s,e[12]=y,e[13]=b):b=e[13];let S;e[14]!==a||e[15]!==b?(S=(0,On.jsxDEV)(r$,{client:a,children:b},void 0,!1),e[14]=a,e[15]=b,e[16]=S):S=e[16];let w;return e[17]!==x||e[18]!==S?(w=(0,On.jsxDEV)("div",{className:x,"data-testid":"lunora-studio-app",children:S},void 0,!1),e[17]=x,e[18]=S,e[19]=w):w=e[19],w},"StudioShell"),aNe=n(t=>{let e=(0,Dw.c)(25),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{adminToken:r,basePath:a,baseUrl:s,client:i,rulesInstalled:c,studio:d,locale:f}=o,p;e[2]!==r?(p=n(()=>r??FSt(),"t2"),e[2]=r,e[3]=p):p=e[3];let[m,h]=(0,Nw.useState)(p),v,x;e[4]!==m?(v=n(()=>{RSt(m)},"t3"),x=[m],e[4]=m,e[5]=v,e[6]=x):(v=e[5],x=e[6]),(0,Nw.useEffect)(v,x);let y=na(m,300),b;e:{if(i!==void 0){b=i;break e}let L;e[7]!==s||e[8]!==y?(L=new hF({url:TSt(s),...y===""?{}:{wsToken:y}}),y!==""&&L.setAuthToken(y),e[7]=s,e[8]=y,e[9]=L):L=e[9],b=L}let S=b,w,C;e[10]!==S||e[11]!==i?(w=n(()=>()=>{i===void 0&&S.close()},"t6"),C=[S,i],e[10]=S,e[11]=i,e[12]=w,e[13]=C):(w=e[12],C=e[13]),(0,Nw.useEffect)(w,C);let F;e[14]===Symbol.for("react.memo_cache_sentinel")?(F=n(L=>{h(L.target.value)},"t8"),e[14]=F):F=e[14];let T=F,E;e[15]===Symbol.for("react.memo_cache_sentinel")?(E=n(()=>{h("")},"t9"),e[15]=E):E=e[15];let k=E,O;e[16]!==f?(O=BF(f),e[16]=f,e[17]=O):O=e[17];let D=O,M;return e[18]!==a||e[19]!==S||e[20]!==D||e[21]!==c||e[22]!==d||e[23]!==m?(M=(0,On.jsxDEV)(jOe,{children:m===""?(0,On.jsxDEV)(ASt,{i18n:D,onSubmit:h},void 0,!1):(0,On.jsxDEV)(MSt,{basePath:a,clearToken:k,client:S,i18n:D,onTokenChange:T,rulesInstalled:c,studio:d,token:m},void 0,!1)},void 0,!1),e[18]=a,e[19]=S,e[20]=D,e[21]=c,e[22]=d,e[23]=m,e[24]=M):M=e[24],M},"StudioApp");var iNe=K(po(),1);var lNe=n((t={})=>{let{container:e="#root",...o}=t,r=typeof e=="string"?document.querySelector(e):e;if(r===null)throw new Error(`mountStudio: container ${typeof e=="string"?e:"element"} not found`);let a=(0,sNe.createRoot)(r);return a.render((0,iNe.jsxDEV)(aNe,{adminToken:o.adminToken,basePath:o.basePath,baseUrl:o.baseUrl,locale:o.locale,rulesInstalled:o.rulesInstalled,studio:o.studio},void 0,!1)),a},"mountStudio");var zm=globalThis;lNe({basePath:typeof zm.__LUNORA_BASE_PATH__=="string"?zm.__LUNORA_BASE_PATH__:"/",adminToken:typeof zm.__LUNORA_ADMIN_TOKEN__=="string"&&zm.__LUNORA_ADMIN_TOKEN__!==""?zm.__LUNORA_ADMIN_TOKEN__:void 0,studio:{dataEditable:zm.__LUNORA_DATA_EDITABLE__===!0,runAsIdentity:zm.__LUNORA_RUN_AS_IDENTITY__===!0,schemaEditable:zm.__LUNORA_SCHEMA_EDITABLE__===!0},rulesInstalled:zm.__LUNORA_RULES_INSTALLED__!==!1});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/studio",
3
- "version": "1.0.0-alpha.24",
3
+ "version": "1.0.0-alpha.25",
4
4
  "description": "The Lunora Studio: a local admin UI for your schema, data, logs, and advisors",
5
5
  "keywords": [
6
6
  "admin-ui",