@lobu/runtime-server 21.2.1 → 23.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalogs/automations.json +40 -13
- package/dist/catalogs/connectors.json +18435 -1259
- package/dist/catalogs/skills.json +1 -1
- package/dist/component.json +1 -1
- package/dist/connectors/README.md +21 -6
- package/dist/connectors/_google/actions.ts +270 -0
- package/dist/connectors/_google/discovery/calendar_v3.json +1 -0
- package/dist/connectors/_google/discovery/chat_v1.json +1 -0
- package/dist/connectors/_google/discovery/docs_v1.json +1 -0
- package/dist/connectors/_google/discovery/drive_v3.json +1 -0
- package/dist/connectors/_google/discovery/gmail_v1.json +1 -0
- package/dist/connectors/_google/discovery/people_v1.json +1 -0
- package/dist/connectors/_google/discovery/sheets_v4.json +1 -0
- package/dist/connectors/_google/discovery/tasks_v1.json +1 -0
- package/dist/connectors/_google/discovery/youtube_v3.json +1 -0
- package/dist/connectors/_google/discovery.ts +442 -0
- package/dist/connectors/_google/errors.ts +91 -0
- package/dist/connectors/_google/list-feed.ts +223 -0
- package/dist/connectors/_google/policies.ts +127 -0
- package/dist/connectors/agentid.ts +43 -0
- package/dist/connectors/chat-user-identity.ts +2 -1
- package/dist/connectors/github-automation-events.ts +9 -0
- package/dist/connectors/github-identity.ts +28 -3
- package/dist/connectors/github.ts +101 -59
- package/dist/connectors/google_calendar.ts +207 -719
- package/dist/connectors/google_drive.ts +16 -2
- package/dist/connectors/google_gmail.ts +52 -33
- package/dist/connectors/herdr.ts +406 -0
- package/dist/connectors/jira-helpers.ts +313 -0
- package/dist/connectors/jira.ts +35 -227
- package/dist/connectors/linear.ts +7 -4
- package/dist/connectors/linkedin-browser-script.ts +13 -0
- package/dist/connectors/linkedin-draft-page.js +104 -0
- package/dist/connectors/linkedin-drafts.ts +73 -0
- package/dist/connectors/linkedin-identity.ts +32 -0
- package/dist/connectors/linkedin-inbox-adapter.js +1185 -0
- package/dist/connectors/linkedin-inbox.ts +156 -0
- package/dist/connectors/linkedin-like.ts +114 -0
- package/dist/connectors/linkedin-takeout.ts +577 -0
- package/dist/connectors/linkedin.ts +3998 -0
- package/dist/connectors/postgres.ts +27 -2
- package/dist/connectors/takeout-utils.ts +240 -0
- package/dist/connectors/tiktok-inbox-page.js +230 -0
- package/dist/connectors/tiktok-web-page.js +217 -0
- package/dist/connectors/tiktok_web.ts +319 -0
- package/dist/connectors/whatsapp-web-adapter.js +285 -567
- package/dist/connectors/whatsapp-web-helpers.ts +74 -455
- package/dist/connectors/whatsapp-web-identity.ts +135 -0
- package/dist/connectors/whatsapp_web.ts +159 -618
- package/dist/connectors/x-dm-adapter.js +556 -0
- package/dist/connectors/x-identity.ts +31 -2
- package/dist/connectors/x.ts +539 -253
- package/dist/db/migrations/20261005150000_retire_agent_tool_config.sql +31 -0
- package/dist/db/migrations/20261005173700_drop_retired_agent_tool_config.sql +29 -0
- package/dist/db/migrations/20261007010000_identity_association_guards.sql +242 -0
- package/dist/db/migrations/20261007010001_identity_association_indexes.sql +35 -0
- package/dist/db/migrations/20261007012000_connector_browser_requirement.sql +7 -0
- package/dist/db/migrations/20261009010000_identity_member_decision_indexes.sql +22 -0
- package/dist/db/migrations/20261009015900_retire_remaining_physical_merges.sql +196 -0
- package/dist/db/migrations/20261009020000_retire_physical_entity_merge.sql +82 -0
- package/dist/db/migrations/20261009030000_retire_physical_merge_indexes.sql +39 -0
- package/dist/db/migrations/20261009030001_drop_physical_entity_redirect.sql +62 -0
- package/dist/db/migrations/20261009040000_normalize_identity_decisions.sql +60 -0
- package/dist/db/migrations/20261010220000_notification_targets_user_event_order.sql +53 -0
- package/dist/db/migrations/20261010223000_device_workers_user_fresh_cover.sql +39 -0
- package/dist/db/migrations/20261010223001_runs_org_default_view.sql +41 -0
- package/dist/db/migrations/20261010223002_events_org_guidance.sql +42 -0
- package/dist/db/migrations/20261011002000_finish_product_eval_retirement.sql +37 -0
- package/dist/db/migrations/20261011160000_mcp_conversation_workspaces.sql +97 -0
- package/dist/db/migrations/20261013120000_events_live_org_effective_date.sql +42 -0
- package/dist/db/migrations/20261013150000_events_live_linked_org_ids_gin.sql +41 -0
- package/dist/db/migrations/20261014120000_clear_team_device_auto_pause.sql +34 -0
- package/dist/db/migrations/20261014150000_connector_webhook_event_type_backfill.sql +30 -0
- package/dist/db/migrations/20261014170000_retire_atlassian_mcp_webhook_refresh.sql +51 -0
- package/dist/db/migrations/20261015010000_connection_auth_profile_fk_set_null_column.sql +53 -0
- package/dist/db/migrations/20261015120000_personal_org_connector_auto_policy.sql +38 -0
- package/dist/db/migrations/20261017120000_drop_feeds_kind_virtual.sql +26 -0
- package/dist/db/migrations/20261017130000_drop_retired_dead_code_columns.sql +46 -0
- package/dist/db/migrations/preconditions/20261005150000_retire_agent_tool_config.sql +22 -0
- package/dist/db/migrations/preconditions/20261005173700_drop_retired_agent_tool_config.sql +13 -0
- package/dist/db/migrations/preconditions/20261009020000_retire_physical_entity_merge.sql +26 -0
- package/dist/db/migrations/preconditions/20261011002000_finish_product_eval_retirement.sql +14 -0
- package/dist/dependencies.bun.lock +144 -137
- package/dist/guest.bundle.js +416 -330
- package/dist/owletto/dist/assets/_-3J-IrxWk.js +2 -0
- package/dist/owletto/dist/assets/_-DYUE3ix4.js +3 -0
- package/dist/owletto/dist/assets/_-DtqBFgK5.js +1 -0
- package/dist/owletto/dist/assets/_agentId-Bn2IAjIy.js +2 -0
- package/dist/owletto/dist/assets/_agentId-Cam7Z0N7.js +2 -0
- package/dist/owletto/dist/assets/_automationId-CXEiKVZJ.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-CS85l61t.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-clVDIyW0.js +2 -0
- package/dist/owletto/dist/assets/_conversationId-Ci2k-BuN.js +2 -0
- package/dist/owletto/dist/assets/_deploymentId-BuUzGtVL.js +2 -0
- package/dist/owletto/dist/assets/_eventId-B0662F8h.js +2 -0
- package/dist/owletto/dist/assets/_name-CwWePlOl.js +2 -0
- package/dist/owletto/dist/assets/_owner-dTWkrKsK.js +3 -0
- package/dist/owletto/dist/assets/_shape-BtS3y4M9.js +2 -0
- package/dist/owletto/dist/assets/_skillKey-Dc9m-nlR.js +2 -0
- package/dist/owletto/dist/assets/_slug-DQHutM41.js +2 -0
- package/dist/owletto/dist/assets/_threadId-DtqBFgK5.js +1 -0
- package/dist/owletto/dist/assets/_viewKey-B30ik8ma.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-CUHypQnF.js +2 -0
- package/dist/owletto/dist/assets/accept-invitation-w17IFTtf.js +2 -0
- package/dist/owletto/dist/assets/activity-route-view-CMqYiiKM.js +2 -0
- package/dist/owletto/dist/assets/agent-card-controls-mnTN2AZt.js +2 -0
- package/dist/owletto/dist/assets/{agent-client-setup-list-BFtgRwe8.js → agent-client-setup-list-Bg3hBfUV.js} +4 -3
- package/dist/owletto/dist/assets/agent-connect-pages-B_vrqLVc.js +2 -0
- package/dist/owletto/dist/assets/agent-editor-form-hTs7eO_U.js +2 -0
- package/dist/owletto/dist/assets/agent-guardrails-route-BOrCXcAl.js +2 -0
- package/dist/owletto/dist/assets/agent-loading-shells-Dqcvky-k.js +2 -0
- package/dist/owletto/dist/assets/agent-permissions-matrix-BOo_4r_4.js +2 -0
- package/dist/owletto/dist/assets/{agent-skill-context-BAr2Dw3F.js → agent-skill-context-CCdvtlmH.js} +2 -1
- package/dist/owletto/dist/assets/agent-skills-route-BUxIswuq.js +2 -0
- package/dist/owletto/dist/assets/agent-subpage-shell-D92imvSt.js +2 -0
- package/dist/owletto/dist/assets/agent-thread-BJOijbT0.js +6 -0
- package/dist/owletto/dist/assets/agents-9XjpDj_S.js +2 -0
- package/dist/owletto/dist/assets/agents-workbench-Bt5QCYQ7.js +2 -0
- package/dist/owletto/dist/assets/app-bridge-BCm4muqj.js +128 -0
- package/dist/owletto/dist/assets/app._appId-CKv7_squ.js +2 -0
- package/dist/owletto/dist/assets/automation-detail-content-vUwVumXf.js +2 -0
- package/dist/owletto/dist/assets/automations-9XjpDj_S.js +2 -0
- package/dist/owletto/dist/assets/{callback-CaRe2TOT.js → callback-BRgcL8gz.js} +2 -1
- package/dist/owletto/dist/assets/{card-CMmh2mzo.js → card-Djgp00r_.js} +2 -1
- package/dist/owletto/dist/assets/claim-BYUZnyMp.js +2 -0
- package/dist/owletto/dist/assets/client-rows-EJSKR6z1.js +1 -0
- package/dist/owletto/dist/assets/clients-D3Zbjxin.js +2 -0
- package/dist/owletto/dist/assets/code-editor-DHeyRGZI.js +16 -0
- package/dist/owletto/dist/assets/connect-CfsFsy9P.js +2 -0
- package/dist/owletto/dist/assets/connect._clientId-DkiC8xos.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId-CIXrGOsT.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.activity-Ckdz6I0y.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.index-CNxafNeo.js +2 -0
- package/dist/owletto/dist/assets/connection-C3XXFEqh.js +2 -0
- package/dist/owletto/dist/assets/connection-feed-detail-CIJJLDP8.js +2 -0
- package/dist/owletto/dist/assets/connection-label-BobuYiAG.js +1 -0
- package/dist/owletto/dist/assets/connections-browser-CKZjzRz6.js +2 -0
- package/dist/owletto/dist/assets/{connector-provenance-BjKiUhYE.js → connector-provenance-8-d8hl10.js} +2 -1
- package/dist/owletto/dist/assets/connector-scope-lists-CadPVsI3.js +2 -0
- package/dist/owletto/dist/assets/{connectors-Baejya0T.js → connectors-lvLJ30lo.js} +2 -1
- package/dist/owletto/dist/assets/consent-CdSvVCgx.js +2 -0
- package/dist/owletto/dist/assets/conversations-table-BdXoZAfc.js +2 -0
- package/dist/owletto/dist/assets/{core.esm-QA7BQgiK.js → core.esm-CYvgWCuv.js} +2 -1
- package/dist/owletto/dist/assets/create-0xW9eXxG.js +2 -0
- package/dist/owletto/dist/assets/create-B0qhrrX4.js +2 -0
- package/dist/owletto/dist/assets/create-CAfF-yI1.js +2 -0
- package/dist/owletto/dist/assets/create-automation-form-CtSSeYj3.js +3 -0
- package/dist/owletto/dist/assets/create._connectorKey-i6xxkWKV.js +2 -0
- package/dist/owletto/dist/assets/{cronstrue-2GHCtD7h.js → cronstrue-n4qGUraE.js} +2 -1
- package/dist/owletto/dist/assets/deployments-4Itm35Xc.js +2 -0
- package/dist/owletto/dist/assets/deployments-RvUdVkj3.js +2 -0
- package/dist/owletto/dist/assets/{deployments-body-Bm2upStd.js → deployments-body-BMp7UsMo.js} +2 -1
- package/dist/owletto/dist/assets/device-CPU6CjkJ.js +2 -0
- package/dist/owletto/dist/assets/device-pin-tombstone-CrjG7gPo.js +2 -0
- package/dist/owletto/dist/assets/device._deviceId-Cs3ZmXWo.js +2 -0
- package/dist/owletto/dist/assets/{entity-options-CrbS6K-i.js → entity-options-uXjgT7y9.js} +2 -1
- package/dist/owletto/dist/assets/entity-page-Dc0LGr5U.js +2 -0
- package/dist/owletto/dist/assets/entity-type-page-CwZxa0BR.js +2 -0
- package/dist/owletto/dist/assets/event-detail-ve2d6Gbb.js +2 -0
- package/dist/owletto/dist/assets/events-feed-BtvhZF1f.js +2 -0
- package/dist/owletto/dist/assets/filter-editors-Cj-v6NtH.js +2 -0
- package/dist/owletto/dist/assets/full-page-spinner-DqpH99np.js +2 -0
- package/dist/owletto/dist/assets/guardrails-HFo2Ut8B.js +2 -0
- package/dist/owletto/dist/assets/identity-BigVSBCl.js +2 -0
- package/dist/owletto/dist/assets/index-B9uPN6FC.js +2 -0
- package/dist/owletto/dist/assets/index-BLEcy9-T.css +1 -0
- package/dist/owletto/dist/assets/index-BQVliQW1.js +2 -0
- package/dist/owletto/dist/assets/index-BfedB4Rc.js +2 -0
- package/dist/owletto/dist/assets/index-CDz3-ieP.js +1 -0
- package/dist/owletto/dist/assets/index-CUw3aKBI.js +2 -0
- package/dist/owletto/dist/assets/index-CXhxUkv3.js +2 -0
- package/dist/owletto/dist/assets/index-Cr5hwh-C.js +7950 -0
- package/dist/owletto/dist/assets/index-CzkTV4ZQ.js +2 -0
- package/dist/owletto/dist/assets/index-DKSx8JN_.js +2 -0
- package/dist/owletto/dist/assets/index-DVk7Ug0d.js +2 -0
- package/dist/owletto/dist/assets/index-DmZuKGf8.js +2 -0
- package/dist/owletto/dist/assets/index-DtqBFgK5.js +1 -0
- package/dist/owletto/dist/assets/index-Hio-HRfo.js +2 -0
- package/dist/owletto/dist/assets/{index-Cf0GJoiG.js → index-ICgKp3YK.js} +2 -1
- package/dist/owletto/dist/assets/index-Vcq4gwWv.js +1 -0
- package/dist/owletto/dist/assets/index-cPcroOH0.js +2 -0
- package/dist/owletto/dist/assets/{index-DlepU3cY.js → index-n7sTbNv4.js} +2 -1
- package/dist/owletto/dist/assets/index-rrnUF981.js +1 -0
- package/dist/owletto/dist/assets/index-xiFpcWKv.js +2 -0
- package/dist/owletto/dist/assets/json-diff-DBoag_OS.js +4 -0
- package/dist/owletto/dist/assets/{list-skeleton-BtWn2eo2.js → list-skeleton-C_GuoxAH.js} +2 -1
- package/dist/owletto/dist/assets/login-Ci6ixHuL.js +2 -0
- package/dist/owletto/dist/assets/logout-CLGgeZB7.js +2 -0
- package/dist/owletto/dist/assets/member-scope-gate-B44INDPY.js +2 -0
- package/dist/owletto/dist/assets/memory-browse-page-DyQiRvzl.js +103 -0
- package/dist/owletto/dist/assets/model-selector-dAbDgJvx.js +2 -0
- package/dist/owletto/dist/assets/models-DpVP7ZwX.js +2 -0
- package/dist/owletto/dist/assets/new-BUb7AnEW.js +2 -0
- package/dist/owletto/dist/assets/new-BkdULx2r.js +2 -0
- package/dist/owletto/dist/assets/new-CHOr-EcI.js +2 -0
- package/dist/owletto/dist/assets/oauth-workspace-access-BxsjwgdH.js +2 -0
- package/dist/owletto/dist/assets/organization-gxGeDjIV.js +2 -0
- package/dist/owletto/dist/assets/peek-pane-content-CHoQHe2H.js +2 -0
- package/dist/owletto/dist/assets/{permissions-h_qSft1A.js → permissions-aPHaKLec.js} +2 -1
- package/dist/owletto/dist/assets/proposal-review-shell-UcZr87_Q.js +2 -0
- package/dist/owletto/dist/assets/public-shell-ready-DcnlADmj.js +2 -0
- package/dist/owletto/dist/assets/{recent-JiBNvZzD.js → recent-D-65Pgu-.js} +2 -1
- package/dist/owletto/dist/assets/record-activity-CBXH6v1d.js +2 -0
- package/dist/owletto/dist/assets/{renderer-DgPLyEbx.js → renderer-mEDnVW0O.js} +28 -27
- package/dist/owletto/dist/assets/reset-password-uX_V6bip.js +2 -0
- package/dist/owletto/dist/assets/runs-C0rCgGwX.js +2 -0
- package/dist/owletto/dist/assets/runs-panel-Du1JMjg5.js +2 -0
- package/dist/owletto/dist/assets/runs-table-syPJ6r6T.js +2 -0
- package/dist/owletto/dist/assets/settings-9NkNA1G1.js +2 -0
- package/dist/owletto/dist/assets/settings-E-10sLQX.js +2 -0
- package/dist/owletto/dist/assets/skill-editor-D_W3QlRz.js +1 -0
- package/dist/owletto/dist/assets/skills-D2Ri9b4f.js +2 -0
- package/dist/owletto/dist/assets/source-record-panels-CPyzlfD1.js +2 -0
- package/dist/owletto/dist/assets/status-dot-B-EWMgq6.js +2 -0
- package/dist/owletto/dist/assets/tabs-DqIIkCX-.js +2 -0
- package/dist/owletto/dist/assets/{use-mention-search-B4DfZFm5.js → use-mention-search-By8RZyKW.js} +3 -2
- package/dist/owletto/dist/assets/view-param-filters-CqLZQrnO.js +2 -0
- package/dist/owletto/dist/assets/workspace-label-o_QfBuCM.js +2 -0
- package/dist/owletto/dist/index.html +46 -4
- package/dist/providers.json +1 -1
- package/dist/server-main.bundle.mjs +137029 -133673
- package/npm-shrinkwrap.json +612 -645
- package/package.json +4 -3
- package/vendor/connector-sdk/dist/browser-handoff-banner.d.ts +39 -0
- package/vendor/connector-sdk/dist/browser-handoff-banner.js +175 -0
- package/vendor/connector-sdk/dist/browser-requirement.d.ts +36 -0
- package/vendor/connector-sdk/dist/browser-requirement.js +60 -0
- package/vendor/connector-sdk/dist/browser-source-read.d.ts +52 -0
- package/vendor/connector-sdk/dist/browser-source-read.js +107 -0
- package/vendor/connector-sdk/dist/connector-runtime.d.ts +3 -1
- package/vendor/connector-sdk/dist/connector-runtime.js +10 -0
- package/vendor/connector-sdk/dist/connector-types.d.ts +169 -45
- package/vendor/connector-sdk/dist/define-connector.d.ts +4 -2
- package/vendor/connector-sdk/dist/define-connector.js +3 -0
- package/vendor/connector-sdk/dist/index.d.ts +8 -2
- package/vendor/connector-sdk/dist/index.js +3 -0
- package/vendor/connector-sdk/dist/reaction-client-types.d.ts +16 -21
- package/vendor/connector-sdk/dist/reaction-client-types.typecheck.d.ts +5 -0
- package/vendor/connector-sdk/package.json +13 -1
- package/vendor/core/dist/agent-policy.js +1 -1
- package/vendor/core/dist/agent-store.d.ts +2 -0
- package/vendor/core/dist/agent-tooling.d.ts +1 -1
- package/vendor/core/dist/agent-tooling.js +1 -1
- package/vendor/core/dist/capabilities.d.ts +1 -1
- package/vendor/core/dist/capabilities.js +2 -1
- package/vendor/core/dist/connector-query-errors.d.ts +32 -0
- package/vendor/core/dist/connector-query-errors.js +41 -1
- package/vendor/core/dist/contracts/agent-settings.d.ts +0 -11
- package/vendor/core/dist/contracts/agent-settings.js +1 -7
- package/vendor/core/dist/contracts/tools/collection-presentation.d.ts +93 -0
- package/vendor/core/dist/contracts/tools/collection-presentation.js +88 -0
- package/vendor/core/dist/contracts/tools/collection-selection.d.ts +47 -0
- package/vendor/core/dist/contracts/tools/collection-selection.js +74 -0
- package/vendor/core/dist/contracts/tools/manage-agents.d.ts +10 -4
- package/vendor/core/dist/contracts/tools/manage-auth-profiles.d.ts +1 -1
- package/vendor/core/dist/contracts/tools/manage-auth-profiles.js +5 -1
- package/vendor/core/dist/contracts/tools/manage-automations.d.ts +19 -4
- package/vendor/core/dist/contracts/tools/manage-automations.js +25 -8
- package/vendor/core/dist/contracts/tools/manage-connections.d.ts +1 -0
- package/vendor/core/dist/contracts/tools/manage-connections.js +3 -0
- package/vendor/core/dist/contracts/tools/manage-conversations.js +2 -2
- package/vendor/core/dist/contracts/tools/manage-entity-schema.d.ts +11 -0
- package/vendor/core/dist/contracts/tools/manage-entity-schema.js +42 -3
- package/vendor/core/dist/contracts/tools/manage-entity.d.ts +181 -152
- package/vendor/core/dist/contracts/tools/manage-entity.js +118 -162
- package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +14 -0
- package/vendor/core/dist/contracts/tools/manage-feeds.js +17 -0
- package/vendor/core/dist/contracts/tools/manage-operations.d.ts +41 -3
- package/vendor/core/dist/contracts/tools/manage-operations.js +40 -2
- package/vendor/core/dist/contracts/tools/manage-views.d.ts +182 -7
- package/vendor/core/dist/contracts/tools/manage-views.js +49 -13
- package/vendor/core/dist/contracts/tools/read-knowledge.d.ts +11 -2
- package/vendor/core/dist/contracts/tools/read-knowledge.js +23 -3
- package/vendor/core/dist/contracts/tools/save-memory.d.ts +3 -6
- package/vendor/core/dist/contracts/tools/save-memory.js +2 -6
- package/vendor/core/dist/contracts/tools/view-attach.d.ts +2 -1
- package/vendor/core/dist/contracts/tools/view-attach.js +7 -2
- package/vendor/core/dist/contracts/worker/protocol.d.ts +130 -159
- package/vendor/core/dist/contracts/worker/protocol.js +88 -76
- package/vendor/core/dist/device-pin-tombstones.d.ts +44 -0
- package/vendor/core/dist/device-pin-tombstones.js +57 -0
- package/vendor/core/dist/index.d.ts +5 -5
- package/vendor/core/dist/index.js +4 -6
- package/vendor/core/dist/json-template.d.ts +6 -10
- package/vendor/core/dist/json-template.js +5 -9
- package/vendor/core/dist/logger.js +17 -26
- package/vendor/core/dist/shell-safety.d.ts +9 -0
- package/vendor/core/dist/shell-safety.js +154 -0
- package/vendor/core/dist/suggestions.d.ts +1 -1
- package/vendor/core/dist/suggestions.js +1 -1
- package/vendor/core/dist/tool-trace-summary.d.ts +1 -1
- package/vendor/core/dist/tool-trace-summary.js +1 -1
- package/vendor/core/dist/types.d.ts +1 -3
- package/vendor/core/dist/utils/diagnostic-scrubber.d.ts +7 -0
- package/vendor/core/dist/utils/diagnostic-scrubber.js +437 -0
- package/vendor/core/dist/worker/auth.d.ts +44 -6
- package/vendor/core/dist/worker/auth.js +44 -11
- package/vendor/core/dist/worker/wire.d.ts +0 -10
- package/vendor/core/package.json +20 -11
- package/vendor/views/dist/api.d.ts +39 -29
- package/vendor/views/dist/api.js +110 -83
- package/vendor/views/dist/bridge.d.ts +4 -0
- package/vendor/views/dist/bridge.js +15 -0
- package/vendor/views/dist/index.d.ts +1 -0
- package/vendor/views/dist/index.js +0 -7
- package/vendor/views/package.json +4 -1
- package/dist/owletto/dist/assets/_-CLhipgJI.js +0 -1
- package/dist/owletto/dist/assets/_-D0ZVGAIA.js +0 -2
- package/dist/owletto/dist/assets/_agentId-BLXUf3ot.js +0 -1
- package/dist/owletto/dist/assets/_agentId-DnI66MF3.js +0 -1
- package/dist/owletto/dist/assets/_automationId-ziwseLb7.js +0 -1
- package/dist/owletto/dist/assets/_connectorKey._connectionId-B6V3ySFK.js +0 -1
- package/dist/owletto/dist/assets/_connectorKey.index-CR5u_dtt.js +0 -1
- package/dist/owletto/dist/assets/_conversationId-FBMYmOl8.js +0 -1
- package/dist/owletto/dist/assets/_deploymentId-DNTXbT_m.js +0 -1
- package/dist/owletto/dist/assets/_name-B37LKIxH.js +0 -1
- package/dist/owletto/dist/assets/_owner-BxYumqC2.js +0 -1
- package/dist/owletto/dist/assets/_shape-Bxz-04jR.js +0 -1
- package/dist/owletto/dist/assets/_skillKey-D5MFbiw2.js +0 -1
- package/dist/owletto/dist/assets/_slug-Dlhit09k.js +0 -1
- package/dist/owletto/dist/assets/_viewKey-C6535i-t.js +0 -1
- package/dist/owletto/dist/assets/_viewKey-CQCtY3Y8.js +0 -1
- package/dist/owletto/dist/assets/_viewKey-CxKfKbRa.js +0 -1
- package/dist/owletto/dist/assets/accept-invitation-BQQwec3R.js +0 -1
- package/dist/owletto/dist/assets/activity-route-view-BwThvdGs.js +0 -1
- package/dist/owletto/dist/assets/agent-card-controls-B3RhzsPz.js +0 -1
- package/dist/owletto/dist/assets/agent-connect-pages-BO4wQn4L.js +0 -1
- package/dist/owletto/dist/assets/agent-editor-form-BYC4uSNz.js +0 -1
- package/dist/owletto/dist/assets/agent-guardrails-route-Dp02G1AQ.js +0 -1
- package/dist/owletto/dist/assets/agent-loading-shells-OagauQzV.js +0 -1
- package/dist/owletto/dist/assets/agent-permissions-matrix-B9Ho3P1t.js +0 -1
- package/dist/owletto/dist/assets/agent-skills-route-B4VUnVi0.js +0 -1
- package/dist/owletto/dist/assets/agent-subpage-shell-Dz8I-GUt.js +0 -1
- package/dist/owletto/dist/assets/agent-thread-B9-cdkaV.js +0 -8
- package/dist/owletto/dist/assets/agent-thread-storage-U6htL3ad.js +0 -1
- package/dist/owletto/dist/assets/agents-D0CIg4b9.js +0 -1
- package/dist/owletto/dist/assets/agents-workbench-C2sr5h82.js +0 -1
- package/dist/owletto/dist/assets/app-bridge-BH3g2mKG.js +0 -127
- package/dist/owletto/dist/assets/app._appId-DLsJ_QWS.js +0 -1
- package/dist/owletto/dist/assets/automation-detail-content-9Rjb_I9j.js +0 -1
- package/dist/owletto/dist/assets/automations-D0CIg4b9.js +0 -1
- package/dist/owletto/dist/assets/calendar-DAiyi1ZL.js +0 -1
- package/dist/owletto/dist/assets/claim-CYHnUF7G.js +0 -1
- package/dist/owletto/dist/assets/clients-Cp1BJ28u.js +0 -1
- package/dist/owletto/dist/assets/code-editor-CYsR2VBP.js +0 -15
- package/dist/owletto/dist/assets/connect-CZip2g_B.js +0 -1
- package/dist/owletto/dist/assets/connect._clientId-CEKY8Dnv.js +0 -1
- package/dist/owletto/dist/assets/connected._clientId-C5xRjxNO.js +0 -1
- package/dist/owletto/dist/assets/connection-C06HZ241.js +0 -1
- package/dist/owletto/dist/assets/connection-feed-detail-D1whY5hL.js +0 -1
- package/dist/owletto/dist/assets/consent-CfYDldcF.js +0 -1
- package/dist/owletto/dist/assets/create-C3P-3_8O.js +0 -1
- package/dist/owletto/dist/assets/create-CwnrPUEw.js +0 -1
- package/dist/owletto/dist/assets/create-DOScS9Gl.js +0 -1
- package/dist/owletto/dist/assets/create-automation-form-CuxiIRCF.js +0 -2
- package/dist/owletto/dist/assets/create._connectorKey-Bjv3lCf8.js +0 -1
- package/dist/owletto/dist/assets/deployments-ByBv1DW-.js +0 -1
- package/dist/owletto/dist/assets/deployments-C-_ECORv.js +0 -1
- package/dist/owletto/dist/assets/device-B0i7Xp8y.js +0 -1
- package/dist/owletto/dist/assets/device-automation-BIjs7DZJ.js +0 -1
- package/dist/owletto/dist/assets/device-pin-tombstone-Bd6vS2zu.js +0 -1
- package/dist/owletto/dist/assets/device-rows-Bwf8qDte.js +0 -1
- package/dist/owletto/dist/assets/device._deviceId-DJLAesm3.js +0 -1
- package/dist/owletto/dist/assets/entity-page-ijZe_1-6.js +0 -1
- package/dist/owletto/dist/assets/entity-type-page-onp2Tk_E.js +0 -1
- package/dist/owletto/dist/assets/event-page-C0B2UDY-.js +0 -1
- package/dist/owletto/dist/assets/events-feed-DK35T4g7.js +0 -1
- package/dist/owletto/dist/assets/full-page-spinner-Dd8eEaxq.js +0 -1
- package/dist/owletto/dist/assets/guardrails-DKO8_J-G.js +0 -1
- package/dist/owletto/dist/assets/identity-CKM54vrM.js +0 -1
- package/dist/owletto/dist/assets/index--VmN5WxW.js +0 -1
- package/dist/owletto/dist/assets/index-B2AmRqYh.js +0 -7898
- package/dist/owletto/dist/assets/index-B_rcEgFX.js +0 -1
- package/dist/owletto/dist/assets/index-BmAuAhub.css +0 -1
- package/dist/owletto/dist/assets/index-BmhGe6-Z.js +0 -1
- package/dist/owletto/dist/assets/index-C1dJSGrL.js +0 -1
- package/dist/owletto/dist/assets/index-CAFw4qCb.js +0 -1
- package/dist/owletto/dist/assets/index-CCcc_xBw.js +0 -52
- package/dist/owletto/dist/assets/index-CLU3gXVm.js +0 -1
- package/dist/owletto/dist/assets/index-CqQVnAY-.js +0 -1
- package/dist/owletto/dist/assets/index-CxT0uyIe.js +0 -1
- package/dist/owletto/dist/assets/index-DR08e6Ec.js +0 -1
- package/dist/owletto/dist/assets/index-DYb9L5FC.js +0 -1
- package/dist/owletto/dist/assets/index-SUUcQGT-.js +0 -1
- package/dist/owletto/dist/assets/index-SdiFOfR1.js +0 -1
- package/dist/owletto/dist/assets/index-zcfi5r1l.js +0 -1
- package/dist/owletto/dist/assets/json-diff-ClBBYBQD.js +0 -3
- package/dist/owletto/dist/assets/login-d3PdO-qV.js +0 -1
- package/dist/owletto/dist/assets/logout-DgckxwLn.js +0 -1
- package/dist/owletto/dist/assets/member-scope-gate-DXOCfx-v.js +0 -1
- package/dist/owletto/dist/assets/memory-browse-page-CeAnKoTR.js +0 -101
- package/dist/owletto/dist/assets/missing-view-DrZ8m8yo.js +0 -1
- package/dist/owletto/dist/assets/model-selector-CapL1ARf.js +0 -1
- package/dist/owletto/dist/assets/models-CB8mhq7j.js +0 -1
- package/dist/owletto/dist/assets/new-BBUb-VR4.js +0 -1
- package/dist/owletto/dist/assets/new-CBLJ25_w.js +0 -1
- package/dist/owletto/dist/assets/new-tTXB4qBW.js +0 -1
- package/dist/owletto/dist/assets/oauth-workspace-access-DearynqZ.js +0 -1
- package/dist/owletto/dist/assets/organization-BgdBg-PJ.js +0 -1
- package/dist/owletto/dist/assets/pending-seed-CPbfgnLX.js +0 -1
- package/dist/owletto/dist/assets/proposal-review-shell-D4YNrrye.js +0 -1
- package/dist/owletto/dist/assets/reset-password-B8tWPtIj.js +0 -1
- package/dist/owletto/dist/assets/runs-oHveuEUB.js +0 -1
- package/dist/owletto/dist/assets/runs-panel-C56GDaJm.js +0 -1
- package/dist/owletto/dist/assets/runs-table-BUKDjiBc.js +0 -1
- package/dist/owletto/dist/assets/schema-value-normalization-3JuM_r1H.js +0 -1
- package/dist/owletto/dist/assets/settings-DaKg6U5O.js +0 -1
- package/dist/owletto/dist/assets/settings-DhnRi2nq.js +0 -1
- package/dist/owletto/dist/assets/skills-BpQncuMC.js +0 -1
- package/dist/owletto/dist/assets/switch-BQ40_DMb.js +0 -1
- package/dist/owletto/dist/assets/use-applied-views-B-Z-Weji.js +0 -1
- package/dist/owletto/dist/assets/view-frame-C7ciEoLo.js +0 -1
- package/vendor/core/dist/contracts/worker/device-chat.d.ts +0 -4
- package/vendor/core/dist/contracts/worker/device-chat.js +0 -26
- package/vendor/core/dist/sentry.d.ts +0 -26
- package/vendor/core/dist/sentry.js +0 -133
- package/vendor/core/dist/tool-policy.d.ts +0 -74
- package/vendor/core/dist/tool-policy.js +0 -305
- package/vendor/core/dist/utils/sentry-scrubber.d.ts +0 -29
- package/vendor/core/dist/utils/sentry-scrubber.js +0 -228
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{az as U}from"./index-B2AmRqYh.js";var M={exports:{}},A;function H(){return A||(A=1,(function(L,C){(function(w,_){L.exports=_()})(globalThis,()=>(()=>{var D={949(g,p,v){Object.defineProperty(p,"__esModule",{value:!0}),p.CronParser=void 0;var i=v(515),y=(function(){function l(e,t,r){t===void 0&&(t=!0),r===void 0&&(r=!1),this.expression=e,this.dayOfWeekStartIndexZero=t,this.monthStartIndexZero=r}return l.prototype.parse=function(){var e,t,r=(e=this.expression)!==null&&e!==void 0?e:"";if(r==="@reboot")return t=["@reboot","","","","","",""],t;if(r.startsWith("@")){var n=this.parseSpecial(this.expression);t=this.extractParts(n)}else t=this.extractParts(this.expression);return this.normalize(t),this.validate(t),t},l.prototype.parseSpecial=function(e){var t={"@yearly":"0 0 1 1 *","@annually":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@midnight":"0 0 * * *","@hourly":"0 * * * *","@reboot":"@reboot"},r=t[e];if(!r)throw new Error("Unknown special expression.");return r},l.prototype.extractParts=function(e){if(!this.expression)throw new Error("cron expression is empty");for(var t=e.trim().split(/[ ]+/),r=0;r<t.length;r++)if(t[r].includes(",")){var n=t[r].split(",").map(function(a){return a.trim()}).filter(function(a){return a!==""}).map(function(a){return isNaN(Number(a))?a:Number(a)}).filter(function(a){return a!==null&&a!==""});n.length===0&&n.push("*"),n.sort(function(a,u){return a!==null&&u!==null?a-u:0}),t[r]=n.map(function(a){return a!==null?a.toString():""}).join(",")}if(t.length<5)throw new Error("Expression has only ".concat(t.length," part").concat(t.length==1?"":"s",". At least 5 parts are required."));if(t.length==5)t.unshift(""),t.push("");else if(t.length==6){var o=/\d{4}$/.test(t[5])||t[4]=="?"||t[2]=="?";o?t.unshift(""):t.push("")}else if(t.length>7)throw new Error("Expression has ".concat(t.length," parts; too many!"));return t},l.prototype.normalize=function(e){var t=this;if(e[3]=e[3].replace("?","*"),e[5]=e[5].replace("?","*"),e[2]=e[2].replace("?","*"),e[0].indexOf("0/")==0&&(e[0]=e[0].replace("0/","*/")),e[1].indexOf("0/")==0&&(e[1]=e[1].replace("0/","*/")),e[2].indexOf("0/")==0&&(e[2]=e[2].replace("0/","*/")),e[3].indexOf("1/")==0&&(e[3]=e[3].replace("1/","*/")),e[4].indexOf("1/")==0&&(e[4]=e[4].replace("1/","*/")),e[6].indexOf("1/")==0&&(e[6]=e[6].replace("1/","*/")),e[5]=e[5].replace(/(^\d)|([^#/\s]\d)/g,function(c){var d=c.replace(/\D/,""),f=d;return t.dayOfWeekStartIndexZero?d=="7"&&(f="0"):f=(parseInt(d)-1).toString(),c.replace(d,f)}),e[5]=="L"&&(e[5]="6"),e[3]=="?"&&(e[3]="*"),e[3].indexOf("W")>-1&&(e[3].indexOf(",")>-1||e[3].indexOf("-")>-1))throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");var r={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var n in r)e[5]=e[5].replace(new RegExp(n,"gi"),r[n].toString());e[4]=e[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(c){var d=c.replace(/\D/,""),f=d;return t.monthStartIndexZero&&(f=(parseInt(d)+1).toString()),c.replace(d,f)});var o={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var a in o)e[4]=e[4].replace(new RegExp(a,"gi"),o[a].toString());e[0]=="0"&&(e[0]=""),!/\*|\-|\,|\//.test(e[2])&&(/\*|\//.test(e[1])||/\*|\//.test(e[0]))&&(e[2]+="-".concat(e[2]));for(var u=0;u<e.length;u++)if(e[u].indexOf(",")!=-1&&(e[u]=e[u].split(",").filter(function(c){return c!==""}).join(",")||"*"),e[u]=="*/1"&&(e[u]="*"),e[u].indexOf("/")>-1&&!/^\*|\-|\,/.test(e[u])){var s=null;switch(u){case 4:s="12";break;case 5:s="6";break;case 6:s="9999";break;default:s=null;break}if(s!==null){var h=e[u].split("/");e[u]="".concat(h[0],"-").concat(s,"/").concat(h[1])}}},l.prototype.validate=function(e){var t="0-9,\\-*/";this.validateOnlyExpectedCharactersFound(e[0],t),this.validateOnlyExpectedCharactersFound(e[1],t),this.validateOnlyExpectedCharactersFound(e[2],t),this.validateOnlyExpectedCharactersFound(e[3],"0-9,\\-*/LW"),this.validateOnlyExpectedCharactersFound(e[4],t),this.validateOnlyExpectedCharactersFound(e[5],"0-9,\\-*/L#"),this.validateOnlyExpectedCharactersFound(e[6],t),this.validateAnyRanges(e)},l.prototype.validateAnyRanges=function(e){i.default.secondRange(e[0]),i.default.minuteRange(e[1]),i.default.hourRange(e[2]),i.default.dayOfMonthRange(e[3]),i.default.monthRange(e[4],this.monthStartIndexZero),i.default.dayOfWeekRange(e[5],this.dayOfWeekStartIndexZero)},l.prototype.validateOnlyExpectedCharactersFound=function(e,t){var r=e.match(new RegExp("[^".concat(t,"]+"),"gi"));if(r&&r.length)throw new Error("Expression contains invalid values: '".concat(r.toString(),"'"))},l})();p.CronParser=y},333(g,p,v){Object.defineProperty(p,"__esModule",{value:!0}),p.ExpressionDescriptor=void 0;var i=v(823),y=v(949),l=(function(){function e(t,r){if(this.expression=t,this.options=r,this.expressionParts=new Array(5),!this.options.locale&&e.defaultLocale&&(this.options.locale=e.defaultLocale),!e.locales[this.options.locale]){var n=Object.keys(e.locales)[0];console.warn("Locale '".concat(this.options.locale,"' could not be found; falling back to '").concat(n,"'.")),this.options.locale=n}this.i18n=e.locales[this.options.locale],r.use24HourTimeFormat===void 0&&(r.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return e.toString=function(t,r){var n=r===void 0?{}:r,o=n.throwExceptionOnParseError,a=o===void 0?!0:o,u=n.verbose,s=u===void 0?!1:u,h=n.dayOfWeekStartIndexZero,c=h===void 0?!0:h,d=n.monthStartIndexZero,f=d===void 0?!1:d,O=n.use24HourTimeFormat,T=n.trimHoursLeadingZero,m=T===void 0?!1:T,b=n.locale,E=b===void 0?null:b,X=n.logicalAndDayFields,x=X===void 0?!1:X,S={throwExceptionOnParseError:a,verbose:s,dayOfWeekStartIndexZero:c,monthStartIndexZero:f,use24HourTimeFormat:O,trimHoursLeadingZero:m,locale:E,logicalAndDayFields:x};S.tzOffset&&console.warn("'tzOffset' option has been deprecated and is no longer supported.");var I=new e(t,S);return I.getFullDescription()},e.initialize=function(t,r){r===void 0&&(r="en"),e.specialCharacters=["/","-",",","*"],e.defaultLocale=r,t.load(e.locales)},e.prototype.getFullDescription=function(){var t,r,n="";try{var o=new y.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero);if(this.expressionParts=o.parse(),this.expressionParts[0]==="@reboot")return((r=(t=this.i18n).atReboot)===null||r===void 0?void 0:r.call(t))||"Run once, at startup";var a=this.getTimeOfDayDescription(),u=this.getDayOfMonthDescription(),s=this.getMonthDescription(),h=this.getDayOfWeekDescription(),c=this.getYearDescription();n+=a+u+h+s+c,n=this.transformVerbosity(n,!!this.options.verbose),n=n.charAt(0).toLocaleUpperCase()+n.substr(1)}catch(d){if(!this.options.throwExceptionOnParseError)n=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw"".concat(d)}return n},e.prototype.getTimeOfDayDescription=function(){var t=this.expressionParts[0],r=this.expressionParts[1],n=this.expressionParts[2],o="";if(!i.StringUtilities.containsAny(r,e.specialCharacters)&&!i.StringUtilities.containsAny(n,e.specialCharacters)&&!i.StringUtilities.containsAny(t,e.specialCharacters))o+=this.i18n.atSpace()+this.formatTime(n,r,t);else if(!t&&r.indexOf("-")>-1&&!(r.indexOf(",")>-1)&&!(r.indexOf("/")>-1)&&!i.StringUtilities.containsAny(n,e.specialCharacters)){var a=r.split("-");o+=i.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(n,a[0],""),this.formatTime(n,a[1],""))}else if(!t&&n.indexOf(",")>-1&&n.indexOf("-")==-1&&n.indexOf("/")==-1&&!i.StringUtilities.containsAny(r,e.specialCharacters)){var u=n.split(",");o+=this.i18n.at();for(var s=0;s<u.length;s++)o&&(o+=" "),o+=this.formatTime(u[s],r,""),s<u.length-2&&(o+=","),s==u.length-2&&(o+=this.i18n.spaceAnd())}else{var h=this.getSecondsDescription(),c=this.getMinutesDescription(),d=this.getHoursDescription();if(o+=h,o&&c&&(o+=", "),o+=c,c===d)return o;o&&d&&(o+=", "),o+=d}return o},e.prototype.getSecondsDescription=function(){var t=this,r=this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(n){return n},function(n){return i.StringUtilities.format(t.i18n.everyX0Seconds(n),n)},function(n){return t.i18n.secondsX0ThroughX1PastTheMinute()},function(n){return n=="0"?"":parseInt(n)<20?t.i18n.atX0SecondsPastTheMinute(n):t.i18n.atX0SecondsPastTheMinuteGt20()||t.i18n.atX0SecondsPastTheMinute(n)});return r},e.prototype.getMinutesDescription=function(){var t=this,r=this.expressionParts[0],n=this.expressionParts[2],o=this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(a){return a},function(a){return i.StringUtilities.format(t.i18n.everyX0Minutes(a),a)},function(a){return t.i18n.minutesX0ThroughX1PastTheHour()},function(a){var u,s;try{return a=="0"&&n.indexOf("/")==-1&&r==""?t.i18n.everyHour():a=="0"?((s=(u=t.i18n).onTheHour)===null||s===void 0?void 0:s.call(u))||t.i18n.atX0MinutesPastTheHour(a):parseInt(a)<20?t.i18n.atX0MinutesPastTheHour(a):t.i18n.atX0MinutesPastTheHourGt20()||t.i18n.atX0MinutesPastTheHour(a)}catch{return t.i18n.atX0MinutesPastTheHour(a)}});return o},e.prototype.getHoursDescription=function(){var t=this,r=this.expressionParts[2],n=0,o=[];r.split("/")[0].split(",").forEach(function(s){var h=s.split("-");h.length===2&&o.push({value:h[1],index:n+1}),n+=h.length});var a=0,u=this.getSegmentDescription(r,this.i18n.everyHour(),function(s){var h=o.find(function(d){return d.value===s&&d.index===a}),c=h&&t.expressionParts[1]!=="0";return a++,c?t.formatTime(s,"59",""):t.formatTime(s,"0","")},function(s){return i.StringUtilities.format(t.i18n.everyX0Hours(s),s)},function(s){return t.i18n.betweenX0AndX1()},function(s){return t.i18n.atX0()});return u},e.prototype.getDayOfWeekDescription=function(){var t=this,r=this.i18n.daysOfTheWeek(),n=null;return this.expressionParts[5]=="*"?n="":n=this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(o,a){var u=o;o.indexOf("#")>-1?u=o.substring(0,o.indexOf("#")):o.indexOf("L")>-1&&(u=u.replace("L",""));var s=parseInt(u),h=t.i18n.daysOfTheWeekInCase?t.i18n.daysOfTheWeekInCase(a)[s]:r[s];if(o.indexOf("#")>-1){var c=null,d=o.substring(o.indexOf("#")+1),f=o.substring(0,o.indexOf("#"));switch(d){case"1":c=t.i18n.first(f);break;case"2":c=t.i18n.second(f);break;case"3":c=t.i18n.third(f);break;case"4":c=t.i18n.fourth(f);break;case"5":c=t.i18n.fifth(f);break}h=c+" "+h}return h},function(o){return parseInt(o)==1?"":i.StringUtilities.format(t.i18n.commaEveryX0DaysOfTheWeek(o),o)},function(o){var a=o.substring(0,o.indexOf("-")),u=t.expressionParts[3]!="*";return u?t.i18n.commaAndX0ThroughX1(a):t.i18n.commaX0ThroughX1(a)},function(o){var a=null;if(o.indexOf("#")>-1){var u=o.substring(o.indexOf("#")+1),s=o.substring(0,o.indexOf("#"));a=t.i18n.commaOnThe(u,s).trim()+t.i18n.spaceX0OfTheMonth()}else if(o.indexOf("L")>-1)a=t.i18n.commaOnTheLastX0OfTheMonth(o.replace("L",""));else{var h=t.expressionParts[3]!="*";h?t.options.logicalAndDayFields?a=t.i18n.commaOnlyOnX0(o):a=t.i18n.commaAndOnX0():a=t.i18n.commaOnlyOnX0(o)}return a}),n},e.prototype.getMonthDescription=function(){var t=this,r=this.i18n.monthsOfTheYear(),n=this.getSegmentDescription(this.expressionParts[4],"",function(o,a){return a&&t.i18n.monthsOfTheYearInCase?t.i18n.monthsOfTheYearInCase(a)[parseInt(o)-1]:r[parseInt(o)-1]},function(o){return parseInt(o)==1?"":i.StringUtilities.format(t.i18n.commaEveryX0Months(o),o)},function(o){return t.i18n.commaMonthX0ThroughMonthX1()||t.i18n.commaX0ThroughX1()},function(o){return t.i18n.commaOnlyInMonthX0?t.i18n.commaOnlyInMonthX0():t.i18n.commaOnlyInX0()});return n},e.prototype.getDayOfMonthDescription=function(){var t=this,r=null,n=this.expressionParts[3];switch(n){case"L":r=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":r=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var o=n.match(/(\d{1,2}W)|(W\d{1,2})/);if(o){var a=parseInt(o[0].replace("W","")),u=a==1?this.i18n.firstWeekday():i.StringUtilities.format(this.i18n.weekdayNearestDayX0(),a.toString());r=i.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),u);break}else{var s=n.match(/L-(\d{1,2})/);if(s){var h=s[1];r=i.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(h),h);break}else{if(n=="*"&&this.expressionParts[5]!="*")return"";r=this.getSegmentDescription(n,this.i18n.commaEveryDay(),function(c){return c=="L"?t.i18n.lastDay():t.i18n.dayX0?i.StringUtilities.format(t.i18n.dayX0(),c):c},function(c){return c=="1"?t.i18n.commaEveryDay():t.i18n.commaEveryX0Days(c)},function(c){return t.i18n.commaBetweenDayX0AndX1OfTheMonth(c)},function(c){return t.i18n.commaOnDayX0OfTheMonth(c)})}break}}return r},e.prototype.getYearDescription=function(){var t=this,r=this.getSegmentDescription(this.expressionParts[6],"",function(n){return/^\d+$/.test(n)?new Date(parseInt(n),1).getFullYear().toString():n},function(n){return i.StringUtilities.format(t.i18n.commaEveryX0Years(n),n)},function(n){return t.i18n.commaYearX0ThroughYearX1()||t.i18n.commaX0ThroughX1()},function(n){return t.i18n.commaOnlyInYearX0?t.i18n.commaOnlyInYearX0():t.i18n.commaOnlyInX0()});return r},e.prototype.getSegmentDescription=function(t,r,n,o,a,u){var s=null,h=t.indexOf("/")>-1,c=t.indexOf("-")>-1,d=t.indexOf(",")>-1;if(!t)s="";else if(t==="*")s=r;else if(!h&&!c&&!d)s=i.StringUtilities.format(u(t),n(t));else if(d){for(var f=t.split(","),O="",T=this.i18n.spaceAnd(),m=0;m<f.length;m++)if(m>0&&f.length>2&&(O+=",",m<f.length-1&&(O+=" ")),m>0&&f.length>1&&(m==f.length-1||f.length==2)&&(O+=T==","&&f.length>2?" ":"".concat(T," ")),f[m].indexOf("/")>-1||f[m].indexOf("-")>-1){var b=f[m].indexOf("-")>-1&&f[m].indexOf("/")==-1,E=this.getSegmentDescription(f[m],r,n,o,b?this.i18n.commaX0ThroughX1:a,u);b&&(E=E.replace(", ","")),O+=E}else if(!h)O+=n(f[m]);else{var X=this.getSegmentDescription(f[m],r,n,o,a,u);X&&X.startsWith(", ")&&(X=X.substring(2)),O+=X}h?s=O:s=i.StringUtilities.format(u(t),O)}else if(h){var f=t.split("/");if(s=i.StringUtilities.format(o(f[1]),f[1]),f[0].indexOf("-")>-1){var x=this.generateRangeSegmentDescription(f[0],a,n);x.indexOf(", ")!=0&&(s+=", "),s+=x}else if(f[0].indexOf("*")==-1){var S=i.StringUtilities.format(u(f[0]),n(f[0]));S=S.replace(", ",""),s+=i.StringUtilities.format(this.i18n.commaStartingX0(),S)}}else c&&(s=this.generateRangeSegmentDescription(t,a,n));return s},e.prototype.generateRangeSegmentDescription=function(t,r,n){var o="",a=t.split("-"),u=n(a[0],1),s=n(a[1],2),h=r(t);return o+=i.StringUtilities.format(h,u,s),o},e.prototype.formatTime=function(t,r,n){var o=0,a=0,u=parseInt(t)+o,s=parseInt(r)+a;s>=60?(s-=60,u+=1):s<0&&(s+=60,u-=1),u>=24?u=u-24:u<0&&(u=24+u);var h="",c=!1;this.options.use24HourTimeFormat||(c=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),h=c?"".concat(this.getPeriod(u)," "):" ".concat(this.getPeriod(u)),u>12&&(u-=12),u===0&&(u=12));var d="";n&&(d=":".concat(("00"+n).substring(n.length)));var f=u.toString(),O=("00"+f).substring(f.length),T=s.toString(),m=("00"+T).substring(T.length),b=this.options.trimHoursLeadingZero?f:O;return"".concat(c?h:"").concat(b,":").concat(m).concat(d).concat(c?"":h)},e.prototype.transformVerbosity=function(t,r){if(!r&&(t=t.replace(new RegExp(", ".concat(this.i18n.everyMinute()),"g"),""),t=t.replace(new RegExp(", ".concat(this.i18n.everyHour()),"g"),""),t=t.replace(new RegExp(this.i18n.commaEveryDay(),"g"),""),t=t.replace(/\, ?$/,""),this.i18n.conciseVerbosityReplacements))for(var n=0,o=Object.entries(this.i18n.conciseVerbosityReplacements());n<o.length;n++){var a=o[n],u=a[0],s=a[1];t=t.replace(new RegExp(u,"g"),s)}return t},e.prototype.getPeriod=function(t){return t>=12?this.i18n.pm&&this.i18n.pm()||"PM":this.i18n.am&&this.i18n.am()||"AM"},e.locales={},e})();p.ExpressionDescriptor=l},747(g,p,v){Object.defineProperty(p,"__esModule",{value:!0}),p.enLocaleLoader=void 0;var i=v(486),y=(function(){function l(){}return l.prototype.load=function(e){e.en=new i.en},l})();p.enLocaleLoader=y},486(g,p){Object.defineProperty(p,"__esModule",{value:!0}),p.en=void 0;var v=(function(){function i(){}return i.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},i.prototype.atX0MinutesPastTheHourGt20=function(){return null},i.prototype.commaMonthX0ThroughMonthX1=function(){return null},i.prototype.commaYearX0ThroughYearX1=function(){return null},i.prototype.use24HourTimeFormatByDefault=function(){return!1},i.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occurred when generating the expression description. Check the cron expression syntax."},i.prototype.everyMinute=function(){return"every minute"},i.prototype.everyHour=function(){return"every hour"},i.prototype.atSpace=function(){return"At "},i.prototype.everyMinuteBetweenX0AndX1=function(){return"Every minute between %s and %s"},i.prototype.at=function(){return"At"},i.prototype.spaceAnd=function(){return" and"},i.prototype.everySecond=function(){return"every second"},i.prototype.everyX0Seconds=function(){return"every %s seconds"},i.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},i.prototype.atX0SecondsPastTheMinute=function(){return"at %s seconds past the minute"},i.prototype.everyX0Minutes=function(){return"every %s minutes"},i.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},i.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},i.prototype.everyX0Hours=function(){return"every %s hours"},i.prototype.betweenX0AndX1=function(){return"between %s and %s"},i.prototype.atX0=function(){return"at %s"},i.prototype.commaEveryDay=function(){return", every day"},i.prototype.commaEveryX0DaysOfTheWeek=function(){return", every %s days of the week"},i.prototype.commaX0ThroughX1=function(){return", %s through %s"},i.prototype.commaAndX0ThroughX1=function(){return", %s through %s"},i.prototype.first=function(){return"first"},i.prototype.second=function(){return"second"},i.prototype.third=function(){return"third"},i.prototype.fourth=function(){return"fourth"},i.prototype.fifth=function(){return"fifth"},i.prototype.commaOnThe=function(){return", on the "},i.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},i.prototype.lastDay=function(){return"the last day"},i.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},i.prototype.commaOnlyOnX0=function(){return", only on %s"},i.prototype.commaAndOnX0=function(){return", and on %s"},i.prototype.commaEveryX0Months=function(){return", every %s months"},i.prototype.commaOnlyInX0=function(){return", only in %s"},i.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},i.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},i.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s days before the last day of the month"},i.prototype.firstWeekday=function(){return"first weekday"},i.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},i.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},i.prototype.commaEveryX0Days=function(){return", every %s days in a month"},i.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},i.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},i.prototype.commaEveryHour=function(){return", every hour"},i.prototype.commaEveryX0Years=function(){return", every %s years"},i.prototype.commaStartingX0=function(){return", starting %s"},i.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},i.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},i.prototype.atReboot=function(){return"Run once, at startup"},i.prototype.onTheHour=function(){return"on the hour"},i})();p.en=v},515(g,p){Object.defineProperty(p,"__esModule",{value:!0});function v(y,l){if(!y)throw new Error(l)}var i=(function(){function y(){}return y.secondRange=function(l){for(var e=l.split(","),t=0;t<e.length;t++)if(!isNaN(parseInt(e[t],10))){var r=parseInt(e[t],10);v(r>=0&&r<=59,"seconds part must be >= 0 and <= 59")}},y.minuteRange=function(l){for(var e=l.split(","),t=0;t<e.length;t++)if(!isNaN(parseInt(e[t],10))){var r=parseInt(e[t],10);v(r>=0&&r<=59,"minutes part must be >= 0 and <= 59")}},y.hourRange=function(l){for(var e=l.split(","),t=0;t<e.length;t++)if(!isNaN(parseInt(e[t],10))){var r=parseInt(e[t],10);v(r>=0&&r<=23,"hours part must be >= 0 and <= 23")}},y.dayOfMonthRange=function(l){for(var e=l.split(","),t=0;t<e.length;t++)if(!isNaN(parseInt(e[t],10))){var r=parseInt(e[t],10);v(r>=1&&r<=31,"DOM part must be >= 1 and <= 31")}},y.monthRange=function(l,e){for(var t=l.split(","),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var n=parseInt(t[r],10);v(n>=1&&n<=12,e?"month part must be >= 0 and <= 11":"month part must be >= 1 and <= 12")}},y.dayOfWeekRange=function(l,e){for(var t=l.split(","),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var n=parseInt(t[r],10);v(n>=0&&n<=6,e?"DOW part must be >= 0 and <= 6":"DOW part must be >= 1 and <= 7")}},y})();p.default=i},823(g,p){Object.defineProperty(p,"__esModule",{value:!0}),p.StringUtilities=void 0;var v=(function(){function i(){}return i.format=function(y){for(var l=[],e=1;e<arguments.length;e++)l[e-1]=arguments[e];return y.replace(/%s/g,function(t){return l.shift()})},i.containsAny=function(y,l){return l.some(function(e){return y.indexOf(e)>-1})},i})();p.StringUtilities=v}},w={};function _(g){var p=w[g];if(p!==void 0)return p.exports;var v=w[g]={exports:{}};return D[g](v,v.exports,_),v.exports}var k={};return(()=>{var g=k;Object.defineProperty(g,"__esModule",{value:!0}),g.toString=void 0;var p=_(333),v=_(747);p.ExpressionDescriptor.initialize(new v.enLocaleLoader),g.default=p.ExpressionDescriptor;var i=p.ExpressionDescriptor.toString;g.toString=i})(),k})())})(M)),M.exports}var R=H();const F=U(R);export{F as c};
|
|
1
|
+
import{eo as U}from"./index-Cr5hwh-C.js";var M={exports:{}},A;function H(){return A||(A=1,(function(L,C){(function(w,_){L.exports=_()})(globalThis,()=>(()=>{var D={949(g,p,v){Object.defineProperty(p,"__esModule",{value:!0}),p.CronParser=void 0;var i=v(515),y=(function(){function l(e,t,r){t===void 0&&(t=!0),r===void 0&&(r=!1),this.expression=e,this.dayOfWeekStartIndexZero=t,this.monthStartIndexZero=r}return l.prototype.parse=function(){var e,t,r=(e=this.expression)!==null&&e!==void 0?e:"";if(r==="@reboot")return t=["@reboot","","","","","",""],t;if(r.startsWith("@")){var n=this.parseSpecial(this.expression);t=this.extractParts(n)}else t=this.extractParts(this.expression);return this.normalize(t),this.validate(t),t},l.prototype.parseSpecial=function(e){var t={"@yearly":"0 0 1 1 *","@annually":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@midnight":"0 0 * * *","@hourly":"0 * * * *","@reboot":"@reboot"},r=t[e];if(!r)throw new Error("Unknown special expression.");return r},l.prototype.extractParts=function(e){if(!this.expression)throw new Error("cron expression is empty");for(var t=e.trim().split(/[ ]+/),r=0;r<t.length;r++)if(t[r].includes(",")){var n=t[r].split(",").map(function(a){return a.trim()}).filter(function(a){return a!==""}).map(function(a){return isNaN(Number(a))?a:Number(a)}).filter(function(a){return a!==null&&a!==""});n.length===0&&n.push("*"),n.sort(function(a,u){return a!==null&&u!==null?a-u:0}),t[r]=n.map(function(a){return a!==null?a.toString():""}).join(",")}if(t.length<5)throw new Error("Expression has only ".concat(t.length," part").concat(t.length==1?"":"s",". At least 5 parts are required."));if(t.length==5)t.unshift(""),t.push("");else if(t.length==6){var o=/\d{4}$/.test(t[5])||t[4]=="?"||t[2]=="?";o?t.unshift(""):t.push("")}else if(t.length>7)throw new Error("Expression has ".concat(t.length," parts; too many!"));return t},l.prototype.normalize=function(e){var t=this;if(e[3]=e[3].replace("?","*"),e[5]=e[5].replace("?","*"),e[2]=e[2].replace("?","*"),e[0].indexOf("0/")==0&&(e[0]=e[0].replace("0/","*/")),e[1].indexOf("0/")==0&&(e[1]=e[1].replace("0/","*/")),e[2].indexOf("0/")==0&&(e[2]=e[2].replace("0/","*/")),e[3].indexOf("1/")==0&&(e[3]=e[3].replace("1/","*/")),e[4].indexOf("1/")==0&&(e[4]=e[4].replace("1/","*/")),e[6].indexOf("1/")==0&&(e[6]=e[6].replace("1/","*/")),e[5]=e[5].replace(/(^\d)|([^#/\s]\d)/g,function(c){var d=c.replace(/\D/,""),f=d;return t.dayOfWeekStartIndexZero?d=="7"&&(f="0"):f=(parseInt(d)-1).toString(),c.replace(d,f)}),e[5]=="L"&&(e[5]="6"),e[3]=="?"&&(e[3]="*"),e[3].indexOf("W")>-1&&(e[3].indexOf(",")>-1||e[3].indexOf("-")>-1))throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");var r={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var n in r)e[5]=e[5].replace(new RegExp(n,"gi"),r[n].toString());e[4]=e[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(c){var d=c.replace(/\D/,""),f=d;return t.monthStartIndexZero&&(f=(parseInt(d)+1).toString()),c.replace(d,f)});var o={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var a in o)e[4]=e[4].replace(new RegExp(a,"gi"),o[a].toString());e[0]=="0"&&(e[0]=""),!/\*|\-|\,|\//.test(e[2])&&(/\*|\//.test(e[1])||/\*|\//.test(e[0]))&&(e[2]+="-".concat(e[2]));for(var u=0;u<e.length;u++)if(e[u].indexOf(",")!=-1&&(e[u]=e[u].split(",").filter(function(c){return c!==""}).join(",")||"*"),e[u]=="*/1"&&(e[u]="*"),e[u].indexOf("/")>-1&&!/^\*|\-|\,/.test(e[u])){var s=null;switch(u){case 4:s="12";break;case 5:s="6";break;case 6:s="9999";break;default:s=null;break}if(s!==null){var h=e[u].split("/");e[u]="".concat(h[0],"-").concat(s,"/").concat(h[1])}}},l.prototype.validate=function(e){var t="0-9,\\-*/";this.validateOnlyExpectedCharactersFound(e[0],t),this.validateOnlyExpectedCharactersFound(e[1],t),this.validateOnlyExpectedCharactersFound(e[2],t),this.validateOnlyExpectedCharactersFound(e[3],"0-9,\\-*/LW"),this.validateOnlyExpectedCharactersFound(e[4],t),this.validateOnlyExpectedCharactersFound(e[5],"0-9,\\-*/L#"),this.validateOnlyExpectedCharactersFound(e[6],t),this.validateAnyRanges(e)},l.prototype.validateAnyRanges=function(e){i.default.secondRange(e[0]),i.default.minuteRange(e[1]),i.default.hourRange(e[2]),i.default.dayOfMonthRange(e[3]),i.default.monthRange(e[4],this.monthStartIndexZero),i.default.dayOfWeekRange(e[5],this.dayOfWeekStartIndexZero)},l.prototype.validateOnlyExpectedCharactersFound=function(e,t){var r=e.match(new RegExp("[^".concat(t,"]+"),"gi"));if(r&&r.length)throw new Error("Expression contains invalid values: '".concat(r.toString(),"'"))},l})();p.CronParser=y},333(g,p,v){Object.defineProperty(p,"__esModule",{value:!0}),p.ExpressionDescriptor=void 0;var i=v(823),y=v(949),l=(function(){function e(t,r){if(this.expression=t,this.options=r,this.expressionParts=new Array(5),!this.options.locale&&e.defaultLocale&&(this.options.locale=e.defaultLocale),!e.locales[this.options.locale]){var n=Object.keys(e.locales)[0];console.warn("Locale '".concat(this.options.locale,"' could not be found; falling back to '").concat(n,"'.")),this.options.locale=n}this.i18n=e.locales[this.options.locale],r.use24HourTimeFormat===void 0&&(r.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return e.toString=function(t,r){var n=r===void 0?{}:r,o=n.throwExceptionOnParseError,a=o===void 0?!0:o,u=n.verbose,s=u===void 0?!1:u,h=n.dayOfWeekStartIndexZero,c=h===void 0?!0:h,d=n.monthStartIndexZero,f=d===void 0?!1:d,O=n.use24HourTimeFormat,T=n.trimHoursLeadingZero,m=T===void 0?!1:T,b=n.locale,E=b===void 0?null:b,X=n.logicalAndDayFields,x=X===void 0?!1:X,S={throwExceptionOnParseError:a,verbose:s,dayOfWeekStartIndexZero:c,monthStartIndexZero:f,use24HourTimeFormat:O,trimHoursLeadingZero:m,locale:E,logicalAndDayFields:x};S.tzOffset&&console.warn("'tzOffset' option has been deprecated and is no longer supported.");var I=new e(t,S);return I.getFullDescription()},e.initialize=function(t,r){r===void 0&&(r="en"),e.specialCharacters=["/","-",",","*"],e.defaultLocale=r,t.load(e.locales)},e.prototype.getFullDescription=function(){var t,r,n="";try{var o=new y.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero);if(this.expressionParts=o.parse(),this.expressionParts[0]==="@reboot")return((r=(t=this.i18n).atReboot)===null||r===void 0?void 0:r.call(t))||"Run once, at startup";var a=this.getTimeOfDayDescription(),u=this.getDayOfMonthDescription(),s=this.getMonthDescription(),h=this.getDayOfWeekDescription(),c=this.getYearDescription();n+=a+u+h+s+c,n=this.transformVerbosity(n,!!this.options.verbose),n=n.charAt(0).toLocaleUpperCase()+n.substr(1)}catch(d){if(!this.options.throwExceptionOnParseError)n=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw"".concat(d)}return n},e.prototype.getTimeOfDayDescription=function(){var t=this.expressionParts[0],r=this.expressionParts[1],n=this.expressionParts[2],o="";if(!i.StringUtilities.containsAny(r,e.specialCharacters)&&!i.StringUtilities.containsAny(n,e.specialCharacters)&&!i.StringUtilities.containsAny(t,e.specialCharacters))o+=this.i18n.atSpace()+this.formatTime(n,r,t);else if(!t&&r.indexOf("-")>-1&&!(r.indexOf(",")>-1)&&!(r.indexOf("/")>-1)&&!i.StringUtilities.containsAny(n,e.specialCharacters)){var a=r.split("-");o+=i.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(n,a[0],""),this.formatTime(n,a[1],""))}else if(!t&&n.indexOf(",")>-1&&n.indexOf("-")==-1&&n.indexOf("/")==-1&&!i.StringUtilities.containsAny(r,e.specialCharacters)){var u=n.split(",");o+=this.i18n.at();for(var s=0;s<u.length;s++)o&&(o+=" "),o+=this.formatTime(u[s],r,""),s<u.length-2&&(o+=","),s==u.length-2&&(o+=this.i18n.spaceAnd())}else{var h=this.getSecondsDescription(),c=this.getMinutesDescription(),d=this.getHoursDescription();if(o+=h,o&&c&&(o+=", "),o+=c,c===d)return o;o&&d&&(o+=", "),o+=d}return o},e.prototype.getSecondsDescription=function(){var t=this,r=this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(n){return n},function(n){return i.StringUtilities.format(t.i18n.everyX0Seconds(n),n)},function(n){return t.i18n.secondsX0ThroughX1PastTheMinute()},function(n){return n=="0"?"":parseInt(n)<20?t.i18n.atX0SecondsPastTheMinute(n):t.i18n.atX0SecondsPastTheMinuteGt20()||t.i18n.atX0SecondsPastTheMinute(n)});return r},e.prototype.getMinutesDescription=function(){var t=this,r=this.expressionParts[0],n=this.expressionParts[2],o=this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(a){return a},function(a){return i.StringUtilities.format(t.i18n.everyX0Minutes(a),a)},function(a){return t.i18n.minutesX0ThroughX1PastTheHour()},function(a){var u,s;try{return a=="0"&&n.indexOf("/")==-1&&r==""?t.i18n.everyHour():a=="0"?((s=(u=t.i18n).onTheHour)===null||s===void 0?void 0:s.call(u))||t.i18n.atX0MinutesPastTheHour(a):parseInt(a)<20?t.i18n.atX0MinutesPastTheHour(a):t.i18n.atX0MinutesPastTheHourGt20()||t.i18n.atX0MinutesPastTheHour(a)}catch{return t.i18n.atX0MinutesPastTheHour(a)}});return o},e.prototype.getHoursDescription=function(){var t=this,r=this.expressionParts[2],n=0,o=[];r.split("/")[0].split(",").forEach(function(s){var h=s.split("-");h.length===2&&o.push({value:h[1],index:n+1}),n+=h.length});var a=0,u=this.getSegmentDescription(r,this.i18n.everyHour(),function(s){var h=o.find(function(d){return d.value===s&&d.index===a}),c=h&&t.expressionParts[1]!=="0";return a++,c?t.formatTime(s,"59",""):t.formatTime(s,"0","")},function(s){return i.StringUtilities.format(t.i18n.everyX0Hours(s),s)},function(s){return t.i18n.betweenX0AndX1()},function(s){return t.i18n.atX0()});return u},e.prototype.getDayOfWeekDescription=function(){var t=this,r=this.i18n.daysOfTheWeek(),n=null;return this.expressionParts[5]=="*"?n="":n=this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(o,a){var u=o;o.indexOf("#")>-1?u=o.substring(0,o.indexOf("#")):o.indexOf("L")>-1&&(u=u.replace("L",""));var s=parseInt(u),h=t.i18n.daysOfTheWeekInCase?t.i18n.daysOfTheWeekInCase(a)[s]:r[s];if(o.indexOf("#")>-1){var c=null,d=o.substring(o.indexOf("#")+1),f=o.substring(0,o.indexOf("#"));switch(d){case"1":c=t.i18n.first(f);break;case"2":c=t.i18n.second(f);break;case"3":c=t.i18n.third(f);break;case"4":c=t.i18n.fourth(f);break;case"5":c=t.i18n.fifth(f);break}h=c+" "+h}return h},function(o){return parseInt(o)==1?"":i.StringUtilities.format(t.i18n.commaEveryX0DaysOfTheWeek(o),o)},function(o){var a=o.substring(0,o.indexOf("-")),u=t.expressionParts[3]!="*";return u?t.i18n.commaAndX0ThroughX1(a):t.i18n.commaX0ThroughX1(a)},function(o){var a=null;if(o.indexOf("#")>-1){var u=o.substring(o.indexOf("#")+1),s=o.substring(0,o.indexOf("#"));a=t.i18n.commaOnThe(u,s).trim()+t.i18n.spaceX0OfTheMonth()}else if(o.indexOf("L")>-1)a=t.i18n.commaOnTheLastX0OfTheMonth(o.replace("L",""));else{var h=t.expressionParts[3]!="*";h?t.options.logicalAndDayFields?a=t.i18n.commaOnlyOnX0(o):a=t.i18n.commaAndOnX0():a=t.i18n.commaOnlyOnX0(o)}return a}),n},e.prototype.getMonthDescription=function(){var t=this,r=this.i18n.monthsOfTheYear(),n=this.getSegmentDescription(this.expressionParts[4],"",function(o,a){return a&&t.i18n.monthsOfTheYearInCase?t.i18n.monthsOfTheYearInCase(a)[parseInt(o)-1]:r[parseInt(o)-1]},function(o){return parseInt(o)==1?"":i.StringUtilities.format(t.i18n.commaEveryX0Months(o),o)},function(o){return t.i18n.commaMonthX0ThroughMonthX1()||t.i18n.commaX0ThroughX1()},function(o){return t.i18n.commaOnlyInMonthX0?t.i18n.commaOnlyInMonthX0():t.i18n.commaOnlyInX0()});return n},e.prototype.getDayOfMonthDescription=function(){var t=this,r=null,n=this.expressionParts[3];switch(n){case"L":r=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":r=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var o=n.match(/(\d{1,2}W)|(W\d{1,2})/);if(o){var a=parseInt(o[0].replace("W","")),u=a==1?this.i18n.firstWeekday():i.StringUtilities.format(this.i18n.weekdayNearestDayX0(),a.toString());r=i.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),u);break}else{var s=n.match(/L-(\d{1,2})/);if(s){var h=s[1];r=i.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(h),h);break}else{if(n=="*"&&this.expressionParts[5]!="*")return"";r=this.getSegmentDescription(n,this.i18n.commaEveryDay(),function(c){return c=="L"?t.i18n.lastDay():t.i18n.dayX0?i.StringUtilities.format(t.i18n.dayX0(),c):c},function(c){return c=="1"?t.i18n.commaEveryDay():t.i18n.commaEveryX0Days(c)},function(c){return t.i18n.commaBetweenDayX0AndX1OfTheMonth(c)},function(c){return t.i18n.commaOnDayX0OfTheMonth(c)})}break}}return r},e.prototype.getYearDescription=function(){var t=this,r=this.getSegmentDescription(this.expressionParts[6],"",function(n){return/^\d+$/.test(n)?new Date(parseInt(n),1).getFullYear().toString():n},function(n){return i.StringUtilities.format(t.i18n.commaEveryX0Years(n),n)},function(n){return t.i18n.commaYearX0ThroughYearX1()||t.i18n.commaX0ThroughX1()},function(n){return t.i18n.commaOnlyInYearX0?t.i18n.commaOnlyInYearX0():t.i18n.commaOnlyInX0()});return r},e.prototype.getSegmentDescription=function(t,r,n,o,a,u){var s=null,h=t.indexOf("/")>-1,c=t.indexOf("-")>-1,d=t.indexOf(",")>-1;if(!t)s="";else if(t==="*")s=r;else if(!h&&!c&&!d)s=i.StringUtilities.format(u(t),n(t));else if(d){for(var f=t.split(","),O="",T=this.i18n.spaceAnd(),m=0;m<f.length;m++)if(m>0&&f.length>2&&(O+=",",m<f.length-1&&(O+=" ")),m>0&&f.length>1&&(m==f.length-1||f.length==2)&&(O+=T==","&&f.length>2?" ":"".concat(T," ")),f[m].indexOf("/")>-1||f[m].indexOf("-")>-1){var b=f[m].indexOf("-")>-1&&f[m].indexOf("/")==-1,E=this.getSegmentDescription(f[m],r,n,o,b?this.i18n.commaX0ThroughX1:a,u);b&&(E=E.replace(", ","")),O+=E}else if(!h)O+=n(f[m]);else{var X=this.getSegmentDescription(f[m],r,n,o,a,u);X&&X.startsWith(", ")&&(X=X.substring(2)),O+=X}h?s=O:s=i.StringUtilities.format(u(t),O)}else if(h){var f=t.split("/");if(s=i.StringUtilities.format(o(f[1]),f[1]),f[0].indexOf("-")>-1){var x=this.generateRangeSegmentDescription(f[0],a,n);x.indexOf(", ")!=0&&(s+=", "),s+=x}else if(f[0].indexOf("*")==-1){var S=i.StringUtilities.format(u(f[0]),n(f[0]));S=S.replace(", ",""),s+=i.StringUtilities.format(this.i18n.commaStartingX0(),S)}}else c&&(s=this.generateRangeSegmentDescription(t,a,n));return s},e.prototype.generateRangeSegmentDescription=function(t,r,n){var o="",a=t.split("-"),u=n(a[0],1),s=n(a[1],2),h=r(t);return o+=i.StringUtilities.format(h,u,s),o},e.prototype.formatTime=function(t,r,n){var o=0,a=0,u=parseInt(t)+o,s=parseInt(r)+a;s>=60?(s-=60,u+=1):s<0&&(s+=60,u-=1),u>=24?u=u-24:u<0&&(u=24+u);var h="",c=!1;this.options.use24HourTimeFormat||(c=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),h=c?"".concat(this.getPeriod(u)," "):" ".concat(this.getPeriod(u)),u>12&&(u-=12),u===0&&(u=12));var d="";n&&(d=":".concat(("00"+n).substring(n.length)));var f=u.toString(),O=("00"+f).substring(f.length),T=s.toString(),m=("00"+T).substring(T.length),b=this.options.trimHoursLeadingZero?f:O;return"".concat(c?h:"").concat(b,":").concat(m).concat(d).concat(c?"":h)},e.prototype.transformVerbosity=function(t,r){if(!r&&(t=t.replace(new RegExp(", ".concat(this.i18n.everyMinute()),"g"),""),t=t.replace(new RegExp(", ".concat(this.i18n.everyHour()),"g"),""),t=t.replace(new RegExp(this.i18n.commaEveryDay(),"g"),""),t=t.replace(/\, ?$/,""),this.i18n.conciseVerbosityReplacements))for(var n=0,o=Object.entries(this.i18n.conciseVerbosityReplacements());n<o.length;n++){var a=o[n],u=a[0],s=a[1];t=t.replace(new RegExp(u,"g"),s)}return t},e.prototype.getPeriod=function(t){return t>=12?this.i18n.pm&&this.i18n.pm()||"PM":this.i18n.am&&this.i18n.am()||"AM"},e.locales={},e})();p.ExpressionDescriptor=l},747(g,p,v){Object.defineProperty(p,"__esModule",{value:!0}),p.enLocaleLoader=void 0;var i=v(486),y=(function(){function l(){}return l.prototype.load=function(e){e.en=new i.en},l})();p.enLocaleLoader=y},486(g,p){Object.defineProperty(p,"__esModule",{value:!0}),p.en=void 0;var v=(function(){function i(){}return i.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},i.prototype.atX0MinutesPastTheHourGt20=function(){return null},i.prototype.commaMonthX0ThroughMonthX1=function(){return null},i.prototype.commaYearX0ThroughYearX1=function(){return null},i.prototype.use24HourTimeFormatByDefault=function(){return!1},i.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occurred when generating the expression description. Check the cron expression syntax."},i.prototype.everyMinute=function(){return"every minute"},i.prototype.everyHour=function(){return"every hour"},i.prototype.atSpace=function(){return"At "},i.prototype.everyMinuteBetweenX0AndX1=function(){return"Every minute between %s and %s"},i.prototype.at=function(){return"At"},i.prototype.spaceAnd=function(){return" and"},i.prototype.everySecond=function(){return"every second"},i.prototype.everyX0Seconds=function(){return"every %s seconds"},i.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},i.prototype.atX0SecondsPastTheMinute=function(){return"at %s seconds past the minute"},i.prototype.everyX0Minutes=function(){return"every %s minutes"},i.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},i.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},i.prototype.everyX0Hours=function(){return"every %s hours"},i.prototype.betweenX0AndX1=function(){return"between %s and %s"},i.prototype.atX0=function(){return"at %s"},i.prototype.commaEveryDay=function(){return", every day"},i.prototype.commaEveryX0DaysOfTheWeek=function(){return", every %s days of the week"},i.prototype.commaX0ThroughX1=function(){return", %s through %s"},i.prototype.commaAndX0ThroughX1=function(){return", %s through %s"},i.prototype.first=function(){return"first"},i.prototype.second=function(){return"second"},i.prototype.third=function(){return"third"},i.prototype.fourth=function(){return"fourth"},i.prototype.fifth=function(){return"fifth"},i.prototype.commaOnThe=function(){return", on the "},i.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},i.prototype.lastDay=function(){return"the last day"},i.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},i.prototype.commaOnlyOnX0=function(){return", only on %s"},i.prototype.commaAndOnX0=function(){return", and on %s"},i.prototype.commaEveryX0Months=function(){return", every %s months"},i.prototype.commaOnlyInX0=function(){return", only in %s"},i.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},i.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},i.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s days before the last day of the month"},i.prototype.firstWeekday=function(){return"first weekday"},i.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},i.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},i.prototype.commaEveryX0Days=function(){return", every %s days in a month"},i.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},i.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},i.prototype.commaEveryHour=function(){return", every hour"},i.prototype.commaEveryX0Years=function(){return", every %s years"},i.prototype.commaStartingX0=function(){return", starting %s"},i.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},i.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},i.prototype.atReboot=function(){return"Run once, at startup"},i.prototype.onTheHour=function(){return"on the hour"},i})();p.en=v},515(g,p){Object.defineProperty(p,"__esModule",{value:!0});function v(y,l){if(!y)throw new Error(l)}var i=(function(){function y(){}return y.secondRange=function(l){for(var e=l.split(","),t=0;t<e.length;t++)if(!isNaN(parseInt(e[t],10))){var r=parseInt(e[t],10);v(r>=0&&r<=59,"seconds part must be >= 0 and <= 59")}},y.minuteRange=function(l){for(var e=l.split(","),t=0;t<e.length;t++)if(!isNaN(parseInt(e[t],10))){var r=parseInt(e[t],10);v(r>=0&&r<=59,"minutes part must be >= 0 and <= 59")}},y.hourRange=function(l){for(var e=l.split(","),t=0;t<e.length;t++)if(!isNaN(parseInt(e[t],10))){var r=parseInt(e[t],10);v(r>=0&&r<=23,"hours part must be >= 0 and <= 23")}},y.dayOfMonthRange=function(l){for(var e=l.split(","),t=0;t<e.length;t++)if(!isNaN(parseInt(e[t],10))){var r=parseInt(e[t],10);v(r>=1&&r<=31,"DOM part must be >= 1 and <= 31")}},y.monthRange=function(l,e){for(var t=l.split(","),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var n=parseInt(t[r],10);v(n>=1&&n<=12,e?"month part must be >= 0 and <= 11":"month part must be >= 1 and <= 12")}},y.dayOfWeekRange=function(l,e){for(var t=l.split(","),r=0;r<t.length;r++)if(!isNaN(parseInt(t[r],10))){var n=parseInt(t[r],10);v(n>=0&&n<=6,e?"DOW part must be >= 0 and <= 6":"DOW part must be >= 1 and <= 7")}},y})();p.default=i},823(g,p){Object.defineProperty(p,"__esModule",{value:!0}),p.StringUtilities=void 0;var v=(function(){function i(){}return i.format=function(y){for(var l=[],e=1;e<arguments.length;e++)l[e-1]=arguments[e];return y.replace(/%s/g,function(t){return l.shift()})},i.containsAny=function(y,l){return l.some(function(e){return y.indexOf(e)>-1})},i})();p.StringUtilities=v}},w={};function _(g){var p=w[g];if(p!==void 0)return p.exports;var v=w[g]={exports:{}};return D[g](v,v.exports,_),v.exports}var k={};return(()=>{var g=k;Object.defineProperty(g,"__esModule",{value:!0}),g.toString=void 0;var p=_(333),v=_(747);p.ExpressionDescriptor.initialize(new v.enLocaleLoader),g.default=p.ExpressionDescriptor;var i=p.ExpressionDescriptor.toString;g.toString=i})(),k})())})(M)),M.exports}var R=H();const F=U(R);export{F as c};
|
|
2
|
+
//# sourceMappingURL=cronstrue-n4qGUraE.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{cb as r,e8 as l,V as i,di as u,cc as c,H as d}from"./index-Cr5hwh-C.js";function o(e,n=""){return`${d}/api/${e}/deployments${n}`}const y=50;function f(e){const{slug:n}=r();return l({queryKey:["deployments-feed",n,e?.resourceKind,e?.resourceId],queryFn:async({pageParam:t})=>{const a=new URLSearchParams({limit:String(y)});t!==null&&a.set("before_id",String(t)),e&&(a.set("resource_kind",e.resourceKind),a.set("resource_id",e.resourceId));const s=await i(o(n,`?${a.toString()}`),{credentials:"include"});return s.status===404?{items:[],has_more:!1}:(await u(s,"Failed to fetch deployments"),await s.json())},initialPageParam:null,getNextPageParam:t=>t.has_more?t.items[t.items.length-1]?.id:void 0,enabled:!!n,staleTime:15e3,retry:!1})}function h(e){const{slug:n}=r();return c({queryKey:["deployment-detail",n,e],queryFn:async()=>{const t=await i(o(n,`/${e}`),{credentials:"include"});return t.status===404?null:(await u(t,"Failed to fetch deployment"),await t.json())},enabled:!!n&&!!e,staleTime:15e3,retry:!1})}function g(e){const{slug:n}=r();return c({queryKey:["deployment-change-detail",n,e],queryFn:async()=>{const t=await i(o(n,`/changes/${e}`),{credentials:"include"});return t.status===404?null:(await u(t,"Failed to fetch change"),(await t.json()).change)},enabled:!!n&&!!e,staleTime:15e3,retry:!1})}export{g as a,h as b,f as u};
|
|
2
|
+
//# sourceMappingURL=deployments-RvUdVkj3.js.map
|
package/dist/owletto/dist/assets/{deployments-body-Bm2upStd.js → deployments-body-BMp7UsMo.js}
RENAMED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{j as a,
|
|
1
|
+
import{j as a,bx as x,bK as p,aQ as m,gW as c,B as f,bc as o,L as i,gX as h,M as r}from"./index-Cr5hwh-C.js";import{u as g}from"./deployments-RvUdVkj3.js";function y(e){return e==="partial_failure"?a.jsx(r,{variant:"destructive",children:"Partial failure"}):e==="succeeded"?a.jsx(r,{variant:"secondary",children:"Succeeded"}):null}function j(e){switch(e){case"created":return a.jsx(r,{variant:"default",children:"Created"});case"updated":return a.jsx(r,{variant:"secondary",children:"Updated"});case"deleted":return a.jsx(r,{variant:"destructive",children:"Deleted"});default:return null}}function N(e){if(!e)return null;const t=[e.create?`${e.create} created`:null,e.update?`${e.update} updated`:null,e.delete?`${e.delete} deleted`:null].filter(n=>n!==null);return t.length>0?t.join(" · "):"no changes"}const u="flex items-start gap-3 px-3 py-2.5 transition-colors hover:bg-accent/50";function B({owner:e}){const t=g(),n=t.data?.pages.flatMap(s=>s.items)??[];return t.isLoading?a.jsx("div",{className:"max-w-3xl",children:a.jsx(x,{label:"deployments"})}):t.isError?a.jsx(p,{label:"deployments"}):n.length===0?a.jsx(m,{icon:c,title:"No deployments yet",description:"lobu apply runs and settings edits will appear here as an audit trail."}):a.jsxs("div",{className:"max-w-3xl space-y-3",children:[a.jsx("div",{className:"overflow-hidden rounded-lg border",children:n.map((s,l)=>{const d=l===n.length-1;return s.type==="deployment"?a.jsx(b,{item:s,owner:e,isLast:d},s.id):a.jsx(v,{item:s,owner:e,isLast:d},s.id)})}),t.hasNextPage?a.jsx(f,{variant:"outline",size:"sm",className:"h-8 text-xs",disabled:t.isFetchingNextPage,onClick:()=>t.fetchNextPage(),children:t.isFetchingNextPage?"Loading...":"Load more"}):null]})}function b({item:e,owner:t,isLast:n}){const l=[N(e.counts),e.createdBy?`by ${e.createdBy}`:null,o(e.createdAt)].filter(Boolean).join(" · ");return a.jsxs(i,{to:"/$owner/connectors/deployments/$deploymentId",params:{owner:t,deploymentId:e.applyId??String(e.id)},className:`${u} ${n?"":"border-b"}`,children:[a.jsx(c,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:"truncate text-sm font-medium",children:"Deployment"}),y(e.status),e.gitSha?a.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.gitSha.slice(0,7)}):null]}),a.jsx("p",{className:"truncate text-[11px] text-muted-foreground",children:l})]})]})}function v({item:e,owner:t,isLast:n}){const s=[e.actorSource?`via ${e.actorSource}`:null,e.createdBy?`by ${e.createdBy}`:null,o(e.createdAt)].filter(Boolean).join(" · ");return a.jsxs(i,{to:"/$owner/connectors/deployments/$deploymentId",params:{owner:t,deploymentId:`change-${e.id}`},className:`${u} ${n?"":"border-b"}`,children:[a.jsx(h,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs("span",{className:"truncate text-sm font-medium",children:[e.resourceKind??"config",e.resourceId?a.jsxs("span",{className:"text-muted-foreground",children:[" ",e.resourceId]}):null]}),j(e.op)]}),a.jsx("p",{className:"truncate text-[11px] text-muted-foreground",children:s})]})]})}export{B as D,j as c,y as d};
|
|
2
|
+
//# sourceMappingURL=deployments-body-BMp7UsMo.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{F as we,g as ye,r as c,G as be,j as e,I as je,B as R,H as ie}from"./index-Cr5hwh-C.js";import{s as ke,g as Ce,u as Ne,a as Se,b as Ae,A as Re,W as _e}from"./oauth-workspace-access-BxsjwgdH.js";import{C as oe,a as re,b as ne,d as ce,c as P}from"./card-Djgp00r_.js";import{w as ae}from"./workspace-label-o_QfBuCM.js";function q(t){return t.trim().toUpperCase()}const Le=15e3;async function Te(t){const n=new AbortController,j=window.setTimeout(()=>n.abort(),Le);try{const a=await fetch(`${ie}/oauth/device/info?user_code=${encodeURIComponent(t)}`,{credentials:"include",signal:n.signal}),x=await a.json().catch(()=>null);return{response:a,data:x}}catch(a){throw n.signal.aborted?new Error("Verification timed out. Check your connection and try again."):a}finally{window.clearTimeout(j)}}function F(t,n){return typeof t?.error_description=="string"&&t.error_description||typeof t?.error=="string"&&t.error||n}function ze(){const t=we.useSearch(),{session:n,isReady:j}=ye(),a=!j,[x,_]=c.useState(t.user_code||""),[r,m]=c.useState(null),[h,o]=c.useState(null),[i,le]=c.useState(null),[M,L]=c.useState(null),[T,D]=c.useState(null),[E,I]=c.useState(!1),[de,V]=c.useState(null),w=c.useRef(0),k=be(t.return_to),B=k?"app":"terminal",ue=!!t.user_code,N=q(x),d=M?.code===N?M:null,g=d!==null,C=d?.scopes??[],me=c.useMemo(()=>ke(C,T),[T,C]),$=C.some(s=>s.startsWith("mcp:")),G=C.includes("device_worker:run"),he=C.includes("connections:token"),Y=G||he,S=Ce(d?.resource),U=g&&$&&!S,J=d?.multiWorkspaceGrantsEnabled===!0,y=g&&G&&!S,{orgList:W,workspaceAccess:pe,setWorkspaceAccess:fe,selectedOrgIds:K,toggleSelectedOrgId:ge,resetWorkspaceSelection:ve,deviceHomeOrgId:z,orgsLoading:H,orgsError:A,retryOrgs:Q,workspaceSelectionReady:xe}=Ne({requireDeviceHome:y,deviceHomeOrgId:de,allowMultiple:J}),b=W.find(s=>s.id===z)??null,X=U?xe:!y||!H&&!A&&b!==null,O=c.useCallback(async s=>{const p=++w.current;m("verify"),o(null),I(!1);try{const{response:v,data:l}=await Te(s);if(p!==w.current)return;if(v.status===401){const f=new URL("/auth/login",window.location.origin);f.searchParams.set("callbackUrl",window.location.href),window.location.href=f.toString();return}if(!v.ok||!l)throw new Error(F(l,"Failed to verify device authorization code"));const u=Array.isArray(l.scopes)?l.scopes:[];L({code:s,clientName:l.client_name??null,scopes:u,resource:typeof l.resource=="string"?l.resource:null,multiWorkspaceGrantsEnabled:l.multi_workspace_grants_enabled===!0}),D(Se(u))}catch(v){if(p!==w.current)return;L(null),o(v instanceof Error?v.message:"Unexpected error")}finally{p===w.current&&m(null)}},[]);Ae(!!n,a),c.useEffect(()=>{if(!(a||!n||!t.user_code))return O(q(t.user_code)),()=>{w.current+=1}},[n,a,t.user_code,O]);const Z=async s=>{const p=N;if(!p){o(`Please enter the code shown in your ${B}.`);return}if(!g){o("Verify the device code before approving or denying access.");return}if(s&&Y&&!E){o("Confirm that you initiated this request and that the device code matches.");return}if(s&&!X){o(A?"Workspaces could not be loaded. Retry before approving.":y&&!b?"Choose a workspace for this device before approving.":"Choose at least one workspace before approving.");return}const v=d?.clientName??null,l=y&&b?ae(b):null;m(s?"approve":"deny"),o(null);try{const u=await fetch(`${ie}/oauth/device/approve`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({user_code:p,approved:s,...s?{scope:me.join(" ")}:{},...s&&U?{workspace_access:pe,organization_ids:K}:{},...s&&y&&b?{organization_id:b.id}:{}})}),f=await u.json().catch(()=>null);if(u.status===401){const te=new URL("/auth/login",window.location.origin);te.searchParams.set("callbackUrl",window.location.href),window.location.href=te.toString();return}if(!u.ok)throw new Error(F(f,"Failed to process device authorization"));const ee=s?"approved":"denied";if(f?.status!==ee)throw new Error(F(f,s?"The server did not confirm this approval. The device is still waiting — try again.":"The server did not confirm this denial. Try again."));const se=typeof f.user_code=="string"?q(f.user_code):null;if(se!==null&&se!==p)throw new Error("The server confirmed a different device code. Re-check the code shown on your device.");m(null),le({outcome:ee,code:p,clientName:v,deviceHomeLabel:l})}catch(u){m(null),o(u instanceof Error?u.message:"Unexpected error")}};return c.useEffect(()=>{if(i?.outcome!=="approved"||!k)return;const s=window.setTimeout(()=>{window.location.href=k},600);return()=>window.clearTimeout(s)},[i,k]),a||!n?e.jsx("main",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center p-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Checking authentication..."})}):i?e.jsx("main",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center p-4",children:e.jsxs(oe,{className:"w-full max-w-lg",role:"status","aria-live":"polite",children:[e.jsxs(re,{children:[e.jsx(ne,{children:i.outcome==="approved"?ue?"Access Authorized":"Device Authorized":"Authorization Denied"}),e.jsx(ce,{children:i.outcome==="approved"?k?"You can close this tab and return to the Lobu app.":"You can close this tab and return to your terminal.":"The device was not authorized. You can close this tab."})]}),i.outcome==="approved"&&i.deviceHomeLabel?e.jsxs(P,{className:"text-sm text-muted-foreground",children:["This device now lives in ",i.deviceHomeLabel,". Change its workspace or share its connections from the device page under Connectors."]}):null,e.jsx(P,{className:"text-sm",children:e.jsxs("dl",{className:"space-y-1",children:[e.jsx("dt",{className:"text-muted-foreground",children:i.outcome==="approved"?"Approved code":"Denied code"}),e.jsx("dd",{className:"font-mono text-base tracking-widest text-foreground",children:i.code}),i.clientName?e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Requested by"}),e.jsx("dd",{className:"text-foreground",children:i.clientName})]}):null]})})]})}):e.jsx("main",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center p-4",children:e.jsxs(oe,{className:"w-full max-w-lg",children:[e.jsxs(re,{children:[e.jsx(ne,{asChild:!0,children:e.jsx("h1",{children:g?"Authorize application":"Connect a device"})}),e.jsx(ce,{children:g?"Review the application, access level, and workspaces.":`Enter the code shown in your ${B}.`})]}),e.jsxs(P,{className:"space-y-5","aria-busy":r!==null,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"user-code",className:"text-sm font-medium",children:"Device code"}),e.jsx(je,{id:"user-code",value:x,disabled:r==="approve"||r==="deny",onChange:s=>{w.current+=1,_(s.target.value.toUpperCase()),L(null),D(null),ve(),V(null),I(!1),m(null),o(null)},placeholder:"ABCD-1234",className:"font-mono text-center text-lg tracking-widest",maxLength:9,autoFocus:!t.user_code})]}),y&&e.jsx(De,{deviceName:d?.clientName??null,orgList:W,deviceHomeOrgId:z,onChange:V,orgsLoading:H,orgsError:A,onRetry:Q,disabled:r!==null}),d&&e.jsx(Re,{idPrefix:"oauth-device",clientName:d.clientName,requestedScopes:d.scopes,accessLevel:T,onAccessLevelChange:D,sensitiveScopesAcknowledged:E,onSensitiveScopesAcknowledgedChange:I,disabled:r!==null}),U&&e.jsx(_e,{idPrefix:"oauth-device",allowMultiple:J,orgList:W,selectedOrgIds:K,onWorkspaceAccessChange:fe,onSelectedOrgChange:ge,orgsLoading:H,orgsError:A,onRetry:Q,disabled:r!==null,deviceHomeOrgId:z}),g&&$&&S&&e.jsxs("section",{className:"rounded-md border border-primary/20 bg-primary/5 p-3 text-sm space-y-1",children:[e.jsxs("p",{className:"font-medium text-foreground",children:["Workspace access: only ",S]}),e.jsx("p",{className:"text-muted-foreground",children:"This request is fixed to the workspace in the MCP resource URL."})]}),h&&e.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:h}),e.jsx("div",{className:"flex items-center justify-end gap-3",children:g?e.jsxs(e.Fragment,{children:[e.jsx(R,{type:"button",variant:"outline",onClick:()=>Z(!1),disabled:r!==null,children:r==="deny"?"Denying...":"Deny"}),e.jsx(R,{type:"button",onClick:()=>Z(!0),disabled:r!==null||!X||Y&&!E,children:r==="approve"?"Approving...":"Approve"})]}):e.jsx(R,{type:"button",onClick:()=>O(N),disabled:r!==null||!N,children:r==="verify"?"Verifying...":"Continue"})})]})]})})}function De({deviceName:t,orgList:n,deviceHomeOrgId:j,onChange:a,orgsLoading:x,orgsError:_,onRetry:r,disabled:m}){const h=n.find(o=>o.id===j)??null;return e.jsxs("section",{className:"space-y-2 rounded-md border border-primary/20 bg-primary/5 p-3 text-sm",children:[e.jsx("label",{htmlFor:"oauth-device-home",className:"block font-medium text-foreground",children:"Device workspace"}),x?e.jsx("p",{role:"status","aria-live":"polite",className:"text-muted-foreground",children:"Loading your workspaces..."}):_?e.jsxs("div",{role:"alert",className:"space-y-2 text-destructive",children:[e.jsx("p",{children:"Workspaces could not be loaded. Approval is unavailable until they load."}),e.jsx(R,{type:"button",variant:"outline",size:"sm",onClick:r,children:"Retry"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("select",{id:"oauth-device-home",value:h?.id??"",disabled:m,onChange:o=>a(o.target.value),className:"flex h-9 w-full rounded-md border border-input bg-background px-3 text-sm focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[h?null:e.jsx("option",{value:"",disabled:!0,children:"Choose a workspace"}),n.map(o=>e.jsx("option",{value:o.id,children:ae(o)},o.id))]}),h&&!h.isPersonal?e.jsxs("p",{role:"note",className:"rounded-md bg-amber-500/10 px-3 py-2 text-amber-700 dark:text-amber-400",children:[t??"This device"," will be added to ",h.name,". Its Shell and Browser connections will be private to you — teammates can't use them unless you share them from the device page."]}):null,e.jsx("p",{className:"text-xs text-muted-foreground",children:"This applies to a newly paired device. A device that is already paired keeps its workspace; change it from the Devices page."})]})]})}export{ze as component};
|
|
2
|
+
//# sourceMappingURL=device-CPU6CjkJ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as e,ex as f,r as y,hZ as C,h_ as k,hi as g,B as A,L as w,cy as E,h$ as I,i0 as L,i1 as N,u as P,i2 as F,hw as O}from"./index-Cr5hwh-C.js";import{a as R,R as S}from"./runs-panel-Du1JMjg5.js";import{c as v,C as $,a as b}from"./connector-scope-lists-CadPVsI3.js";function M({formRows:s=5}){return e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[minmax(0,1fr)_360px]",children:[e.jsx(R,{}),e.jsx(f,{rows:s})]})}function V({connection:s,connectorDef:t,ownerSlug:a,openSettings:n=!1,authResult:o,showActivity:r=!0,embedded:i=!1,showShare:c=!0}){const[l,d]=y.useState(n);y.useEffect(()=>{n&&d(!0)},[n]);const m=s.id,h=s.connector_key,u=s.facets?.chat??!1,p=u?"Channels":"Feeds",x=s.has_operations===!0,_=s.feed_count>0||v(t),j=e.jsx(N,{connection:s,connectorDef:t,ownerSlug:a,showShare:c});return e.jsxs("div",{className:"space-y-6",children:[o&&e.jsx(C,{result:o}),s.auth_profile_kind==="oauth_account"&&e.jsx(k,{connection:s,connectorDef:t,onReview:()=>{d(!0),requestAnimationFrame(()=>document.getElementById("connection-auth")?.scrollIntoView({block:"nearest"}))}}),(_||x)&&e.jsxs("div",{className:i?"space-y-6":"grid grid-cols-1 items-start gap-3 sm:grid-cols-2",children:[_&&(i?e.jsx(g,{title:p,count:s.feed_count===1?"1 source":`${s.feed_count} sources`,action:v(t)?e.jsx(A,{asChild:!0,size:"sm",variant:"outline",children:e.jsxs(w,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:a,connectorKey:h,connectionId:String(m)},search:{addFeed:!0},children:[e.jsx(E,{className:"h-3.5 w-3.5"}),u?"Add channel":"Add source"]})}):null,children:e.jsx($,{connection:s,ownerSlug:a,connectorKey:h,connectorDef:t})}):e.jsx(b,{connection:s,ownerSlug:a,title:p})),x&&(i?e.jsx(I,{connection:s,ownerSlug:a}):e.jsx(B,{connection:s,ownerSlug:a}))]}),i?e.jsx(L,{title:"Connection settings",summary:"name, visibility, credentials, remove",open:l,onOpenChange:d,children:j}):j,r&&!u&&e.jsx(g,{title:"Recent activity",children:e.jsx(S,{scope:{connectionId:m},ownerSlug:a})})]})}function B({connection:s,ownerSlug:t}){const a=P(),{data:n=[],isLoading:o,isError:r}=F(s.id),i=n.filter(l=>l.readiness==="scope_upgrade_required").length,c=o?"Loading actions…":r?"Could not load actions — open to retry":`${n.length} actions${i?` · ${i} need additional provider access`:" · permissions and approval policy"}`;return e.jsx(O,{title:"Actions",summary:c,onOpen:()=>a?.open({href:"",title:"Actions",connectorPanel:{section:"actions",connectionId:s.id,connectorKey:s.connector_key,organizationId:s.organization_id,ownerSlug:t}})})}const T=new Set(["Device was removed","Device was moved to another workspace"]);function H(s){const t=s.error_message??null;return!t||!T.has(t)?t:!!s.device_worker_id&&(s.device_last_seen_at!=null||s.device_worker_handle!=null||s.device_label!=null)?null:t}export{V as C,M as R,H as c};
|
|
2
|
+
//# sourceMappingURL=device-pin-tombstone-CrjG7gPo.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{aI as U,hL as ne,hM as V,r as v,j as e,hN as L,B as b,a1 as z,hO as C,cN as Y,au as te,hi as I,S as R,aU as T,dO as ae,dP as ce,dj as ie,dQ as oe,hP as re,T as le,m as de,az as me,hQ as ue,hR as xe,hS as he,aA as pe,av as fe,aB as P,aT as O,L as E,hT as ge,hU as je,aO as ve,hV as ye,hW as be,h0 as Ne,b7 as _e,fL as ke,hX as q,I as we,a_ as Ce,b8 as Se,fM as $e,fN as K,bc as De,hY as W,ah as Pe}from"./index-Cr5hwh-C.js";import{c as Q,C as Le,R as ze}from"./device-pin-tombstone-CrjG7gPo.js";import{R as Ie}from"./runs-panel-Du1JMjg5.js";import{S as Re,g as Ae}from"./runs-table-syPJ6r6T.js";import{c as Ee}from"./connection-label-BobuYiAG.js";import{w as M}from"./workspace-label-o_QfBuCM.js";import"./connector-scope-lists-CadPVsI3.js";import"./status-dot-B-EWMgq6.js";import"./runs-C0rCgGwX.js";import"./filter-editors-Cj-v6NtH.js";function Me(s,n,o){const h=new Set(s.capabilities??[]),m=new Set(s.connectors.filter(t=>t.organization_slug===o).map(t=>t.connector_key)),r=new Set(G(s,o).map(t=>t.connector_key));return n.filter(t=>U(t)&&!!t.required_capability&&h.has(t.required_capability)&&!m.has(t.key)&&!r.has(t.key))}function G(s,n){return s.organization_slug===n?s.update_required:[]}function Te(s,n,o){const h=s.organization_slug;if(!h||h===o)return[];const m=new Set(n.map(t=>t.key)),r=new Set(s.connectors.filter(t=>t.organization_slug===o).map(t=>t.connector_key));return s.connectors.filter(t=>t.organization_slug!==h||m.has(t.connector_key)||r.has(t.connector_key)?!1:(r.add(t.connector_key),!0))}function Be({device:s,organizationId:n,ownerSlug:o,connectable:h,unavailable:m}){const r=ne(),t=V(),[u,p]=v.useState(null),[g,a]=v.useState(null),[f,N]=v.useState(null),[j,d]=v.useState([]),x=s.organization_id===n,y=async c=>{p(null),N(null),a(c.key);try{x||await t.mutateAsync({deviceWorkerId:s.id,organizationId:n});const w=await r.mutateAsync({connector_key:c.key,device_worker_id:s.id}),S=w.connection_id??w.connection?.id;if(S===void 0)throw new Error(w.instructions??"The connection was not created.");d($=>[...$.filter(D=>D.connectorKey!==c.key),{connectorKey:c.key,name:c.name,connectionId:S,instructions:w.status==="setup_required"?w.instructions:void 0}])}catch(w){N({key:c.key,message:w instanceof Error?w.message:"Could not connect."})}finally{a(null)}},_=new Set(j.map(c=>c.connectorKey)),l=G(s,o),i=h.filter(c=>!_.has(c.key));return e.jsxs("div",{className:"mt-4 space-y-3",children:[j.map(c=>e.jsx(Oe,{outcome:c,device:s,organizationId:n},c.connectorKey)),i.length>0?e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium",children:"Supported by this device"}),e.jsxs("p",{className:"mb-2 text-xs text-muted-foreground",children:["Not connected in this workspace yet.",x?null:" Connecting one moves the device here; you will be asked to confirm first."]}),e.jsx("div",{className:"divide-y border-y",children:i.map(c=>e.jsxs("div",{className:"space-y-2 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"min-w-0 flex-1 text-sm font-medium",children:[c.name,c.required_capability&&L[c.required_capability]&&L[c.required_capability]!==c.name?e.jsx("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:L[c.required_capability]}):null]}),e.jsxs(b,{size:"sm",variant:"outline","aria-label":`Connect ${c.name}`,disabled:g!==null,onClick:()=>x?void y(c):p(c.key),children:[g===c.key?e.jsx(z,{className:"mr-1.5"}):null,"Connect"]})]}),u===c.key?e.jsx(X,{device:s,ownerSlug:o,title:"Move device to this workspace",intro:`${C(s)} lives in ${s.organization_name??"another workspace"}. A device serves one workspace at a time, so it has to move here before it can be connected.`,confirmLabel:"Move here and connect",onConfirm:()=>void y(c),onCancel:()=>p(null)}):null,f?.key===c.key?e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:f.message}):null]},c.key))})]}):null,l.length>0?e.jsxs("div",{role:"status",children:[e.jsx("p",{className:"text-xs font-medium",children:"Update Lobu on this device"}),e.jsx("ul",{className:"mt-1 space-y-1 text-xs text-muted-foreground",children:l.map(c=>e.jsx("li",{children:`${c.display_name} — this device has ${c.device_version}, this workspace uses ${c.workspace_version}`},c.connector_key))})]}):null,m.length>0?e.jsx("ul",{className:"space-y-1 text-xs text-muted-foreground",children:m.map(c=>e.jsx("li",{children:`${c.display_name} — set up on this device in ${s.organization_name??"its home workspace"}, not available in this workspace yet`},c.connector_key))}):null]})}function X({device:s,ownerSlug:n,title:o,intro:h,aftermath:m,confirmLabel:r,pending:t=!1,onConfirm:u,onCancel:p}){const g=s.connector_count,a=s.connectors.filter(f=>f.organization_slug===n).length;return e.jsxs("div",{role:"alertdialog","aria-label":o,className:"space-y-2 rounded-lg bg-amber-500/10 px-3 py-2 text-xs",children:[e.jsx("p",{children:h}),e.jsxs("p",{className:"text-muted-foreground",children:[g>0?`Moving pauses and unpins all ${g} connection${g===1?"":"s"} pinned to it${a>0?`, including ${a} in this workspace`:""}. They stay paused until you reconnect them.`:"It has no pinned connections, so nothing is paused.",m?` ${m}`:null]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(b,{size:"sm",disabled:t,onClick:u,children:[t?e.jsx(z,{className:"mr-1.5"}):null,r]}),e.jsx(b,{size:"sm",variant:"ghost",disabled:t,onClick:p,children:"Cancel"})]})]})}function Oe({outcome:s,device:n,organizationId:o}){const{data:h=[],isLoading:m}=Y(o,{connectionIds:[s.connectionId]}),r=h.find(p=>p.id===s.connectionId),t=C(n);if(m)return e.jsxs("p",{role:"status",className:"text-sm text-muted-foreground",children:["Checking ",s.name,"…"]});const u=[];if(!r)u.push(`${s.name} was created but could not be loaded yet.`);else if(r.status!=="active"){const p=Q(r);u.push(`${s.name} is ${r.status}${p?`: ${p}`:"."}`)}return s.instructions&&u.push(s.instructions),n.online||u.push(`${t} is offline. ${s.name} runs once it reconnects.`),e.jsx("div",{role:"status",className:"rounded-lg border px-3 py-2 text-sm",children:u.length===0?e.jsxs("p",{children:[s.name," is ready on ",t,"."]}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"font-medium",children:[s.name," connected, not ready yet"]}),e.jsx("ul",{className:"mt-1 list-disc pl-4 text-xs text-muted-foreground",children:u.map(p=>e.jsx("li",{children:p},p))})]})})}function H({device:s,organizationId:n,ownerSlug:o,selectedConnection:h,openSettings:m}){const{data:r=[],isLoading:t,isError:u,refetch:p}=te(n),g=new Map(r.map(d=>[d.key,d])),a=new Map,f=[];for(const d of s.connectors){if(d.organization_slug!==o)continue;const x=g.get(d.connector_key);if(!x||!U(x)){f.push(d);continue}const y=x.required_capability??`connector:${x.key}`,_=a.get(y)??{key:y,name:x.name,connections:[]};_.name=L[y]??x.name,_.connections.push(d),a.set(y,_)}const N=Me(s,r,o),j=Te(s,r,o);return e.jsxs(e.Fragment,{children:[e.jsxs(I,{title:"Capabilities",children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Manage the native connections available to this workspace."}),s.online?null:e.jsx("p",{className:"mb-3 text-sm text-muted-foreground",children:"This device is offline. You can edit its settings; actions and sync need it to reconnect."}),!n||t?e.jsx(R,{className:"h-24 w-full"}):u?e.jsxs("div",{role:"alert",className:"space-y-2 text-sm",children:[e.jsx("p",{children:"Could not load capability settings."}),e.jsx(b,{variant:"outline",size:"sm",onClick:()=>void p(),children:"Retry"})]}):a.size===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No native connections on this device in this workspace."}):e.jsx("div",{className:"divide-y border-y",children:[...a.values()].map(d=>e.jsx(F,{group:d,deviceId:s.id,organizationId:n,ownerSlug:o,definitionsByKey:g,selectedConnection:h,openSettings:m},d.key))}),n&&!t&&!u?e.jsx(Be,{device:s,organizationId:n,ownerSlug:o,connectable:N,unavailable:j}):null,T(s)==="macos"?e.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Manage macOS permissions in the Lobu app on this device."}):null]}),n&&f.length>0&&!t&&!u?e.jsxs(I,{title:"Apps and sources",count:String(f.length),children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Apps and sources that use this device."}),e.jsx("div",{className:"divide-y border-y",children:[...new Set(f.map(d=>d.connector_key))].map(d=>e.jsx(F,{group:{key:d,name:g.get(d)?.name??d,connections:f.filter(x=>x.connector_key===d)},deviceId:s.id,organizationId:n,ownerSlug:o,definitionsByKey:g,selectedConnection:h,openSettings:m},d))})]}):null]})}function F({group:s,deviceId:n,organizationId:o,ownerSlug:h,definitionsByKey:m,selectedConnection:r,openSettings:t}){const u=s.connections.some(a=>a.connection_id===r),[p,g]=v.useState(u);return v.useEffect(()=>{u&&r!==void 0&&g(!0)},[u,r]),e.jsxs(ae,{open:p,onOpenChange:g,children:[e.jsxs(ce,{className:"group flex w-full items-center gap-3 py-3 text-left",children:[e.jsx(ie,{className:"size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90"}),e.jsx("span",{className:"min-w-0 flex-1 text-sm font-medium",children:s.name}),e.jsx("span",{className:"text-right text-xs text-muted-foreground",children:s.connections.some(a=>a.status==="error"||a.status==="revoked")?"Needs attention":s.connections.length>1?`${s.connections.length} connections`:"Configured"})]}),e.jsx(oe,{className:"pb-4 pl-6",children:e.jsx("div",{className:"space-y-5",children:s.connections.map(a=>e.jsx(qe,{summary:a,deviceId:n,organizationId:o,ownerSlug:h,connectorDef:m.get(a.connector_key),openSettings:a.connection_id===r&&t},a.connection_id))})})]})}function qe({summary:s,deviceId:n,organizationId:o,ownerSlug:h,connectorDef:m,openSettings:r}){const{data:t=[],isLoading:u,isError:p,refetch:g}=Y(o,{connectionIds:[s.connection_id]}),a=t.find(j=>j.id===s.connection_id&&j.device_worker_id===n),f=m?.name??s.connector_key,N=a?Q(a):null;return e.jsxs("section",{id:`connection-${s.connection_id}`,"aria-label":f,className:"scroll-mt-24",children:[a?e.jsxs("div",{className:"mb-3 flex items-baseline justify-between gap-3 text-xs text-muted-foreground",children:[e.jsx("span",{children:Ee(a)}),e.jsx("span",{children:a.status})]}):null,u||!o?e.jsx(R,{className:"h-24 w-full"}):p?e.jsxs("div",{role:"alert",className:"space-y-2 text-sm",children:[e.jsx("p",{children:"Could not load this connection."}),e.jsx(b,{variant:"outline",size:"sm",onClick:()=>void g(),children:"Retry"})]}):a?e.jsxs(e.Fragment,{children:[N?e.jsx("p",{role:"alert",className:"mb-4 text-sm text-destructive",children:N}):null,e.jsx("div",{className:"mb-4",children:e.jsx(re,{connection:a})}),e.jsx(Le,{connection:a,connectorDef:m,ownerSlug:h,openSettings:r,showActivity:!1,showShare:!1,embedded:!0})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection is no longer available on this device."})]})}function Ke({device:s,ownerSlug:n}){const o=v.useId(),{data:h=[]}=le(),m=V(),[r,t]=v.useState(!1),[u,p]=v.useState(null),[g,a]=v.useState(null),f=h.filter(l=>l.is_member).map(l=>({id:l.id,name:l.name,isPersonal:l.is_personal===!0})),N=f.find(l=>l.id===s.organization_id),j=N?M(N):s.organization_name??"No workspace",d=f.filter(l=>l.id!==s.organization_id),x=d.find(l=>l.id===u)??null,y=()=>{t(!1),p(null)},_=async l=>{a(null);try{await m.mutateAsync({deviceWorkerId:s.id,organizationId:l}),y()}catch(i){a(i instanceof Error?i.message:"Could not move the device.")}};return e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Workspace: "}),j]}),!r&&d.length>0?e.jsx(b,{size:"sm",variant:"outline",onClick:()=>{a(null),t(!0)},children:"Change workspace"}):null]}),r?e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("label",{htmlFor:o,className:"text-xs text-muted-foreground",children:"Move to"}),e.jsxs("select",{id:o,value:u??"",disabled:m.isPending,onChange:l=>p(l.target.value||null),className:"h-8 rounded-md border border-input bg-background px-2 text-sm",children:[e.jsx("option",{value:"",children:"Choose a workspace"}),d.map(l=>e.jsx("option",{value:l.id,children:M(l)},l.id))]}),x?null:e.jsx(b,{size:"sm",variant:"ghost",onClick:y,children:"Cancel"})]}):null,x?e.jsx(X,{device:s,ownerSlug:n,title:`Move device to ${x.name}`,intro:`Move ${C(s)} from ${j} to ${M(x)}?`,aftermath:`It is set up fresh in ${x.name}, with its connections there private to you until you share them.`,confirmLabel:"Move device",pending:m.isPending,onConfirm:()=>void _(x.id),onCancel:y}):null,g?e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:g}):null]})}function We({ownerSlug:s,deviceId:n,organizationId:o,selectedConnection:h,openSettings:m}){const r=de(),{data:t=[],isLoading:u,isError:p,refetch:g}=me(),a=ue(),f=xe(),[N,j]=v.useState(!1),[d,x]=v.useState(!1),[y,_]=v.useState(""),l=he(t,n),i=l&&pe(l,s)?l:void 0,c=i?.id??n,{data:w=[]}=fe(o,{profileKind:"browser_session"}),S=v.useMemo(()=>w.filter(k=>k.device_worker_id===c&&k.status!=="revoked"),[w,c]),$=i?.label?.trim()??"";if(v.useEffect(()=>{d||_($)},[$,d]),u)return e.jsxs(P,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"h-6 w-6 rounded"}),e.jsx(R,{className:"h-5 w-40"})]}),e.jsx(ze,{})]});if(p)return e.jsx(P,{children:e.jsxs("div",{role:"alert",className:"space-y-2",children:[e.jsx("p",{children:"Could not load this device."}),e.jsx(b,{variant:"outline",size:"sm",onClick:()=>void g(),children:"Retry"})]})});if(!i&&l&&o)return e.jsxs(P,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{platform:T(l),className:"h-5 w-5"}),e.jsx("h1",{className:"text-base font-semibold",children:C(l)})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["This device lives in"," ",l.organization_name??"another workspace",", not this workspace."]}),e.jsx(H,{device:l,organizationId:o,ownerSlug:s})]});if(!i)return e.jsxs(P,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"This device isn't in this workspace, so its details aren't available."}),e.jsx(E,{to:"/$owner/connectors",params:{owner:s},search:{},className:"text-sm text-primary hover:underline",children:"Back to connectors"})]});const D=ge(i),A=D?je(s,D,ve()):void 0,J=T(i),Z=ye(i.app_version),ee=be(i,Z),B=()=>{const k=y.trim(),se=i.label?.trim()??"";if(k===se){x(!1);return}f.mutate({deviceWorkerId:i.id,label:k.length===0?null:k},{onSuccess:()=>x(!1)})};return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(Ne,{header:e.jsx(ke,{breadcrumb:e.jsx($e,{crumbs:[e.jsx(E,{to:"/$owner/connectors",params:{owner:s},search:{},className:K,children:"Connectors"},"connectors"),...A?[e.jsx(E,{to:"/$owner/connectors/app/$appId",params:{owner:s,appId:A.id},className:K,children:A.name},"app")]:[]]}),icon:e.jsx(O,{platform:J,className:"h-5 w-5"}),title:d?e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(we,{"aria-label":"Device name",value:y,onChange:k=>_(k.target.value),placeholder:C({...i,label:null}),maxLength:80,className:"h-9 max-w-sm text-base font-semibold",autoFocus:!0,onKeyDown:k=>{k.key==="Enter"?(k.preventDefault(),N||B()):k.key==="Escape"&&(j(!1),_(i.label?.trim()??""),x(!1))}}),N?e.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg bg-destructive/10 px-3 py-2",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Forgets this device"," ",i.connector_count>0?`and un-pins ${i.connector_count} connector${i.connector_count===1?"":"s"} across every workspace, not just this one.`:"with no pinned connections."]}),e.jsxs(b,{variant:"destructive",size:"sm",disabled:a.isPending,onClick:()=>a.mutate(i.id,{onSuccess:()=>{j(!1),r({to:"/$owner/connectors",params:{owner:s},search:{}})}}),children:[a.isPending?e.jsx(z,{className:"mr-1.5"}):null,a.isPending?"Removing...":"Confirm remove"]}),e.jsx(b,{size:"sm",variant:"ghost",disabled:a.isPending,onClick:()=>j(!1),children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(b,{size:"sm",onClick:B,disabled:f.isPending,children:[f.isPending?e.jsx(z,{className:"mr-1.5"}):null,f.isPending?"Saving...":"Save"]}),e.jsx(b,{size:"sm",variant:"ghost",disabled:f.isPending,onClick:()=>{_(i.label?.trim()??""),x(!1)},children:"Cancel"}),e.jsxs(b,{size:"sm",variant:"ghost",className:"text-destructive hover:text-destructive",disabled:f.isPending||a.isPending,onClick:()=>j(!0),children:[e.jsx(Ce,{className:"mr-1.5 h-3.5 w-3.5"}),"Remove device"]})]})]}):e.jsxs("span",{className:"flex items-center gap-1.5",children:[C(i),e.jsx(b,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground","aria-label":"Edit device",onClick:()=>{j(!1),_(i.label?.trim()??""),x(!0)},children:e.jsx(Se,{className:"h-3.5 w-3.5"})})]}),badge:e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx("span",{className:`size-1.5 rounded-full ${i.online?"bg-emerald-500":"bg-muted-foreground/50"}`}),i.online?i.connector_error_count>0?"Needs attention":"Online":"Offline"]}),meta:ee||void 0,caption:`Last seen ${q(new Date(i.last_seen_at),{addSuffix:!0})}${i.last_sync_at?` · Last sync ${q(new Date(i.last_sync_at),{addSuffix:!0})}`:""}`}),children:[e.jsx(Ke,{device:i,ownerSlug:s}),i.connector_error_count>0?e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-amber-600",children:[e.jsx(_e,{className:"h-3.5 w-3.5 shrink-0"}),i.connector_error_count," connector",i.connector_error_count===1?"":"s"," pinned to this device ",i.connector_error_count===1?"is":"are"," erroring."]}):null,e.jsx(H,{device:i,organizationId:o,ownerSlug:s,selectedConnection:h,openSettings:m}),S.length>0?e.jsx(I,{title:"Browser auth profiles",children:e.jsx(He,{profiles:S})}):null,e.jsx(I,{title:"Runs",children:e.jsx(Ie,{scope:{deviceId:c},ownerSlug:s})})]})})}function He({profiles:s}){return s.length===0?null:e.jsx("div",{className:"rounded-lg border",children:e.jsx("ul",{className:"divide-y",children:s.map(n=>e.jsxs("li",{className:"space-y-2 px-3 py-2.5 text-sm",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-medium",children:n.display_name}),e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx("span",{children:n.connector_key??"Any connector"}),n.browser_kind?e.jsxs("span",{children:["· ",n.browser_kind]}):null,n.captured_at?e.jsxs("span",{title:n.captured_at,children:["· captured ",De(n.captured_at)]}):null,typeof n.cookie_count=="number"?e.jsxs("span",{children:["· ",n.cookie_count," cookie",n.cookie_count===1?"":"s"]}):null]})]}),e.jsx(Re,{status:n.is_expired?"error":Ae(n.status),showDot:!0,children:n.is_expired?"expired":n.status})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Refresh the session using the connector’s authorization instructions."})]},n.id))})})}function ss(){const{owner:s,deviceId:n}=W.useParams(),{connection:o,settings:h}=W.useSearch();return e.jsx(Pe,{owner:s,children:({ownerSlug:m,organizationId:r})=>e.jsx(We,{ownerSlug:m,deviceId:n,organizationId:r,selectedConnection:o,openSettings:h})})}export{ss as component};
|
|
2
|
+
//# sourceMappingURL=device._deviceId-Cs3ZmXWo.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{m as x,t as m,j as e,bn as C,bo as _,bp as S,bq as b,br as c,eh as u}from"./index-Cr5hwh-C.js";import{c as w}from"./connection-label-BobuYiAG.js";const h="__connection_picker_create_new__";function y({connections:s,value:r,onValueChange:n,connectorKey:a,disabled:p,placeholder:d="Choose a connection",includeWorkspaceEvents:i=!1,ariaLabel:g="Connection"}){const f=x(),l=m().org?.slug,o=a?s.filter(t=>t.connector_key===a):s,j=t=>{if(t===h){if(!l)return;f({to:"/$owner/connectors/create",params:{owner:l},search:a?{connector:a}:{}});return}n(t)};return e.jsxs(C,{value:r,onValueChange:j,disabled:p,children:[e.jsx(_,{"aria-label":g,children:e.jsx(S,{placeholder:d})}),e.jsxs(b,{children:[i?e.jsxs(e.Fragment,{children:[e.jsx(c,{value:"workspace",children:"Current workspace"}),o.length>0?e.jsx(u,{}):null]}):null,o.map(t=>e.jsx(c,{value:String(t.id),children:w(t)},t.id)),l?e.jsxs(e.Fragment,{children:[o.length>0||i?e.jsx(u,{}):null,e.jsx(c,{value:h,children:"Connect an app…"})]}):null]})]})}function v(s){const r=[];for(const n of s)r.push({id:n.id,name:n.name,entityType:n.entity_type}),n.children&&n.children.length>0&&r.push(...v(n.children));return r}export{y as C,v as f};
|
|
2
|
+
//# sourceMappingURL=entity-options-uXjgT7y9.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{k as ee,iP as re,r as _,j as e,S as M,m as U,iQ as oe,M as le,P as te,cd as ce,iR as de,dk as R,v as me,eu as H,iS as J,iT as ue,b_ as Q,dY as he,eL as ge,eq as xe,eN as pe,iU as fe,bO as ve,bP as D,ex as ye,bS as je,y as z,I as X,f3 as be,b7 as _e,B as E,eX as Ne,dN as we,eO as Se,L as ke,gj as Ee}from"./index-Cr5hwh-C.js";import{R as Ce}from"./record-activity-CBXH6v1d.js";import{T as Te,a as Pe,b as I,d as F,e as G,c as Z,S as De,D as Ie,E as Re}from"./tabs-DqIIkCX-.js";import{a as Fe}from"./source-record-panels-CPyzlfD1.js";import{V as B,a as K,M as Le,b as $e}from"./view-param-filters-CqLZQrnO.js";import{a as Ae}from"./renderer-mEDnVW0O.js";import"./filter-editors-Cj-v6NtH.js";import"./connection-label-BobuYiAG.js";import"./runs-C0rCgGwX.js";import"./clients-D3Zbjxin.js";import"./client-rows-EJSKR6z1.js";import"./events-feed-BtvhZF1f.js";import"./conversations-table-BdXoZAfc.js";import"./agent-loading-shells-Dqcvky-k.js";import"./member-scope-gate-B44INDPY.js";import"./app-bridge-BCm4muqj.js";import"./card-Djgp00r_.js";function Oe({entityId:t,ownerSlug:s}){const{orgContext:l}=ee(),{data:r,isLoading:m}=re(t,l),a=_.useMemo(()=>{if(!r)return[];const o=new Map;for(const c of r.rows){const d=o.get(c.relationship_type_slug);d?d.rows.push(c):o.set(c.relationship_type_slug,{slug:c.relationship_type_slug,label:c.relationship_type_name,rows:[c]})}return[...o.values()]},[r]);return m?e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{className:"h-4 w-32"}),e.jsx(M,{className:"h-12 w-full rounded-lg"}),e.jsx(M,{className:"h-12 w-full rounded-lg"})]}):!r||r.rows.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No relationships for this entity yet."}):e.jsx("div",{className:"space-y-3",children:a.map(({slug:o,label:c,rows:d})=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("p",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[c,e.jsx("span",{className:"text-[10px] tabular-nums text-muted-foreground/70",children:d.length})]}),e.jsx("ul",{className:"space-y-1",children:d.map(x=>e.jsx(Ve,{entityId:t,row:x,ownerSlug:s},x.id))})]},o))})}function Ve({entityId:t,row:s,ownerSlug:l}){const r=U(),{orgContext:m}=ee(),[a,o]=_.useState(!1),[c,d]=_.useState(!1),x=s.from_entity_id===s.to_entity_id,p=s.from_entity_id===t,u=x?"this entity":p?s.to_entity_name??`Entity #${s.to_entity_id}`:s.from_entity_name??`Entity #${s.from_entity_id}`,h=p?s.to_entity_type:s.from_entity_type,N=p?s.to_entity_id:s.from_entity_id,i=h?`${h} · ${u}`:u;async function g(){o(!0),d(!1);try{const b=[],v=new Set;let y=N;for(;y!==null;){if(v.has(y))throw new Error("Cyclic entity ancestry");v.add(y);const{entity:j}=await ce("manage_entity",{action:"get",entity_id:y},de(m));b.unshift({entity_type:j.entity_type,slug:j.slug}),y=j.parent_id}await r({to:R(l,b)})}catch{d(!0)}finally{o(!1)}}return e.jsxs("li",{className:te("flex items-center gap-2 rounded-md border border-border/70 px-2.5 py-1.5"),children:[e.jsx(oe,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),x||!h?e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:i}):e.jsxs("button",{type:"button",onClick:g,disabled:a,"aria-busy":a,className:"flex min-w-0 flex-1 items-center gap-2",children:[e.jsx("span",{className:"min-w-0 truncate text-sm hover:underline",children:i}),h?e.jsx(le,{variant:"outline",className:"shrink-0 text-[9px] px-1.5 py-0 h-4 text-muted-foreground",children:h}):null]}),c?e.jsx("span",{role:"alert",className:"text-xs text-destructive",children:"Could not open this record. Try again."}):null]})}function Me(t,s){const l=new Set([...Object.keys(t),...Object.keys(s)]);let r=!1;const m={};for(const a of l){const o=a in t,c=a in s;if(!o&&c){m[a]=s[a];continue}o&&(m[a]=t[a],(!c||JSON.stringify(t[a])!==JSON.stringify(s[a]))&&(r=!0))}return r?m:void 0}function ze({entity:t,entityTypeSlug:s,orgContext:l,onDeleted:r}){const{isAdmin:m,isLoading:a}=xe(l.organizationId),o=m&&!a,{data:c,isLoading:d}=H(s,l),x=pe(),p=fe(),u=c?.metadata_schema,h=t.field_controls,N=_.useMemo(()=>G(t.metadata??{},u),[t.metadata,u]),i=ve(t.id,{name:t.name,slug:t.slug,metadata:N},u),[g,b]=i.field("name"),[v,y]=i.field("slug"),[j,C]=i.field("metadata"),[w,T]=D(t.id,""),[P,n]=D(t.id,null),[se,$]=D(t.id,!1),[W,A]=D(t.id,null),O=_.useMemo(()=>i.hasInvalidInput?void 0:Me(Z(j),Z(i.baseline.metadata)),[i.baseline.metadata,j,i.hasInvalidInput]),V=O!==void 0,ae=g!==i.baseline.name||v!==i.baseline.slug||V,ie=async f=>{if(f.preventDefault(),!(!o||!i.canSubmit)){if(n(null),!g.trim()){n("Name is required");return}try{await x.mutateAsync({entityId:t.id,name:g.trim()!==i.baseline.name.trim()?g.trim():void 0,slug:v,metadata:O,field_note:V&&w.trim()||void 0}),i.accept(i.values,{name:g.trim(),slug:v,metadata:G({...we(i.baseline.metadata),...O},u)}),T("")}catch(q){n(q instanceof Error?q.message:"Failed to update entity")}}},ne=async()=>{if(o){A(null);try{await p.mutateAsync({entityId:t.id}),$(!1),r?.()}catch(f){A(f instanceof Error?f.message:"Failed to delete entity")}}},Y=[t.total_content>0&&`${t.total_content} content item${t.total_content===1?"":"s"}`,t.automations_count>0&&`${t.automations_count} Automation${t.automations_count===1?"":"s"}`,t.active_connections>0&&`${t.active_connections} connector${t.active_connections===1?"":"s"}`].filter(Boolean).join(", ");return d?e.jsx(ye,{rows:6}):e.jsxs("form",{onSubmit:ie,className:"space-y-4",children:[e.jsx(je,{visible:i.hasConflict,onReload:i.reset}),!o&&e.jsx("p",{className:"text-sm text-muted-foreground",role:"status",children:a?"Checking edit permissions…":"You can view this record. Ask a workspace owner or admin to make changes."}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(z,{htmlFor:"sidebar-name",children:["Name ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(X,{id:"sidebar-name",readOnly:!o,value:g,onChange:f=>b(f.target.value)})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(z,{htmlFor:"sidebar-slug",children:"URL Slug"}),e.jsx(X,{id:"sidebar-slug",readOnly:!o,value:v,onChange:f=>y(f.target.value.toLowerCase().replace(/[^a-z0-9-]/g,""))})]}),i.revision&&Object.keys(i.revision).length>0&&e.jsxs(e.Fragment,{children:[e.jsx(De,{}),e.jsx(Ie,{schema:i.revision,values:j,onValuesChange:C,readonly:!o,fieldControls:h,orgContext:l})]}),o&&V&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx(z,{htmlFor:"sidebar-correction-note",children:"Correction note (optional)"}),e.jsx(be,{id:"sidebar-correction-note",value:w,onChange:f=>T(f.target.value),placeholder:"Why are you changing these fields? Helps Automations respect the correction.",rows:2})]}),P&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:P}),o&&(se?e.jsxs("div",{className:"space-y-3 rounded-lg border border-destructive/40 bg-destructive/5 p-3",children:[e.jsxs("div",{className:"flex items-start gap-2.5 text-sm",children:[e.jsx(_e,{className:"h-4 w-4 shrink-0 text-destructive mt-0.5"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"font-medium text-foreground",children:['Delete "',t.name,'"?']}),Y&&e.jsxs("p",{className:"text-muted-foreground",children:["Removes ",Y,". This cannot be easily undone."]})]})]}),W&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-2.5 py-1.5 text-sm text-destructive",children:W}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(E,{type:"button",variant:"ghost",size:"sm",onClick:()=>{$(!1),A(null)},children:"Cancel"}),e.jsx(E,{type:"button",variant:"destructive",size:"sm",onClick:ne,disabled:p.isPending,children:p.isPending?"Deleting...":`Delete ${c?.name||"entity"}`})]})]}):e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsx(E,{type:"button",variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>$(!0),children:"Delete"}),e.jsx(E,{type:"submit",size:"sm",disabled:!i.canSubmit||!ae||x.isPending||!g.trim(),children:x.isPending?"Saving...":"Save"})]}))]})}function Be({entity:t,schema:s}){const l=new Set(t.measure_columns??[]),r=t.metadata??{},m=Object.keys(r).filter(a=>a!=="id"&&a!=="slug"&&a!=="name"&&s?.properties?.[a]?.const===void 0);return e.jsxs("div",{children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Managed by the source"}),e.jsx("dl",{className:"space-y-2.5 text-sm leading-5",children:m.map(a=>e.jsxs("div",{className:"grid grid-cols-[minmax(0,2fr)_minmax(0,3fr)] items-baseline gap-x-3",children:[e.jsx("dt",{className:"break-words text-muted-foreground",children:String(s?.properties?.[a]?.["x-table-label"]??(l.has(a)?a:he(a.replace(/_/g," "))))}),e.jsx("dd",{className:te("min-w-0 [overflow-wrap:anywhere]",l.has(a)&&"tabular-nums"),children:ge(r[a])})]},a))})]})}const L=":overview",S=":activity",k=":relationships";function Ue({active:t,children:s}){const[l,r]=_.useState(t);return _.useEffect(()=>{t&&r(!0)},[t]),!t&&!l?null:e.jsx(F,{value:L,forceMount:!0,hidden:!t,children:s})}const He={},We=()=>{};function Ye({namespace:t,entity:s,recordUrl:l,viewKey:r,onDeleted:m}){const a=me({strict:!1}),o=U(),c={slug:t.slug,organizationId:t.id},d=Ae(c),{data:x}=H(s.entity_type,c),p=d.data??[],u={type:s.entity_type,id:s.id,slug:s.slug,parentId:s.parent_id},h=J(p,u,"overview"),N=J(p,u,"tab"),i=ue(N,r),g=!r&&a.tab==="relationships",b=!r&&!g&&(h.length===0||a.tab==="activity"),v=!r&&!g&&!b,y=n=>`${l}${Ne(n)}`,j=n=>void o({to:".",search:n,replace:!0}),C={type:s.entity_type,entity:s.is_derived?s.slug:s.id},w=s.is_derived?e.jsx(Be,{entity:s,schema:x?.metadata_schema}):e.jsx(ze,{entity:s,entityTypeSlug:s.entity_type,orgContext:c,onDeleted:m}),T=s.is_derived?e.jsx(Fe,{record:{type:s.entity_type,key:s.slug},ownerSlug:t.slug,orgContext:c}):e.jsx(Oe,{entityId:s.id,ownerSlug:t.slug}),P=e.jsxs(e.Fragment,{children:[d.isError&&e.jsx(B,{onRetry:()=>void d.refetch()}),h.map(n=>e.jsx("section",{className:"mb-4 min-w-0","data-testid":"view-card","data-view":n.key,children:e.jsx(K,{orgSlug:t.slug,viewKey:n.key,scope:C,params:He,onParamsChange:We,contentHash:n.content_hash,title:n.name,minHeight:160})},n.key))]});return r&&d.data===void 0?d.isError?e.jsx(B,{onRetry:()=>void d.refetch()}):null:!r&&!g&&a.tab!=="activity"&&d.data===void 0&&!d.isError?e.jsxs("div",{className:"mt-4 grid gap-6 lg:grid-cols-[18rem_minmax(0,1fr)]",children:[e.jsx("aside",{className:"min-w-0 lg:pr-2",children:w}),e.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"Loading views…"})]}):i.kind==="missing"?e.jsx(Le,{viewKey:i.key,backTo:l,backLabel:`Back to ${s.name}`}):e.jsxs("div",{className:"mt-4 grid gap-6 lg:grid-cols-[18rem_minmax(0,1fr)]",children:[e.jsx("aside",{className:"min-w-0 lg:pr-2",children:w}),e.jsxs(Te,{className:"min-w-0",value:i.kind==="tab"?i.view.key:g?k:b?S:L,onValueChange:n=>void o({to:n===L||n===S||n===k?l:y(n),search:n===k?{tab:"relationships"}:n===S?{tab:"activity"}:{}}),children:[e.jsxs(Pe,{className:"max-w-full justify-start overflow-x-auto",children:[h.length>0&&e.jsx(I,{value:L,children:h.length===1?h[0].name:"Overview"}),e.jsx(I,{value:S,children:"Activity"}),e.jsx(I,{value:k,children:"Relationships"}),N.map(n=>e.jsx(I,{value:n.key,"data-testid":`tab-${n.key}`,children:n.name},n.key))]}),h.length>0&&e.jsx(Ue,{active:v,children:P},`${t.id}/${s.entity_type}/${s.is_derived?s.slug:s.id}`),e.jsx(F,{value:k,children:T}),e.jsxs(F,{value:S,children:[d.isError&&e.jsx(B,{onRetry:()=>void d.refetch()}),e.jsx(Ce,{entity:s,organizationId:t.id,ownerSlug:t.slug})]}),i.kind==="tab"&&e.jsxs(F,{value:i.view.key,children:[e.jsx($e,{decls:i.view.params,params:Q(a),onParamsChange:n=>void o({to:".",search:n})}),e.jsx(K,{orgSlug:t.slug,viewKey:i.view.key,scope:C,params:Q(a),onParamsChange:j,contentHash:i.view.content_hash,title:i.view.name,minHeight:320})]})]})]})}function qe(t){return t?.trim()?t:void 0}function mt({namespace:t,path:s,entity:l,viewKey:r}){const m=U(),{data:a}=H(l.entity_type,{slug:t.slug}),o=qe(a?.icon),c=s.map(u=>({entity_type:u.entity_type,slug:u.slug})),d=`/${t.slug}/${Se(l.entity_type)}`,x=R(t.slug,c),p=s.length>1?R(t.slug,c.slice(0,-1)):d;return e.jsxs("div",{className:"mx-auto flex min-h-0 w-full max-w-7xl flex-1 flex-col gap-4 px-4 py-6 lg:px-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:e.jsx(E,{asChild:!0,variant:"ghost",size:"sm",className:"-ml-2 h-7 w-fit px-2 text-muted-foreground hover:text-foreground",children:e.jsxs(ke,{to:p,children:[e.jsx(Ee,{className:"mr-1 h-4 w-4"}),"Back"]})})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(Re,{metadata:l.metadata,metadataSchema:a?.metadata_schema,name:l.name,typeIcon:o,className:"h-6 w-6"}),e.jsx("h2",{className:"text-lg font-semibold leading-tight",children:l.name})]})]}),e.jsx(Ye,{namespace:t,entity:l,recordUrl:x,viewKey:r,onDeleted:()=>{const u=s.slice(0,-1);u.length>0?m({to:R(t.slug,u)}):m({to:d})}})]})}export{mt as EntityPage};
|
|
2
|
+
//# sourceMappingURL=entity-page-Dc0LGr5U.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as e,M as $,k as W,ed as me,em as xe,eg as Q,bx as ae,r as x,ee as he,ef as pe,d5 as ge,d7 as fe,B as f,cy as V,d6 as je,y as C,bn as q,bo as P,bp as M,bq as I,br as R,I as T,a1 as ve,ep as Ne,e_ as ye,e$ as be,X as H,dv as ne,dj as re,Q as Se,a_ as le,f0 as ie,f1 as we,b7 as oe,f2 as Ce,eS as ke,bO as Ee,bP as Y,bS as _e,f3 as Re,by as Te,f4 as Oe,f5 as De,P as G}from"./index-Cr5hwh-C.js";import{J as B}from"./json-diff-DBoag_OS.js";import{C as ce}from"./code-editor-DHeyRGZI.js";function Ae(s){switch(s){case"create":return"default";case"update":return"secondary";case"delete":return"destructive";default:return"outline"}}function Fe(s){switch(s){case"create":return"Created";case"update":return"Updated";case"delete":return"Deleted";default:return s}}function ze(s){try{return new Date(s).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}catch{return s}}function qe({entry:s}){return e.jsxs("div",{className:"relative pl-6 pb-6 last:pb-0",children:[e.jsx("div",{className:"absolute left-0 top-1.5 h-3 w-3 rounded-full border-2 border-border bg-background"}),e.jsx("div",{className:"absolute left-[5px] top-5 bottom-0 w-px bg-border last:hidden"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{variant:Ae(s.action),children:Fe(s.action)}),s.actor&&e.jsx("span",{className:"text-xs text-muted-foreground",children:s.actor})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:ze(s.created_at)}),s.action==="update"&&e.jsx(B,{before:s.before_payload,after:s.after_payload}),s.action==="create"&&s.after_payload&&e.jsx(B,{before:null,after:s.after_payload}),s.action==="delete"&&s.before_payload&&e.jsx(B,{before:s.before_payload,after:null})]})]})}function Pe({entityType:s}){const{orgContext:a}=W(),{data:c,isLoading:n}=me(a),{data:r}=xe(a),t=(c||[]).filter(m=>m.status==="active"),i=t.filter(m=>!m.organization_slug||m.organization_slug===a?.slug),o=i.filter(m=>m.purpose!==Q),d=i.filter(m=>m.purpose===Q),h=t.filter(m=>m.organization_slug&&m.organization_slug!==a?.slug);return e.jsx("div",{className:"space-y-4 py-4",children:n?e.jsx(ae,{label:"relationships",variant:"rows",rows:4}):e.jsxs(e.Fragment,{children:[e.jsx(J,{entityTypeSlug:s.slug,relationshipTypes:o,allEntityTypes:r||[]}),d.length>0&&e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Managed by access control"}),e.jsx(J,{entityTypeSlug:s.slug,relationshipTypes:d,allEntityTypes:r||[],readOnly:!0})]}),h.length>0&&e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"From public catalogs"}),e.jsx(J,{entityTypeSlug:s.slug,relationshipTypes:h,allEntityTypes:r||[],readOnly:!0})]}),e.jsx(Le,{entityTypeSlug:s.slug,relationshipTypes:o,allEntityTypes:r||[]})]})})}function J({entityTypeSlug:s,relationshipTypes:a,allEntityTypes:c,readOnly:n=!1}){return e.jsx("div",{className:"space-y-2",children:a.map(r=>e.jsx(Me,{relationshipType:r,entityTypeSlug:s,allEntityTypes:c,readOnly:n},r.id))})}function Me({relationshipType:s,entityTypeSlug:a,allEntityTypes:c,readOnly:n=!1}){const{orgContext:r}=W(),{data:t}=Ne(s.slug,r),i=ye(),o=(t||[]).filter(h=>h.source_entity_type_slug===a||h.target_entity_type_slug===a);if(o.length===0)return null;const d=new Map(c.map(h=>[h.slug,h.name]));return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s.name}),e.jsx("code",{className:"text-[11px] bg-muted px-1.5 py-0.5 rounded text-muted-foreground",children:s.slug}),s.is_symmetric&&e.jsx($,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"symmetric"}),n&&e.jsx($,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:"read-only"})]}),o.map(h=>e.jsx(Ie,{rule:h,entityTypeSlug:a,entityTypeNameMap:d,onRemove:()=>i.mutate(h.id),isRemoving:i.isPending,readOnly:n},h.id))]})}function Ie({rule:s,entityTypeSlug:a,entityTypeNameMap:c,onRemove:n,isRemoving:r,readOnly:t=!1}){const[i,o]=x.useState(!1),d=s.source_entity_type_slug===a,h=d?s.target_entity_type_slug:s.source_entity_type_slug,m=c.get(h)||h;return e.jsxs("div",{className:"flex items-center gap-2 py-1.5 px-3 rounded-md border border-border bg-muted/30 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:d?"this":m}),e.jsx(be,{className:"h-3 w-3 text-muted-foreground shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:d?m:"this"}),t?null:i?e.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[e.jsx(f,{variant:"destructive",size:"sm",className:"h-6 px-2 text-xs",onClick:n,disabled:r,children:r?"Removing...":"Remove"}),e.jsx(f,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>o(!1),disabled:r,children:"Cancel"})]}):e.jsx("div",{className:"ml-auto",children:e.jsx(f,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-muted-foreground hover:text-destructive",onClick:()=>o(!0),disabled:r,children:e.jsx(H,{className:"h-3 w-3"})})})]})}function Le({entityTypeSlug:s,relationshipTypes:a,allEntityTypes:c}){const{orgContext:n}=W(),r=c.filter(l=>!l.organization_slug||l.organization_slug===n?.slug),[t,i]=x.useState(!1),[o,d]=x.useState("existing"),[h,m]=x.useState(""),[w,N]=x.useState(""),[y,b]=x.useState("source"),[g,j]=x.useState(""),[k,E]=x.useState(""),[D,S]=x.useState(!1),[A,_]=x.useState(null),u=he(),p=pe(),v=()=>{d("existing"),m(""),N(""),b("source"),j(""),E(""),S(!1),_(null)},O=l=>{i(l),l||v()},F=l=>l.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,""),U=async()=>{_(null);try{let l=h;if(o==="new"){if(!g.trim()){_("Name is required");return}const K=k.trim()||F(g);if(!K){_("Slug is required");return}l=(await u.mutateAsync({slug:K,name:g.trim(),is_symmetric:D})).relationship_type.slug}if(!l){_("Select a relationship type");return}if(!w){_("Select a target entity type");return}const L=y==="source"?s:w,ue=y==="source"?w:s;await p.mutateAsync({slug:l,source_entity_type_slug:L,target_entity_type_slug:ue}),O(!1)}catch(l){_(l instanceof Error?l.message:"An error occurred")}},z=u.isPending||p.isPending;return e.jsxs(ge,{open:t,onOpenChange:O,children:[e.jsx(fe,{asChild:!0,children:e.jsxs(f,{variant:"outline",size:"sm",className:"w-full",children:[e.jsx(V,{className:"h-3.5 w-3.5 mr-1.5"}),"Add Relationship Rule"]})}),e.jsx(je,{className:"w-80 p-4",align:"start",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{className:"text-xs",children:"Relationship Type"}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx(f,{variant:o==="existing"?"default":"outline",size:"sm",className:"h-7 text-xs flex-1",onClick:()=>d("existing"),children:"Existing"}),e.jsx(f,{variant:o==="new"?"default":"outline",size:"sm",className:"h-7 text-xs flex-1",onClick:()=>d("new"),children:"Create New"})]})]}),o==="existing"?e.jsxs(q,{value:h,onValueChange:m,children:[e.jsx(P,{className:"h-8 text-sm",children:e.jsx(M,{placeholder:"Select relationship type..."})}),e.jsxs(I,{children:[a.map(l=>e.jsx(R,{value:l.slug,children:l.name},l.slug)),a.length===0&&e.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No relationship types yet. Create one."})]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{placeholder:"Name (e.g. Integrates With)",className:"h-8 text-sm",value:g,onChange:l=>{j(l.target.value),k||E("")}}),e.jsx(T,{placeholder:g?F(g)||"slug":"Slug (auto-generated)",className:"h-8 text-sm",value:k,onChange:l=>E(l.target.value)}),e.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:D,onChange:l=>S(l.target.checked),className:"rounded"}),"Symmetric (A↔B = B↔A)"]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{className:"text-xs",children:"Direction"}),e.jsxs(q,{value:y,onValueChange:l=>b(l),children:[e.jsx(P,{className:"h-8 text-sm",children:e.jsx(M,{})}),e.jsxs(I,{children:[e.jsx(R,{value:"source",children:"This type → other"}),e.jsx(R,{value:"target",children:"Other → this type"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(C,{className:"text-xs",children:[y==="source"?"Target":"Source"," Entity Type"]}),e.jsxs(q,{value:w,onValueChange:N,children:[e.jsx(P,{className:"h-8 text-sm",children:e.jsx(M,{placeholder:"Select entity type..."})}),e.jsx(I,{children:r.map(l=>e.jsxs(R,{value:l.slug,children:[l.icon?`${l.icon} `:"",l.name]},l.slug))})]})]}),A&&e.jsx("p",{className:"text-xs text-destructive",children:A}),e.jsx(f,{size:"sm",className:"w-full",onClick:U,disabled:z,children:z?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"mr-1.5"}),"Saving..."]}):"Add Rule"})]})})]})}function Ve({options:s,onChange:a}){const[c,n]=x.useState(""),r=()=>{const i=c.trim();i&&!s.includes(i)&&(a([...s,i]),n(""))},t=i=>{a(s.filter((o,d)=>d!==i))};return e.jsxs("div",{className:"space-y-2 pl-4 border-l-2 border-muted",children:[e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map((i,o)=>e.jsxs("span",{className:"inline-flex items-center gap-1 bg-muted text-sm px-2 py-0.5 rounded",children:[i,e.jsx("button",{type:"button",onClick:()=>t(o),className:"text-muted-foreground hover:text-foreground",children:e.jsx(H,{className:"h-3 w-3"})})]},i))}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx(T,{value:c,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&(i.preventDefault(),r())},placeholder:"Add option...",className:"h-7 text-sm"}),e.jsx(f,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2",onClick:r,children:e.jsx(V,{className:"h-3 w-3"})})]})]})}const Ue=[{value:"string",label:"String"},{value:"number",label:"Number"},{value:"integer",label:"Integer"},{value:"boolean",label:"Boolean"},{value:"enum",label:"Enum"}];function Be({examples:s,onChange:a}){const[c,n]=x.useState(""),r=()=>{const t=c.trim();t&&!s.includes(t)&&(a([...s,t]),n(""))};return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map((t,i)=>e.jsxs("span",{className:"inline-flex items-center gap-1 bg-muted text-xs px-2 py-0.5 rounded",children:[t,e.jsx("button",{type:"button",onClick:()=>a(s.filter((o,d)=>d!==i)),className:"text-muted-foreground hover:text-foreground",children:e.jsx(H,{className:"h-3 w-3"})})]},t))}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx(T,{value:c,onChange:t=>n(t.target.value),onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),r())},placeholder:"Add example...",className:"h-7 text-xs"}),e.jsx(f,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2",onClick:r,children:e.jsx(V,{className:"h-3 w-3"})})]})]})}function Je({field:s,onChange:a,onDelete:c}){const[n,r]=x.useState(!!(s.description||s.default||s.role||s.examples&&s.examples.length>0));return e.jsxs("div",{className:"rounded-md border border-border p-2.5 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>r(!n),className:"text-muted-foreground hover:text-foreground shrink-0",children:n?e.jsx(ne,{className:"h-3.5 w-3.5"}):e.jsx(re,{className:"h-3.5 w-3.5"})}),e.jsx(T,{value:s.name,onChange:t=>a({...s,name:t.target.value}),placeholder:"Field name",className:"h-8 flex-1"}),e.jsxs(q,{value:s.type,onValueChange:t=>a({...s,type:t,enumOptions:t==="enum"?s.enumOptions||[]:void 0,role:t==="enum"||s.role!=="workflowState"?s.role:void 0}),children:[e.jsx(P,{className:"h-8 w-32",children:e.jsx(M,{})}),e.jsx(I,{children:Ue.map(t=>e.jsx(R,{value:t.value,children:t.label},t.value))})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-muted-foreground whitespace-nowrap",children:[e.jsx(Se,{checked:s.required,onCheckedChange:t=>a({...s,required:t===!0})}),e.jsx("span",{children:"Required"})]}),e.jsx(f,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",onClick:c,children:e.jsx(le,{className:"h-3.5 w-3.5"})})]}),s.type==="enum"&&e.jsx("div",{className:"pl-6",children:e.jsx(Ve,{options:s.enumOptions||[],onChange:t=>a({...s,enumOptions:t})})}),n&&e.jsxs("div",{className:"pl-6 space-y-2 pt-1",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"Description"}),e.jsx(T,{value:s.description||"",onChange:t=>a({...s,description:t.target.value||void 0}),placeholder:"Field description",className:"h-7 text-xs mt-0.5"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"Default"}),e.jsx(T,{value:s.default||"",onChange:t=>a({...s,default:t.target.value||void 0}),placeholder:s.type==="boolean"?"true / false":"Default value",className:"h-7 text-xs mt-0.5"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"View role"}),e.jsxs(q,{value:s.role||"none",onValueChange:t=>a({...s,role:t==="workflowState"||t==="sortRank"?t:void 0}),children:[e.jsx(P,{className:"h-7 text-xs mt-0.5",children:e.jsx(M,{})}),e.jsxs(I,{children:[e.jsx(R,{value:"none",children:"None"}),e.jsx(R,{value:"workflowState",disabled:s.type!=="enum",children:"Workflow state (board)"}),e.jsx(R,{value:"sortRank",children:"Sort rank"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"Examples"}),e.jsx("div",{className:"mt-0.5",children:e.jsx(Be,{examples:s.examples||[],onChange:t=>a({...s,examples:t.length>0?t:void 0})})})]})]})]})}function X({value:s,onChange:a,readonly:c,error:n}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{value:s,onChange:a,readonly:c,placeholder:'{ "type": "object", "properties": {} }',minHeight:"200px"}),n&&e.jsx("p",{className:"text-sm text-destructive",children:n})]})}function Z(s){if(s.type!=="object")return!1;const a=s.properties;if(!a||typeof a!="object")return Object.keys(s).length<=1;for(const c of Object.values(a)){if(!c||typeof c!="object")return!1;const n=c,r=n.type;if(!n.enum&&(!r||!["string","number","integer","boolean"].includes(r)||n.properties||n.items||n.allOf||n.oneOf||n.anyOf))return!1}return!0}function de(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`field-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function ee(s){const a=s.properties||{},c=s.required||[];return Object.entries(a).map(([n,r])=>{const t=r["x-lobu"]?.role||r["x-lobu-role"],i=t==="workflowState"?"workflowState":t==="sortRank"?"sortRank":void 0,o={id:de(),name:n,required:c.includes(n),description:r.description||void 0,default:r.default!==void 0?String(r.default):void 0,examples:Array.isArray(r.examples)?r.examples.map(String):void 0,role:i};return r.enum?{...o,type:"enum",enumOptions:r.enum||[]}:{...o,type:r.type||"string"}})}function se(s,a){if(a==="number"||a==="integer"){const c=Number(s);return Number.isNaN(c)?s:c}return a==="boolean"?s==="true"?!0:s==="false"?!1:s:s}function $e(s,a="auto"){const c={},n=[];for(const t of s){if(!t.name.trim())continue;const i={};t.type==="enum"?i.enum=t.enumOptions||[]:i.type=t.type,t.description?.trim()&&(i.description=t.description.trim()),t.default!==void 0&&t.default!==""&&(i.default=se(t.default,t.type)),t.examples&&t.examples.length>0&&(i.examples=t.examples.map(o=>se(o,t.type))),t.role&&(i["x-lobu"]={role:t.role,...t.role==="workflowState"&&t.type==="enum"?{states:(t.enumOptions||[]).map(o=>({value:o,label:o.replace(/[_-]+/g," ").replace(/\b\w/g,d=>d.toUpperCase()),terminal:["done","complete","completed","closed","archived"].includes(o.toLowerCase())}))}:{}}),c[t.name]=i,t.required&&n.push(t.name)}const r={type:"object",properties:c};return n.length>0&&(r.required=n),a&&a!=="auto"&&(r["x-lobu"]={defaultView:a}),r}function te(s){const a=s["x-lobu"]?.defaultView;return a==="table"||a==="board"?a:"auto"}function We({value:s,onChange:a,readonly:c=!1}){const[n,r]=x.useState("visual"),[t,i]=x.useState([]),[o,d]=x.useState("auto"),[h,m]=x.useState(""),[w,N]=x.useState(null),[y,b]=x.useState(!1),g=x.useRef(!1);x.useEffect(()=>{if(g.current){g.current=!1;return}if(!s||Object.keys(s).length===0){i([]),d("auto"),m(""),b(!1);return}const u=JSON.stringify(s,null,2);m(u),d(te(s)),Z(s)?(i(ee(s)),b(!1)):(b(!0),r("json"))},[s]);const j=x.useCallback((u,p)=>{g.current=!0;const v=$e(u,p),O=u.some(F=>F.name.trim());m(O?JSON.stringify(v,null,2):""),a(O?v:void 0)},[a]),k=x.useCallback(u=>{i(u),j(u,o)},[j,o]),E=x.useCallback(u=>{d(u),j(t,u)},[j,t]),D=x.useCallback(u=>{if(g.current=!0,m(u),!u.trim()){N(null),i([]),d("auto"),a(void 0);return}try{const p=JSON.parse(u);N(null),d(te(p)),Z(p)?(i(ee(p)),b(!1)):b(!0),a(p)}catch(p){N(p instanceof Error?p.message:"Invalid JSON")}},[a]),S=()=>{k([...t,{id:de(),name:"",type:"string",required:!1}])},A=(u,p)=>{const v=[...t];v[u]=p,k(v)},_=u=>{k(t.filter((p,v)=>v!==u))};return c?e.jsx(X,{value:h,onChange:()=>{},readonly:!0}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(f,{type:"button",variant:n==="visual"?"default":"outline",size:"sm",onClick:()=>!y&&r("visual"),disabled:y,className:"h-7 text-xs",children:[e.jsx(ie,{className:"h-3 w-3 mr-1"}),"Visual"]}),e.jsxs(f,{type:"button",variant:n==="json"?"default":"outline",size:"sm",onClick:()=>r("json"),className:"h-7 text-xs",children:[e.jsx(we,{className:"h-3 w-3 mr-1"}),"JSON"]})]}),y&&e.jsxs("div",{className:"flex items-start gap-2 p-2 rounded-md bg-amber-500/10 text-amber-600 text-xs",children:[e.jsx(oe,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),e.jsx("span",{children:"This schema uses advanced features (nested objects, allOf, etc.) that can only be edited in JSON mode."})]}),n==="visual"?e.jsxs("div",{className:"space-y-3",children:[t.map((u,p)=>e.jsx(Je,{field:u,onChange:v=>A(p,v),onDelete:()=>_(p)},u.id)),e.jsxs(f,{type:"button",variant:"outline",size:"sm",onClick:S,className:"w-full",children:[e.jsx(V,{className:"h-3.5 w-3.5 mr-1"}),"Add Field"]}),t.some(u=>u.name.trim())&&e.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border p-2.5",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"Default view"}),e.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"Which view this type opens in. Auto picks from your fields (a workflow field → board, otherwise table)."})]}),e.jsxs(q,{value:o,onValueChange:u=>E(u),children:[e.jsx(P,{className:"h-8 w-32 text-xs",children:e.jsx(M,{})}),e.jsxs(I,{children:[e.jsx(R,{value:"auto",children:"Auto"}),e.jsx(R,{value:"table",children:"Table"}),e.jsx(R,{value:"board",children:"Board"})]})]})]})]}):e.jsx(X,{value:h,onChange:D,error:w})]})}function He(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Ke({entityType:s,onCancel:a,onSaved:c}){const n=!!s,r=Ce(),t=ke(),i=s?.slug??"new",o=Ee(i,{name:s?.name??"",slug:s?.slug??"",description:s?.description??"",icon:s?.icon??"",color:s?.color??"",metadataSchema:s?.metadata_schema??void 0,backingSql:s?.backing_sql??""}),[d,h]=o.field("name"),[m,w]=o.field("slug"),[N,y]=o.field("description"),[b,g]=o.field("icon"),[j,k]=o.field("color"),[E,D]=o.field("metadataSchema"),[S,A]=o.field("backingSql"),[_,u]=Y(i,n),[p,v]=Y(i,null),O=S.trim().length>0,F=l=>{h(l),!n&&!_&&w(He(l))},U=async()=>{if(!o.canSubmit)return;if(v(null),!d.trim()){v("Name is required");return}if(!n&&!m.trim()){v("Slug is required");return}const l=O?{sql:S.trim()}:null;try{n?await t.mutateAsync({slug:s.slug,name:d.trim(),description:N.trim()||void 0,icon:b.trim()||void 0,color:j.trim()||void 0,metadata_schema:O?void 0:E,backing:l}):await r.mutateAsync({slug:m.trim(),name:d.trim(),description:N.trim()||void 0,icon:b.trim()||void 0,color:j.trim()||void 0,metadata_schema:O?void 0:E,backing:l}),c()}catch(L){v(L instanceof Error?L.message:"An error occurred")}},z=r.isPending||t.isPending;return e.jsxs("div",{className:"space-y-5",children:[e.jsx(_e,{visible:o.hasConflict,onReload:o.reset}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"et-name",children:"Name"}),e.jsx(T,{id:"et-name",value:d,onChange:l=>F(l.target.value),placeholder:"e.g. Product"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"et-slug",children:"Slug"}),e.jsx(T,{id:"et-slug",value:m,onChange:l=>{u(!0),w(l.target.value)},placeholder:"e.g. topic",disabled:n}),n&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Slug cannot be changed after creation."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"et-desc",children:"Description"}),e.jsx(Re,{id:"et-desc",value:N,onChange:l=>y(l.target.value),placeholder:"Optional description...",rows:2})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"et-icon",children:"Icon (emoji)"}),e.jsx(T,{id:"et-icon",value:b,onChange:l=>g(l.target.value),placeholder:"e.g. 📦"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"et-color",children:"Color"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{id:"et-color",value:j,onChange:l=>k(l.target.value),placeholder:"e.g. #6366f1",className:"flex-1"}),j&&e.jsx("div",{className:"h-9 w-9 rounded-md border border-border shrink-0",style:{backgroundColor:j}})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"Backing query (SQL)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. A read-only SELECT turns this into a derived (view) type — rows are computed from the query, not stored. Leave empty for a normal stored type. Table references are auto-scoped to your organization."}),e.jsx(ce,{value:S,onChange:A,minHeight:"120px",placeholder:"SELECT (metadata->>'vendor') AS vendor, SUM((metadata->>'amount')::numeric) AS total FROM events GROUP BY 1"})]}),O?e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-start gap-2 rounded-lg bg-muted px-3 py-2 text-sm text-muted-foreground",children:[e.jsx(ie,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsx("span",{children:"Derived view — columns are computed from the query, so there's no stored-row schema to define."})]}),s?.measure_columns&&s.measure_columns.length>0&&e.jsxs("div",{className:"space-y-1 pt-1",children:[e.jsx(C,{children:"Measure columns"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.measure_columns.map(l=>e.jsx("span",{className:"rounded-md border border-border bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground",children:l},l))})]})]}):e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"Metadata Schema"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Define the structure of metadata fields for entities of this type."}),e.jsx(We,{value:E,onChange:D})]}),n&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"Relationships"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Define how this entity type relates to others."}),e.jsx(Pe,{entityType:s})]}),p&&e.jsx("div",{className:"p-3 rounded-md bg-destructive/10 text-destructive text-sm",children:p}),e.jsx(Te,{onCancel:a,cancelDisabled:z,className:"pt-2",children:e.jsx(f,{onClick:U,disabled:z,children:z?"Saving...":n?"Update":"Create"})})]})}function Ze({entityType:s,onClose:a,orgContext:c,hideDelete:n=!1,compact:r=!1}){const t=!!s,[i,o]=x.useState(!1),[d,h]=x.useState(!1),[m,w]=x.useState(null),N=Oe(),{data:y,isLoading:b}=De(i&&s?s.slug:null,c),g=s?.entity_count??0,j=g>0,k=async()=>{if(s){w(null);try{await N.mutateAsync(s.slug),a()}catch(S){w(S instanceof Error?S.message:"Failed to delete")}}},E=t?`${s?.icon||"📄"} ${s?.name}`:"Create Entity Type",D=t?"Edit entity type configuration.":"Define a new entity type for your workspace.";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:G("space-y-1.5",!t&&!r&&"text-center"),children:[e.jsx("h1",{className:G("font-semibold leading-tight",r?"text-lg":"text-2xl"),children:E}),e.jsx("p",{className:"text-sm text-muted-foreground",children:D})]}),e.jsx("div",{className:"py-4",children:e.jsx(Ke,{entityType:s,onCancel:a,onSaved:a})}),t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border-t border-border pt-4",children:[e.jsxs("button",{type:"button",onClick:()=>o(!i),className:"flex items-center gap-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors w-full",children:[i?e.jsx(ne,{className:"h-4 w-4"}):e.jsx(re,{className:"h-4 w-4"}),"History"]}),i&&e.jsx("div",{className:"mt-3",children:b?e.jsx(ae,{label:"history",variant:"rows",rows:4}):y&&y.length>0?e.jsx("div",{className:"relative ml-1.5",children:y.map(S=>e.jsx(qe,{entry:S},S.id))}):e.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No audit history found."})})]}),!n&&e.jsx("div",{className:"border-t border-border pt-4 mt-4",children:d?e.jsxs("div",{className:"space-y-3",children:[j?e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-md bg-amber-500/10 text-amber-600",children:[e.jsx(oe,{className:"h-5 w-5 shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"font-medium",children:"Cannot delete this entity type"}),e.jsxs("p",{className:"mt-1 text-amber-600/80",children:["There ",g===1?"is":"are"," ",g," entit",g===1?"y":"ies",' of type "',s.name,'". Migrate or delete them first.']})]})]}):e.jsxs("p",{className:"text-sm text-muted-foreground",children:['Are you sure you want to delete "',s.name,'"? This action will soft-delete the entity type. It can be restored by a database administrator.']}),m&&e.jsx("div",{className:"p-3 rounded-md bg-destructive/10 text-destructive text-sm",children:m}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{variant:"outline",size:"sm",onClick:()=>{h(!1),w(null)},children:"Cancel"}),e.jsx(f,{variant:"destructive",size:"sm",onClick:k,disabled:j||N.isPending,children:N.isPending?"Deleting...":"Delete"})]})]}):e.jsxs(f,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>h(!0),children:[e.jsx(le,{className:"h-3.5 w-3.5 mr-1.5"}),"Delete entity type"]})})]})]})}export{Ze as E};
|
|
2
|
+
//# sourceMappingURL=entity-type-page-CwZxa0BR.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{g as J,T as Z,r as D,fJ as q,fs as I,j as s,bZ as M,L as Q}from"./index-Cr5hwh-C.js";import{u as W,E as X}from"./events-feed-BtvhZF1f.js";import{b as Y,a as z,V as K,M as ee}from"./view-param-filters-CqLZQrnO.js";const se={},te="calc(100dvh - 120px)";function ie({owner:n,organizationId:o,eventId:c,viewKey:r,params:g,onParamsChange:d,onSelectView:p,dense:m=!1,fullBleed:k=!1}){const{isAuthenticated:y,isReady:E}=J(),{data:T,isLoading:w}=Z(),O=T?.some(t=>t.id===o&&t.is_member),i=n!=="me"&&o!==null&&E&&y&&!w&&O,a=W(i?{slug:n,organizationId:o}:null,c),[j,b]=D.useState(se),[P,L]=D.useState(null),u=q(a.views,r),e=i&&!a.isLoading&&!a.isError&&u.kind==="view"?u.view:null,v=e?`${I(n,e.key)}/${e.content_hash}/${e.eventId}`:null,f=e!==null&&P===v,V=M(n,c),F=n!=="me"&&(!E||y&&(w||a.isLoading)),H=e!==null&&!f&&!F,h=k&&H,U=(k||m)&&H,N=F?s.jsx("div",{role:"status",className:"py-8 text-sm text-muted-foreground",children:"Loading event view…"}):e&&!f?s.jsxs(s.Fragment,{children:[s.jsx(Y,{decls:e.params,params:g??j,onParamsChange:t=>d?d(e.key,t,{replace:!1}):b(t)}),s.jsx(z,{orgSlug:n,viewKey:e.key,scope:{event:e.eventId},params:g??j,onParamsChange:t=>d?d(e.key,t):b(t),onLoadError:()=>L(v),contentHash:e.content_hash,title:e.name,minHeight:m?240:320,fixedHeight:U?te:void 0},v)]}):void 0;return s.jsxs("div",{className:h?"w-full space-y-3":"mx-auto w-full max-w-3xl space-y-3",...h?{"data-testid":"event-view-fullbleed"}:{},children:[i&&a.isError&&s.jsx(K,{onRetry:a.refetch}),(i||n==="me"&&r)&&!a.isLoading&&!a.isError&&u.kind==="missing"&&s.jsx(ee,{viewKey:u.key,backTo:V,backLabel:"Back to the event"}),f&&s.jsxs("div",{role:"alert",className:"rounded-md border p-3 text-sm",children:[s.jsx("p",{children:"The custom view couldn’t load. The event content is shown below."}),s.jsx("button",{type:"button",className:"mt-2 underline",onClick:()=>L(null),children:"Retry custom view"})]}),s.jsx(X,{presentation:"detail",organizationId:o,ownerSlug:n,filters:{contentIds:[c],...n==="me"?{sortBy:"date",sortOrder:"desc"}:{}},dense:m,hideDetails:m,renderDetail:t=>{const x=N!=null&&(t==null||!!r),A=(i?a.views:[]).filter(l=>!x||l.key!==e?.key).map(l=>({key:l.key,name:l.name,href:M(n,c,l.key)})),S=l=>l.length?s.jsx("nav",{"aria-label":"Event views",className:"flex flex-wrap gap-3 text-sm",children:l.map(({key:$,name:C,href:B})=>s.jsx(Q,{to:B,className:"underline",onClick:p?G=>{G.preventDefault(),p(B)}:void 0,children:C},$))}):null,R=[...A],_=[...A];return i&&r&&t!=null&&_.unshift({key:":event",name:"Event details",href:V}),{content:x?N:t,nativeHeading:!x&&t!=null,headingAside:h?S(R):void 0,links:h?null:S(_)}}})]})}export{ie as E};
|
|
2
|
+
//# sourceMappingURL=event-detail-ve2d6Gbb.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as e,L as oe,dj as bt,dk as Ye,cd as _t,bw as wt,r as h,dl as Ze,dm as kt,V as Ct,H as St,di as Rt,aR as At,dn as Xe,b6 as et,dp as It,dq as Tt,cr as Et,aV as $t,P as Te,dr as tt,ds as Dt,dt as be,dc as Ce,B as $,du as ve,dv as ye,M as pe,dw as st,dx as ze,dy as nt,d5 as Pt,d7 as Ot,d6 as Ft,dz as Mt,dA as Lt,ce as rt,dB as Bt,dC as zt,m as Ht,u as Vt,k as at,bH as Ue,bZ as qe,Z as Ut,dD as qt,dE as Jt,dF as Kt,dG as it,dH as Qt,dI as Wt,a1 as Se,dJ as Gt,dK as Yt,bO as Zt,dL as Xt,bS as es,dM as ts,dd as ss,dN as ns,X as rs,bi as ot,dO as Ee,dP as $e,dQ as De,cO as as,S as is,aQ as os,cY as ls,g as ds,t as cs,cL as us,cM as ms,cR as ps,cS as xs,dR as hs,dS as fs,dT as gs,dU as vs,bK as ys,dV as js,dW as Fe,bc as Je,ai as Ns}from"./index-Cr5hwh-C.js";import{c as bs}from"./conversations-table-BdXoZAfc.js";import{a as lt,J as _s}from"./renderer-mEDnVW0O.js";import{u as ws}from"./clients-D3Zbjxin.js";function ks(s,t){const n=t.parentEntityType&&t.parentEntitySlug?[{entity_type:t.parentEntityType,slug:t.parentEntitySlug},{entity_type:t.entityType,slug:t.entitySlug}]:[{entity_type:t.entityType,slug:t.entitySlug}];return Ye(s,n)}function Cs({ownerSlug:s,entity:t,className:n}){const r=ks(s,t);return e.jsxs(oe,{to:r,className:`flex items-center gap-1 text-primary hover:underline group ${n??""}`,children:[e.jsx("span",{className:"font-medium",children:t.entityName}),e.jsx(bt,{className:"h-3 w-3 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function dt(s){const t=Array.isArray(s?.records)?s.records:Array.isArray(s?.current)?s.current:[];return[s?.from_entity_id??s?.entity_id,s?.to_entity_id].map(n=>{const i=t.find(l=>l&&typeof l=="object"&&"id"in l&&l.id===n);return{id:String(n??"unknown"),name:typeof i?.name=="string"?i.name:`Record ${String(n??"unknown")}`}})}function ct(s,t){return t==="rejected"?"The proposed relationship change was rejected. Both records remain available.":t==="failed"?"The relationship change failed. Both records remain available.":t==="completed"?s==="link"?"The records were linked. Both records remain available.":"The relationship was removed. Both records remain available.":t==="approved"||t==="confirmed"?"The relationship change was approved. Both records remain available.":s==="link"?"If approved, these records will be linked. Both records remain available.":"If approved, this relationship will be removed. Both records remain available."}function mn(s){const t=dt(s.proposal);return{title:s.action==="link"?"Link records":"Unlink records",icon:"entity",impact:{level:"normal"},tone:"default",blocks:[...t.map((n,r)=>({type:"text",label:r===0?"From":"To",value:n.name})),{type:"text",label:"Relationship",value:String(s.proposal?.relationship_type??s.proposal?.relationship_type_slug??"Relationship")},{type:"text",value:ct(s.action,typeof s.status=="string"?s.status:void 0),muted:!0},...typeof s.reason=="string"&&s.reason?[{type:"text",label:"Why this needs approval",value:s.reason}]:[]],actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",confirm:s.action==="unlink",confirmPrompt:"Remove this relationship? Both records will remain available.",tool:"manage_operations",args:{action:"approve"},resolvedLabel:"Approval submitted."},{id:"reject",label:"Reject",variant:"outline",icon:"x",confirm:!0,confirmPrompt:"Reject this relationship change?",tool:"manage_operations",args:{action:"reject"},resolvedLabel:"Relationship change rejected."}]}}function ut(s,t,n){return{queryKey:["event-view-match",s,t.key,t.content_hash,n],queryFn:async()=>{try{const i=(await _t("open_view",{key:t.key,scope:{event:n}},{slug:s})).scope?.event;if(!Number.isSafeInteger(i)||(i??0)<1)throw new Error("The view did not resolve its event subject");return i}catch(r){if(r instanceof wt&&(r.status===400||r.status===404))return null;throw r}},staleTime:6e4}}function pn(s,t){const n=lt(s??{slug:null,organizationId:null}),r=s?.slug??null,i=h.useMemo(()=>r?Ze(n.data??[]):[],[r,n.data]),l=kt({queries:i.map(a=>ut(r,a,t))});return r?{views:i.flatMap((a,u)=>{const N=l[u]?.data;return N?[{...a,eventId:N}]:[]}),isLoading:n.data===void 0?!n.isError:l.some(a=>a.isPending),isError:n.isError||l.some(a=>a.isError),refetch:()=>{n.refetch();for(const a of l)a.isError&&a.refetch()}}:{views:[],isLoading:!1,isError:!1,refetch:()=>{}}}async function Ss(s,t,n,r){const i=await Promise.all(n.map(l=>s.fetchQuery(ut(t,l,r))));return n.find((l,a)=>i[a])??null}async function Rs(s,t,n,r){const i=await Ct(`${St}/api/${encodeURIComponent(s)}/events/${t}/actions/${encodeURIComponent(n.action)}`,{method:"POST",timeoutMs:9e4,credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:n.value,interaction_id:r})});return await Rt(i,"Could not record interaction"),i.json()}function z(s){if(typeof s!="string")return;const t=s.trim();return t.length>0?t:void 0}function Me(s){return typeof s=="boolean"?s:void 0}function As(s,t,n){const r=(n??"").toLowerCase();return!!(r==="prepare_comment"||r==="verify_staged_comment"||r.includes("prepare_")||r.includes("verify_staged")||t?.prepared===!0||typeof t?.verified=="boolean"||z(t?.reason_preview)&&z(t?.message)||z(s?.body)&&(z(s?.post_url)||z(s?.activity_id)))}function Is(s,t,n){if(!As(s,t,n))return null;const r=(n??"").toLowerCase(),i=z(t?.body)??z(s?.body),l=z(t?.reason_preview)??z(s?.reason),a=z(t?.post_url)??z(s?.post_url)??(z(s?.activity_id)?`https://www.linkedin.com/feed/update/urn:li:activity:${z(s?.activity_id)}`:void 0),u=Me(t?.prepared),N=Me(t?.verified),j=Me(t?.banner_shown),b=z(t?.message),f=t?.match&&typeof t.match=="object"?t.match:null,m=z(f?.text_preview),v=z(f?.author);let S="generic";r==="verify_staged_comment"||r.includes("verify")||typeof N=="boolean"?S="verify":(r==="prepare_comment"||r.includes("prepare")||u===!0||i&&a)&&(S="prepare");const g=[];return u===!0&&g.push("Staged — not posted"),u===!1&&g.push("Not staged"),N===!0&&g.push("Verified posted"),N===!1&&g.push("Not verified as posted"),j===!0&&g.push("In-page banner"),j===!1&&g.push("No banner"),{kind:S,message:b,reason:l,body:i,postUrl:a,prepared:u,bannerShown:j,verified:N,matchPreview:m,matchAuthor:v,chips:g}}function we(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function Ts({template:s,data:t,onAction:n}){const[r,i]=h.useState(null),[l,a]=h.useState(!1),[u,N]=h.useState(null),[j,b]=h.useState(!1),f=h.useRef(!1),m=h.useRef(!0);h.useEffect(()=>(m.current=!0,()=>{m.current=!1}),[]);const v=async S=>{if(!(!n||f.current)){f.current=!0,a(!0),N(null),b(!1);try{const g=await n(S);if(!m.current)return;if(we(g)&&g.kind==="sdk"){const _=g.result;if(!we(_)||_.success!==!0){const I=we(_)&&we(_.error)?_.error.message:null;throw new Error(typeof I=="string"?I:"Could not update this event.")}if(_.return_truncated||!we(_.return_value))throw new Error("The update did not return a complete data object.");i(_.return_value),b(!0)}}catch(g){m.current&&N(g instanceof Error?g.message:"Could not update this event.")}finally{f.current=!1,m.current&&a(!1)}}};return e.jsxs("div",{className:"space-y-2",children:[l?e.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"Updating…"}):null,j?e.jsx("p",{role:"status",className:"sr-only",children:"Updated"}):null,u?e.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:[u," Previous data is still shown."]}):null,e.jsx("fieldset",{disabled:!n||l,"aria-busy":l,className:"min-w-0",children:e.jsx(_s,{template:{root:s.root},data:r??t,onAction:n?v:void 0,interactions:s.interactions})})]})}function mt(s){return{audit:s.semantic_type==="audit"&&s.origin_type==="tool_invocation",operation:s.interaction_type==="approval"||s.semantic_type==="operation",changeSet:s.semantic_type==="change_set"}}const Es={};function xe(s){return s.replace(/_/g," ").replace(/\s+/g," ").trim().replace(/^./,t=>t.toUpperCase())}const $s={notification:"Notification",tool_invocation:"Action",deployment:"Deployment",config_change:"Config change",message:"Message",msg:"Note",summary:"Summary"};function Ds(s){return s.author_name?s.author_name:s.platform?xe(s.platform):s.origin_type?$s[s.origin_type]??xe(s.origin_type):null}function Ps(s){return s==null?"":typeof s=="string"?s:typeof s=="number"||typeof s=="boolean"||typeof s=="bigint"?String(s):Array.isArray(s)?s.length===0?"":s.every(t=>typeof t!="object")?s.map(t=>String(t)).join(", "):e.jsx("pre",{className:"overflow-x-auto rounded bg-muted/40 p-2 text-[11px] leading-relaxed whitespace-pre-wrap",children:JSON.stringify(s,null,2)}):e.jsx("pre",{className:"overflow-x-auto rounded bg-muted/40 p-2 text-[11px] leading-relaxed whitespace-pre-wrap",children:JSON.stringify(s,null,2)})}const Le=1e5;function Ke({value:s}){const t=JSON.stringify(s,null,2)??"null",n=t.length>Le;return e.jsxs(e.Fragment,{children:[e.jsx("pre",{className:"max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-md border bg-muted/40 p-3 font-mono text-xs",children:n?t.slice(0,Le):t}),n&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Showing the first ",Le.toLocaleString()," of"," ",t.length.toLocaleString()," characters."]})]})}function Os(s){return Object.entries(s).filter(([,t])=>t==null?!1:typeof t=="string"?t.trim().length>0:Array.isArray(t)?t.length>0:typeof t=="object"?Object.keys(t).length>0:!0).sort(([t],[n])=>t.localeCompare(n))}function Fs({breakdown:s}){if(!s)return null;const t=[{label:"Engagement",value:s.engagement,max:100},{label:"Criticality",value:s.criticality,max:100},{label:"Depth",value:s.depth,max:100},{label:"Authority",value:s.authority,max:100},{label:"Recency",value:s.recency,max:100},{label:"Quality",value:s.quality,max:100}];return e.jsx("div",{className:"space-y-2 text-sm",children:t.map(n=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-20 text-muted-foreground",children:n.label}),e.jsx("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary",style:{width:`${n.value/n.max*100}%`}})}),e.jsx("span",{className:"w-8 text-right",children:n.value})]},n.label))})}function Ms({slug:s,value:t,isManual:n}){return e.jsxs(pe,{variant:"secondary",className:"text-xs",children:[s,": ",t,n&&e.jsx(tt,{className:"ml-1 h-2.5 w-2.5 fill-current"})]})}function Ls(s){if(s&&typeof s=="object"){const t=s;if(Array.isArray(t.values))return{values:t.values.map(n=>String(n)).filter(n=>n.length>0),isManual:t.is_manual===!0};if(t.value!==void 0&&t.value!==null)return{values:[String(t.value)],isManual:t.is_manual===!0};if(typeof t.values=="string"&&t.values.length>0)return{values:[t.values],isManual:t.is_manual===!0}}return typeof s=="string"||typeof s=="number"||typeof s=="boolean"||typeof s=="bigint"?{values:[String(s)],isManual:!1}:{values:[],isManual:!1}}function pt(s,t){if(s)switch(s){case"pending":return"pending_approval";case"approved":return"confirmed";case"rejected":return"rejected";case"completed":return"completed";case"failed":return"failed";default:return s}return t||"pending_approval"}function Be(s){return!s||typeof s!="object"||Array.isArray(s)?null:s}function Qe(s){return s==null||s===""?"Not set":typeof s=="string"?s:JSON.stringify(s,null,2)}function Bs(s){return s.replace(/\s+[—-]\s+pending approval$/i,"")}function Re(s){return s.replace(/^\$/,"").replace(/[_-]/g," ").replace(/\s+/g," ").trim().replace(/^./,t=>t.toUpperCase())}function xt(s,t,n){return s?.kind==="agent_session"&&s.agent_id?s.client_id?`${s.agent_id} via ${s.client_id}`:s.agent_id:s?.kind==="user"?"a person":t==="agent"?"an agent":n?`Automation ${n}`:"an Automation"}function zs({ownerSlug:s,initiator:t,clientName:n,fallback:r}){const i=t?.client_id??n,{allOrgs:l,isAuthenticated:a}=at(),u=a&&l?.some(v=>v.slug===s),j=ws(void 0,{ownerSlug:s,enabled:!!(i&&u)}).data?.find(v=>v.id===i)?.title,b=t&&t.kind!=="user"?xt(t,void 0,t.automation_id===void 0?void 0:String(t.automation_id)):r,f="font-medium text-foreground",m=`${f} underline-offset-4 hover:underline`;return t?.kind==="automation"&&t.automation_id?e.jsx(oe,{to:"/$owner/automations/$automationId",params:{owner:s,automationId:String(t.automation_id)},search:{view:"definition",run_id:void 0},className:m,children:b}):t?.kind==="agent_session"&&t.agent_id?e.jsx(oe,{to:"/$owner/agents/$agentId",params:{owner:s,agentId:String(t.agent_id)},className:m,children:b}):i?e.jsxs(oe,{to:"/$owner/agents/connected/$clientId",params:{owner:s,clientId:i},className:`${m} inline-flex items-center gap-1 align-middle`,children:[e.jsx(ot,{name:j??n??i}),j??b]}):e.jsx("span",{className:f,children:b})}function Hs(s){const t=Object.keys(s.fields),n=t.map(Re).join(", ")||"field",r=t.length===1?"field":"fields";return`Update ${s.entityType?Re(s.entityType).toLowerCase():"entity"} ${r}: ${n}`}function Vs(s,t){const n=Be(t.fields);if(!n||Object.keys(n).length===0||t.action_key!=="entity_field_change"&&t.tool!=="entity_field_change")return null;const r=Be(t.current)??{},i=s;return{fields:n,current:r,reason:typeof t.reason=="string"?t.reason:void 0,automationId:t.automation_id!=null?String(t.automation_id):void 0,automationName:typeof t.automation_name=="string"?t.automation_name:void 0,automationAgentId:typeof t.automation_agent_id=="string"?t.automation_agent_id:void 0,entityType:typeof t.entity_type=="string"?t.entity_type:void 0,entityName:(typeof t.entity_name=="string"?t.entity_name:void 0)??i.entity_name??void 0,entitySlug:typeof t.entity_slug=="string"?t.entity_slug:void 0,parentSlug:typeof t.parent_slug=="string"?t.parent_slug:void 0,parentEntityType:typeof t.parent_entity_type=="string"?t.parent_entity_type:void 0,attribution:typeof t.attribution=="string"?t.attribution:void 0,initiator:t.initiator&&typeof t.initiator=="object"?t.initiator:void 0}}function Us(s){const t=s.entityType?Re(s.entityType).toLowerCase():"entity";return`${Re(s.operation)} ${t}`}function qs(s,t){if(t.action_key!=="entity_change"&&t.tool!=="entity_change")return null;const n=t.action;if(n!=="create"&&n!=="delete"&&n!=="link"&&n!=="unlink")return null;const r=s;return{operation:n,proposal:Be(t.proposal),reason:typeof t.reason=="string"?t.reason:void 0,automationId:t.automation_id!=null?String(t.automation_id):void 0,automationName:typeof t.automation_name=="string"?t.automation_name:void 0,automationAgentId:typeof t.automation_agent_id=="string"?t.automation_agent_id:void 0,entityType:typeof t.entity_type=="string"?t.entity_type:void 0,entityName:(typeof t.entity_name=="string"?t.entity_name:void 0)??r.entity_name??void 0,entitySlug:typeof t.entity_slug=="string"?t.entity_slug:void 0,parentSlug:typeof t.parent_slug=="string"?t.parent_slug:void 0,parentEntityType:typeof t.parent_entity_type=="string"?t.parent_entity_type:void 0,attribution:typeof t.attribution=="string"?t.attribution:void 0,proposerRationale:typeof t.proposer_rationale=="string"?t.proposer_rationale:void 0,initiator:t.initiator&&typeof t.initiator=="object"?t.initiator:void 0}}function Js(s,t){return!t.entityType||!t.entitySlug?null:Ye(s,t.parentEntityType&&t.parentSlug?[{entity_type:t.parentEntityType,slug:t.parentSlug},{entity_type:t.entityType,slug:t.entitySlug}]:[{entity_type:t.entityType,slug:t.entitySlug}])}function ht({ownerSlug:s,runId:t,details:n}){const i=it(n.automationId,void 0,void 0,{ownerSlug:s,includeVersions:!1}).data?.automation,l=xt(n.initiator,n.attribution,n.automationId),a=i?.automation_name??n.automationName??l;return e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Requested by"," ",n.automationId?e.jsx(oe,{to:"/$owner/automations/$automationId",params:{owner:s,automationId:n.automationId},search:{view:"definition",run_id:void 0},className:"font-medium text-foreground underline-offset-4 hover:underline",children:a}):e.jsx("span",{className:"font-medium text-foreground",children:a}),t&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:" · "}),e.jsxs(oe,{to:"/$owner/events",params:{owner:s},search:{run_ids:String(t)},className:"font-medium text-foreground underline-offset-4 hover:underline",children:["Run #",t]})]})]})}function ft({ownerSlug:s,details:t}){const n=Js(s,t);return t.entityName?e.jsxs("div",{className:"rounded-md bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Entity"}),e.jsx("div",{className:"mt-1 text-sm font-medium",children:n?e.jsx(oe,{to:n,className:"underline-offset-4 hover:underline",children:t.entityName}):t.entityName})]}):null}function gt({label:s,before:t,after:n}){return e.jsxs("div",{className:"rounded-md border border-border/70 overflow-hidden",children:[e.jsx("div",{className:"border-b border-border/70 px-3 py-2 text-xs font-medium",children:s}),e.jsxs("div",{className:"grid gap-px bg-border/70 sm:grid-cols-2",children:[e.jsxs("div",{className:"bg-background p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Current"}),e.jsx("div",{className:"whitespace-pre-wrap text-sm leading-relaxed",children:Qe(t)})]}),e.jsxs("div",{className:"bg-background p-3",children:[e.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Proposed"}),e.jsx("div",{className:"whitespace-pre-wrap text-sm leading-relaxed",children:Qe(n)})]})]})]})}function Ks({ownerSlug:s,runId:t,details:n}){return e.jsxs("div",{className:"space-y-3",children:[e.jsx(ht,{ownerSlug:s,runId:t,details:n}),e.jsx(ft,{ownerSlug:s,details:n}),Object.entries(n.fields).map(([r,i])=>e.jsx(gt,{label:Re(r),before:n.current[r],after:i},r)),n.reason&&e.jsxs("div",{className:"rounded-md bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Reasoning"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:n.reason})]})]})}function Qs({ownerSlug:s,runId:t,details:n,status:r}){const{operation:i}=n,l=i==="link"||i==="unlink";return e.jsxs("div",{className:"space-y-3",children:[e.jsx(ht,{ownerSlug:s,runId:t,details:n}),!l&&e.jsx(ft,{ownerSlug:s,details:n}),e.jsxs("div",{className:"rounded-lg bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Change"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:l?ct(i,r):i==="create"?"Create a new entity after approval.":"Delete this entity after approval."}),l&&e.jsxs("div",{className:"mt-2 space-y-1 text-sm",children:[dt(n.proposal).map((a,u)=>e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:u===0?"From: ":"To: "}),a.name]},a.id)),e.jsxs("div",{className:"text-muted-foreground",children:["Relationship:"," ",String(n.proposal?.relationship_type??n.proposal?.relationship_type_slug??"Relationship")]})]})]}),!l&&n.proposal&&e.jsxs("div",{className:"rounded-lg border border-border/70 p-3",children:[e.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"Proposal"}),e.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-xs leading-relaxed",children:JSON.stringify(n.proposal,null,2)})]}),n.proposerRationale&&e.jsxs("div",{className:"rounded-lg bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:n.attribution==="agent"?"The agent's reasoning":"The Automation's reasoning"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:n.proposerRationale})]}),n.reason&&e.jsxs("div",{className:"rounded-lg bg-muted/40 px-3 py-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Why this needs approval"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:n.reason})]})]})}function Ws({summary:s}){return e.jsxs("div",{className:"space-y-2 rounded-md border border-border/70 bg-muted/30 p-3 text-sm",children:[s.chips.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.chips.map(t=>e.jsx(pe,{variant:"outline",className:"text-[10px] font-normal",children:t},t))}),s.message&&e.jsx("p",{className:"leading-relaxed text-foreground",children:s.message}),s.reason&&e.jsxs("div",{className:"rounded-md bg-background/80 px-2.5 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Why"}),e.jsx("div",{className:"mt-0.5 leading-relaxed",children:s.reason})]}),s.body&&e.jsxs("div",{className:"rounded-md bg-background/80 px-2.5 py-2",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s.kind==="verify"?"Expected comment":"Draft"}),e.jsx("div",{className:"mt-0.5 whitespace-pre-wrap leading-relaxed",children:s.body})]}),s.matchPreview&&e.jsxs("div",{className:"rounded-md bg-background/80 px-2.5 py-2",children:[e.jsxs("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:["Matched comment",s.matchAuthor?` · ${s.matchAuthor}`:""]}),e.jsx("div",{className:"mt-0.5 whitespace-pre-wrap leading-relaxed text-muted-foreground",children:s.matchPreview})]}),s.postUrl&&e.jsxs("a",{href:s.postUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:["Open post",e.jsx(rt,{className:"h-3 w-3"})]})]})}function Gs({ownerSlug:s,content:t,batchReview:n}){const r=t.metadata||{},i=t.run_id??void 0,l=Vs(t,r),a=qs(t,r),u=(l?Hs(l):a?Us(a):void 0)||r.operation_name||r.action_name||(t.title?Bs(t.title):void 0)||"Action",N=r.connection_name,j=r.operation_key||r.action_key||null,b=t.interaction_input_schema||r.input_schema||null,f=h.useMemo(()=>t.interaction_input||r.action_input||r.operation_input||Es,[t.interaction_input,r.action_input,r.operation_input]),m=t.interaction_output||r.action_output||void 0,v=Is(f,m??null,j),S=t.interaction_error||r.error_message||void 0,g=pt(t.interaction_status,r.status),_=r.reviewed_by_name||r.reviewed_by_id||void 0,I=r.reject_reason||void 0,H=r.initiator,q=Gt({slug:s}),x=Yt({slug:s}),y=Zt(t.id,Xt(b,f),b),{values:V,setValues:k}=y,[w,J]=h.useState(null),[c,T]=h.useState(!1),[M,P]=h.useState(""),E=g==="pending_approval"&&w?w:g,F=E==="pending_approval",W=typeof r.source_run_id=="number";return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(et,{className:"h-4 w-4 text-yellow-500"}),e.jsx("span",{className:"font-medium",children:u}),N&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["on ",N]}),E==="confirmed"&&e.jsx(pe,{variant:"outline",className:"text-blue-700 border-blue-300 bg-blue-50 dark:bg-blue-950/30 text-[10px]",children:"Approved"}),E==="completed"&&e.jsx(pe,{variant:"outline",className:"text-green-700 border-green-300 bg-green-50 dark:bg-green-950/30 text-[10px]",children:"Completed"}),E==="failed"&&e.jsx(pe,{variant:"outline",className:"text-red-700 border-red-300 bg-red-50 dark:bg-red-950/30 text-[10px]",children:"Failed"}),E==="rejected"&&e.jsx(pe,{variant:"outline",className:"text-muted-foreground text-[10px]",children:"Rejected"})]}),!l&&!a&&(t.author_name||_)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs text-muted-foreground",children:[t.author_name&&e.jsxs("span",{children:["Requested by"," ",e.jsx(zs,{ownerSlug:s,initiator:H,clientName:t.author_name,fallback:t.author_name})]}),t.author_name&&_&&e.jsx("span",{children:"·"}),_&&e.jsxs("span",{children:[E==="rejected"?"Rejected":"Approved"," by"," ",e.jsx("span",{className:"font-medium text-foreground",children:_})]})]}),l&&e.jsx(Ks,{ownerSlug:s,runId:i,details:l}),!l&&a&&e.jsx(Qs,{ownerSlug:s,runId:i,details:a,status:E}),E==="rejected"&&I&&e.jsxs("div",{className:"rounded-md bg-muted/50 p-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:"Reason:"})," ",I]}),v&&e.jsx(Ws,{summary:v}),(F?y.revision:b)&&(F||Object.keys(f).length>0)&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:v?"Full input":"Input"}),F?e.jsxs(e.Fragment,{children:[e.jsx(es,{visible:y.hasConflict,onReload:y.reset}),e.jsx(ts,{schema:y.revision,values:V,onValuesChange:k,fieldIdPrefix:`action-${t.id}-`},`action-${t.id}`)]}):v?e.jsxs("details",{className:"text-xs",children:[e.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"Raw input"}),e.jsx("pre",{className:"mt-1 bg-muted/50 rounded p-2 font-mono overflow-auto max-h-32",children:JSON.stringify(f,null,2)})]}):e.jsx("pre",{className:"text-xs bg-muted/50 rounded p-2 font-mono overflow-auto max-h-32",children:JSON.stringify(f,null,2)})]}),E==="completed"&&m&&Object.keys(m).length>0&&!v&&e.jsxs("div",{className:"rounded-md bg-green-50 dark:bg-green-950/30 p-3 text-sm space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-green-700 dark:text-green-400 font-medium",children:[e.jsx(ze,{className:"h-3.5 w-3.5"}),"Output"]}),e.jsx("pre",{className:"text-xs text-green-800 dark:text-green-300 font-mono whitespace-pre-wrap",children:JSON.stringify(m,null,2)})]}),E==="completed"&&m&&Object.keys(m).length>0&&v&&e.jsxs("details",{className:"text-xs",children:[e.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"Raw output"}),e.jsx("pre",{className:"mt-1 rounded bg-green-50 p-2 font-mono dark:bg-green-950/30 overflow-auto max-h-32",children:JSON.stringify(m,null,2)})]}),E==="failed"&&S&&e.jsxs("div",{className:"rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-red-700 dark:text-red-400 font-medium",children:[e.jsx(st,{className:"h-3.5 w-3.5"}),"Error"]}),e.jsx("p",{className:"text-xs text-red-800 dark:text-red-300 font-mono mt-1",children:S})]}),F&&!w&&W&&e.jsxs("div",{className:"pt-1 text-xs text-muted-foreground",children:["Review this proposal with the other changes in its Automation run.",n]}),F&&i&&!w&&!W&&e.jsx("div",{className:"flex items-center gap-2 pt-1",children:c?e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("input",{type:"text",placeholder:"Reason (optional)",value:M,onChange:se=>P(se.target.value),className:"h-7 text-xs border rounded px-2 flex-1 bg-background"}),e.jsxs($,{size:"sm",variant:"destructive",className:"h-7 text-xs",onClick:()=>x.mutate({run_id:i,reason:M||void 0},{onSuccess:()=>{J("rejected")}}),disabled:x.isPending,children:[x.isPending&&e.jsx(Se,{size:"sm",className:"mr-1"}),"Confirm Reject"]}),e.jsx($,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>{T(!1),P("")},children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsxs($,{size:"sm",className:"h-7 text-xs",onClick:()=>q.mutate({run_id:i,input:ns(V)},{onSuccess:()=>{J("confirmed")}}),disabled:!y.canSubmit||q.isPending||x.isPending,children:[q.isPending?e.jsx(Se,{size:"sm",className:"mr-1"}):e.jsx(ss,{className:"h-3 w-3 mr-1"}),"Confirm"]}),e.jsxs($,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>T(!0),disabled:q.isPending||x.isPending,children:[e.jsx(rs,{className:"h-3 w-3 mr-1"}),"Reject"]})]})})]})}function Ys({content:s,ownerSlug:t}){const n=s.metadata||{},r=n.kind,i=s.run_id??null,l=typeof n.automation_id=="number"?n.automation_id:null,N=it(l!=null?String(l):void 0,void 0,void 0,{includeVersions:!1,ownerSlug:t}).data?.automation?.automation_name??(l!=null?`Automation ${l}`:"An Automation"),j=Qt({slug:t}),b=Wt({slug:t}),[f,m]=h.useState(!1),[v,S]=h.useState(""),[g,_]=h.useState(null);if(r==="automation_batch_reject"){const c=n.reason||void 0;return e.jsxs("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 p-3",children:[e.jsx("div",{className:"text-sm font-medium",children:"Proposals rejected"}),c&&e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:c}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Ask the agent to revise its proposals with this feedback."})]})}const I=Array.isArray(n.changes)?n.changes:[],H=typeof n.created_count=="number"?n.created_count:I.filter(c=>c.kind==="created").length,q=typeof n.updated_count=="number"?n.updated_count:I.filter(c=>c.kind==="updated").length,x=typeof n.denied_count=="number"?n.denied_count:I.filter(c=>c.kind==="denied").length,y=I.filter(c=>c.kind==="denied"),V=I.filter(c=>c.kind==="updated"&&Object.keys(c.applied||{}).length>0),k=typeof n.pending_proposal_count=="number"?n.pending_proposal_count:null,w=k==null||k>0,J=w?"proposed":"applied";return e.jsxs("div",{className:"rounded-md border p-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[e.jsxs("div",{className:"text-sm font-medium",children:[J==="proposed"?"Proposed":"Applied"," ",H," ","new + ",q," updated",x>0&&e.jsxs(e.Fragment,{children:[" + ",x," denied"]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[l!=null?e.jsx(oe,{to:"/$owner/automations/$automationId",params:{owner:t,automationId:String(l)},search:{view:"definition",run_id:void 0},className:"font-medium text-foreground underline-offset-4 hover:underline",children:N}):e.jsx("span",{className:"font-medium text-foreground",children:N}),i!=null&&e.jsxs("span",{children:[" · run #",i]}),k!=null&&k>0&&e.jsxs("span",{children:[" · ",k," pending"]})]})]}),V.length>0&&e.jsx("div",{className:"mt-3 space-y-2",children:V.map(c=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:c.name}),Object.entries(c.applied).map(([T,M])=>e.jsx(gt,{label:T,before:M.old,after:M.new},T))]},c.entityId))}),y.length>0&&e.jsx("div",{className:"mt-3 space-y-1.5",children:y.map(c=>e.jsxs("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-2.5 py-2",children:[e.jsxs("div",{className:"text-xs font-medium",children:[c.name," — not written"]}),c.denied&&e.jsxs("div",{className:"mt-0.5 text-xs text-muted-foreground",children:[c.denied.reason,e.jsxs("span",{className:"ml-1 opacity-70",children:["(refused by"," ",c.denied.source==="rule"?"a write rule":"org policy",")"]})]})]},`denied-${c.entityId}-${c.name}`))}),i!=null&&g==null&&w&&e.jsx("div",{className:"mt-3 border-t border-border/70 pt-3",children:f?e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("input",{type:"text",placeholder:"What should the agent change?",value:v,onChange:c=>S(c.target.value),className:"h-7 text-xs border rounded px-2 flex-1 bg-background"}),e.jsxs($,{size:"sm",variant:"destructive",className:"h-7 text-xs",onClick:()=>b.mutate({run_id:i,reason:v||void 0},{onSuccess:()=>_("rejected")}),disabled:b.isPending,children:[b.isPending&&e.jsx(Se,{size:"sm",className:"mr-1"}),"Reject all"]}),e.jsx($,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>{m(!1),S("")},children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs($,{size:"sm",className:"h-7 text-xs",onClick:()=>j.mutate({run_id:i},{onSuccess:()=>_("approved")}),disabled:j.isPending||b.isPending,children:[j.isPending&&e.jsx(Se,{size:"sm",className:"mr-1"}),"Approve all proposals"]}),e.jsx($,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>m(!0),disabled:j.isPending||b.isPending,children:"Reject with feedback"})]})}),g==="approved"&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"All proposals approved."}),g==="rejected"&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Proposals rejected — ask the agent to revise them."}),i!=null&&g==null&&!w&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"All proposals reviewed."})]})}function ke({presentation:s="summary",renderDetail:t,onFiltersChange:n,ownerSlug:r,content:i,isReply:l,showParentContext:a,connectorDefinitions:u,hideOriginator:N=!1,hideRunAction:j=!1,hideAttribution:b=!1,hideDetails:f=!1}){const[m,v]=h.useState(null),S=Ht(),g=s==="detail",_=Vt(),{currentOwner:I,allOrgs:H,isAuthenticated:q}=at(),x=r??I,y=x==="me"?null:x,V=h.useCallback(async p=>{if(!y){Ue.error("Open this event inside a workspace to interact with it.");return}const D=await Rs(y,Number(i.id),p,crypto.randomUUID());return"event_id"in D&&Ue.success("Recorded"),D},[i.id,y]),k=i.payload_data??{},{audit:w,operation:J,changeSet:c}=mt(i),T=w&&(k.request!==void 0||k.request_status==="too_large"),M=w&&Array.isArray(k.sdk_call_trace)&&k.sdk_call_trace.length>0,P=x?qe(x,Number(i.id)):null,E=!g&&q?(H??[]).find(p=>p.slug===y):void 0,F=E?{slug:E.slug,organizationId:E.id}:null,W=lt(F??{slug:null,organizationId:null}),se=F?.slug??null,he=h.useMemo(()=>se&&!w?Ze(W.data??[],i.semantic_type):[],[se,w,W.data,i.semantic_type]),le=Ut(),je=!!(!(J||c)&&F&&he.length>0),K=!g&&!!P,X=qt(_?.item?.href.split(/[?#]/)[0]??""),ne=X?.owner===x&&X?.eventId===Number(i.id),ee=(p,D,O)=>{_?_.open({href:p,title:D,...O==null?{}:{runId:O}}):S({to:p})},de=(p,D)=>{if(!y)return null;const O=`/${y}/events?run_ids=${p}`;return _?.item?.href===O?null:e.jsxs($,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>n?n({runIds:[p]}):ee(O,"Run activity",p),title:n?"Filter by this run":"Open run activity",children:[e.jsx(Kt,{className:"h-3.5 w-3.5"}),D]})},ce=i.run_id!=null&&(n||!(_&&y&&i.automation_id!=null))?de(i.run_id,n?"Run":"Open run"):null,U=Jt(i),ue=i.automation_id,Ne=_&&y&&U!=null&&ue!=null?()=>_.open({href:`/${y}/automations/${ue}?run_id=${U}`,title:`${i.automation_name??`Automation ${ue}`} · Run #${U}`,runId:U}):void 0,me=()=>{if(je&&F&&y){const p=Number(i.id);Ss(le,F.slug,he,p).catch(()=>null).then(D=>ee(qe(y,p,D?.key),i.title??"Event"));return}P&&ee(P,i.title??"Event")},re=p=>{const D=p.target;if(!(D instanceof Element))return!1;const O=D.closest('a,button,input,select,textarea,[role="button"],[role="radio"]');return O!==null&&O!==p.currentTarget},Z=p=>{re(p)||me()},ae=p=>{p.key!=="Enter"&&p.key!==" "||re(p)||(p.preventDefault(),me())},fe=i.metadata?.source_run_id,Q=g&&y?c?e.jsx(Ys,{content:i,ownerSlug:y}):J?e.jsx(Gs,{ownerSlug:y,content:i,batchReview:typeof fe=="number"?de(fe,"Review run"):null}):void 0:void 0,ie=g&&t?t(Q):{content:Q,nativeHeading:Q!=null};return e.jsx("div",{className:Te(l?"border-l-2 border-l-muted pl-4":"",K&&"cursor-pointer rounded-lg p-3 transition-colors hover:bg-accent/40",K&&ne&&"bg-accent ring-1 ring-inset ring-primary/20"),...K?{role:"button","aria-current":ne?"true":void 0,tabIndex:0,onClick:Z,onKeyDown:ae}:{},children:e.jsx(en,{primaryContent:ie.content,nativeHeading:ie.nativeHeading,detailLinks:ie.links,headingAside:ie.headingAside,hideDetails:f,onFiltersChange:n,presentation:s,content:i,ownerSlug:x??void 0,showParentContext:a,connectorDefinitions:u,onRenderedAction:y?V:void 0,runAction:j?null:ce,hideOriginator:N,hideAttribution:b,runId:U??i.run_id??null,onRunSelect:Ne,auditDetails:g&&(T||M)&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:[{key:"request",label:"Request",available:T},{key:"calls",label:"SDK calls",available:M}].map(p=>p.available?e.jsxs($,{variant:"outline",size:"sm","aria-expanded":m===p.key,onClick:()=>v(D=>D===p.key?null:p.key),children:[m===p.key?e.jsx(ve,{className:"h-3.5 w-3.5"}):e.jsx(ye,{className:"h-3.5 w-3.5"}),p.label]},p.key):null)}),m==="request"&&(k.request_status==="too_large"?e.jsxs("p",{className:"text-sm text-muted-foreground",children:["The request was too large to retain",typeof k.request_bytes=="number"?` (${k.request_bytes.toLocaleString()} bytes).`:"."]}):e.jsx(Ke,{value:k.request})),m==="calls"&&e.jsx(Ke,{value:k.sdk_call_trace})]})})})}function Zs(s,t){const n=s.payload_data??{},r=s.metadata??{};if(t.audit&&typeof n.success=="boolean")return n.success?"completed":"failed";if(t.changeSet)return r.kind==="automation_batch_reject"?"rejected":typeof r.pending_proposal_count!="number"?void 0:r.pending_proposal_count>0?"pending_approval":"completed";if(t.operation)return pt(s.interaction_status,typeof r.status=="string"?r.status:void 0)}function Xs(s){return s==="pending_approval"?"Needs approval":s==="confirmed"?"Approved":s?xe(s):null}function en({presentation:s,primaryContent:t,nativeHeading:n=!1,detailLinks:r,headingAside:i,onFiltersChange:l,content:a,ownerSlug:u,showParentContext:N,connectorDefinitions:j,onRenderedAction:b,runAction:f,auditDetails:m,hideOriginator:v=!1,hideAttribution:S=!1,runId:g,onRunSelect:_,hideDetails:I=!1}){const[H,q]=h.useState(!1),x=a.metadata??{},y=typeof a.score=="number"&&Number.isFinite(a.score)?Math.round(a.score):"-",V=a.payload_type||"text",k=a.text_content||"",w=s==="summary",J=s==null&&(V==="text"||V==="markdown")&&k.length>500,c=J&&!H?`${k.slice(0,500)}...`:k,T=a.payload_data??{},M=mt(a),{audit:P,operation:E,changeSet:F}=M,W=Zs(a,M),se=Xs(W),he=w&&P&&typeof T.tool_name=="string"?xe(T.tool_name):a.title,le=P&&T.error&&typeof T.error=="object"?T.error.message:void 0,_e=(typeof le=="string"?le:void 0)??a.interaction_error??(typeof x.error_message=="string"?x.error_message:void 0),je=_e||(P?"":k),[K,X]=h.useState(s!=="summary"&&P&&t==null&&r==null),ne=P?T.duration_ms:x.duration_ms,ee=typeof ne=="number"&&Number.isFinite(ne)&&ne>=0?ne:null,de=P&&typeof T.sdk_call_count=="number"&&Number.isSafeInteger(T.sdk_call_count)&&T.sdk_call_count>=0?T.sdk_call_count:null,ce=x.thumbnail_url||x.thumbnail,U=x.media_url,ue=w?[]:Os(x),Ne=Object.entries(a.classifications||{}).flatMap(([o,d])=>{const R=Ls(d);return R.values.map(A=>({slug:o,value:A,isManual:R.isManual}))}),me=(()=>{const o=a.platform||(typeof x.platform=="string"?x.platform:null),d=a.connection_id!=null?a.connection_id:x.source_connection_id!=null?Number(x.source_connection_id):null;return{...a,platform:o,connection_id:d!=null&&Number.isFinite(d)?d:null}})(),re=(()=>{const o=a.source_url??x.browser_url;if(typeof o!="string"||!URL.canParse(o))return null;const d=new URL(o);return d.protocol==="https:"||d.protocol==="http:"?d:null})(),Z=a.occurred_at?new Date(a.occurred_at):null,ae=me.platform?At(me.platform,j??[]):null,fe=P?Xe:E?et:F?It:a.semantic_type==="notification"?Tt:Et,Q=P?"SDK call":xe(a.semantic_type||a.origin_type||"Event"),ie=e.jsx($t,{plain:!0,name:ae?.name??re?.hostname??Q,icon:ae?.icon,faviconDomain:ae?.faviconDomain??re?.hostname,fallback:e.jsx(fe,{className:"h-4 w-4"}),className:"h-5 w-5 rounded-sm text-xs"}),p=ue.length>0?e.jsx("dl",{className:"grid gap-x-3 gap-y-2 text-sm sm:grid-cols-[minmax(140px,180px)_1fr]",children:ue.map(([o,d])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:xe(o)}),e.jsx("dd",{className:"min-w-0 break-words font-mono text-xs sm:text-sm",children:Ps(d)})]},o))}):null,D=w?je?e.jsx("p",{className:Te("line-clamp-2 text-sm whitespace-pre-wrap",_e&&"text-destructive"),children:je.slice(0,320)}):null:e.jsxs(e.Fragment,{children:[a.rating&&e.jsx("div",{className:"flex items-center gap-1 mb-2",children:[1,2,3,4,5].map(o=>e.jsx(tt,{className:`h-4 w-4 ${o<=Number(a.rating)?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},o))}),ce&&e.jsx("a",{href:U||a.source_url||"#",target:"_blank",rel:"noopener noreferrer",className:"block mb-2",children:e.jsx("img",{src:ce,alt:"",className:`rounded-md object-cover ${V==="media"?"max-h-96 w-full":"max-h-48"}`,loading:"lazy"})}),(()=>{switch(V){case"markdown":if(c)return e.jsx("div",{className:"max-w-none text-sm space-y-2",children:e.jsx(Dt,{text:c})});break;case"json_template":{const o=a.payload_template;if(o?.root)return e.jsx(Ts,{template:o,data:a.payload_data||{},onAction:t?void 0:b},`${u}:${a.id}`);if(c)return e.jsx("div",{className:"text-sm whitespace-pre-wrap",children:c});break}case"media":return e.jsxs("div",{className:"space-y-3",children:[!ce&&U&&e.jsx("a",{href:U,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline truncate block",children:U}),c&&e.jsx("div",{className:"text-sm whitespace-pre-wrap text-muted-foreground",children:c})]});case"empty":return e.jsxs("div",{className:"space-y-3",children:[m,p??(m?null:e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No content"}))]});default:if(c)return e.jsx("div",{className:"text-sm whitespace-pre-wrap",children:c});break}return e.jsxs("div",{className:"space-y-3",children:[U&&!ce&&e.jsx("a",{href:U,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-muted-foreground hover:text-foreground truncate block",children:U}),p]})})()]}),O=t!=null||s==="detail"&&P,ge=i!==void 0,Ae=O||r!=null;return h.useEffect(()=>{if(!ge||!K)return;const o=d=>{d.key==="Escape"&&(d.preventDefault(),X(!1))};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[ge,K]),e.jsxs(e.Fragment,{children:[N&&a.parent_context&&e.jsxs("div",{className:"mb-3 p-2 bg-muted/50 rounded-md text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Replying to:"}),e.jsx("div",{className:"font-medium",children:a.parent_context.author_name}),e.jsx("div",{className:"text-muted-foreground line-clamp-2",children:a.parent_context.text_content})]}),e.jsxs("div",{className:Te("flex gap-3",s==="detail"&&"mb-5",ge&&"relative"),children:[e.jsx("div",{"aria-hidden":!0,className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground",children:ie}),e.jsxs("div",{className:"min-w-0 flex-1",children:[s==="detail"&&(()=>{const o={semanticTypes:[a.semantic_type],...typeof a.automation_id=="number"?{producedByAutomationId:a.automation_id}:{},...typeof a.run_id=="number"?{runIds:[a.run_id]}:{}},d={semantic_types:a.semantic_type,...typeof a.automation_id=="number"?{produced_by:String(a.automation_id)}:{},...typeof a.run_id=="number"?{run_ids:String(a.run_id)}:{}};return e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[a.semantic_type?l?e.jsx("button",{type:"button",className:"hover:underline",title:`Show all ${Q} events`,onClick:()=>l(o),children:Q}):u?e.jsx(oe,{to:"/$owner/events",params:{owner:u},search:d,className:"hover:underline",title:`Show all ${Q} events`,children:Q}):e.jsx("span",{children:Q}):e.jsx("span",{children:Q}),Z&&e.jsx("time",{dateTime:Z.toISOString(),children:be(Z)})]})})(),e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[he&&!n&&e.jsx("h4",{className:Te("min-w-0 font-medium",s==="detail"?"text-xl leading-snug":"line-clamp-2 text-sm"),children:he}),s!=="detail"&&Z&&e.jsx("time",{dateTime:Z.toISOString(),title:be(Z),className:"shrink-0 pt-0.5 text-xs text-muted-foreground",children:Ce(Z,"HH:mm")}),ge&&e.jsxs("div",{className:"flex shrink-0 items-center gap-1 pt-0.5",children:[i,Ae&&e.jsxs($,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-muted-foreground hover:text-foreground","aria-expanded":K,onClick:()=>X(o=>!o),children:["Details",K?e.jsx(ve,{className:"h-3.5 w-3.5"}):e.jsx(ye,{className:"h-3.5 w-3.5"})]})]})]}),w&&e.jsx("div",{className:"mt-1 text-muted-foreground",children:D}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[se&&!n&&e.jsxs(pe,{variant:W==="failed"?"destructive":"secondary",className:"gap-1 text-xs",children:[W==="failed"?e.jsx(st,{className:"h-3 w-3"}):W==="completed"?e.jsx(ze,{className:"h-3 w-3"}):null,se]}),de!=null&&e.jsxs("span",{children:[de," SDK ",de===1?"call":"calls"]}),ee!=null&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(nt,{className:"h-3 w-3"}),ee<1e3?`${Math.round(ee)}ms`:`${Number((ee/1e3).toFixed(2))}s`]}),f,y==="-"||w&&(P||E||F)?null:a.score_breakdown?e.jsxs(Pt,{children:[e.jsx(Ot,{asChild:!0,children:e.jsx($,{variant:"ghost",size:"sm",className:"h-7 px-2",children:e.jsx("span",{className:"font-medium",children:y})})}),e.jsx(Ft,{className:"w-64",align:"end",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Score Breakdown"}),e.jsx(Fs,{breakdown:a.score_breakdown})]})})]}):null,re&&e.jsxs(Mt,{children:[e.jsx(Lt,{asChild:!0,children:e.jsx($,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-1",asChild:!0,children:e.jsxs("a",{href:re.href,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(rt,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:w?"sr-only":void 0,children:"View original"})]})})}),e.jsx(Bt,{children:"View original"})]})]}),u&&!S&&e.jsx(zt,{owner:u,source:me,connectorDefinitions:j,onFiltersChange:l,variant:"chips",className:"mt-2 text-xs",hideOriginator:v,runId:g,onRunSelect:_}),(a.author_name||!u)&&!(s==="detail"&&E)&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:a.author_name||Ds(a)})]}),ge&&K&&Ae&&e.jsxs("div",{className:"absolute inset-x-0 top-full z-20 mt-2 max-h-[65vh] space-y-3 overflow-y-auto rounded-lg border bg-background p-3 shadow-lg",children:[r,O&&D]})]}),!w&&typeof le=="string"&&e.jsx("p",{className:"mb-2 text-sm whitespace-pre-wrap text-destructive",children:le}),t,!w&&!O&&D,(O||r!=null)&&i===void 0&&!(I&&t!=null)&&e.jsxs("details",{className:"mt-5 border-t pt-3",open:K,onToggle:o=>X(o.currentTarget.open),children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground",children:"Details"}),K&&e.jsxs("div",{className:"mt-3 space-y-3",children:[r,O&&D]})]}),J&&e.jsx($,{variant:"link",size:"sm",className:"px-0 h-6 mt-1",onClick:()=>q(!H),children:H?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"h-3 w-3 mr-1"})," Show less"]}):e.jsxs(e.Fragment,{children:[e.jsx(ye,{className:"h-3 w-3 mr-1"})," Show more"]})}),Ne.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:Ne.map(o=>e.jsx(Ms,{slug:o.slug,value:o.value||"",isManual:o.isManual},o.slug))})]})}function tn({toolName:s,count:t,totalDurationMs:n,totalSdkCalls:r,newestAt:i,oldestAt:l,expanded:a,onToggle:u,children:N}){return e.jsx("div",{children:e.jsxs(Ee,{open:a,children:[e.jsx("div",{className:"rounded-lg p-3",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{"aria-hidden":!0,className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground",children:e.jsx(Xe,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx($e,{asChild:!0,children:e.jsxs($,{variant:"ghost",size:"sm",className:"h-5 min-w-0 gap-1.5 px-0 text-sm text-muted-foreground",onClick:u,children:[e.jsxs("span",{className:"min-w-0 truncate font-medium text-foreground",children:[xe(s)," × ",t]}),a?e.jsx(ve,{className:"h-3.5 w-3.5 shrink-0"}):e.jsx(ye,{className:"h-3.5 w-3.5 shrink-0"})]})}),e.jsx(vt,{newestAt:i,oldestAt:l})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[e.jsxs(pe,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx(ze,{className:"h-3 w-3"}),"Completed"]}),r!=null&&e.jsxs("span",{children:[r," SDK ",r===1?"call":"calls"]}),n!=null&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(nt,{className:"h-3 w-3"}),sn(n)]})]})]})]})}),e.jsx(De,{className:"mt-2 space-y-3 border-l-2 border-l-muted pl-4",children:N})]})})}function sn(s){return s<1e3?`${Math.round(s)}ms`:`${Number((s/1e3).toFixed(2))}s`}function vt({newestAt:s,oldestAt:t}){const n=We(s),r=We(t);return n!=null&&r!=null&&n.getTime()-r.getTime()>nn&&r?e.jsxs("time",{dateTime:n.toISOString(),title:`${be(r)} – ${be(n)}`,className:"shrink-0 pt-0.5 text-xs text-muted-foreground",children:[Ce(r,"HH:mm"),"–",Ce(n,"HH:mm")]}):n?e.jsx("time",{dateTime:n.toISOString(),title:be(n),className:"shrink-0 pt-0.5 text-xs text-muted-foreground",children:Ce(n,"HH:mm")}):null}const nn=300*1e3;function We(s){if(s==null||s==="")return null;const t=new Date(s);return Number.isNaN(t.getTime())?null:t}function rn({organizationId:s,clientId:t,activityId:n,activityKind:r,callCount:i,newestAt:l,oldestAt:a,expanded:u,onToggle:N,children:j}){const{data:b=[]}=as({limit:100,organizationId:s??null}),f=b.find(S=>S.activityId===n&&(t==null||S.clientId===t))??null,m=f?bs(f):r==="session"?"MCP session":"Conversation",v=f?.clientName??null;return e.jsx("div",{children:e.jsxs(Ee,{open:u,children:[e.jsx("div",{className:"rounded-lg border bg-muted/40 p-3",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border bg-background",children:e.jsx(ot,{name:v})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx($e,{asChild:!0,children:e.jsxs($,{variant:"ghost",size:"sm",className:"h-5 min-w-0 gap-1.5 px-0 text-sm text-muted-foreground",onClick:N,children:[e.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",children:m}),u?e.jsx(ve,{className:"h-3.5 w-3.5 shrink-0"}):e.jsx(ye,{className:"h-3.5 w-3.5 shrink-0"})]})}),e.jsx(vt,{newestAt:l,oldestAt:a})]}),e.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:[`${i} ${i===1?"call":"calls"}`,v?` · ${v}`:null]})]})]})}),e.jsx(De,{className:"mt-2 space-y-3 border-l-2 border-l-muted pl-4",children:j})]})})}function an({onIntersect:s,enabled:t,rootMargin:n="400px"}){const r=h.useRef(null),i=h.useRef(s);return i.current=s,h.useEffect(()=>{const l=r.current;if(!l||!t)return;const a=new IntersectionObserver(u=>{u[0]?.isIntersecting&&i.current()},{rootMargin:n});return a.observe(l),()=>a.disconnect()},[t,n]),r}function Ge(s){if(s==null||s==="")return null;const t=new Date(s);return Number.isNaN(t.getTime())?null:Ce(t,"d MMMM yyyy")}function on({items:s,isLoading:t,emptyState:n,dense:r,hasNextPage:i,isFetching:l,isFetchingNextPage:a,onLoadMore:u,autoLoadMore:N=!0,groupByDate:j=!0}){const b=an({onIntersect:u,enabled:N&&i&&!l});return t&&s.length===0?e.jsx("div",{className:"space-y-4",children:["s1","s2","s3"].map(f=>e.jsx(is,{className:"h-32 rounded-lg"},f))}):e.jsxs("div",{className:r?"":"pt-1",children:[s.length===0?n!==void 0?n:e.jsx(os,{icon:ls,title:"Nothing here yet",description:"No events match this view."}):s.map((f,m)=>{const v=Ge(f.occurredAt),S=m>0?Ge(s[m-1].occurredAt):null;return e.jsxs(h.Fragment,{children:[j&&v&&v!==S&&e.jsx("p",{className:"px-3 pb-2 pt-4 text-xs text-muted-foreground",children:v}),e.jsx("div",{className:"mb-1",children:f.content})]},f.key)}),e.jsx("div",{ref:b,className:"h-1"}),a?e.jsx("div",{className:"flex justify-center py-4",children:e.jsx(Se,{size:"xl",className:"text-muted-foreground"})}):i&&e.jsx($,{size:"sm",variant:"outline",disabled:l,onClick:u,children:"Load more"})]})}function xn({presentation:s="summary",renderDetail:t,onFiltersChange:n,hideDetails:r=!1,organizationId:i,ownerSlug:l,entityId:a,filters:u,showEntityLinks:N=!1,hideOriginator:j=!1,emptyState:b,dense:f=!1,foldConsecutiveCalls:m=!1,groupByConversation:v=!1,groupByRun:S=!1,onRunSelect:g,runs:_,hideRunAction:I=!1,hideAttribution:H=!1}){const{isAuthenticated:q,isReady:x}=ds(),{isMember:y,isLoading:V}=cs(),k=l==="me",w=!k&&x&&q&&y,J=!k&&x&&(!q||!V&&!y),{data:c=[]}=us(x&&w?i:null),{data:T=[]}=ms(J?l:null),M=w?c:T,P=ps(x&&w?i:null,a,u,l),E=xs(J?l:null,a,u),F=J?E:P,{data:W,isLoading:se,error:he,fetchNextPage:le,hasNextPage:_e,isFetchingNextPage:je}=F,K=h.useMemo(()=>W?.pages.flatMap(o=>o.content)??[],[W]),X=h.useMemo(()=>{const o=hs(K,{foldRunSatellites:!S}),d=o.map(L=>L.head),R=new Map(o.map(L=>[L.head.id,L])),A=fs(d,{groupByRun:S});return Array.from(A.entries()).map(([L,Y])=>{const B=Y.root||Y.replies[0],G=B?R.get(B.id):void 0;return{rootId:L,group:Y,history:G?.history??[],runId:G?.runId??null}})},[K,S]),[ne,ee]=h.useState(new Set),[de,ce]=h.useState(new Set),[U,ue]=h.useState(new Set),[Ne,me]=h.useState(new Set),[re,Z]=h.useState(new Set),ae=(o,d)=>o(R=>{const A=new Set(R);return A.has(d)?A.delete(d):A.add(d),A}),fe=(o,d)=>d.some(R=>o.has(R)),Q=(o,d)=>o(R=>{const A=new Set(R),L=d.some(Y=>A.has(Y));for(const Y of d)L?A.delete(Y):A.add(Y);return A}),ie=m?gs(X):X.map(o=>({kind:"single",node:o})),p=v?vs(ie):ie,D=!k&&(!x||q&&V||w&&F.isPending);if(he)return e.jsx(ys,{label:"events"});const O=o=>{if(o.kind==="fold"){const{fold:C}=o,Ve=C.nodes.map(Pe=>Pe.rootId),Nt=fe(de,Ve);return[{key:C.key,occurredAt:C.newestAt,content:e.jsx(tn,{toolName:C.toolName,count:C.nodes.length,totalDurationMs:C.totalDurationMs,totalSdkCalls:C.totalSdkCalls,newestAt:C.newestAt,oldestAt:C.oldestAt,expanded:Nt,onToggle:()=>Q(ce,Ve),children:C.nodes.map(Pe=>{const Oe=Pe.group.root;return Oe?e.jsx(ke,{presentation:s,onFiltersChange:n,ownerSlug:l,content:Oe,renderDetail:t,connectorDefinitions:M,hideOriginator:j,hideRunAction:I,hideAttribution:H,hideDetails:r},Oe.id):null})})}]}const{rootId:d,group:R,history:A,runId:L}=o.node,Y=R.replies.length>0,B=ne.has(d),G=re.has(d),He=Ne.has(d),yt=R.replies.filter(C=>C.depth<=3),Ie=R.replies.filter(C=>C.depth>3),jt=!R.root&&R.replies.length>0,te=R.root||R.replies[0];return te?[{key:d,occurredAt:te.occurred_at,content:e.jsxs(e.Fragment,{children:[N&&l&&te.entity_name&&te.entity_type&&te.entity_slug&&e.jsx("div",{className:"mb-2",children:e.jsx(Cs,{ownerSlug:l,entity:{entityName:te.entity_name,entityType:te.entity_type,entitySlug:te.entity_slug}})}),e.jsx(ke,{presentation:s,onFiltersChange:n,ownerSlug:l,content:te,renderDetail:t,showParentContext:jt&&!!te.parent_context,connectorDefinitions:M,hideOriginator:j,hideRunAction:I,hideAttribution:H,hideDetails:r}),A.length>0&&e.jsxs(Ee,{open:He,children:[e.jsx($e,{asChild:!0,children:e.jsxs($,{variant:"ghost",size:"sm",className:"mt-1 h-7 gap-1 text-xs text-muted-foreground",onClick:()=>ae(me,d),children:[e.jsx(Ns,{className:"h-3.5 w-3.5"}),He?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"h-3.5 w-3.5"}),"Hide ",L!=null?`run #${L} `:"","history"]}):e.jsxs(e.Fragment,{children:[e.jsx(ye,{className:"h-3.5 w-3.5"}),L!=null?`Run #${L} · ${A.length===1?"1 earlier step":`${A.length} earlier steps`}`:A.length===1?"1 earlier state":`${A.length} earlier states`]})]})}),e.jsx(De,{className:"mt-2 space-y-3 border-l-2 border-l-muted pl-4",children:A.map(C=>e.jsxs("div",{children:[e.jsx("time",{dateTime:new Date(C.occurred_at).toISOString(),title:be(C.occurred_at),className:"mb-1 block text-xs text-muted-foreground",children:Je(C.occurred_at)}),e.jsx(ke,{presentation:s,onFiltersChange:n,ownerSlug:l,content:C,connectorDefinitions:M,hideOriginator:j,hideRunAction:I,hideAttribution:H})]},C.id))})]}),Y&&e.jsxs(Ee,{open:B,children:[e.jsx($e,{asChild:!0,children:e.jsxs($,{variant:"ghost",size:"sm",className:"mt-2 ml-6 gap-1",onClick:()=>ae(ee,d),children:[e.jsx(Fe,{className:"h-3.5 w-3.5"}),B?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"h-3.5 w-3.5"}),"Hide ",R.replies.length," replies"]}):e.jsxs(e.Fragment,{children:[e.jsx(ye,{className:"h-3.5 w-3.5"}),"Show ",R.replies.length," replies"]})]})}),e.jsxs(De,{className:"space-y-2 mt-2",children:[yt.map(C=>e.jsx(ke,{presentation:s,onFiltersChange:n,ownerSlug:l,content:C,isReply:!0,connectorDefinitions:M,hideOriginator:j,hideRunAction:I,hideAttribution:H},C.id)),Ie.length>0&&e.jsxs(e.Fragment,{children:[e.jsx($,{variant:"ghost",size:"sm",className:"ml-12",onClick:()=>ae(Z,d),children:G?e.jsxs(e.Fragment,{children:["Hide ",Ie.length," nested replies"]}):e.jsxs(e.Fragment,{children:["Show ",Ie.length," nested replies"]})}),G&&Ie.map(C=>e.jsx(ke,{presentation:s,onFiltersChange:n,ownerSlug:l,content:C,isReply:!0,connectorDefinitions:M,hideOriginator:j,hideRunAction:I,hideAttribution:H},C.id))]})]})]})]})}]:[]},ge=o=>{const d=o.nodes.length;return{key:o.key,occurredAt:o.newestAt,content:e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[g?e.jsxs($,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-1 text-xs font-medium",onClick:()=>g(o.runId),title:`Open run #${o.runId} conversation`,children:[e.jsx(Fe,{className:"h-3.5 w-3.5"}),"Run #",o.runId]}):e.jsxs("span",{className:"inline-flex h-7 items-center gap-1 px-1 text-xs font-medium",children:[e.jsx(Fe,{className:"h-3.5 w-3.5"}),"Run #",o.runId]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[o.status!=null?`· ${xe(o.status)} · `:"· ",d===1?"1 event":`${d} events`,o.newestAt!=null?` · ${Je(o.newestAt)}`:""]})]}),e.jsx("div",{className:"mt-2 space-y-2 border-l-2 border-l-muted pl-4",children:o.nodes.flatMap(R=>O({kind:"single",node:R}).map(A=>e.jsx(h.Fragment,{children:A.content},A.key)))})]})}},Ae=o=>{const{block:d}=o,R=d.entries.flatMap(B=>B.kind==="fold"?B.fold.nodes.map(G=>G.rootId):[B.node.rootId]),A=fe(U,R),L=d.entries.flatMap(B=>O(B).map(G=>({key:G.key,content:G.content})));if(L.length===0)return[];const Y=d.entries.reduce((B,G)=>B+(G.kind==="fold"?G.fold.nodes.length:1),0);return[{key:d.key,occurredAt:d.newestAt,content:e.jsx(rn,{organizationId:i,clientId:d.clientId,activityId:d.activityId,activityKind:d.activityKind,callCount:Y,newestAt:d.newestAt,oldestAt:d.oldestAt,expanded:A,onToggle:()=>Q(ue,R),children:L.map(B=>e.jsx(h.Fragment,{children:B.content},B.key))})}]};return e.jsx(on,{groupByDate:s==="summary",dense:f,isLoading:se||D,emptyState:b,hasNextPage:!!_e,isFetching:F.isFetching,isFetchingNextPage:je,onLoadMore:()=>void le(),items:S?js(X,_).map(o=>"nodes"in o?ge(o):O({kind:"single",node:o})[0]).filter(o=>o!=null):p.flatMap(o=>o.kind==="context"?Ae(o):O(o))})}export{xn as E,on as a,en as b,mn as c,pn as u};
|
|
2
|
+
//# sourceMappingURL=events-feed-BtvhZF1f.js.map
|