lenso-cli 0.1.14

Lenso command-line interface for scaffolding and operating Lenso backend projects.
1
2
3
import{n as e}from"./rolldown-runtime-Bh1tDfsg.js";import{i as t,r as n}from"./react-qq500p4R.js";import{a as r,m as i,n as a,r as o,t as s}from"./tanstack-BEBkZm10.js";import{A as c,B as l,C as u,D as d,E as f,F as p,H as m,J as h,K as g,L as ee,P as _,Q as v,S as y,V as b,Y as te,_t as ne,c as x,ct as S,dt as re,f as ie,gt as C,h as ae,ht as oe,it as w,j as T,k as E,l as se,lt as ce,mt as D,nt as le,ot as ue,p as de,q as fe,rt as O,st as k,tt as pe,u as me,ut as A,vt as he,w as ge,z as _e}from"./ui-vendor-DUnow8p0.js";import{t as j}from"./gsap-D_956-p2.js";var ve=`/`;`${[`runtime.stories.read`,`auth.users.read`,`identity.users.read`,`remote_crm.contacts.read`,`remote_crm.contacts.sync`,`hello-action:greetings:write`].join(`,`)}`;var ye=`dev-service:admin:runtime.stories.read,auth.users.read,identity.users.read,remote_crm.contacts.read,remote_crm.contacts.sync,hello-action:greetings:write`;function be(e=ve){if(!e)return;let t=e.trim();if(t)return t===`/`?`/`:t.replace(/\/+$/,``)}function M(){return!!be()}function xe(){return M()?`api`:`mock`}var Se=be(),N=ne.create({...Se?{prefix:Se}:{},hooks:{beforeRequest:[({request:e})=>{e.headers.set(`Accept`,`application/json`),e.headers.set(`Authorization`,`Bearer ${ye}`)}],beforeError:[async({error:e})=>{if(!he(e))return e;let t=await e.response.json().catch(()=>void 0);return t&&typeof t==`object`&&`error`in t&&t.error&&typeof t.error==`object`&&`message`in t.error&&(e.message=String(t.error.message)),e}]}}),P=e(t(),1),F=e(n(),1),Ce=[`modules`,`registry`];function we(){return o({enabled:M(),queryKey:Ce,queryFn:()=>N.get(`admin/data/modules`).json()})}var Te=e=>e;new Proxy({},{get:()=>{throw Error(`Runtime Console host API is only available inside Lenso.`)}});var Ee=e=>e,De=e=>`surfaces`in e?e.surfaces:[e],Oe=e=>De(e).map(t=>{let n={area:t.area,label:t.label,name:t.surfaceName,package:{export:e.exportName,name:e.packageName},required_capabilities:t.requiredCapabilities,route:t.route};return t.icon&&(n.icon=t.icon),t.navigation&&(n.navigation=t.navigation),n}),ke=e=>{let[t]=Oe(e);if(!t)throw Error(`Console package manifest declares no surfaces: ${e.id}`);return t},Ae=`corr_01HX9A7K2R_RUNTIME`,je=[{id:`story_resource_published_fanout`,name:`Resource Published Fan-out`,service:`content-api`,source:`runtime-story`,status:`completed`,durationMs:9600,timestamp:`2026-06-01T10:00:00.000Z`,correlationId:`corr_resource_published_fanout`,nodes:[{id:`publish_resource_request`,name:`PublishResource`,service:`content-api`,kind:`http`,status:`completed`,startMs:0,durationMs:320,attributes:{"http.method":`POST`,"http.route":`/v1/resources/:id/publish`,resource_id:`res_01J2PUBLISH`},events:[{name:`request.accepted`,timestampMs:0}],logs:[`validated publish request`,`opened publish workflow`],context:{actor:`user:editor_42`,correlation_id:`corr_resource_published_fanout`,request_id:`req_resource_publish`},payload:{resource_id:`res_01J2PUBLISH`,version:7}},{id:`create_resource_version`,parentId:`publish_resource_request`,name:`CreateResourceVersion`,service:`content`,kind:`function`,status:`completed`,startMs:260,durationMs:1040,attributes:{module:`content`,version:7},events:[{name:`version.snapshot_created`,timestampMs:520},{name:`version.persisted`,timestampMs:1260}],logs:[`snapshotted draft`,`persisted resource version`],context:{correlation_id:`corr_resource_published_fanout`,resource_id:`res_01J2PUBLISH`},payload:{resource_id:`res_01J2PUBLISH`,version_id:`rv_01J2PUBLISH_V7`}},{id:`resource_version_published`,parentId:`create_resource_version`,name:`ResourceVersionPublished`,service:`outbox-relay`,kind:`event`,status:`published`,startMs:1400,durationMs:420,attributes:{event_name:`content.resource_version_published.v1`,fanout_handlers:3},events:[{name:`event.claimed`,timestampMs:1400},{name:`fanout.dispatched`,timestampMs:1820}],logs:[`published resource version event`,`dispatched fan-out work`],context:{correlation_id:`corr_resource_published_fanout`,causation_id:`create_resource_version`}},{id:`generate_search_index`,parentId:`resource_version_published`,name:`GenerateSearchIndex`,service:`search`,kind:`function`,status:`completed`,startMs:2e3,durationMs:4500,attributes:{index:`resources_live`,documents_written:18},events:[{name:`index.batch_started`,timestampMs:2050},{name:`index.batch_committed`,timestampMs:6500}],logs:[`generated searchable document`,`committed search index batch`],context:{correlation_id:`corr_resource_published_fanout`,function_run_id:`fn_generate_search_index`},payload:{resource_id:`res_01J2PUBLISH`,version_id:`rv_01J2PUBLISH_V7`}},{id:`sync_cdn_metadata`,parentId:`resource_version_published`,name:`SyncCDNMetadata`,service:`cdn`,kind:`function`,status:`completed`,startMs:2200,durationMs:1800,attributes:{provider:`fastly`,surrogate_keys:6},events:[{name:`cdn.metadata_patch_started`,timestampMs:2220},{name:`cdn.metadata_patch_completed`,timestampMs:4e3}],logs:[`patched CDN metadata`,`queued soft purge`],context:{correlation_id:`corr_resource_published_fanout`,function_run_id:`fn_sync_cdn_metadata`},payload:{resource_id:`res_01J2PUBLISH`,version_id:`rv_01J2PUBLISH_V7`}},{id:`send_subscriber_notifications`,parentId:`resource_version_published`,name:`SendSubscriberNotifications`,service:`notifications`,kind:`function`,status:`completed`,startMs:2100,durationMs:6900,attributes:{subscribers:1248,batches:13},events:[{name:`notification.batches_created`,timestampMs:2140},{name:`notification.batches_sent`,timestampMs:9e3}],logs:[`created subscriber batches`,`sent publish notifications`],context:{correlation_id:`corr_resource_published_fanout`,function_run_id:`fn_send_subscriber_notifications`},payload:{resource_id:`res_01J2PUBLISH`,version_id:`rv_01J2PUBLISH_V7`}},{id:`mark_publish_complete`,parentId:`resource_version_published`,name:`MarkPublishComplete`,service:`content`,kind:`function`,status:`completed`,startMs:9150,durationMs:450,attributes:{completed_after:`fanout`,version_id:`rv_01J2PUBLISH_V7`},events:[{name:`publish.completed`,timestampMs:9600}],logs:[`all fan-out work completed`,`marked publish complete`],context:{correlation_id:`corr_resource_published_fanout`,resource_id:`res_01J2PUBLISH`},payload:{resource_id:`res_01J2PUBLISH`,published:!0}}],edges:[{id:`edge_publish_to_create_version`,source:`publish_resource_request`,target:`create_resource_version`,type:`causation`},{id:`edge_create_version_to_event`,source:`create_resource_version`,target:`resource_version_published`,type:`causation`},{id:`edge_event_to_search`,source:`resource_version_published`,target:`generate_search_index`,type:`causation`},{id:`edge_event_to_cdn`,source:`resource_version_published`,target:`sync_cdn_metadata`,type:`causation`},{id:`edge_event_to_notifications`,source:`resource_version_published`,target:`send_subscriber_notifications`,type:`causation`},{id:`edge_event_to_mark_complete`,source:`resource_version_published`,target:`mark_publish_complete`,type:`sequence`,label:`join`}],timelineItems:[{id:`timeline_publish_resource_request`,type:`http_request`,name:`PublishResource`,status:`completed`,attempts:1,maxAttempts:1,correlationId:`corr_resource_published_fanout`,createdAt:`2026-06-01T10:00:00.000Z`,startedAt:`2026-06-01T10:00:00.000Z`,completedAt:`2026-06-01T10:00:00.320Z`,detailId:`publish_resource_request`},{id:`timeline_create_resource_version`,type:`function_run`,name:`CreateResourceVersion`,status:`completed`,attempts:1,maxAttempts:1,correlationId:`corr_resource_published_fanout`,createdAt:`2026-06-01T10:00:00.260Z`,startedAt:`2026-06-01T10:00:00.260Z`,completedAt:`2026-06-01T10:00:01.300Z`,detailId:`create_resource_version`},{id:`timeline_resource_version_published`,type:`outbox_event`,name:`ResourceVersionPublished`,status:`published`,attempts:1,maxAttempts:3,correlationId:`corr_resource_published_fanout`,createdAt:`2026-06-01T10:00:01.400Z`,startedAt:`2026-06-01T10:00:01.400Z`,completedAt:`2026-06-01T10:00:01.820Z`,detailId:`resource_version_published`},{id:`timeline_generate_search_index`,type:`function_run`,name:`GenerateSearchIndex`,status:`completed`,attempts:1,maxAttempts:3,correlationId:`corr_resource_published_fanout`,createdAt:`2026-06-01T10:00:02.000Z`,startedAt:`2026-06-01T10:00:02.000Z`,completedAt:`2026-06-01T10:00:06.500Z`,detailId:`generate_search_index`},{id:`timeline_sync_cdn_metadata`,type:`function_run`,name:`SyncCDNMetadata`,status:`completed`,attempts:1,maxAttempts:3,correlationId:`corr_resource_published_fanout`,createdAt:`2026-06-01T10:00:02.200Z`,startedAt:`2026-06-01T10:00:02.200Z`,completedAt:`2026-06-01T10:00:04.000Z`,detailId:`sync_cdn_metadata`},{id:`timeline_send_subscriber_notifications`,type:`function_run`,name:`SendSubscriberNotifications`,status:`completed`,attempts:1,maxAttempts:3,correlationId:`corr_resource_published_fanout`,createdAt:`2026-06-01T10:00:02.100Z`,startedAt:`2026-06-01T10:00:02.100Z`,completedAt:`2026-06-01T10:00:09.000Z`,detailId:`send_subscriber_notifications`},{id:`timeline_mark_publish_complete`,type:`function_run`,name:`MarkPublishComplete`,status:`completed`,attempts:1,maxAttempts:1,correlationId:`corr_resource_published_fanout`,createdAt:`2026-06-01T10:00:09.150Z`,startedAt:`2026-06-01T10:00:09.150Z`,completedAt:`2026-06-01T10:00:09.600Z`,detailId:`mark_publish_complete`}]},{id:`tr_01HX9A7_RUNTIME`,name:`POST /v1/identity/users`,service:`app-api`,source:`http`,status:`failed`,durationMs:6412,timestamp:`2026-05-31T09:18:11.980Z`,correlationId:Ae,nodes:[{id:`sp_http_create_user`,name:`POST /v1/identity/users`,service:`app-api`,kind:`http`,status:`completed`,startMs:0,durationMs:140,attributes:{"http.method":`POST`,"http.route":`/v1/identity/users`,"http.status_code":201},events:[{name:`request.accepted`,timestampMs:4}],logs:[`request context created`,`identity route matched`],context:{actor:`user:user_123`,request_id:`req_01HX9A7G`,correlation_id:Ae},payload:{email:`alex@example.com`,display_name:`Alex Chen`}},{id:`sp_identity_command`,parentId:`sp_http_create_user`,name:`identity.create_user`,service:`identity`,kind:`command`,status:`completed`,startMs:24,durationMs:91,attributes:{"module.name":`identity`,"command.name":`identity.create_user`},events:[{name:`validation.passed`,timestampMs:31}],logs:[`validated email`,`opened database transaction`],context:{actor:`user:user_123`,tenant_id:`local`}},{id:`sp_outbox_insert`,parentId:`sp_identity_command`,name:`platform.outbox.insert`,service:`postgres`,kind:`database`,status:`completed`,startMs:72,durationMs:22,attributes:{"db.system":`postgresql`,"db.schema":`platform`,"db.operation":`insert`},events:[{name:`row.inserted`,timestampMs:87}],logs:[`inserted outbox event identity.user_registered.v1`],context:{transaction_id:`tx_01HX9A7`},payload:{event_name:`identity.user_registered.v1`,aggregate_id:`usr_01HX9A7J`}},{id:`sp_user_registered`,parentId:`sp_outbox_insert`,name:`identity.user_registered.v1`,service:`outbox-relay`,kind:`event`,status:`published`,startMs:440,durationMs:260,attributes:{"event.name":`identity.user_registered.v1`,"event.version":1,"outbox.attempt":1},events:[{name:`event.claimed`,timestampMs:441},{name:`event.dispatched`,timestampMs:687}],logs:[`claimed outbox row`,`dispatching in-process handlers`],context:{locked_by:`worker-local-1`,correlation_id:Ae}},{id:`sp_notifications_handler`,parentId:`sp_user_registered`,name:`notifications.handle_user_registered`,service:`notifications`,kind:`handler`,status:`completed`,startMs:712,durationMs:118,attributes:{"handler.event":`identity.user_registered.v1`,"module.name":`notifications`},events:[{name:`handler.completed`,timestampMs:826}],logs:[`resolved welcome-email runtime function`],context:{causation_id:`evt_01HX9A7N_USER_REGISTERED`}},{id:`sp_enqueue_function`,parentId:`sp_notifications_handler`,name:`runtime.enqueue_function`,service:`platform-runtime`,kind:`runtime`,status:`completed`,startMs:841,durationMs:38,attributes:{"runtime.function":`notifications.send_welcome_email.v1`,"runtime.max_attempts":3},events:[{name:`function_run.created`,timestampMs:871}],logs:[`inserted runtime.function_runs row`],context:{function_run_id:`fn_01HX9A7Q_WELCOME_DEAD`}},{id:`sp_send_welcome`,parentId:`sp_enqueue_function`,name:`notifications.send_welcome_email.v1`,service:`runtime-worker`,kind:`function`,status:`dead`,startMs:1120,durationMs:5290,attributes:{"runtime.attempt":3,"runtime.function":`notifications.send_welcome_email.v1`,"runtime.status":`dead`},events:[{name:`function.claimed`,timestampMs:1120},{name:`function.retry_exhausted`,timestampMs:6410}],logs:[`attempt 3/3`,`rendered welcome template`,`smtp provider timed out after 5000ms`],context:{locked_by:`worker-local-1`,actor:`system`},payload:{user_id:`usr_01HX9A7J`,email:`alex@example.com`,template:`welcome`},retryable:!0,attempts:3,maxAttempts:3},{id:`sp_smtp_provider`,parentId:`sp_send_welcome`,name:`smtp.provider.call`,service:`postmark`,kind:`external`,status:`failed`,startMs:1285,durationMs:5e3,attributes:{"net.peer.name":`api.postmarkapp.com`,provider:`postmark`,timeout_ms:5e3},events:[{name:`socket.timeout`,timestampMs:6285}],logs:[`connect ETIMEDOUT`],context:{retry_after_ms:3e4},retryable:!1}]},{id:`tr_01HX9C5_FILES`,name:`files.object_uploaded.v1`,service:`files`,source:`outbox`,status:`pending`,durationMs:820,timestamp:`2026-05-31T09:20:44.500Z`,correlationId:`corr_01HX9C5_FILES`,nodes:[{id:`sp_files_upload`,name:`files.object_uploaded.v1`,service:`outbox-relay`,kind:`event`,status:`pending`,startMs:0,durationMs:820,attributes:{"event.name":`files.object_uploaded.v1`,queue:`platform.outbox`},events:[{name:`available`,timestampMs:0}],logs:[`waiting for relay claim`],context:{correlation_id:`corr_01HX9C5_FILES`}}]},{id:`tr_01HX9A9_CLEANUP`,name:`identity.cleanup_expired_sessions.v1`,service:`identity`,source:`runtime-worker`,status:`completed`,durationMs:128,timestamp:`2026-05-31T09:14:01.000Z`,correlationId:`corr_01HX9A9_CLEANUP`,nodes:[{id:`sp_cleanup_run`,name:`identity.cleanup_expired_sessions.v1`,service:`runtime-worker`,kind:`function`,status:`completed`,startMs:0,durationMs:128,attributes:{"runtime.function":`identity.cleanup_expired_sessions.v1`,deleted_sessions:17},events:[{name:`function.completed`,timestampMs:128}],logs:[`scanned sessions`,`deleted 17 expired rows`],context:{locked_by:`worker-local-1`},payload:{older_than_minutes:60}}]}],I=[{id:`evt_01HX9A7N_USER_REGISTERED`,eventName:`identity.user_registered.v1`,status:`published`,attempts:1,maxAttempts:3,aggregateId:`usr_01HX9A7J`,aggregateType:`user`,correlationId:Ae,causationId:`req_01HX9A7G`,createdAt:`2026-05-31T09:18:12.120Z`,lockedAt:`2026-05-31T09:18:12.420Z`,publishedAt:`2026-05-31T09:18:12.680Z`,actor:{kind:`user`,id:`user_123`,scopes:[`identity:create`]},payload:{user_id:`usr_01HX9A7J`,email:`alex@example.com`,display_name:`Alex Chen`}},{id:`evt_01HX9B2_DEAD_PROFILE`,eventName:`identity.user_registered.v1`,status:`dead`,attempts:3,maxAttempts:3,aggregateId:`usr_01HX9B2`,aggregateType:`user`,correlationId:`corr_01HX9B2_PROFILE`,causationId:`req_01HX9B2`,createdAt:`2026-05-31T09:10:03.000Z`,lockedAt:`2026-05-31T09:12:11.000Z`,lastError:`handler failed: runtime enqueue unavailable`,actor:{kind:`service`,id:`worker`,scopes:[`runtime:dispatch`]},payload:{user_id:`usr_01HX9B2`,email:`nora@example.com`,display_name:`Nora Vale`}},{id:`evt_01HX9C5_OBJECT`,eventName:`files.object_uploaded.v1`,status:`pending`,attempts:0,maxAttempts:3,aggregateId:`obj_01HX9C5`,aggregateType:`object`,correlationId:`corr_01HX9C5_FILES`,causationId:`req_01HX9C5`,createdAt:`2026-05-31T09:20:44.500Z`,actor:{kind:`user`,id:`user_456`,scopes:[`files:write`]},payload:{object_id:`obj_01HX9C5`,bucket:`avatars`,content_type:`image/png`}},{id:`evt_01HX9D9_MESSAGE`,eventName:`notifications.message_sent.v1`,status:`failed`,attempts:2,maxAttempts:3,aggregateId:`msg_01HX9D9`,aggregateType:`message`,correlationId:`corr_01HX9D9_NOTIFY`,causationId:`fn_01HX9D9`,createdAt:`2026-05-31T09:22:30.200Z`,lockedAt:`2026-05-31T09:23:10.000Z`,lastError:`smtp provider returned timeout after 5000ms`,actor:{kind:`system`},payload:{message_id:`msg_01HX9D9`,channel:`email`,provider:`postmark`}}],L=[{id:`fn_01HX9A7Q_WELCOME`,functionName:`notifications.send_welcome_email.v1`,runtimeDeclaration:{moduleName:`notifications`,moduleSource:`linked`,name:`notifications.send_welcome_email.v1`,version:1,queue:`notifications`,inputSchema:`notifications.send_welcome_email.v1`},status:`failed`,attempts:2,maxAttempts:3,correlationId:Ae,createdAt:`2026-05-31T09:18:13.000Z`,startedAt:`2026-05-31T09:18:13.160Z`,completedAt:`2026-05-31T09:18:18.180Z`,lockedBy:`worker-local-1`,lastError:`email provider timeout: connect ETIMEDOUT`,actor:{kind:`system`},input:{user_id:`usr_01HX9A7J`,email:`alex@example.com`,template:`welcome`},logs:[`loaded welcome template`,`resolved recipient alex@example.com`,`provider request timed out after 5000ms`]},{id:`fn_01HX9A7Q_WELCOME_DEAD`,functionName:`notifications.send_welcome_email.v1`,runtimeDeclaration:{moduleName:`notifications`,moduleSource:`linked`,name:`notifications.send_welcome_email.v1`,version:1,queue:`notifications`,inputSchema:`notifications.send_welcome_email.v1`},status:`dead`,attempts:3,maxAttempts:3,correlationId:Ae,createdAt:`2026-05-31T09:23:13.000Z`,startedAt:`2026-05-31T09:23:13.160Z`,completedAt:`2026-05-31T09:23:18.220Z`,lockedBy:`worker-local-1`,lastError:`dead after retry: email provider timeout: connect ETIMEDOUT`,actor:{kind:`system`},input:{user_id:`usr_01HX9A7J`,email:`alex@example.com`,template:`welcome`},logs:[`retry attempt 3/3`,`provider request timed out after 5000ms`,`marked dead after exhausting attempts`]},{id:`fn_01HX9A9_CLEANUP`,functionName:`identity.cleanup_expired_sessions.v1`,runtimeDeclaration:{moduleName:`identity`,moduleSource:`linked`,name:`identity.cleanup_expired_sessions.v1`,version:1,queue:`identity`,inputSchema:`identity.cleanup_expired_sessions.v1`},status:`completed`,attempts:1,maxAttempts:3,correlationId:`corr_01HX9A9_CLEANUP`,createdAt:`2026-05-31T09:14:01.000Z`,startedAt:`2026-05-31T09:14:01.040Z`,completedAt:`2026-05-31T09:14:01.128Z`,lockedBy:`worker-local-1`,actor:{kind:`service`,id:`scheduler`,scopes:[`runtime:enqueue`]},input:{older_than_minutes:60},output:{deleted_sessions:17},logs:[`scanned sessions`,`deleted 17 expired rows`]},{id:`fn_01HX9E2_RUNNING`,functionName:`notifications.send_welcome_email.v1`,runtimeDeclaration:{moduleName:`notifications`,moduleSource:`linked`,name:`notifications.send_welcome_email.v1`,version:1,queue:`notifications`,inputSchema:`notifications.send_welcome_email.v1`},status:`running`,attempts:1,maxAttempts:3,correlationId:`corr_01HX9E2_RUNNING`,createdAt:`2026-05-31T09:24:10.000Z`,startedAt:`2026-05-31T09:24:11.000Z`,lockedBy:`worker-local-2`,actor:{kind:`system`},input:{user_id:`usr_01HX9E2`,email:`maya@example.com`,template:`welcome`},logs:[`claimed run`,`rendering template`]},{id:`fn_01HX9F6_DEAD`,functionName:`notifications.send_welcome_email.v1`,runtimeDeclaration:{moduleName:`notifications`,moduleSource:`linked`,name:`notifications.send_welcome_email.v1`,version:1,queue:`notifications`,inputSchema:`notifications.send_welcome_email.v1`},status:`dead`,attempts:3,maxAttempts:3,correlationId:`corr_01HX9F6_DEAD`,createdAt:`2026-05-31T09:05:42.000Z`,startedAt:`2026-05-31T09:08:42.000Z`,completedAt:`2026-05-31T09:08:47.000Z`,lockedBy:`worker-local-1`,lastError:`template renderer rejected missing locale`,actor:{kind:`system`},input:{user_id:`usr_01HX9F6`,email:`sam@example.com`,template:`welcome`,locale:null},logs:[`claimed run`,`template renderer rejected missing locale`]},{id:`fn_01HX9R_REMOTE_SYNC`,functionName:`remote_crm.sync_contact.v1`,runtimeDeclaration:{moduleName:`remote-crm`,moduleSource:`remote`,name:`remote_crm.sync_contact.v1`,version:1,queue:`remote-crm`,inputSchema:`remote_crm.sync_contact.v1`,retryPolicy:{maxAttempts:3,initialDelayMs:1e3}},status:`completed`,attempts:1,maxAttempts:3,correlationId:`corr_01HX9R_REMOTE_SYNC`,createdAt:`2026-05-31T09:26:10.000Z`,startedAt:`2026-05-31T09:26:11.000Z`,completedAt:`2026-05-31T09:26:11.420Z`,lockedBy:`worker-remote-1`,actor:{kind:`system`},input:{contact_id:`contact_1`},output:{synced:!0},logs:[`claimed remote runtime function`,`remote module returned success`]}],Me=[{name:`outbox`,pending:12,running:1,failed:2,dead:1,oldest:`38s`},{name:`runtime.functions`,pending:7,running:3,failed:1,dead:1,oldest:`12s`}],Ne=[{capability:`crm.accounts.read`,correlation_id:`corr_resource_published_fanout`,declared_path:`/accounts/:account_id`,duration_ms:86,error_code:null,error_details:null,id:`rpc_01J2REMOTE_OK_ACCOUNTS`,method:`GET`,module_name:`remote-crm`,occurred_at:`2026-06-03T10:12:04.120Z`,path_params:{account_id:`acct_01J2A9`},remote_path:`/v1/accounts/acct_01J2A9`,remote_status:200,request_id:`req_remote_accounts_lookup`,retryable:!1,span_id:`span_remote_accounts_lookup`,success:!0,trace_id:`trace_remote_accounts_lookup`},{capability:`billing.invoices.create`,correlation_id:`corr_resource_published_fanout`,declared_path:`/invoices`,duration_ms:1420,error_code:`remote_http_429`,error_details:{message:`remote module rate limited the request`,retry_after_seconds:45,upstream:`billing-sandbox`},id:`rpc_01J2REMOTE_FAIL_BILLING`,method:`POST`,module_name:`remote-billing`,occurred_at:`2026-06-03T10:08:41.880Z`,path_params:{},remote_path:`/api/invoices`,remote_status:429,request_id:`req_remote_invoice_create`,retryable:!0,span_id:`span_remote_invoice_create`,success:!1,trace_id:`trace_remote_invoice_create`},{capability:`fulfillment.shipments.read`,correlation_id:`corr_remote_shipment_detail`,declared_path:`/shipments/:shipment_id`,duration_ms:314,error_code:null,error_details:null,id:`rpc_01J2REMOTE_OK_SHIPMENT`,method:`GET`,module_name:`remote-fulfillment`,occurred_at:`2026-06-03T09:58:15.004Z`,path_params:{shipment_id:`shp_01J2Z8`},remote_path:`/v2/shipments/shp_01J2Z8`,remote_status:206,request_id:`req_remote_shipment_detail`,retryable:!1,span_id:null,success:!0,trace_id:`trace_remote_shipment_detail`},{capability:`crm.contacts.write`,correlation_id:`corr_remote_contact_sync`,declared_path:`/contacts/:contact_id`,duration_ms:5012,error_code:`remote_timeout`,error_details:{message:`remote proxy timed out before headers`,timeout_ms:5e3},id:`rpc_01J2REMOTE_TIMEOUT_CONTACT`,method:`PATCH`,module_name:`remote-crm`,occurred_at:`2026-06-03T09:52:32.440Z`,path_params:{contact_id:`con_01J2C4`},remote_path:`/v1/contacts/con_01J2C4`,remote_status:null,request_id:`req_remote_contact_sync`,retryable:!0,span_id:`span_remote_contact_sync`,success:!1,trace_id:`trace_remote_contact_sync`}],Pe=[{action_name:`sync_contacts`,capability:`remote_crm.contacts.sync`,correlation_id:`corr_admin_action_contact_sync`,duration_ms:128,error_code:null,error_message:null,id:`adminaction_req_admin_contact_sync`,input_summary:`dry_run: true`,label:`Sync contacts`,module_name:`remote-crm`,occurred_at:`2026-06-03T10:14:22.150Z`,request_id:`req_admin_contact_sync`,result_summary:`queued contact sync`,span_id:`span_admin_contact_sync`,success:!0,trace_id:`trace_admin_contact_sync`},{action_name:`rebuild_customer_index`,capability:`identity.users.maintain`,correlation_id:`corr_admin_action_reindex`,duration_ms:2410,error_code:`action_validation_failed`,error_message:`input window must be less than 24h`,id:`adminaction_req_admin_reindex_failed`,input_summary:`window: 7d`,label:`Rebuild customer index`,module_name:`identity`,occurred_at:`2026-06-03T10:02:09.300Z`,request_id:`req_admin_reindex_failed`,result_summary:null,span_id:`span_admin_reindex_failed`,success:!1,trace_id:`trace_admin_reindex_failed`},{action_name:`replay_invoice_export`,capability:`billing.invoices.export`,correlation_id:`corr_admin_action_invoice_export`,duration_ms:860,error_code:null,error_message:null,id:`adminaction_req_admin_invoice_export`,input_summary:`invoice_count: 42`,label:`Replay invoice export`,module_name:`remote-billing`,occurred_at:`2026-06-03T09:49:18.000Z`,request_id:`req_admin_invoice_export`,result_summary:`export replay scheduled`,span_id:null,success:!0,trace_id:`trace_admin_invoice_export`}];function Fe(e){return e===`failed`||e===`dead`}function Ie(e){if(!(e.retryable&&Fe(e.status)))return null;let t=e.kind===`event`?`event`:e.kind===`function`?`function`:null;return t===null?null:{attempts:e.attempts??1,id:e.id,kind:t,maxAttempts:e.maxAttempts??3,name:e.name,status:e.status}}function Le(e){if(e.kind===`event`)return Fe(e.item.status)?{kind:`event`,id:e.item.id,name:e.item.eventName,status:e.item.status,attempts:e.item.attempts,maxAttempts:e.item.maxAttempts}:null;if(e.kind===`function`)return Fe(e.item.status)?{kind:`function`,id:e.item.id,name:e.item.functionName,status:e.item.status,attempts:e.item.attempts,maxAttempts:e.item.maxAttempts}:null;if(!Fe(e.item.status))return null;let t=e.item.type===`outbox_event`||e.item.type===`event`?`event`:e.item.type===`function_run`||e.item.type===`function`?`function`:null;return t===null?null:{kind:t,id:e.item.detailId??e.item.id,name:e.item.name,status:e.item.status,attempts:e.item.attempts,maxAttempts:e.item.maxAttempts}}var Re=`1970-01-01T00:00:00.000Z`;function ze(e){return{...e.page?{page:tt(e.page)}:{},stories:(e.data??[]).map(Be)}}function Be(e){let t=B(e.correlation_id,`unknown`),n=R(e.created_at),r=st(e.duration),i=ut(e.services),a=ut(e.pattern),o=z(e.node_count,0),s=z(e.error_count,0),c=Array.from({length:o},(o,c)=>nt({correlationId:t,durationMs:c===0?r:0,...c===0&&e.root_error?{error:e.root_error}:{},id:`${t}:summary:${c+1}`,index:c,kind:rt(a[c]??a.at(-1)),service:i[c]??i.at(-1)??`runtime`,status:it(c<s?`failed`:e.status),timestamp:n}));return{correlationId:t,durationMs:r,id:t,name:B(e.title,`Runtime Story`),nodes:c,service:i[0]??`runtime`,source:`runtime-story`,status:it(e.status),timestamp:n}}function Ve(e){let t=e.summary??{},n=B(t.correlation_id,`unknown`),r=R(t.created_at),i=typeof t.created_at==`string`&&Number.isFinite(Date.parse(t.created_at)),a=Date.parse(r),o=e.nodes??[],s=new Map,c=new Map,l=o.map((e,t)=>{let o=B(e.id,`node_${t+1}`),l=c.get(o)??0;c.set(o,l+1);let u=l===0?o:`${o}__${l+1}`;s.has(o)||s.set(o,u);let d=dt(e.metadata),f=R(e.timestamp,r),p=Date.parse(f),m=i?Number.isFinite(a)&&Number.isFinite(p)?Math.max(0,p-a):t:0,h=e.error??void 0,g=it(e.status),ee=lt(d.attempts),_=lt(d.max_attempts),v=B(e.name,`Runtime Work`),y=B(e.display_name,v);return{...ee===void 0?{}:{attempts:ee},...y===v?{}:{canonicalName:v},..._===void 0?{}:{maxAttempts:_},attributes:d,context:{correlation_id:n,...typeof d.causation_id==`string`?{causation_id:d.causation_id}:{}},durationMs:st(e.duration_ms),events:[],id:u,kind:rt(e.type),logs:h?[h]:[],name:y,retryable:Fe(g),service:B(e.service,`runtime`),startMs:m,status:g}}),u=new Set(l.map(e=>e.id)),d=Ke(e.edges??[],s,u),f=new Map(d.map(e=>[e.target,e.source])),p=l.map(e=>{let t=f.get(e.id);return t?{...e,parentId:t}:e}),m=e.timeline_items?.map((e,t)=>qe(e,n,t))??[],h=Math.max(0,...p.map(e=>e.startMs+e.durationMs),...m.map(e=>ot(r,e.completedAt??e.createdAt)));return{correlationId:n,durationMs:Math.max(st(t.duration),h),edges:d,id:n,name:B(t.title,`Runtime Story`),nodes:p,service:p[0]?.service??`runtime`,source:`runtime-story`,status:it(t.status),timelineItems:m,timestamp:r}}function He(e){return{bucketSeconds:lt(e.bucket_seconds)&&Number(e.bucket_seconds)>0?Number(e.bucket_seconds):300,cells:(e.data??[]).map($e),...e.page?{page:tt(e.page)}:{}}}function Ue(e){return(e.data??[]).map(Ye)}function We(e){let t=e.data??{};return{input:t.input,metadata:t.metadata,output:t.output,redactedFields:ut(t.redacted_fields)}}function Ge(e){return(e.data??[]).map(Je)}function Ke(e,t,n){let r=new Set,i=[];for(let a of e){let e=t.get(a.source??``)??a.source,o=t.get(a.target??``)??a.target;if(!e||!o||!n.has(e)||!n.has(o))continue;let s=B(a.id,`${e}:${o}:${a.type??`edge`}`),c=`${e}:${o}:${a.type??`edge`}:${s}`;r.has(c)||(r.add(c),i.push({id:s,...a.label?{label:a.label}:{},source:e,target:o,type:B(a.type,`sequence`)}))}return i}function qe(e,t,n){let r=B(e.id,`timeline_${n+1}`),i=R(e.created_at),a=at(e.completed_at),o=e.last_error,s=at(e.started_at);return{attempts:z(e.attempts,1),correlationId:B(e.correlation_id,t),createdAt:i,detailId:r,id:r,maxAttempts:z(e.max_attempts,1),name:B(e.name,`Runtime Work`),...a?{completedAt:a}:{},...o?{lastError:o}:{},...s?{startedAt:s}:{},status:it(e.status),type:B(e.type,`runtime`)}}function Je(e){return{attributes:dt(e.attributes),body:B(e.body,``),correlationId:B(e.correlation_id,`unknown`),executionName:B(e.execution_name,`Runtime Work`),id:B(e.id,`execution_log`),nodeId:B(e.node_id,`unknown`),nodeType:B(e.node_type,`runtime`),occurredAt:R(e.occurred_at),redactedFields:ut(e.redacted_fields),serviceName:B(e.service_name,`runtime`),severity:Xe(e.severity),...typeof e.span_id==`string`?{spanId:e.span_id}:{},storyId:B(e.story_id,B(e.correlation_id,`unknown`)),...typeof e.trace_id==`string`?{traceId:e.trace_id}:{}}}function Ye(e){return{attributes:dt(e.attributes),category:Ze(e.category),correlationId:B(e.correlation_id,`unknown`),durationMs:st(e.duration_ms),endedAt:R(e.ended_at),id:B(e.id,`technical_operation`),name:B(e.name,`Technical Operation`),...e.related_node_id?{relatedNodeId:e.related_node_id}:{},source:Qe(e.source),startedAt:R(e.started_at),status:B(e.status,`unknown`),storyId:B(e.story_id,`unknown`)}}function Xe(e){switch(e){case`trace`:case`debug`:case`info`:case`warn`:case`error`:return e;default:return`info`}}function Ze(e){switch(e){case`http`:case`db`:case`redis`:case`s3`:case`ses`:case`worker`:case`runtime`:case`external`:case`unknown`:return e;default:return`unknown`}}function Qe(e){switch(e){case`remote_proxy`:case`remote_runtime`:return e;default:return`otel`}}function $e(e){let t=R(e.bucket_start),n=ct(e.avg_duration_ms),r=ct(e.max_duration_ms);return{bucketEnd:R(e.bucket_end,t),bucketStart:t,deadCount:z(e.dead_count,0),errorCount:z(e.error_count,0),...n===void 0?{}:{avgDurationMs:n},...r===void 0?{}:{maxDurationMs:r},nodeType:et(e.node_type),service:B(e.service,`runtime`),totalCount:z(e.total_count,0)}}function et(e){switch(e){case`event`:case`outbox_event`:return`event`;case`http`:case`http_request`:return`http`;default:return`function`}}function tt(e){return{limit:z(e.limit,0),...at(e.next_created_before)?{nextCreatedBefore:at(e.next_created_before)}:{}}}function nt(e){return{attributes:{},context:{correlation_id:e.correlationId},durationMs:e.durationMs,events:[],id:e.id,kind:e.kind,logs:e.error?[e.error]:[],name:`Runtime Work`,retryable:Fe(e.status),service:e.service,startMs:e.index===0?0:e.index,status:e.status}}function rt(e){switch(e){case`http`:case`http_request`:case`request`:return`http`;case`command`:return`command`;case`database`:return`database`;case`event`:case`outbox_event`:return`event`;case`handler`:return`handler`;case`function`:case`function_run`:case`flow_step`:case`agent_tool_call`:return`function`;case`external`:case`remote_proxy_call`:case`external_provider_call`:return`external`;case`worker`:case`runtime`:return`runtime`;default:return`runtime`}}function it(e){switch(e){case`pending`:case`processing`:case`running`:case`published`:case`completed`:case`failed`:case`dead`:return e;default:return`pending`}}function R(e,t=Re){return typeof e==`string`&&Number.isFinite(Date.parse(e))?e:t}function at(e){if(typeof e==`string`&&Number.isFinite(Date.parse(e)))return e}function ot(e,t){let n=Date.parse(e),r=Date.parse(t);return Number.isFinite(n)&&Number.isFinite(r)?Math.max(0,r-n):0}function st(e){return z(e,0)}function ct(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?Math.trunc(e):void 0}function z(e,t){return typeof e==`number`&&Number.isFinite(e)?Math.max(0,Math.trunc(e)):t}function lt(e){return typeof e==`number`&&Number.isFinite(e)?Math.max(0,Math.trunc(e)):void 0}function B(e,t){return typeof e==`string`&&e.trim().length>0?e:t}function ut(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.length>0):[]}function dt(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}var V={summary:[`runtime`,`summary`],events:[`runtime`,`events`],eventDetail:e=>[`runtime`,`events`,e,`detail`],functions:[`runtime`,`functions`],functionDetail:e=>[`runtime`,`functions`,e,`detail`],heatmap:[`runtime`,`heatmap`],storyHeatmap:e=>[`runtime`,`stories`,e,`heatmap`],technicalOperationsForStory:e=>[`runtime`,`stories`,e,`technical-operations`],technicalOperationsForExecution:e=>[`runtime`,`executions`,e,`technical-operations`],executionPayload:e=>[`runtime`,`executions`,e,`payload`],executionLogs:e=>[`runtime`,`executions`,e,`logs`],stories:[`runtime`,`stories`],deadLetters:[`runtime`,`dead-letters`],remoteProxyCalls:e=>[`runtime`,`remote-proxy-calls`,e],adminActionInvocations:e=>[`runtime`,`admin-actions`,e]};function ft(){return o({queryKey:V.summary,queryFn:async()=>M()?jt():Ot()})}function pt(){return o({queryKey:V.events,queryFn:async()=>M()?Mt():I})}function mt(e){return o({enabled:!!e?.id,queryKey:V.eventDetail(e?.id??`-`),queryFn:async()=>{if(!e)throw Error(`Outbox event detail query requires an event`);return M()?Nt(e.id,e):e}})}function ht(){return o({queryKey:V.functions,queryFn:async()=>M()?Pt():L})}function gt(e){return o({enabled:!!e?.id,queryKey:V.functionDetail(e?.id??`-`),queryFn:async()=>{if(!e)throw Error(`Function run detail query requires a run`);return M()?Ft(e.id,e):e}})}function _t(){return o({queryKey:V.heatmap,queryFn:async()=>M()?It():dn()})}function vt(e){return o({enabled:!!e.correlationId,queryKey:V.storyHeatmap(e.correlationId),queryFn:async()=>M()?Lt(e.correlationId):fn(e)})}function yt(){return o({queryKey:V.deadLetters,queryFn:async()=>{let[e,t]=M()?await Promise.all([Mt(),Pt()]):[I,L];return[...e.filter(e=>e.status===`failed`||e.status===`dead`).map(e=>({kind:`event`,item:e})),...t.filter(e=>e.status===`failed`||e.status===`dead`).map(e=>({kind:`function`,item:e}))]}})}function bt({enabled:e=!0}={}){return o({enabled:e,queryKey:V.stories,queryFn:async()=>M()?Rt():je})}function xt(e={}){return s({initialPageParam:e.createdBefore,queryKey:V.remoteProxyCalls(e),queryFn:async({pageParam:t})=>{let n={...e,...t?{createdBefore:t}:{}};return M()?zt(n):Vt(n)},getNextPageParam:e=>e.page.next_created_before??void 0})}function St(e={}){return s({initialPageParam:e.createdBefore,queryKey:V.adminActionInvocations(e),queryFn:async({pageParam:t})=>{let n={...e,...t?{createdBefore:t}:{}};return M()?Bt(n):Ht(Pe,n)},getNextPageParam:e=>e.page.next_created_before??void 0})}function Ct(e){return o({enabled:!!e,queryKey:V.technicalOperationsForStory(e),queryFn:async()=>M()?Gt(e):[]})}function wt(e){return o({enabled:!!e,queryKey:V.technicalOperationsForExecution(e),queryFn:async()=>M()?Kt(e):[]})}function Tt(e,t,n){return o({enabled:!!t&&n,queryKey:V.executionLogs(t),queryFn:async()=>M()?Jt(t):Zt(e,t)})}function Et(e,t,n){return o({enabled:!!t&&n,queryKey:V.executionPayload(t),queryFn:async()=>M()?qt(t):Xt(e,t)})}function Dt(){let e=r();return a({mutationFn:async e=>M()?(await Yt(e),{ok:!0}):(await new Promise(e=>window.setTimeout(e,320)),{ok:!0}),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:V.summary}),e.invalidateQueries({queryKey:V.events}),e.invalidateQueries({queryKey:V.functions}),e.invalidateQueries({queryKey:V.deadLetters})])}})}function Ot(){let e=[...I.map(e=>({type:`outbox_event`,id:e.id,name:e.eventName,status:e.status,attempts:e.attempts,maxAttempts:e.maxAttempts,correlationId:e.correlationId,createdAt:e.createdAt,...e.lastError?{lastError:e.lastError}:{}})),...L.map(e=>({type:`function_run`,id:e.id,name:e.functionName,status:e.status,attempts:e.attempts,maxAttempts:e.maxAttempts,correlationId:e.correlationId,createdAt:e.createdAt,...e.lastError?{lastError:e.lastError}:{}}))].sort((e,t)=>t.createdAt.localeCompare(e.createdAt)).slice(0,10),t=e.filter(e=>e.status===`failed`||e.status===`dead`),n=e.filter(e=>e.status===`dead`).length,r=e.filter(e=>e.status===`failed`).length;return{status:n>0?`failing`:r>0?`degraded`:`healthy`,outbox:{pending:I.filter(e=>e.status===`pending`).length,processing:I.filter(e=>e.status===`processing`).length,published:I.filter(e=>e.status===`published`).length,failed:I.filter(e=>e.status===`failed`).length,dead:I.filter(e=>e.status===`dead`).length,...kt(`oldestPendingAgeSeconds`,At(`outbox`))},functions:{pending:L.filter(e=>e.status===`pending`).length,running:L.filter(e=>e.status===`running`).length,completed:L.filter(e=>e.status===`completed`).length,failed:L.filter(e=>e.status===`failed`).length,dead:L.filter(e=>e.status===`dead`).length,...kt(`oldestPendingAgeSeconds`,At(`runtime.functions`))},recentActivity:e,recentFailures:t}}function kt(e,t){return t==null?{}:{[e]:t}}function At(e){let t=Me.find(t=>t.name===e);if(t){if(t.oldest.endsWith(`s`))return Number(t.oldest.replace(`s`,``));if(t.oldest.endsWith(`m`))return Number(t.oldest.replace(`m`,``))*60}}async function jt(){let e=await N.get(`admin/runtime/summary`).json();return{status:cn(e.status),outbox:{pending:e.outbox.pending,processing:e.outbox.processing,published:e.outbox.published,failed:e.outbox.failed,dead:e.outbox.dead,...kt(`oldestPendingAgeSeconds`,e.outbox.oldest_pending_age_seconds),...kt(`oldestFailedAgeSeconds`,e.outbox.oldest_failed_age_seconds)},functions:{pending:e.functions.pending,running:e.functions.running,completed:e.functions.completed,failed:e.functions.failed,dead:e.functions.dead,...kt(`oldestPendingAgeSeconds`,e.functions.oldest_pending_age_seconds),...kt(`oldestFailedAgeSeconds`,e.functions.oldest_failed_age_seconds)},recentActivity:e.recent_activity.map(Qt),recentFailures:e.recent_failures.map(Qt)}}async function Mt(){return(await N.get(`admin/runtime/outbox`).json()).data.map($t)}async function Nt(e,t){return en(await N.get(`admin/runtime/outbox/${encodeURIComponent(e)}`).json(),t)}async function Pt(){return(await N.get(`admin/runtime/functions`).json()).data.map(tn)}async function Ft(e,t){return nn(await N.get(`admin/runtime/functions/${encodeURIComponent(e)}`).json(),t)}async function It(){return He(await N.get(`admin/runtime/heatmap`).json())}async function Lt(e){return He(await N.get(`admin/runtime/stories/${encodeURIComponent(e)}/heatmap`).json())}async function Rt(){let{stories:e}=ze(await N.get(`admin/runtime/stories`).json());return await Promise.all(e.map(e=>Wt(e.correlationId).then(t=>mn(e,t)).catch(()=>e)))}async function zt(e){let t={},n=e.moduleName?.trim();n&&(t.module_name=n);let r=e.correlationId?.trim();return r&&(t.correlation_id=r),e.createdBefore&&(t.created_before=e.createdBefore),e.success!==void 0&&(t.success=String(e.success)),e.limit!==void 0&&(t.limit=String(e.limit)),await N.get(`admin/runtime/remote-proxy-calls`,{searchParams:t}).json()}async function Bt(e){let t={},n=e.moduleName?.trim();n&&(t.module_name=n);let r=e.actionName?.trim();r&&(t.action_name=r);let i=e.capability?.trim();i&&(t.capability=i);let a=e.correlationId?.trim();return a&&(t.correlation_id=a),e.createdBefore&&(t.created_before=e.createdBefore),e.success!==void 0&&(t.success=String(e.success)),e.limit!==void 0&&(t.limit=String(e.limit)),await N.get(`admin/runtime/admin-actions`,{searchParams:t}).json()}function Vt(e){return Ut(Ne,e)}function Ht(e,t){let n=t.moduleName?.trim().toLowerCase(),r=t.actionName?.trim().toLowerCase(),i=t.capability?.trim(),a=t.correlationId?.trim(),o=t.limit??100,s=e.filter(e=>n?e.module_name.toLowerCase()===n:!0).filter(e=>r?e.action_name.toLowerCase()===r:!0).filter(e=>i?e.capability===i:!0).filter(e=>a?e.correlation_id===a:!0).filter(e=>t.success===void 0?!0:e.success===t.success).filter(e=>t.createdBefore?e.occurred_at<t.createdBefore:!0).sort((e,t)=>t.occurred_at.localeCompare(e.occurred_at));return{data:s.slice(0,o),page:{limit:o,next_created_before:s.length>o?s.at(o-1)?.occurred_at??null:null}}}function Ut(e,t){let n=t.moduleName?.trim().toLowerCase(),r=t.correlationId?.trim(),i=t.limit??100,a=e.filter(e=>n?e.module_name.toLowerCase()===n:!0).filter(e=>r?e.correlation_id===r:!0).filter(e=>t.success===void 0?!0:e.success===t.success).filter(e=>t.createdBefore?e.occurred_at<t.createdBefore:!0).sort((e,t)=>t.occurred_at.localeCompare(e.occurred_at)),o=a.slice(0,i);return{data:o,page:{limit:i,next_created_before:a.length>i?o.at(-1)?.occurred_at??null:null}}}async function Wt(e){let t=await N.get(`admin/runtime/stories/${encodeURIComponent(e)}`).json();if(!t.data)throw Error(`Runtime story detail response did not include data`);return Ve(t.data)}async function Gt(e){return Ue(await N.get(`admin/runtime/stories/${encodeURIComponent(e)}/technical-operations`).json())}async function Kt(e){return Ue(await N.get(`admin/runtime/executions/${encodeURIComponent(e)}/technical-operations`).json())}async function qt(e){return We(await N.get(`admin/runtime/executions/${encodeURIComponent(e)}/payload`).json())}async function Jt(e){return Ge(await N.get(`admin/runtime/executions/${encodeURIComponent(e)}/logs`).json())}async function Yt(e){let t=e.kind===`function`?`admin/runtime/functions/${encodeURIComponent(e.id)}/retry`:`admin/runtime/outbox/${encodeURIComponent(e.id)}/retry`;await N.post(t).json()}function Xt(e,t){let n=e.nodes.find(e=>e.id===t);return{input:n?.payload,metadata:n?.attributes,output:void 0,redactedFields:[]}}function Zt(e,t){let n=e.nodes.find(e=>e.id===t);return n?n.logs.map((t,r)=>({attributes:{},body:t,correlationId:e.correlationId,executionName:n.name,id:`${n.id}:log:${r+1}`,nodeId:n.id,nodeType:n.kind,occurredAt:new Date(Date.parse(e.timestamp)+n.startMs+r*12).toISOString(),redactedFields:[],serviceName:n.service,severity:n.status===`failed`||n.status===`dead`?`error`:`info`,storyId:e.id})):[]}function Qt(e){return{type:ln(e.type),id:e.id,name:e.name,status:un(e.status),attempts:e.attempts,maxAttempts:e.max_attempts,correlationId:e.correlation_id??`-`,createdAt:e.created_at,...e.last_error?{lastError:e.last_error}:{}}}function $t(e){return{id:e.id,eventName:e.event_name,status:un(e.status),attempts:e.attempts,maxAttempts:e.max_attempts,aggregateId:`-`,aggregateType:`-`,correlationId:e.correlation_id,causationId:`-`,createdAt:e.created_at,...e.published_at?{publishedAt:e.published_at}:{},...e.last_error?{lastError:e.last_error}:{},actor:hn(void 0),payload:{}}}function en(e,t){return{id:e.id,eventName:e.event_name,eventVersion:e.event_version,status:un(e.status),attempts:e.attempts,maxAttempts:e.max_attempts,aggregateId:e.aggregate_id,aggregateType:e.aggregate_type,correlationId:e.correlation_id,causationId:e.causation_id??t?.causationId??`-`,createdAt:e.created_at,occurredAt:e.occurred_at,...e.locked_by?{lockedBy:e.locked_by}:{},...e.published_at?{publishedAt:e.published_at}:{},...e.last_error?{lastError:e.last_error}:{},sourceModule:e.source_module,actor:hn(e.actor),headers:on(e.headers),payload:on(e.payload),trace:on(e.trace)}}function tn(e){return{...rn(e),actor:hn(void 0),input:{},logs:e.last_error?[e.last_error]:[]}}function nn(e,t){return{...rn(e),actor:hn(e.actor),input:on(e.input_json),...t?.output?{output:t.output}:{},logs:e.last_error?[e.last_error]:t?.logs??[]}}function rn(e){let t=an(e.runtime_declaration);return{id:e.id,functionName:e.function_name,...t?{runtimeDeclaration:t}:{},status:un(e.status),attempts:e.attempts,maxAttempts:e.max_attempts,correlationId:e.correlation_id,createdAt:e.created_at,...e.started_at?{startedAt:e.started_at}:{},...e.completed_at?{completedAt:e.completed_at}:{},...e.locked_by?{lockedBy:e.locked_by}:{},...e.last_error?{lastError:e.last_error}:{}}}function an(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;if(typeof t.module_name!=`string`||typeof t.module_source!=`string`||typeof t.name!=`string`||typeof t.version!=`number`||typeof t.queue!=`string`)return;let n=sn(t.retry_policy);return{moduleName:t.module_name,moduleSource:t.module_source,name:t.name,version:t.version,queue:t.queue,...typeof t.input_schema==`string`?{inputSchema:t.input_schema}:{},...n?{retryPolicy:n}:{}}}function on(e){return e?typeof e==`object`&&!Array.isArray(e)?e:{value:e}:{}}function sn(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;return typeof t.max_attempts==`number`&&typeof t.initial_delay_ms==`number`?{maxAttempts:t.max_attempts,initialDelayMs:t.initial_delay_ms}:void 0}function cn(e){return e===`healthy`||e===`degraded`||e===`failing`?e:`degraded`}function ln(e){return e===`function_run`?`function_run`:e===`http`||e===`http_request`?`http_request`:`outbox_event`}function un(e){switch(e){case`pending`:case`processing`:case`running`:case`published`:case`completed`:case`failed`:case`dead`:return e;default:return`pending`}}function dn(){return{bucketSeconds:300,cells:je.flatMap(e=>pn(e,300))}}function fn(e){return{bucketSeconds:300,cells:pn(e,300)}}function pn(e,t){let n=Date.parse(e.timestamp),r=t*1e3,i=new Map;for(let t of e.nodes){if(!(t.kind===`event`||t.kind===`function`||t.kind===`http`))continue;let e=Number.isFinite(n)?n+t.startMs:Date.now(),a=Math.floor(e/r)*r,o=a+r,s=t.kind===`event`?`event`:t.kind===`http`?`http`:`function`,c=`${a}:${t.service}:${s}`,l=i.get(c);if(l){l.deadCount+=+(t.status===`dead`),l.durationTotalMs+=t.durationMs,l.errorCount+=+(t.status===`failed`||t.status===`dead`),l.maxDurationMs=Math.max(l.maxDurationMs??0,t.durationMs),l.totalCount+=1,l.avgDurationMs=Math.round(l.durationTotalMs/l.totalCount);continue}i.set(c,{avgDurationMs:t.durationMs,bucketEnd:new Date(o).toISOString(),bucketStart:new Date(a).toISOString(),deadCount:+(t.status===`dead`),durationTotalMs:t.durationMs,errorCount:+(t.status===`failed`||t.status===`dead`),maxDurationMs:t.durationMs,nodeType:s,service:t.service,totalCount:1})}return[...i.values()].sort((e,t)=>t.bucketStart.localeCompare(e.bucketStart)||e.service.localeCompare(t.service)||e.nodeType.localeCompare(t.nodeType)).map(({durationTotalMs:e,...t})=>t)}function mn(e,t){return{...t,name:t.name||e.name}}function hn(e){if(!e||typeof e!=`object`||!(`kind`in e))return{kind:`system`};let t=e;if(t.kind===`anonymous`||t.kind===`system`)return{kind:t.kind};if(t.kind===`user`||t.kind===`service`){let e=typeof t.id==`string`?t.id:t.kind===`user`&&typeof t.user_id==`string`?t.user_id:t.kind===`service`&&typeof t.service_id==`string`?t.service_id:`-`;return{kind:t.kind,id:e,scopes:Array.isArray(t.scopes)?t.scopes:[]}}return{kind:`system`}}function gn(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=gn(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function _n(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=gn(e))&&(r&&(r+=` `),r+=t);return r}var vn=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},yn=(e,t)=>({classGroupId:e,validator:t}),bn=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),xn=`-`,Sn=[],Cn=`arbitrary..`,wn=e=>{let t=Dn(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return En(e);let n=e.split(xn);return Tn(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?vn(i,t):t:i||Sn}return n[e]||Sn}}},Tn=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Tn(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(xn):e.slice(t).join(xn),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},En=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Cn+r:void 0})(),Dn=e=>{let{theme:t,classGroups:n}=e;return On(n,t)},On=(e,t)=>{let n=bn();for(let r in e){let i=e[r];kn(i,n,r,t)}return n},kn=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];An(i,t,n,r)}},An=(e,t,n,r)=>{if(typeof e==`string`){jn(e,t,n);return}if(typeof e==`function`){Mn(e,t,n,r);return}Nn(e,t,n,r)},jn=(e,t,n)=>{let r=e===``?t:Pn(t,e);r.classGroupId=n},Mn=(e,t,n,r)=>{if(Fn(e)){kn(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(yn(n,e))},Nn=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];kn(o,Pn(t,a),n,r)}},Pn=(e,t)=>{let n=e,r=t.split(xn),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=bn(),n.nextPart.set(t,i)),n=i}return n},Fn=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,In=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ln=`!`,Rn=`:`,zn=[],Bn=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Vn=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===Rn){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Ln)?(c=s.slice(0,-1),l=!0):s.startsWith(Ln)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Bn(t,l,c,u)};if(t){let e=t+Rn,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Bn(zn,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Hn=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Un=e=>({cache:In(e.cacheSize),parseClassName:Vn(e),sortModifiers:Hn(e),postfixLookupClassGroupIds:Wn(e),...wn(e)}),Wn=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},Gn=/\s+/,Kn=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Gn),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let ee=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),_=f?ee+Ln:ee,v=_+g;if(s.indexOf(v)>-1)continue;s.push(v);let y=i(g,h);for(let e=0;e<y.length;++e){let t=y[e];s.push(_+t)}l=t+(l.length>0?` `+l:l)}return l},qn=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Jn(n))&&(i&&(i+=` `),i+=r);return i},Jn=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Jn(e[r]))&&(n&&(n+=` `),n+=t);return n},Yn=(e,...t)=>{let n,r,i,a,o=o=>(n=Un(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Kn(e,n);return i(e,a),a};return a=o,(...e)=>a(qn(...e))},Xn=[],H=e=>{let t=t=>t[e]||Xn;return t.isThemeGetter=!0,t},Zn=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Qn=/^\((?:(\w[\w-]*):)?(.+)\)$/i,$n=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,er=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,tr=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,nr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,rr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ir=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ar=e=>$n.test(e),U=e=>!!e&&!Number.isNaN(Number(e)),W=e=>!!e&&Number.isInteger(Number(e)),or=e=>e.endsWith(`%`)&&U(e.slice(0,-1)),G=e=>er.test(e),sr=()=>!0,cr=e=>tr.test(e)&&!nr.test(e),lr=()=>!1,ur=e=>rr.test(e),dr=e=>ir.test(e),fr=e=>!K(e)&&!q(e),pr=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),mr=e=>kr(e,Nr,lr),K=e=>Zn.test(e),hr=e=>kr(e,Pr,cr),gr=e=>kr(e,Fr,U),_r=e=>kr(e,Lr,sr),vr=e=>kr(e,Ir,lr),yr=e=>kr(e,jr,lr),br=e=>kr(e,Mr,dr),xr=e=>kr(e,Rr,ur),q=e=>Qn.test(e),Sr=e=>Ar(e,Pr),Cr=e=>Ar(e,Ir),wr=e=>Ar(e,jr),Tr=e=>Ar(e,Nr),Er=e=>Ar(e,Mr),Dr=e=>Ar(e,Rr,!0),Or=e=>Ar(e,Lr,!0),kr=(e,t,n)=>{let r=Zn.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Ar=(e,t,n=!1)=>{let r=Qn.exec(e);return r?r[1]?t(r[1]):n:!1},jr=e=>e===`position`||e===`percentage`,Mr=e=>e===`image`||e===`url`,Nr=e=>e===`length`||e===`size`||e===`bg-size`,Pr=e=>e===`length`,Fr=e=>e===`number`,Ir=e=>e===`family-name`,Lr=e=>e===`number`||e===`weight`,Rr=e=>e===`shadow`,zr=Yn(()=>{let e=H(`color`),t=H(`font`),n=H(`text`),r=H(`font-weight`),i=H(`tracking`),a=H(`leading`),o=H(`breakpoint`),s=H(`container`),c=H(`spacing`),l=H(`radius`),u=H(`shadow`),d=H(`inset-shadow`),f=H(`text-shadow`),p=H(`drop-shadow`),m=H(`blur`),h=H(`perspective`),g=H(`aspect`),ee=H(`ease`),_=H(`animate`),v=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],y=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],b=()=>[...y(),q,K],te=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],ne=()=>[`auto`,`contain`,`none`],x=()=>[q,K,c],S=()=>[ar,`full`,`auto`,...x()],re=()=>[W,`none`,`subgrid`,q,K],ie=()=>[`auto`,{span:[`full`,W,q,K]},W,q,K],C=()=>[W,`auto`,q,K],ae=()=>[`auto`,`min`,`max`,`fr`,q,K],oe=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],w=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],T=()=>[`auto`,...x()],E=()=>[ar,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...x()],se=()=>[ar,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...x()],ce=()=>[ar,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...x()],D=()=>[e,q,K],le=()=>[...y(),wr,yr,{position:[q,K]}],ue=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],de=()=>[`auto`,`cover`,`contain`,Tr,mr,{size:[q,K]}],fe=()=>[or,Sr,hr],O=()=>[``,`none`,`full`,l,q,K],k=()=>[``,U,Sr,hr],pe=()=>[`solid`,`dashed`,`dotted`,`double`],me=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],A=()=>[U,or,wr,yr],he=()=>[``,`none`,m,q,K],ge=()=>[`none`,U,q,K],_e=()=>[`none`,U,q,K],j=()=>[U,q,K],ve=()=>[ar,`full`,...x()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[G],breakpoint:[G],color:[sr],container:[G],"drop-shadow":[G],ease:[`in`,`out`,`in-out`],font:[fr],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[G],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[G],shadow:[G],spacing:[`px`,U],text:[G],"text-shadow":[G],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,ar,K,q,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,q,K]}],"container-named":[pr],columns:[{columns:[U,K,q,s]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:b()}],overflow:[{overflow:te()}],"overflow-x":[{"overflow-x":te()}],"overflow-y":[{"overflow-y":te()}],overscroll:[{overscroll:ne()}],"overscroll-x":[{"overscroll-x":ne()}],"overscroll-y":[{"overscroll-y":ne()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:S()}],"inset-x":[{"inset-x":S()}],"inset-y":[{"inset-y":S()}],start:[{"inset-s":S(),start:S()}],end:[{"inset-e":S(),end:S()}],"inset-bs":[{"inset-bs":S()}],"inset-be":[{"inset-be":S()}],top:[{top:S()}],right:[{right:S()}],bottom:[{bottom:S()}],left:[{left:S()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[W,`auto`,q,K]}],basis:[{basis:[ar,`full`,`auto`,s,...x()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[U,ar,`auto`,`initial`,`none`,K]}],grow:[{grow:[``,U,q,K]}],shrink:[{shrink:[``,U,q,K]}],order:[{order:[W,`first`,`last`,`none`,q,K]}],"grid-cols":[{"grid-cols":re()}],"col-start-end":[{col:ie()}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":re()}],"row-start-end":[{row:ie()}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ae()}],"auto-rows":[{"auto-rows":ae()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:[...oe(),`normal`]}],"justify-items":[{"justify-items":[...w(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...w()]}],"align-content":[{content:[`normal`,...oe()]}],"align-items":[{items:[...w(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...w(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":oe()}],"place-items":[{"place-items":[...w(),`baseline`]}],"place-self":[{"place-self":[`auto`,...w()]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pbs:[{pbs:x()}],pbe:[{pbe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:T()}],mx:[{mx:T()}],my:[{my:T()}],ms:[{ms:T()}],me:[{me:T()}],mbs:[{mbs:T()}],mbe:[{mbe:T()}],mt:[{mt:T()}],mr:[{mr:T()}],mb:[{mb:T()}],ml:[{ml:T()}],"space-x":[{"space-x":x()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":x()}],"space-y-reverse":[`space-y-reverse`],size:[{size:E()}],"inline-size":[{inline:[`auto`,...se()]}],"min-inline-size":[{"min-inline":[`auto`,...se()]}],"max-inline-size":[{"max-inline":[`none`,...se()]}],"block-size":[{block:[`auto`,...ce()]}],"min-block-size":[{"min-block":[`auto`,...ce()]}],"max-block-size":[{"max-block":[`none`,...ce()]}],w:[{w:[s,`screen`,...E()]}],"min-w":[{"min-w":[s,`screen`,`none`,...E()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...E()]}],h:[{h:[`screen`,`lh`,...E()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...E()]}],"max-h":[{"max-h":[`screen`,`lh`,...E()]}],"font-size":[{text:[`base`,n,Sr,hr]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Or,_r]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,or,K]}],"font-family":[{font:[Cr,vr,t]}],"font-features":[{"font-features":[K]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,q,K]}],"line-clamp":[{"line-clamp":[U,`none`,q,gr]}],leading:[{leading:[a,...x()]}],"list-image":[{"list-image":[`none`,q,K]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,q,K]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...pe(),`wavy`]}],"text-decoration-thickness":[{decoration:[U,`from-font`,`auto`,q,hr]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[U,`auto`,q,K]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:x()}],"tab-size":[{tab:[W,q,K]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,q,K]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,q,K]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:le()}],"bg-repeat":[{bg:ue()}],"bg-size":[{bg:de()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},W,q,K],radial:[``,q,K],conic:[W,q,K]},Er,br]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:fe()}],"gradient-via-pos":[{via:fe()}],"gradient-to-pos":[{to:fe()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:O()}],"rounded-s":[{"rounded-s":O()}],"rounded-e":[{"rounded-e":O()}],"rounded-t":[{"rounded-t":O()}],"rounded-r":[{"rounded-r":O()}],"rounded-b":[{"rounded-b":O()}],"rounded-l":[{"rounded-l":O()}],"rounded-ss":[{"rounded-ss":O()}],"rounded-se":[{"rounded-se":O()}],"rounded-ee":[{"rounded-ee":O()}],"rounded-es":[{"rounded-es":O()}],"rounded-tl":[{"rounded-tl":O()}],"rounded-tr":[{"rounded-tr":O()}],"rounded-br":[{"rounded-br":O()}],"rounded-bl":[{"rounded-bl":O()}],"border-w":[{border:k()}],"border-w-x":[{"border-x":k()}],"border-w-y":[{"border-y":k()}],"border-w-s":[{"border-s":k()}],"border-w-e":[{"border-e":k()}],"border-w-bs":[{"border-bs":k()}],"border-w-be":[{"border-be":k()}],"border-w-t":[{"border-t":k()}],"border-w-r":[{"border-r":k()}],"border-w-b":[{"border-b":k()}],"border-w-l":[{"border-l":k()}],"divide-x":[{"divide-x":k()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":k()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...pe(),`hidden`,`none`]}],"divide-style":[{divide:[...pe(),`hidden`,`none`]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...pe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[U,q,K]}],"outline-w":[{outline:[``,U,Sr,hr]}],"outline-color":[{outline:D()}],shadow:[{shadow:[``,`none`,u,Dr,xr]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":[`none`,d,Dr,xr]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:k()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[U,hr]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":k()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":[`none`,f,Dr,xr]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[U,q,K]}],"mix-blend":[{"mix-blend":[...me(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":me()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[U]}],"mask-image-linear-from-pos":[{"mask-linear-from":A()}],"mask-image-linear-to-pos":[{"mask-linear-to":A()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":A()}],"mask-image-t-to-pos":[{"mask-t-to":A()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":A()}],"mask-image-r-to-pos":[{"mask-r-to":A()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":A()}],"mask-image-b-to-pos":[{"mask-b-to":A()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":A()}],"mask-image-l-to-pos":[{"mask-l-to":A()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":A()}],"mask-image-x-to-pos":[{"mask-x-to":A()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":A()}],"mask-image-y-to-pos":[{"mask-y-to":A()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[q,K]}],"mask-image-radial-from-pos":[{"mask-radial-from":A()}],"mask-image-radial-to-pos":[{"mask-radial-to":A()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":y()}],"mask-image-conic-pos":[{"mask-conic":[U]}],"mask-image-conic-from-pos":[{"mask-conic-from":A()}],"mask-image-conic-to-pos":[{"mask-conic-to":A()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:le()}],"mask-repeat":[{mask:ue()}],"mask-size":[{mask:de()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,q,K]}],filter:[{filter:[``,`none`,q,K]}],blur:[{blur:he()}],brightness:[{brightness:[U,q,K]}],contrast:[{contrast:[U,q,K]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Dr,xr]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:[``,U,q,K]}],"hue-rotate":[{"hue-rotate":[U,q,K]}],invert:[{invert:[``,U,q,K]}],saturate:[{saturate:[U,q,K]}],sepia:[{sepia:[``,U,q,K]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,q,K]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[U,q,K]}],"backdrop-contrast":[{"backdrop-contrast":[U,q,K]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,U,q,K]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[U,q,K]}],"backdrop-invert":[{"backdrop-invert":[``,U,q,K]}],"backdrop-opacity":[{"backdrop-opacity":[U,q,K]}],"backdrop-saturate":[{"backdrop-saturate":[U,q,K]}],"backdrop-sepia":[{"backdrop-sepia":[``,U,q,K]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,q,K]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[U,`initial`,q,K]}],ease:[{ease:[`linear`,`initial`,ee,q,K]}],delay:[{delay:[U,q,K]}],animate:[{animate:[`none`,_,q,K]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,q,K]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:_e()}],"scale-x":[{"scale-x":_e()}],"scale-y":[{"scale-y":_e()}],"scale-z":[{"scale-z":_e()}],"scale-3d":[`scale-3d`],skew:[{skew:j()}],"skew-x":[{"skew-x":j()}],"skew-y":[{"skew-y":j()}],transform:[{transform:[q,K,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":[`translate-none`],zoom:[{zoom:[W,q,K]}],accent:[{accent:D()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:D()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,q,K]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":D()}],"scrollbar-track-color":[{"scrollbar-track":D()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mbs":[{"scroll-mbs":x()}],"scroll-mbe":[{"scroll-mbe":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pbs":[{"scroll-pbs":x()}],"scroll-pbe":[{"scroll-pbe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,q,K]}],fill:[{fill:[`none`,...D()]}],"stroke-w":[{stroke:[U,Sr,hr,gr]}],stroke:[{stroke:[`none`,...D()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function J(...e){return zr(_n(e))}var Br=[`#737373`,`#525252`,`#8a8a8a`,`#6b7280`,`#4b5563`,`#71717a`,`#3f3f46`,`#a1a1aa`];function Y(e){return e<1?`${Math.round(e*1e3)}us`:e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(2)}s`}function Vr(e){return e===`failed`||e===`dead`?`var(--error)`:e===`pending`||e===`processing`||e===`running`?`var(--warning)`:`var(--success)`}function X(e){return Br[[...e].reduce((e,t)=>e+(t.codePointAt(0)??0),0)%Br.length]}function Hr(e){let t=Math.max(0,...e.nodes.map(e=>e.startMs+e.durationMs));return Math.max(e.durationMs,t,1)}function Ur({durationMs:e,minWidthPercent:t,startMs:n,timelineEnd:r}){let i=Wr(n/r*100),a=e/r*100,o=Math.max(0,100-i);return{left:i,width:Math.min(Math.max(a,t),o)}}function Wr(e){return Math.min(100,Math.max(0,e))}var Gr=[{id:`overview`,label:`Overview`},{id:`payload`,label:`Payload`},{id:`activity`,label:`Activity`},{id:`logs`,label:`Logs`},{id:`failures`,label:`Failures`},{id:`context`,label:`Context`},{id:`technical`,label:`Technical`}];function Kr(e){let t=e.payload,n=ri(t)?t:void 0,r=ti(n,[`input`,`input_json`,`inputJson`,`request`,`request_json`,`requestJson`,`request_payload`,`requestPayload`,`payload`]),i=ti(n,[`output`,`output_json`,`outputJson`,`response`,`response_json`,`responseJson`,`response_payload`,`responsePayload`]),a=ti(n,[`metadata`,`meta`,`headers`]);return{input:r??(n&&!(r!==void 0||i!==void 0)?n:void 0),metadata:a??(n&&Object.keys(e.attributes).length>0?e.attributes:void 0),output:i}}function qr(e){return e.status===`failed`||e.status===`dead`?`failures`:ei(e)?`payload`:`overview`}function Jr(e,t){let n=e.timelineItems?.filter(e=>e.detailId===t.id||e.id===t.id).map(t=>({id:t.id,kind:t.type,label:t.name,status:t.status,timestampMs:di(e.timestamp,t.startedAt??t.createdAt),...t.attempts>1?{detail:`attempt ${t.attempts}/${t.maxAttempts}`}:{}}))??[],r=t.events.map(e=>({id:`${t.id}:${e.name}:${e.timestampMs}`,kind:`event`,label:e.name,status:t.status,timestampMs:e.timestampMs,...e.attributes?{detail:JSON.stringify(e.attributes)}:{}}));return[...n,...r].sort((e,t)=>e.timestampMs-t.timestampMs||e.label.localeCompare(t.label))}function Yr(e){let t=e.status===`failed`||e.status===`dead`;if(!t)return[];let n=e.logs.at(-1),r=[];return t&&r.push({id:`current-error`,label:`current error`,value:n??`${e.status} execution`}),n&&r.push({id:`last-error`,label:`last error`,value:n}),((e.attempts??1)>1||e.retryable)&&r.push({id:`retry-history`,label:`retry history`,value:`${e.attempts??1}/${e.maxAttempts??1} attempts`}),r}function Xr(e){let t=ii(e.attributes.source_metadata);if(!ai(t))return;let n=[oi(t.method),oi(t.declared_path)].filter(e=>e!==void 0).join(` `),r=si(t.remote_status),i=ci(t.retryable),a=si(t.duration_ms)??e.durationMs,o=[[`result`,li(e.status,i)],[`module`,oi(t.module_name)??e.service],[`declared route`,n||`-`],[`remote path`,oi(t.remote_path)??`-`],[`remote status`,r??`-`],[`duration`,Y(a)],[`request id`,oi(t.request_id)??`-`],[`trace id`,oi(t.trace_id)??`-`],[`span id`,oi(t.span_id)??`-`],[`error code`,oi(t.error_code)??`-`],[`retryability`,i?`retryable`:`not retryable`]];return{...t.error_details===void 0?{}:{errorDetails:t.error_details},...t.path_params===void 0?{}:{pathParams:t.path_params},rows:o}}function Zr(e,t){let n=ui(e,t,`upstream`),r=ui(e,t,`downstream`),i=typeof t.context.causation_id==`string`?t.context.causation_id:t.parentId,a=t.context.actor??n.find(e=>e.context.actor)?.context.actor??e.service,o=t.attributes.aggregate_id??t.attributes.aggregateId??t.payload?.aggregate_id??t.payload?.aggregateId,s=t.context.trigger_source??t.attributes.trigger_source??t.attributes.triggerSource??t.kind;return{downstream:r,rows:[[`correlation id`,e.correlationId],[`causation id`,i??`-`],[`actor`,a??`-`],[`aggregate`,o??`-`],[`trigger source`,s??`-`],[`related executions`,n.length+r.length]],upstream:n}}function Qr(e,t){return{activity:Jr(e,t).length,context:ui(e,t,`upstream`).length+ui(e,t,`downstream`).length,failures:Yr(t).length,logs:t.logs.length,overview:0,payload:$r(t),technical:0}}function $r(e){let t=Kr(e);return[t.input,t.metadata,t.output].filter(e=>ni(e)).length}function ei(e){let t=Kr(e);return ni(t.input)||ni(t.output)}function ti(e,t){if(e){for(let n of t)if(e[n]!==void 0)return e[n]}}function ni(e){return e==null?!1:Array.isArray(e)?e.length>0:ri(e)?Object.keys(e).length>0:!0}function ri(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function ii(e){return ri(e)?e:{}}function ai(e){return typeof e.remote_proxy_call_id==`string`?!0:typeof e.module_name==`string`&&typeof e.method==`string`&&typeof e.declared_path==`string`}function oi(e){return typeof e==`string`&&e.length>0?e:void 0}function si(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function ci(e){return typeof e==`boolean`?e:!1}function li(e,t){return e===`failed`||e===`dead`?t?`retryable failure`:`failed`:e===`completed`||e===`published`?`ok`:e}function ui(e,t,n){let r=(e.edges??[]).filter(e=>n===`upstream`?e.target===t.id:e.source===t.id).map(e=>n===`upstream`?e.source:e.target),i=n===`upstream`?t.parentId:void 0,a=n===`downstream`?e.nodes.filter(e=>e.parentId===t.id).map(e=>e.id):[],o=new Set([...r,...i?[i]:[],...a]);return e.nodes.filter(e=>o.has(e.id))}function di(e,t){let n=Date.parse(e),r=Date.parse(t);return Number.isFinite(n)&&Number.isFinite(r)?Math.max(0,r-n):0}function fi({children:e,className:t,contentClassName:n,viewportClassName:r}){return(0,F.jsx)(me,{className:J(`relative min-w-0`,t),overflowEdgeThreshold:1,children:(0,F.jsx)(se,{className:J(`scrollbar-none min-w-0 overflow-x-auto overflow-y-hidden`,r),onWheel:mi,children:(0,F.jsx)(x,{className:J(`w-max min-w-full`,n),children:e})})})}function pi({children:e}){return(0,F.jsx)(fi,{className:`h-8`,contentClassName:`h-full`,viewportClassName:`h-full`,children:e})}function mi(e){let t=e.currentTarget,n=t.scrollWidth-t.clientWidth;if(n<=0)return;let r=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.deltaY;if(r===0)return;let i=Math.max(0,Math.min(n,t.scrollLeft+r));i!==t.scrollLeft&&(e.preventDefault(),t.scrollLeft=i)}var hi=new Intl.DateTimeFormat(`en`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1});function gi(e){return e?hi.format(new Date(e)):`—`}function _i(e){let t=Math.max(0,Date.now()-new Date(e).getTime()),n=Math.floor(t/6e4);return n<1?`now`:n<60?`${n}m ago`:`${Math.floor(n/60)}h ago`}function vi(e){switch(e.kind){case`anonymous`:return`anonymous`;case`user`:return`user:${e.id}`;case`service`:return`service:${e.id}`;case`system`:return`system`;default:return`unknown`}}function yi(e){return JSON.stringify(e,null,2)}function bi({title:e,value:t,defaultExpanded:n=!1}){let[r,i]=(0,P.useState)(n),a=yi(t).split(`
`);return(0,F.jsxs)(`section`,{className:`overflow-hidden border-b border-(--line) bg-(--bg-panel)`,children:[(0,F.jsxs)(`button`,{className:`flex w-full items-center gap-2 border-b border-(--line) bg-(--bg-panel-header) px-4 py-2 text-left font-mono text-xs font-semibold text-(--fg-tertiary) hover:bg-(--bg-control-hover)`,onClick:()=>i(e=>!e),type:`button`,children:[r?(0,F.jsx)(A,{size:14}):(0,F.jsx)(ce,{size:14}),(0,F.jsx)(`span`,{children:e}),(0,F.jsxs)(`span`,{className:`mono ml-auto text-[11px] text-(--fg-tertiary)`,children:[a.length,` lines`]})]}),r?(0,F.jsx)(`div`,{className:`overflow-auto bg-(--bg-panel) py-2 font-mono text-xs leading-5`,children:a.map((e,t)=>(0,F.jsxs)(`div`,{className:`grid grid-cols-[36px_minmax(0,1fr)]`,children:[(0,F.jsx)(`span`,{className:`select-none border-r border-(--line) pr-2 text-right text-(--fg-quaternary)`,children:t+1}),(0,F.jsx)(`code`,{className:`whitespace-pre px-3 text-(--fg-secondary)`,children:e||` `})]},t))}):null]})}function xi({apiMode:e,data:t,fallback:n,isError:r}){return t||(e&&!r?[]:n)}function Si(){return typeof window>`u`?``:`${window.location.pathname}${window.location.search}`}function Ci(e,t=`/console/`){let n=t.replace(/\/+$/,``);return!n||n===`/`||!e.startsWith(`/`)||e.startsWith(`//`)||e===n||e.startsWith(`${n}/`)?e:`${n}${e}`}function wi(e,t=`replace`){let n=Ci(e);if(!(typeof window>`u`||Si()===n)){if(t===`push`){window.history.pushState(null,``,n);return}window.history.replaceState(null,``,n)}}function Ti(e){(0,P.useEffect)(()=>{if(typeof window>`u`)return;let t=()=>{e(new URLSearchParams(window.location.search))};return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)},[e])}function Ei(e,t){let n=new URLSearchParams;for(let[e,r]of Object.entries(t))r==null||r===``||n.set(e,String(r));let r=n.toString();return r?`${e}?${r}`:e}function Di(){return typeof window>`u`?new URLSearchParams:new URLSearchParams(window.location.search)}function Oi(e){return Di().get(e)??``}function ki(e){wi(e,`replace`)}function Ai(e){wi(e,`push`)}function ji(e={}){return Ei(`/operations/functions`,{module:e.moduleName,q:e.query,queue:e.queue,selected:e.selectedId,status:e.status===`all`?void 0:e.status})}function Mi(e={}){return Ei(`/operations/dead-letters`,{kind:e.kind===`all`?void 0:e.kind,order:e.oldestFirst===void 0?void 0:e.oldestFirst?`oldest`:`newest`,q:e.query,selected:e.selectedId})}function Ni(e={}){return Ei(`/operations/queues`,{q:e.query,selected:e.selectedId})}function Pi(e={}){return Ei(`/operations/admin-actions`,{action:e.actionName,capability:e.capability,correlation_id:e.correlationId,module:e.moduleName,q:e.query,result:e.result===`all`?void 0:e.result,selected:e.selectedId})}function Fi(e,t=5){return[...e].sort((e,t)=>t.occurred_at.localeCompare(e.occurred_at)).slice(0,t).map(e=>({actionName:e.action_name,correlationId:e.correlation_id,durationLabel:`${e.duration_ms}ms`,key:e.id,label:e.label,occurredAt:e.occurred_at,operationsPath:Pi({actionName:e.action_name,...e.capability?{capability:e.capability}:{},correlationId:e.correlation_id,moduleName:e.module_name,selectedId:e.id}),requestId:e.request_id??`-`,result:Vi(e),success:e.success,summary:Hi(e)}))}function Ii(e){return e?.flatMap(e=>e.data)??[]}function Li(e){return e?.at(-1)?.page.next_created_before??null}function Ri(e,t){let n=t.query.trim().toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>t.result===`success`?e.success:t.result===`failed`?!e.success:!0).filter(e=>{if(n.length===0)return!0;let t=[e.id,e.module_name,e.action_name,e.label,e.capability??``,e.request_id??``,e.correlation_id,e.trace_id??``,e.error_code??``,e.input_summary??``,e.result_summary??``].join(` `).toLowerCase();return n.every(e=>t.includes(e))}).sort((e,t)=>t.occurred_at.localeCompare(e.occurred_at))}function zi(e){let t=e.reduce((e,t)=>e+t.duration_ms,0),n=e.filter(e=>!e.success).length;return{avgDurationMs:e.length===0?0:Math.round(t/e.length),failed:n,success:e.length-n,total:e.length}}function Bi(e,t,n=5){let r=new Map;for(let n of e){let e=Wi(n,t);r.set(e,[...r.get(e)??[],n])}return Array.from(r.entries()).map(([e,t])=>{let n=t.filter(e=>!e.success).length;return{failed:n,failureRate:t.length===0?0:n/t.length,key:e,total:t.length}}).sort((e,t)=>t.failed-e.failed||t.total-e.total||e.key.localeCompare(t.key)).slice(0,n)}function Vi(e){return e.success?`success`:`failed`}function Hi(e){return e.success?e.result_summary??e.input_summary??e.label:e.error_message??e.error_code??`failed`}function Ui(e){return{actionRows:[[`result`,Vi(e)],[`module`,e.module_name],[`action`,e.action_name],[`label`,e.label],[`capability`,e.capability??`-`],[`duration_ms`,String(e.duration_ms)],[`occurred`,e.occurred_at]],failure:e.success?null:{error_code:e.error_code??null,error_message:e.error_message??null},lineageRows:[[`story_node`,e.id],[`request`,e.request_id??`-`],[`correlation`,e.correlation_id],[`trace`,e.trace_id??`-`],[`span`,e.span_id??`-`]],summaries:{input_summary:e.input_summary??null,result_summary:e.result_summary??null}}}function Wi(e,t){return t===`module`?e.module_name:t===`action`?e.action_name:t===`capability`?e.capability??`none`:e.error_code??(e.success?`success`:`unknown_error`)}function Gi(e={}){return Ei(`/operations/remote-calls`,{correlation_id:e.correlationId,module:e.moduleName,q:e.query,result:e.result===`all`?void 0:e.result,selected:e.selectedId})}function Ki(e){return Array.from(new Set(e.map(e=>e.module_name))).sort()}function qi(e){return e?.flatMap(e=>e.data)??[]}function Ji(e){return e?.at(-1)?.page.next_created_before??null}function Yi(e,t){let n=t.query.trim().toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>t.result===`success`?e.success:t.result===`failed`?!e.success:!0).filter(e=>{if(n.length===0)return!0;let t=[e.id,e.module_name,e.method,e.declared_path,e.remote_path,e.capability??``,e.request_id,e.correlation_id,e.trace_id??``,e.error_code??``].join(` `).toLowerCase();return n.every(e=>t.includes(e))}).sort((e,t)=>t.occurred_at.localeCompare(e.occurred_at))}function Xi(e){let t=e.reduce((e,t)=>e+t.duration_ms,0),n=e.filter(e=>!e.success).length;return{total:e.length,success:e.length-n,failed:n,retryable:e.filter(e=>e.retryable).length,avgDurationMs:e.length===0?0:Math.round(t/e.length),p95DurationMs:ea(e,.95)}}function Zi(e,t,n=5){let r=new Map;for(let n of e){let e=$i(n,t);r.set(e,[...r.get(e)??[],n])}return Array.from(r.entries()).map(([e,t])=>{let n=t.filter(e=>!e.success).length;return{key:e,total:t.length,failed:n,failureRate:t.length===0?0:n/t.length,p95DurationMs:ea(t,.95)}}).sort((e,t)=>t.failed-e.failed||t.p95DurationMs-e.p95DurationMs||t.total-e.total||e.key.localeCompare(t.key)).slice(0,n)}function Qi(e){return e.success?`success`:e.retryable?`retryable`:`failed`}function $i(e,t){return t===`module`?e.module_name:t===`error`?e.error_code??(e.success?`success`:`unknown_error`):e.remote_status===null||e.remote_status===void 0?`no_status`:String(e.remote_status)}function ea(e,t){if(e.length===0)return 0;let n=e.map(e=>e.duration_ms).sort((e,t)=>e-t);return n[Math.max(0,Math.ceil(t*n.length)-1)]??0}function ta({events:e,functions:t,query:n,stories:r,limit:i=8}){let a=n.trim().toLowerCase();if(!a)return[];let o=r.flatMap(e=>{let t=[e.id,e.name,e.service,e.source,e.status,e.correlationId].some(e=>e.toLowerCase().includes(a)),n=e.nodes.filter(e=>[e.id,e.name,e.canonicalName??``,e.service,e.kind,e.status].some(e=>e.toLowerCase().includes(a)));return[...t?[{kind:`story`,id:e.id,title:e.name,subtitle:`${e.status} · ${e.correlationId}`,correlationId:e.correlationId,storyId:e.id}]:[],...n.map(t=>({kind:`story`,id:t.id,title:t.name,subtitle:`${e.correlationId} · ${t.service}`,correlationId:e.correlationId,storyId:e.id,nodeId:t.id}))]}),s=e.filter(e=>[e.id,e.eventName,e.status,e.correlationId,e.lastError??``].some(e=>e.toLowerCase().includes(a))).map(e=>({kind:`event`,id:e.id,title:e.eventName,subtitle:`${e.status} · ${e.correlationId}`,correlationId:e.correlationId})),c=t.filter(e=>[e.id,e.functionName,e.runtimeDeclaration?.moduleName??``,e.runtimeDeclaration?.moduleSource??``,e.runtimeDeclaration?.queue??``,e.runtimeDeclaration?.inputSchema??``,e.status,e.correlationId,e.lastError??``].some(e=>e.toLowerCase().includes(a))).map(e=>({kind:`function`,id:e.id,title:e.functionName,subtitle:`${e.status} · ${e.runtimeDeclaration?.moduleName??e.correlationId}`,correlationId:e.correlationId})),l=Array.from(new Set([...r.map(e=>e.correlationId),...e.map(e=>e.correlationId),...t.map(e=>e.correlationId)])).filter(e=>e.toLowerCase().includes(a)).map(e=>({kind:`correlation`,id:e,title:e,subtitle:`Open correlation in Stories`,correlationId:e}));return[...o,...l,...s,...c].slice(0,i)}function na(e,t){let n=ra(e,t.correlationId),r=n?ia(n,t):aa(t);return{storyId:n?.id??t.correlationId,...r?{nodeId:r}:{}}}function ra(e,t){return e.find(e=>e.id===t||e.correlationId===t)??null}function ia(e,t){let n=new Set(t.nodeIdCandidates),r=e.nodes.find(e=>n.has(e.id));return r?r.id:t.remoteProxyCallId||t.requestId?e.nodes.find(e=>{let n=oa(e.attributes.source_metadata),r=oa(e.attributes);return sa(n.remote_proxy_call_id)===t.remoteProxyCallId||sa(r.remote_proxy_call_id)===t.remoteProxyCallId||sa(n.request_id)===t.requestId||sa(r.request_id)===t.requestId})?.id??aa(t):aa(t)}function aa(e){return e.nodeIdCandidates?.find(e=>e.length>0)}function oa(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function sa(e){return typeof e==`string`?e:void 0}var ca=(0,P.createContext)(null);function la(e){return Ei(`/runtime/stories`,{node:e.nodeId,story:e.storyId})}function ua({children:e}){let t=i(),n=pt(),r=ht(),a=bt(),o=(0,P.useRef)(null),[s,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(!1),[d,f]=(0,P.useState)(null),p=(0,P.useCallback)(e=>{f({storyId:e}),t({to:la({storyId:e})})},[t]),m=(0,P.useCallback)((e,n)=>{f({storyId:e,...n?{nodeId:n}:{}}),t({to:la({...n?{nodeId:n}:{},storyId:e})})},[t]),h=(0,P.useCallback)((e,n)=>{t({to:Gi(e?{correlationId:e,...n?{selectedId:n}:{}}:{})})},[t]),g=(0,P.useCallback)((e,n)=>{t({to:Pi(e?{correlationId:e,...n?{selectedId:n}:{}}:{})})},[t]),ee=(0,P.useCallback)(()=>{f(null)},[]),_=(0,P.useMemo)(()=>xi({apiMode:M(),data:n.data,fallback:I,isError:n.isError}),[n.data,n.isError]),v=(0,P.useMemo)(()=>xi({apiMode:M(),data:r.data,fallback:L,isError:r.isError}),[r.data,r.isError]),y=(0,P.useMemo)(()=>xi({apiMode:M(),data:a.data,fallback:je,isError:a.isError}),[a.data,a.isError]),b=(0,P.useCallback)(e=>{let n=na(y,e);f(n),t({to:la({...n.nodeId?{nodeId:n.nodeId}:{},storyId:n.storyId})})},[t,y]),te=(0,P.useCallback)(e=>{let t=e.trim().toLowerCase();return t?ta({events:_,functions:v,query:t,stories:y}):[]},[_,v,y]),ne=(0,P.useCallback)(e=>{if(e.kind===`correlation`){p(e.correlationId);return}if(e.kind===`story`){m(e.storyId,e.nodeId);return}if(e.kind===`event`){b({correlationId:e.correlationId,nodeIdCandidates:[e.id]});return}e.kind===`function`&&t({to:ji({selectedId:e.id})})},[t,p,m,b]),x=(0,P.useMemo)(()=>({retryTarget:s,commandOpen:l,activeStoryTarget:d,searchInputRef:o,openRetry:c,closeRetry:()=>c(null),openCommandPalette:()=>u(!0),closeCommandPalette:()=>u(!1),focusGlobalSearch:()=>o.current?.focus(),openTimeline:p,openStory:m,openStoryTarget:b,openRemoteCalls:h,openAdminActions:g,clearStoryTarget:ee,searchRuntime:te,selectSearchResult:ne}),[d,ee,l,p,g,h,m,b,s,te,ne]);return(0,F.jsx)(ca.Provider,{value:x,children:e})}function da(){let e=(0,P.useContext)(ca);if(!e)throw Error(`useRuntimeConsole must be used within RuntimeConsoleProvider`);return e}function fa({className:e,status:t,variant:n=`default`}){let r=ma[t],i=r.icon,a=n!==`table`;return(0,F.jsxs)(`span`,{className:J(pa,r.className,n===`compact`&&`min-h-4.5 px-1.5 text-[10px]`,n===`label`&&`runtime-status-label py-0.5 text-[11px]`,n===`table`&&`min-h-4.5 w-[72px] justify-center px-1 text-[10px]`,e),title:r.label,children:[a?(0,F.jsx)(i,{className:J(`shrink-0`,n===`compact`?`size-2.5`:`size-3`),strokeWidth:2.2}):null,(0,F.jsx)(`span`,{className:`truncate`,children:r.label})]})}var pa=`runtime-status-badge inline-flex min-h-5 w-fit max-w-full items-center gap-1 rounded-full border px-2 text-[11px] font-medium leading-none`,ma={pending:{className:`runtime-status-pending`,icon:O,label:`pending`},processing:{className:`runtime-status-processing`,icon:b,label:`processing`},running:{className:`runtime-status-running`,icon:C,label:`running`},published:{className:`runtime-status-published`,icon:ue,label:`published`},completed:{className:`runtime-status-completed`,icon:k,label:`completed`},failed:{className:`runtime-status-failed`,icon:ae,label:`failed`},dead:{className:`runtime-status-dead`,icon:_,label:`dead`}};function ha(e){let t=e.executionOperations.filter(t=>t.relatedNodeId===e.selectedNodeId),n=e.storyOperations.filter(e=>!e.relatedNodeId);return[..._a(t,e.storyTimestamp),...va(n,e.storyTimestamp)]}function ga(e){return e.isLoading?`Loading technical operations...`:e.isError?`Technical operations could not be loaded.`:`No technical operations recorded for this execution.`}function _a(e,t){let n=new Map;for(let t of e){let e=n.get(t.category)??[];e.push(t),n.set(t.category,e)}return[...n.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,n])=>({category:e,id:e,label:e,operations:ya(n,t)}))}function va(e,t){return e.length===0?[]:[{category:`story`,id:`story-level`,label:`Story-level operations`,operations:ya(e,t)}]}function ya(e,t){let n=Date.parse(t);return e.map(e=>({...e,relativeStartMs:Number.isFinite(n)&&Number.isFinite(Date.parse(e.startedAt))?Math.max(0,Date.parse(e.startedAt)-n):0,safeAttributes:Aa(e.attributes),sourceLabel:ba(e),summary:xa(e)})).sort((e,t)=>e.relativeStartMs-t.relativeStartMs||e.name.localeCompare(t.name))}function ba(e){switch(e.source){case`remote_proxy`:return`remote proxy`;case`remote_runtime`:return`remote runtime`;case`admin_action`:return`admin action`;default:return`otel`}}function xa(e){if(e.source===`remote_runtime`)return Oa(e);if(e.source===`admin_action`)return Ca(e);if(e.source!==`remote_proxy`)return;let t=Z(e.attributes.module_name),n=Z(e.attributes.method),r=Z(e.attributes.declared_path),i=Z(e.attributes.remote_path),a=ka(e.attributes.remote_status),o=Z(e.attributes.request_id),s=[t,[n,r].filter(Boolean).join(` `),i?`remote ${i}`:void 0,typeof a==`number`?`status ${a}`:void 0,o?`request ${o}`:void 0].filter(Boolean);return s.length>0?s.join(` / `):void 0}function Sa(e){return e.source===`remote_proxy`?{kind:`remote_calls`,correlationId:e.correlationId,...Ea(wa(e))}:e.source===`admin_action`?{kind:`admin_actions`,correlationId:e.correlationId,...Ea(Ta(e))}:null}function Ca(e){let t=Z(e.attributes.module_name),n=Z(e.attributes.action_name),r=Z(e.attributes.capability),i=Z(e.attributes.request_id),a=Z(e.attributes.error_code),o=[t,n,r?`capability ${r}`:void 0,i?`request ${i}`:void 0,a?`error ${a}`:void 0].filter(Boolean);return o.length>0?o.join(` / `):void 0}function wa(e){return Z(e.attributes.remote_proxy_call_id)??Da(e.id,`remote_proxy:`)}function Ta(e){return Z(e.attributes.admin_action_id)??e.relatedNodeId??Da(e.id,`admin_action:`)}function Ea(e){return e?{selectedId:e}:{}}function Da(e,t){return e.startsWith(t)?e.slice(t.length):void 0}function Oa(e){let t=Z(e.attributes.module_name),n=Z(e.attributes.function_name),r=Z(e.attributes.remote_path),i=Z(e.attributes.request_id),a=Z(e.attributes.error_code),o=ka(e.attributes.timeout_ms),s=Z(e.attributes.worker_id),c=[t,n,r?`remote ${r}`:void 0,typeof o==`number`?`timeout ${o}ms`:void 0,s?`worker ${s}`:void 0,i?`request ${i}`:void 0,a?`error ${a}`:void 0].filter(Boolean);return c.length>0?c.join(` / `):void 0}function Z(e){return typeof e==`string`&&e.length>0?e:void 0}function ka(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function Aa(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>ja(e)?t===null||typeof t==`string`||typeof t==`number`||typeof t==`boolean`:!1))}function ja(e){let t=e.toLowerCase();return![`authorization`,`cookie`,`password`,`secret`,`token`,`api_key`,`email`,`statement`,`query`,`body`,`payload`].some(e=>t.includes(e))}function Ma({activeTab:e,onClearSelection:t,selectedNode:n,setActiveTab:r,story:i}){let a=n,o=a.parentId?i.nodes.find(e=>e.id===a.parentId):null,s=Za(i,a),c=i.nodes.filter(e=>e.parentId===a.id).length,l=Qr(i,a);return(0,F.jsxs)(`aside`,{className:`grid h-full min-h-0 w-full min-w-0 max-w-full grid-rows-[auto_auto_auto_minmax(0,1fr)] overflow-hidden bg-(--bg-panel-header)`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 overflow-hidden border-b border-(--line) bg-(--bg-panel)`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2 px-3 py-2`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`mb-1 flex min-w-0 items-center gap-1.5 overflow-hidden`,children:[(0,F.jsx)(`span`,{className:J(`shrink-0 rounded-xs border px-1.5 py-0.5 font-mono text-[10px] font-semibold uppercase tracking-[0.08em]`,`border-(--line) bg-(--bg-control) text-(--accent)`),children:Qa(a)}),(0,F.jsx)(`span`,{className:`min-w-0 truncate rounded-xs border px-1.5 py-0.5 font-mono text-[10px] font-medium uppercase tracking-wide`,style:{backgroundColor:`${X(a.service)}14`,borderColor:`${X(a.service)}28`,color:X(a.service)},children:a.service})]}),(0,F.jsx)(`h2`,{className:`truncate font-mono text-sm font-semibold leading-tight text-(--fg-primary)`,children:a.name})]}),(0,F.jsx)(`button`,{"aria-label":`Clear inspector selection`,className:`grid size-6 shrink-0 place-items-center rounded-xs border border-(--line) bg-(--bg-control) text-(--fg-tertiary) transition hover:text-(--fg-primary)`,onClick:t,type:`button`,children:(0,F.jsx)(ie,{size:13})})]}),(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 overflow-hidden border-t border-(--line) px-3 py-1.5 font-mono text-[11px] text-(--fg-tertiary)`,children:[(0,F.jsxs)(`button`,{className:`group flex min-w-10.5 flex-1 items-center gap-1 overflow-hidden text-left transition hover:text-(--fg-secondary)`,type:`button`,children:[(0,F.jsx)(`span`,{className:`truncate`,children:a.id.slice(0,16)}),(0,F.jsx)(v,{className:`size-2.5 shrink-0 opacity-0 transition group-hover:opacity-100`})]}),(0,F.jsx)(`span`,{className:`shrink-0 text-(--accent)`,children:Y(a.durationMs)}),(0,F.jsx)(fa,{className:`shrink-0`,status:a.status,variant:`label`}),(0,F.jsxs)(`span`,{className:`min-w-0 truncate`,children:[c,` children`]})]})]}),(0,F.jsx)(`div`,{className:`min-w-0 overflow-hidden border-b border-(--line) bg-(--bg-canvas) px-3 py-1.5`,children:(0,F.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-2 font-mono text-[11px] text-(--fg-tertiary)`,children:[(0,F.jsx)(fi,{className:`h-5`,contentClassName:`h-full`,viewportClassName:`h-full`,children:(0,F.jsxs)(`div`,{className:`flex h-full w-max min-w-full items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`shrink-0 text-(--fg-quaternary)`,children:`path`}),s.map((e,t)=>(0,F.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:[t>0?(0,F.jsx)(oe,{className:`size-3 shrink-0 text-(--fg-quaternary)`}):null,(0,F.jsx)(`span`,{className:J(e.id===a.id?`text-(--fg-primary)`:`text-(--fg-secondary)`),title:e.name,children:e.name})]},e.id))]})}),o?(0,F.jsx)(`span`,{className:`shrink-0 text-(--fg-tertiary)`,children:Y(o.durationMs)}):null]})}),(0,F.jsx)(`div`,{className:`min-w-0 overflow-hidden border-b border-(--line) bg-(--bg-panel-muted)`,children:(0,F.jsx)(pi,{children:(0,F.jsx)(`div`,{className:`flex h-full w-max min-w-full items-stretch pr-10`,children:Gr.map(t=>(0,F.jsxs)(`button`,{className:J(`inline-flex h-full shrink-0 items-center gap-1.5 whitespace-nowrap border-b border-transparent px-2 font-mono text-[10px] font-semibold uppercase tracking-[0.06em] text-(--fg-tertiary) transition hover:border-(--border) hover:text-(--fg-secondary) disabled:text-(--fg-quaternary)`,e===t.id&&`border-(--line-strong) bg-(--bg-row-hover) text-(--fg-primary)`),onClick:()=>r(t.id),type:`button`,children:[(0,F.jsx)(`span`,{children:t.label}),l[t.id]>0?(0,F.jsx)(`span`,{className:J(`grid h-4.5 min-w-4.5 place-items-center border px-1 font-mono text-[10px] leading-none shadow-[inset_0_1px_0_rgba(255,255,255,0.03)]`,e===t.id?`border-[var(--tone-info-border)] bg-[var(--tone-info-bg)] text-(--tone-info-fg)`:`border-(--line) bg-(--bg-canvas) text-(--fg-tertiary)`),children:l[t.id]}):null]},t.id))})})}),(0,F.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-auto bg-(--bg-canvas)`,children:(0,F.jsx)(Na,{activeTab:e,node:a,story:i})})]})}function Na({activeTab:e,node:t,story:n}){let{openRemoteCalls:r,openRetry:i}=da(),a=Et(n,t.id,e===`payload`),o=Tt(n,t.id,e===`logs`),s=wt(t.id),c=Ct(n.correlationId);if(e===`overview`){let e=Ie(t),a=Xr(t);return(0,F.jsxs)(`div`,{className:`font-mono text-xs`,children:[(0,F.jsx)(Pa,{node:t,story:n}),(0,F.jsx)(Ba,{rows:[[`display name`,t.name],[`execution name`,t.canonicalName??t.name],[`execution type`,Qa(t)],[`status`,t.status],[`duration`,Y(t.durationMs)],[`start time`,Y(t.startMs)],[`completion time`,Y(t.startMs+t.durationMs)],[`retry count`,Math.max(0,(t.attempts??1)-1)],[`attempt`,`${t.attempts??1}/${t.maxAttempts??1}`],[`parent count`,$a(n,t)],[`child count`,eo(n,t)],[`service`,t.service]]}),a?(0,F.jsx)(Fa,{detail:a,onOpenRemoteCalls:()=>r(n.correlationId)}):null,e?(0,F.jsx)(`div`,{className:`border-b border-(--line) px-3 py-2`,children:(0,F.jsxs)(`button`,{className:`inline-flex h-8 w-fit items-center gap-2 rounded-xs border border-[var(--tone-error-border)] bg-[var(--tone-error-bg)] px-2 font-mono text-[11px] text-(--tone-error-fg)`,onClick:()=>i(e),type:`button`,children:[(0,F.jsx)(d,{size:12}),`Retry execution`]})}):null]})}if(e===`activity`)return(0,F.jsx)(Va,{activity:Jr(n,t)});if(e===`payload`)return(0,F.jsx)(Ua,{error:a.error,isError:a.isError,isLoading:a.isLoading,payload:a.data});if(e===`failures`)return(0,F.jsx)(Ha,{failures:Yr(t),node:t});if(e===`logs`)return(0,F.jsx)(Wa,{error:o.error,isError:o.isError,isLoading:o.isLoading,logs:o.data??[],story:n});if(e===`context`){let e=Zr(n,t);return(0,F.jsxs)(`div`,{className:`grid min-w-full`,children:[(0,F.jsx)(Ba,{rows:e.rows}),(0,F.jsx)(Ya,{label:`upstream references`,nodes:e.upstream}),(0,F.jsx)(Ya,{label:`downstream references`,nodes:e.downstream}),(0,F.jsx)(bi,{defaultExpanded:!0,title:`execution context`,value:{attributes:t.attributes,context:t.context}})]})}return(0,F.jsx)(Ia,{executionOperations:s.data??[],error:s.error??c.error,isError:s.isError||c.isError,isLoading:s.isLoading||c.isLoading,node:t,story:n,storyOperations:c.data??[]})}function Pa({node:e,story:t}){return(0,F.jsx)(`div`,{className:`border-b border-(--line) bg-(--bg-panel-muted) p-3`,children:(0,F.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,F.jsx)(`span`,{className:`mt-1 size-2 shrink-0 rounded-xs`,style:{backgroundColor:X(e.service)}}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`truncate text-[13px] font-semibold text-(--fg-primary)`,children:e.name}),(0,F.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-1.5 text-[11px] text-(--fg-tertiary)`,children:[(0,F.jsx)(`span`,{children:Qa(e)}),(0,F.jsx)(`span`,{children:`·`}),(0,F.jsx)(`span`,{children:e.status}),(0,F.jsx)(`span`,{children:`·`}),(0,F.jsx)(`span`,{children:Y(e.durationMs)})]}),(0,F.jsx)(`div`,{className:`mt-2 truncate text-[11px] text-(--fg-quaternary)`,children:t.correlationId})]})]})})}function Fa({detail:e,onOpenRemoteCalls:t}){return e?(0,F.jsxs)(`section`,{className:`grid min-w-full border-b border-(--line)`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 bg-(--bg-panel-header) px-3 py-1.5 font-mono text-[11px] text-(--fg-tertiary)`,children:[(0,F.jsx)(`span`,{children:`remote proxy`}),(0,F.jsxs)(`button`,{className:`ml-auto inline-flex h-5 items-center gap-1 border border-(--line) bg-(--bg-control) px-1.5 text-[10px] text-(--fg-secondary) hover:text-(--fg-primary)`,onClick:t,type:`button`,children:[(0,F.jsx)(p,{size:11}),`Remote Calls`]})]}),(0,F.jsx)(Ba,{rows:e.rows}),Ja(e.pathParams)?(0,F.jsx)(bi,{title:`path params`,value:e.pathParams}):null,Ja(e.errorDetails)?(0,F.jsx)(bi,{title:`error details`,value:e.errorDetails}):null]}):null}function Ia({executionOperations:e,error:t,isError:n,isLoading:r,node:i,story:a,storyOperations:o}){let s=ha({executionOperations:e,selectedNodeId:i.id,storyOperations:o,storyTimestamp:a.timestamp});return s.length===0||r||n?(0,F.jsx)(`div`,{className:`grid min-w-full`,children:(0,F.jsx)(Q,{label:ga({error:t,isError:n,isLoading:r})})}):(0,F.jsx)(`div`,{className:`grid min-w-full`,children:s.map(e=>(0,F.jsx)(La,{group:e},e.id))})}function La({group:e}){return(0,F.jsxs)(`section`,{className:`border-b border-(--line)`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 bg-(--bg-panel-header) px-3 py-1.5 font-mono text-[11px] text-(--fg-tertiary)`,children:[(0,F.jsx)(`span`,{children:e.label}),(0,F.jsx)(`span`,{className:`rounded-xs border border-(--line) bg-(--bg-canvas) px-1.5 py-0.5 text-[10px] text-(--fg-tertiary)`,children:e.operations.length})]}),e.operations.map(e=>(0,F.jsx)(Ra,{operation:e},e.id))]})}function Ra({operation:e}){let{openAdminActions:t,openRemoteCalls:n}=da(),r=Sa(e);return(0,F.jsxs)(`div`,{className:`border-t border-(--line) bg-(--bg-canvas)`,children:[(0,F.jsxs)(`div`,{className:`grid min-w-full grid-cols-[72px_82px_minmax(180px,1fr)_72px_64px_58px_24px] items-start gap-2 px-3 py-2 font-mono text-xs`,children:[(0,F.jsx)(`span`,{className:`w-fit rounded-xs border border-(--line) bg-(--bg-control) px-1.5 py-0.5 text-[10px] font-semibold uppercase text-(--accent)`,children:e.category}),(0,F.jsx)(`span`,{className:J(`w-fit rounded-xs border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,za(e)),children:e.sourceLabel}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`truncate text-(--fg-primary)`,title:e.name,children:e.name}),e.summary?(0,F.jsx)(`div`,{className:`mt-1 truncate text-[11px] text-(--fg-tertiary)`,title:e.summary,children:e.summary}):null]}),(0,F.jsx)(`span`,{className:J(`text-[11px] leading-5`,e.status===`error`?`text-(--tone-error-fg)`:`text-(--fg-tertiary)`),children:e.status}),(0,F.jsx)(`span`,{className:`text-right text-[11px] leading-5 text-(--fg-tertiary)`,children:Y(e.durationMs)}),(0,F.jsxs)(`span`,{className:`text-right text-[11px] leading-5 text-(--fg-tertiary)`,children:[`+`,Y(e.relativeStartMs)]}),r?(0,F.jsx)(`button`,{"aria-label":`Open ${e.sourceLabel} operations`,className:`grid size-5 place-items-center rounded-xs border border-(--line) bg-(--bg-control) text-(--fg-tertiary) hover:text-(--fg-primary)`,onClick:()=>{if(r.kind===`remote_calls`){n(r.correlationId,r.selectedId);return}t(r.correlationId,r.selectedId)},title:`Open ${e.sourceLabel} operations`,type:`button`,children:(0,F.jsx)(te,{size:11})}):(0,F.jsx)(`span`,{})]}),(0,F.jsx)(bi,{title:`safe attributes`,value:e.safeAttributes})]})}function za(e){return e.source===`remote_proxy`?`tint tint-warning`:e.source===`remote_runtime`||e.source===`admin_action`?`tint tint-info`:`border-(--line) bg-(--bg-control) text-(--fg-tertiary)`}function Ba({rows:e}){return e.length===0?(0,F.jsx)(Q,{label:`No execution details recorded`}):(0,F.jsx)(`div`,{className:`w-max min-w-full border-b border-(--line) font-mono text-xs`,children:e.map(([e,t])=>(0,F.jsxs)(`div`,{className:`grid w-max min-w-full grid-cols-[124px_minmax(220px,max-content)] border-b border-(--line) last:border-b-0`,children:[(0,F.jsx)(`div`,{className:`bg-(--bg-panel-header) px-3 py-1.5 text-(--fg-tertiary)`,children:e}),(0,F.jsx)(`div`,{className:`whitespace-pre-wrap px-3 py-1.5 text-(--fg-secondary)`,children:Xa(t)})]},e))})}function Va({activity:e}){return e.length===0?(0,F.jsx)(Q,{label:`No activity recorded`}):(0,F.jsx)(`div`,{className:`w-max min-w-full font-mono text-xs`,children:e.map(e=>(0,F.jsxs)(`div`,{className:`grid w-max min-w-full grid-cols-[58px_minmax(220px,max-content)] gap-2 border-b border-(--line) px-3 py-2`,children:[(0,F.jsxs)(`span`,{className:`whitespace-nowrap text-(--fg-tertiary)`,children:[`+`,Y(e.timestampMs)]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`whitespace-nowrap text-(--fg-primary)`,children:e.label}),(0,F.jsx)(`div`,{className:`whitespace-nowrap text-[11px] text-(--fg-tertiary)`,children:e.detail??`${e.kind} · ${e.status}`})]})]},e.id))})}function Ha({failures:e,node:t}){return e.length===0?(0,F.jsx)(Q,{label:`No failures recorded`}):(0,F.jsxs)(`div`,{className:`grid min-w-full`,children:[(0,F.jsx)(Ba,{rows:e.map(e=>[e.label,e.value])}),(0,F.jsx)(Ba,{rows:[[`dead letter state`,t.status===`dead`?`dead`:`-`],[`retryability`,t.retryable?`retryable`:`not retryable`],[`failure timeline`,t.logs.join(`
`)||`-`]]})]})}function Ua({error:e,isError:t,isLoading:n,payload:r}){if(n)return(0,F.jsx)(Q,{label:`Loading captured execution payload...`});if(t)return(0,F.jsx)(Q,{label:`Execution payload could not be loaded. ${qa(e)}`});let i=[[`Input`,r?.input],[`Output`,r?.output],[`Metadata`,r?.metadata]].filter(([,e])=>Ja(e));return i.length===0?(0,F.jsx)(Q,{label:`No payload captured for this execution. Story details stay lightweight; payload is only available for runtime records that persisted it.`}):(0,F.jsxs)(`div`,{className:`grid min-w-full`,children:[r&&r.redactedFields.length>0?(0,F.jsxs)(`div`,{className:`border-b border-(--line) tint-soft tint-warning px-3 py-2 font-mono text-[11px] leading-5 tint-text`,children:[`Redacted `,r.redactedFields.length,` sensitive field`,r.redactedFields.length===1?``:`s`,`:`,` `,r.redactedFields.join(`, `)]}):null,i.map(([e,t],n)=>(0,F.jsx)(bi,{defaultExpanded:n===0,title:e,value:t},e))]})}function Wa({error:e,isError:t,isLoading:n,logs:r,story:i}){return n?(0,F.jsx)(Q,{label:`Loading execution logs...`}):t?(0,F.jsx)(Q,{label:`Execution logs could not be loaded. ${qa(e)}`}):r.length===0?(0,F.jsx)(Q,{label:`No runtime logs recorded for this execution yet. Runtime lifecycle logs are recorded for work processed after execution logging was enabled.`}):(0,F.jsx)(`div`,{className:`w-max min-w-full font-mono text-xs`,children:r.map(e=>(0,F.jsxs)(`div`,{className:`grid w-max min-w-full grid-cols-[58px_58px_minmax(220px,max-content)_minmax(180px,max-content)] gap-2 border-b border-(--line) px-3 py-1.5`,children:[(0,F.jsxs)(`span`,{className:`whitespace-nowrap text-(--fg-tertiary)`,children:[`+`,Y(Ga(i.timestamp,e.occurredAt))]}),(0,F.jsx)(`span`,{className:J(`uppercase`,Ka(e.severity)),children:e.severity}),(0,F.jsx)(`span`,{className:`whitespace-nowrap text-(--fg-secondary)`,children:e.body||`-`}),(0,F.jsxs)(`span`,{className:`whitespace-nowrap text-[11px] text-(--fg-tertiary)`,children:[e.serviceName,e.traceId?` · trace ${e.traceId.slice(0,12)}`:``]}),Object.keys(e.attributes).length>0||e.redactedFields.length>0?(0,F.jsx)(`div`,{className:`col-span-4 -mx-3 mt-1 border-t border-(--line)`,children:(0,F.jsx)(bi,{title:e.redactedFields.length>0?`attributes · redacted ${e.redactedFields.length}`:`attributes`,value:{attributes:e.attributes,...e.redactedFields.length>0?{redacted_fields:e.redactedFields}:{},...e.spanId?{span_id:e.spanId}:{},...e.traceId?{trace_id:e.traceId}:{}}})}):null]},e.id))})}function Ga(e,t){let n=Date.parse(e),r=Date.parse(t);return Number.isFinite(n)&&Number.isFinite(r)?Math.max(0,r-n):0}function Ka(e){switch(e){case`error`:return`text-(--tone-error-fg)`;case`warn`:return`tint-text tint-warning`;case`debug`:case`trace`:return`text-(--fg-tertiary)`;default:return`text-(--tone-success-fg)`}}function Q({label:e}){return(0,F.jsx)(`div`,{className:`p-4 font-mono text-xs text-(--fg-tertiary)`,children:e})}function qa(e){return e instanceof Error?e.message:`Unknown error`}function Ja(e){return e==null?!1:Array.isArray(e)?e.length>0:typeof e==`object`?Object.keys(e).length>0:!0}function Ya({label:e,nodes:t}){return(0,F.jsxs)(`div`,{className:`w-max min-w-full border-b border-(--line) font-mono text-xs`,children:[(0,F.jsx)(`div`,{className:`bg-(--bg-panel-header) px-3 py-1.5 text-(--fg-tertiary)`,children:e}),t.length===0?(0,F.jsx)(`div`,{className:`border-t border-(--line) px-3 py-1.5 text-(--fg-tertiary)`,children:`None`}):t.map(e=>(0,F.jsxs)(`div`,{className:`grid w-max min-w-full grid-cols-[124px_minmax(220px,max-content)] border-t border-(--line)`,children:[(0,F.jsx)(`div`,{className:`px-3 py-1.5 text-(--fg-tertiary)`,children:Qa(e)}),(0,F.jsx)(`div`,{className:`whitespace-pre-wrap px-3 py-1.5 text-(--fg-secondary)`,children:e.name})]},e.id))]})}function Xa(e){return typeof e==`string`?e:e==null?`-`:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e)}function Za(e,t){let n=[],r=new Map(e.nodes.map(e=>[e.id,e])),i=t;for(;i;){n.unshift(i);let e=i.parentId;i=e?r.get(e):void 0}return n}function Qa(e){return e.kind===`external`?`provider`:e.kind===`function`?`function`:e.kind===`http`?`http`:e.kind===`event`?`outbox`:`node`}function $a(e,t){return e.nodes.filter(e=>e.id===t.parentId).length}function eo(e,t){return e.nodes.filter(e=>e.parentId===t.id).length}function to({ariaLabel:e,axis:t=`horizontal`,onResize:n,onReset:r}){let[i,a]=(0,P.useState)(!1),[o,s]=(0,P.useState)(!1),[c,l]=(0,P.useState)(!1),u=(0,P.useRef)(null),d=(0,P.useRef)(!1),f=i||o||c,p=t===`vertical`,m=p?`ns-resize`:`col-resize`;return(0,F.jsxs)(`button`,{"aria-label":e,className:`group relative z-1 bg-transparent outline-hidden ${p?`h-px min-w-0`:`min-h-0 w-px`}`,ref:u,style:{cursor:m},onBlur:()=>s(!1),onDoubleClick:r,onFocus:()=>s(!0),onKeyDown:e=>{e.key===(p?`ArrowUp`:`ArrowLeft`)&&(e.preventDefault(),n(-16)),e.key===(p?`ArrowDown`:`ArrowRight`)&&(e.preventDefault(),n(16)),e.key===`Enter`&&r?.()},onPointerDown:e=>{a(!0),l(!0),e.currentTarget.setPointerCapture(e.pointerId);let t=p?e.clientY:e.clientX,r=0,i=e=>{let i=(p?e.clientY:e.clientX)-t;n(i-r),r=i},o=e=>{d.current=!0,a(!1),l(!1),s(!1),u.current?.hasPointerCapture(e.pointerId)&&u.current.releasePointerCapture(e.pointerId),u.current?.blur(),window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o),document.body.style.cursor=``,document.body.style.userSelect=``};document.body.style.cursor=m,document.body.style.userSelect=`none`,window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,o,{once:!0}),window.addEventListener(`pointercancel`,o,{once:!0})},onPointerEnter:()=>{d.current||l(!0)},onPointerLeave:()=>{d.current=!1,l(!1)},type:`button`,children:[(0,F.jsx)(`span`,{className:p?`absolute -bottom-1.5 -top-1.5 inset-x-0`:`absolute inset-y-0 -left-1.5 -right-1.5`}),(0,F.jsx)(`span`,{className:`absolute inset-0 transition ${i?`bg-(--fg-tertiary)`:f?`bg-(--line-strong)`:`bg-(--border-subtle)`}`})]})}function no(e){let t=new Map,n=new Set(e.map(e=>e.id));e.forEach(e=>{let n=t.get(e.parentId)??[];n.push(e),t.set(e.parentId,n)});let r=[],i=(e,n)=>{r[n]=[...r[n]??[],e],(t.get(e.id)??[]).forEach(e=>i(e,n+1))};return e.filter(e=>!e.parentId||!n.has(e.parentId)).sort(ro).forEach(e=>i(e,0)),r}function ro(e,t){return e.startMs-t.startMs||e.name.localeCompare(t.name)}var io=`flex min-w-0 items-center justify-between gap-3 overflow-hidden border-b border-(--line) bg-(--bg-panel-header) px-3 py-2`,ao=`flex min-w-0 items-center gap-2 overflow-hidden`,oo=`font-sans text-[11px] font-semibold uppercase tracking-[0.04em] text-(--fg-tertiary)`,so=`min-w-0 truncate font-mono text-[11px] text-(--fg-tertiary)`,co=`shrink-0 font-mono text-[11px] text-(--fg-tertiary)`;function $({children:e,title:t,summary:n,meta:r}){return(0,F.jsxs)(`div`,{className:io,children:[(0,F.jsxs)(`div`,{className:ao,children:[(0,F.jsx)(`span`,{className:oo,children:t}),n?(0,F.jsx)(`span`,{className:so,children:n}):null]}),r?(0,F.jsx)(`div`,{className:co,children:r}):null,e?(0,F.jsx)(`div`,{className:co,children:e}):null]})}function lo({selectedNodeId:e,story:t,onSelectNode:n}){let r=no(t.nodes),i=Hr(t);return(0,F.jsxs)(`div`,{className:`isolate flex h-full min-w-0 flex-col overflow-hidden bg-(--bg-canvas)`,children:[(0,F.jsx)($,{meta:Y(i),summary:`color by service and status`,title:`Flame`}),(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:r.map(t=>(0,F.jsx)(`div`,{className:`relative isolate h-9 overflow-hidden border-b border-[color-mix(in_srgb,var(--line)_60%,transparent)]`,children:t.map(t=>{let r=Ur({durationMs:t.durationMs,minWidthPercent:3,startMs:t.startMs,timelineEnd:i});return(0,F.jsx)(`button`,{className:J(`absolute top-1 h-7 overflow-hidden rounded-xs border px-2 text-left font-mono text-[12px] text-(--fg-primary) transition hover:brightness-125`,e===t.id&&`shadow-[0_0_0_1px_var(--line-strong)]`),onClick:()=>n(t),style:{backgroundColor:t.status===`failed`||t.status===`dead`?`var(--error)`:`${X(t.service)}cc`,borderColor:t.status===`failed`||t.status===`dead`?`var(--error)`:`${X(t.service)}99`,left:`${r.left}%`,width:`${r.width}%`},type:`button`,children:(0,F.jsxs)(`span`,{className:`truncate`,children:[t.name,` · `,Y(t.durationMs)]})},t.id)})},t.map(e=>e.id).join(`:`)))})]})}function uo(e){let t=e.nodes.flatMap(e=>{let t=fo(e);if(!t)return[];let n=_o(e);return[{...n?{error:n}:{},...e.parentId?{parentId:e.parentId}:{},duration:e.durationMs,id:e.id,name:go(e,t),service:e.service,node:e,status:e.status,timestamp:e.startMs,type:t,typeLabel:po(t)}]}),n=Array.from(new Set(e.nodes.map(e=>e.service))),r=yo(t.map(e=>e.type)),i=vo(t);return{...i?{rootError:i}:{},correlationId:e.correlationId,duration:e.durationMs,errorCount:e.nodes.filter(bo).length,id:e.correlationId,nodeCount:t.length,nodes:t,pattern:r,patternLabel:r.map(po).join(` -> `),services:n,status:e.status,title:ho(e,t)}}function fo(e){return e.kind===`http`?`request`:e.kind===`command`||e.kind===`function`?`function`:e.kind===`event`?`event`:e.kind===`handler`||e.kind===`runtime`?`worker`:e.kind===`external`?`external`:null}function po(e){switch(e){case`request`:return`Request`;case`function`:return`Function`;case`event`:return`Outbox`;case`worker`:return`Worker`;case`external`:return`External`;default:return e}}function mo(e){return e===`dead`?`dead`:e===`failed`?`failed`:e===`pending`||e===`processing`?`retrying`:e===`running`?`running`:`success`}function ho(e,t){let n=t[0]?.node??e.nodes[0];return n?.kind===`http`&&n.name.includes(`/identity/users`)?`User Registration`:e.name.includes(`object_uploaded`)?`File Upload`:e.name.includes(`cleanup_expired_sessions`)?`Session Cleanup`:xo(e.name)}function go(e,t){return t===`external`&&bo(e)&&_o(e)?.toLowerCase().includes(`smtp`)?`smtp.provider`:xo(e.name)}function _o(e){if(!bo(e))return;let t=e.logs.at(-1);return t?.toLowerCase().includes(`smtp`)?`smtp timeout`:t||`${e.status} runtime work`}function vo(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n?.error)return n.error}}function yo(e){return e.filter((t,n)=>n===0||e[n-1]!==t)}function bo(e){let t=typeof e==`string`?e:e.status;return t===`failed`||t===`dead`}function xo(e){return e.replace(/\.v\d+$/u,``)}var So={fitPadding:128,maxZoom:1.8,minZoom:.55,zoomStep:.15};function Co(e){return Math.min(So.maxZoom,Math.max(So.minZoom,Ao(e)))}function wo({canvasHeight:e,canvasWidth:t,viewportHeight:n,viewportWidth:r}){let i=Math.max(1,r-So.fitPadding),a=Math.max(1,n-So.fitPadding);return Co(Math.min(i/t,a/e))}function To({canvasHeight:e,canvasWidth:t,viewportHeight:n,viewportWidth:r,zoom:i}){let a=Math.round(r/2),o=Math.round(n/2),s=t*i,c=e*i;return{marginLeft:a,marginTop:o,scaledCanvasHeight:c,scaledCanvasWidth:s,workspaceHeight:Math.round(c+o*2),workspaceWidth:Math.round(s+a*2)}}function Eo({bounds:e,marginLeft:t,marginTop:n,viewportHeight:r,viewportWidth:i,zoom:a}){return{scrollLeft:Math.max(0,ko(t+(e.x+e.width/2)*a-i/2)),scrollTop:Math.max(0,ko(n+(e.y+e.height/2)*a-r/2))}}function Do(e,t=240,n=72){if(e.length===0)return{height:n,width:t,x:0,y:0};let r=Math.min(...e.map(e=>e.x)),i=Math.min(...e.map(e=>e.y)),a=Math.max(...e.map(e=>e.x+t));return{height:Math.max(...e.map(e=>e.y+n))-i,width:a-r,x:r,y:i}}function Oo({currentZoom:e,nextZoom:t,pointerX:n,pointerY:r,scrollLeft:i,scrollTop:a}){let o=Co(t),s=o/e;return{scrollLeft:ko((i+n)*s-n),scrollTop:ko((a+r)*s-r),zoom:o}}function ko(e){return Math.round(e)}function Ao(e){return Math.round(e*100)/100}var jo=350;function Mo(e){let t=Po(e,new Map(e.nodes.map(e=>[e.id,e]))),n=[];for(let[e,r]of t){let t=[...r].sort(Io);for(let r of Fo(t,jo)){let t=r.filter(e=>r.some(t=>t.id!==e.id&&Lo(e,t)));if(t.length<2)continue;let[i]=[...t].sort((e,t)=>t.durationMs-e.durationMs||t.startMs+t.durationMs-(e.startMs+e.durationMs)||e.name.localeCompare(t.name));if(!i)continue;let a=Math.min(...t.map(e=>e.startMs));n.push({branchCount:t.length,childIds:t.map(e=>e.id),id:`parallel:${e}:${a}`,longestBranchId:i.id,longestBranchName:i.name,parentId:e,startMs:a})}}return n.sort((e,t)=>e.startMs-t.startMs||e.parentId.localeCompare(t.parentId))}function No(e){return Mo(e).map(e=>({branchCount:e.branchCount,firstNodeId:e.childIds[0],id:e.id,label:`${e.branchCount} parallel executions started`,parentId:e.parentId,startMs:e.startMs}))}function Po(e,t){let n=new Map;if(e.edges!==void 0){for(let r of e.edges){let e=t.get(r.target);!e||!t.has(r.source)||n.set(r.source,[...n.get(r.source)??[],e])}return n}for(let r of e.nodes)!r.parentId||!t.has(r.parentId)||n.set(r.parentId,[...n.get(r.parentId)??[],r]);return n}function Fo(e,t){let n=[],r=[],i=0;for(let a of e){if(r.length===0){r=[a],i=a.startMs;continue}if(a.startMs-i<=t){r.push(a);continue}n.push(r),r=[a],i=a.startMs}return r.length>0&&n.push(r),n}function Io(e,t){return e.startMs-t.startMs||e.name.localeCompare(t.name)}function Lo(e,t){return e.startMs<t.startMs+t.durationMs&&t.startMs<e.startMs+e.durationMs}function Ro(e){return e.edges===void 0?{edges:Bo(e.nodes),source:`derived`,state:e.nodes.length===0?`empty-nodes`:`ready`}:{edges:e.edges,source:`backend`,state:e.nodes.length>0&&e.edges.length===0?`missing-edges`:`ready`}}function zo(e){let t=Ro(e),n=Vo(e.nodes,t.edges),r=new Map(e.nodes.map(e=>[e.id,e])),i=new Map,a=new Map;for(let e of t.edges){let t=r.get(e.source),n=r.get(e.target);!t||!n||a.has(n.id)||(a.set(n.id,t.id),i.set(t.id,[...i.get(t.id)??[],n]))}for(let e of i.values())e.sort(Ho);let o=new Set;for(let[e,t]of i){o.add(e);for(let e of t)o.add(e.id)}let s=e.nodes.filter(e=>o.has(e.id)&&!a.has(e.id)).sort(Ho),c=[],l=new Set,u=e=>{if(l.has(e.id))return;l.add(e.id);let t=a.get(e.id);c.push({depth:n.get(e.id)??0,node:e,...t===void 0?{}:{parentId:t},row:c.length});for(let t of i.get(e.id)??[])u(t)};for(let e of s)u(e);for(let t of e.nodes.filter(e=>!l.has(e.id)).sort(Ho)){let e=a.get(t.id);c.push({depth:n.get(t.id)??0,node:t,...e===void 0?{}:{parentId:e},row:c.length})}return{edges:t.edges,nodes:c}}function Bo(e){return e.filter(e=>!!e.parentId).map(e=>({id:`${e.parentId}:${e.id}:parent`,source:e.parentId,target:e.id,type:`sequence`}))}function Vo(e,t){let n=new Map;for(let e of t)n.set(e.target,[...n.get(e.target)??[],e.source]);let r=new Map,i=(e,t=new Set)=>{if(r.has(e))return r.get(e);if(t.has(e))return 0;let a=new Set(t).add(e),o=n.get(e)??[],s=o.length===0?0:Math.max(...o.map(e=>i(e,a)))+1;return r.set(e,s),s};for(let t of e)i(t.id);return r}function Ho(e,t){return e.startMs-t.startMs||e.name.localeCompare(t.name)}var Uo=240,Wo=72,Go=280,Ko=92,qo=64,Jo=140,Yo=100;function Xo({selectedNodeId:e,story:t,onSelectNode:n}){let r=(0,P.useRef)(null),i=(0,P.useRef)(null),a=(0,P.useRef)(!1),o=(0,P.useRef)(null),[s,l]=(0,P.useState)(!1),[u,d]=(0,P.useState)({height:0,width:0}),[f,p]=(0,P.useState)(1),m=(0,P.useMemo)(()=>Ro(t),[t]),{edges:h}=m,g=(0,P.useMemo)(()=>zo(t),[t]),_=(0,P.useMemo)(()=>Mo(t),[t]),v=(0,P.useMemo)(()=>new Map(_.map(e=>[e.parentId,e])),[_]),y=(0,P.useMemo)(()=>new Map(_.flatMap(e=>e.childIds.map(t=>[t,e]))),[_]),b=(0,P.useMemo)(()=>g.nodes.map(e=>({fanoutGroup:v.get(e.node.id),node:e.node,parallelGroup:y.get(e.node.id),parentId:e.parentId,x:e.depth*Go,y:e.row*Ko})),[g.nodes,y,v]),te=(0,P.useMemo)(()=>new Map(b.map(e=>[e.node.id,e])),[b]),ne=(0,P.useMemo)(()=>Do(b,Uo,Wo),[b]),x=Math.max(980,Math.max(0,...b.map(e=>e.x+Uo))+qo*2),S=Math.max(420,b.length*Ko),re=To({canvasHeight:S,canvasWidth:x,viewportHeight:u.height,viewportWidth:u.width,zoom:f}),ie=Math.min((Jo-16)/x,(Yo-16)/S),C=(0,P.useCallback)(e=>{let t=r.current;if(!t)return;let n=To({canvasHeight:S,canvasWidth:x,viewportHeight:t.clientHeight,viewportWidth:t.clientWidth,zoom:e}),i=Eo({bounds:ne,marginLeft:n.marginLeft,marginTop:n.marginTop,viewportHeight:t.clientHeight,viewportWidth:t.clientWidth,zoom:e});requestAnimationFrame(()=>{t.scrollTo({left:i.scrollLeft,top:i.scrollTop})})},[S,x,ne]),ae=(0,P.useCallback)(e=>{if(o.current?.disconnect(),o.current=null,r.current=e,!e)return;let t=()=>{d({height:e.clientHeight,width:e.clientWidth})},n=new ResizeObserver(t);t(),n.observe(e),o.current=n},[]);(0,P.useLayoutEffect)(()=>{a.current||u.height<=0||u.width<=0||(a.current=!0,C(f))},[C,u.height,u.width,f]);let oe=(0,P.useCallback)(()=>{let e=r.current;if(!e)return;let t=wo({canvasHeight:S,canvasWidth:x,viewportHeight:e.clientHeight,viewportWidth:e.clientWidth});p(t),C(t)},[S,x,C]),w=(0,P.useCallback)(e=>{let t=r.current;if(!t){p(t=>Co(t+e));return}p(n=>{let r=Oo({currentZoom:n,nextZoom:n+e,pointerX:t.clientWidth/2,pointerY:t.clientHeight/2,scrollLeft:t.scrollLeft,scrollTop:t.scrollTop});return requestAnimationFrame(()=>{t.scrollTo({left:r.scrollLeft,top:r.scrollTop})}),r.zoom})},[]),T=e=>{if(!(e.metaKey||e.ctrlKey))return;e.preventDefault();let t=r.current;if(!t)return;let n=t.getBoundingClientRect();p(r=>{let i=Oo({currentZoom:r,nextZoom:r+(e.deltaY>0?-.08:.08),pointerX:e.clientX-n.left,pointerY:e.clientY-n.top,scrollLeft:t.scrollLeft,scrollTop:t.scrollTop});return requestAnimationFrame(()=>{t.scrollTo({left:i.scrollLeft,top:i.scrollTop})}),i.zoom})},E=e=>{if(e.button!==0||e.target.closest(`button`))return;let t=r.current;t&&(i.current={pointerId:e.pointerId,scrollLeft:t.scrollLeft,scrollTop:t.scrollTop,x:e.clientX,y:e.clientY},t.setPointerCapture(e.pointerId),l(!0))},se=e=>{let t=i.current,n=r.current;!t||!n||t.pointerId!==e.pointerId||(n.scrollLeft=t.scrollLeft-(e.clientX-t.x),n.scrollTop=t.scrollTop-(e.clientY-t.y))},ce=e=>{let t=r.current,n=i.current;t&&n?.pointerId===e.pointerId&&t.releasePointerCapture(e.pointerId),i.current=null,l(!1)};return(0,F.jsxs)(`div`,{className:`isolate relative h-full min-w-0 overflow-hidden bg-(--sidebar)`,children:[(0,F.jsx)(`div`,{className:`absolute top-0 right-0 left-0 z-2`,children:(0,F.jsx)($,{summary:`${b.length} nodes · ${h.length} ${m.source===`backend`?`backend`:`derived`} edges · ${Math.round(f*100)}%`,title:`Execution Graph`,children:(0,F.jsxs)(`button`,{className:`flex items-center gap-1.5 transition hover:text-(--fg-primary)`,onClick:oe,type:`button`,children:[(0,F.jsx)(_e,{size:12}),`Frame`]})})}),m.state===`missing-edges`?(0,F.jsx)(`div`,{className:`absolute top-12 left-1/2 z-3 w-[min(520px,calc(100%-32px))] -translate-x-1/2 border tint-border tint-warning bg-[color-mix(in_srgb,var(--bg-canvas)_92%,transparent)] p-3 font-mono text-[11px] tint-text shadow-(--elevation-overlay)`,children:`This story includes execution nodes, but the backend did not return graph edges.`}):null,m.state===`empty-nodes`?(0,F.jsx)(`div`,{className:`absolute inset-0 z-3 grid place-items-center p-4`,children:(0,F.jsx)(`div`,{className:`border border-(--line) bg-(--bg-panel) p-4 font-mono text-xs text-(--fg-tertiary)`,children:`This story does not include execution nodes yet.`})}):null,(0,F.jsx)(`div`,{className:J(`relative z-0 h-full overflow-auto`,s?`cursor-grabbing select-none`:`cursor-grab`),onPointerCancel:ce,onPointerDown:E,onPointerMove:se,onPointerUp:ce,onWheel:T,ref:ae,children:(0,F.jsx)(`div`,{className:`relative`,style:{height:re.workspaceHeight,width:re.workspaceWidth},children:(0,F.jsxs)(`div`,{className:`absolute top-0 left-0`,style:{height:S,left:re.marginLeft,top:re.marginTop,transform:`scale(${f})`,transformOrigin:`top left`,width:x},children:[(0,F.jsxs)(`svg`,{"aria-label":`Story flow connectors`,className:`pointer-events-none absolute inset-0 size-full`,children:[(0,F.jsx)(`title`,{children:`Story flow connectors`}),h.map(e=>{let t=te.get(e.source),n=te.get(e.target);if(!t||!n)return null;let r=t.x+Uo,i=t.y+Wo/2,a=n.x,o=n.y+Wo/2,s=(r+a)/2;return(0,F.jsx)(`path`,{d:`M ${r} ${i} C ${s} ${i}, ${s} ${o}, ${a} ${o}`,fill:`none`,opacity:`0.72`,stroke:`var(--fg-quaternary)`,strokeDasharray:e.type===`causation`?`none`:`6 4`,strokeWidth:`1.5`},e.id)})]}),b.map(({fanoutGroup:t,node:r,parallelGroup:i,x:a,y:o})=>{let s=X(r.service),c=e===r.id,l=r.status===`failed`||r.status===`dead`;return(0,F.jsxs)(`button`,{"aria-label":`Select graph node ${r.name}`,className:J(`absolute h-18 w-60 cursor-pointer rounded-sm border bg-(--bg-control) text-left transition hover:bg-(--bg-row-hover)`,c&&`border-(--line-strong) ring-1 ring-(--line-strong)`,!c&&l&&`border-[color-mix(in_srgb,var(--error)_45%,transparent)]`,!c&&!l&&`border-(--line) hover:border-(--fg-quaternary)`),onClick:()=>n(r),style:{left:a,top:o},type:`button`,children:[(0,F.jsx)(`span`,{className:`absolute top-0 right-0 left-0 h-0.75 rounded-t-sm`,style:{backgroundColor:s}}),(0,F.jsxs)(`span`,{className:`flex h-full flex-col justify-between px-3 pt-2.5 pb-2`,children:[(0,F.jsxs)(`span`,{className:`flex items-start justify-between gap-2`,children:[(0,F.jsx)(`span`,{className:`rounded-xs border px-1.5 py-0.5 font-mono text-[10px] font-bold uppercase tracking-[0.06em]`,style:{backgroundColor:`${s}18`,borderColor:`${s}30`,color:s},children:r.service}),(0,F.jsx)(`span`,{className:J(`rounded-xs px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-[0.06em]`,l?`bg-[color-mix(in_srgb,var(--error)_10%,transparent)] text-(--error)`:`bg-(--bg-row-hover) text-(--fg-secondary)`),children:Zo(r)})]}),(0,F.jsxs)(`span`,{className:`min-w-0`,children:[(0,F.jsx)(`span`,{className:`block truncate font-mono text-[13px] text-(--fg-primary)`,children:r.name}),(0,F.jsxs)(`span`,{className:`mt-1 flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-(--fg-tertiary)`,children:[(0,F.jsx)(`span`,{children:Y(r.durationMs)}),t?(0,F.jsxs)(`span`,{className:`shrink-0 rounded-xs px-1 py-0 text-[10px] tint tint-info`,children:[`fan-out `,t.branchCount]}):null,!t&&i?(0,F.jsx)(`span`,{className:`shrink-0 rounded-xs px-1 py-0 text-[10px] tint tint-info`,children:`parallel`}):null]})]})]}),l?(0,F.jsx)(`span`,{className:`absolute -top-1 -right-1 size-2.5 rounded-full border border-(--bg-control) bg-[var(--error)]`}):null]},r.id)})]})})}),(0,F.jsxs)(`div`,{className:`absolute bottom-10 left-4 z-2 flex flex-col gap-1`,children:[(0,F.jsx)(`button`,{"aria-label":`Zoom graph in`,className:`grid size-7 place-items-center rounded-xs border border-(--line) bg-(--bg-control) text-(--fg-secondary) transition hover:border-(--fg-quaternary) hover:text-(--fg-primary)`,onClick:()=>w(So.zoomStep),type:`button`,children:(0,F.jsx)(c,{size:14})}),(0,F.jsx)(`button`,{"aria-label":`Zoom graph out`,className:`grid size-7 place-items-center rounded-xs border border-(--line) bg-(--bg-control) text-(--fg-secondary) transition hover:border-(--fg-quaternary) hover:text-(--fg-primary)`,onClick:()=>w(-So.zoomStep),type:`button`,children:(0,F.jsx)(ee,{size:14})}),(0,F.jsx)(`button`,{"aria-label":`Frame graph`,className:`grid size-7 place-items-center rounded-xs border border-(--line) bg-(--bg-control) text-(--fg-secondary) transition hover:border-(--fg-quaternary) hover:text-(--fg-primary)`,onClick:oe,type:`button`,children:(0,F.jsx)(_e,{size:14})})]}),(0,F.jsx)(`div`,{className:`absolute right-4 bottom-10 z-2 h-25 w-35 overflow-hidden rounded-xs border border-(--line) bg-(--bg-panel)`,children:(0,F.jsx)(`div`,{className:`absolute top-2 left-2`,style:{height:S,transform:`scale(${ie})`,transformOrigin:`top left`,width:x},children:b.map(({node:t,x:n,y:r})=>(0,F.jsx)(`div`,{className:`absolute h-18 w-60 rounded-sm`,style:{backgroundColor:X(t.service),left:n,opacity:e===t.id?1:.45,top:r}},t.id))})}),(0,F.jsxs)(`div`,{className:`absolute bottom-2 left-1/2 z-2 flex -translate-x-1/2 items-center gap-4 rounded-xs border border-(--line) bg-(--bg-panel) px-3 py-1.5 font-mono text-[11px] text-(--fg-tertiary)`,children:[(0,F.jsx)(`span`,{children:`Select nodes`}),(0,F.jsxs)(`span`,{children:[Math.round(f*100),`%`]}),(0,F.jsx)(`span`,{children:`Ctrl wheel zoom`}),(0,F.jsx)(`span`,{children:`Drag canvas`})]})]})}function Zo(e){let t=fo(e);return t?po(t):`Node`}function Qo({children:e,className:t,type:n=`button`,variant:r=`default`,...i}){return(0,F.jsx)(`button`,{className:J(`inline-flex min-h-7 items-center justify-center gap-1.5 rounded-[var(--radius-control)] border px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--accent) disabled:opacity-45`,r==="default"&&`border-(--line) bg-(--bg-control) text-(--fg-primary) shadow-(--elevation-control) hover:bg-(--bg-control-hover) active:bg-(--bg-control-active)`,r===`ghost`&&`border-transparent bg-transparent text-(--fg-secondary) hover:bg-(--bg-row-hover) hover:text-(--fg-primary) active:bg-(--bg-control-active)`,r===`danger`&&`border-[var(--tone-error-border)] bg-[var(--tone-error-bg)] text-(--tone-error-fg) hover:bg-[var(--tone-error-bg)] active:bg-[var(--tone-error-bg)]`,t),type:n,...i,children:e})}function $o({children:e,className:t}){return(0,F.jsx)(`div`,{className:J(`grid place-items-center gap-2 p-12 text-center text-(--fg-tertiary)`,t),children:e})}function es({children:e}){return(0,F.jsx)(`div`,{className:`text-(--fg-tertiary)`,children:e})}function ts({children:e}){return(0,F.jsx)(`h2`,{className:`text-base font-semibold text-(--fg-primary)`,children:e})}function ns({children:e}){return(0,F.jsx)(`p`,{className:`max-w-md text-sm leading-6 text-(--fg-tertiary)`,children:e})}var rs=Object.assign($o,{Icon:es,Title:ts,Description:ns});function is(e,t){return`${e.bucketStart}:${e.service}:${e.nodeType}:${t}`}function as({cell:e,story:t}){let n=Date.parse(e.bucketStart),r=Date.parse(e.bucketEnd),i=Date.parse(t.timestamp),a=Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(i)&&r>n;return t.nodes.filter(t=>{if(t.service!==e.service||os(t)!==e.nodeType)return!1;if(!a)return!0;let o=i+t.startMs;return o>=n&&o<r}).sort((e,t)=>e.startMs-t.startMs)}function os(e){return e.kind===`event`?`event`:e.kind===`http`?`http`:`function`}function ss({heatmap:e,loading:t,selectedNodeId:n,story:r,queryError:i,onSelectNode:a}){let[o,s]=(0,P.useState)(null),c=!!(r&&a),l=(0,P.useMemo)(()=>{if(!(e&&r&&o))return null;let t=e.cells.findIndex((e,t)=>is(e,t)===o),n=e.cells[t];return n?{cell:n,key:o,nodes:as({cell:n,story:r})}:null},[e,o,r]);if(t)return(0,F.jsxs)(`div`,{className:`isolate flex h-full min-w-0 flex-col overflow-hidden bg-(--bg-canvas)`,children:[(0,F.jsx)($,{meta:`loading`,summary:`Backend runtime heatmap`,title:`Heatmap`}),(0,F.jsx)(`div`,{className:`grid grid-cols-[repeat(20,minmax(0,1fr))] gap-0.5 p-3`,children:Array.from({length:120},(e,t)=>(0,F.jsx)(`div`,{className:`aspect-5/4 rounded-[1px] border border-(--line) bg-(--bg-control)`},t))})]});if(i)return(0,F.jsxs)(`div`,{className:`isolate flex h-full min-w-0 flex-col overflow-hidden bg-(--bg-canvas)`,children:[(0,F.jsx)($,{meta:`error`,summary:`Backend runtime heatmap`,title:`Heatmap`}),(0,F.jsxs)(rs,{className:`h-full bg-(--bg-panel)`,children:[(0,F.jsx)(rs.Title,{children:`Heatmap unavailable`}),(0,F.jsx)(rs.Description,{children:i.message})]})]});if(!e||e.cells.length===0)return(0,F.jsxs)(`div`,{className:`isolate flex h-full min-w-0 flex-col overflow-hidden bg-(--bg-canvas)`,children:[(0,F.jsx)($,{meta:e?`${e.bucketSeconds}s buckets`:`no data`,summary:`Backend runtime heatmap`,title:`Heatmap`}),(0,F.jsxs)(rs,{className:`h-full bg-(--bg-panel)`,children:[(0,F.jsx)(rs.Title,{children:`No runtime heatmap data`}),(0,F.jsx)(rs.Description,{children:`The backend returned an empty heatmap for the current runtime window.`})]})]});let u=Math.max(1,...e.cells.map(e=>e.totalCount));return(0,F.jsxs)(`div`,{className:`isolate flex h-full min-w-0 flex-col overflow-hidden bg-(--bg-canvas)`,children:[(0,F.jsx)($,{meta:`${e.bucketSeconds}s buckets`,summary:`${e.cells.length} backend cells`,title:`Heatmap`}),(0,F.jsxs)(`div`,{className:J(`grid min-h-0 flex-1 overflow-hidden`,c&&l?`grid-cols-[minmax(0,1fr)_minmax(0,280px)] max-xl:grid-cols-1`:`grid-cols-1`),children:[(0,F.jsx)(`div`,{className:`min-h-0 overflow-auto bg-(--bg-canvas) p-3`,children:(0,F.jsx)(`div`,{className:`grid grid-cols-[repeat(20,minmax(0,1fr))] gap-0.5`,children:e.cells.map((e,t)=>{let i=is(e,t),l=r===void 0?[]:as({cell:e,story:r}),d=i===o,f=c&&l.length===1,p=c&&l.length>1;return(0,F.jsxs)(`button`,{"aria-label":`${e.service} ${e.nodeType} heatmap cell with ${e.totalCount} executions`,className:J(`relative aspect-5/4 rounded-[1px] border border-(--line) transition hover:z-1 hover:border-(--fg-secondary) focus-visible:z-1 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-(--accent)`,ls(e),d&&`border-(--line-strong)`,c?`cursor-pointer`:`cursor-default`),disabled:!c,onClick:()=>{if(c){if(l.length===1&&l[0]){a?.(l[0]),s(null);return}s(d?null:i)}},style:{opacity:Math.max(.28,e.totalCount/u)},title:`${e.service} · ${e.nodeType} · ${e.totalCount} executions`,type:`button`,children:[p?(0,F.jsx)(`span`,{className:`absolute right-0.5 bottom-0.5 rounded-[1px] bg-(--bg-canvas)/80 px-1 font-mono text-[9px] text-(--fg-primary)`,children:l.length}):null,f&&n&&n===l[0]?.id?(0,F.jsx)(`span`,{className:`absolute inset-1 border border-(--bg-canvas)`}):null]},i)})})}),c&&l?(0,F.jsx)(cs,{selected:l,selectedNodeId:n??null,onClear:()=>s(null),onSelectNode:e=>a?.(e)}):null]})]})}function cs({selected:e,selectedNodeId:t,onClear:n,onSelectNode:r}){return(0,F.jsxs)(`aside`,{className:`min-h-0 overflow-hidden border-l border-(--line) bg-(--bg-panel)`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2 border-b border-(--line) px-3 py-2`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`truncate font-mono text-[11px] font-semibold text-(--fg-primary)`,children:[e.cell.service,` · `,e.cell.nodeType]}),(0,F.jsxs)(`div`,{className:`mt-0.5 truncate font-mono text-[10px] text-(--fg-tertiary)`,children:[e.cell.totalCount,` total · `,e.cell.errorCount,` errors`]})]}),(0,F.jsx)(Qo,{"aria-label":`Clear heatmap cell selection`,className:`size-7 p-0`,onClick:n,variant:`ghost`,children:(0,F.jsx)(ie,{size:13})})]}),(0,F.jsx)(`div`,{className:`min-h-0 overflow-auto`,children:e.nodes.length===0?(0,F.jsx)(`div`,{className:`p-3 font-mono text-[11px] text-(--fg-tertiary)`,children:`No matching story nodes were found for this cell.`}):e.nodes.map(e=>(0,F.jsxs)(`button`,{"aria-label":`Open heatmap node ${e.name}`,className:J(`grid w-full min-w-0 gap-1 border-b border-(--line) px-3 py-2 text-left transition hover:bg-(--bg-row-hover)`,t===e.id&&`bg-(--bg-row-hover)`),onClick:()=>r(e),type:`button`,children:[(0,F.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full`,style:{backgroundColor:Vr(e.status)}}),(0,F.jsx)(`span`,{className:`truncate text-[12px] font-semibold text-(--fg-primary)`,children:e.name})]}),(0,F.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 font-mono text-[10px] text-(--fg-tertiary)`,children:[(0,F.jsx)(`span`,{className:`truncate`,children:e.service}),(0,F.jsx)(`span`,{className:`ml-auto shrink-0`,children:Y(e.durationMs)})]})]},e.id))})]})}function ls(e){return e.errorCount>0||e.deadCount>0?`bg-(--error)`:e.avgDurationMs&&e.avgDurationMs>1e3?`bg-(--data-accent)`:e.avgDurationMs&&e.avgDurationMs>200?`bg-(--data-success)`:`bg-(--data-info)`}function us({selectedNodeId:e,story:t,onRetryNode:n,onSelectNode:r}){let i=uo(t);return(0,F.jsxs)(`div`,{className:`grid h-full min-h-0 min-w-0 grid-rows-[auto_minmax(0,1fr)] overflow-hidden bg-(--bg-canvas)`,children:[(0,F.jsx)($,{meta:`${i.nodeCount} nodes · ${Y(i.duration)}`,summary:i.patternLabel||`No execution pattern`,title:`Runtime Story`}),(0,F.jsx)(`div`,{className:`min-h-0 overflow-auto px-4 py-4`,children:(0,F.jsxs)(`div`,{className:`mx-auto grid w-full max-w-4xl gap-2`,children:[i.nodes.length===0?(0,F.jsx)(`div`,{className:`border border-(--line) bg-(--bg-panel) p-4 font-mono text-xs text-(--fg-tertiary)`,children:`No runtime story nodes were derived for this story.`}):null,i.nodes.map((t,a)=>(0,F.jsx)(ds,{node:t,onRetry:()=>n(t),onSelect:()=>r(t.node),selected:e===t.node.id,showConnector:a<i.nodes.length-1},t.id))]})})]})}function ds({node:e,selected:t,showConnector:n,onRetry:r,onSelect:i}){let a=ps[e.type],o=ms[mo(e.status)],s=a.icon,c=o.icon,l=Ie(e.node)!==null;return(0,F.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[40px_minmax(0,1fr)] gap-3`,children:[(0,F.jsxs)(`div`,{className:`relative flex justify-center`,children:[(0,F.jsxs)(`span`,{className:J(`relative z-10 mt-1 grid size-9 place-items-center border bg-(--bg-panel)`,a.iconClass,t&&`ring-1 ring-(--line-strong)`),children:[(0,F.jsx)(s,{size:16,strokeWidth:1.8}),(0,F.jsx)(`span`,{className:J(`-right-1 -bottom-1 absolute grid size-4 place-items-center rounded-full border border-(--bg-canvas)`,o.badgeClass),title:o.label,children:(0,F.jsx)(c,{size:10,strokeWidth:2.2})})]}),n?(0,F.jsx)(`span`,{className:`absolute top-11 bottom-[-0.5rem] w-px bg-[linear-gradient(180deg,var(--line)_0%,var(--line)_100%)]`}):null]}),(0,F.jsxs)(`div`,{className:J(`group relative min-w-0 border bg-(--bg-panel) px-3 py-2.5 text-left shadow-(--elevation-raised) transition hover:border-(--line) hover:bg-(--bg-control)`,a.cardClass,t&&`border-(--line-strong) bg-(--bg-row-hover)`,(e.status===`failed`||e.status===`dead`)&&`shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--error)_20%,transparent),var(--elevation-raised)]`),children:[(0,F.jsx)(`button`,{"aria-label":`Select ${e.typeLabel} ${e.name}`,className:`absolute inset-0 z-0 cursor-pointer focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--focus-ring)`,onClick:i,type:`button`}),(0,F.jsxs)(`span`,{className:`flex min-w-0 items-start gap-3`,children:[(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,F.jsx)(`span`,{className:J(`shrink-0 border px-1.5 py-0.5 font-mono text-[10px] font-semibold uppercase tracking-[0.06em]`,a.labelClass),children:e.typeLabel}),(0,F.jsx)(`span`,{className:J(`font-mono text-[10px]`,o.textClass),children:o.label}),(0,F.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px] text-(--fg-tertiary)`,children:Y(e.duration)})]}),(0,F.jsx)(`span`,{className:`mt-1.5 block truncate text-[14px] font-semibold text-(--fg-primary)`,children:e.name}),(0,F.jsxs)(`span`,{className:`mt-1 flex min-w-0 items-center gap-2 font-mono text-[10px] text-(--fg-tertiary)`,children:[(0,F.jsx)(`span`,{className:`truncate`,children:e.service}),(0,F.jsx)(`span`,{className:`text-(--fg-quaternary)`,children:`·`}),(0,F.jsx)(`span`,{className:`shrink-0`,title:e.id,children:fs(e.id)})]}),e.error?(0,F.jsx)(`span`,{className:`mt-2 block truncate font-mono text-[11px] text-[var(--tone-error-fg)]`,children:e.error}):null]}),l?(0,F.jsx)(`span`,{className:`relative z-10 shrink-0`,children:(0,F.jsxs)(Qo,{onClick:e=>{e.stopPropagation(),r()},variant:`danger`,children:[(0,F.jsx)(E,{size:13}),`Retry`]})}):null]})]})]})}function fs(e){let t=e.split(`-`).at(-1)??e;return t.length>12?`…${t.slice(-12)}`:`…${t}`}var ps={event:{cardClass:`tint-border tint-info`,icon:l,iconClass:`border-dashed tint-border tint-text tint-info`,labelClass:`tint tint-info`},external:{cardClass:`tint-border tint-error`,icon:pe,iconClass:`tint-border tint-text tint-error`,labelClass:`tint tint-error`},function:{cardClass:`tint-border tint-success`,icon:de,iconClass:`tint-border tint-text tint-success`,labelClass:`tint tint-success`},request:{cardClass:`tint-border tint-info`,icon:f,iconClass:`tint-border tint-text tint-info`,labelClass:`tint tint-info`},worker:{cardClass:`tint-border tint-warning`,icon:u,iconClass:`border-double tint-border tint-text tint-warning`,labelClass:`tint tint-warning`}},ms={dead:{badgeClass:`bg-(--error) text-white`,icon:w,label:`dead`,textClass:`text-[var(--tone-error-fg)]`},failed:{badgeClass:`bg-(--warning) text-white`,icon:ae,label:`failed`,textClass:`tint-text tint-warning`},retrying:{badgeClass:`bg-(--info) text-white`,icon:E,label:`retrying`,textClass:`tint-text tint-info`},running:{badgeClass:`bg-(--info) text-white`,icon:T,label:`running`,textClass:`tint-text tint-info`},success:{badgeClass:`bg-(--success) text-white`,icon:re,label:`success`,textClass:`tint-text tint-success`}},hs=[{id:`story`,label:`Story`,icon:de},{id:`graph`,label:`Graph`,icon:fe},{id:`timeline`,label:`Timeline`,icon:de},{id:`heatmap`,label:`Heatmap`,icon:g},{id:`waterfall`,label:`Waterfall`,icon:m},{id:`flame`,label:`Flame`,icon:h}];function gs({mode:e,onChange:t}){return(0,F.jsx)(`div`,{className:`min-w-0 border-b border-(--line) bg-(--bg-panel-header)`,children:(0,F.jsx)(pi,{children:(0,F.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center gap-1 px-2`,children:hs.map(({icon:n,id:r,label:i})=>(0,F.jsxs)(`button`,{className:J(`relative flex h-6 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-[var(--radius-control)] px-2 text-[11px] font-medium transition-colors`,e===r?`native-selection`:`text-(--fg-tertiary) hover:bg-(--bg-row-hover) hover:text-(--fg-primary)`),onClick:()=>t(r),type:`button`,children:[(0,F.jsx)(n,{...e===r?{className:`text-(--accent)`}:{},size:12,strokeWidth:1.75}),i]},r))})})})}function _s(e){return e.timelineItems===void 0?e.nodes.map(xs):e.timelineItems.map((t,n)=>bs(e,t,n))}function vs(e,t){return t.node?t.node:e.nodes.find(e=>e.id===t.id)??e.nodes.find(e=>e.id===t.id.replace(/^timeline:/,``))??null}function ys(e){let t=_s(e),n=Math.max(0,...t.map(e=>e.startMs+e.durationMs));return Math.max(e.durationMs,n,1)}function bs(e,t,n){let r=e.nodes.find(e=>e.id===t.detailId)??e.nodes.find(e=>e.id===t.id),i=t.startedAt?Ss(e.timestamp,t.startedAt,n):Ss(e.timestamp,t.createdAt,n),a=t.completedAt?Ss(e.timestamp,t.completedAt,n):i+(r?.durationMs??1);return{...t.lastError?{error:t.lastError}:{},...r?{node:r}:{},attempts:t.attempts,durationMs:Math.max(0,a-i),id:t.id,kind:t.type,maxAttempts:t.maxAttempts,metaParts:ws({kind:t.type,...r?{node:r}:{},service:r?.service??Cs(t.type),status:t.status}),name:t.name,service:r?.service??Cs(t.type),source:`backend`,startMs:i,status:t.status}}function xs(e){let t=e.logs.at(-1);return{...t?{error:t}:{},...e.attempts===void 0?{}:{attempts:e.attempts},...e.maxAttempts===void 0?{}:{maxAttempts:e.maxAttempts},durationMs:e.durationMs,id:e.id,kind:e.kind,metaParts:ws({kind:e.kind,node:e,service:e.service,status:e.status}),name:e.name,node:e,service:e.service,source:`node`,startMs:e.startMs,status:e.status}}function Ss(e,t,n){let r=Date.parse(e),i=Date.parse(t);return Number.isFinite(r)&&Number.isFinite(i)?Math.max(0,i-r):n}function Cs(e){return e===`outbox_event`?`outbox`:e===`function_run`?`runtime.functions`:e===`http_request`?`http`:`runtime`}function ws(e){let t=Os(e.node?.attributes.source_metadata);return e.kind===`remote_proxy_call`||Es(t)?Ts(e):[e.service]}function Ts(e){let t=Os(e.node?.attributes.source_metadata),n=ks(t.module_name)??e.service,r=ks(t.method),i=ks(t.declared_path),a=As(t.remote_status),o=[r,i].filter(Boolean).join(` `);return[Ds(e.status,t),n,o||void 0,typeof a==`number`?`status ${a}`:void 0].filter(e=>e!==void 0)}function Es(e){return typeof e.remote_proxy_call_id==`string`?!0:typeof e.module_name==`string`&&typeof e.method==`string`&&typeof e.declared_path==`string`}function Ds(e,t){return e===`failed`||e===`dead`?js(t.retryable)?`retryable`:`failed`:e===`completed`||e===`published`?`ok`:e}function Os(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function ks(e){return typeof e==`string`&&e.length>0?e:void 0}function As(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function js(e){return typeof e==`boolean`?e:!1}var Ms=`grid min-w-0 gap-4 border-b border-(--line) bg-(--bg-panel-header) px-3 py-2 font-sans text-[11px] font-semibold uppercase tracking-[0.04em] text-(--fg-tertiary)`,Ns=`${Ms} grid-cols-[minmax(180px,260px)_minmax(0,1fr)] max-md:grid-cols-1`,Ps=`${Ms} grid-cols-[minmax(260px,340px)_minmax(0,1fr)]`;function Fs({selectedNodeId:e,story:t,onSelectNode:n}){let r=_s(t),i=No(t),a=new Map(i.map(e=>[e.firstNodeId,e])),o=ys(t),s=t.timelineItems===void 0?`execution nodes`:`backend timeline`;return(0,F.jsxs)(`div`,{className:`isolate flex h-full min-w-0 flex-col overflow-hidden bg-(--bg-canvas)`,children:[(0,F.jsx)($,{meta:`total ${Y(o)}`,summary:`${r.length} rows from ${s}`,title:`Business Timeline`}),(0,F.jsxs)(`div`,{className:Ns,children:[(0,F.jsx)(`span`,{children:`Story Flow`}),(0,F.jsx)(`div`,{className:`grid min-w-0 grid-cols-5 overflow-hidden font-mono`,children:[0,25,50,75,100].map(e=>(0,F.jsx)(`span`,{className:`normal-case`,children:Y(o*e/100)},e))})]}),(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,F.jsx)(`div`,{className:`mx-auto w-full max-w-5xl`,children:r.length===0?(0,F.jsx)(`div`,{className:`border border-(--line) bg-(--bg-panel) p-4 font-mono text-xs text-(--fg-tertiary)`,children:`No timeline items were returned for this story.`}):(0,F.jsx)(`div`,{className:`grid gap-3`,children:r.map((r,i)=>{let s=vs(t,r),c=s?a.get(s.id):void 0;return(0,F.jsxs)(`div`,{className:`grid gap-2`,children:[c?(0,F.jsx)(Ls,{label:c.label}):null,(0,F.jsx)(Is,{index:i,onSelectNode:n,row:r,selected:e===r.node?.id,story:t,timelineEnd:o})]},r.id)})})})})]})}function Is({index:e,row:t,selected:n,story:r,timelineEnd:i,onSelectNode:a}){let o=vs(r,t),s=Bs(t.kind),c=zs(t.kind),l=Ur({durationMs:t.durationMs,minWidthPercent:1.5,startMs:t.startMs,timelineEnd:i}),u=t.status===`failed`||t.status===`dead`;return(0,F.jsxs)(`button`,{"aria-label":`Open ${t.kind} ${t.name}`,className:J(`group grid min-w-0 grid-cols-[minmax(180px,260px)_minmax(0,1fr)] gap-4 text-left transition max-md:grid-cols-1`,n&&`scale-[1.004]`,!o&&`cursor-default`),disabled:!o,onClick:()=>{o&&a(o)},type:`button`,children:[(0,F.jsxs)(`span`,{className:J(`relative min-w-0 border bg-(--bg-panel) px-3 py-2.5 shadow-(--elevation-raised) transition group-hover:border-(--line)`,c.card,n&&`border-(--line-strong) bg-(--bg-row-hover)`),children:[e>0?(0,F.jsx)(`span`,{className:`-top-3.5 absolute left-6 h-3.5 w-px bg-(--line)`}):null,(0,F.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2`,children:[(0,F.jsx)(`span`,{className:J(`grid size-8 shrink-0 place-items-center border`,c.icon),children:(0,F.jsx)(s,{size:15,strokeWidth:1.8})}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`truncate font-mono text-[10px] font-semibold uppercase tracking-[0.06em]`,children:Vs(t.kind)}),(0,F.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full`,style:{backgroundColor:Vr(t.status)}})]}),(0,F.jsx)(`span`,{className:`mt-1 block truncate text-[13px] font-semibold text-(--fg-primary)`,children:t.name}),(0,F.jsxs)(`span`,{className:`mt-1 flex min-w-0 items-center gap-1.5 overflow-hidden font-mono text-[10px] text-(--fg-tertiary)`,children:[t.metaParts.map((e,n)=>(0,F.jsx)(`span`,{className:J(`min-w-0 truncate`,n>0&&`before:mr-1.5 before:content-['/']`,n>2&&`max-lg:hidden`),children:e},`${t.id}:${n}:${e}`)),(0,F.jsx)(`span`,{className:`ml-auto shrink-0`,children:Y(t.durationMs)})]})]})]}),t.error?(0,F.jsx)(`span`,{className:`mt-2 block truncate border-l-2 border-[var(--error)] pl-2 font-mono text-[11px] text-[var(--tone-error-fg)]`,children:t.error}):null]}),(0,F.jsx)(`span`,{className:`grid min-h-18 min-w-0 items-center max-md:hidden`,children:(0,F.jsx)(`span`,{className:`relative h-9 min-w-0 overflow-hidden border border-(--line) bg-[linear-gradient(90deg,transparent_0%,transparent_24.8%,var(--line)_25%,transparent_25.2%,transparent_49.8%,var(--line)_50%,transparent_50.2%,transparent_74.8%,var(--line)_75%,transparent_75.2%)]`,children:(0,F.jsx)(`span`,{className:J(`absolute top-2 h-5 min-w-1 transition`,u&&`opacity-90`),style:{backgroundColor:u?`var(--error)`:X(t.service),left:`${l.left}%`,opacity:n?1:.82,transform:n?`scaleY(1.22)`:void 0,width:`${l.width}%`}})})})]})}function Ls({label:e}){return(0,F.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(180px,260px)_minmax(0,1fr)] gap-4 max-md:grid-cols-1`,children:[(0,F.jsx)(`div`,{className:`tint tint-info px-3 py-1.5 font-mono text-[11px]`,children:e}),(0,F.jsx)(`div`,{className:`grid min-w-0 items-center max-md:hidden`,children:(0,F.jsx)(`div`,{className:`h-px tint-soft tint-info`})})]})}var Rs={event:{card:`tint-border tint-text tint-info`,icon:`tint tint-info`},external:{card:`tint-border tint-text tint-error`,icon:`tint tint-error`},function:{card:`tint-border tint-text tint-success`,icon:`tint tint-success`},request:{card:`tint-border tint-text tint-info`,icon:`tint tint-info`},worker:{card:`tint-border tint-text tint-warning`,icon:`tint tint-warning`}};function zs(e){return e===`outbox_event`||e===`event`?Rs.event:e===`function_run`||e===`function`||e===`command`?Rs.function:e===`http_request`||e===`http`?Rs.request:e===`external_provider_call`||e===`remote_proxy_call`||e===`external`?Rs.external:Rs.worker}function Bs(e){return e===`outbox_event`||e===`event`?l:e===`function_run`||e===`function`||e===`command`?de:e===`http_request`||e===`http`?f:e===`external_provider_call`||e===`remote_proxy_call`||e===`external`?pe:u}function Vs(e){return e===`outbox_event`||e===`event`?`Outbox`:e===`function_run`||e===`function`||e===`command`?`Function`:e===`http_request`||e===`http`?`Request`:e===`remote_proxy_call`?`Remote Call`:e===`external_provider_call`||e===`external`?`External`:`Worker`}function Hs(e){let t=Ks(e),n=new Set,r=new Map(t.map(e=>[e.node?.id??e.id,e]));for(let t of e.timelineItems??[]){let i=Xs(e,t);if(!i)continue;let a=r.get(i.id);a&&(a.markers.push(Ys(e,t,i)),n.add(t.id))}for(let e of t)e.markers.sort(Qs);let i=e.timelineItems?.filter(e=>!n.has(e.id)).map((t,n)=>Js(e,t,n)).sort(Zs)??[];return[...t,...i]}function Us(e){return e.node??null}function Ws(e){let t=Hs(e),n=Math.max(0,...t.map(e=>e.startMs+e.durationMs),...t.flatMap(e=>e.markers.map(e=>e.startMs+e.durationMs)));return Math.max(e.durationMs,n,1)}function Gs({durationMs:e,minWidthPercent:t,startMs:n,timelineEnd:r}){return Ur({durationMs:e,minWidthPercent:t,startMs:n,timelineEnd:r})}function Ks(e){let t=Ro(e),n=Mo(e),r=new Map(n.map(e=>[e.parentId,e.branchCount])),i=new Map(n.flatMap(e=>e.childIds.map(t=>[t,e.branchCount]))),a=new Map,o=new Map;for(let n of t.edges){let t=e.nodes.find(e=>e.id===n.source),r=e.nodes.find(e=>e.id===n.target);!t||!r||o.has(r.id)||(o.set(r.id,t.id),a.set(t.id,[...a.get(t.id)??[],r]))}for(let e of a.values())e.sort($s);let s=new Set;for(let[e,t]of a){s.add(e);for(let e of t)s.add(e.id)}let c=e.nodes.filter(e=>s.has(e.id)&&!o.has(e.id)).sort($s),l=[],u=new Set,d=(e,t)=>{if(u.has(e.id))return;u.add(e.id);let n=o.get(e.id),s=r.get(e.id),c=i.get(e.id);l.push(qs(e,t,`linked`,{...s===void 0?{}:{fanoutGroupSize:s},...c===void 0?{}:{parallelGroupSize:c},...n===void 0?{}:{parentId:n}}));for(let n of a.get(e.id)??[])d(n,t+1)};for(let e of c)d(e,0);let f=e.nodes.filter(e=>!u.has(e.id)).sort($s);for(let e of f){let t=o.get(e.id),n=r.get(e.id),a=i.get(e.id);l.push(qs(e,0,`unlinked`,{...n===void 0?{}:{fanoutGroupSize:n},...a===void 0?{}:{parallelGroupSize:a},...t===void 0?{}:{parentId:t}}))}return l}function qs(e,t,n,r={}){return{durationMs:e.durationMs,...r.fanoutGroupSize===void 0?{}:{fanoutGroupSize:r.fanoutGroupSize},id:e.id,kind:e.kind,markers:[],name:e.name,node:e,...r.parallelGroupSize===void 0?{}:{parallelGroupSize:r.parallelGroupSize},...r.parentId===void 0?{}:{parentId:r.parentId},service:e.service,startMs:e.startMs,status:e.status,depth:t,group:n}}function Js(e,t,n){let r=Ys(e,t);return{durationMs:r.durationMs,group:`unlinked`,id:`unlinked:${t.id}`,kind:t.type,markers:[r],name:t.name,service:tc(t.type),startMs:r.startMs+n/1e3,status:t.status,depth:0}}function Ys(e,t,n){let r=t.startedAt?ec(e.timestamp,t.startedAt,n?.startMs??0):ec(e.timestamp,t.createdAt,n?.startMs??0),i=t.completedAt?ec(e.timestamp,t.completedAt,r):r+(n?.durationMs??1);return{durationMs:Math.max(0,i-r),id:t.id,kind:t.type,matchesRowTiming:n!==void 0&&r===n.startMs&&Math.max(0,i-r)===n.durationMs,name:t.name,startMs:r,status:t.status}}function Xs(e,t){return e.nodes.find(e=>e.id===t.detailId)??e.nodes.find(e=>e.id===t.id)??null}function Zs(e,t){return e.startMs-t.startMs||e.name.localeCompare(t.name)}function Qs(e,t){return e.startMs-t.startMs||e.name.localeCompare(t.name)}function $s(e,t){return e.startMs-t.startMs||e.name.localeCompare(t.name)}function ec(e,t,n){let r=Date.parse(e),i=Date.parse(t);return Number.isFinite(r)&&Number.isFinite(i)?Math.max(0,i-r):n}function tc(e){return e===`outbox_event`?`outbox`:e===`function_run`?`runtime.functions`:e===`http_request`?`http`:`runtime`}function nc({selectedNodeId:e,story:t,onSelectNode:n}){let r=Hs(t),i=Ws(t),a=r.filter(e=>e.group===`unlinked`).length;return(0,F.jsxs)(`div`,{className:`isolate flex h-full min-w-0 flex-col overflow-hidden bg-(--background)`,children:[(0,F.jsx)($,{meta:`total ${Y(i)}`,summary:`${r.length} execution rows${a>0?` · ${a} unlinked`:``}`,title:`Waterfall`}),(0,F.jsxs)(`div`,{className:Ps,children:[(0,F.jsx)(`span`,{children:`Node`}),(0,F.jsx)(`div`,{className:`grid min-w-0 grid-cols-5 overflow-hidden`,children:[0,25,50,75,100].map(e=>(0,F.jsx)(`span`,{className:`font-mono normal-case`,children:Y(i*e/100)},e))})]}),(0,F.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[r.length===0?(0,F.jsx)(`div`,{className:`border-b border-(--border-subtle) p-4 font-mono text-xs text-(--muted)`,children:`No waterfall rows were returned for this story.`}):null,r.map((t,a)=>{let o=r[a-1];return(0,F.jsxs)(`div`,{children:[t.group===`unlinked`&&o?.group!==`unlinked`?(0,F.jsx)(`div`,{className:`border-y border-(--border-subtle) bg-(--sidebar) px-3 py-1.5 font-mono text-[10px] font-semibold uppercase tracking-[0.08em] text-(--muted)`,children:`Unlinked`}):null,(0,F.jsx)(rc,{onSelectNode:n,row:t,selectedNodeId:e,timelineEnd:i})]},t.id)})]})]})}function rc({row:e,selectedNodeId:t,timelineEnd:n,onSelectNode:r}){let i=Us(e),a=Gs({durationMs:e.durationMs,minWidthPercent:.8,startMs:e.startMs,timelineEnd:n}),o=t===i?.id,s=X(e.service);return(0,F.jsxs)(`button`,{"aria-label":`Select row ${e.name}`,className:J(`grid w-full min-w-0 grid-cols-[minmax(260px,340px)_minmax(0,1fr)] items-center gap-4 px-3 py-1.5 text-left transition hover:bg-(--bg-row-hover) disabled:cursor-default`,o&&`bg-(--bg-row-hover)`,e.group===`unlinked`&&`opacity-82`),disabled:!i,onClick:()=>{i&&r(i)},type:`button`,children:[(0,F.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 overflow-hidden`,children:[(0,F.jsxs)(`span`,{className:`grid h-7 shrink-0 grid-cols-[1px_minmax(0,1fr)]`,style:{marginLeft:e.depth*16,width:e.depth>0?18:2},children:[(0,F.jsx)(`span`,{className:`h-full bg-(--border-subtle)`}),e.depth>0?(0,F.jsx)(`span`,{className:`mt-3 h-px bg-(--border-subtle)`}):null]}),(0,F.jsx)(`span`,{className:`size-2 shrink-0 rounded-xs`,style:{backgroundColor:Vr(e.status)}}),(0,F.jsx)(`span`,{className:`max-w-28 shrink-0 truncate whitespace-nowrap rounded-xs border px-1.5 py-0.5 font-mono text-[11px] leading-3.5`,style:{backgroundColor:`${s}12`,borderColor:`${s}24`,color:s},children:e.service}),(0,F.jsx)(`span`,{className:`max-w-26 shrink-0 truncate font-mono text-[11px] text-(--muted)`,children:e.kind}),e.fanoutGroupSize?(0,F.jsxs)(`span`,{className:`shrink-0 rounded-xs px-1.5 py-0.5 font-mono text-[10px] leading-3.5 tint tint-info`,children:[`fan-out `,e.fanoutGroupSize]}):null,!e.fanoutGroupSize&&e.parallelGroupSize?(0,F.jsx)(`span`,{className:`shrink-0 rounded-xs px-1.5 py-0.5 font-mono text-[10px] leading-3.5 tint tint-info`,children:`parallel group`}):null,(0,F.jsx)(`span`,{className:`truncate font-mono text-[13px] text-(--foreground)`,children:e.name}),(0,F.jsx)(`span`,{className:`ml-auto font-mono text-xs text-(--muted)`,children:Y(e.durationMs)})]}),(0,F.jsxs)(`span`,{className:`relative isolate h-8 min-w-0 overflow-hidden rounded-xs bg-[linear-gradient(90deg,transparent_0%,transparent_24.8%,var(--border-subtle)_25%,transparent_25.2%,transparent_49.8%,var(--border-subtle)_50%,transparent_50.2%,transparent_74.8%,var(--border-subtle)_75%,transparent_75.2%)]`,children:[(0,F.jsx)(`span`,{className:`absolute top-2 h-4 min-w-0.75 rounded-xs transition-transform`,style:{backgroundColor:e.status===`failed`||e.status===`dead`?`var(--error)`:s,left:`${a.left}%`,opacity:o?1:.82,transform:o?`scaleY(1.25)`:void 0,width:`${a.width}%`}}),ic(e,n)]})]})}function ic(e,t){let n=[];for(let r of e.markers)r.matchesRowTiming||n.push((0,F.jsx)(ac,{marker:r,timelineEnd:t},r.id));return n}function ac({marker:e,timelineEnd:t}){let n=Gs({durationMs:e.durationMs,minWidthPercent:.6,startMs:e.startMs,timelineEnd:t}),r=e.status===`failed`||e.status===`dead`;return(0,F.jsx)(`span`,{className:J(`absolute top-1 h-1.5 rounded-xs bg-(--foreground)`,r&&`bg-(--error)`),style:{left:`${n.left}%`,opacity:r?.9:.5,width:`${n.width}%`},title:`${e.kind}: ${e.name} · ${Y(e.durationMs)}`})}function oc({mode:e,selectedNodeId:t,setMode:n,story:r,onRetryNode:i,onSelectNode:a}){let o=vt(r);return(0,F.jsxs)(`section`,{className:`isolate grid h-full min-h-0 min-w-0 grid-rows-[32px_minmax(0,1fr)] overflow-hidden`,children:[(0,F.jsx)(gs,{mode:e,onChange:n}),(0,F.jsxs)(`div`,{className:`min-h-0 min-w-0 overflow-hidden`,children:[e===`story`?(0,F.jsx)(us,{onRetryNode:e=>i(e.node),onSelectNode:a,selectedNodeId:t,story:r}):null,e===`graph`?(0,F.jsx)(Xo,{onSelectNode:a,selectedNodeId:t,story:r}):null,e===`timeline`?(0,F.jsx)(Fs,{onSelectNode:a,selectedNodeId:t,story:r}):null,e===`waterfall`?(0,F.jsx)(nc,{onSelectNode:a,selectedNodeId:t,story:r}):null,e===`flame`?(0,F.jsx)(lo,{onSelectNode:a,selectedNodeId:t,story:r}):null,e===`heatmap`?(0,F.jsx)(ss,{heatmap:o.data,loading:o.isLoading,onSelectNode:a,queryError:o.error,selectedNodeId:t,story:r}):null]})]})}var sc=typeof document<`u`?P.useLayoutEffect:P.useEffect,cc=e=>e&&!Array.isArray(e)&&typeof e==`object`,lc=[],uc={},dc=j,fc=(e,t=lc)=>{let n=uc;cc(e)?(n=e,e=null,t=`dependencies`in n?n.dependencies:lc):cc(t)&&(n=t,t=`dependencies`in n?n.dependencies:lc),e&&typeof e!=`function`&&console.warn(`First parameter must be a function or config object`);let{scope:r,revertOnUpdate:i}=n,a=(0,P.useRef)(!1),o=(0,P.useRef)(dc.context(()=>{},r)),s=(0,P.useRef)(e=>o.current.add(null,e)),c=t&&t.length&&!i;return c&&sc(()=>(a.current=!0,()=>o.current.revert()),lc),sc(()=>{if(e&&o.current.add(e,r),!c||!a.current)return()=>o.current.revert()},t),{context:o.current,contextSafe:s.current}};fc.register=e=>{dc=e},fc.headless=!0;function pc({expanded:e,headerHeight:t=28,height:n=144}){let r=Math.max(t,n);return{contentHeight:e?Math.max(0,r-t):0,panelHeight:e?r:t}}j.registerPlugin(fc);function mc({expanded:e,height:t,onExpandedChange:n,story:r}){let i=(0,P.useRef)(null),a=(0,P.useRef)(null),o=(0,P.useRef)(!1),s=(0,P.useRef)(null),c=(0,P.useRef)(e),l=pc({expanded:e,height:t}),u=(0,P.useRef)(l),d=Array.from(new Set(r.nodes.map(e=>e.service))).map(e=>{let t=r.nodes.filter(t=>t.service===e),n=t.map(e=>e.durationMs);return{duration:n.reduce((e,t)=>e+t,0),errors:t.filter(e=>e.status===`failed`||e.status===`dead`).length,p50:hc(n,50),p95:hc(n,95),p99:hc(n,99),service:e,nodes:t.length}});return fc(()=>{let t=i.current,n=a.current,r=s.current;if(!t||!n||!r)return;let u=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,d=c.current!==e,f=o.current&&d;if(c.current=e,o.current=!0,j.killTweensOf([t,n,r]),u||!f){j.set(t,{height:l.panelHeight}),j.set(n,{height:l.contentHeight,opacity:+!!e}),j.set(r,{rotate:e?0:-90});return}j.to(r,{duration:.22,ease:`power2.out`,rotate:e?0:-90}),j.to(t,{duration:e?.32:.24,ease:e?`power3.out`:`power2.inOut`,height:l.panelHeight}),j.to(n,{duration:e?.32:.2,ease:e?`power3.out`:`power2.inOut`,height:l.contentHeight,opacity:+!!e})},{dependencies:[e,t??null,l.contentHeight,l.panelHeight,d.length],scope:i}),(0,F.jsxs)(`div`,{ref:i,className:`grid min-w-0 grid-rows-[auto_minmax(0,1fr)] overflow-hidden border-t border-(--border-subtle) bg-(--surface)`,style:{height:u.current.panelHeight},children:[(0,F.jsxs)(`div`,{className:J(`flex h-7 min-w-0 items-center gap-2 px-3`,e&&`border-b border-(--border-subtle)`),children:[(0,F.jsxs)(`button`,{"aria-expanded":e,"aria-label":e?`Collapse services`:`Expand services`,className:`flex min-w-0 items-center gap-1.5 text-left transition hover:text-(--foreground)`,onClick:()=>n(!e),type:`button`,children:[(0,F.jsx)(A,{ref:s,className:`shrink-0 text-(--muted)`,size:13}),(0,F.jsx)(`span`,{className:`font-sans text-[11px] font-semibold uppercase tracking-[0.08em] text-(--secondary)`,children:`Services`}),(0,F.jsx)(`span`,{className:`rounded-[2px] border border-(--border-subtle) bg-(--elevated) px-1 font-mono text-[10px] text-(--muted)`,children:d.length})]}),(0,F.jsxs)(`div`,{className:`ml-auto flex min-w-0 items-center gap-3 overflow-hidden font-mono text-[11px] text-(--muted)`,children:[(0,F.jsxs)(`span`,{children:[`p50`,` `,Y(hc(r.nodes.map(e=>e.durationMs),50))]}),(0,F.jsxs)(`span`,{children:[`p95`,` `,Y(hc(r.nodes.map(e=>e.durationMs),95))]}),(0,F.jsxs)(`span`,{children:[`max`,` `,Y(Math.max(...r.nodes.map(e=>e.durationMs)))]})]})]}),(0,F.jsx)(`div`,{ref:a,className:`min-h-0 overflow-hidden`,style:{height:u.current.contentHeight,opacity:+(u.current.contentHeight>0)},children:(0,F.jsx)(`div`,{className:`h-full min-h-0 overflow-auto`,children:d.map(e=>(0,F.jsxs)(`div`,{className:`grid min-w-175 grid-cols-[12px_minmax(150px,1fr)_64px_82px_82px_82px_minmax(104px,190px)] items-center gap-2 border-b border-(--border-subtle) px-3 py-1.5 font-mono text-[11px] last:border-b-0`,children:[(0,F.jsx)(`div`,{className:`size-2 rounded-xs`,style:{backgroundColor:X(e.service)}}),(0,F.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-(--foreground)`,children:e.service}),(0,F.jsxs)(`span`,{className:`text-(--muted)`,children:[e.nodes,` nodes`]}),(0,F.jsxs)(`span`,{className:`text-(--muted)`,children:[`p50 `,Y(e.p50)]}),(0,F.jsxs)(`span`,{className:`text-(--muted)`,children:[`p95 `,Y(e.p95)]}),(0,F.jsxs)(`span`,{className:`text-(--muted)`,children:[`p99 `,Y(e.p99)]}),(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,F.jsxs)(`span`,{className:e.errors>0?`w-10 text-(--error)`:`w-10 text-(--muted)`,children:[e.errors,` err`]}),(0,F.jsx)(`div`,{className:`h-1 flex-1 overflow-hidden rounded-[1px] bg-(--elevated)`,children:(0,F.jsx)(`div`,{className:`h-full rounded-[1px]`,style:{backgroundColor:X(e.service),opacity:.7,width:`${Math.max(2,e.duration/r.durationMs*100)}%`}})})]})]},e.service))})})]})}function hc(e,t){if(e.length===0)return 0;let n=[...e].sort((e,t)=>e-t),r=Math.ceil(t/100*n.length)-1;return n[Math.max(0,r)]??0}function gc({onClose:e,onSelectNode:t,story:n}){let r=uo(n),[i]=Mo(n).sort((e,t)=>t.branchCount-e.branchCount||e.startMs-t.startMs),a=r.status===`failed`||r.status===`dead`;return(0,F.jsxs)(`header`,{className:`min-w-0 overflow-hidden border-b border-(--border-subtle) bg-(--surface)`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3 px-3 pt-2 pb-1.5`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,F.jsx)(`h1`,{className:`min-w-0 truncate text-[16px] font-semibold leading-tight text-(--foreground)`,children:r.title}),(0,F.jsx)(fa,{status:r.status,variant:`label`})]}),(0,F.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-1.5 font-mono text-[10px] text-(--secondary)`,children:[(0,F.jsx)(vc,{icon:(0,F.jsx)(le,{size:10}),tone:`accent`,children:Y(r.duration)}),(0,F.jsxs)(vc,{icon:(0,F.jsx)(D,{size:10}),children:[r.nodeCount,` nodes`]}),(0,F.jsxs)(vc,{icon:(0,F.jsx)(S,{size:10}),tone:r.errorCount>0?`error`:`muted`,children:[r.errorCount,` errors`]}),(0,F.jsxs)(vc,{icon:(0,F.jsx)(y,{size:10}),children:[r.services.length,` services`]}),i?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(vc,{icon:(0,F.jsx)(fe,{size:10}),tone:`accent`,children:[`fan-out `,i.branchCount]}),(0,F.jsxs)(vc,{icon:(0,F.jsx)(le,{size:10}),children:[`longest `,i.longestBranchName]})]}):null]})]}),(0,F.jsx)(`button`,{"aria-label":`Close story detail`,className:`grid size-5 shrink-0 place-items-center rounded-xs text-(--muted) transition hover:bg-(--hover) hover:text-(--foreground)`,onClick:e,type:`button`,children:(0,F.jsx)(ie,{size:13})})]}),(0,F.jsx)(`div`,{className:`min-w-0 px-3 pb-1.5`,children:(0,F.jsx)(fi,{className:`h-6`,viewportClassName:`h-full`,children:(0,F.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center gap-1.5`,children:r.services.map(e=>(0,F.jsx)(`span`,{className:`shrink-0 border border-(--border-subtle) bg-(--elevated) px-1.5 py-0.5 font-mono text-[10px] text-(--secondary)`,children:e},e))})})}),(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 px-3 pb-1.5 font-mono text-[10px]`,children:[(0,F.jsx)(`span`,{className:`min-w-0 truncate text-(--secondary)`,children:r.patternLabel||`No execution pattern`}),(0,F.jsx)(`span`,{className:`text-(--muted-deep)`,children:`·`}),(0,F.jsx)(`span`,{className:`min-w-0 truncate text-(--muted)`,children:r.correlationId}),r.rootError?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`text-(--muted-deep)`,children:`·`}),(0,F.jsx)(`button`,{className:J(`min-w-0 truncate text-left text-(--tone-error-fg) transition hover:text-(--error)`,a&&`font-semibold`),onClick:()=>{let e=_c(r.nodes);e&&t(e.node)},type:`button`,children:r.rootError})]}):null]})]})}function _c(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n?.error)return n}return null}function vc({children:e,icon:t,tone:n=`muted`}){let r={accent:`text-(--accent)`,error:`text-(--tone-error-fg)`,muted:`text-(--secondary)`}[n];return(0,F.jsxs)(`span`,{className:J(`inline-flex items-center gap-1`,r),children:[t,e]})}function yc({query:e,selectedStoryId:t,setQuery:n,stories:r,onSelect:i}){return(0,F.jsxs)(`aside`,{className:`grid h-full min-h-0 min-w-0 grid-rows-[auto_auto_auto_minmax(0,1fr)] overflow-hidden bg-(--bg-panel)`,children:[(0,F.jsx)(`div`,{className:`flex min-h-10 items-center justify-between gap-2 border-b border-(--line) bg-(--bg-panel) px-3 py-2`,children:(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h2`,{className:`text-sm font-semibold tracking-tight text-(--fg-primary)`,children:`Stories`}),(0,F.jsxs)(`p`,{className:`text-xs text-(--fg-tertiary)`,children:[r.length,` correlations`]})]})}),(0,F.jsxs)(`div`,{className:`flex h-8 items-center gap-2 border-b border-(--line) px-3 text-(--fg-tertiary)`,children:[(0,F.jsx)(ge,{size:12}),(0,F.jsx)(`input`,{"aria-label":`Search stories`,className:`mono w-full bg-transparent text-xs text-(--fg-primary) outline-hidden placeholder:text-(--fg-quaternary)`,onChange:e=>n(e.target.value),placeholder:`filter story / service / correlation...`,value:e})]}),(0,F.jsxs)(`div`,{className:`grid h-6 grid-cols-[12px_minmax(0,1fr)_58px] items-center gap-2 border-b border-(--line) bg-(--bg-panel-header) px-3 text-[10px] font-semibold uppercase text-(--fg-tertiary)`,children:[(0,F.jsx)(`span`,{}),(0,F.jsx)(`span`,{children:`story`}),(0,F.jsx)(`span`,{className:`text-right`,children:`state`})]}),(0,F.jsxs)(`div`,{className:`min-h-0 overflow-auto`,children:[r.length===0?(0,F.jsx)(`div`,{className:`p-4 text-[12px] leading-5 text-(--fg-tertiary)`,children:`No stories match the current filter.`}):null,r.map(e=>{let n=uo(e),r=n.status===`failed`||n.status===`dead`,a=t===e.id;return(0,F.jsxs)(`button`,{className:J(`relative w-full border-b border-(--line) py-2.5 pr-3 pl-4 text-left transition`,r&&`before:absolute before:inset-y-0 before:left-0 before:w-0.5 before:bg-(--error)`,a?`native-selection`:`hover:bg-(--bg-row-hover)`),onClick:()=>i(e),type:`button`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full`,style:{backgroundColor:Vr(n.status)}}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-(--fg-primary)`,children:n.title}),(0,F.jsx)(`span`,{className:J(`text-[10px] font-medium`,r?`text-(--tone-error-fg)`:`text-(--fg-tertiary)`),children:n.status})]}),(0,F.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 text-[11px] text-(--fg-secondary)`,children:[(0,F.jsx)(xc,{icon:(0,F.jsx)(le,{size:10}),children:Y(n.duration)}),(0,F.jsx)(`span`,{className:`text-(--line)`,children:`·`}),(0,F.jsx)(xc,{icon:(0,F.jsx)(D,{size:10}),children:n.nodeCount}),n.errorCount>0?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`text-(--line)`,children:`·`}),(0,F.jsx)(xc,{className:`text-(--tone-error-fg)`,icon:(0,F.jsx)(S,{size:10}),children:n.errorCount})]}):null,(0,F.jsx)(`span`,{className:`ml-auto truncate text-[10px] text-(--fg-tertiary)`,title:n.correlationId,children:bc(n.correlationId)})]}),r&&n.rootError?(0,F.jsx)(`div`,{className:`mt-1.5 truncate text-[11px] leading-4 text-(--tone-error-fg)`,children:n.rootError}):(0,F.jsx)(`div`,{className:`mt-1.5 truncate text-[11px] leading-4 text-(--fg-secondary)`,children:n.patternLabel||`No execution pattern`}),(0,F.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap gap-1`,children:[n.services.slice(0,4).map(e=>(0,F.jsx)(`span`,{className:`max-w-24 truncate rounded border border-(--line) bg-(--bg-control) px-1.5 py-0.5 text-[10px] text-(--fg-tertiary)`,children:e},e)),n.services.length>4?(0,F.jsxs)(`span`,{className:`rounded border border-(--line) bg-(--bg-control) px-1.5 py-0.5 text-[10px] text-(--fg-tertiary)`,children:[`+`,n.services.length-4]}):null]})]},e.id)})]})]})}function bc(e){let t=e.split(`-`).at(-1)??e;return t.length>12?`…${t.slice(-12)}`:`…${t}`}function xc({children:e,className:t,icon:n}){return(0,F.jsxs)(`span`,{className:J(`inline-flex items-center gap-1`,t),children:[n,e]})}function Sc({hasModifier:e,isTyping:t,items:n,key:r,retryEnabled:i,selectedIndex:a}){if(t||e||n.length===0)return null;if(r===`j`)return{index:Math.min(a+1,n.length-1),kind:`select`};if(r===`k`)return{index:Math.max(a-1,0),kind:`select`};let o=n[a];return o?r===`Enter`?{item:o,kind:`open`}:r.toLowerCase()===`r`&&i?{item:o,kind:`retry`}:null:null}function Cc({items:e,selectedIndex:t,setSelectedIndex:n,onOpen:r,onRetry:i}){(0,P.useEffect)(()=>{let a=a=>{let o=a.target,s=o?.tagName===`INPUT`||o?.tagName===`TEXTAREA`||o?.tagName===`SELECT`||o?.isContentEditable,c=Sc({hasModifier:a.metaKey||a.ctrlKey||a.altKey,isTyping:!!s,items:e,key:a.key,retryEnabled:!!i,selectedIndex:t});if(c){if(c.kind===`select`){a.preventDefault(),n(c.index);return}if(c.kind===`open`){a.preventDefault(),r(c.item);return}c.kind===`retry`&&i&&(a.preventDefault(),i(c.item))}};return window.addEventListener(`keydown`,a),()=>window.removeEventListener(`keydown`,a)},[e,r,i,t,n])}function wc(e,t){let[n,r]=(0,P.useState)(()=>{if(typeof window>`u`)return t;let n=window.localStorage.getItem(e);if(!n)return t;try{let e=JSON.parse(n);return Tc(t)&&!Tc(e)?t:e}catch{return t}});return(0,P.useEffect)(()=>{window.localStorage.setItem(e,JSON.stringify(n))},[e,n]),[n,r,(0,P.useCallback)(()=>r(t),[t])]}function Tc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ec({entityName:e,limit:t=50,moduleName:n}){return o({enabled:M(),queryKey:[`admin-data`,`list`,n,e,t],queryFn:()=>N.get(`admin/data/${encodeURIComponent(n)}/${encodeURIComponent(e)}?limit=${t}`).json()})}function Dc(){let e=r();return a({mutationFn:({actionName:e,input:t,moduleName:n})=>N.post(`admin/data/${encodeURIComponent(n)}/actions/${encodeURIComponent(e)}`,{json:{input:t}}).json(),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:[`admin-data`,`list`,n.moduleName]}),await e.invalidateQueries({queryKey:[`runtime`,`admin-actions`]})}})}var Oc={adminData:{useInvokeAction:Dc,useRecords:Ec},modules:{useMetadata:we},context:{useRuntimeConsole:da},data:{retryTargetForNode:Ie,runtimeStories:je},hooks:{useBrowserUrlPopState:Ti,useListKeyboard:Cc,usePersistedLayout:wc,writeBrowserUrl:wi},queries:{useRuntimeStories:bt},routing:{buildPath:Ei},story:{executionInspectorTabs:Gr,findStoryByCorrelation:ra},ui:{common:{EmptyState:rs},runtime:{ExecutionInspector:Ma,ResizeHandle:to,RuntimeStoryVisualization:oc,ServiceSummaryStrip:mc,StoryHeader:gc,StoryList:yc,defaultExecutionInspectorTab:qr}}};export{gt as $,zi as A,bi as B,Vi as C,Ii as D,Ri as E,Oi as F,J as G,_i as H,ki as I,wt as J,St as K,Si as L,ji as M,Ai as N,Fi as O,Ni as P,pt as Q,Ti as R,Hi as S,Bi as T,gi as U,vi as V,Y as W,Dt as X,xt as Y,mt as Z,Ki as _,Qo as a,je as at,Xi as b,Sa as c,Te as ct,ua as d,ye as dt,ht as et,da as f,N as ft,Ji as g,qi as h,fc as i,Le as it,Mi as j,Li as k,ga as l,Ee as lt,Yi as m,xe as mt,wc as n,bt as nt,to as o,ke as ot,Zi as p,M as pt,yt as q,Cc as r,ft as rt,ha as s,Oe as st,Oc as t,_t as tt,fa as u,we as ut,Qi as v,Pi as w,Ui as x,Gi as y,xi as z};