@lobu/runtime-server 23.0.0 → 24.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/connectors.json +70 -6
- package/dist/catalogs/skills.json +1 -1
- package/dist/component.json +1 -1
- package/dist/connectors/README.md +1 -1
- package/dist/connectors/linkedin-inbox-adapter.js +4 -7
- package/dist/connectors/linkedin.ts +53 -34
- package/dist/connectors/reddit.ts +92 -20
- package/dist/connectors/slack.ts +1 -0
- package/dist/connectors/whatsapp-web-adapter.js +41 -11
- package/dist/connectors/whatsapp-web-helpers.ts +1 -1
- package/dist/connectors/whatsapp_web.ts +2 -2
- package/dist/connectors/x-identity.ts +5 -3
- package/dist/db/migrations/20261019120000_retire_identities_of_deleted_entities.sql +21 -0
- package/dist/db/migrations/20261020120000_entities_live_metadata_domain.sql +66 -0
- package/dist/db/migrations/20261020130000_agents_starters.sql +14 -0
- package/dist/db/migrations/20261020140000_view_attachments_by_page.sql +71 -0
- package/dist/dependencies.bun.lock +63 -60
- package/dist/guest.bundle.js +362 -300
- package/dist/owletto/dist/assets/_-CC8cTmRg.js +3 -0
- package/dist/owletto/dist/assets/_-ksFp4zVf.js +2 -0
- package/dist/owletto/dist/assets/_agentId-DWUFSrVp.js +2 -0
- package/dist/owletto/dist/assets/_agentId-MENLoohA.js +2 -0
- package/dist/owletto/dist/assets/_automationId-BnHqdXOC.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-CefXIqy2.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-C1QPGf9E.js +2 -0
- package/dist/owletto/dist/assets/_conversationId-DinuPCUp.js +2 -0
- package/dist/owletto/dist/assets/{_deploymentId-BuUzGtVL.js → _deploymentId-BeyzVjRm.js} +2 -2
- package/dist/owletto/dist/assets/_eventId-3L_qeL_l.js +2 -0
- package/dist/owletto/dist/assets/_name-Dgedji78.js +2 -0
- package/dist/owletto/dist/assets/_owner-DbrKma4e.js +3 -0
- package/dist/owletto/dist/assets/_shape-DtVfRFz_.js +2 -0
- package/dist/owletto/dist/assets/_skillKey-CqLHzm7L.js +2 -0
- package/dist/owletto/dist/assets/_slug-ndDr_CUg.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-3CH5w8mr.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-DHQY9A8u.js +2 -0
- package/dist/owletto/dist/assets/{accept-invitation-w17IFTtf.js → accept-invitation-CRKbM2Xy.js} +2 -2
- package/dist/owletto/dist/assets/activity-route-view-CFLNukhD.js +2 -0
- package/dist/owletto/dist/assets/{agent-card-controls-mnTN2AZt.js → agent-card-controls-Be1Okb2C.js} +2 -2
- package/dist/owletto/dist/assets/{agent-client-setup-list-Bg3hBfUV.js → agent-client-setup-list-BA8dU_C6.js} +2 -2
- package/dist/owletto/dist/assets/agent-connect-pages-CAV-yXus.js +2 -0
- package/dist/owletto/dist/assets/agent-editor-form-Bi6WvYX-.js +2 -0
- package/dist/owletto/dist/assets/{agent-guardrails-route-BOrCXcAl.js → agent-guardrails-route-DMOjG1D4.js} +2 -2
- package/dist/owletto/dist/assets/{agent-loading-shells-Dqcvky-k.js → agent-loading-shells-De_2d8Lr.js} +2 -2
- package/dist/owletto/dist/assets/{agent-permissions-matrix-BOo_4r_4.js → agent-permissions-matrix-gZWl6mAe.js} +2 -2
- package/dist/owletto/dist/assets/{agent-skill-context-CCdvtlmH.js → agent-skill-context-JLaTamGR.js} +2 -2
- package/dist/owletto/dist/assets/{agent-skills-route-BUxIswuq.js → agent-skills-route-DcK41PWj.js} +2 -2
- package/dist/owletto/dist/assets/agent-subpage-shell-BBJoyTuC.js +2 -0
- package/dist/owletto/dist/assets/agent-thread-Buz3naVF.js +6 -0
- package/dist/owletto/dist/assets/agents-C-ReckCa.js +2 -0
- package/dist/owletto/dist/assets/agents-workbench-CqaKGggb.js +2 -0
- package/dist/owletto/dist/assets/app._appId-Cl1fTuIt.js +2 -0
- package/dist/owletto/dist/assets/automation-detail-content-BMLL4lxO.js +2 -0
- package/dist/owletto/dist/assets/automations-C-ReckCa.js +2 -0
- package/dist/owletto/dist/assets/callback-DTKKsfkz.js +2 -0
- package/dist/owletto/dist/assets/{card-Djgp00r_.js → card-yU0TmNRH.js} +2 -2
- package/dist/owletto/dist/assets/{claim-BYUZnyMp.js → claim-DJfTvlT2.js} +2 -2
- package/dist/owletto/dist/assets/client-rows--FrZfJol.js +2 -0
- package/dist/owletto/dist/assets/{clients-D3Zbjxin.js → clients-L4K1UT8c.js} +2 -2
- package/dist/owletto/dist/assets/{code-editor-DHeyRGZI.js → code-editor-U54Gwjit.js} +2 -2
- package/dist/owletto/dist/assets/connect-4zqtnDHb.js +2 -0
- package/dist/owletto/dist/assets/connect._clientId-Dj0SqgbE.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId-sgtocSvf.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.activity-DTpSW1Xy.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.index-h9X5H1x8.js +2 -0
- package/dist/owletto/dist/assets/{connection-C3XXFEqh.js → connection-ByvKkyFm.js} +2 -2
- package/dist/owletto/dist/assets/{connection-feed-detail-CIJJLDP8.js → connection-feed-detail-DWM9lTao.js} +2 -2
- package/dist/owletto/dist/assets/connections-browser-CEwYrYqt.js +2 -0
- package/dist/owletto/dist/assets/{connector-provenance-8-d8hl10.js → connector-provenance-BocTm__v.js} +2 -2
- package/dist/owletto/dist/assets/connector-scope-lists-OYDOydtz.js +2 -0
- package/dist/owletto/dist/assets/connectors-CyZpcE5f.js +2 -0
- package/dist/owletto/dist/assets/{consent-CdSvVCgx.js → consent-DdfINrVp.js} +2 -2
- package/dist/owletto/dist/assets/{conversations-table-BdXoZAfc.js → conversations-table-BSznfdYt.js} +2 -2
- package/dist/owletto/dist/assets/{core.esm-CYvgWCuv.js → core.esm-Dr7tcIB-.js} +2 -2
- package/dist/owletto/dist/assets/create-CBGwASon.js +2 -0
- package/dist/owletto/dist/assets/create-Cf5hp6Z8.js +2 -0
- package/dist/owletto/dist/assets/create-CwThQtd3.js +2 -0
- package/dist/owletto/dist/assets/{create-automation-form-CtSSeYj3.js → create-automation-form-9T5WnoUs.js} +3 -3
- package/dist/owletto/dist/assets/create._connectorKey-sNHQHNpg.js +2 -0
- package/dist/owletto/dist/assets/{cronstrue-n4qGUraE.js → cronstrue-BWFEyy_P.js} +2 -2
- package/dist/owletto/dist/assets/deployments-DHh9dyzv.js +2 -0
- package/dist/owletto/dist/assets/{deployments-body-BMp7UsMo.js → deployments-body-2xKS8gRo.js} +2 -2
- package/dist/owletto/dist/assets/{deployments-RvUdVkj3.js → deployments-wG_8QzOF.js} +2 -2
- package/dist/owletto/dist/assets/{device-CPU6CjkJ.js → device-6z-xgsoW.js} +2 -2
- package/dist/owletto/dist/assets/device-pin-tombstone-Cwq88RMU.js +2 -0
- package/dist/owletto/dist/assets/device._deviceId-BDerBfD9.js +2 -0
- package/dist/owletto/dist/assets/entity-avatar-Cc1CuI-0.js +2 -0
- package/dist/owletto/dist/assets/entity-options-DHdMC1Lx.js +2 -0
- package/dist/owletto/dist/assets/entity-page--OkXmlNP.js +2 -0
- package/dist/owletto/dist/assets/entity-type-page-89RoK_-P.js +2 -0
- package/dist/owletto/dist/assets/event-detail-D4YZRtrA.js +2 -0
- package/dist/owletto/dist/assets/events-feed-DsrkV2ix.js +2 -0
- package/dist/owletto/dist/assets/filter-editors-B1_QUpg_.js +2 -0
- package/dist/owletto/dist/assets/{full-page-spinner-DqpH99np.js → full-page-spinner-Cqih-8IW.js} +2 -2
- package/dist/owletto/dist/assets/guardrails-B8Rs1be3.js +2 -0
- package/dist/owletto/dist/assets/identity-B0nH4yiC.js +2 -0
- package/dist/owletto/dist/assets/index-4TSkcsth.js +2 -0
- package/dist/owletto/dist/assets/index-BSH07yVD.css +1 -0
- package/dist/owletto/dist/assets/index-BgkhXElB.js +2 -0
- package/dist/owletto/dist/assets/index-CoW4Bz3w.js +2 -0
- package/dist/owletto/dist/assets/index-Codw-Qqi.js +2 -0
- package/dist/owletto/dist/assets/{index-BQVliQW1.js → index-DAOyXG1X.js} +2 -2
- package/dist/owletto/dist/assets/{index-B9uPN6FC.js → index-DKPwCasf.js} +2 -2
- package/dist/owletto/dist/assets/index-DMyXd3bJ.js +2 -0
- package/dist/owletto/dist/assets/index-DYCqXaMf.js +7950 -0
- package/dist/owletto/dist/assets/index-DYYZLcJ0.js +2 -0
- package/dist/owletto/dist/assets/index-DYzWV5_z.js +2 -0
- package/dist/owletto/dist/assets/index-Da6CrGEu.js +2 -0
- package/dist/owletto/dist/assets/{index-Hio-HRfo.js → index-DfyDUpuI.js} +2 -2
- package/dist/owletto/dist/assets/index-DneshLbf.js +2 -0
- package/dist/owletto/dist/assets/index-TgRS2v_F.js +2 -0
- package/dist/owletto/dist/assets/{index-ICgKp3YK.js → index-ZNlrDc_f.js} +2 -2
- package/dist/owletto/dist/assets/{json-diff-DBoag_OS.js → json-diff-DFvYINBT.js} +3 -3
- package/dist/owletto/dist/assets/{list-skeleton-C_GuoxAH.js → list-skeleton-DFsEqLU1.js} +2 -2
- package/dist/owletto/dist/assets/login-DO0j-AYr.js +2 -0
- package/dist/owletto/dist/assets/{logout-CLGgeZB7.js → logout-BmNwoAf7.js} +2 -2
- package/dist/owletto/dist/assets/member-scope-gate-B2LrMWBU.js +2 -0
- package/dist/owletto/dist/assets/memory-browse-page-Cjpl8EbB.js +103 -0
- package/dist/owletto/dist/assets/{model-selector-dAbDgJvx.js → model-selector-TQcA93xm.js} +2 -2
- package/dist/owletto/dist/assets/models-D7aED5Sa.js +2 -0
- package/dist/owletto/dist/assets/new-BMrFy5Qa.js +2 -0
- package/dist/owletto/dist/assets/{new-BkdULx2r.js → new-ByBhteWA.js} +2 -2
- package/dist/owletto/dist/assets/new-DWp3deoW.js +2 -0
- package/dist/owletto/dist/assets/{oauth-workspace-access-BxsjwgdH.js → oauth-workspace-access-D_5uESuz.js} +2 -2
- package/dist/owletto/dist/assets/{organization-gxGeDjIV.js → organization-DTFoYP4V.js} +2 -2
- package/dist/owletto/dist/assets/peek-pane-content-DF5iGC3c.js +2 -0
- package/dist/owletto/dist/assets/{permissions-aPHaKLec.js → permissions-C_auqxfP.js} +2 -2
- package/dist/owletto/dist/assets/proposal-review-shell-DsNiavG_.js +2 -0
- package/dist/owletto/dist/assets/public-shell-ready-B2NUI89V.js +2 -0
- package/dist/owletto/dist/assets/{recent-D-65Pgu-.js → recent-3d99S2IE.js} +2 -2
- package/dist/owletto/dist/assets/record-activity-C9KfBkXb.js +2 -0
- package/dist/owletto/dist/assets/record-field-peek-BBZcRuGT.js +2 -0
- package/dist/owletto/dist/assets/record-session-BizRugWs.js +2 -0
- package/dist/owletto/dist/assets/{reset-password-uX_V6bip.js → reset-password-DqfcSn8M.js} +2 -2
- package/dist/owletto/dist/assets/runs-panel-T1ZxTVz6.js +2 -0
- package/dist/owletto/dist/assets/runs-table-D_8QlCCN.js +2 -0
- package/dist/owletto/dist/assets/schema-value-normalization-CylKX3PK.js +97 -0
- package/dist/owletto/dist/assets/settings-B_ClYztB.js +2 -0
- package/dist/owletto/dist/assets/settings-DgX1-xo7.js +2 -0
- package/dist/owletto/dist/assets/skills-Drw5tcZw.js +2 -0
- package/dist/owletto/dist/assets/{source-record-panels-CPyzlfD1.js → source-record-panels-Cg249m1S.js} +2 -2
- package/dist/owletto/dist/assets/{use-mention-search-By8RZyKW.js → use-mention-search-BYbFvHbJ.js} +2 -2
- package/dist/owletto/dist/assets/view-param-filters-DMSqkN2J.js +2 -0
- package/dist/owletto/dist/index.html +2 -2
- package/dist/server-main.bundle.mjs +3881 -3215
- package/npm-shrinkwrap.json +277 -261
- package/package.json +6 -5
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/agent-policy.js +0 -3
- package/vendor/core/dist/agent-tooling.d.ts +1 -1
- package/vendor/core/dist/agent-tooling.js +3 -1
- package/vendor/core/dist/contracts/agent-settings.d.ts +6 -2
- package/vendor/core/dist/contracts/agent-settings.js +12 -1
- package/vendor/core/dist/contracts/tools/manage-views.d.ts +53 -234
- package/vendor/core/dist/contracts/tools/manage-views.js +50 -76
- package/vendor/core/dist/contracts/tools/view-attach.d.ts +5 -8
- package/vendor/core/dist/contracts/tools/view-attach.js +14 -31
- package/vendor/core/dist/contracts/tools/view-definition.d.ts +21 -0
- package/vendor/core/dist/contracts/tools/view-definition.js +165 -0
- package/vendor/core/dist/contracts/worker/protocol.d.ts +39 -2
- package/vendor/core/dist/contracts/worker/protocol.js +24 -1
- package/vendor/core/dist/index.d.ts +1 -1
- package/vendor/core/dist/index.js +2 -1
- package/vendor/core/dist/suggestions.d.ts +15 -2
- package/vendor/core/dist/suggestions.js +48 -3
- package/vendor/core/dist/types.d.ts +26 -0
- package/vendor/core/dist/types.js +5 -0
- package/vendor/core/package.json +11 -5
- package/vendor/postgres/cf/src/connection.js +18 -0
- package/vendor/postgres/cjs/src/connection.js +18 -0
- package/vendor/postgres/src/connection.js +18 -0
- package/vendor/views/dist/api.d.ts +71 -17
- package/vendor/views/dist/api.js +200 -35
- package/vendor/views/dist/bridge.d.ts +3 -0
- package/vendor/views/dist/bridge.js +9 -1
- package/vendor/views/dist/components.d.ts +170 -0
- package/vendor/views/dist/components.js +361 -0
- package/vendor/views/dist/index.d.ts +1 -1
- package/vendor/views/package.json +11 -1
- package/dist/owletto/dist/assets/_-3J-IrxWk.js +0 -2
- package/dist/owletto/dist/assets/_-DYUE3ix4.js +0 -3
- package/dist/owletto/dist/assets/_agentId-Bn2IAjIy.js +0 -2
- package/dist/owletto/dist/assets/_agentId-Cam7Z0N7.js +0 -2
- package/dist/owletto/dist/assets/_automationId-CXEiKVZJ.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey._connectionId-CS85l61t.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey.index-clVDIyW0.js +0 -2
- package/dist/owletto/dist/assets/_conversationId-Ci2k-BuN.js +0 -2
- package/dist/owletto/dist/assets/_eventId-B0662F8h.js +0 -2
- package/dist/owletto/dist/assets/_name-CwWePlOl.js +0 -2
- package/dist/owletto/dist/assets/_owner-dTWkrKsK.js +0 -3
- package/dist/owletto/dist/assets/_shape-BtS3y4M9.js +0 -2
- package/dist/owletto/dist/assets/_skillKey-Dc9m-nlR.js +0 -2
- package/dist/owletto/dist/assets/_slug-DQHutM41.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-B30ik8ma.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-CUHypQnF.js +0 -2
- package/dist/owletto/dist/assets/activity-route-view-CMqYiiKM.js +0 -2
- package/dist/owletto/dist/assets/agent-connect-pages-B_vrqLVc.js +0 -2
- package/dist/owletto/dist/assets/agent-editor-form-hTs7eO_U.js +0 -2
- package/dist/owletto/dist/assets/agent-subpage-shell-D92imvSt.js +0 -2
- package/dist/owletto/dist/assets/agent-thread-BJOijbT0.js +0 -6
- package/dist/owletto/dist/assets/agents-9XjpDj_S.js +0 -2
- package/dist/owletto/dist/assets/agents-workbench-Bt5QCYQ7.js +0 -2
- package/dist/owletto/dist/assets/app._appId-CKv7_squ.js +0 -2
- package/dist/owletto/dist/assets/automation-detail-content-vUwVumXf.js +0 -2
- package/dist/owletto/dist/assets/automations-9XjpDj_S.js +0 -2
- package/dist/owletto/dist/assets/callback-BRgcL8gz.js +0 -2
- package/dist/owletto/dist/assets/client-rows-EJSKR6z1.js +0 -2
- package/dist/owletto/dist/assets/connect-CfsFsy9P.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-DkiC8xos.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId-CIXrGOsT.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId.activity-Ckdz6I0y.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId.index-CNxafNeo.js +0 -2
- package/dist/owletto/dist/assets/connections-browser-CKZjzRz6.js +0 -2
- package/dist/owletto/dist/assets/connector-scope-lists-CadPVsI3.js +0 -2
- package/dist/owletto/dist/assets/connectors-lvLJ30lo.js +0 -2
- package/dist/owletto/dist/assets/create-0xW9eXxG.js +0 -2
- package/dist/owletto/dist/assets/create-B0qhrrX4.js +0 -2
- package/dist/owletto/dist/assets/create-CAfF-yI1.js +0 -2
- package/dist/owletto/dist/assets/create._connectorKey-i6xxkWKV.js +0 -2
- package/dist/owletto/dist/assets/deployments-4Itm35Xc.js +0 -2
- package/dist/owletto/dist/assets/device-pin-tombstone-CrjG7gPo.js +0 -2
- package/dist/owletto/dist/assets/device._deviceId-Cs3ZmXWo.js +0 -2
- package/dist/owletto/dist/assets/entity-options-uXjgT7y9.js +0 -2
- package/dist/owletto/dist/assets/entity-page-Dc0LGr5U.js +0 -2
- package/dist/owletto/dist/assets/entity-type-page-CwZxa0BR.js +0 -2
- package/dist/owletto/dist/assets/event-detail-ve2d6Gbb.js +0 -2
- package/dist/owletto/dist/assets/events-feed-BtvhZF1f.js +0 -2
- package/dist/owletto/dist/assets/filter-editors-Cj-v6NtH.js +0 -2
- package/dist/owletto/dist/assets/guardrails-HFo2Ut8B.js +0 -2
- package/dist/owletto/dist/assets/identity-BigVSBCl.js +0 -2
- package/dist/owletto/dist/assets/index-BLEcy9-T.css +0 -1
- package/dist/owletto/dist/assets/index-BfedB4Rc.js +0 -2
- package/dist/owletto/dist/assets/index-CUw3aKBI.js +0 -2
- package/dist/owletto/dist/assets/index-CXhxUkv3.js +0 -2
- package/dist/owletto/dist/assets/index-Cr5hwh-C.js +0 -7950
- package/dist/owletto/dist/assets/index-CzkTV4ZQ.js +0 -2
- package/dist/owletto/dist/assets/index-DKSx8JN_.js +0 -2
- package/dist/owletto/dist/assets/index-DVk7Ug0d.js +0 -2
- package/dist/owletto/dist/assets/index-DmZuKGf8.js +0 -2
- package/dist/owletto/dist/assets/index-cPcroOH0.js +0 -2
- package/dist/owletto/dist/assets/index-n7sTbNv4.js +0 -2
- package/dist/owletto/dist/assets/index-xiFpcWKv.js +0 -2
- package/dist/owletto/dist/assets/login-Ci6ixHuL.js +0 -2
- package/dist/owletto/dist/assets/member-scope-gate-B44INDPY.js +0 -2
- package/dist/owletto/dist/assets/memory-browse-page-DyQiRvzl.js +0 -103
- package/dist/owletto/dist/assets/models-DpVP7ZwX.js +0 -2
- package/dist/owletto/dist/assets/new-BUb7AnEW.js +0 -2
- package/dist/owletto/dist/assets/new-CHOr-EcI.js +0 -2
- package/dist/owletto/dist/assets/peek-pane-content-CHoQHe2H.js +0 -2
- package/dist/owletto/dist/assets/proposal-review-shell-UcZr87_Q.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-DcnlADmj.js +0 -2
- package/dist/owletto/dist/assets/record-activity-CBXH6v1d.js +0 -2
- package/dist/owletto/dist/assets/renderer-mEDnVW0O.js +0 -97
- package/dist/owletto/dist/assets/runs-C0rCgGwX.js +0 -2
- package/dist/owletto/dist/assets/runs-panel-Du1JMjg5.js +0 -2
- package/dist/owletto/dist/assets/runs-table-syPJ6r6T.js +0 -2
- package/dist/owletto/dist/assets/settings-9NkNA1G1.js +0 -2
- package/dist/owletto/dist/assets/settings-E-10sLQX.js +0 -2
- package/dist/owletto/dist/assets/skills-D2Ri9b4f.js +0 -2
- package/dist/owletto/dist/assets/status-dot-B-EWMgq6.js +0 -2
- package/dist/owletto/dist/assets/tabs-DqIIkCX-.js +0 -2
- package/dist/owletto/dist/assets/view-param-filters-CqLZQrnO.js +0 -2
- /package/vendor/postgres/{.bun-tag-f39dafdb2305d504 → .bun-tag-2f292c6554a8475e} +0 -0
|
@@ -1,2 +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-
|
|
1
|
+
import{G as we,i as ye,r as c,H as be,j as e,I as je,B as R,J as ie}from"./index-DYCqXaMf.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-D_5uESuz.js";import{C as oe,a as re,b as ne,d as ce,c as P}from"./card-yU0TmNRH.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 M(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),[F,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=F?.code===N?F: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(M(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(M(f,"Failed to process device authorization"));const ee=s?"approved":"denied";if(f?.status!==ee)throw new Error(M(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-6z-xgsoW.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as e,f4 as f,r as v,it as C,iu as k,hL as y,B as A,L,cT as w,iv as E,iw as I,ix as N,u as P,iy as F,hZ as O}from"./index-DYCqXaMf.js";import{a as R,R as S}from"./runs-panel-T1ZxTVz6.js";import{c as g,C as $,a as b}from"./connector-scope-lists-OYDOydtz.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]=v.useState(n);v.useEffect(()=>{n&&d(!0)},[n]);const m=s.id,p=s.connector_key,u=s.facets?.chat??!1,h=u?"Channels":"Feeds",x=s.has_operations===!0,_=s.feed_count>0||g(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(y,{title:h,count:s.feed_count===1?"1 source":`${s.feed_count} sources`,action:g(t)?e.jsx(A,{asChild:!0,size:"sm",variant:"outline",children:e.jsxs(L,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:a,connectorKey:p,connectionId:String(m)},search:{addFeed:!0},children:[e.jsx(w,{className:"h-3.5 w-3.5"}),u?"Add channel":"Add source"]})}):null,children:e.jsx($,{connection:s,ownerSlug:a,connectorKey:p,connectorDef:t})}):e.jsx(b,{connection:s,ownerSlug:a,title:h})),x&&(i?e.jsx(E,{connection:s,ownerSlug:a}):e.jsx(B,{connection:s,ownerSlug:a}))]}),i?e.jsx(I,{title:"Connection settings",summary:"name, visibility, credentials, remove",open:l,onOpenChange:d,children:j}):j,r&&!u&&e.jsx(y,{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-Cwq88RMU.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{aJ as U,id as ne,ie as V,r as v,j as e,ig as L,B as b,a2 as z,ih as C,d7 as Y,av as te,hL as I,S as A,aV as B,ef as ae,eg as ie,dF as ce,eh as oe,ii as re,U as le,o as de,aA as me,ij as ue,ik as xe,il as he,aB as pe,aw as fe,aC as P,aU as q,L as E,im as ge,io as je,aP as ve,ip as ye,iq as be,ht as Ne,b8 as ke,g9 as _e,ir as K,I as we,a$ as Ce,b9 as Se,ga as $e,gb as O,bd as De,is as F,ai as Pe}from"./index-DYCqXaMf.js";import{c as G,C as Le,R as ze}from"./device-pin-tombstone-Cwq88RMU.js";import{R as Ie}from"./runs-panel-T1ZxTVz6.js";import{S as Ae,g as Re}from"./runs-table-D_8QlCCN.js";import{c as Ee}from"./connection-label-BobuYiAG.js";import{w as M}from"./workspace-label-o_QfBuCM.js";import"./connector-scope-lists-OYDOydtz.js";import"./filter-editors-B1_QUpg_.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(J(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 J(s,n){return s.organization_slug===n?s.update_required:[]}function Be(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 Te({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 i=>{p(null),N(null),a(i.key);try{x||await t.mutateAsync({deviceWorkerId:s.id,organizationId:n});const w=await r.mutateAsync({connector_key:i.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!==i.key),{connectorKey:i.key,name:i.name,connectionId:S,instructions:w.status==="setup_required"?w.instructions:void 0}])}catch(w){N({key:i.key,message:w instanceof Error?w.message:"Could not connect."})}finally{a(null)}},k=new Set(j.map(i=>i.connectorKey)),l=J(s,o),c=h.filter(i=>!k.has(i.key));return e.jsxs("div",{className:"mt-4 space-y-3",children:[j.map(i=>e.jsx(qe,{outcome:i,device:s,organizationId:n},i.connectorKey)),c.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:c.map(i=>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:[i.name,i.required_capability&&L[i.required_capability]&&L[i.required_capability]!==i.name?e.jsx("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:L[i.required_capability]}):null]}),e.jsxs(b,{size:"sm",variant:"outline","aria-label":`Connect ${i.name}`,disabled:g!==null,onClick:()=>x?void y(i):p(i.key),children:[g===i.key?e.jsx(z,{className:"mr-1.5"}):null,"Connect"]})]}),u===i.key?e.jsx(Q,{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(i),onCancel:()=>p(null)}):null,f?.key===i.key?e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:f.message}):null]},i.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(i=>e.jsx("li",{children:`${i.display_name} — this device has ${i.device_version}, this workspace uses ${i.workspace_version}`},i.connector_key))})]}):null,m.length>0?e.jsx("ul",{className:"space-y-1 text-xs text-muted-foreground",children:m.map(i=>e.jsx("li",{children:`${i.display_name} — set up on this device in ${s.organization_name??"its home workspace"}, not available in this workspace yet`},i.connector_key))}):null]})}function Q({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 qe({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=G(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}`,k=a.get(y)??{key:y,name:x.name,connections:[]};k.name=L[y]??x.name,k.connections.push(d),a.set(y,k)}const N=Me(s,r,o),j=Be(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(A,{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(W,{group:d,deviceId:s.id,organizationId:n,ownerSlug:o,definitionsByKey:g,selectedConnection:h,openSettings:m},d.key))}),n&&!t&&!u?e.jsx(Te,{device:s,organizationId:n,ownerSlug:o,connectable:N,unavailable:j}):null,B(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(W,{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 W({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(ie,{className:"group flex w-full items-center gap-3 py-3 text-left",children:[e.jsx(ce,{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(Ke,{summary:a,deviceId:n,organizationId:o,ownerSlug:h,connectorDef:m.get(a.connector_key),openSettings:a.connection_id===r&&t},a.connection_id))})})]})}function Ke({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?G(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(A,{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 Oe({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)},k=async l=>{a(null);try{await m.mutateAsync({deviceWorkerId:s.id,organizationId:l}),y()}catch(c){a(c instanceof Error?c.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(Q,{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 k(x.id),onCancel:y}):null,g?e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:g}):null]})}function Fe({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,k]=v.useState(""),l=he(t,n),c=l&&pe(l,s)?l:void 0,i=c?.id??n,{data:w=[]}=fe(o,{profileKind:"browser_session"}),S=v.useMemo(()=>w.filter(_=>_.device_worker_id===i&&_.status!=="revoked"),[w,i]),$=c?.label?.trim()??"";if(v.useEffect(()=>{d||k($)},[$,d]),u)return e.jsxs(P,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{className:"h-6 w-6 rounded"}),e.jsx(A,{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(!c&&l&&o)return e.jsxs(P,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(q,{platform:B(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(!c)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(c),R=D?je(s,D,ve()):void 0,X=B(c),Z=ye(c.app_version),ee=be(c,Z),T=()=>{const _=y.trim(),se=c.label?.trim()??"";if(_===se){x(!1);return}f.mutate({deviceWorkerId:c.id,label:_.length===0?null:_},{onSuccess:()=>x(!1)})};return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(Ne,{header:e.jsx(_e,{breadcrumb:e.jsx($e,{crumbs:[e.jsx(E,{to:"/$owner/connectors",params:{owner:s},search:{},className:O,children:"Connectors"},"connectors"),...R?[e.jsx(E,{to:"/$owner/connectors/app/$appId",params:{owner:s,appId:R.id},className:O,children:R.name},"app")]:[]]}),icon:e.jsx(q,{platform:X,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(_.target.value),placeholder:C({...c,label:null}),maxLength:80,className:"h-9 max-w-sm text-base font-semibold",autoFocus:!0,onKeyDown:_=>{_.key==="Enter"?(_.preventDefault(),N||T()):_.key==="Escape"&&(j(!1),k(c.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"," ",c.connector_count>0?`and un-pins ${c.connector_count} connector${c.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(c.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:T,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:()=>{k(c.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(c),e.jsx(b,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground","aria-label":"Edit device",onClick:()=>{j(!1),k(c.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 ${c.online?"bg-emerald-500":"bg-muted-foreground/50"}`}),c.online?c.connector_error_count>0?"Needs attention":"Online":"Offline"]}),meta:ee||void 0,caption:`Last seen ${K(new Date(c.last_seen_at),{addSuffix:!0})}${c.last_sync_at?` · Last sync ${K(new Date(c.last_sync_at),{addSuffix:!0})}`:""}`}),children:[e.jsx(Oe,{device:c,ownerSlug:s}),c.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(ke,{className:"h-3.5 w-3.5 shrink-0"}),c.connector_error_count," connector",c.connector_error_count===1?"":"s"," pinned to this device ",c.connector_error_count===1?"is":"are"," erroring."]}):null,e.jsx(H,{device:c,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:i},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(Ae,{status:n.is_expired?"error":Re(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 Ze(){const{owner:s,deviceId:n}=F.useParams(),{connection:o,settings:h}=F.useSearch();return e.jsx(Pe,{owner:s,children:({ownerSlug:m,organizationId:r})=>e.jsx(Fe,{ownerSlug:m,deviceId:n,organizationId:r,selectedConnection:o,openSettings:h})})}export{Ze as component};
|
|
2
|
+
//# sourceMappingURL=device._deviceId-BDerBfD9.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as a,j as l,fx as A,Q as f,cS as O}from"./index-DYCqXaMf.js";var S="Separator",m="horizontal",k=["horizontal","vertical"],b=a.forwardRef((e,t)=>{const{decorative:r,orientation:o=m,...i}=e,n=I(o)?o:m,c=r?{role:"none"}:{"aria-orientation":n==="vertical"?n:void 0,role:"separator"};return l.jsx(A.div,{"data-orientation":n,...c,...i,ref:t})});b.displayName=S;function I(e){return k.includes(e)}var x=b;const P=a.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...o},i)=>l.jsx(x,{ref:i,decorative:r,orientation:t,className:f("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...o}));P.displayName=x.displayName;function g(e,t){const r=e?.properties;if(r)return Object.entries(r).find(([,o])=>o[t])?.[0]}function R(e){const t=e.trim(),r=t.split(/[\s._@/-]+/).filter(Boolean),o=r.length>=2?`${r[0][0]}${r[1][0]}`:(r[0]??t).slice(0,2);let i=0;for(let n=0;n<t.length;n++)i=i*31+t.charCodeAt(n)>>>0;return{initials:o.toUpperCase()||"?",hue:i%360}}function T(e){const[t,r]=a.useState();return a.useEffect(()=>{if(!e){r(void 0);return}let o=!1;const i=e.trim().toLowerCase();return crypto.subtle.digest("SHA-256",new TextEncoder().encode(i)).then(n=>{o||r(Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join(""))}),()=>{o=!0}},[e]),t?`https://www.gravatar.com/avatar/${t}?d=identicon&s=80`:void 0}function $({metadata:e,metadataSchema:t,name:r,typeIcon:o,className:i="h-6 w-6",iconClassName:n="h-5 w-5",initialsFallback:s=!1}){const c=g(t,"x-image"),u=g(t,"x-email"),p=c&&e?.[c]||void 0,v=u&&e?.[u]||void 0,y=T(p?void 0:v),d=p||y,[w,h]=a.useState(!1);if(a.useEffect(()=>{h(!1)},[d]),d&&!w)return l.jsx("img",{src:d,alt:r,referrerPolicy:"no-referrer",onError:()=>h(!0),className:f("rounded-full object-cover border border-border",i)});if(s){const E=r.trim()||v||z(e,t)||r,{initials:j,hue:N}=R(E);return l.jsx("span",{role:"img","aria-label":r,className:f("inline-grid place-items-center rounded-full border border-border font-semibold text-white select-none",i),style:{background:`oklch(0.55 0.13 ${N})`,fontSize:"0.85em"},children:j})}return l.jsx(O,{icon:o,className:n})}function z(e,t){if(!e)return;const r=t?.properties,o=["email","handle","username","login","github","x_handle","slug"],i=Object.keys(r||e);for(const n of i)if(o.includes(n.toLowerCase())){const s=e[n];if(typeof s=="string"&&s.trim())return s}}export{$ as E,P as S};
|
|
2
|
+
//# sourceMappingURL=entity-avatar-Cc1CuI-0.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{o as x,bh as C,j as e,bp as _,bq as m,br as S,bs as b,bt as c,eR as u}from"./index-DYCqXaMf.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=C().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(_,{value:r,onValueChange:j,disabled:p,children:[e.jsx(m,{"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-DHdMC1Lx.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{d2 as pe,r as S,bQ as fe,fk as ge,dS as X,j as e,B as N,u as H,jb as ve,S as Y,fu as ne,jg as je,w as ye,o as ie,jh as be,bR as L,g as ke,dQ as re,e_ as _e,jc as Ne,ji as we,b9 as Se,c0 as J,fi as Re,f4 as Fe,gP as Ee,gQ as De,gR as Ce,gS as Le,gT as Pe,jj as Be,bU as Ie,z,I as Z,fN as Te,b8 as Ve,fl as Oe,dG as U,i as Ae,jk as Me,L as $e,gK as ze}from"./index-DYCqXaMf.js";import{R as Ue}from"./record-activity-C9KfBkXb.js";import{n as Ke,c as K,g as He,D as We,S as Ge}from"./schema-value-normalization-CylKX3PK.js";import{r as Qe}from"./record-field-peek-BBZcRuGT.js";import{S as qe,E as Xe}from"./entity-avatar-Cc1CuI-0.js";import{a as oe,V as ee,M as Ye,b as Je}from"./view-param-filters-DMSqkN2J.js";import{a as Ze}from"./source-record-panels-Cg249m1S.js";import{l as et,L as tt,s as W,R as le,i as st,S as at}from"./events-feed-DsrkV2ix.js";import{a as nt}from"./record-session-BizRugWs.js";import"./filter-editors-B1_QUpg_.js";import"./connection-label-BobuYiAG.js";import"./clients-L4K1UT8c.js";import"./client-rows--FrZfJol.js";import"./agent-loading-shells-De_2d8Lr.js";import"./member-scope-gate-B2LrMWBU.js";import"./card-yU0TmNRH.js";import"./app-bridge-BCm4muqj.js";import"./conversations-table-BSznfdYt.js";function it(t,s){if(t===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if("shouldBlockFn"in t)return t;if(typeof t=="function")return{shouldBlockFn:async()=>await t(),enableBeforeUnload:!0,withResolver:!1};const n=!!(t.condition??!0),i=t.blockerFn;return{shouldBlockFn:async()=>n&&i!==void 0?await i():n,enableBeforeUnload:n,withResolver:i===void 0}}function rt(t,s){const{shouldBlockFn:n,enableBeforeUnload:i=!0,disabled:a=!1,withResolver:c=!1}=it(t),o=pe(),{history:r}=o,[m,x]=S.useState({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return S.useEffect(()=>{const p=async f=>{function l(j){const g=o.parseLocation(j),_=o.getMatchedRoutes(g.pathname);return _.foundRoute===void 0?{routeId:"__notFound__",fullPath:g.pathname,pathname:g.pathname,params:_.routeParams,search:o.options.parseSearch(j.search)}:{routeId:_.foundRoute.id,fullPath:_.foundRoute.fullPath,pathname:g.pathname,params:_.routeParams,search:o.options.parseSearch(j.search)}}const h=l(f.currentLocation),d=l(f.nextLocation);if(h.routeId==="__notFound__"&&d.routeId!=="__notFound__")return!1;const u=await n({action:f.action,current:h,next:d});if(!c)return u;if(!u)return!1;const b=await new Promise(j=>{x({status:"blocked",current:h,next:d,action:f.action,proceed:()=>j(!1),reset:()=>j(!0)})});return x({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),b};return a?void 0:r.block({blockerFn:p,enableBeforeUnload:i})},[n,i,a,c,r,o]),m}function $(t,s){return X(K(t))===X(K(s))}function ot(t,s){const n={};for(const i of new Set([...Object.keys(t),...Object.keys(s)]))$(t[i],s[i])||(n[i]=K(t[i])??null);return Object.keys(n).length>0?n:void 0}function lt(t,s){return[...new Set([...Object.keys(t),...Object.keys(s)])].filter(n=>{try{return!$(t[n],s[n])}catch{return!0}})}function te(t,s){return{name:t.name,slug:t.slug,metadata:Ke(t.metadata??{},s)}}function ct(t,s,n){const i=new Set(n),a={},c={},o=new Set([...Object.keys(t.values.metadata),...Object.keys(t.baseline.metadata),...Object.keys(s.metadata)]);for(const r of o){const m=i.has(r),x=m?t.values.metadata[r]:t.baseline.metadata[r],p=$(x,s.metadata[r])?x:s.metadata[r];p!==void 0&&(a[r]=p);let f=!1;if(!m)try{f=!$(t.values.metadata[r],t.baseline.metadata[r])}catch{f=!0}const l=f?t.values.metadata[r]:p;l!==void 0&&(c[r]=l)}return{baseline:{name:s.name,slug:s.slug,metadata:a},values:{name:s.name,slug:s.slug,metadata:c}}}function dt({entity:t,schema:s,orgContext:n}){const i=S.useMemo(()=>te(t,s),[t,s]),a=fe(t.id,i,s),c=ge(n),{values:o,baseline:r,commit:m}=a,x=S.useMemo(()=>lt(o.metadata,r.metadata),[o.metadata,r.metadata]),p=o.name!==r.name||o.slug!==r.slug,f=S.useCallback((h,d)=>a.setValues(u=>({...u,metadata:{...u.metadata,[h]:d}})),[a.setValues]),l=async({note:h}={})=>{if(!a.canSubmit)return null;const d=ot(o.metadata,r.metadata),u=o.name.trim()!==r.name.trim();if(!d&&!p)return null;const b=await c.mutateAsync({entityId:t.id,name:u?o.name.trim():void 0,slug:o.slug,metadata:d,field_note:d&&h?.trim()||void 0}),j=te(b.entity,s);return m(g=>ct(g,j,Object.keys(d??{})),j),{held:b.blocked_fields??[],approvalUrl:b.approval_url}};return{values:o,baseline:r,revision:a.revision,setValues:a.setValues,setMetadataField:f,reset:a.reset,save:l,saving:c.isPending,dirtyKeys:x,identityDirty:p,isDirty:p||x.length>0,canSubmit:a.canSubmit,hasConflict:a.hasConflict,hasInvalidInput:a.hasInvalidInput}}const ut=3,mt=50;function ce(t){const s=S.useRef(null);return S.useEffect(()=>{t&&(s.current?.scrollIntoView?.({block:"start"}),s.current?.focus())},[t]),s}function I({headingRef:t,children:s}){return e.jsx("h3",{ref:t,tabIndex:-1,className:"text-xs font-medium uppercase tracking-wide text-muted-foreground outline-none",children:s})}function ht({entityId:t,entityName:s,ownerSlug:n,orgContext:i,focus:a,collapsed:c=!1}){const o=H(),r=ce(a),{data:m,isLoading:x,isError:p,refetch:f}=ve(t,i,{limit:mt});if(x)return e.jsxs("section",{className:"space-y-2","aria-busy":"true",children:[e.jsx(I,{headingRef:r,children:"Linked"}),e.jsx(Y,{className:"h-4 w-24"}),e.jsx(Y,{className:"h-6 w-full rounded-md"})]});if(p||!m)return e.jsxs("section",{className:"space-y-2",children:[e.jsx(I,{headingRef:r,children:"Linked"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Could not load this record's links."," ",e.jsx("button",{type:"button",className:"underline",onClick:()=>void f(),children:"Retry"})]})]});if(m.countsByType.length===0)return a?e.jsxs("section",{className:"space-y-2",children:[e.jsx(I,{headingRef:r,children:"Linked"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"No links to other records yet."})]}):null;if(c){const l=m.countsByType.flatMap(h=>{const d=h.count===1?m.rows.find(b=>b.relationship_type_slug===h.relationship_type_slug):void 0,u=d?et(d,t):void 0;return[h.relationship_type_name,u?.self?"this record":u?.name??String(h.count)]});return e.jsxs("section",{className:"space-y-1","aria-label":"Linked records",children:[e.jsx(I,{headingRef:r,children:"Linked"}),e.jsx("p",{"data-testid":"linked-summary",className:"truncate text-sm text-muted-foreground",children:l.join(" · ")})]})}return e.jsxs("section",{className:"space-y-3","aria-label":"Linked records",children:[e.jsx(I,{headingRef:r,children:"Linked"}),m.countsByType.map(l=>{const h=m.rows.filter(u=>u.relationship_type_slug===l.relationship_type_slug).slice(0,ut),d=l.count>h.length;return e.jsxs("div",{className:"grid grid-cols-[minmax(0,2fr)_minmax(0,3fr)] items-baseline gap-x-3 text-sm",children:[e.jsxs("p",{className:"text-muted-foreground",children:[l.relationship_type_name,d?e.jsxs("span",{className:"tabular-nums text-muted-foreground/70",children:[" ","· ",l.count]}):null]}),e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[h.map(u=>e.jsx(tt,{row:u,entityId:t,ownerSlug:n,orgContext:i},u.id)),d&&o?e.jsxs(N,{type:"button",variant:"ghost",size:"sm",className:"h-8 px-2 text-primary hover:text-primary",onClick:()=>o.open({href:"",key:`record-links:${t}:${l.relationship_type_slug}`,title:`${l.relationship_type_name} · ${l.count}`,recordLinks:{entityId:t,entityName:s,ownerSlug:n,orgContext:i,relationshipType:l.relationship_type_slug,label:l.relationship_type_name}}),children:["Show all ",l.count]}):null]})]},l.relationship_type_slug)})]})}function xt({record:t,ownerSlug:s,orgContext:n,focus:i}){const[a,c]=S.useState(i),o=ce(i);return e.jsxs("section",{className:"space-y-2",children:[e.jsx(I,{headingRef:o,children:"Linked"}),a?e.jsx(Ze,{record:t,ownerSlug:s,orgContext:n}):e.jsx(N,{type:"button",variant:"outline",size:"sm",className:"h-7",onClick:()=>c(!0),children:"Find linked records"})]})}const pt="$name";function de({outcome:t,schema:s}){if(!t||t.held.length===0)return null;const n=s?.properties??{},i=t.held.map(a=>a===pt?"Name":He(a,n[a]??{}));return e.jsxs("div",{role:"status",className:"rounded-md bg-amber-500/10 px-3 py-2 text-sm text-amber-700 dark:text-amber-300",children:[i.join(", ")," ",i.length===1?"needs":"need"," approval before ",i.length===1?"it changes":"they change",".",t.approvalUrl?e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{href:t.approvalUrl,className:"underline",children:"Review"})]}):null]})}const ft=320,gt={},vt=()=>{};function jt({view:t,orgSlug:s,recordUrl:n,scope:i}){const a=H(),c=`${n}${ne(t.key)}`,o=a?()=>a.open({href:c,title:t.name}):void 0;return e.jsxs("section",{className:"min-w-0 rounded-lg border","data-testid":"view-card","data-view":t.key,children:[e.jsxs("header",{className:"flex items-start justify-between gap-3 px-4 pt-3 pb-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"truncate text-sm font-medium",children:t.name}),t.description?e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:t.description}):null]}),o?e.jsxs(N,{type:"button",variant:"ghost",size:"sm",className:"h-7 shrink-0 gap-1.5 px-2 text-muted-foreground hover:text-foreground",onClick:o,"aria-label":`Open ${t.name}`,children:[e.jsx(je,{className:"h-3.5 w-3.5"}),"Open"]}):null]}),e.jsx("div",{className:"px-4 pb-3",children:e.jsx(oe,{orgSlug:s,viewKey:t.key,scope:i,params:gt,onParamsChange:vt,contentHash:t.content_hash,title:t.name,minHeight:64,displayMode:"inline",maxHeight:ft,onRequestDisplayMode:o?r=>{r==="fullscreen"&&o()}:void 0})})]})}function yt({recordUrl:t,dirty:s,onDiscard:n}){const i=rt({disabled:!s,enableBeforeUnload:s,withResolver:!0,shouldBlockFn:({next:c})=>c.pathname!==t&&!c.pathname.startsWith(`${t}${ne("")}`)}),a=i.status==="blocked";return e.jsx(Ee,{open:a,onOpenChange:c=>{!c&&a&&i.reset()},children:e.jsxs(De,{className:"max-w-sm",children:[e.jsxs(Ce,{children:[e.jsx(Le,{children:"Discard unsaved changes?"}),e.jsx(Pe,{children:"This record has edits that are not saved. Leaving discards them."})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(N,{type:"button",variant:"ghost",onClick:()=>a&&i.reset(),children:"Keep editing"}),e.jsx(N,{type:"button",variant:"destructive",onClick:()=>{a&&(n(),i.proceed())},children:"Discard"})]})]})})}const se=6;function bt({entity:t,ownerSlug:s,orgContext:n,recordUrl:i,schema:a,entityTypeName:c,isTypeLoading:o,record:r,canEdit:m,editing:x,onEditingChange:p,outcome:f,onSaved:l,formId:h,fieldLimit:d,onDeleted:u}){const b=x&&m,j=H(),g={entity:{id:t.id,name:t.name,entity_type:t.entity_type},ownerSlug:s,orgContext:n,schema:a,record:r,editing:b};nt(g);const _=j?.item?.recordField,D={ownerSlug:s,orgContext:n,controls:t.field_controls,dirtyKeys:r.dirtyKeys,openField:j?C=>j.open(Qe(g,C.key)):void 0,openFieldKey:_?.entityId===t.id?_.field:void 0},R=e.jsx(yt,{recordUrl:i,dirty:b&&r.isDirty,onDiscard:()=>{r.reset(),p(!1)}});if(o)return e.jsx(Fe,{rows:6});if(b)return e.jsxs(e.Fragment,{children:[R,e.jsx(kt,{formId:h,entity:t,entityTypeName:c,schema:a,record:r,orgContext:n,renderControl:(C,F,E)=>st(F)?e.jsx(at,{field:{key:C,prop:F},value:E,context:D}):void 0,onSaved:l,onDeleted:u,onDone:()=>p(!1)})]});const w=W(r.revision);return e.jsxs("div",{className:"space-y-3",children:[e.jsx(de,{outcome:f,schema:a}),e.jsx(le,{fields:d===void 0?w:w.slice(0,d),values:r.values.metadata,context:D})]})}function kt({formId:t,entity:s,entityTypeName:n,schema:i,record:a,orgContext:c,renderControl:o,onSaved:r,onDeleted:m,onDone:x}){const p=Be(),f=s.field_controls,{name:l,slug:h,metadata:d}=a.values,u=v=>a.setValues(y=>({...y,name:v})),b=v=>a.setValues(y=>({...y,slug:v})),j=v=>a.setValues(y=>({...y,metadata:v})),[g,_]=L(s.id,""),[D,R]=L(s.id,null),[w,C]=L(s.id,null),[F,E]=L(s.id,!1),[V,T]=L(s.id,null),O=a.dirtyKeys.length>0,P=async v=>{if(v.preventDefault(),!!a.canSubmit){if(R(null),!l.trim()){R("Name is required");return}try{const y=await a.save({note:g});C(y),r(y),_(""),y?.held.length||x()}catch(y){R(y instanceof Error?y.message:"Failed to update entity")}}},B=async()=>{T(null);try{await p.mutateAsync({entityId:s.id}),E(!1),m?.()}catch(v){T(v instanceof Error?v.message:"Failed to delete entity")}},A=[s.total_content>0&&`${s.total_content} content item${s.total_content===1?"":"s"}`,s.automations_count>0&&`${s.automations_count} Automation${s.automations_count===1?"":"s"}`,s.active_connections>0&&`${s.active_connections} connector${s.active_connections===1?"":"s"}`].filter(Boolean).join(", ");return e.jsxs("form",{id:t,onSubmit:P,className:"space-y-4",children:[e.jsx(Ie,{visible:a.hasConflict,onReload:a.reset}),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(Z,{id:"sidebar-name",value:l,onChange:v=>u(v.target.value)})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(z,{htmlFor:"sidebar-slug",children:"URL Slug"}),e.jsx(Z,{id:"sidebar-slug",value:h,onChange:v=>b(v.target.value.toLowerCase().replace(/[^a-z0-9-]/g,""))})]}),a.revision&&Object.keys(a.revision).length>0&&e.jsxs(e.Fragment,{children:[e.jsx(qe,{}),e.jsx(We,{schema:a.revision,values:d,onValuesChange:j,fieldControls:f,orgContext:c,renderControl:o})]}),O&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx(z,{htmlFor:"sidebar-correction-note",children:"Correction note (optional)"}),e.jsx(Te,{id:"sidebar-correction-note",value:g,onChange:v=>_(v.target.value),placeholder:"Why are you changing these fields? Helps Automations respect the correction.",rows:2})]}),D&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:D}),e.jsx(de,{outcome:w,schema:i}),F?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(Ve,{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 "',s.name,'"?']}),A&&e.jsxs("p",{className:"text-muted-foreground",children:["Removes ",A,". This cannot be easily undone."]})]})]}),V&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-2.5 py-1.5 text-sm text-destructive",children:V}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:()=>{E(!1),T(null)},children:"Cancel"}),e.jsx(N,{type:"button",variant:"destructive",size:"sm",onClick:B,disabled:p.isPending,children:p.isPending?"Deleting...":`Delete ${n||"entity"}`})]})]}):e.jsx("div",{className:"pt-2",children:e.jsx(N,{type:"button",variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>E(!0),children:"Delete"})})]})}function ue(t,s){const n=new Set(t.measure_columns??[]),i=s?.properties??{};return Object.keys(t.metadata??{}).filter(a=>a!=="id"&&a!=="slug"&&a!=="name"&&i[a]?.const===void 0).map(a=>({key:a,prop:i[a]??{},label:i[a]?.["x-table-label"]??(n.has(a)?a:Re(a.replace(/_/g," "))),numeric:n.has(a)}))}function _t({entity:t,schema:s,ownerSlug:n,fieldLimit:i}){const a=ue(t,s);return e.jsxs("div",{children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Managed by the source"}),e.jsx(le,{fields:i===void 0?a:a.slice(0,i),values:t.metadata??{},context:{ownerSlug:n}})]})}const Nt=720,ae="owletto:record-details-expanded";function wt(){const[t,s]=S.useState(()=>{try{return window.localStorage.getItem(ae)==="1"}catch{return!1}});return[t,i=>{s(i);try{window.localStorage.setItem(ae,i?"1":"0")}catch{}}]}function St({schema:t,metadata:s}){const n=W(t).filter(({key:i,prop:a})=>a["x-table-column"]===!0&&!a["x-image"]&&s[i]!==void 0&&s[i]!==null&&s[i]!=="");return n.length===0?null:e.jsx("p",{"data-testid":"record-summary",className:"-mt-2 truncate text-sm text-muted-foreground tabular-nums",children:n.map(({key:i,prop:a},c)=>e.jsxs("span",{children:[c>0?" · ":null,e.jsx(Ge,{value:s[i],prop:a})]},i))})}function Rt({namespace:t,entity:s,recordUrl:n,viewKey:i,title:a,onDeleted:c}){const o=ye({strict:!1}),r=ie(),m=S.useRef(null),x=be(m,Nt),[p,f]=wt(),[l,h]=L(s.id,!1),d={slug:t.slug,organizationId:t.id},u=ke(d),{data:b,isLoading:j}=re(s.entity_type,d),g=b?.metadata_schema,{isAdmin:_,isLoading:D}=_e(d.organizationId),R=_&&!D&&!s.is_derived,w=dt({entity:s,schema:g,orgContext:d}),[C,F]=L(s.id,null),E=`record-form-${s.id}`,V=l&&R,T=u.data??[],O=Ne(T,{type:s.entity_type,id:s.id}),P=we(O,i),B=!i&&o.tab==="relationships",A=k=>void r({to:".",search:k,replace:!0}),v={type:s.entity_type,entity:s.is_derived?s.slug:s.id},y=x&&!p&&!l&&!B,G=s.is_derived?ue(s,g).length:W(g).length,Q=y?se:void 0,q=e.jsxs("div",{className:"space-y-6",children:[s.is_derived?e.jsxs(e.Fragment,{children:[e.jsx(_t,{entity:s,schema:g,ownerSlug:t.slug,fieldLimit:Q}),e.jsx(xt,{record:{type:s.entity_type,key:s.slug},ownerSlug:t.slug,orgContext:d,focus:B})]}):e.jsxs(e.Fragment,{children:[e.jsx(bt,{entity:s,ownerSlug:t.slug,orgContext:d,recordUrl:n,schema:g,entityTypeName:b?.name,isTypeLoading:j,record:w,canEdit:R,editing:l,onEditingChange:h,outcome:C,onSaved:F,formId:E,fieldLimit:Q,onDeleted:c}),e.jsx(ht,{entityId:s.id,entityName:s.name,ownerSlug:t.slug,orgContext:d,focus:B,collapsed:y})]}),x&&!l&&!B?e.jsx(N,{type:"button",variant:"ghost",size:"sm",className:"h-8 px-2 text-primary hover:text-primary","aria-expanded":!y,onClick:()=>f(y),children:y?G>se?`Show all ${G} fields`:"Show all details":"Show fewer"}):null]}),me=k=>e.jsx("div",{ref:m,className:"min-w-0 space-y-4",children:x?e.jsxs(e.Fragment,{children:[e.jsx(St,{schema:g,metadata:s.metadata??{}}),e.jsx("section",{"aria-label":"Details","data-testid":"record-details",children:q}),k]}):e.jsxs("div",{className:"grid grid-cols-[18rem_minmax(0,1fr)] gap-6",children:[e.jsx("aside",{className:"sticky top-12 max-h-[calc(100dvh-7rem)] min-w-0 self-start overflow-y-auto overscroll-contain pr-2 pb-16",children:q}),k]})}),he=V?e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:()=>{w.reset(),F(null),h(!1)},children:"Cancel"}),e.jsx(N,{type:"submit",form:E,size:"sm",disabled:!w.canSubmit||!w.isDirty||w.saving||!w.values.name.trim(),children:w.saving?"Saving...":"Save"})]}):R&&!j?e.jsxs(N,{type:"button",variant:"ghost",size:"sm",className:"h-8 shrink-0 gap-1.5 px-2 text-muted-foreground hover:text-foreground",onClick:()=>{F(null),h(!0)},children:[e.jsx(Se,{className:"h-3.5 w-3.5"}),"Edit"]}):null,M=k=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"record-header",className:"sticky top-0 z-30 -mx-4 flex h-12 items-center justify-between gap-3 bg-background px-4 lg:-mx-6 lg:px-6",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-2",children:a}),he]}),k]});if(i&&u.data===void 0)return M(u.isError?e.jsx(ee,{onRetry:()=>void u.refetch()}):null);if(P.kind==="missing")return M(e.jsx(Ye,{viewKey:P.key,backTo:n,backLabel:`Back to ${s.name}`}));if(P.kind==="view"){const{view:k}=P;return M(e.jsxs("div",{className:"min-w-0 space-y-3",children:[e.jsx(Je,{decls:k.params,params:J(o),onParamsChange:xe=>void r({to:".",search:xe})}),e.jsx(oe,{orgSlug:t.slug,viewKey:k.key,scope:v,params:J(o),onParamsChange:A,contentHash:k.content_hash,title:k.name,minHeight:320})]}))}return M(me(e.jsxs("div",{className:"min-w-0 space-y-4",children:[u.isError&&e.jsx(ee,{onRetry:()=>void u.refetch()}),O.map(k=>e.jsx(jt,{view:k,orgSlug:t.slug,recordUrl:n,scope:v},k.key)),e.jsxs("section",{"aria-labelledby":"record-activity-heading",className:"min-w-0",children:[e.jsx("h2",{id:"record-activity-heading",className:"mb-2 text-sm font-medium text-muted-foreground",children:"Activity"}),e.jsx(Ue,{entity:s,organizationId:t.id,ownerSlug:t.slug})]})]})))}function Ft(t){return t?.trim()?t:void 0}function Gt({namespace:t,path:s,entity:n,viewKey:i}){const a=ie(),{data:c}=re(n.entity_type,{slug:t.slug}),o=Ft(c?.icon),r=s.map(l=>({entity_type:l.entity_type,slug:l.slug})),m=`/${t.slug}/${Oe(n.entity_type)}`,x=U(t.slug,r),p=s.length>1?U(t.slug,r.slice(0,-1)):m,f=Ae().session?.user.id;return S.useEffect(()=>{f&&Me(f,t.slug,{id:n.id,name:n.name,entityType:n.entity_type,url:x})},[f,t.slug,n.id,n.name,n.entity_type,x]),e.jsxs("div",{className:"mx-auto flex min-h-0 w-full max-w-7xl flex-1 flex-col gap-4 px-4 pt-2.5 pb-8 lg:px-6",children:[e.jsx("div",{children:e.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:e.jsx(N,{asChild:!0,variant:"ghost",size:"sm",className:"-ml-2 h-7 w-fit px-2 text-muted-foreground hover:text-foreground",children:e.jsxs($e,{to:p,children:[e.jsx(ze,{className:"mr-1 h-4 w-4"}),"Back"]})})})}),e.jsx(Rt,{namespace:t,entity:n,recordUrl:x,viewKey:i,title:e.jsxs(e.Fragment,{children:[e.jsx(Xe,{metadata:n.metadata,metadataSchema:c?.metadata_schema,name:n.name,typeIcon:o,className:"h-6 w-6 shrink-0"}),e.jsx("h2",{className:"truncate text-lg font-semibold leading-tight",children:n.name})]}),onDeleted:()=>{const l=s.slice(0,-1);l.length>0?a({to:U(t.slug,l)}):a({to:m})}})]})}export{Gt as EntityPage};
|
|
2
|
+
//# sourceMappingURL=entity-page--OkXmlNP.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as e,P as $,n as W,eN as me,eW as xe,eQ as K,bz as ae,r as x,eO as he,eP as pe,dr as ge,dt as fe,B as f,cT as U,ds as je,z as C,bp as q,bq as P,br as M,bs as I,bt as R,I as T,a2 as ve,eZ as Ne,fI as ye,fJ as be,X as H,d$ as ne,dF as re,T as we,a$ as le,fK as ie,fL as Se,b8 as oe,fM as Ce,fp as ke,bQ as Ee,bR as Y,bU as _e,fN as Re,bA as Te,fO as Oe,fP as De,Q as Z}from"./index-DYCqXaMf.js";import{J}from"./json-diff-DFvYINBT.js";import{C as ce}from"./code-editor-U54Gwjit.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(J,{before:s.before_payload,after:s.after_payload}),s.action==="create"&&s.after_payload&&e.jsx(J,{before:null,after:s.after_payload}),s.action==="delete"&&s.before_payload&&e.jsx(J,{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!==K),d=i.filter(m=>m.purpose===K),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(B,{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(B,{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(B,{entityTypeSlug:s.slug,relationshipTypes:h,allEntityTypes:r||[],readOnly:!0})]}),e.jsx(Le,{entityTypeSlug:s.slug,relationshipTypes:o,allEntityTypes:r||[]})]})})}function B({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(""),[S,N]=x.useState(""),[y,b]=x.useState("source"),[g,j]=x.useState(""),[k,E]=x.useState(""),[D,w]=x.useState(!1),[A,_]=x.useState(null),u=he(),p=pe(),v=()=>{d("existing"),m(""),N(""),b("source"),j(""),E(""),w(!1),_(null)},O=l=>{i(l),l||v()},F=l=>l.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,""),V=async()=>{_(null);try{let l=h;if(o==="new"){if(!g.trim()){_("Name is required");return}const Q=k.trim()||F(g);if(!Q){_("Slug is required");return}l=(await u.mutateAsync({slug:Q,name:g.trim(),is_symmetric:D})).relationship_type.slug}if(!l){_("Select a relationship type");return}if(!S){_("Select a target entity type");return}const L=y==="source"?s:S,ue=y==="source"?S: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(U,{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=>w(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:S,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:V,disabled:z,children:z?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"mr-1.5"}),"Saving..."]}):"Add Rule"})]})})]})}function Ue({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(U,{className:"h-3 w-3"})})]})]})}const Ve=[{value:"string",label:"String"},{value:"number",label:"Number"},{value:"integer",label:"Integer"},{value:"boolean",label:"Boolean"},{value:"enum",label:"Enum"}];function Je({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(U,{className:"h-3 w-3"})})]})]})}function Be({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:Ve.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(we,{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(Ue,{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(Je,{examples:s.examples||[],onChange:t=>a({...s,examples:t.length>0?t:void 0})})})]})]})]})}function G({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 X(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(""),[S,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)),X(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)),X(p)?(i(ee(p)),b(!1)):b(!0),a(p)}catch(p){N(p instanceof Error?p.message:"Invalid JSON")}},[a]),w=()=>{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(G,{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(Se,{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(Be,{field:u,onChange:v=>A(p,v),onDelete:()=>_(p)},u.id)),e.jsxs(f,{type:"button",variant:"outline",size:"sm",onClick:w,className:"w-full",children:[e.jsx(U,{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(G,{value:h,onChange:D,error:S})]})}function He(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Qe({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,S]=o.field("slug"),[N,y]=o.field("description"),[b,g]=o.field("icon"),[j,k]=o.field("color"),[E,D]=o.field("metadataSchema"),[w,A]=o.field("backingSql"),[_,u]=Y(i,n),[p,v]=Y(i,null),O=w.trim().length>0,F=l=>{h(l),!n&&!_&&S(He(l))},V=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:w.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),S(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:w,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:V,disabled:z,children:z?"Saving...":n?"Update":"Create"})})]})}function Xe({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,S]=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){S(null);try{await N.mutateAsync(s.slug),a()}catch(w){S(w instanceof Error?w.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:Z("space-y-1.5",!t&&!r&&"text-center"),children:[e.jsx("h1",{className:Z("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(Qe,{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(w=>e.jsx(qe,{entry:w},w.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),S(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{Xe as E};
|
|
2
|
+
//# sourceMappingURL=entity-type-page-89RoK_-P.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as q,U as I,r as D,g7 as J,fS as Q,j as s,b$ as M,L as W}from"./index-DYCqXaMf.js";import{u as X,E as Y}from"./events-feed-DsrkV2ix.js";import{b as Z,a as z,V as K,M as ee}from"./view-param-filters-DMSqkN2J.js";const se={},te="calc(100dvh - 120px)";function ie({owner:n,organizationId:o,eventId:c,viewKey:r,params:g,onParamsChange:d,onSelectView:p,dense:h=!1,fullBleed:k=!1}){const{isAuthenticated:y,isReady:E}=q(),{data:U,isLoading:w}=I(),O=U?.some(t=>t.id===o&&t.is_member),i=n!=="me"&&o!==null&&E&&y&&!w&&O,a=X(i?{slug:n,organizationId:o}:null,c),[j,b]=D.useState(se),[P,L]=D.useState(null),m=J(a.views,r),e=i&&!a.isLoading&&!a.isError&&m.kind==="view"?m.view:null,v=e?`${Q(n,e.key)}/${e.content_hash}/${e.eventId}`:null,x=e!==null&&P===v,V=M(n,c),F=n!=="me"&&(!E||y&&(w||a.isLoading)),H=e!==null&&!x&&!F,u=k&&H,T=(k||h)&&H,N=F?s.jsx("div",{role:"status",className:"py-8 text-sm text-muted-foreground",children:"Loading event view…"}):e&&!x?s.jsxs(s.Fragment,{children:[s.jsx(Z,{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:h?240:320,fixedHeight:T?te:void 0},v)]}):void 0;return s.jsxs("div",{className:u?"w-full space-y-3":"mx-auto w-full max-w-3xl space-y-3",...u?{"data-testid":"event-view-fullbleed"}:{},children:[i&&a.isError&&s.jsx(K,{onRetry:a.refetch}),(i||n==="me"&&r)&&!a.isLoading&&!a.isError&&m.kind==="missing"&&s.jsx(ee,{viewKey:m.key,backTo:V,backLabel:"Back to the event"}),x&&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(Y,{presentation:"detail",organizationId:o,ownerSlug:n,filters:{contentIds:[c],...n==="me"?{sortBy:"date",sortOrder:"desc"}:{}},hideDetails:h,renderDetail:t=>{const f=N!=null&&(t==null||!!r),S=(i?a.views:[]).filter(l=>!f||l.key!==e?.key).map(l=>({key:l.key,name:l.name,href:M(n,c,l.key)})),A=l=>l.length?s.jsx("nav",{"aria-label":"Event views",className:"flex flex-wrap gap-3 text-sm",children:l.map(({key:R,name:C,href:B})=>s.jsx(W,{to:B,className:"underline",onClick:p?G=>{G.preventDefault(),p(B)}:void 0,children:C},R))}):null,$=[...S],_=[...S];return i&&r&&t!=null&&_.unshift({key:":event",name:"Event details",href:V}),{content:f?N:t,nativeHeading:!f&&t!=null,headingAside:u?A($):void 0,links:u?null:A(_)}}})]})}export{ie as E};
|
|
2
|
+
//# sourceMappingURL=event-detail-D4YZRtrA.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as e,L as le,dF as Qt,dG as Ye,cy as Wt,by as Gt,g as gt,r as N,dH as yt,dI as Xt,W as Yt,J as Zt,dD as en,dh as tn,Q as ue,dJ as nn,dK as jt,dL as vt,dM as sn,dN as bt,cM as rn,dO as an,cA as on,o as Nt,u as Ze,dP as et,dQ as _t,S as Pe,B as E,A as ln,dR as dn,dS as Je,dT as wt,b7 as kt,dU as cn,dV as un,cN as mn,dW as Ct,dX as pn,ck as xn,dY as Ae,dZ as hn,d_ as Ne,d$ as _e,P as ce,e0 as St,e1 as tt,e2 as It,dr as fn,dt as gn,ds as yn,cz as At,e3 as jn,n as Rt,bJ as it,b$ as ot,$ as vn,e4 as bn,e5 as Nn,cm as _n,e6 as wn,e7 as Et,e8 as kn,e9 as Cn,a2 as Re,ea as Sn,eb as In,bQ as An,ec as Rn,bU as En,ed as Tn,dy as $n,ee as Pn,X as Fn,bk as Tt,ef as De,eg as Le,eh as Me,d1 as Fe,d8 as On,aR as Dn,di as Ln,i as Mn,bh as Bn,cg as zn,d6 as Un,db as Vn,dc as Hn,ei as qn,ej as Kn,ek as Jn,el as Qn,em as Wn,bM as Gn,en as Xn,eo as He,bd as lt,aj as Yn}from"./index-DYCqXaMf.js";import{c as Zn}from"./conversations-table-BSznfdYt.js";import{u as es}from"./clients-L4K1UT8c.js";import{J as ts,g as ns,c as ss,a as rs,F as as,S as nt,e as is,n as os}from"./schema-value-normalization-CylKX3PK.js";function ls(t,n){const s=n.parentEntityType&&n.parentEntitySlug?[{entity_type:n.parentEntityType,slug:n.parentEntitySlug},{entity_type:n.entityType,slug:n.entitySlug}]:[{entity_type:n.entityType,slug:n.entitySlug}];return Ye(t,s)}function ds({ownerSlug:t,entity:n,className:s}){const r=ls(t,n);return e.jsxs(le,{to:r,className:`flex items-center gap-1 text-primary hover:underline group ${s??""}`,children:[e.jsx("span",{className:"font-medium",children:n.entityName}),e.jsx(Qt,{className:"h-3 w-3 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function $t(t){const n=Array.isArray(t?.records)?t.records:Array.isArray(t?.current)?t.current:[];return[t?.from_entity_id??t?.entity_id,t?.to_entity_id].map(s=>{const a=n.find(i=>i&&typeof i=="object"&&"id"in i&&i.id===s);return{id:String(s??"unknown"),name:typeof a?.name=="string"?a.name:`Record ${String(s??"unknown")}`}})}function Pt(t,n){return n==="rejected"?"The proposed relationship change was rejected. Both records remain available.":n==="failed"?"The relationship change failed. Both records remain available.":n==="completed"?t==="link"?"The records were linked. Both records remain available.":"The relationship was removed. Both records remain available.":n==="approved"||n==="confirmed"?"The relationship change was approved. Both records remain available.":t==="link"?"If approved, these records will be linked. Both records remain available.":"If approved, this relationship will be removed. Both records remain available."}function br(t){const n=$t(t.proposal);return{title:t.action==="link"?"Link records":"Unlink records",icon:"entity",impact:{level:"normal"},tone:"default",blocks:[...n.map((s,r)=>({type:"text",label:r===0?"From":"To",value:s.name})),{type:"text",label:"Relationship",value:String(t.proposal?.relationship_type??t.proposal?.relationship_type_slug??"Relationship")},{type:"text",value:Pt(t.action,typeof t.status=="string"?t.status:void 0),muted:!0},...typeof t.reason=="string"&&t.reason?[{type:"text",label:"Why this needs approval",value:t.reason}]:[]],actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",confirm:t.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 Ft(t,n,s){return{queryKey:["event-view-match",t,n.key,n.content_hash,s],queryFn:async()=>{try{const a=(await Wt("open_view",{key:n.key,scope:{event:s}},{slug:t})).scope?.event;if(!Number.isSafeInteger(a)||(a??0)<1)throw new Error("The view did not resolve its event subject");return a}catch(r){if(r instanceof Gt&&(r.status===400||r.status===404))return null;throw r}},staleTime:6e4}}function Nr(t,n){const s=gt(t??{slug:null,organizationId:null}),r=t?.slug??null,a=N.useMemo(()=>r?yt(s.data??[]):[],[r,s.data]),i=Xt({queries:a.map(l=>Ft(r,l,n))});return r?{views:a.flatMap((l,m)=>{const o=i[m]?.data;return o?[{...l,eventId:o}]:[]}),isLoading:s.data===void 0?!s.isError:i.some(l=>l.isPending),isError:s.isError||i.some(l=>l.isError),refetch:()=>{s.refetch();for(const l of i)l.isError&&l.refetch()}}:{views:[],isLoading:!1,isError:!1,refetch:()=>{}}}async function cs(t,n,s,r){const a=await Promise.all(s.map(i=>t.fetchQuery(Ft(n,i,r))));return s.find((i,l)=>a[l])??null}async function us(t,n,s,r){const a=await Yt(`${Zt}/api/${encodeURIComponent(t)}/events/${n}/actions/${encodeURIComponent(s.action)}`,{method:"POST",timeoutMs:9e4,credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:s.value,interaction_id:r})});return await en(a,"Could not record interaction"),a.json()}function U(t){if(typeof t!="string")return;const n=t.trim();return n.length>0?n:void 0}function qe(t){return typeof t=="boolean"?t:void 0}function ms(t,n,s){const r=(s??"").toLowerCase();return!!(r==="prepare_comment"||r==="verify_staged_comment"||r.includes("prepare_")||r.includes("verify_staged")||n?.prepared===!0||typeof n?.verified=="boolean"||U(n?.reason_preview)&&U(n?.message)||U(t?.body)&&(U(t?.post_url)||U(t?.activity_id)))}function ps(t,n,s){if(!ms(t,n,s))return null;const r=(s??"").toLowerCase(),a=U(n?.body)??U(t?.body),i=U(n?.reason_preview)??U(t?.reason),l=U(n?.post_url)??U(t?.post_url)??(U(t?.activity_id)?`https://www.linkedin.com/feed/update/urn:li:activity:${U(t?.activity_id)}`:void 0),m=qe(n?.prepared),o=qe(n?.verified),c=qe(n?.banner_shown),p=U(n?.message),u=n?.match&&typeof n.match=="object"?n.match:null,h=U(u?.text_preview),v=U(u?.author);let I="generic";r==="verify_staged_comment"||r.includes("verify")||typeof o=="boolean"?I="verify":(r==="prepare_comment"||r.includes("prepare")||m===!0||a&&l)&&(I="prepare");const _=[];return m===!0&&_.push("Staged — not posted"),m===!1&&_.push("Not staged"),o===!0&&_.push("Verified posted"),o===!1&&_.push("Not verified as posted"),c===!0&&_.push("In-page banner"),c===!1&&_.push("No banner"),{kind:I,message:p,reason:i,body:a,postUrl:l,prepared:m,bannerShown:c,verified:o,matchPreview:h,matchAuthor:v,chips:_}}function Se(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function xs({template:t,data:n,onAction:s}){const[r,a]=N.useState(null),[i,l]=N.useState(!1),[m,o]=N.useState(null),[c,p]=N.useState(!1),u=N.useRef(!1),h=N.useRef(!0);N.useEffect(()=>(h.current=!0,()=>{h.current=!1}),[]);const v=async I=>{if(!(!s||u.current)){u.current=!0,l(!0),o(null),p(!1);try{const _=await s(I);if(!h.current)return;if(Se(_)&&_.kind==="sdk"){const j=_.result;if(!Se(j)||j.success!==!0){const w=Se(j)&&Se(j.error)?j.error.message:null;throw new Error(typeof w=="string"?w:"Could not update this event.")}if(j.return_truncated||!Se(j.return_value))throw new Error("The update did not return a complete data object.");a(j.return_value),p(!0)}}catch(_){h.current&&o(_ instanceof Error?_.message:"Could not update this event.")}finally{u.current=!1,h.current&&l(!1)}}};return e.jsxs("div",{className:"space-y-2",children:[i?e.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"Updating…"}):null,c?e.jsx("p",{role:"status",className:"sr-only",children:"Updated"}):null,m?e.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:[m," Previous data is still shown."]}):null,e.jsx("fieldset",{disabled:!s||i,"aria-busy":i,className:"min-w-0",children:e.jsx(ts,{template:{root:t.root},data:r??n,onAction:s?v:void 0,interactions:t.interactions})})]})}function hs(t){return t.type==="array"&&!!t.items&&(t.items?.type==="object"||!!t.items?.properties)}function fs(t){return(t.type==="object"||!!t.properties)&&Object.keys(t.properties??{}).length>0}function gs(t){const n=t?.properties??{};return Object.entries(n).filter(([,s])=>!("x-measure"in s)&&!("x-dimension"in s)).map(([s,r])=>({key:s,prop:r}))}function Be(t){return t.label??t.prop["x-table-label"]??ns(t.key,t.prop)}function ys(t){try{return ss(t)}catch{return t instanceof nn?t.text:t}}function dt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function js({value:t,prop:n,ownerSlug:s,orgContext:r}){const a=n["x-link-entity-type"],i=n["x-link-lookup-field"]||"slug",{data:l}=rn(a,r,{limit:an}),m=o=>{const c=l?.entities.find(p=>{const u=i==="slug"?p.slug:p.metadata?.[i];return u!=null&&String(u)===o});return c?{label:c.name,to:on(s,is(c))}:void 0};return e.jsx(nt,{value:t,prop:n,resolveLink:m})}function vs({field:t,value:n,context:s}){if(hs(t.prop)&&(n==null||Array.isArray(n))){const r=Array.isArray(n)?n.length:0,a=`${r} ${r===1?"item":"items"}`,i=s.dirtyKeys?.includes(t.key)??!1,l="inline-flex items-center gap-1 rounded-md bg-muted px-1.5 py-0.5 text-xs tabular-nums";if(!s.openField)return e.jsx("span",{className:l,children:a});const m=s.openFieldKey===t.key;return e.jsxs("button",{type:"button","aria-pressed":m,"aria-label":`${Be(t)}: ${a}${i?", unsaved changes":""}`,className:ue(l,"hover:bg-muted/70 hover:text-foreground",m&&"ring-1 ring-primary"),onClick:()=>s.openField?.(t),children:[a,i?e.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"· edited"}):null]})}return t.prop["x-link-entity-type"]&&s.orgContext&&n!=null?e.jsx(js,{value:n,prop:t.prop,ownerSlug:s.ownerSlug,orgContext:s.orgContext}):e.jsx(nt,{value:n,prop:t.prop})}function ct({field:t,control:n,labelId:s}){const r=rs(t.prop);return e.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-1 gap-y-0.5",children:[e.jsx("span",{id:s,className:"min-w-0 break-words",children:Be(t)}),r?e.jsxs(jt,{children:[e.jsx(vt,{asChild:!0,children:e.jsx("button",{type:"button",className:"shrink-0 text-muted-foreground/70 hover:text-foreground","aria-label":`About ${Be(t)}: ${r}`,children:e.jsx(sn,{className:"h-3 w-3"})})}),e.jsx(bt,{className:"max-w-xs",children:r})]}):null,n?e.jsx(as,{control:n}):null]})}function Ot({field:t,value:n,context:s,nested:r}){const a=N.useId(),i=r?void 0:s.controls?.[t.key],l=ys(n);if(fs(t.prop)&&(l==null||dt(l))){const m=Object.entries(t.prop.properties??{}).map(([c,p])=>({key:c,prop:p})),o=dt(l)?l:{};return e.jsxs("fieldset",{"aria-labelledby":a,className:"m-0 min-w-0 space-y-2 border-0 p-0",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:e.jsx(ct,{field:t,control:i,labelId:a})}),e.jsx("dl",{className:"space-y-2 border-l border-border pl-3",children:m.map(c=>e.jsx(Ot,{field:c,value:o[c.key],context:s,nested:!0},c.key))})]})}return e.jsxs("div",{className:"grid grid-cols-[minmax(0,2fr)_minmax(0,3fr)] items-baseline gap-x-3",children:[e.jsx("dt",{className:"text-muted-foreground",children:e.jsx(ct,{field:t,control:i,labelId:a})}),e.jsx("dd",{"aria-labelledby":a,className:ue("min-w-0 [overflow-wrap:anywhere]",t.numeric&&"tabular-nums"),children:e.jsx(vs,{field:t,value:l,context:s})})]})}function bs({fields:t,values:n,context:s}){return t.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"This type declares no fields."}):e.jsx(tn,{delayDuration:200,children:e.jsx("dl",{className:"space-y-2.5 text-sm leading-5",children:t.map(r=>e.jsx(Ot,{field:r,value:n[r.key],context:s,nested:!1},r.key))})})}function Ns(t){return{href:"",key:`record-peer:${t.entityId}`,title:t.name?.trim()||"Record",recordPeer:{entityId:t.entityId,ownerSlug:t.ownerSlug,orgContext:t.orgContext}}}function _r({target:t}){const n=Nt(),s=Ze(),{data:r,isLoading:a,isError:i}=et(t.entityId,t.orgContext),{data:l}=_t(r?.entity_type??"",t.orgContext),[m,o]=N.useState(!1),[c,p]=N.useState(!1);if(a)return e.jsxs("div",{className:"space-y-3 px-5 py-5",children:[e.jsx(Pe,{className:"h-5 w-2/3"}),e.jsx(Pe,{className:"h-4 w-full"}),e.jsx(Pe,{className:"h-4 w-full"})]});if(i||!r)return e.jsx("p",{className:"px-5 py-5 text-sm text-muted-foreground",children:"This record is not available. It may have been deleted, or you may not have access to it."});const u=l?.metadata_schema,h=async()=>{o(!0),p(!1);try{const v=await dn(r.id,t.orgContext);s?.close(),await n({to:Ye(t.ownerSlug,v)})}catch{p(!0)}finally{o(!1)}};return e.jsxs("article",{className:"space-y-4 px-5 py-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:r.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l?.name??r.entity_type})]}),e.jsxs(E,{type:"button",variant:"ghost",size:"sm",className:"h-7 shrink-0 gap-1 px-2 text-muted-foreground hover:text-foreground",disabled:m,"aria-busy":m,onClick:()=>void h(),children:["Open record",e.jsx(ln,{className:"h-3.5 w-3.5"})]})]}),c?e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"Could not open this record. Try again."}):null,e.jsx(bs,{fields:gs(u),values:os(r.metadata??{},u),context:{ownerSlug:t.ownerSlug,orgContext:t.orgContext}})]})}function _s(t,n){const s=t.from_entity_id===n;return{id:s?t.to_entity_id:t.from_entity_id,name:s?t.to_entity_name:t.from_entity_name,type:s?t.to_entity_type:t.from_entity_type,self:t.from_entity_id===t.to_entity_id}}const ut="inline-flex max-w-full items-center truncate rounded-md border border-border px-1.5 py-0.5 text-xs";function Qe({peer:t,ownerSlug:n,orgContext:s}){const r=Ze();if(t.self||!t.type||!r)return e.jsx("span",{className:ue(ut,"text-muted-foreground"),children:t.name});const a=r.item?.recordPeer?.entityId===t.id;return e.jsx("button",{type:"button","aria-pressed":a,title:t.type,className:ue(ut,"hover:bg-muted",a&&"ring-1 ring-primary"),onClick:i=>{i.stopPropagation(),r.open(Ns({entityId:t.id,ownerSlug:n,orgContext:s,name:t.name}))},children:e.jsx("span",{className:"truncate",children:t.name})})}function wr({row:t,entityId:n,ownerSlug:s,orgContext:r}){const a=_s(t,n);return e.jsx(Qe,{peer:{id:a.id,type:a.type,self:a.self,name:a.self?"this record":a.name??`Record #${a.id}`},ownerSlug:s,orgContext:r})}const Dt={name:"Name",slug:"URL slug",parent_id:"Parent",content:"Content changed"};function be(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Te(t){return t==null||t===""}function ws(t,n){return Je(t??null)===Je(n??null)}function ks(t){return!!(t?.type==="array"&&(t.items?.type==="object"||t.items?.properties))}function Cs(t){return!!(t&&(t.type==="object"||t.properties)&&t.type!=="array")}function st(t,n){return Be({key:t,prop:n??{}})}function Ss(t,n){return t?.properties?.[n]}function We(t,n,s,r,a){if(ws(n,s))return;const i=o=>Array.isArray(o)?o:[];if((Array.isArray(n)||Te(n))&&(Array.isArray(s)||Te(s))&&(Array.isArray(n)||Array.isArray(s)||r?.type==="array")){const o=i(n),c=i(s);if(ks(r)||[...o,...c].some(j=>be(j))){const j=Math.min(o.length,c.length);for(let P=0;P<j;P++)We([...t,`item ${P+1}`],o[P],c[P],r?.items,a);const w=Math.max(0,c.length-o.length),K=Math.max(0,o.length-c.length);(w||K)&&a.push({kind:"items",path:t,added:w,removed:K});return}const u=j=>Je(j),h=new Set(o.map(u)),v=new Set(c.map(u)),I=c.filter(j=>!h.has(u(j))),_=o.filter(j=>!v.has(u(j)));a.push(I.length||_.length?{kind:"values",path:t,added:I,removed:_,prop:r?.items}:{kind:"reordered",path:t});return}if((be(n)||Te(n))&&(be(s)||Te(s))&&(be(n)||be(s)||Cs(r))){const o=be(n)?n:{},c=be(s)?s:{},p=[...new Set([...Object.keys(r?.properties??{}),...Object.keys(o),...Object.keys(c)])];for(const u of p){const h=Ss(r,u);We([...t,st(u,h)],o[u],c[u],h,a)}return}a.push({kind:"set",path:t,old:n,new:s,prop:r})}function Is(t,n){const s=Dt[t.field];if(s)return t.field==="content"?[{kind:"note",path:[s]}]:t.field==="parent_id"?[{kind:"parent",path:[s],old:t.old,new:t.new}]:[{kind:"set",path:[s],old:t.old,new:t.new}];const r=n?.properties?.[t.field],a=[];return We([st(t.field,r)],t.old,t.new,r,a),a}function As(t,n){const s=n?.properties;return t.map(r=>r.field==="content"?"Content":Dt[r.field]??st(r.field,s?.[r.field]))}const Rs="entity.updated",Es=new Set(["link","unlink","update_link"]);function mt(t){const n=typeof t=="string"||typeof t=="number"?Number(t):Number.NaN;return Number.isSafeInteger(n)&&n>0?n:null}function Ts(t){const n=t.split("_").join(" ").trim();return n?`${n.charAt(0).toUpperCase()}${n.slice(1)}`:t}function $s(t){const n=t.metadata;if(t.semantic_type!=="change"||!n||n._lobu_relationship_change!==!0||typeof n.op!="string"||!Es.has(n.op))return null;const s=mt(n.fromEntityId),r=mt(n.toEntityId);if(s==null||r==null)return null;const a=typeof n.relationshipTypeSlug=="string"?n.relationshipTypeSlug:null,i=Array.isArray(n.changes)?n.changes:[];return{op:n.op,fromId:s,toId:r,typeLabel:a?Ts(a):"relationship",changedFields:i.flatMap(l=>l&&typeof l=="object"&&typeof l.field=="string"?[l.field]:[])}}function Oe({id:t,recordId:n,ownerSlug:s}){const r=t===n,a={slug:s},{data:i,isLoading:l,isError:m}=et(r?void 0:t,a);return r?e.jsx(Qe,{peer:{id:t,name:"this record",type:null,self:!0},ownerSlug:s,orgContext:a}):l?e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Record #",t]}):m||!i?e.jsx("span",{className:"text-xs text-muted-foreground",title:"Deleted, or you do not have access to it",children:"Unavailable record"}):e.jsx(Qe,{peer:{id:t,name:i.name,type:i.entity_type},ownerSlug:s,orgContext:a})}function Ps({change:t,recordId:n,ownerSlug:s}){const r=t.op==="link"?`Linked as ${t.typeLabel}`:t.op==="unlink"?`Unlinked ${t.typeLabel}`:`Updated ${t.typeLabel} link`,a=n===t.toId&&n!==t.fromId,i=n===t.fromId;return e.jsxs("span",{"data-testid":"relationship-change",className:"inline-flex flex-wrap items-center gap-1.5",children:[!i&&!a?e.jsx(Oe,{id:t.fromId,ownerSlug:s}):null,e.jsx("span",{children:a?`${r} from`:r}),a?e.jsx(Oe,{id:t.fromId,recordId:n,ownerSlug:s}):e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"→"}),e.jsx(Oe,{id:t.toId,recordId:n,ownerSlug:s})]}),t.op==="update_link"&&t.changedFields.length>0?e.jsxs("span",{className:"text-xs text-muted-foreground",children:["· ",t.changedFields.join(", ")]}):null]})}function Fs(t){if(!Array.isArray(t)||t.length===0)return null;const n=[];for(const s of t){if(!s||typeof s!="object"||typeof s.field!="string")return null;const{field:r,old:a,new:i}=s;n.push({field:r,old:a??null,new:i??null})}return n}function Os(t){const n=$s(t);if(n)return{kind:"relationship",change:n};const s=t.metadata;if(t.semantic_type!=="change"||!s)return null;const r=s._lobu_event_type;if(r!==Rs&&(r!==void 0||s.category))return null;const a=Fs(s.changes);if(!a)return null;const i=t.entity_ids?.[0];return{kind:"fields",entityId:typeof i=="number"?i:null,changes:a}}function Lt(t,n){const s={slug:n},{data:r}=et(t.entityType?void 0:t.entityId??void 0,s),{data:a}=_t(t.entityType??r?.entity_type??"",s);return a?.metadata_schema}const Ds=4;function $e({value:t,prop:n}){return e.jsx("span",{className:"inline-block max-w-[18rem] truncate align-bottom",title:typeof t=="string"?t:void 0,children:e.jsx(nt,{value:t,prop:n,empty:e.jsx("span",{className:"italic",children:"empty"})})})}function pt({id:t,ownerSlug:n}){const s=typeof t=="number"||typeof t=="string"?Number(t):Number.NaN;return Number.isSafeInteger(s)&&s>0?e.jsx(Oe,{id:s,ownerSlug:n}):e.jsx("span",{className:"italic text-muted-foreground",children:"empty"})}function Ge(t,n){return`${t} ${n}${t===1?"":"s"}`}function Ls({line:t,ownerSlug:n}){const s=e.jsx("span",{className:"text-muted-foreground",children:t.path.join(" · ")});switch(t.kind){case"note":return s;case"set":return e.jsxs(e.Fragment,{children:[s,": ",e.jsx($e,{value:t.old,prop:t.prop})," ",e.jsx("span",{"aria-hidden":"true",children:"→"})," ",e.jsx($e,{value:t.new,prop:t.prop})]});case"parent":return e.jsxs(e.Fragment,{children:[s,": ",e.jsx(pt,{id:t.old,ownerSlug:n})," ",e.jsx("span",{"aria-hidden":"true",children:"→"})," ",e.jsx(pt,{id:t.new,ownerSlug:n})]});case"items":return e.jsxs(e.Fragment,{children:[s,":"," ",[t.added?`${Ge(t.added,"item")} added`:null,t.removed?`${Ge(t.removed,"item")} removed`:null].filter(Boolean).join(", ")]});case"values":return e.jsxs(e.Fragment,{children:[s,":",t.added.map((r,a)=>e.jsxs("span",{className:"ml-1.5",children:["+",e.jsx($e,{value:r,prop:t.prop})]},`+${a}`)),t.removed.map((r,a)=>e.jsxs("span",{className:"ml-1.5 text-muted-foreground",children:["−",e.jsx($e,{value:r,prop:t.prop})]},`-${a}`))]});case"reordered":return e.jsxs(e.Fragment,{children:[s,": reordered"]})}}function Ms({change:t,ownerSlug:n}){const s=Lt(t,n);return e.jsxs(e.Fragment,{children:["Updated ",As(t.changes,s).join(", ")]})}function rt({changes:t,entityId:n,entityType:s,ownerSlug:r,showAll:a=!1}){const i=Lt({entityId:n,entityType:s},r),[l,m]=N.useState(a),o=t.flatMap(u=>Is(u,i)),c=l?o:o.slice(0,Ds),p=o.length-c.length;return e.jsxs("ul",{"data-testid":"field-changes",className:"space-y-0.5 text-sm",children:[c.map((u,h)=>e.jsx("li",{className:"min-w-0 truncate",children:e.jsx(Ls,{line:u,ownerSlug:r})},h)),p>0?e.jsx("li",{children:e.jsxs("button",{type:"button",className:"text-xs text-primary hover:underline",onClick:u=>{u.stopPropagation(),m(!0)},children:["+",Ge(p,"more change")]})}):null]})}function Bs({event:t,recordId:n,ownerSlug:s}){return t.kind==="relationship"?e.jsx(Ps,{change:t.change,recordId:n,ownerSlug:s}):e.jsx(Ms,{change:t,ownerSlug:s})}function zs({event:t,ownerSlug:n}){return t.kind==="fields"?e.jsx(rt,{changes:t.changes,entityId:t.entityId,ownerSlug:n}):null}function Mt(t){return{audit:t.semantic_type==="audit"&&t.origin_type==="tool_invocation",operation:t.interaction_type==="approval"||t.semantic_type==="operation",changeSet:t.semantic_type==="change_set"}}const Us={};function me(t){return t.replace(/_/g," ").replace(/\s+/g," ").trim().replace(/^./,n=>n.toUpperCase())}const Vs={notification:"Notification",tool_invocation:"Action",deployment:"Deployment",config_change:"Config change",message:"Message",msg:"Note",summary:"Summary"};function Hs(t){return t.author_name?t.author_name:t.platform?me(t.platform):t.origin_type?Vs[t.origin_type]??me(t.origin_type):null}function qs(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):Array.isArray(t)?t.length===0?"":t.every(n=>typeof n!="object")?t.map(n=>String(n)).join(", "):e.jsx("pre",{className:"overflow-x-auto rounded bg-muted/40 p-2 text-[11px] leading-relaxed whitespace-pre-wrap",children:JSON.stringify(t,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(t,null,2)})}const Ke=1e5;function xt({value:t}){const n=JSON.stringify(t,null,2)??"null",s=n.length>Ke;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:s?n.slice(0,Ke):n}),s&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Showing the first ",Ke.toLocaleString()," of"," ",n.length.toLocaleString()," characters."]})]})}function Ks(t){return Object.entries(t).filter(([,n])=>n==null?!1:typeof n=="string"?n.trim().length>0:Array.isArray(n)?n.length>0:typeof n=="object"?Object.keys(n).length>0:!0).sort(([n],[s])=>n.localeCompare(s))}function Js({breakdown:t}){if(!t)return null;const n=[{label:"Engagement",value:t.engagement,max:100},{label:"Criticality",value:t.criticality,max:100},{label:"Depth",value:t.depth,max:100},{label:"Authority",value:t.authority,max:100},{label:"Recency",value:t.recency,max:100},{label:"Quality",value:t.quality,max:100}];return e.jsx("div",{className:"space-y-2 text-sm",children:n.map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-20 text-muted-foreground",children:s.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:`${s.value/s.max*100}%`}})}),e.jsx("span",{className:"w-8 text-right",children:s.value})]},s.label))})}function Qs({slug:t,value:n,isManual:s}){return e.jsxs(ce,{variant:"secondary",className:"text-xs",children:[t,": ",n,s&&e.jsx(Ct,{className:"ml-1 h-2.5 w-2.5 fill-current"})]})}function Ws(t){if(t&&typeof t=="object"){const n=t;if(Array.isArray(n.values))return{values:n.values.map(s=>String(s)).filter(s=>s.length>0),isManual:n.is_manual===!0};if(n.value!==void 0&&n.value!==null)return{values:[String(n.value)],isManual:n.is_manual===!0};if(typeof n.values=="string"&&n.values.length>0)return{values:[n.values],isManual:n.is_manual===!0}}return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?{values:[String(t)],isManual:!1}:{values:[],isManual:!1}}function Bt(t,n){if(t)switch(t){case"pending":return"pending_approval";case"approved":return"confirmed";case"rejected":return"rejected";case"completed":return"completed";case"failed":return"failed";default:return t}return n||"pending_approval"}function Xe(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function Gs(t){return t.replace(/\s+[—-]\s+pending approval$/i,"")}function ze(t){return t.replace(/^\$/,"").replace(/[_-]/g," ").replace(/\s+/g," ").trim().replace(/^./,n=>n.toUpperCase())}function zt(t,n,s){return t?.kind==="agent_session"&&t.agent_id?t.client_id?`${t.agent_id} via ${t.client_id}`:t.agent_id:t?.kind==="user"?"a person":n==="agent"?"an agent":s?`Automation ${s}`:"an Automation"}function Xs({ownerSlug:t,initiator:n,clientName:s,fallback:r}){const a=n?.client_id??s,{allOrgs:i,isAuthenticated:l}=Rt(),m=l&&i?.some(v=>v.slug===t),c=es(void 0,{ownerSlug:t,enabled:!!(a&&m)}).data?.find(v=>v.id===a)?.title,p=n&&n.kind!=="user"?zt(n,void 0,n.automation_id===void 0?void 0:String(n.automation_id)):r,u="font-medium text-foreground",h=`${u} underline-offset-4 hover:underline`;return n?.kind==="automation"&&n.automation_id?e.jsx(le,{to:"/$owner/automations/$automationId",params:{owner:t,automationId:String(n.automation_id)},search:{view:"definition",run_id:void 0},className:h,children:p}):n?.kind==="agent_session"&&n.agent_id?e.jsx(le,{to:"/$owner/agents/$agentId",params:{owner:t,agentId:String(n.agent_id)},className:h,children:p}):a?e.jsxs(le,{to:"/$owner/agents/connected/$clientId",params:{owner:t,clientId:a},className:`${h} inline-flex items-center gap-1 align-middle`,children:[e.jsx(Tt,{name:c??s??a}),c??p]}):e.jsx("span",{className:u,children:p})}function Ys(t){const n=Object.keys(t.fields),s=n.map(ze).join(", ")||"field",r=n.length===1?"field":"fields";return`Update ${t.entityType?ze(t.entityType).toLowerCase():"entity"} ${r}: ${s}`}function Zs(t,n){const s=Xe(n.fields);if(!s||Object.keys(s).length===0||n.action_key!=="entity_field_change"&&n.tool!=="entity_field_change")return null;const r=Xe(n.current)??{},a=t;return{fields:s,current:r,reason:typeof n.reason=="string"?n.reason:void 0,automationId:n.automation_id!=null?String(n.automation_id):void 0,automationName:typeof n.automation_name=="string"?n.automation_name:void 0,automationAgentId:typeof n.automation_agent_id=="string"?n.automation_agent_id:void 0,entityType:typeof n.entity_type=="string"?n.entity_type:void 0,entityName:(typeof n.entity_name=="string"?n.entity_name:void 0)??a.entity_name??void 0,entitySlug:typeof n.entity_slug=="string"?n.entity_slug:void 0,parentSlug:typeof n.parent_slug=="string"?n.parent_slug:void 0,parentEntityType:typeof n.parent_entity_type=="string"?n.parent_entity_type:void 0,attribution:typeof n.attribution=="string"?n.attribution:void 0,initiator:n.initiator&&typeof n.initiator=="object"?n.initiator:void 0}}function er(t){const n=t.entityType?ze(t.entityType).toLowerCase():"entity";return`${ze(t.operation)} ${n}`}function tr(t,n){if(n.action_key!=="entity_change"&&n.tool!=="entity_change")return null;const s=n.action;if(s!=="create"&&s!=="delete"&&s!=="link"&&s!=="unlink")return null;const r=t;return{operation:s,proposal:Xe(n.proposal),reason:typeof n.reason=="string"?n.reason:void 0,automationId:n.automation_id!=null?String(n.automation_id):void 0,automationName:typeof n.automation_name=="string"?n.automation_name:void 0,automationAgentId:typeof n.automation_agent_id=="string"?n.automation_agent_id:void 0,entityType:typeof n.entity_type=="string"?n.entity_type:void 0,entityName:(typeof n.entity_name=="string"?n.entity_name:void 0)??r.entity_name??void 0,entitySlug:typeof n.entity_slug=="string"?n.entity_slug:void 0,parentSlug:typeof n.parent_slug=="string"?n.parent_slug:void 0,parentEntityType:typeof n.parent_entity_type=="string"?n.parent_entity_type:void 0,attribution:typeof n.attribution=="string"?n.attribution:void 0,proposerRationale:typeof n.proposer_rationale=="string"?n.proposer_rationale:void 0,initiator:n.initiator&&typeof n.initiator=="object"?n.initiator:void 0}}function nr(t,n){return!n.entityType||!n.entitySlug?null:Ye(t,n.parentEntityType&&n.parentSlug?[{entity_type:n.parentEntityType,slug:n.parentSlug},{entity_type:n.entityType,slug:n.entitySlug}]:[{entity_type:n.entityType,slug:n.entitySlug}])}function Ut({ownerSlug:t,runId:n,details:s}){const a=Et(s.automationId,void 0,void 0,{ownerSlug:t,includeVersions:!1}).data?.automation,i=zt(s.initiator,s.attribution,s.automationId),l=a?.automation_name??s.automationName??i;return e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Requested by"," ",s.automationId?e.jsx(le,{to:"/$owner/automations/$automationId",params:{owner:t,automationId:s.automationId},search:{view:"definition",run_id:void 0},className:"font-medium text-foreground underline-offset-4 hover:underline",children:l}):e.jsx("span",{className:"font-medium text-foreground",children:l}),n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:" · "}),e.jsxs(le,{to:"/$owner/events",params:{owner:t},search:{run_ids:String(n)},className:"font-medium text-foreground underline-offset-4 hover:underline",children:["Run #",n]})]})]})}function Vt({ownerSlug:t,details:n}){const s=nr(t,n);return n.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:s?e.jsx(le,{to:s,className:"underline-offset-4 hover:underline",children:n.entityName}):n.entityName})]}):null}function sr({ownerSlug:t,runId:n,details:s}){return e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ut,{ownerSlug:t,runId:n,details:s}),e.jsx(Vt,{ownerSlug:t,details:s}),e.jsx("div",{className:"rounded-md border border-border/70 px-3 py-2",children:e.jsx(rt,{changes:Object.entries(s.fields).map(([r,a])=>({field:r,old:s.current[r]??null,new:a??null})),entityType:s.entityType,ownerSlug:t,showAll:!0})}),s.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:s.reason})]})]})}function rr({ownerSlug:t,runId:n,details:s,status:r}){const{operation:a}=s,i=a==="link"||a==="unlink";return e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ut,{ownerSlug:t,runId:n,details:s}),!i&&e.jsx(Vt,{ownerSlug:t,details:s}),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:i?Pt(a,r):a==="create"?"Create a new entity after approval.":"Delete this entity after approval."}),i&&e.jsxs("div",{className:"mt-2 space-y-1 text-sm",children:[$t(s.proposal).map((l,m)=>e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:m===0?"From: ":"To: "}),l.name]},l.id)),e.jsxs("div",{className:"text-muted-foreground",children:["Relationship:"," ",String(s.proposal?.relationship_type??s.proposal?.relationship_type_slug??"Relationship")]})]})]}),!i&&s.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(s.proposal,null,2)})]}),s.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:s.attribution==="agent"?"The agent's reasoning":"The Automation's reasoning"}),e.jsx("div",{className:"mt-1 text-sm leading-relaxed",children:s.proposerRationale})]}),s.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:s.reason})]})]})}function ar({summary:t}){return e.jsxs("div",{className:"space-y-2 rounded-md border border-border/70 bg-muted/30 p-3 text-sm",children:[t.chips.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.chips.map(n=>e.jsx(ce,{variant:"outline",className:"text-[10px] font-normal",children:n},n))}),t.message&&e.jsx("p",{className:"leading-relaxed text-foreground",children:t.message}),t.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:t.reason})]}),t.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:t.kind==="verify"?"Expected comment":"Draft"}),e.jsx("div",{className:"mt-0.5 whitespace-pre-wrap leading-relaxed",children:t.body})]}),t.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",t.matchAuthor?` · ${t.matchAuthor}`:""]}),e.jsx("div",{className:"mt-0.5 whitespace-pre-wrap leading-relaxed text-muted-foreground",children:t.matchPreview})]}),t.postUrl&&e.jsxs("a",{href:t.postUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:["Open post",e.jsx(At,{className:"h-3 w-3"})]})]})}function ir({ownerSlug:t,content:n,batchReview:s}){const r=n.metadata||{},a=n.run_id??void 0,i=Zs(n,r),l=tr(n,r),m=(i?Ys(i):l?er(l):void 0)||r.operation_name||r.action_name||(n.title?Gs(n.title):void 0)||"Action",o=r.connection_name,c=r.operation_key||r.action_key||null,p=n.interaction_input_schema||r.input_schema||null,u=N.useMemo(()=>n.interaction_input||r.action_input||r.operation_input||Us,[n.interaction_input,r.action_input,r.operation_input]),h=n.interaction_output||r.action_output||void 0,v=ps(u,h??null,c),I=n.interaction_error||r.error_message||void 0,_=Bt(n.interaction_status,r.status),j=r.reviewed_by_name||r.reviewed_by_id||void 0,w=r.reject_reason||void 0,K=r.initiator,P=Sn({slug:t}),F=In({slug:t}),T=An(n.id,Rn(p,u),p),{values:g,setValues:B}=T,[k,D]=N.useState(null),[f,G]=N.useState(!1),[R,L]=N.useState(""),O=_==="pending_approval"&&k?k:_,A=O==="pending_approval",V=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(kt,{className:"h-4 w-4 text-yellow-500"}),e.jsx("span",{className:"font-medium",children:m}),o&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["on ",o]}),O==="confirmed"&&e.jsx(ce,{variant:"outline",className:"text-blue-700 border-blue-300 bg-blue-50 dark:bg-blue-950/30 text-[10px]",children:"Approved"}),O==="completed"&&e.jsx(ce,{variant:"outline",className:"text-green-700 border-green-300 bg-green-50 dark:bg-green-950/30 text-[10px]",children:"Completed"}),O==="failed"&&e.jsx(ce,{variant:"outline",className:"text-red-700 border-red-300 bg-red-50 dark:bg-red-950/30 text-[10px]",children:"Failed"}),O==="rejected"&&e.jsx(ce,{variant:"outline",className:"text-muted-foreground text-[10px]",children:"Rejected"})]}),!i&&!l&&(n.author_name||j)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs text-muted-foreground",children:[n.author_name&&e.jsxs("span",{children:["Requested by"," ",e.jsx(Xs,{ownerSlug:t,initiator:K,clientName:n.author_name,fallback:n.author_name})]}),n.author_name&&j&&e.jsx("span",{children:"·"}),j&&e.jsxs("span",{children:[O==="rejected"?"Rejected":"Approved"," by"," ",e.jsx("span",{className:"font-medium text-foreground",children:j})]})]}),i&&e.jsx(sr,{ownerSlug:t,runId:a,details:i}),!i&&l&&e.jsx(rr,{ownerSlug:t,runId:a,details:l,status:O}),O==="rejected"&&w&&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:"})," ",w]}),v&&e.jsx(ar,{summary:v}),(A?T.revision:p)&&(A||Object.keys(u).length>0)&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:v?"Full input":"Input"}),A?e.jsxs(e.Fragment,{children:[e.jsx(En,{visible:T.hasConflict,onReload:T.reset}),e.jsx(Tn,{schema:T.revision,values:g,onValuesChange:B,fieldIdPrefix:`action-${n.id}-`},`action-${n.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(u,null,2)})]}):e.jsx("pre",{className:"text-xs bg-muted/50 rounded p-2 font-mono overflow-auto max-h-32",children:JSON.stringify(u,null,2)})]}),O==="completed"&&h&&Object.keys(h).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(tt,{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(h,null,2)})]}),O==="completed"&&h&&Object.keys(h).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(h,null,2)})]}),O==="failed"&&I&&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:I})]}),A&&!k&&V&&e.jsxs("div",{className:"pt-1 text-xs text-muted-foreground",children:["Review this proposal with the other changes in its Automation run.",s]}),A&&a&&!k&&!V&&e.jsx("div",{className:"flex items-center gap-2 pt-1",children:f?e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("input",{type:"text",placeholder:"Reason (optional)",value:R,onChange:se=>L(se.target.value),className:"h-7 text-xs border rounded px-2 flex-1 bg-background"}),e.jsxs(E,{size:"sm",variant:"destructive",className:"h-7 text-xs",onClick:()=>F.mutate({run_id:a,reason:R||void 0},{onSuccess:()=>{D("rejected")}}),disabled:F.isPending,children:[F.isPending&&e.jsx(Re,{size:"sm",className:"mr-1"}),"Confirm Reject"]}),e.jsx(E,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>{G(!1),L("")},children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(E,{size:"sm",className:"h-7 text-xs",onClick:()=>P.mutate({run_id:a,input:Pn(g)},{onSuccess:()=>{D("confirmed")}}),disabled:!T.canSubmit||P.isPending||F.isPending,children:[P.isPending?e.jsx(Re,{size:"sm",className:"mr-1"}):e.jsx($n,{className:"h-3 w-3 mr-1"}),"Confirm"]}),e.jsxs(E,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>G(!0),disabled:P.isPending||F.isPending,children:[e.jsx(Fn,{className:"h-3 w-3 mr-1"}),"Reject"]})]})})]})}function or({content:t,ownerSlug:n}){const s=t.metadata||{},r=s.kind,a=t.run_id??null,i=typeof s.automation_id=="number"?s.automation_id:null,o=Et(i!=null?String(i):void 0,void 0,void 0,{includeVersions:!1,ownerSlug:n}).data?.automation?.automation_name??(i!=null?`Automation ${i}`:"An Automation"),c=kn({slug:n}),p=Cn({slug:n}),[u,h]=N.useState(!1),[v,I]=N.useState(""),[_,j]=N.useState(null);if(r==="automation_batch_reject"){const f=s.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"}),f&&e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:f}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Ask the agent to revise its proposals with this feedback."})]})}const w=Array.isArray(s.changes)?s.changes:[],K=typeof s.created_count=="number"?s.created_count:w.filter(f=>f.kind==="created").length,P=typeof s.updated_count=="number"?s.updated_count:w.filter(f=>f.kind==="updated").length,F=typeof s.denied_count=="number"?s.denied_count:w.filter(f=>f.kind==="denied").length,T=w.filter(f=>f.kind==="denied"),g=w.filter(f=>f.kind==="updated"&&Object.keys(f.applied||{}).length>0),B=typeof s.pending_proposal_count=="number"?s.pending_proposal_count:null,k=B==null||B>0,D=k?"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:[D==="proposed"?"Proposed":"Applied"," ",K," ","new + ",P," updated",F>0&&e.jsxs(e.Fragment,{children:[" + ",F," denied"]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[i!=null?e.jsx(le,{to:"/$owner/automations/$automationId",params:{owner:n,automationId:String(i)},search:{view:"definition",run_id:void 0},className:"font-medium text-foreground underline-offset-4 hover:underline",children:o}):e.jsx("span",{className:"font-medium text-foreground",children:o}),a!=null&&e.jsxs("span",{children:[" · run #",a]}),B!=null&&B>0&&e.jsxs("span",{children:[" · ",B," pending"]})]})]}),g.length>0&&e.jsx("div",{className:"mt-3 space-y-2",children:g.map(f=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:f.name}),e.jsx(rt,{changes:Object.entries(f.applied).map(([G,R])=>({field:G,old:R.old??null,new:R.new??null})),entityId:f.entityId,ownerSlug:n,showAll:!0})]},f.entityId))}),T.length>0&&e.jsx("div",{className:"mt-3 space-y-1.5",children:T.map(f=>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:[f.name," — not written"]}),f.denied&&e.jsxs("div",{className:"mt-0.5 text-xs text-muted-foreground",children:[f.denied.reason,e.jsxs("span",{className:"ml-1 opacity-70",children:["(refused by"," ",f.denied.source==="rule"?"a write rule":"org policy",")"]})]})]},`denied-${f.entityId}-${f.name}`))}),a!=null&&_==null&&k&&e.jsx("div",{className:"mt-3 border-t border-border/70 pt-3",children:u?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:f=>I(f.target.value),className:"h-7 text-xs border rounded px-2 flex-1 bg-background"}),e.jsxs(E,{size:"sm",variant:"destructive",className:"h-7 text-xs",onClick:()=>p.mutate({run_id:a,reason:v||void 0},{onSuccess:()=>j("rejected")}),disabled:p.isPending,children:[p.isPending&&e.jsx(Re,{size:"sm",className:"mr-1"}),"Reject all"]}),e.jsx(E,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>{h(!1),I("")},children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(E,{size:"sm",className:"h-7 text-xs",onClick:()=>c.mutate({run_id:a},{onSuccess:()=>j("approved")}),disabled:c.isPending||p.isPending,children:[c.isPending&&e.jsx(Re,{size:"sm",className:"mr-1"}),"Approve all proposals"]}),e.jsx(E,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>h(!0),disabled:c.isPending||p.isPending,children:"Reject with feedback"})]})}),_==="approved"&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"All proposals approved."}),_==="rejected"&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Proposals rejected — ask the agent to revise them."}),a!=null&&_==null&&!k&&e.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"All proposals reviewed."})]})}function Ie({presentation:t="summary",renderDetail:n,onFiltersChange:s,ownerSlug:r,content:a,isReply:i,showParentContext:l,connectorDefinitions:m,hideOriginator:o=!1,hideRunAction:c=!1,hideAttribution:p=!1,hideDetails:u=!1,recordId:h}){const[v,I]=N.useState(null),_=Nt(),j=t==="detail",w=Ze(),{currentOwner:K,allOrgs:P,isAuthenticated:F}=Rt(),T=r??K,g=T==="me"?null:T,B=N.useCallback(async y=>{if(!g){it.error("Open this event inside a workspace to interact with it.");return}const $=await us(g,Number(a.id),y,crypto.randomUUID());return"event_id"in $&&it.success("Recorded"),$},[a.id,g]),k=a.payload_data??{},{audit:D,operation:f,changeSet:G}=Mt(a),R=D&&(k.request!==void 0||k.request_status==="too_large"),L=D&&Array.isArray(k.sdk_call_trace)&&k.sdk_call_trace.length>0,O=T?ot(T,Number(a.id)):null,A=!j&&F?(P??[]).find(y=>y.slug===g):void 0,V=A?{slug:A.slug,organizationId:A.id}:null,se=gt(V??{slug:null,organizationId:null}),re=V?.slug??null,pe=N.useMemo(()=>re&&!D?yt(se.data??[],a.semantic_type):[],[re,D,se.data,a.semantic_type]),we=vn(),he=!!(!(f||G)&&V&&pe.length>0),Z=!j&&!!O,X=bn(w?.item?.href.split(/[?#]/)[0]??""),de=X?.owner===T&&X?.eventId===Number(a.id),ee=(y,$,z)=>{w?w.open({href:y,title:$,...z==null?{}:{runId:z}}):_({to:y})},ae=(y,$)=>{if(!g)return null;const z=`/${g}/events?run_ids=${y}`;return w?.item?.href===z?null:e.jsxs(E,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>s?s({runIds:[y]}):ee(z,"Run activity",y),title:s?"Filter by this run":"Open run activity",children:[e.jsx(wn,{className:"h-3.5 w-3.5"}),$]})},fe=a.run_id!=null&&(s||!(w&&g&&a.automation_id!=null))?ae(a.run_id,s?"Run":"Open run"):null,Y=Nn(a),Q=a.automation_id,ke=w&&g&&Y!=null&&Q!=null?()=>w.open({href:`/${g}/automations/${Q}?run_id=${Y}`,title:`${a.automation_name??`Automation ${Q}`} · Run #${Y}`,runId:Y}):void 0,ge=()=>{if(he&&V&&g){const y=Number(a.id);cs(we,V.slug,pe,y).catch(()=>null).then($=>ee(ot(g,y,$?.key),a.title??"Event"));return}O&&ee(O,a.title??"Event")},ye=y=>{const $=y.target;if(!($ instanceof Element))return!1;const z=$.closest('a,button,input,select,textarea,[role="button"],[role="radio"]');return z!==null&&z!==y.currentTarget},ie=y=>{ye(y)||ge()},te=y=>{y.key!=="Enter"&&y.key!==" "||ye(y)||(y.preventDefault(),ge())},je=a.metadata?.source_run_id,H=Os(a),ve=j&&g?G?e.jsx(or,{content:a,ownerSlug:g}):f?e.jsx(ir,{ownerSlug:g,content:a,batchReview:typeof je=="number"?ae(je,"Review run"):null}):void 0:void 0,oe=j&&n?n(ve):{content:ve,nativeHeading:ve!=null};return e.jsx("div",{className:ue(i?"border-l-2 border-l-muted pl-4":"",Z&&"cursor-pointer rounded-lg p-3 transition-colors hover:bg-accent/40",Z&&de&&"bg-accent ring-1 ring-inset ring-primary/20"),...Z?{role:"button","aria-current":de?"true":void 0,tabIndex:0,onClick:ie,onKeyDown:te}:{},children:e.jsx(cr,{primaryContent:oe.content,nativeHeading:oe.nativeHeading,heading:H&&g?e.jsx(Bs,{event:H,recordId:h,ownerSlug:g}):void 0,body:H&&g?e.jsx(zs,{event:H,ownerSlug:g}):void 0,detailLinks:oe.links,headingAside:oe.headingAside,hideDetails:u,onFiltersChange:s,presentation:t,content:a,ownerSlug:T??void 0,showParentContext:l,connectorDefinitions:m,onRenderedAction:g?B:void 0,runAction:c?null:fe,hideOriginator:o,hideAttribution:p,runId:Y??a.run_id??null,onRunSelect:ke,auditDetails:j&&(R||L)&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:[{key:"request",label:"Request",available:R},{key:"calls",label:"SDK calls",available:L}].map(y=>y.available?e.jsxs(E,{variant:"outline",size:"sm","aria-expanded":v===y.key,onClick:()=>I($=>$===y.key?null:y.key),children:[v===y.key?e.jsx(Ne,{className:"h-3.5 w-3.5"}):e.jsx(_e,{className:"h-3.5 w-3.5"}),y.label]},y.key):null)}),v==="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(xt,{value:k.request})),v==="calls"&&e.jsx(xt,{value:k.sdk_call_trace})]})})})}function lr(t,n){const s=t.payload_data??{},r=t.metadata??{};if(n.audit&&typeof s.success=="boolean")return s.success?"completed":"failed";if(n.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(n.operation)return Bt(t.interaction_status,typeof r.status=="string"?r.status:void 0)}function dr(t){return t==="pending_approval"?"Needs approval":t==="confirmed"?"Approved":t?me(t):null}function cr({presentation:t,primaryContent:n,nativeHeading:s=!1,heading:r,body:a,detailLinks:i,headingAside:l,onFiltersChange:m,content:o,ownerSlug:c,showParentContext:p,connectorDefinitions:u,onRenderedAction:h,runAction:v,auditDetails:I,hideOriginator:_=!1,hideAttribution:j=!1,runId:w,onRunSelect:K,hideDetails:P=!1}){const[F,T]=N.useState(!1),g=o.metadata??{},B=typeof o.score=="number"&&Number.isFinite(o.score)?Math.round(o.score):"-",k=o.payload_type||"text",D=o.text_content||"",f=t==="summary",G=t==null&&(k==="text"||k==="markdown")&&D.length>500,R=G&&!F?`${D.slice(0,500)}...`:D,L=o.payload_data??{},O=Mt(o),{audit:A,operation:V,changeSet:se}=O,re=lr(o,O),pe=dr(re),we=f&&A&&typeof L.tool_name=="string"?me(L.tool_name):o.title,xe=A&&L.error&&typeof L.error=="object"?L.error.message:void 0,he=(typeof xe=="string"?xe:void 0)??o.interaction_error??(typeof g.error_message=="string"?g.error_message:void 0),Z=he||(A?"":D),[X,de]=N.useState(t!=="summary"&&A&&n==null&&i==null),ee=A?L.duration_ms:g.duration_ms,ae=typeof ee=="number"&&Number.isFinite(ee)&&ee>=0?ee:null,fe=A&&typeof L.sdk_call_count=="number"&&Number.isSafeInteger(L.sdk_call_count)&&L.sdk_call_count>=0?L.sdk_call_count:null,Y=g.thumbnail_url||g.thumbnail,Q=g.media_url,ke=f?[]:Ks(g),ge=Object.entries(o.classifications||{}).flatMap(([d,b])=>{const C=Ws(b);return C.values.map(J=>({slug:d,value:J,isManual:C.isManual}))}),ye=(()=>{const d=o.platform||(typeof g.platform=="string"?g.platform:null),b=o.connection_id!=null?o.connection_id:g.source_connection_id!=null?Number(g.source_connection_id):null;return{...o,platform:d,connection_id:b!=null&&Number.isFinite(b)?b:null}})(),ie=(()=>{const d=o.source_url??g.browser_url;if(typeof d!="string"||!URL.canParse(d))return null;const b=new URL(d);return b.protocol==="https:"||b.protocol==="http:"?b:null})(),te=o.occurred_at?new Date(o.occurred_at):null,je=A?wt:V?kt:se?cn:o.semantic_type==="notification"?un:mn,H=A?"SDK call":me(o.semantic_type||o.origin_type||"Event"),ve=e.jsx(_n,{platform:ye.platform,connectorDefinitions:u,sourceUrl:ie,label:H,fallback:e.jsx(je,{className:"h-4 w-4"})}),oe=ke.length>0?e.jsx("dl",{className:"grid gap-x-3 gap-y-2 text-sm sm:grid-cols-[minmax(140px,180px)_1fr]",children:ke.map(([d,b])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:me(d)}),e.jsx("dd",{className:"min-w-0 break-words font-mono text-xs sm:text-sm",children:qs(b)})]},d))}):null,y=a?e.jsx("div",{className:"mt-1",children:a}):f?Z?e.jsx("p",{className:ue("line-clamp-2 text-sm whitespace-pre-wrap",he&&"text-destructive"),children:Z.slice(0,320)}):null:e.jsxs(e.Fragment,{children:[o.rating&&e.jsx("div",{className:"flex items-center gap-1 mb-2",children:[1,2,3,4,5].map(d=>e.jsx(Ct,{className:`h-4 w-4 ${d<=Number(o.rating)?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},d))}),Y&&e.jsx("a",{href:Q||o.source_url||"#",target:"_blank",rel:"noopener noreferrer",className:"block mb-2",children:e.jsx("img",{src:Y,alt:"",className:`rounded-md object-cover ${k==="media"?"max-h-96 w-full":"max-h-48"}`,loading:"lazy"})}),(()=>{switch(k){case"markdown":if(R)return e.jsx("div",{className:"max-w-none text-sm space-y-2",children:e.jsx(pn,{text:R})});break;case"json_template":{const d=o.payload_template;if(d?.root)return e.jsx(xs,{template:d,data:o.payload_data||{},onAction:n?void 0:h},`${c}:${o.id}`);if(R)return e.jsx("div",{className:"text-sm whitespace-pre-wrap",children:R});break}case"media":return e.jsxs("div",{className:"space-y-3",children:[!Y&&Q&&e.jsx("a",{href:Q,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline truncate block",children:Q}),R&&e.jsx("div",{className:"text-sm whitespace-pre-wrap text-muted-foreground",children:R})]});case"empty":return e.jsxs("div",{className:"space-y-3",children:[I,oe??(I?null:e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No content"}))]});default:if(R)return e.jsx("div",{className:"text-sm whitespace-pre-wrap",children:R});break}return e.jsxs("div",{className:"space-y-3",children:[Q&&!Y&&e.jsx("a",{href:Q,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-muted-foreground hover:text-foreground truncate block",children:Q}),oe]})})()]}),$=n!=null||t==="detail"&&A,z=l!==void 0,x=$||i!=null;return N.useEffect(()=>{if(!z||!X)return;const d=b=>{b.key==="Escape"&&(b.preventDefault(),de(!1))};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[z,X]),e.jsxs(e.Fragment,{children:[p&&o.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:o.parent_context.author_name}),e.jsx("div",{className:"text-muted-foreground line-clamp-2",children:o.parent_context.text_content})]}),e.jsxs("div",{className:ue("flex gap-3",t==="detail"&&"mb-5",z&&"relative"),children:[e.jsx(xn,{children:ve}),e.jsxs("div",{className:"min-w-0 flex-1",children:[t==="detail"&&(()=>{const d={semanticTypes:[o.semantic_type],...typeof o.automation_id=="number"?{producedByAutomationId:o.automation_id}:{},...typeof o.run_id=="number"?{runIds:[o.run_id]}:{}},b={semantic_types:o.semantic_type,...typeof o.automation_id=="number"?{produced_by:String(o.automation_id)}:{},...typeof o.run_id=="number"?{run_ids:String(o.run_id)}:{}};return e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[o.semantic_type?m?e.jsx("button",{type:"button",className:"hover:underline",title:`Show all ${H} events`,onClick:()=>m(d),children:H}):c?e.jsx(le,{to:"/$owner/events",params:{owner:c},search:b,className:"hover:underline",title:`Show all ${H} events`,children:H}):e.jsx("span",{children:H}):e.jsx("span",{children:H}),te&&e.jsx("time",{dateTime:te.toISOString(),children:Ae(te)})]})})(),e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[(r??we)&&!s&&e.jsx("h4",{className:ue("min-w-0 font-medium",t==="detail"?"text-xl leading-snug":"line-clamp-2 text-sm"),children:r??we}),t!=="detail"&&te&&e.jsx(hn,{at:te}),z&&e.jsxs("div",{className:"flex shrink-0 items-center gap-1 pt-0.5",children:[l,x&&e.jsxs(E,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-muted-foreground hover:text-foreground","aria-expanded":X,onClick:()=>de(d=>!d),children:["Details",X?e.jsx(Ne,{className:"h-3.5 w-3.5"}):e.jsx(_e,{className:"h-3.5 w-3.5"})]})]})]}),f&&e.jsx("div",{className:"mt-1 text-muted-foreground",children:y}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[pe&&!s&&e.jsxs(ce,{variant:re==="failed"?"destructive":"secondary",className:"gap-1 text-xs",children:[re==="failed"?e.jsx(St,{className:"h-3 w-3"}):re==="completed"?e.jsx(tt,{className:"h-3 w-3"}):null,pe]}),fe!=null&&e.jsxs("span",{children:[fe," SDK ",fe===1?"call":"calls"]}),ae!=null&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(It,{className:"h-3 w-3"}),ae<1e3?`${Math.round(ae)}ms`:`${Number((ae/1e3).toFixed(2))}s`]}),v,B==="-"||f&&(A||V||se)?null:o.score_breakdown?e.jsxs(fn,{children:[e.jsx(gn,{asChild:!0,children:e.jsx(E,{variant:"ghost",size:"sm",className:"h-7 px-2",children:e.jsx("span",{className:"font-medium",children:B})})}),e.jsx(yn,{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(Js,{breakdown:o.score_breakdown})]})})]}):null,ie&&e.jsxs(jt,{children:[e.jsx(vt,{asChild:!0,children:e.jsx(E,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-1",asChild:!0,children:e.jsxs("a",{href:ie.href,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(At,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:f?"sr-only":void 0,children:"View original"})]})})}),e.jsx(bt,{children:"View original"})]})]}),c&&!j&&e.jsx(jn,{owner:c,source:ye,connectorDefinitions:u,onFiltersChange:m,variant:"chips",className:"mt-2 text-xs",hideOriginator:_,runId:w,onRunSelect:K}),(o.author_name||!c)&&!(t==="detail"&&V)&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:o.author_name||Hs(o)})]}),z&&X&&x&&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:[i,$&&y]})]}),!f&&typeof xe=="string"&&e.jsx("p",{className:"mb-2 text-sm whitespace-pre-wrap text-destructive",children:xe}),n,!f&&!$&&y,($||i!=null)&&l===void 0&&!(P&&n!=null)&&e.jsxs("details",{className:"mt-5 border-t pt-3",open:X,onToggle:d=>de(d.currentTarget.open),children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground",children:"Details"}),X&&e.jsxs("div",{className:"mt-3 space-y-3",children:[i,$&&y]})]}),G&&e.jsx(E,{variant:"link",size:"sm",className:"px-0 h-6 mt-1",onClick:()=>T(!F),children:F?e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"h-3 w-3 mr-1"})," Show less"]}):e.jsxs(e.Fragment,{children:[e.jsx(_e,{className:"h-3 w-3 mr-1"})," Show more"]})}),ge.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:ge.map(d=>e.jsx(Qs,{slug:d.slug,value:d.value||"",isManual:d.isManual},d.slug))})]})}function ur({toolName:t,count:n,totalDurationMs:s,totalSdkCalls:r,newestAt:a,oldestAt:i,expanded:l,onToggle:m,children:o}){return e.jsx("div",{children:e.jsxs(De,{open:l,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(wt,{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(Le,{asChild:!0,children:e.jsxs(E,{variant:"ghost",size:"sm",className:"h-5 min-w-0 gap-1.5 px-0 text-sm text-muted-foreground",onClick:m,children:[e.jsxs("span",{className:"min-w-0 truncate font-medium text-foreground",children:[me(t)," × ",n]}),l?e.jsx(Ne,{className:"h-3.5 w-3.5 shrink-0"}):e.jsx(_e,{className:"h-3.5 w-3.5 shrink-0"})]})}),e.jsx(Ht,{newestAt:a,oldestAt:i})]}),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(ce,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx(tt,{className:"h-3 w-3"}),"Completed"]}),r!=null&&e.jsxs("span",{children:[r," SDK ",r===1?"call":"calls"]}),s!=null&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(It,{className:"h-3 w-3"}),mr(s)]})]})]})]})}),e.jsx(Me,{className:"mt-2 space-y-3 border-l-2 border-l-muted pl-4",children:o})]})})}function mr(t){return t<1e3?`${Math.round(t)}ms`:`${Number((t/1e3).toFixed(2))}s`}function Ht({newestAt:t,oldestAt:n}){const s=ht(t),r=ht(n);return s!=null&&r!=null&&s.getTime()-r.getTime()>pr&&r?e.jsxs("time",{dateTime:s.toISOString(),title:`${Ae(r)} – ${Ae(s)}`,className:"shrink-0 pt-0.5 text-xs text-muted-foreground",children:[Fe(r,"HH:mm"),"–",Fe(s,"HH:mm")]}):s?e.jsx("time",{dateTime:s.toISOString(),title:Ae(s),className:"shrink-0 pt-0.5 text-xs text-muted-foreground",children:Fe(s,"HH:mm")}):null}const pr=300*1e3;function ht(t){if(t==null||t==="")return null;const n=new Date(t);return Number.isNaN(n.getTime())?null:n}function xr({organizationId:t,clientId:n,activityId:s,activityKind:r,callCount:a,newestAt:i,oldestAt:l,expanded:m,onToggle:o,children:c}){const{data:p=[]}=On({limit:100,organizationId:t??null}),u=p.find(I=>I.activityId===s&&(n==null||I.clientId===n))??null,h=u?Zn(u):r==="session"?"MCP session":"Conversation",v=u?.clientName??null;return e.jsx("div",{children:e.jsxs(De,{open:m,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(Tt,{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(Le,{asChild:!0,children:e.jsxs(E,{variant:"ghost",size:"sm",className:"h-5 min-w-0 gap-1.5 px-0 text-sm text-muted-foreground",onClick:o,children:[e.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",children:h}),m?e.jsx(Ne,{className:"h-3.5 w-3.5 shrink-0"}):e.jsx(_e,{className:"h-3.5 w-3.5 shrink-0"})]})}),e.jsx(Ht,{newestAt:i,oldestAt:l})]}),e.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:[`${a} ${a===1?"call":"calls"}`,v?` · ${v}`:null]})]})]})}),e.jsx(Me,{className:"mt-2 space-y-3 border-l-2 border-l-muted pl-4",children:c})]})})}function hr({onIntersect:t,enabled:n,rootMargin:s="400px"}){const r=N.useRef(null),a=N.useRef(t);return a.current=t,N.useEffect(()=>{const i=r.current;if(!i||!n)return;const l=new IntersectionObserver(m=>{m[0]?.isIntersecting&&a.current()},{rootMargin:s});return l.observe(i),()=>l.disconnect()},[n,s]),r}function ft(t){if(t==null||t==="")return null;const n=new Date(t);return Number.isNaN(n.getTime())?null:Fe(n,"d MMMM yyyy")}function fr({items:t,isLoading:n,emptyState:s,hasNextPage:r,isFetching:a,isFetchingNextPage:i,onLoadMore:l,autoLoadMore:m=!0,groupByDate:o=!0}){const c=hr({onIntersect:l,enabled:m&&r&&!a});return n&&t.length===0?e.jsx("div",{className:"space-y-4",children:["s1","s2","s3"].map(p=>e.jsx(Pe,{className:"h-32 rounded-lg"},p))}):e.jsxs("div",{children:[t.length===0?s!==void 0?s:e.jsx(Dn,{icon:Ln,title:"Nothing here yet",description:"No events match this view."}):t.map((p,u)=>{const h=ft(p.occurredAt),v=u>0?ft(t[u-1].occurredAt):null;return e.jsxs(N.Fragment,{children:[o&&h&&h!==v&&e.jsx("p",{className:"px-3 pb-2 pt-4 text-xs text-muted-foreground first:pt-0",children:h}),e.jsx("div",{className:"mb-1",children:p.content})]},p.key)}),e.jsx("div",{ref:c,className:"h-1"}),i?e.jsx("div",{className:"flex justify-center py-4",children:e.jsx(Re,{size:"xl",className:"text-muted-foreground"})}):r&&e.jsx(E,{size:"sm",variant:"outline",disabled:a,onClick:l,children:"Load more"})]})}function kr({presentation:t="summary",renderDetail:n,onFiltersChange:s,hideDetails:r=!1,organizationId:a,ownerSlug:i,entityId:l,filters:m,showEntityLinks:o=!1,hideOriginator:c=!1,emptyState:p,foldConsecutiveCalls:u=!1,groupByConversation:h=!1,groupByRun:v=!1,onRunSelect:I,runs:_,hideRunAction:j=!1,hideAttribution:w=!1,hiddenApprovalRunIds:K}){const{isAuthenticated:P,isReady:F}=Mn(),{isMember:T,isLoading:g}=Bn(),B=i==="me",k=!B&&F&&P&&T,D=!B&&F&&(!P||!g&&!T),{data:f=[]}=zn(F&&k?a:null),{data:G=[]}=Un(D?i:null),R=k?f:G,L=Vn(F&&k?a:null,l,m,i),O=Hn(D?i:null,l,m),A=D?O:L,{data:V,isLoading:se,error:re,fetchNextPage:pe,hasNextPage:we,isFetchingNextPage:xe}=A,he=N.useMemo(()=>V?.pages.flatMap(x=>x.content)??[],[V]),Z=N.useMemo(()=>{const x=qn(he,{foldRunSatellites:!v}),d=x.map(q=>q.head),b=new Map(x.map(q=>[q.head.id,q])),C=Kn(d,{groupByRun:v}),J=Array.from(C.entries()).map(([q,M])=>{const W=M.root||M.replies[0],Ce=W?b.get(W.id):void 0;return{rootId:q,group:M,history:Ce?.history??[],runId:Ce?.runId??null}});return K?Jn(J,K):J},[he,v,K]),[X,de]=N.useState(new Set),[ee,ae]=N.useState(new Set),[fe,Y]=N.useState(new Set),[Q,ke]=N.useState(new Set),[ge,ye]=N.useState(new Set),ie=(x,d)=>x(b=>{const C=new Set(b);return C.has(d)?C.delete(d):C.add(d),C}),te=(x,d)=>d.some(b=>x.has(b)),je=(x,d)=>x(b=>{const C=new Set(b),J=d.some(q=>C.has(q));for(const q of d)J?C.delete(q):C.add(q);return C}),H=u?Qn(Z):Z.map(x=>({kind:"single",node:x})),ve=h?Wn(H):H,oe=!B&&(!F||P&&g||k&&A.isPending);if(re)return e.jsx(Gn,{label:"events"});const y=x=>{if(x.kind==="fold"){const{fold:S}=x,at=S.nodes.map(Ue=>Ue.rootId),Jt=te(ee,at);return[{key:S.key,occurredAt:S.newestAt,content:e.jsx(ur,{toolName:S.toolName,count:S.nodes.length,totalDurationMs:S.totalDurationMs,totalSdkCalls:S.totalSdkCalls,newestAt:S.newestAt,oldestAt:S.oldestAt,expanded:Jt,onToggle:()=>je(ae,at),children:S.nodes.map(Ue=>{const Ve=Ue.group.root;return Ve?e.jsx(Ie,{presentation:t,recordId:l,onFiltersChange:s,ownerSlug:i,content:Ve,renderDetail:n,connectorDefinitions:R,hideOriginator:c,hideRunAction:j,hideAttribution:w,hideDetails:r},Ve.id):null})})}]}const{rootId:d,group:b,history:C,runId:J}=x.node,q=b.replies.length>0,M=X.has(d),W=ge.has(d),Ce=Q.has(d),qt=b.replies.filter(S=>S.depth<=3),Ee=b.replies.filter(S=>S.depth>3),Kt=!b.root&&b.replies.length>0,ne=b.root||b.replies[0];return ne?[{key:d,occurredAt:ne.occurred_at,content:e.jsxs(e.Fragment,{children:[o&&i&&ne.entity_name&&ne.entity_type&&ne.entity_slug&&e.jsx("div",{className:"mb-2",children:e.jsx(ds,{ownerSlug:i,entity:{entityName:ne.entity_name,entityType:ne.entity_type,entitySlug:ne.entity_slug}})}),e.jsx(Ie,{presentation:t,recordId:l,onFiltersChange:s,ownerSlug:i,content:ne,renderDetail:n,showParentContext:Kt&&!!ne.parent_context,connectorDefinitions:R,hideOriginator:c,hideRunAction:j,hideAttribution:w,hideDetails:r}),C.length>0&&e.jsxs(De,{open:Ce,children:[e.jsx(Le,{asChild:!0,children:e.jsxs(E,{variant:"ghost",size:"sm",className:"mt-1 h-7 gap-1 text-xs text-muted-foreground",onClick:()=>ie(ke,d),children:[e.jsx(Yn,{className:"h-3.5 w-3.5"}),Ce?e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"h-3.5 w-3.5"}),"Hide ",J!=null?`run #${J} `:"","history"]}):e.jsxs(e.Fragment,{children:[e.jsx(_e,{className:"h-3.5 w-3.5"}),J!=null?`Run #${J} · ${C.length===1?"1 earlier step":`${C.length} earlier steps`}`:C.length===1?"1 earlier state":`${C.length} earlier states`]})]})}),e.jsx(Me,{className:"mt-2 space-y-3 border-l-2 border-l-muted pl-4",children:C.map(S=>e.jsxs("div",{children:[e.jsx("time",{dateTime:new Date(S.occurred_at).toISOString(),title:Ae(S.occurred_at),className:"mb-1 block text-xs text-muted-foreground",children:lt(S.occurred_at)}),e.jsx(Ie,{presentation:t,recordId:l,onFiltersChange:s,ownerSlug:i,content:S,connectorDefinitions:R,hideOriginator:c,hideRunAction:j,hideAttribution:w})]},S.id))})]}),q&&e.jsxs(De,{open:M,children:[e.jsx(Le,{asChild:!0,children:e.jsxs(E,{variant:"ghost",size:"sm",className:"mt-2 ml-6 gap-1",onClick:()=>ie(de,d),children:[e.jsx(He,{className:"h-3.5 w-3.5"}),M?e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"h-3.5 w-3.5"}),"Hide ",b.replies.length," replies"]}):e.jsxs(e.Fragment,{children:[e.jsx(_e,{className:"h-3.5 w-3.5"}),"Show ",b.replies.length," replies"]})]})}),e.jsxs(Me,{className:"space-y-2 mt-2",children:[qt.map(S=>e.jsx(Ie,{presentation:t,recordId:l,onFiltersChange:s,ownerSlug:i,content:S,isReply:!0,connectorDefinitions:R,hideOriginator:c,hideRunAction:j,hideAttribution:w},S.id)),Ee.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(E,{variant:"ghost",size:"sm",className:"ml-12",onClick:()=>ie(ye,d),children:W?e.jsxs(e.Fragment,{children:["Hide ",Ee.length," nested replies"]}):e.jsxs(e.Fragment,{children:["Show ",Ee.length," nested replies"]})}),W&&Ee.map(S=>e.jsx(Ie,{presentation:t,recordId:l,onFiltersChange:s,ownerSlug:i,content:S,isReply:!0,connectorDefinitions:R,hideOriginator:c,hideRunAction:j,hideAttribution:w},S.id))]})]})]})]})}]:[]},$=x=>{const d=x.nodes.length;return{key:x.key,occurredAt:x.newestAt,content:e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[I?e.jsxs(E,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-1 text-xs font-medium",onClick:()=>I(x.runId),title:`Open run #${x.runId} conversation`,children:[e.jsx(He,{className:"h-3.5 w-3.5"}),"Run #",x.runId]}):e.jsxs("span",{className:"inline-flex h-7 items-center gap-1 px-1 text-xs font-medium",children:[e.jsx(He,{className:"h-3.5 w-3.5"}),"Run #",x.runId]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.status!=null?`· ${me(x.status)} · `:"· ",d===1?"1 event":`${d} events`,x.newestAt!=null?` · ${lt(x.newestAt)}`:""]})]}),e.jsx("div",{className:"mt-2 space-y-2 border-l-2 border-l-muted pl-4",children:x.nodes.flatMap(b=>y({kind:"single",node:b}).map(C=>e.jsx(N.Fragment,{children:C.content},C.key)))})]})}},z=x=>{const{block:d}=x,b=d.entries.flatMap(M=>M.kind==="fold"?M.fold.nodes.map(W=>W.rootId):[M.node.rootId]),C=te(fe,b),J=d.entries.flatMap(M=>y(M).map(W=>({key:W.key,content:W.content})));if(J.length===0)return[];const q=d.entries.reduce((M,W)=>M+(W.kind==="fold"?W.fold.nodes.length:1),0);return[{key:d.key,occurredAt:d.newestAt,content:e.jsx(xr,{organizationId:a,clientId:d.clientId,activityId:d.activityId,activityKind:d.activityKind,callCount:q,newestAt:d.newestAt,oldestAt:d.oldestAt,expanded:C,onToggle:()=>je(Y,b),children:J.map(M=>e.jsx(N.Fragment,{children:M.content},M.key))})}]};return e.jsx(fr,{groupByDate:t==="summary",isLoading:se||oe,emptyState:p,hasNextPage:!!we,isFetching:A.isFetching,isFetchingNextPage:xe,onLoadMore:()=>void pe(),items:v?Xn(Z,_).map(x=>"nodes"in x?$(x):y({kind:"single",node:x})[0]).filter(x=>x!=null):ve.flatMap(x=>x.kind==="context"?z(x):y(x))})}export{kr as E,wr as L,bs as R,vs as S,fr as a,cr as b,br as c,_r as d,hs as i,_s as l,gs as s,Nr as u};
|
|
2
|
+
//# sourceMappingURL=events-feed-DsrkV2ix.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{dq as P,j as e,B as h,Q as g,r as m,dr as C,X as z,ds as k,dt as S,cT as O,C as B,du as D,dv as E,dw as F,dx as L,cE as $,cF as R,T as I,d1 as j,dy as Q,dz as _,dA as N,dB as b,I as y,dC as A}from"./index-DYCqXaMf.js";function w(s,t,n){return P(s,-t,n)}const T="w-72";function M({editor:s,close:t,header:n,footer:o}){const[r,a]=m.useState("");return e.jsxs(e.Fragment,{children:[n,s.kind==="list"?e.jsxs(D,{shouldFilter:!s.onQueryChange,children:[e.jsx(E,{autoFocus:!0,placeholder:s.searchPlaceholder,value:r,onValueChange:d=>{a(d),s.onQueryChange?.(d)}}),e.jsxs(F,{children:[e.jsx(L,{children:s.emptyText}),e.jsx($,{children:s.items(t,r)})]})]}):s.render(t),o]})}function q({chip:s,editor:t}){const[n,o]=m.useState(!1),r=s.onRemove!=null,a=[s.label,s.op,s.value].filter(Boolean).join(" "),d=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:s.label}),s.op?e.jsx("span",{className:"text-muted-foreground",children:s.op}):null,e.jsx("span",{className:"min-w-0 truncate font-medium",children:s.value})]}),l=t?e.jsx(S,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Edit filter: ${a}`,className:"flex min-w-0 items-center gap-1.5 pl-2.5 pr-1 focus-visible:outline-none",children:d})}):e.jsx("span",{className:"flex min-w-0 items-center gap-1.5 pl-2.5 pr-1",children:d});return e.jsxs(C,{open:n,onOpenChange:o,children:[e.jsxs("div",{"data-filter-chip":s.id,title:s.title,className:g("inline-flex h-8 max-w-full items-stretch rounded-md border text-sm",s.tone==="warning"?"border-amber-500/60 bg-amber-500/10":r?"bg-muted":"border-dashed bg-transparent",n&&"ring-1 ring-ring",!r&&"pr-1.5"),children:[l,r?e.jsx("button",{type:"button","aria-label":`Remove filter: ${a}`,onClick:s.onRemove,className:"flex w-7 shrink-0 items-center justify-center text-muted-foreground transition-colors hover:text-foreground",children:e.jsx(z,{className:"h-3.5 w-3.5"})}):null]}),t?e.jsx(k,{align:"start",className:g("p-0",T,t.className),children:e.jsx(M,{editor:t,close:()=>o(!1),footer:r?e.jsx("div",{className:"border-t p-1",children:e.jsx(h,{variant:"ghost",size:"sm",className:"w-full justify-start text-destructive hover:text-destructive",onClick:()=>{o(!1),s.onRemove?.()},children:"Remove filter"})}):null})}):null]})}function H({fields:s}){const[t,n]=m.useState(!1),[o,r]=m.useState(),a=s.find(i=>i.key===o),d=[...new Set(s.map(i=>i.group??""))],l=()=>{n(!1),r(void 0)};return e.jsxs(C,{open:t,onOpenChange:i=>{n(i),i||r(void 0)},children:[e.jsx(S,{asChild:!0,children:e.jsxs(h,{variant:"outline",size:"sm",className:"h-8 border-dashed font-normal text-muted-foreground",children:[e.jsx(O,{className:"mr-1 h-3.5 w-3.5"}),"Filter"]})}),e.jsx(k,{align:"start",className:g("p-0",T,a?.editor.className),children:a?e.jsx(M,{editor:a.editor,close:l,header:e.jsxs("div",{className:"flex items-center gap-1 border-b px-1 py-1 text-sm font-medium",children:[e.jsx(h,{variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":"Back to filters",onClick:()=>r(void 0),children:e.jsx(B,{className:"h-4 w-4"})}),a.label]})},a.key):e.jsxs(D,{children:[e.jsx(E,{autoFocus:!0,placeholder:"Filter by…"}),e.jsxs(F,{children:[e.jsx(L,{children:"No matching filter"}),d.map(i=>e.jsx($,{heading:i||void 0,children:s.filter(c=>(c.group??"")===i).map(c=>e.jsxs(R,{value:`${c.label} ${c.key}`,onSelect:()=>r(c.key),className:"gap-2",children:[c.icon?e.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground",children:c.icon}):null,c.label]},c.key))},i))]})]})})]})}function K({fields:s,chips:t,meta:n,actions:o,trailing:r,onClearAll:a,hasClearableState:d=!1,className:l,label:i="Filters"}){const c=s.filter(u=>u.inMenu!==!1),x=t.filter(u=>u.onRemove).length;return e.jsxs("div",{role:"search","aria-label":i,className:g("flex min-w-0 flex-wrap items-center gap-2",l),children:[t.map(u=>e.jsx(q,{chip:u,editor:u.editor??s.find(f=>f.key===(u.field??u.id))?.editor},u.id)),c.length>0?e.jsx(H,{fields:c}):null,o,e.jsxs("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:[n?e.jsx("span",{className:"text-sm text-muted-foreground",children:n}):null,a&&(x>0||d)?e.jsx(h,{variant:"ghost",size:"sm",className:"h-8 text-muted-foreground",onClick:a,children:"Clear all"}):null,r]})]})}function U({selected:s}){return e.jsx(Q,{className:g("h-4 w-4 shrink-0",s?"opacity-100":"opacity-0")})}function Y({searchPlaceholder:s,emptyText:t="No options",options:n,selected:o,multiple:r=!1,onSelect:a}){return{kind:"list",searchPlaceholder:s,emptyText:t,items:d=>n.map(l=>{const i=o.includes(l.value);return e.jsxs(R,{value:`${l.label} ${l.keywords??l.value}`,onSelect:()=>{a(l.value),r||d()},className:"gap-2",children:[r?e.jsx(I,{checked:i,className:"mr-1"}):e.jsx(U,{selected:i}),l.icon,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:l.label}),l.count!=null?e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:l.count.toLocaleString()}):null]},l.value)})}}function Z([s,t],n,o){return s<=n?`≤ ${t}`:t>=o?`≥ ${s}`:`${s}–${t}`}function V({value:s,min:t,max:n,onApply:o,close:r}){const[a,d]=m.useState(String(s?.[0]??t)),[l,i]=m.useState(String(s?.[1]??n)),[c,x]=m.useState(),u=f=>{f.preventDefault();const v=Number(a),p=Number(l);if(!Number.isFinite(v)||!Number.isFinite(p)){x("Enter a number.");return}if(v<t||p>n){x(`Use values between ${t} and ${n}.`);return}if(v>p){x("The lower bound must not exceed the upper bound.");return}o([v,p]),r()};return e.jsxs("form",{className:"space-y-3 p-3",onSubmit:u,children:[e.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-center gap-2",children:[e.jsx(y,{"aria-label":"From",type:"number",min:t,max:n,value:a,onChange:f=>d(f.target.value)}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"to"}),e.jsx(y,{"aria-label":"To",type:"number",min:t,max:n,value:l,onChange:f=>i(f.target.value)})]}),c?e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:c}):null,e.jsx(h,{type:"submit",size:"sm",className:"w-full",children:"Apply"})]})}function ee(s){return{kind:"custom",render:t=>e.jsx(V,{...s,close:t})}}const G=[{label:"Today",range:()=>[N(new Date),b(new Date)]},{label:"Last 7 days",range:()=>[N(w(new Date,6)),b(new Date)]},{label:"Last 30 days",range:()=>[N(w(new Date,29)),b(new Date)]},{label:"This month",range:()=>[A(new Date),b(new Date)]}];function se([s,t]){return j(s,"yyyy-MM-dd")===j(t,"yyyy-MM-dd")?j(s,"LLL d, y"):`${j(s,"LLL d")} – ${j(t,"LLL d, y")}`}function W({value:s,onApply:t,close:n}){const[o,r]=m.useState(s?{from:s[0],to:s[1]}:void 0);return e.jsxs("div",{className:"flex flex-col sm:flex-row",children:[e.jsx("div",{className:"flex flex-col gap-0.5 border-b p-2 sm:w-36 sm:border-b-0 sm:border-r",children:G.map(a=>e.jsx(h,{variant:"ghost",size:"sm",className:"justify-start font-normal",onClick:()=>{t(a.range()),n()},children:a.label},a.label))}),e.jsx(_,{mode:"range",defaultMonth:o?.from,selected:o,onSelect:a=>{r(a),a?.from&&a.to&&a.from!==a.to&&(t([N(a.from),b(a.to)]),n())},numberOfMonths:1})]})}function te(s){return{kind:"custom",className:"w-auto",render:t=>e.jsx(W,{...s,close:t})}}function X({type:s,label:t,value:n,onApply:o,close:r}){const[a,d]=m.useState(n==null?"":String(n)),[l,i]=m.useState(),c=x=>{if(x.preventDefault(),s==="number"){const u=Number(a);if(a.trim()===""||!Number.isFinite(u)){i("Enter a number.");return}o(u)}else o(a);r()};return e.jsxs("form",{className:"space-y-3 p-3",onSubmit:c,children:[e.jsx(y,{autoFocus:!0,"aria-label":t,type:s,step:s==="number"?"any":void 0,value:a,onChange:x=>d(x.target.value),placeholder:"Enter a value…"}),l?e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:l}):null,e.jsx(h,{type:"submit",size:"sm",className:"w-full",children:"Apply"})]})}function ae(s){return{kind:"custom",render:t=>e.jsx(X,{...s,close:t})}}export{K as F,U as S,Z as a,te as d,se as f,Y as o,ee as r,ae as v};
|
|
2
|
+
//# sourceMappingURL=filter-editors-B1_QUpg_.js.map
|
package/dist/owletto/dist/assets/{full-page-spinner-DqpH99np.js → full-page-spinner-Cqih-8IW.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r,j as t,
|
|
2
|
-
//# sourceMappingURL=full-page-spinner-
|
|
1
|
+
import{r,j as t,Q as u}from"./index-DYCqXaMf.js";function l({className:i,delayMs:e=500}){const[s,n]=r.useState(e<=0);return r.useEffect(()=>{if(e<=0)return;const a=setTimeout(()=>n(!0),e);return()=>clearTimeout(a)},[e]),s?t.jsx("div",{className:u("flex min-h-[50vh] items-center justify-center",i),role:"status","aria-label":"Loading",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):null}export{l as F};
|
|
2
|
+
//# sourceMappingURL=full-page-spinner-Cqih-8IW.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{iO as t,j as r}from"./index-DYCqXaMf.js";import{a as i}from"./agents-workbench-CqaKGggb.js";import"./agent-editor-form-Bi6WvYX-.js";import"./model-selector-TQcA93xm.js";import"./proposal-review-shell-DsNiavG_.js";function c(){const{owner:o,agentId:e}=t.useParams(),n=t.useSearch();return r.jsx(i,{owner:o,agentId:e,tab:"identity",runId:n.run_id})}export{c as component};
|
|
2
|
+
//# sourceMappingURL=identity-B0nH4yiC.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{aq as s,ar as m,j as o}from"./index-DYCqXaMf.js";import{A as n}from"./activity-route-view-CFLNukhD.js";import{E as p}from"./events-feed-DsrkV2ix.js";import"./record-activity-C9KfBkXb.js";import"./filter-editors-B1_QUpg_.js";import"./connection-label-BobuYiAG.js";import"./source-record-panels-Cg249m1S.js";import"./clients-L4K1UT8c.js";import"./client-rows--FrZfJol.js";import"./schema-value-normalization-CylKX3PK.js";import"./card-yU0TmNRH.js";import"./agent-loading-shells-De_2d8Lr.js";import"./member-scope-gate-B2LrMWBU.js";import"./public-shell-ready-B2NUI89V.js";import"./conversations-table-BSznfdYt.js";function A(){const{owner:r}=s.useParams(),e=s.useSearch();if(r==="me"){const t=m(e),i={sortBy:"date",sortOrder:"desc",...t.contentIds?.length?{contentIds:t.contentIds}:{clientIds:t.clientIds,mcpActivityId:t.mcpActivityId}};return o.jsxs("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-6 px-4 pt-2.5 pb-8 lg:px-6",children:[o.jsx("h1",{className:"text-lg font-semibold",children:"Your MCP activity"}),o.jsx(p,{organizationId:null,ownerSlug:"me",filters:i})]})}return o.jsx(n,{owner:r,search:e})}export{A as component};
|
|
2
|
+
//# sourceMappingURL=index-4TSkcsth.js.map
|